@burdenoff/microfe-admin 2026.1030.1 → 2026.1107.1

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 (336) hide show
  1. package/dist/admin/AdminRoot.d.ts +29 -0
  2. package/dist/admin/AdminRoot.js +34 -31
  3. package/dist/admin/AdminRoot.js.map +1 -1
  4. package/dist/admin/AdminRoutes.d.ts +28 -0
  5. package/dist/admin/AdminRoutes.js +17 -18
  6. package/dist/admin/AdminRoutes.js.map +1 -1
  7. package/dist/admin/components/AccessDenied.d.ts +6 -0
  8. package/dist/admin/components/AccessDenied.js +1 -2
  9. package/dist/admin/components/AccessDenied.js.map +1 -1
  10. package/dist/admin/components/ActivityFeed.d.ts +18 -0
  11. package/dist/admin/components/ActivityFeed.js +23 -24
  12. package/dist/admin/components/ActivityFeed.js.map +1 -1
  13. package/dist/admin/components/Charts.d.ts +31 -0
  14. package/dist/admin/components/Charts.js +14 -15
  15. package/dist/admin/components/Charts.js.map +1 -1
  16. package/dist/admin/components/ConfirmDialog.d.ts +43 -0
  17. package/dist/admin/components/ConfirmDialog.js +7 -8
  18. package/dist/admin/components/ConfirmDialog.js.map +1 -1
  19. package/dist/admin/components/DataTable.d.ts +62 -0
  20. package/dist/admin/components/DataTable.js +37 -38
  21. package/dist/admin/components/DataTable.js.map +1 -1
  22. package/dist/admin/components/FormSheet.d.ts +78 -0
  23. package/dist/admin/components/FormSheet.js +1 -2
  24. package/dist/admin/components/FormSheet.js.map +1 -1
  25. package/dist/admin/components/MarkdownEditor.d.ts +27 -0
  26. package/dist/admin/components/MarkdownEditor.js +1 -2
  27. package/dist/admin/components/MarkdownEditor.js.map +1 -1
  28. package/dist/admin/components/MetricCard.d.ts +43 -0
  29. package/dist/admin/components/MetricCard.js +9 -10
  30. package/dist/admin/components/MetricCard.js.map +1 -1
  31. package/dist/admin/components/PageLayout.d.ts +43 -0
  32. package/dist/admin/components/PageLayout.js +1 -2
  33. package/dist/admin/components/PageLayout.js.map +1 -1
  34. package/dist/admin/components/PermissionGuard.d.ts +10 -0
  35. package/dist/admin/components/PermissionGuard.js +1 -2
  36. package/dist/admin/components/PermissionGuard.js.map +1 -1
  37. package/dist/admin/components/RowActions.d.ts +39 -0
  38. package/dist/admin/components/RowActions.js +13 -14
  39. package/dist/admin/components/RowActions.js.map +1 -1
  40. package/dist/admin/components/StatusBadge.d.ts +33 -0
  41. package/dist/admin/components/StatusBadge.js +11 -12
  42. package/dist/admin/components/StatusBadge.js.map +1 -1
  43. package/dist/admin/components/TenantMembersPanel.d.ts +12 -0
  44. package/dist/admin/components/TenantMembersPanel.js +25 -26
  45. package/dist/admin/components/TenantMembersPanel.js.map +1 -1
  46. package/dist/admin/components/TenantSsoPanel.d.ts +6 -0
  47. package/dist/admin/components/TenantSsoPanel.js +21 -22
  48. package/dist/admin/components/TenantSsoPanel.js.map +1 -1
  49. package/dist/admin/components/Toast.d.ts +24 -0
  50. package/dist/admin/components/Toast.js +1 -2
  51. package/dist/admin/components/Toast.js.map +1 -1
  52. package/dist/admin/components/forms/SubscriptionForm.d.ts +56 -0
  53. package/dist/admin/components/forms/SubscriptionForm.js +22 -23
  54. package/dist/admin/components/forms/SubscriptionForm.js.map +1 -1
  55. package/dist/admin/components/forms/TenantForm.d.ts +67 -0
  56. package/dist/admin/components/forms/TenantForm.js +52 -50
  57. package/dist/admin/components/forms/TenantForm.js.map +1 -1
  58. package/dist/admin/components/forms/TicketForm.d.ts +66 -0
  59. package/dist/admin/components/forms/TicketForm.js +4 -5
  60. package/dist/admin/components/forms/TicketForm.js.map +1 -1
  61. package/dist/admin/components/forms/UserForm.d.ts +56 -0
  62. package/dist/admin/components/forms/UserForm.js +39 -40
  63. package/dist/admin/components/forms/UserForm.js.map +1 -1
  64. package/dist/admin/components/forms/index.d.ts +4 -0
  65. package/dist/admin/components/forms/index.js +4 -3
  66. package/dist/admin/components/index.d.ts +15 -0
  67. package/dist/admin/components/index.js +18 -17
  68. package/dist/admin/components/ui.d.ts +58 -0
  69. package/dist/admin/components/ui.js +1 -2
  70. package/dist/admin/components/ui.js.map +1 -1
  71. package/dist/admin/constants/featureFlags.d.ts +8 -0
  72. package/dist/admin/constants/featureFlags.js +1 -2
  73. package/dist/admin/constants/featureFlags.js.map +1 -1
  74. package/dist/admin/constants/index.d.ts +75 -0
  75. package/dist/admin/constants/index.js +1 -2
  76. package/dist/admin/constants/index.js.map +1 -1
  77. package/dist/admin/constants/permissions.d.ts +28 -0
  78. package/dist/admin/constants/permissions.js +1 -2
  79. package/dist/admin/constants/permissions.js.map +1 -1
  80. package/dist/admin/hooks/useAdminPermissions.d.ts +40 -0
  81. package/dist/admin/hooks/useAdminPermissions.js +2 -3
  82. package/dist/admin/hooks/useAdminPermissions.js.map +1 -1
  83. package/dist/admin/hooks/useTr.d.ts +16 -0
  84. package/dist/admin/hooks/useTr.js +1 -2
  85. package/dist/admin/hooks/useTr.js.map +1 -1
  86. package/dist/admin/index.d.ts +30 -0
  87. package/dist/admin/index.js +9 -8
  88. package/dist/admin/pages/AiSpendPage.d.ts +1 -0
  89. package/dist/admin/pages/AiSpendPage.js +130 -131
  90. package/dist/admin/pages/AiSpendPage.js.map +1 -1
  91. package/dist/admin/pages/AuditLogsPage.d.ts +4 -0
  92. package/dist/admin/pages/AuditLogsPage.js +17 -18
  93. package/dist/admin/pages/AuditLogsPage.js.map +1 -1
  94. package/dist/admin/pages/BillingPage.d.ts +1 -0
  95. package/dist/admin/pages/BillingPage.js +17 -18
  96. package/dist/admin/pages/BillingPage.js.map +1 -1
  97. package/dist/admin/pages/CommunicationsPage.d.ts +1 -0
  98. package/dist/admin/pages/CommunicationsPage.js +15 -16
  99. package/dist/admin/pages/CommunicationsPage.js.map +1 -1
  100. package/dist/admin/pages/ContentPagesPage.d.ts +1 -0
  101. package/dist/admin/pages/ContentPagesPage.js +120 -121
  102. package/dist/admin/pages/ContentPagesPage.js.map +1 -1
  103. package/dist/admin/pages/DashboardPage.d.ts +4 -0
  104. package/dist/admin/pages/DashboardPage.js +1 -2
  105. package/dist/admin/pages/DashboardPage.js.map +1 -1
  106. package/dist/admin/pages/ExploreConversationsPage.d.ts +12 -0
  107. package/dist/admin/pages/ExploreConversationsPage.js +48 -46
  108. package/dist/admin/pages/ExploreConversationsPage.js.map +1 -1
  109. package/dist/admin/pages/FeatureFlagsPage.d.ts +1 -0
  110. package/dist/admin/pages/FeatureFlagsPage.js +1 -2
  111. package/dist/admin/pages/FeatureFlagsPage.js.map +1 -1
  112. package/dist/admin/pages/OrganizationsListPage.d.ts +1 -0
  113. package/dist/admin/pages/OrganizationsListPage.js +1 -2
  114. package/dist/admin/pages/OrganizationsListPage.js.map +1 -1
  115. package/dist/admin/pages/ProductsPage.d.ts +4 -0
  116. package/dist/admin/pages/ProductsPage.js +27 -28
  117. package/dist/admin/pages/ProductsPage.js.map +1 -1
  118. package/dist/admin/pages/ReferralsPage.d.ts +1 -0
  119. package/dist/admin/pages/ReferralsPage.js +20 -25
  120. package/dist/admin/pages/ReferralsPage.js.map +1 -1
  121. package/dist/admin/pages/RolesPermissionsPage.d.ts +1 -0
  122. package/dist/admin/pages/RolesPermissionsPage.js +1 -2
  123. package/dist/admin/pages/RolesPermissionsPage.js.map +1 -1
  124. package/dist/admin/pages/SREPage.d.ts +4 -0
  125. package/dist/admin/pages/SREPage.js +22 -23
  126. package/dist/admin/pages/SREPage.js.map +1 -1
  127. package/dist/admin/pages/SandboxSettingsPage.d.ts +6 -0
  128. package/dist/admin/pages/SandboxSettingsPage.js +79 -84
  129. package/dist/admin/pages/SandboxSettingsPage.js.map +1 -1
  130. package/dist/admin/pages/SettingsPage.d.ts +4 -0
  131. package/dist/admin/pages/SettingsPage.js +39 -40
  132. package/dist/admin/pages/SettingsPage.js.map +1 -1
  133. package/dist/admin/pages/SyncFailuresPage.d.ts +13 -0
  134. package/dist/admin/pages/SyncFailuresPage.js +121 -122
  135. package/dist/admin/pages/SyncFailuresPage.js.map +1 -1
  136. package/dist/admin/pages/TenantDetailPage.d.ts +4 -0
  137. package/dist/admin/pages/TenantDetailPage.js +53 -54
  138. package/dist/admin/pages/TenantDetailPage.js.map +1 -1
  139. package/dist/admin/pages/TenantFormRoutePage.d.ts +5 -0
  140. package/dist/admin/pages/TenantFormRoutePage.js +45 -47
  141. package/dist/admin/pages/TenantFormRoutePage.js.map +1 -1
  142. package/dist/admin/pages/TenantsListPage.d.ts +4 -0
  143. package/dist/admin/pages/TenantsListPage.js +35 -36
  144. package/dist/admin/pages/TenantsListPage.js.map +1 -1
  145. package/dist/admin/pages/UsersListPage.d.ts +4 -0
  146. package/dist/admin/pages/UsersListPage.js +29 -30
  147. package/dist/admin/pages/UsersListPage.js.map +1 -1
  148. package/dist/admin/pages/WaitlistPage.d.ts +1 -0
  149. package/dist/admin/pages/WaitlistPage.js +9 -10
  150. package/dist/admin/pages/WaitlistPage.js.map +1 -1
  151. package/dist/admin/pages/WorkflowsPage.d.ts +1 -0
  152. package/dist/admin/pages/WorkflowsPage.js +13 -14
  153. package/dist/admin/pages/WorkflowsPage.js.map +1 -1
  154. package/dist/admin/pages/WorkspacesListPage.d.ts +2 -0
  155. package/dist/admin/pages/WorkspacesListPage.js +25 -26
  156. package/dist/admin/pages/WorkspacesListPage.js.map +1 -1
  157. package/dist/admin/pages/aiSpend/aiSpendFormat.d.ts +34 -0
  158. package/dist/admin/pages/aiSpend/aiSpendFormat.js +3 -3
  159. package/dist/admin/pages/aiSpend/aiSpendFormat.js.map +1 -1
  160. package/dist/admin/pages/index.d.ts +23 -0
  161. package/dist/admin/pages/index.js +1 -1
  162. package/dist/admin/providers/AdminProvider.d.ts +11 -0
  163. package/dist/admin/providers/AdminProvider.js +8 -9
  164. package/dist/admin/providers/AdminProvider.js.map +1 -1
  165. package/dist/admin/schemas/index.d.ts +337 -0
  166. package/dist/admin/schemas/index.js +2 -3
  167. package/dist/admin/schemas/index.js.map +1 -1
  168. package/dist/admin/store/adminStore.d.ts +26 -0
  169. package/dist/admin/store/adminStore.js +1 -2
  170. package/dist/admin/store/adminStore.js.map +1 -1
  171. package/dist/admin/types/index.d.ts +323 -0
  172. package/dist/admin/utils/cn.d.ts +5 -0
  173. package/dist/admin/utils/cn.js +2 -3
  174. package/dist/admin/utils/cn.js.map +1 -1
  175. package/dist/admin/utils/directActivityGraphql.d.ts +10 -0
  176. package/dist/admin/utils/directActivityGraphql.js +1 -2
  177. package/dist/admin/utils/directActivityGraphql.js.map +1 -1
  178. package/dist/admin/utils/formatters.d.ts +32 -0
  179. package/dist/admin/utils/formatters.js +12 -11
  180. package/dist/admin/utils/formatters.js.map +1 -1
  181. package/dist/admin/utils/gatewayGraphql.d.ts +8 -0
  182. package/dist/admin/utils/i18n.d.ts +4 -0
  183. package/dist/admin/utils/i18n.js +1 -2
  184. package/dist/admin/utils/i18n.js.map +1 -1
  185. package/dist/admin/utils/mappers.d.ts +13 -0
  186. package/dist/admin/utils/mappers.js +2 -3
  187. package/dist/admin/utils/mappers.js.map +1 -1
  188. package/dist/admin/utils/navigation.d.ts +8 -0
  189. package/dist/admin/utils/navigation.js +1 -2
  190. package/dist/admin/utils/navigation.js.map +1 -1
  191. package/dist/admin/utils/tenantEvents.d.ts +9 -0
  192. package/dist/admin/utils/tenantEvents.js +1 -2
  193. package/dist/admin/utils/tenantEvents.js.map +1 -1
  194. package/dist/dev/main.d.ts +0 -0
  195. package/dist/generated/global-operations.d.ts +3410 -0
  196. package/dist/generated/global-operations.js +137 -138
  197. package/dist/generated/global-operations.js.map +1 -1
  198. package/dist/generated/global-types.d.ts +27174 -0
  199. package/dist/generated/global-types.js +1 -2
  200. package/dist/generated/global-types.js.map +1 -1
  201. package/dist/generated/wspace-operations.d.ts +224 -0
  202. package/dist/generated/wspace-operations.js +2 -3
  203. package/dist/generated/wspace-operations.js.map +1 -1
  204. package/dist/generated/wspace-types.d.ts +123963 -0
  205. package/dist/index.d.ts +5 -0
  206. package/dist/node_modules/@hookform/resolvers/dist/resolvers.js +4 -5
  207. package/dist/node_modules/@hookform/resolvers/dist/resolvers.js.map +1 -1
  208. package/dist/node_modules/@hookform/resolvers/zod/dist/zod.js +83 -75
  209. package/dist/node_modules/@hookform/resolvers/zod/dist/zod.js.map +1 -1
  210. package/dist/node_modules/clsx/dist/clsx.js +8 -7
  211. package/dist/node_modules/clsx/dist/clsx.js.map +1 -1
  212. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js +1 -2
  213. package/dist/node_modules/date-fns/_lib/addLeadingZeros.js.map +1 -1
  214. package/dist/node_modules/date-fns/_lib/defaultOptions.js +1 -2
  215. package/dist/node_modules/date-fns/_lib/defaultOptions.js.map +1 -1
  216. package/dist/node_modules/date-fns/_lib/format/formatters.js +27 -21
  217. package/dist/node_modules/date-fns/_lib/format/formatters.js.map +1 -1
  218. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js +3 -4
  219. package/dist/node_modules/date-fns/_lib/format/lightFormatters.js.map +1 -1
  220. package/dist/node_modules/date-fns/_lib/format/longFormatters.js +2 -5
  221. package/dist/node_modules/date-fns/_lib/format/longFormatters.js.map +1 -1
  222. package/dist/node_modules/date-fns/_lib/getRoundingMethod.js +1 -2
  223. package/dist/node_modules/date-fns/_lib/getRoundingMethod.js.map +1 -1
  224. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js +2 -3
  225. package/dist/node_modules/date-fns/_lib/getTimezoneOffsetInMilliseconds.js.map +1 -1
  226. package/dist/node_modules/date-fns/_lib/normalizeDates.js +2 -3
  227. package/dist/node_modules/date-fns/_lib/normalizeDates.js.map +1 -1
  228. package/dist/node_modules/date-fns/_lib/protectedTokens.js +1 -2
  229. package/dist/node_modules/date-fns/_lib/protectedTokens.js.map +1 -1
  230. package/dist/node_modules/date-fns/compareAsc.js +3 -4
  231. package/dist/node_modules/date-fns/compareAsc.js.map +1 -1
  232. package/dist/node_modules/date-fns/constants.js +5 -6
  233. package/dist/node_modules/date-fns/constants.js.map +1 -1
  234. package/dist/node_modules/date-fns/constructFrom.js +2 -3
  235. package/dist/node_modules/date-fns/constructFrom.js.map +1 -1
  236. package/dist/node_modules/date-fns/constructNow.js +3 -4
  237. package/dist/node_modules/date-fns/constructNow.js.map +1 -1
  238. package/dist/node_modules/date-fns/differenceInCalendarDays.js +7 -8
  239. package/dist/node_modules/date-fns/differenceInCalendarDays.js.map +1 -1
  240. package/dist/node_modules/date-fns/differenceInCalendarMonths.js +2 -3
  241. package/dist/node_modules/date-fns/differenceInCalendarMonths.js.map +1 -1
  242. package/dist/node_modules/date-fns/differenceInMilliseconds.js +3 -4
  243. package/dist/node_modules/date-fns/differenceInMilliseconds.js.map +1 -1
  244. package/dist/node_modules/date-fns/differenceInMonths.js +3 -4
  245. package/dist/node_modules/date-fns/differenceInMonths.js.map +1 -1
  246. package/dist/node_modules/date-fns/differenceInSeconds.js +2 -3
  247. package/dist/node_modules/date-fns/differenceInSeconds.js.map +1 -1
  248. package/dist/node_modules/date-fns/endOfDay.js +2 -3
  249. package/dist/node_modules/date-fns/endOfDay.js.map +1 -1
  250. package/dist/node_modules/date-fns/endOfMonth.js +2 -3
  251. package/dist/node_modules/date-fns/endOfMonth.js.map +1 -1
  252. package/dist/node_modules/date-fns/format.js +15 -16
  253. package/dist/node_modules/date-fns/format.js.map +1 -1
  254. package/dist/node_modules/date-fns/formatDistance.js +23 -21
  255. package/dist/node_modules/date-fns/formatDistance.js.map +1 -1
  256. package/dist/node_modules/date-fns/formatDistanceToNow.js +3 -4
  257. package/dist/node_modules/date-fns/formatDistanceToNow.js.map +1 -1
  258. package/dist/node_modules/date-fns/getDayOfYear.js +7 -8
  259. package/dist/node_modules/date-fns/getDayOfYear.js.map +1 -1
  260. package/dist/node_modules/date-fns/getISOWeek.js +6 -7
  261. package/dist/node_modules/date-fns/getISOWeek.js.map +1 -1
  262. package/dist/node_modules/date-fns/getISOWeekYear.js +8 -9
  263. package/dist/node_modules/date-fns/getISOWeekYear.js.map +1 -1
  264. package/dist/node_modules/date-fns/getWeek.js +6 -7
  265. package/dist/node_modules/date-fns/getWeek.js.map +1 -1
  266. package/dist/node_modules/date-fns/getWeekYear.js +9 -10
  267. package/dist/node_modules/date-fns/getWeekYear.js.map +1 -1
  268. package/dist/node_modules/date-fns/isDate.js +2 -3
  269. package/dist/node_modules/date-fns/isDate.js.map +1 -1
  270. package/dist/node_modules/date-fns/isLastDayOfMonth.js +7 -8
  271. package/dist/node_modules/date-fns/isLastDayOfMonth.js.map +1 -1
  272. package/dist/node_modules/date-fns/isValid.js +5 -6
  273. package/dist/node_modules/date-fns/isValid.js.map +1 -1
  274. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js +1 -2
  275. package/dist/node_modules/date-fns/locale/_lib/buildFormatLongFn.js.map +1 -1
  276. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js +1 -2
  277. package/dist/node_modules/date-fns/locale/_lib/buildLocalizeFn.js.map +1 -1
  278. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js +1 -2
  279. package/dist/node_modules/date-fns/locale/_lib/buildMatchFn.js.map +1 -1
  280. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js +1 -2
  281. package/dist/node_modules/date-fns/locale/_lib/buildMatchPatternFn.js.map +1 -1
  282. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js +1 -2
  283. package/dist/node_modules/date-fns/locale/en-US/_lib/formatDistance.js.map +1 -1
  284. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js +0 -1
  285. package/dist/node_modules/date-fns/locale/en-US/_lib/formatLong.js.map +1 -1
  286. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js +1 -2
  287. package/dist/node_modules/date-fns/locale/en-US/_lib/formatRelative.js.map +1 -1
  288. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js +0 -1
  289. package/dist/node_modules/date-fns/locale/en-US/_lib/localize.js.map +1 -1
  290. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js +0 -1
  291. package/dist/node_modules/date-fns/locale/en-US/_lib/match.js.map +1 -1
  292. package/dist/node_modules/date-fns/locale/en-US.js +2 -3
  293. package/dist/node_modules/date-fns/locale/en-US.js.map +1 -1
  294. package/dist/node_modules/date-fns/parseISO.js +3 -4
  295. package/dist/node_modules/date-fns/parseISO.js.map +1 -1
  296. package/dist/node_modules/date-fns/startOfDay.js +2 -3
  297. package/dist/node_modules/date-fns/startOfDay.js.map +1 -1
  298. package/dist/node_modules/date-fns/startOfISOWeek.js +2 -3
  299. package/dist/node_modules/date-fns/startOfISOWeek.js.map +1 -1
  300. package/dist/node_modules/date-fns/startOfISOWeekYear.js +7 -8
  301. package/dist/node_modules/date-fns/startOfISOWeekYear.js.map +1 -1
  302. package/dist/node_modules/date-fns/startOfWeek.js +5 -6
  303. package/dist/node_modules/date-fns/startOfWeek.js.map +1 -1
  304. package/dist/node_modules/date-fns/startOfWeekYear.js +8 -9
  305. package/dist/node_modules/date-fns/startOfWeekYear.js.map +1 -1
  306. package/dist/node_modules/date-fns/startOfYear.js +2 -3
  307. package/dist/node_modules/date-fns/startOfYear.js.map +1 -1
  308. package/dist/node_modules/date-fns/toDate.js +3 -4
  309. package/dist/node_modules/date-fns/toDate.js.map +1 -1
  310. package/dist/node_modules/react-hook-form/dist/index.esm.js +1145 -861
  311. package/dist/node_modules/react-hook-form/dist/index.esm.js.map +1 -1
  312. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +229 -167
  313. package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js.map +1 -1
  314. package/dist/node_modules/zod/v3/ZodError.js +1 -2
  315. package/dist/node_modules/zod/v3/ZodError.js.map +1 -1
  316. package/dist/node_modules/zod/v3/errors.js +2 -3
  317. package/dist/node_modules/zod/v3/errors.js.map +1 -1
  318. package/dist/node_modules/zod/v3/helpers/errorUtil.js +1 -2
  319. package/dist/node_modules/zod/v3/helpers/errorUtil.js.map +1 -1
  320. package/dist/node_modules/zod/v3/helpers/parseUtil.js +5 -6
  321. package/dist/node_modules/zod/v3/helpers/parseUtil.js.map +1 -1
  322. package/dist/node_modules/zod/v3/helpers/util.js +2 -3
  323. package/dist/node_modules/zod/v3/helpers/util.js.map +1 -1
  324. package/dist/node_modules/zod/v3/locales/en.js +26 -27
  325. package/dist/node_modules/zod/v3/locales/en.js.map +1 -1
  326. package/dist/node_modules/zod/v3/types.js +966 -956
  327. package/dist/node_modules/zod/v3/types.js.map +1 -1
  328. package/package.json +66 -59
  329. package/dist/node_modules/zod/v4/core/core.js +0 -35
  330. package/dist/node_modules/zod/v4/core/core.js.map +0 -1
  331. package/dist/node_modules/zod/v4/core/errors.js +0 -24
  332. package/dist/node_modules/zod/v4/core/errors.js.map +0 -1
  333. package/dist/node_modules/zod/v4/core/parse.js +0 -29
  334. package/dist/node_modules/zod/v4/core/parse.js.map +0 -1
  335. package/dist/node_modules/zod/v4/core/util.js +0 -20
  336. package/dist/node_modules/zod/v4/core/util.js.map +0 -1
@@ -1,33 +1,39 @@
1
1
  import e from "react";
2
- //#region 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
+ // 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);
4
+ function u(e, t) {
5
+ let n = l(t), r = e._formValues, i = e._defaultValues;
6
+ for (let e = 0; e < n.length - 1; e++) {
7
+ let t = n[e];
8
+ if (r = r == null ? r : r[t], i = i == null ? i : i[t], r === null || i === null) return null;
9
+ }
10
+ }
11
+ var d = (e, t) => t.split(".").some((t, n, r) => !isNaN(Number(t)) && e.has(r.slice(0, n).join("."))), f = typeof window < "u" && window.HTMLElement !== void 0 && typeof document < "u";
12
+ function p(e) {
13
+ if (typeof e != "object" || !e) return e;
8
14
  if (e instanceof Date) return new Date(e);
9
- let t = typeof FileList < "u" && e instanceof FileList;
10
- if (l && (e instanceof Blob || t)) return e;
11
- let n = Array.isArray(e);
12
- if (!n && !(a(e) && c(e))) return e;
13
- 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]));
15
- return r;
15
+ let t = typeof Blob < "u" && e instanceof Blob, n = typeof FileList < "u" && e instanceof FileList;
16
+ if (f && (t || n)) return e;
17
+ let r = Array.isArray(e), i = Object.getPrototypeOf(e);
18
+ if (!r && i && i.constructor !== Object) return e;
19
+ let a = r ? Array(e.length) : Object.create(i);
20
+ for (let t in e) Object.prototype.hasOwnProperty.call(e, t) && (a[t] = p(e[t]));
21
+ return a;
16
22
  }
17
- var d = {
23
+ var m = {
18
24
  BLUR: "blur",
19
25
  FOCUS_OUT: "focusout",
20
26
  CHANGE: "change",
21
27
  SUBMIT: "submit",
22
28
  TRIGGER: "trigger",
23
29
  VALID: "valid"
24
- }, f = {
30
+ }, h = {
25
31
  onBlur: "onBlur",
26
32
  onChange: "onChange",
27
33
  onSubmit: "onSubmit",
28
34
  onTouched: "onTouched",
29
35
  all: "all"
30
- }, p = {
36
+ }, g = {
31
37
  max: "max",
32
38
  min: "min",
33
39
  maxLength: "maxLength",
@@ -35,42 +41,94 @@ var d = {
35
41
  pattern: "pattern",
36
42
  required: "required",
37
43
  validate: "validate"
38
- }, m = "root", h = [
44
+ }, _ = [
45
+ g.required,
46
+ g.min,
47
+ g.max,
48
+ g.minLength,
49
+ g.maxLength,
50
+ g.pattern,
51
+ g.validate
52
+ ], v = "form", y = "root", b = [
39
53
  "__proto__",
40
54
  "constructor",
41
55
  "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;
48
- }, 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;
56
+ ], x = /^\w*$/, S = (e) => x.test(e), C = (e) => e === void 0, w = (e, t, n) => {
57
+ if (!t || !o(e)) return n;
58
+ let r = S(t) ? [t] : l(t);
59
+ if (r.some((e) => b.includes(e))) return n;
60
+ let a = r.reduce((e, t) => i(e) ? void 0 : e[t], e);
61
+ return C(a) || a === e ? C(e[t]) ? n : e[t] : a;
62
+ }, T = (e) => typeof e == "boolean", E = (e) => typeof e == "function", D = (e, t, n) => {
63
+ let r = -1, i = S(t) ? [t] : l(t), a = i.length, s = a - 1;
64
+ for (; ++r < a;) {
65
+ let t = i[r], a = n;
52
66
  if (r !== s) {
53
67
  let n = e[t];
54
- o = a(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
68
+ a = o(n) || Array.isArray(n) ? n : isNaN(+i[r + 1]) ? {} : [];
55
69
  }
56
- if (h.includes(t)) return;
57
- e[t] = o, e = e[t];
70
+ if (b.includes(t)) return;
71
+ e[t] = a, e = e[t];
58
72
  }
59
- }, T = e.createContext(null);
60
- T.displayName = "HookFormControlContext";
61
- var E = () => e.useContext(T), D = (e, t, n, r = !0) => {
73
+ }, O = e.createContext(null);
74
+ O.displayName = "HookFormControlContext";
75
+ var k = () => e.useContext(O), A = (e, t, n, r = !0) => {
62
76
  let i = {};
63
77
  for (let a in e) Object.defineProperty(i, a, { get: () => {
64
78
  let i = a;
65
- return t._proxyFormState[i] !== f.all && (t._proxyFormState[i] = !r || f.all), n && (n[i] = !0), e[i];
79
+ return t._proxyFormState[i] !== h.all && (t._proxyFormState[i] = !r || h.all), n && (n[i] = !0), e[i];
66
80
  } });
67
81
  return i;
68
- }, O = l ? e.useLayoutEffect : e.useEffect;
69
- function k(t) {
70
- let n = E(), { control: r = n, disabled: i, name: a, exact: o } = t || {}, [s, c] = e.useState(() => ({
82
+ }, j = f ? e.useLayoutEffect : e.useEffect, M = (e) => {
83
+ let t = e.constructor && e.constructor.prototype;
84
+ return o(t) && t.hasOwnProperty("isPrototypeOf");
85
+ }, N = (e) => i(e) || !a(e), ee = (e, t) => t.length === 0 && !Array.isArray(e) && Object.getPrototypeOf(e) !== null && !M(e);
86
+ function P(e, t, n = !1, i = /* @__PURE__ */ new WeakMap()) {
87
+ if (e === t) return !0;
88
+ if (N(e) || N(t)) return Object.is(e, t);
89
+ if (r(e) && r(t)) return Object.is(e.getTime(), t.getTime());
90
+ if (Array.isArray(e) && Array.isArray(t) && e.length !== t.length) return !1;
91
+ let a = Object.keys(e), s = Object.keys(t);
92
+ if (a.length !== s.length) return !1;
93
+ if (ee(e, a) || ee(t, s)) return Object.is(e, t);
94
+ if (!a.length && Array.isArray(e) !== Array.isArray(t)) return !1;
95
+ let c = i.get(e);
96
+ if (c && c.has(t)) return !0;
97
+ if (c) c.add(t);
98
+ else {
99
+ let n = /* @__PURE__ */ new WeakSet();
100
+ n.add(t), i.set(e, n);
101
+ }
102
+ for (let s of a) {
103
+ let a = e[s];
104
+ if (!Object.prototype.hasOwnProperty.call(t, s)) return !1;
105
+ if (!n || s !== "ref") {
106
+ let e = t[s];
107
+ if (r(a) && r(e) || (o(a) || Array.isArray(a)) && (o(e) || Array.isArray(e)) ? !P(a, e, n, i) : !Object.is(a, e)) return !1;
108
+ }
109
+ }
110
+ return !0;
111
+ }
112
+ function F(t) {
113
+ let n = e.useRef(!1), r = e.useRef(!1), i = e.useRef(void 0), a = e.useRef(0);
114
+ return a.current++, !r.current && t && (r.current = !0, i.current = p(t())), {
115
+ resyncIfNeeded: e.useCallback((e, t, o) => {
116
+ if (e && (n.current || r.current && a.current > 1)) {
117
+ let e = t();
118
+ P(i.current, e) || o(e);
119
+ }
120
+ n.current = !0;
121
+ }, []),
122
+ snapshot: e.useCallback((e, t) => {
123
+ e && (i.current = p(t()));
124
+ }, [])
125
+ };
126
+ }
127
+ function I(t) {
128
+ let n = k(), { control: r = n, disabled: i, name: a, exact: o } = t || {}, s = () => ({
71
129
  ...r._formState,
72
130
  defaultValues: r._defaultValues
73
- })), l = e.useRef({
131
+ }), [c, l] = e.useState(s), u = e.useRef({
74
132
  isDirty: !1,
75
133
  isLoading: !1,
76
134
  dirtyFields: !1,
@@ -79,215 +137,218 @@ function k(t) {
79
137
  isValidating: !1,
80
138
  isValid: !1,
81
139
  errors: !1
82
- });
83
- return O(() => r._subscribe({
84
- name: a,
85
- formState: l.current,
86
- exact: o,
87
- callback: (e) => {
88
- !i && c({
89
- ...r._formState,
90
- ...e,
91
- defaultValues: r._defaultValues
92
- });
93
- }
94
- }), [
140
+ }), { resyncIfNeeded: d, snapshot: f } = F(s);
141
+ return j(() => {
142
+ d(!i, s, l);
143
+ let e = r._subscribe({
144
+ name: a,
145
+ formState: u.current,
146
+ exact: o,
147
+ callback: (e) => {
148
+ !i && l({
149
+ ...r._formState,
150
+ ...e,
151
+ defaultValues: r._defaultValues
152
+ });
153
+ }
154
+ });
155
+ return () => {
156
+ e(), f(!i, s);
157
+ };
158
+ }, [
159
+ r,
95
160
  a,
96
161
  i,
97
- o
162
+ o,
163
+ d,
164
+ f
98
165
  ]), e.useEffect(() => {
99
- l.current.isValid && r._setValid(!0);
100
- }, [r]), e.useMemo(() => D(s, r, l.current, !1), [s, r]);
101
- }
102
- var A = (e) => typeof e == "string", j = (e, t, n, r, i) => A(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), M = (e) => r(e) || !i(e), N = (e, t) => t.length === 0 && !Array.isArray(e) && !c(e);
103
- function P(e, t, r = /* @__PURE__ */ new WeakMap()) {
104
- if (e === t) return !0;
105
- if (M(e) || M(t)) return Object.is(e, t);
106
- if (n(e) && n(t)) return Object.is(e.getTime(), t.getTime());
107
- let i = Object.keys(e), o = Object.keys(t);
108
- if (i.length !== o.length) return !1;
109
- if (N(e, i) || N(t, o)) return Object.is(e, t);
110
- if (!i.length && Array.isArray(e) !== Array.isArray(t)) return !1;
111
- let s = r.get(e);
112
- if (s && s.has(t)) return !0;
113
- if (s) s.add(t);
114
- else {
115
- let n = /* @__PURE__ */ new WeakSet();
116
- n.add(t), r.set(e, n);
117
- }
118
- for (let o of i) {
119
- let i = e[o];
120
- if (!(o in t)) return !1;
121
- if (o !== "ref") {
122
- let e = t[o];
123
- if (n(i) && n(e) || (a(i) || Array.isArray(i)) && (a(e) || Array.isArray(e)) ? !P(i, e, r) : !Object.is(i, e)) return !1;
124
- }
125
- }
126
- return !0;
166
+ u.current.isValid && r._setValid(!0);
167
+ }, [r]), e.useMemo(() => A(c, r, u.current, !1), [c, r]);
127
168
  }
128
- function F(t) {
129
- 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);
169
+ var L = (e) => typeof e == "string", te = (e, t, n, r, i) => L(e) ? (r && t.watch.add(e), w(n, e, i)) : Array.isArray(e) ? e.map((e) => (r && t.watch.add(e), w(n, e, w(i, e)))) : (r && (t.watchAll = !0), n);
170
+ function R(t) {
171
+ let n = k(), { 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(r), f = e.useRef(i);
130
172
  u.current = c;
131
- let [m, h] = e.useState(() => {
173
+ let m = () => {
132
174
  let e = r._getWatch(i, l.current);
133
175
  return u.current ? u.current(e) : e;
134
- }), g = e.useCallback((e) => {
135
- let t = j(i, r._names, e || r._formValues, !1, l.current);
176
+ }, [h, g] = e.useState(m), _ = e.useRef(h), v = e.useCallback((e) => {
177
+ let t = te(i, r._names, e || r._formValues, !1, l.current);
136
178
  return u.current ? u.current(t) : t;
137
179
  }, [
138
180
  r._formValues,
139
181
  r._names,
140
182
  i
141
- ]), _ = e.useCallback((e) => {
183
+ ]), y = e.useCallback((e) => {
142
184
  if (!o) {
143
- let t = j(i, r._names, e || r._formValues, !1, l.current);
185
+ let t = te(i, r._names, e || r._formValues, !1, l.current);
144
186
  if (u.current) {
145
187
  let e = u.current(t);
146
- P(e, d.current) || (h(e), d.current = e);
147
- } else h(t);
188
+ P(e, _.current) || (g(e), _.current = e);
189
+ } else g(t);
148
190
  }
149
191
  }, [
150
192
  r._formValues,
151
193
  r._names,
152
194
  o,
153
195
  i
154
- ]);
155
- O(() => ((f.current !== r || !P(p.current, i)) && (f.current = r, p.current = i, _()), r._subscribe({
156
- name: i,
157
- formState: { values: !0 },
158
- exact: s,
159
- callback: (e) => {
160
- _(e.values);
161
- }
162
- })), [
196
+ ]), { resyncIfNeeded: b, snapshot: x } = F(m), S = e.useRef(y);
197
+ S.current = y;
198
+ let C = e.useRef(v);
199
+ C.current = v, j(() => {
200
+ d.current !== r || !P(f.current, i) ? (d.current = r, f.current = i, S.current()) : b(!o, () => C.current(), (e) => {
201
+ let t = p(e);
202
+ g(t), _.current = t;
203
+ });
204
+ let e = r._subscribe({
205
+ name: i,
206
+ formState: { values: !0 },
207
+ exact: s,
208
+ callback: (e) => {
209
+ S.current(e.values);
210
+ }
211
+ });
212
+ return () => {
213
+ e(), x(!o, () => C.current());
214
+ };
215
+ }, [
163
216
  r,
164
217
  s,
165
218
  i,
166
- _
167
- ]), e.useEffect(() => r._removeUnmounted());
168
- let v = f.current !== r, y = p.current, b = e.useMemo(() => {
169
- if (o) return null;
170
- let e = !v && !P(y, i);
171
- return v || e ? g() : null;
172
- }, [
173
219
  o,
174
- v,
220
+ b,
221
+ x
222
+ ]), e.useEffect(() => r._removeUnmounted());
223
+ let w = d.current !== r, T = f.current, E = e.useMemo(() => !w && !P(T, i), [
224
+ w,
175
225
  i,
176
- y,
177
- g
226
+ T
178
227
  ]);
179
- return b === null ? m : b;
228
+ return (w || E) && (l.current = a), !o && (w || E) ? v() : h;
180
229
  }
181
- function I(t) {
182
- let n = E(), { name: r, disabled: i, control: a = n, shouldUnregister: c, defaultValue: l, exact: f = !0 } = t, p = s(a._names.array, r), m = F({
230
+ function z(t) {
231
+ let n = k(), { name: r, disabled: i, control: a = n, shouldUnregister: o, defaultValue: c, exact: l = !0 } = t, f = d(a._names.array, r), h = R({
183
232
  control: a,
184
233
  name: r,
185
- defaultValue: e.useMemo(() => x(a._formValues, r, x(a._defaultValues, r, l)), [
234
+ defaultValue: e.useMemo(() => {
235
+ let e = w(a._formValues, r, w(a._defaultValues, r, c));
236
+ return C(e) ? u(a, r) : e;
237
+ }, [
186
238
  a,
187
239
  r,
188
- l
240
+ c
189
241
  ]),
190
- exact: f
191
- }), h = k({
242
+ exact: l
243
+ }), g = I({
192
244
  control: a,
193
245
  name: r,
194
- exact: f
195
- }), g = e.useRef(t), _ = e.useRef(null), y = e.useRef(a.register(r, {
246
+ exact: l
247
+ }), _ = e.useRef(t), v = e.useRef(null), y = e.useRef(a.register(r, {
196
248
  ...t.rules,
197
- value: m,
198
- ...S(t.disabled) ? { disabled: t.disabled } : {}
249
+ value: h,
250
+ ...T(t.disabled) ? { disabled: t.disabled } : {}
199
251
  }));
200
- g.current = t;
252
+ _.current = t;
201
253
  let b = e.useMemo(() => Object.defineProperties({}, {
202
254
  invalid: {
203
255
  enumerable: !0,
204
- get: () => !!x(h.errors, r)
256
+ get: () => !!w(g.errors, r)
205
257
  },
206
258
  isDirty: {
207
259
  enumerable: !0,
208
- get: () => !!x(h.dirtyFields, r)
260
+ get: () => !!w(g.dirtyFields, r)
209
261
  },
210
262
  isTouched: {
211
263
  enumerable: !0,
212
- get: () => !!x(h.touchedFields, r)
264
+ get: () => !!w(g.touchedFields, r)
213
265
  },
214
266
  isValidating: {
215
267
  enumerable: !0,
216
- get: () => !!x(h.validatingFields, r)
268
+ get: () => !!w(g.validatingFields, r)
217
269
  },
218
270
  error: {
219
271
  enumerable: !0,
220
- get: () => x(h.errors, r)
272
+ get: () => w(g.errors, r)
221
273
  }
222
- }), [h, r]), T = e.useCallback((e) => {
223
- let t = o(e);
224
- return x(a._fields, r) || (y.current = a.register(r, {
225
- ...g.current.rules,
274
+ }), [g, r]), x = e.useCallback((e) => {
275
+ let t = s(e);
276
+ return w(a._fields, r) || (y.current = a.register(r, {
277
+ ..._.current.rules,
226
278
  value: t
227
279
  })), y.current.onChange({
228
280
  target: {
229
- value: o(e),
281
+ value: s(e),
230
282
  name: r
231
283
  },
232
- type: d.CHANGE
284
+ type: m.CHANGE
233
285
  });
234
- }, [r, a]), D = e.useCallback(() => y.current.onBlur({
235
- target: {
236
- value: x(a._formValues, r),
237
- name: r
238
- },
239
- type: d.BLUR
240
- }), [r, a._formValues]), O = e.useCallback((e) => {
241
- e && (_.current = {
242
- focus: () => C(e.focus) && e.focus(),
243
- select: () => C(e.select) && e.select(),
244
- setCustomValidity: (t) => C(e.setCustomValidity) && e.setCustomValidity(t),
245
- reportValidity: () => C(e.reportValidity) && e.reportValidity()
286
+ }, [r, a]), S = e.useCallback(() => {
287
+ let e = w(a._formValues, r);
288
+ return w(a._fields, r) || (y.current = a.register(r, {
289
+ ..._.current.rules,
290
+ value: e
291
+ })), y.current.onBlur({
292
+ target: {
293
+ value: e,
294
+ name: r
295
+ },
296
+ type: m.BLUR
246
297
  });
247
- let t = x(a._fields, r);
248
- t && t._f && e && (t._f.ref = _.current);
298
+ }, [r, a]), O = e.useCallback((e) => {
299
+ e && (v.current = {
300
+ focus: () => E(e.focus) && e.focus(),
301
+ select: () => E(e.select) && e.select(),
302
+ setCustomValidity: (t) => E(e.setCustomValidity) && e.setCustomValidity(t),
303
+ reportValidity: () => E(e.reportValidity) && e.reportValidity()
304
+ });
305
+ let t = w(a._fields, r);
306
+ t && t._f && e && (t._f.ref = v.current, t._f._c = !0);
249
307
  }, [a._fields, r]), A = e.useMemo(() => ({
250
308
  name: r,
251
- value: m,
252
- ...S(i) || h.disabled ? { disabled: h.disabled || i } : {},
253
- onChange: T,
254
- onBlur: D,
309
+ value: h,
310
+ ...T(i) || g.disabled ? { disabled: g.disabled || i } : {},
311
+ onChange: x,
312
+ onBlur: S,
255
313
  ref: O
256
314
  }), [
257
315
  r,
258
316
  i,
259
- h.disabled,
260
- T,
261
- D,
317
+ g.disabled,
318
+ x,
319
+ S,
262
320
  O,
263
- m
321
+ h
264
322
  ]);
265
323
  return e.useEffect(() => {
266
- let e = a._options.shouldUnregister || c;
267
- a.register(r, {
268
- ...g.current.rules,
269
- ...S(g.current.disabled) ? { disabled: g.current.disabled } : {}
324
+ let e = a._options.shouldUnregister || o;
325
+ y.current = a.register(r, {
326
+ ..._.current.rules,
327
+ ...T(_.current.disabled) ? { disabled: _.current.disabled } : {}
270
328
  });
271
329
  let t = (e, t) => {
272
- let n = x(a._fields, e);
273
- n && n._f && (n._f.mount = t);
330
+ let n = w(a._fields, e);
331
+ n && n._f && (n._f.mount = t, n._f._c = t);
274
332
  };
275
333
  if (t(r, !0), e) {
276
- let e = u(x(c ? a._defaultValues : a._options.values || a._defaultValues, r, x(a._options.defaultValues, r, g.current.defaultValue)));
277
- w(a._defaultValues, r, e), v(x(a._formValues, r)) && w(a._formValues, r, e);
334
+ let e = p(w(o ? a._defaultValues : a._options.values || a._defaultValues, r, w(a._options.defaultValues, r, _.current.defaultValue)));
335
+ D(a._defaultValues, r, e), C(w(a._formValues, r)) && D(a._formValues, r, e);
278
336
  }
279
- if (!p && a.register(r), _.current) {
280
- let e = x(a._fields, r);
281
- e && e._f && (e._f.ref = _.current);
337
+ if (!f && a.register(r, {
338
+ ..._.current.rules,
339
+ ...T(_.current.disabled) ? { disabled: _.current.disabled } : {}
340
+ }), v.current) {
341
+ let e = w(a._fields, r);
342
+ e && e._f && (e._f.ref = v.current);
282
343
  }
283
344
  return () => {
284
- (p ? e && !a._state.action : e) ? a.unregister(r) : t(r, !1);
345
+ (f ? e && !a._state.action : e) ? a.unregister(r) : t(r, !1);
285
346
  };
286
347
  }, [
287
348
  r,
288
349
  a,
289
- p,
290
- c
350
+ f,
351
+ o
291
352
  ]), e.useEffect(() => {
292
353
  a._setDisabledField({
293
354
  disabled: i,
@@ -299,155 +360,282 @@ function I(t) {
299
360
  a
300
361
  ]), e.useMemo(() => ({
301
362
  field: A,
302
- formState: h,
363
+ formState: g,
303
364
  fieldState: b
304
365
  }), [
305
366
  A,
306
- h,
367
+ g,
307
368
  b
308
369
  ]);
309
370
  }
310
- var L = (e) => e.render(I(e)), R = e.createContext(null);
311
- R.displayName = "HookFormContext";
312
- var ee = (e, t, n, r, i) => t ? {
371
+ var B = (e) => e.render(z(e)), ne = (e) => ({
372
+ isOnSubmit: !e || e === h.onSubmit,
373
+ isOnBlur: e === h.onBlur,
374
+ isOnChange: e === h.onChange,
375
+ isOnAll: e === h.all,
376
+ isOnTouch: e === h.onTouched
377
+ }), re = (e, t, n) => {
378
+ if (n) return !1;
379
+ if (t.watchAll || t.watch.has(e)) return !0;
380
+ for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
381
+ return !1;
382
+ }, ie = (e, t, n) => {
383
+ for (let r of n || Object.keys(e)) {
384
+ if (r === "_f") continue;
385
+ let i = n ? w(e, r) : e[r];
386
+ if (i) {
387
+ let { _f: e } = i;
388
+ if (e) {
389
+ if (e.refs && e.refs[0] && t(e.refs[0], e.name) || e.ref && t(e.ref, e.name) || ie(i, t)) return !0;
390
+ } else if ((o(i) || Array.isArray(i)) && ie(i, t)) return !0;
391
+ }
392
+ }
393
+ }, ae = (e, t, n) => {
394
+ let r = w(e, n), i = Array.isArray(r) ? r : [];
395
+ return D(i, y, t[n]), D(e, n, i), e;
396
+ }, V = (e) => o(e) && !Object.keys(e).length, oe = (e) => {
397
+ if (!f) return !1;
398
+ let t = e ? e.ownerDocument : 0;
399
+ return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
400
+ }, H = (e) => e.type === "radio", U = (e) => e instanceof RegExp, W = (e, t, n, r, i) => t ? {
313
401
  ...n[e],
314
402
  types: {
315
403
  ...n[e] && n[e].types ? n[e].types : {},
316
404
  [r]: i || !0
317
405
  }
318
- } : {}, te = (e) => Array.isArray(e) ? e.filter(Boolean) : [], ne = (e) => Array.isArray(e) ? e : [e], re = () => {
319
- let e = [];
406
+ } : {}, G = {
407
+ value: !1,
408
+ isValid: !1
409
+ }, se = {
410
+ value: !0,
411
+ isValid: !0
412
+ }, ce = (e) => {
413
+ if (!Array.isArray(e)) return G;
414
+ if (e.length > 1) {
415
+ let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
416
+ return {
417
+ value: t,
418
+ isValid: !!t.length
419
+ };
420
+ }
421
+ let t = e[0];
422
+ return !t || !t.checked || t.disabled ? G : !t.attributes || !("value" in t.attributes) || C(t.value) || t.value === "" ? se : {
423
+ value: t.value,
424
+ isValid: !0
425
+ };
426
+ }, le = {
427
+ isValid: !1,
428
+ value: null
429
+ }, ue = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
430
+ isValid: !0,
431
+ value: t.value
432
+ } : e, le) : le;
433
+ function K(e, t, n = "validate") {
434
+ if (L(e) || Array.isArray(e) && e.length && e.every(L) || T(e) && !e) return {
435
+ type: n,
436
+ message: L(e) ? e : "",
437
+ ref: t
438
+ };
439
+ }
440
+ var q = (e) => o(e) && !U(e) ? e : {
441
+ value: e,
442
+ message: ""
443
+ }, de = async (e, a, s, c, l, u) => {
444
+ let { ref: d, refs: f, required: p, maxLength: m, minLength: h, min: _, max: v, pattern: y, validate: b, name: x, valueAsNumber: S, mount: D, _c: O } = e._f, k = w(s, x);
445
+ if (!D || a.has(x)) return {};
446
+ let A = f ? f[0] : d, j = (e) => {
447
+ if (l && A.reportValidity) {
448
+ let t = T(e) ? "" : e || "";
449
+ f ? f.forEach((e) => E(e.setCustomValidity) && e.setCustomValidity(t)) : A.setCustomValidity(t), A.reportValidity();
450
+ }
451
+ }, M = {}, N = !O && H(d), ee = !O && t(d), P = N || ee, F = (S || n(d)) && C(d.value) && C(k) || oe(d) && d.value === "" && !O || k === "" || Array.isArray(k) && !k.length, I = W.bind(null, x, c, M), te = (e, t, n, r = g.maxLength, i = g.minLength) => {
452
+ let a = e ? t : n;
453
+ M[x] = {
454
+ type: e ? r : i,
455
+ message: a,
456
+ ref: d,
457
+ ...I(e ? r : i, a)
458
+ };
459
+ };
460
+ if (u ? !Array.isArray(k) || !k.length : p && (!P && (F || i(k)) || T(k) && !k || ee && !ce(f).isValid || N && !ue(f).isValid)) {
461
+ let { value: e, message: t } = L(p) ? {
462
+ value: !!p,
463
+ message: p
464
+ } : q(p);
465
+ if (e && (M[x] = {
466
+ type: g.required,
467
+ message: t,
468
+ ref: A,
469
+ ...I(g.required, t)
470
+ }, !c)) return j(t), M;
471
+ }
472
+ if (!F && (!i(_) || !i(v))) {
473
+ let e, t, n = q(v), a = q(_);
474
+ if (!i(k) && !r(k) && !isNaN(k)) {
475
+ let r = !O && d.valueAsNumber || k && +k;
476
+ i(n.value) || (e = r > n.value), i(a.value) || (t = r < a.value);
477
+ } else {
478
+ let r = !O && d.valueAsDate || new Date(k), i = (e) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + e), o = d.type == "time", s = d.type == "week";
479
+ L(n.value) && k && (e = o ? i(k) > i(n.value) : s ? k > n.value : r > new Date(n.value)), L(a.value) && k && (t = o ? i(k) < i(a.value) : s ? k < a.value : r < new Date(a.value));
480
+ }
481
+ if ((e || t) && (te(!!e, n.message, a.message, g.max, g.min), !c)) return j(M[x].message), M;
482
+ }
483
+ if ((!i(m) || !i(h)) && !F && (L(k) || u && Array.isArray(k))) {
484
+ let e = q(m), t = q(h), n = !i(e.value) && k.length > +e.value, r = !i(t.value) && k.length < +t.value;
485
+ if ((n || r) && (te(n, e.message, t.message), !c)) return j(M[x].message), M;
486
+ }
487
+ if (y && !F && L(k)) {
488
+ let { value: e, message: t } = q(y);
489
+ if (U(e) && !k.match(e) && (M[x] = {
490
+ type: g.pattern,
491
+ message: t,
492
+ ref: d,
493
+ ...I(g.pattern, t)
494
+ }, !c)) return j(t), M;
495
+ }
496
+ if (b) {
497
+ if (E(b)) {
498
+ let e = K(await b(k, s), A);
499
+ if (e && (M[x] = {
500
+ ...e,
501
+ ...I(g.validate, e.message)
502
+ }, !c)) return j(e.message), M;
503
+ } else if (o(b)) {
504
+ let e = {};
505
+ for (let t in b) {
506
+ if (!V(e) && !c) break;
507
+ let n = K(await b[t](k, s), A, t);
508
+ n && (e = {
509
+ ...n,
510
+ ...I(t, n.message)
511
+ }, c || j(n.message), c && (M[x] = e));
512
+ }
513
+ if (!V(e) && (M[x] = {
514
+ ref: A,
515
+ ...e
516
+ }, !c)) return M;
517
+ }
518
+ }
519
+ let R = M[x];
520
+ return j(!R || R.message), M;
521
+ }, fe = (e) => Array.isArray(e) ? e : [e], pe = (e) => Array.isArray(e) ? e.filter(Boolean) : [];
522
+ function J(e, t) {
523
+ let n = t.length - 1, r = 0;
524
+ for (; r < n;) {
525
+ if (i(e)) {
526
+ e = void 0;
527
+ break;
528
+ }
529
+ e = e[t[r]], r++;
530
+ }
531
+ return e;
532
+ }
533
+ function me(e) {
534
+ for (let t in e) if (e.hasOwnProperty(t) && !C(e[t])) return !1;
535
+ return !0;
536
+ }
537
+ function Y(e, t) {
538
+ if (L(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
539
+ let n = Array.isArray(t) ? t : S(t) ? [t] : l(t);
540
+ if (n.some((e) => b.includes(String(e)))) return e;
541
+ let r = n.length === 1 ? e : J(e, n), i = n.length - 1, a = n[i];
542
+ return r && delete r[a], i !== 0 && (o(r) && V(r) || Array.isArray(r) && me(r)) && Y(e, n.slice(0, -1)), e;
543
+ }
544
+ var he = () => {
545
+ let e = /* @__PURE__ */ new Set(), t = 0;
320
546
  return {
321
547
  get observers() {
322
- return e;
548
+ return Array.from(e);
323
549
  },
324
- next: (t) => {
325
- for (let n of e) n.next && n.next(t);
550
+ next: (n) => {
551
+ let r = e;
552
+ t++;
553
+ for (let e of r) e.next && e.next(n);
554
+ r === e && t--;
326
555
  },
327
- subscribe: (t) => (e.push(t), { unsubscribe: () => {
328
- e = e.filter((e) => e !== t);
556
+ subscribe: (n) => (e.add(n), { unsubscribe: () => {
557
+ t &&= (e = new Set(e), 0), e.delete(n);
329
558
  } }),
330
559
  unsubscribe: () => {
331
- e = [];
560
+ e = /* @__PURE__ */ new Set(), t = 0;
332
561
  }
333
562
  };
334
563
  };
335
- function ie(e, t) {
336
- let n = {};
337
- for (let r in e) if (e.hasOwnProperty(r)) {
338
- let i = e[r], o = t[r];
339
- if (i && a(i) && o) {
340
- let e = ie(i, o);
341
- a(e) && (n[r] = e);
342
- } else e[r] && (n[r] = o);
564
+ function ge(e, t) {
565
+ let n = Array.isArray(e) ? [] : {};
566
+ for (let r in e) if (Object.prototype.hasOwnProperty.call(e, r)) {
567
+ let i = e[r], a = t[r];
568
+ i && (o(i) || Array.isArray(i)) && a ? n[r] = ge(i, a) : e[r] && (n[r] = a);
343
569
  }
344
570
  return n;
345
571
  }
346
- var z = (e) => a(e) && !Object.keys(e).length, ae = (e) => e.type === "file", oe = (e) => {
347
- if (!l) return !1;
348
- let t = e ? e.ownerDocument : 0;
349
- return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
350
- }, se = (e) => e.type === "select-multiple", ce = (e) => e.type === "radio", le = (e) => ce(e) || t(e), ue = (e) => oe(e) && e.isConnected;
351
- function B(e, t) {
352
- let n = t.slice(0, -1).length, i = 0;
353
- for (; i < n;) {
354
- if (r(e)) {
355
- e = void 0;
356
- break;
357
- }
358
- e = e[t[i]], i++;
572
+ var X = (e, t) => e !== null && a(e) && Object.prototype.hasOwnProperty.call(e, t), _e = (e, t) => {
573
+ if (!t) return !1;
574
+ let n = e;
575
+ for (let r of S(t) ? [t] : l(t)) {
576
+ if (!X(n, r)) return X(e, t);
577
+ n = n[r];
359
578
  }
360
- return e;
361
- }
362
- function V(e) {
363
- for (let t in e) if (e.hasOwnProperty(t) && !v(e[t])) return !1;
364
579
  return !0;
580
+ }, ve = (e) => e.type === "select-multiple", ye = (e) => {
581
+ let t = [...e.options];
582
+ return !e.multiple && e.size < 2 && !t.some((e) => e.defaultSelected) ? e.selectedIndex !== t.findIndex((e) => !e.disabled) : t.some((e) => e.selected !== e.defaultSelected);
583
+ }, be = (e) => t(e) ? e.checked !== e.defaultChecked : e.type === "select-one" || ve(e) ? ye(e) : !H(e) && "defaultValue" in e && e.value !== e.defaultValue, xe = (e) => H(e) || t(e), Se = (e) => oe(e) && e.isConnected;
584
+ function Ce(e) {
585
+ return Array.isArray(e) || o(e);
365
586
  }
366
- function H(e, t) {
367
- if (A(t) && Object.prototype.hasOwnProperty.call(e, t)) return delete e[t], e;
368
- let n = Array.isArray(t) ? t : _(t) ? [t] : b(t), r = n.length === 1 ? e : B(e, n), i = n.length - 1, o = n[i];
369
- return r && delete r[o], i !== 0 && (a(r) && z(r) || Array.isArray(r) && V(r)) && H(e, n.slice(0, -1)), e;
587
+ function we(e, t, n = "", r = []) {
588
+ for (let i in e) {
589
+ let a = n ? `${n}.${i}` : i, o = e[i];
590
+ Ce(o) && Ce(w(t, a)) ? we(o, t, a, r) : r.push(a);
591
+ }
592
+ return r;
370
593
  }
371
- var de = (e) => {
372
- for (let t in e) if (C(e[t])) return !0;
594
+ var Te = (e) => {
595
+ for (let t in e) if (E(e[t])) return !0;
373
596
  return !1;
374
597
  };
375
- function fe(e) {
376
- return Array.isArray(e) || a(e) && !de(e);
598
+ function Ee(e) {
599
+ return Array.isArray(e) || o(e) && !Te(e);
377
600
  }
378
- function U(e, t = {}) {
379
- for (let n in e) {
380
- let r = e[n];
381
- fe(r) ? (t[n] = Array.isArray(r) ? [] : {}, U(r, t[n])) : v(r) || (t[n] = !0);
382
- }
383
- return t;
601
+ function De(e) {
602
+ return !!(e && "_f" in e);
384
603
  }
385
- function W(e) {
386
- if (e !== !1) {
387
- if (e === !0) return !0;
388
- if (Array.isArray(e)) {
389
- let t = e.map((e) => W(e));
390
- return t.some((e) => e !== void 0) ? t : void 0;
391
- }
392
- if (a(e)) {
393
- let t = {};
394
- for (let n in e) {
395
- let r = W(e[n]);
396
- v(r) || (t[n] = r);
397
- }
398
- return Object.keys(t).length ? t : void 0;
399
- }
400
- }
604
+ function Oe(e) {
605
+ return Array.isArray(e) ? !e.some((e) => !C(e)) : !Object.keys(e).length;
401
606
  }
402
- function G(e, t, n) {
403
- n ||= U(t);
404
- for (let i in e) {
405
- let a = e[i];
406
- if (fe(a)) v(t) || M(n[i]) ? n[i] = U(a, Array.isArray(a) ? [] : {}) : G(a, r(t) ? {} : t[i], n[i]);
407
- else {
408
- let e = t[i];
409
- n[i] = !P(a, e);
410
- }
607
+ function ke(e, t) {
608
+ Array.isArray(e) ? e[t] = void 0 : delete e[t];
609
+ }
610
+ function Ae(e, t = {}, n) {
611
+ for (let r in e) {
612
+ let i = e[r], a = n && n[r];
613
+ Ee(i) && (!Array.isArray(i) || !De(a)) ? (t[r] = Array.isArray(i) ? [] : {}, Ae(i, t[r], a), Oe(t[r]) && ke(t, r)) : C(i) || (t[r] = !0);
411
614
  }
412
- return W(n) || {};
615
+ return t;
413
616
  }
414
- var pe = {
415
- value: !1,
416
- isValid: !1
417
- }, me = {
418
- value: !0,
419
- isValid: !0
420
- }, he = (e) => {
421
- if (Array.isArray(e)) {
422
- if (e.length > 1) {
423
- let t = e.filter((e) => e && e.checked && !e.disabled).map((e) => e.value);
424
- return {
425
- value: t,
426
- isValid: !!t.length
427
- };
428
- }
429
- return e[0].checked && !e[0].disabled ? e[0].attributes && !v(e[0].attributes.value) ? v(e[0].value) || e[0].value === "" ? me : {
430
- value: e[0].value,
431
- isValid: !0
432
- } : me : pe;
617
+ function Z(e, t, n, r) {
618
+ n ||= Ae(t, Array.isArray(i(t) ? e : t) ? [] : {}, r);
619
+ for (let a in e) {
620
+ let o = e[a], s = r && r[a];
621
+ Ee(o) && (!Array.isArray(o) || !De(s)) ? (C(t) || N(n[a]) ? n[a] = Ae(o, Array.isArray(o) ? [] : {}, s) : Z(o, i(t) ? {} : t[a], n[a], s), Oe(n[a]) && ke(n, a)) : P(o, i(t) ? void 0 : t[a]) ? ke(n, a) : n[a] = !0;
433
622
  }
434
- return pe;
435
- }, ge = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => v(e) ? e : t ? e === "" ? NaN : e && +e : n && A(e) ? new Date(e) : r ? r(e) : e, _e = {
436
- isValid: !1,
437
- value: null
438
- }, K = (e) => Array.isArray(e) ? e.reduce((e, t) => t && t.checked && !t.disabled ? {
439
- isValid: !0,
440
- value: t.value
441
- } : e, _e) : _e;
442
- function ve(e) {
443
- let n = e.ref;
444
- return ae(n) ? n.files : ce(n) ? K(e.refs).value : se(n) ? [...n.selectedOptions].map(({ value: e }) => e) : t(n) ? he(e.refs).value : ge(v(n.value) ? e.ref.value : n.value, e);
623
+ return n;
624
+ }
625
+ var je = (e, t) => {
626
+ let n = t.split("."), r = [], i = n[0];
627
+ for (let t = 1; t < n.length; i += "." + n[t++]) !isNaN(+n[t]) && e.has(i) && r.push(`${i}.${n[t]}`);
628
+ return r;
629
+ }, Me = (e, { valueAsNumber: t, valueAsDate: n, setValueAs: r }) => C(e) ? e : t ? e === "" ? NaN : e && +e : n && L(e) ? new Date(e) : r ? r(e) : e;
630
+ function Ne(e) {
631
+ let r = e.ref;
632
+ return n(r) ? r.files : H(r) ? ue(e.refs).value : ve(r) ? [...r.selectedOptions].map(({ value: e }) => e) : t(r) ? ce(e.refs).value : Me(r.value, e);
445
633
  }
446
- var ye = (e, t, n, r) => {
634
+ var Pe = (e, t, n, r) => {
447
635
  let i = {};
448
636
  for (let n of e) {
449
- let e = x(t, n);
450
- e && w(i, n, e._f);
637
+ let e = w(t, n);
638
+ e && D(i, n, e._f);
451
639
  }
452
640
  return {
453
641
  criteriaMode: n,
@@ -455,45 +643,23 @@ var ye = (e, t, n, r) => {
455
643
  fields: i,
456
644
  shouldUseNativeValidation: r
457
645
  };
458
- }, 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, be = (e) => ({
459
- isOnSubmit: !e || e === f.onSubmit,
460
- isOnBlur: e === f.onBlur,
461
- isOnChange: e === f.onChange,
462
- isOnAll: e === f.all,
463
- isOnTouch: e === f.onTouched
464
- }), xe = "AsyncFunction", Se = (e) => {
646
+ }, Fe = (e) => C(e) ? e : U(e) ? e.source : o(e) ? U(e.value) ? e.value.source : e.value : e, Ie = "AsyncFunction", Le = (e) => {
465
647
  if (!e || !e.validate) return !1;
466
- if (C(e.validate)) return e.validate.constructor.name === xe;
467
- if (a(e.validate)) {
468
- for (let t in e.validate) if (e.validate[t].constructor.name === xe) return !0;
648
+ if (E(e.validate)) return e.validate.constructor.name === Ie;
649
+ if (o(e.validate)) {
650
+ for (let t in e.validate) if (e.validate[t].constructor.name === Ie) return !0;
469
651
  }
470
652
  return !1;
471
- }, Ce = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), we = (e, t, n) => {
472
- if (n) return !1;
473
- if (t.watchAll || t.watch.has(e)) return !0;
474
- for (let n of t.watch) if (e.startsWith(n) && e.charAt(n.length) === ".") return !0;
475
- return !1;
476
- }, Y = (e, t, n, r) => {
477
- for (let i of n || Object.keys(e)) {
478
- let n = x(e, i);
479
- if (n) {
480
- let { _f: e, ...o } = n;
481
- if (e) {
482
- if (e.refs && e.refs[0] && t(e.refs[0], i) && !r || e.ref && t(e.ref, e.name) && !r) return !0;
483
- if (Y(o, t)) break;
484
- } else if (a(o) && Y(o, t)) break;
485
- }
486
- }
487
- };
488
- function Te(e, t, n) {
489
- let r = x(e, n);
490
- if (r || _(n)) return {
653
+ }, Re = (e) => e.mount && (e.required || !C(e.required) && e.required !== !1 || !C(e.min) || !C(e.max) || !C(e.maxLength) || !C(e.minLength) || e.pattern || e.validate);
654
+ function ze(e, t, n) {
655
+ let r = w(e, n);
656
+ if (r && (r.type || r.message) || Array.isArray(r)) return {
491
657
  error: r,
492
658
  name: n
493
659
  };
494
660
  let i = n.split(".");
495
661
  for (; i.length;) {
496
- let r = i.join("."), a = x(t, r), o = x(e, r);
662
+ let r = i.join("."), a = w(t, r), o = w(e, r);
497
663
  if (a && !Array.isArray(a) && n !== r) return { name: n };
498
664
  if (o && o.type) return {
499
665
  name: r,
@@ -507,106 +673,25 @@ function Te(e, t, n) {
507
673
  }
508
674
  return { name: n };
509
675
  }
510
- var Ee = (e, t, n, r) => {
511
- n(e);
512
- let { name: i, ...a } = e, o = Object.keys(a);
513
- return !o.length || r && o.length >= Object.keys(t).length || o.find((e) => t[e] === (!r || f.all));
514
- }, De = (e, t, n) => !e || !t || e === t || ne(e).some((e) => e && (n ? e === t : e.startsWith(t) || t.startsWith(e))), Oe = (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, ke = (e, t) => !te(x(e, t)).length && H(e, t), Ae = (e, t, n) => {
515
- let r = x(e, n), i = Array.isArray(r) ? r : [];
516
- return w(i, m, t[n]), w(e, n, i), e;
517
- };
518
- function X(e, t, n = "validate") {
519
- if (A(e) || Array.isArray(e) && e.every(A) || S(e) && !e) return {
520
- type: n,
521
- message: A(e) ? e : "",
522
- ref: t
523
- };
524
- }
525
- var Z = (e) => a(e) && !q(e) ? e : {
526
- value: e,
527
- message: ""
528
- }, je = async (e, n, i, o, s, c) => {
529
- 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);
530
- if (!T || n.has(b)) return {};
531
- let D = u ? u[0] : l, O = (e) => {
532
- if (s && D.reportValidity) {
533
- let t = S(e) ? "" : e || "";
534
- u ? u.forEach((e) => e.setCustomValidity(t)) : D.setCustomValidity(t), D.reportValidity();
535
- }
536
- }, k = {}, j = ce(l), M = t(l), N = j || M, P = (w || ae(l)) && v(l.value) && v(E) || oe(l) && l.value === "" || E === "" || Array.isArray(E) && !E.length, F = ee.bind(null, b, o, k), I = (e, t, n, r = p.maxLength, i = p.minLength) => {
537
- let a = e ? t : n;
538
- k[b] = {
539
- type: e ? r : i,
540
- message: a,
541
- ref: l,
542
- ...F(e ? r : i, a)
543
- };
544
- };
545
- if (c ? !Array.isArray(E) || !E.length : d && (!N && (P || r(E)) || S(E) && !E || M && !he(u).isValid || j && !K(u).isValid)) {
546
- let { value: e, message: t } = A(d) ? {
547
- value: !!d,
548
- message: d
549
- } : Z(d);
550
- if (e && (k[b] = {
551
- type: p.required,
552
- message: t,
553
- ref: D,
554
- ...F(p.required, t)
555
- }, !o)) return O(t), k;
556
- }
557
- if (!P && (!r(h) || !r(g))) {
558
- let e, t, n = Z(g), i = Z(h);
559
- if (!r(E) && !isNaN(E)) {
560
- let a = l.valueAsNumber || E && +E;
561
- r(n.value) || (e = a > n.value), r(i.value) || (t = a < i.value);
562
- } else {
563
- 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";
564
- A(n.value) && E && (e = o ? a(E) > a(n.value) : s ? E > n.value : r > new Date(n.value)), A(i.value) && E && (t = o ? a(E) < a(i.value) : s ? E < i.value : r < new Date(i.value));
565
- }
566
- if ((e || t) && (I(!!e, n.message, i.message, p.max, p.min), !o)) return O(k[b].message), k;
567
- }
568
- if ((f || m) && !P && (A(E) || c && Array.isArray(E))) {
569
- let e = Z(f), t = Z(m), n = !r(e.value) && E.length > +e.value, i = !r(t.value) && E.length < +t.value;
570
- if ((n || i) && (I(n, e.message, t.message), !o)) return O(k[b].message), k;
571
- }
572
- if (_ && !P && A(E)) {
573
- let { value: e, message: t } = Z(_);
574
- if (q(e) && !E.match(e) && (k[b] = {
575
- type: p.pattern,
576
- message: t,
577
- ref: l,
578
- ...F(p.pattern, t)
579
- }, !o)) return O(t), k;
580
- }
581
- if (y) {
582
- if (C(y)) {
583
- let e = X(await y(E, i), D);
584
- if (e && (k[b] = {
585
- ...e,
586
- ...F(p.validate, e.message)
587
- }, !o)) return O(e.message), k;
588
- } else if (a(y)) {
589
- let e = {};
590
- for (let t in y) {
591
- if (!z(e) && !o) break;
592
- let n = X(await y[t](E, i), D, t);
593
- n && (e = {
594
- ...n,
595
- ...F(t, n.message)
596
- }, O(n.message), o && (k[b] = e));
597
- }
598
- if (!z(e) && (k[b] = {
599
- ref: D,
600
- ...e
601
- }, !o)) return k;
602
- }
603
- }
604
- return O(!0), k;
605
- }, Me = {
606
- mode: f.onSubmit,
607
- reValidateMode: f.onChange,
676
+ var Be = (e, t, n) => {
677
+ let r = Object.keys(e).filter((e) => e !== "name");
678
+ return !r.length || n && r.length >= Object.keys(t).length || r.find((e) => t[e] === (!n || h.all));
679
+ }, Ve = (e, t, n) => n ? e === t || e.startsWith(t + ".") : e.startsWith(t) || t.startsWith(e), He = (e, t, n) => {
680
+ if (!e || !t || e === t) return !0;
681
+ if (!Array.isArray(e)) return Ve(e, t, n);
682
+ for (let r of e) if (r && Ve(r, t, n)) return !0;
683
+ return !1;
684
+ }, Ue = (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, We = (e, t) => {
685
+ let n = w(e, t);
686
+ !pe(n).length && !(n && n.root) && Y(e, t);
687
+ }, Ge = {
688
+ mode: h.onSubmit,
689
+ reValidateMode: h.onChange,
608
690
  shouldFocusError: !0
609
- }, Ne = "form", Pe = {
691
+ }, Ke = (e, t) => {
692
+ for (let t in e) delete e[t];
693
+ Object.assign(e, t);
694
+ }, qe = {
610
695
  submitCount: 0,
611
696
  isDirty: !1,
612
697
  isReady: !1,
@@ -619,28 +704,29 @@ var Z = (e) => a(e) && !q(e) ? e : {
619
704
  dirtyFields: {},
620
705
  validatingFields: {}
621
706
  };
622
- function Q(e = {}) {
623
- let i = {
624
- ...Me,
707
+ function Je(e = {}) {
708
+ let a = {
709
+ ...Ge,
625
710
  ...e
626
711
  }, c = {
627
- ...u(Pe),
628
- isLoading: C(i.defaultValues),
629
- errors: i.errors || {},
630
- disabled: i.disabled || !1
631
- }, h = {}, g = (a(i.defaultValues) || a(i.values)) && u(i.defaultValues || i.values) || {}, y = i.shouldUnregister ? {} : u(g), T = {
712
+ ...p(qe),
713
+ isLoading: E(a.defaultValues),
714
+ errors: p(a.errors) || {},
715
+ disabled: a.disabled || !1
716
+ }, u = {}, b = (o(a.defaultValues) || o(a.values)) && p(a.defaultValues || a.values) || {}, x = a.shouldUnregister ? {} : p(b), O = {
632
717
  action: !1,
718
+ actionArrayLengths: /* @__PURE__ */ new Map(),
633
719
  mount: !1,
634
720
  watch: !1,
635
721
  keepIsValid: !1
636
- }, E = {
722
+ }, k = !1, A = {
637
723
  mount: /* @__PURE__ */ new Set(),
638
724
  disabled: /* @__PURE__ */ new Set(),
639
725
  unMount: /* @__PURE__ */ new Set(),
640
726
  array: /* @__PURE__ */ new Set(),
641
727
  watch: /* @__PURE__ */ new Set(),
642
728
  registerName: /* @__PURE__ */ new Set()
643
- }, D, O = 0, k = 0, M = be(i.mode), N = be(i.reValidateMode), F = {
729
+ }, j = {}, M = {}, N = /* @__PURE__ */ new Set(), ee = ne(a.mode), F = ne(a.reValidateMode), I = {
644
730
  isDirty: !1,
645
731
  dirtyFields: !1,
646
732
  validatingFields: !1,
@@ -648,359 +734,478 @@ function Q(e = {}) {
648
734
  isValidating: !1,
649
735
  isValid: !1,
650
736
  errors: !1
651
- }, I = { ...F }, L = { ...I }, R = {
652
- array: re(),
653
- state: re()
654
- }, ee = i.criteriaMode === f.all, ce = (e) => (t) => {
655
- clearTimeout(O), O = setTimeout(e, t);
656
- }, B = async (e) => {
657
- if (!T.keepIsValid && !i.disabled && (I.isValid || L.isValid || e)) {
658
- let e;
659
- i.resolver ? (e = z((await K()).errors), V()) : e = await X({
660
- fields: h,
737
+ }, R = { ...I }, z = {}, B = (...e) => e.some((e) => R[e] || z[e]), H = (e) => {
738
+ for (let t of N) if (He(t.name, e, t.exact)) return !0;
739
+ return !1;
740
+ }, U = {
741
+ array: he(),
742
+ state: he()
743
+ }, W = 0, G = 0, se = 0, ce = {}, le = a.criteriaMode === h.all, ue = (e, t) => (n) => {
744
+ clearTimeout(M[e]), M[e] = setTimeout(t, n);
745
+ }, K = (e) => {
746
+ clearTimeout(M[e]), delete M[e], delete j[e];
747
+ }, q = (e) => {
748
+ K(e);
749
+ let t = `${e}.`;
750
+ for (let e of Object.keys(j)) e.startsWith(t) && K(e);
751
+ }, J = async (e) => {
752
+ if (!O.keepIsValid && !a.disabled && (B("isValid") || e)) {
753
+ let e = ++W, t;
754
+ a.resolver ? (t = V((await Q()).errors), e === W && X()) : t = await Ze({
755
+ fields: u,
661
756
  onlyCheckValid: !0,
662
- eventType: d.VALID
663
- }), e !== c.isValid && R.state.next({ isValid: e });
757
+ eventType: m.VALID
758
+ }), e === W && t !== c.isValid && U.state.next({ isValid: t });
664
759
  }
665
- }, V = (e, t) => {
666
- !i.disabled && (I.isValidating || I.validatingFields || L.isValidating || L.validatingFields) && ((e || Array.from(E.mount)).forEach((e) => {
667
- e && (t ? w(c.validatingFields, e, t) : H(c.validatingFields, e));
668
- }), R.state.next({
760
+ }, me = (e, t) => {
761
+ let n = [...e];
762
+ if (!n.some((e) => e && (t ? w(c.validatingFields, e) !== !0 : _e(c.validatingFields, e)))) return;
763
+ let r = p(c.validatingFields);
764
+ for (let e of n) e && (t ? D(r, e, !0) : Y(r, e));
765
+ P(c.validatingFields, r) || (c.validatingFields = r);
766
+ }, X = (e, t) => {
767
+ !a.disabled && B("isValidating", "validatingFields") && (me(e || A.mount, t), U.state.next({
669
768
  validatingFields: c.validatingFields,
670
- isValidating: !z(c.validatingFields)
769
+ isValidating: !V(c.validatingFields)
671
770
  }));
672
- }, de = () => {
673
- c.dirtyFields = G(g, y);
674
- }, fe = (e, t = [], n, r, a = !0, o = !0) => {
675
- if (r && n && !i.disabled) {
676
- if (T.action = !0, o && Array.isArray(x(h, e))) {
677
- let t = n(x(h, e), r.argA, r.argB);
678
- a && w(h, e, t);
771
+ }, ye = () => {
772
+ c.dirtyFields = Z(b, x, void 0, u);
773
+ }, Ce = (e, t = [], n, r, i = !0, o = !0) => {
774
+ if (r && n && !a.disabled) {
775
+ O.action = !0, O.keepIsValid = !1;
776
+ let a = w(u, e), s = a && a._f, l = s ? Object.assign([], a) : a;
777
+ if (O.actionArrayLengths.has(e) || O.actionArrayLengths.set(e, Array.isArray(l) ? l.length : 0), o && Array.isArray(l)) {
778
+ let t = n(l, r.argA, r.argB) || l;
779
+ s ? D(u, e, {
780
+ ...t,
781
+ _f: s
782
+ }) : i && D(u, e, t);
783
+ }
784
+ let d = w(c.errors, e);
785
+ if (o && Array.isArray(d)) {
786
+ let t = d.root, a = n(d, r.argA, r.argB) || d;
787
+ t && (a.root = t), i && D(c.errors, e, a), We(c.errors, e), c.errors = { ...c.errors };
679
788
  }
680
- if (o && Array.isArray(x(c.errors, e))) {
681
- let t = n(x(c.errors, e), r.argA, r.argB);
682
- a && w(c.errors, e, t), ke(c.errors, e);
789
+ let f = w(c.touchedFields, e), p = o && Array.isArray(f);
790
+ if (p) {
791
+ let t = n(f, r.argA, r.argB);
792
+ i && D(c.touchedFields, e, t);
683
793
  }
684
- if ((I.touchedFields || L.touchedFields) && o && Array.isArray(x(c.touchedFields, e))) {
685
- let t = n(x(c.touchedFields, e), r.argA, r.argB);
686
- a && w(c.touchedFields, e, t);
794
+ let m = w(c.dirtyFields, e);
795
+ if (o && Array.isArray(m)) {
796
+ let t = n(m, r.argA, r.argB) || m;
797
+ i && D(c.dirtyFields, e, t);
687
798
  }
688
- (I.dirtyFields || L.dirtyFields) && de(), R.state.next({
799
+ B("dirtyFields") ? ye() : k = !0, U.state.next({
689
800
  name: e,
690
- isDirty: Q(e, t),
801
+ isDirty: $(e, t),
691
802
  dirtyFields: c.dirtyFields,
803
+ ...p && { touchedFields: c.touchedFields },
692
804
  errors: c.errors,
693
805
  isValid: c.isValid
694
806
  });
695
- } else w(y, e, t);
696
- }, U = (e, t) => {
697
- w(c.errors, e, t), c.errors = { ...c.errors }, R.state.next({ errors: c.errors });
698
- }, W = (e) => {
699
- c.errors = e, R.state.next({
807
+ } else D(x, e, t);
808
+ }, Te = (e, t) => {
809
+ D(c.errors, e, t), c.errors = { ...c.errors }, U.state.next({ errors: c.errors });
810
+ }, Ee = (e) => {
811
+ Object.keys(j).forEach(K);
812
+ let t = !V(e);
813
+ c.errors = p(e), U.state.next({
700
814
  errors: c.errors,
701
- isValid: !1
702
- });
703
- }, pe = (e) => {
704
- let t = _(e) ? [e] : b(e), n = y, i = g;
815
+ ...t ? { isValid: !1 } : {}
816
+ }), !t && O.mount && J();
817
+ }, De = (e) => S(e) ? [e] : l(e), Oe = (e) => {
818
+ let t = De(e), n = x, r = b;
705
819
  for (let e = 0; e < t.length - 1; e++) {
706
820
  let a = t[e];
707
- if (n = r(n) ? n : n[a], i = r(i) ? i : i[a], n === null && i !== null) return !0;
821
+ if (n = i(n) ? n : n[a], r = i(r) ? r : r[a], n === null && r !== null) return !0;
708
822
  }
709
823
  return !1;
710
- }, me = (t, n, r, i) => {
711
- let a = x(h, t);
712
- if (a) {
713
- if (pe(t)) return;
714
- let o = v(x(y, t)), s = x(y, t, v(r) ? x(g, t) : r);
715
- v(s) || i && i.defaultChecked || n ? w(y, t, n ? s : ve(a._f)) : Le(t, s), T.mount && !T.action && (B(), o && c.isDirty && (I.isDirty || L.isDirty) && (Q() || (c.isDirty = !1, R.state.next({ ...c }))), e.shouldUnregister && o && !v(x(y, t)) && we(t, E) && (T.watch = !0));
824
+ }, ke = (e) => {
825
+ if (!O.actionArrayLengths.size) return !1;
826
+ let t = De(e), n = x, r = "", a = -1, o = 0;
827
+ for (let e = 0; e < t.length; e++) {
828
+ if (i(n)) return !1;
829
+ let s = t[e];
830
+ if (r = r ? `${r}.${s}` : s, Array.isArray(n) && +s >= n.length) return a === -1 ? !1 : e !== a || +s < o;
831
+ if (O.actionArrayLengths.has(r) && (a = e + 1, o = O.actionArrayLengths.get(r)), n = n[s], C(n) && a !== -1 && e > a && +t[a] < o) return !0;
716
832
  }
717
- }, he = (e, t, n, r, a) => {
718
- let o = !1, s = !1, l = { name: e };
719
- if (!i.disabled) {
833
+ return !1;
834
+ }, Ae = (e) => {
835
+ let t = x;
836
+ for (let n of De(e)) {
837
+ if (Array.isArray(t) && +n >= t.length) return !0;
838
+ t &&= t[n];
839
+ }
840
+ return !1;
841
+ }, Ie = (e, t, n, r) => {
842
+ let i = w(u, e);
843
+ if (i) {
844
+ if (Oe(e) || ke(e)) return;
845
+ let o = C(w(x, e)), s = w(x, e, C(n) ? w(b, e) : n), l = !!r && !c.isReady && be(r);
846
+ if (C(s) || r && r.defaultChecked || l || t) {
847
+ let n = t ? s : Ne(i._f);
848
+ C(n) && Ae(e) || (B("dirtyFields") && !P(w(x, e), n) && (k = !0), D(x, e, n), l && Ve(e, n));
849
+ } else tt(e, s);
850
+ O.mount && !O.action && (a.resolver && B("isValidating", "validatingFields") ? Promise.resolve().then(() => J()) : J(), o && c.isDirty && B("isDirty") && ($() || (c.isDirty = !1, U.state.next({ ...c }))), a.shouldUnregister && o && !C(w(x, e)) && re(e, A) && (O.watch = !0));
851
+ }
852
+ }, Ve = (e, t, n, r, i) => {
853
+ let s = !1, l = !1, d = { name: e };
854
+ if (!a.disabled || r === !0) {
720
855
  if (!n || r) {
721
- let n = P(x(g, e), t);
722
- (I.isDirty || L.isDirty) && (s = c.isDirty, c.isDirty = l.isDirty = !n || Q(), o = s !== l.isDirty), s = !!x(c.dirtyFields, e), n === c.isDirty ? n ? H(c.dirtyFields, e) : w(c.dirtyFields, e, !0) : c.dirtyFields = G(g, y), l.dirtyFields = c.dirtyFields, o ||= (I.dirtyFields || L.dirtyFields) && s !== !n;
856
+ let n = P(w(b, e), t);
857
+ if (B("isDirty") && (l = c.isDirty, c.isDirty = d.isDirty = !n || $(), s = l !== d.isDirty), l = !!w(c.dirtyFields, e), n) Y(c.dirtyFields, e);
858
+ else {
859
+ let n = w(b, e), r = w(u, e), i = !(r && r._f) && (o(n) || Array.isArray(n)) ? Z(n, t, void 0, r) : !0;
860
+ D(c.dirtyFields, e, i);
861
+ }
862
+ let r = !1;
863
+ if (k || n && (B("isDirty") ? c.isDirty : $())) {
864
+ k = !1;
865
+ let e = Z(b, x, void 0, u);
866
+ P(c.dirtyFields, e) || (r = !0, Ke(c.dirtyFields, e));
867
+ }
868
+ d.dirtyFields = c.dirtyFields, s ||= B("dirtyFields") && (r || l !== !n);
723
869
  }
724
870
  if (n) {
725
- let t = x(c.touchedFields, e);
726
- t || (w(c.touchedFields, e, n), l.touchedFields = c.touchedFields, o ||= (I.touchedFields || L.touchedFields) && t !== n);
871
+ let t = _e(c.touchedFields, e) ? w(c.touchedFields, e) : void 0;
872
+ t || (D(c.touchedFields, e, n), d.touchedFields = c.touchedFields, s ||= B("touchedFields") && t !== n);
727
873
  }
728
- o && a && R.state.next(l);
874
+ s && i && U.state.next(d);
729
875
  }
730
- return o ? l : {};
731
- }, _e = (e, t, n, r) => {
732
- let a = x(c.errors, e), o = (I.isValid || L.isValid) && S(t) && c.isValid !== t;
733
- if (i.delayError && n ? (D = ce(() => U(e, n)), D(i.delayError)) : (clearTimeout(O), D = null, n ? w(c.errors, e, n) : H(c.errors, e), c.errors = { ...c.errors }), (n ? !P(a, n) : a) || !z(r) || o) {
876
+ return s ? d : {};
877
+ }, Je = (e, t, n, r) => {
878
+ let i = w(c.errors, e), o = B("isValid") && T(t) && c.isValid !== t;
879
+ if (a.delayError && n ? (j[e] = ue(e, () => Te(e, n)), j[e](a.delayError)) : (K(e), n ? D(c.errors, e, n) : Y(c.errors, e), c.errors = { ...c.errors }), (n ? !P(i, n, !0) : i) || !V(r) || o) {
734
880
  let n = {
735
881
  ...r,
736
- ...o && S(t) ? { isValid: t } : {},
882
+ ...o && T(t) ? { isValid: t } : {},
737
883
  errors: c.errors,
738
884
  name: e
739
885
  };
740
- c = {
741
- ...c,
742
- ...n
743
- }, R.state.next(n);
886
+ U.state.next(n);
744
887
  }
745
- }, K = async (e) => (V(e, !0), await i.resolver(y, i.context, ye(e || E.mount, h, i.criteriaMode, i.shouldUseNativeValidation))), q = async (e) => {
746
- let { errors: t } = await K(e);
747
- if (V(e), e) {
748
- for (let n of e) {
749
- let e = x(t, n);
750
- e ? E.array.has(n) && a(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))) ? Ae(c.errors, { [n]: e }, n) : w(c.errors, n, e) : H(c.errors, n);
888
+ }, Q = async (e) => (X(e, !0), await a.resolver(x, a.context, Pe(e || A.mount, u, a.criteriaMode, a.shouldUseNativeValidation))), Ye = async (e) => {
889
+ let t = G, n = se, r = e ? e.filter((e) => w(u, e)) : [], { errors: i } = await Q(e);
890
+ if (t !== G) return i;
891
+ if (X(e), e) {
892
+ for (let t of e) {
893
+ if (r.includes(t) && (!w(u, t) || ce[t] > n)) {
894
+ Y(i, t);
895
+ continue;
896
+ }
897
+ let e = w(i, t);
898
+ q(t);
899
+ let a = A.array.has(t) && o(e) && !Object.keys(e).some((e) => !Number.isNaN(Number(e))), s = w(u, t), l = o(s) && Object.keys(s).some((e) => e !== "_f");
900
+ a ? ae(c.errors, { [t]: e }, t) : e && (e.type || e.message) || Array.isArray(e) || o(e) && l ? D(c.errors, t, e) : Y(c.errors, t);
751
901
  }
752
902
  c.errors = { ...c.errors };
753
- } else c.errors = t;
754
- return t;
755
- }, xe = async ({ name: t, eventType: n }) => {
756
- if (e.validate) {
757
- let r = await e.validate({
758
- formValues: y,
903
+ } else Object.keys(j).forEach(K), c.errors = i;
904
+ return i;
905
+ }, Xe = async ({ name: e, eventType: t }) => {
906
+ if (a.validate) {
907
+ let n = G, r = await a.validate({
908
+ formValues: x,
759
909
  formState: c,
760
- name: t,
761
- eventType: n
910
+ name: e,
911
+ eventType: t
762
912
  });
763
- if (a(r)) for (let e in r) {
764
- let t = r[e];
765
- t && qe(`${Ne}.${e}`, {
766
- message: A(t.message) ? t.message : "",
767
- type: t.type || p.validate
768
- });
913
+ if (n !== G) return !0;
914
+ if (o(r)) {
915
+ let e = !0;
916
+ ft(v);
917
+ for (let t in r) {
918
+ let n = r[t];
919
+ n && (e = !1, pt(`${v}.${t}`, {
920
+ message: L(n.message) ? n.message : "",
921
+ type: n.type || g.validate
922
+ }));
923
+ }
924
+ return e;
769
925
  }
770
- else A(r) || !r ? qe(Ne, {
926
+ return L(r) || !r ? (pt(v, {
771
927
  message: r || "",
772
- type: p.validate
773
- }) : Ke(Ne);
774
- return r;
928
+ type: g.validate
929
+ }), !1) : (ft(v), !0);
775
930
  }
776
931
  return !0;
777
- }, X = async ({ fields: t, onlyCheckValid: n, name: r, eventType: a, context: o = {
932
+ }, Ze = async ({ fields: e, onlyCheckValid: t, name: n, eventType: r, context: i = {
778
933
  valid: !0,
779
934
  runRootValidation: !1
780
935
  } }) => {
781
- if (e.validate && (o.runRootValidation = !0, !await xe({
782
- name: r,
783
- eventType: a
784
- }) && (o.valid = !1, n))) return o.valid;
785
- for (let r in t) {
786
- let s = t[r];
936
+ let o = G;
937
+ if (a.validate && !i.runRootValidation && (i.runRootValidation = !0, !await Xe({
938
+ name: n,
939
+ eventType: r
940
+ }) && (i.valid = !1, t))) return i.valid;
941
+ for (let n in e) {
942
+ let s = e[n];
787
943
  if (s) {
788
- let { _f: t, ...l } = s;
789
- if (t) {
790
- let r = E.array.has(t.name), a = s._f && Se(s._f), l = I.validatingFields || I.isValidating || L.validatingFields || L.isValidating;
791
- a && l && V([t.name], !0);
792
- let u = await je(s, E.disabled, y, ee, i.shouldUseNativeValidation && !n, r);
793
- if (a && l && V([t.name]), u[t.name] && (o.valid = !1, n) || (!n && (x(u, t.name) ? r ? Ae(c.errors, u, t.name) : w(c.errors, t.name, u[t.name]) : H(c.errors, t.name)), e.shouldUseNativeValidation && u[t.name])) break;
944
+ let { _f: e, ...l } = s;
945
+ if (e) {
946
+ let n = A.array.has(e.name), r = s._f && Le(s._f), l = B("isValidating", "validatingFields");
947
+ r && l && X([e.name], !0);
948
+ let d = se, f = await de(s, A.disabled, x, le, a.shouldUseNativeValidation && !t, n);
949
+ if (o !== G) return i.valid;
950
+ if (r && l && X([e.name]), !w(u, e.name) || ce[e.name] > d) continue;
951
+ if (f[e.name] && (i.valid = !1, t) || (t || (K(e.name), w(f, e.name) ? n ? ae(c.errors, f, e.name) : D(c.errors, e.name, f[e.name]) : Y(c.errors, e.name)), a.shouldUseNativeValidation && f[e.name])) break;
794
952
  }
795
- !z(l) && await X({
796
- context: o,
797
- onlyCheckValid: n,
953
+ !V(l) && await Ze({
954
+ context: i,
955
+ onlyCheckValid: t,
798
956
  fields: l,
799
- name: r,
800
- eventType: a
957
+ name: n,
958
+ eventType: r
801
959
  });
802
960
  }
803
961
  }
804
- return o.valid;
805
- }, Z = () => {
806
- for (let e of E.unMount) {
807
- let t = x(h, e);
808
- t && (t._f.refs ? t._f.refs.every((e) => !ue(e)) : !ue(t._f.ref)) && Ze(e);
962
+ return i.valid;
963
+ }, Qe = () => {
964
+ for (let e of A.unMount) {
965
+ let t = w(u, e);
966
+ t && (t._f.refs ? t._f.refs.every((e) => !Se(e)) : !Se(t._f.ref)) && _t(e);
809
967
  }
810
- E.unMount = /* @__PURE__ */ new Set();
811
- }, Q = (e, t) => !i.disabled && (e && t && w(y, e, t), !P(T.mount ? y : g, g)), Fe = (e, t, n) => j(e, E, { ...T.mount ? y : v(t) ? g : A(e) ? { [e]: t } : t }, n, t), Ie = (e) => te(x(T.mount ? y : g, e, i.shouldUnregister ? x(g, e, []) : [])), Le = (e, n, i = {}, a = !1, o = !1) => {
812
- let s = x(h, e), c = n;
813
- if (s) {
814
- let i = s._f;
815
- i && (!i.disabled && w(y, e, ge(n, i)), c = oe(i.ref) && r(n) ? "" : n, se(i.ref) ? [...i.ref.options].forEach((e) => e.selected = c.includes(e.value)) : i.refs ? t(i.ref) ? i.refs.forEach((e) => {
816
- (!e.defaultChecked || !e.disabled) && (Array.isArray(c) ? e.checked = !!c.find((t) => t === e.value) : e.checked = c === e.value || !!c);
817
- }) : i.refs.forEach((e) => e.checked = e.value === c) : ae(i.ref) ? i.ref.value = "" : (i.ref.value = c, !i.ref.type && !o && R.state.next({
968
+ A.unMount = /* @__PURE__ */ new Set();
969
+ }, $ = (e, t) => (e && !C(t) && D(x, e, t), !P(O.mount ? x : b, b)), $e = (e, t, n) => {
970
+ let r = O.mount ? x : C(t) || !C(e) ? b : t;
971
+ return te(e, A, C(e) ? { ...r } : r, n, t);
972
+ }, et = (e) => pe(w(O.mount ? x : b, e, a.shouldUnregister ? w(b, e, []) : [])), tt = (e, r, a = {}, o = !1, s = !1, c = !1) => {
973
+ let l = w(u, e), d = r;
974
+ if (l) {
975
+ let a = l._f;
976
+ a && (!a.disabled && D(x, e, Me(r, a)), d = oe(a.ref) && i(r) ? "" : r, ve(a.ref) ? [...a.ref.options].forEach((e) => e.selected = d.includes(e.value)) : a.refs ? t(a.ref) ? a.refs.forEach((e) => {
977
+ e.defaultChecked && e.disabled || (e.checked = Array.isArray(d) ? !!d.find((t) => t === e.value) : d === e.value || !!d);
978
+ }) : a.refs.forEach((e) => e.checked = e.value === d) : n(a.ref) ? a.ref.value = "" : (a.ref.value = d, a.ref.type || s || c || U.state.next({
818
979
  name: e,
819
- values: a ? y : u(y)
980
+ values: o ? x : H(e) ? p(x) : void 0
820
981
  })));
821
982
  }
822
- (i.shouldDirty || i.shouldTouch) && he(e, c, i.shouldTouch, i.shouldDirty, !o), i.shouldValidate && Ue(e);
823
- }, Re = (e, t, r, i = !1, o = !1) => {
824
- for (let s in t) {
825
- if (!t.hasOwnProperty(s)) return;
826
- let c = t[s], l = e + "." + s, u = x(h, l);
827
- (E.array.has(e) || a(c) || u && !u._f) && !n(c) ? Re(l, c, r, i, o) : Le(l, c, r, i, o);
983
+ (a.shouldDirty || a.shouldTouch) && Ve(e, l && l._f && !l._f.disabled && (l._f.valueAsNumber || l._f.valueAsDate || l._f.setValueAs) ? Me(r, l._f) : d, a.shouldTouch, a.shouldDirty, !s), a.shouldValidate && ct(e, { delayError: a.delayError }), a.shouldValidate && l && l._f && l._f.deps && (!Array.isArray(l._f.deps) || l._f.deps.length > 0) && ct(l._f.deps);
984
+ }, nt = (e, t, n, i = !1, a = !1, s = !1) => {
985
+ for (let c in t) {
986
+ if (!Object.prototype.hasOwnProperty.call(t, c)) continue;
987
+ let l = t[c], d = e + "." + c, f = w(u, d);
988
+ A.array.has(d) && U.array.next({
989
+ name: d,
990
+ values: i ? x : p(x)
991
+ }), (A.array.has(e) || o(l) || f && !f._f) && !r(l) ? nt(d, l, n, i, a, s) : tt(d, l, n, i, a, s);
828
992
  }
829
- }, ze = (e, t, n, i, a = !1) => {
830
- let o = x(h, e), s = E.array.has(e), l = i ? t : u(t), d = P(x(y, e), l);
831
- if (d || w(y, e, l), s) R.array.next({
993
+ }, rt = (e, t, n, r, a = !1) => {
994
+ let o = w(u, e), s = A.array.has(e), l = r ? t : p(t), d = P(w(x, e), l);
995
+ if (d || D(x, e, l), s) U.array.next({
832
996
  name: e,
833
- values: i ? y : u(y)
834
- }), (I.isDirty || I.dirtyFields || L.isDirty || L.dirtyFields) && n.shouldDirty && (de(), a || R.state.next({
997
+ values: r ? x : p(x)
998
+ }), B("isDirty", "dirtyFields") && n.shouldDirty && (ye(), c.isDirty = $(e, l), a || U.state.next({
835
999
  name: e,
836
1000
  dirtyFields: c.dirtyFields,
837
- isDirty: Q(e, l)
838
- }));
1001
+ isDirty: c.isDirty
1002
+ })), n.shouldValidate && ct(e, { delayError: n.delayError });
839
1003
  else {
840
- let t = Array.isArray(l) && !l.length || z(l);
841
- !o || o._f || r(l) || t ? Le(e, l, n, i, a) : Re(e, l, n, i, a);
1004
+ let t = Array.isArray(l) && !l.length || V(l), s = !d && !a;
1005
+ !o || o._f || i(l) || t ? tt(e, l, n, r, a, s) : nt(e, l, n, r, a, s);
842
1006
  }
843
1007
  if (!d && !a) {
844
- let t = we(e, E), n = i ? y : u(y);
845
- R.state.next({
1008
+ let t = re(e, A), n = O.mount || t ? e : void 0, i = s ? [] : je(A.array, e), a = r ? x : H(n) || i.some(H) ? p(x) : void 0;
1009
+ U.state.next({
846
1010
  ...t && c,
847
- name: T.mount || t ? e : void 0,
848
- values: n
1011
+ name: n,
1012
+ values: a
1013
+ });
1014
+ for (let e of i) U.state.next({
1015
+ name: e,
1016
+ values: a
849
1017
  });
850
1018
  }
851
- }, $ = (e, t, n = {}) => ze(e, t, n, !1), Be = (e, t = {}) => {
852
- let n = C(e) ? e(y) : e;
853
- if (!P(y, n)) {
854
- y = {
855
- ...y,
1019
+ }, it = (e, t, n = {}) => rt(e, t, n, !1), at = (e, t = {}) => {
1020
+ let n = E(e) ? e(x) : e;
1021
+ if (!P(x, n)) {
1022
+ x = {
1023
+ ...x,
856
1024
  ...n
857
1025
  };
858
- for (let e of E.mount) ze(e, x(n, e), t, !0, !0);
859
- R.state.next({
1026
+ for (let e of /* @__PURE__ */ new Set([...A.mount, ...A.array])) _e(n, e) && rt(e, w(n, e), t, !0, !0);
1027
+ U.state.next({
860
1028
  ...c,
861
1029
  name: void 0,
862
1030
  type: void 0,
863
- ...k ? { values: y } : {}
864
- }), t.shouldValidate && B();
1031
+ ...N.size ? { values: x } : {}
1032
+ }), t.shouldValidate && J();
865
1033
  }
866
- }, Ve = async (t) => {
867
- T.mount = !0;
868
- let r = t.target, a = r.name, s = !0, l = x(h, a), f = (e) => {
869
- s = Number.isNaN(e) || n(e) && isNaN(e.getTime()) || P(e, x(y, a, e));
1034
+ }, ot = async (e) => {
1035
+ O.mount = !0;
1036
+ let t = e.target, n = t.name, r = !0, i = w(u, n), o = se, l = (e) => {
1037
+ r = !!w(u, n) && !(ce[n] > o) && P(e, w(x, n, e));
870
1038
  };
871
- if (l) {
872
- let n, p, m = r.type ? ve(l._f) : o(t), g = t.type === d.BLUR || t.type === d.FOCUS_OUT, _ = !Ce(l._f) && !e.validate && !i.resolver && !x(c.errors, a) && !l._f.deps, v = _ || Oe(g, x(c.touchedFields, a), c.isSubmitted, N, M), b = we(a, E, g);
873
- 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);
874
- let S = he(a, m, g), C = !z(S) || b;
875
- if (!g && R.state.next({
876
- name: a,
877
- type: t.type,
878
- ...k ? { values: u(y) } : {}
879
- }), v) return (!_ || !c.isValid) && (I.isValid || L.isValid) && (i.mode === "onBlur" ? g && B() : g || B()), C && R.state.next({
880
- name: a,
881
- ...b ? {} : S
1039
+ if (i) {
1040
+ O.keepIsValid = !1;
1041
+ let o, d, f = !1, h = t.type ? Ne(i._f) : s(e), g = e.type === m.BLUR || e.type === m.FOCUS_OUT, _ = !Re(i._f) && !a.validate && !a.resolver && !w(c.errors, n) && !i._f.deps, v = _ || Ue(g, w(c.touchedFields, n), c.isSubmitted, F, ee), y = re(n, A, g);
1042
+ D(x, n, p(h)), g ? t && t.readOnly || (i._f.onBlur && i._f.onBlur(e), Object.prototype.hasOwnProperty.call(j, n) && (f = !0, j[n](0))) : i._f.onChange && i._f.onChange(e);
1043
+ let b = Ve(n, h, g), S = !V(b) || y;
1044
+ if (!g && U.state.next({
1045
+ name: n,
1046
+ type: e.type,
1047
+ ...H(n) ? { values: p(x) } : {}
1048
+ }), v) return _ && c.isValid || !B("isValid") || (a.mode === "onBlur" ? g && J() : g || J()), S && U.state.next({
1049
+ name: n,
1050
+ ...y ? {} : b
882
1051
  });
883
- if (!i.resolver && e.validate && await xe({
884
- name: a,
885
- eventType: t.type
886
- }), !g && b && R.state.next({ ...c }), i.resolver) {
887
- let { errors: e } = await K([a]);
888
- if (V([a]), f(m), !s) {
889
- !z(S) && R.state.next(S);
1052
+ if (!a.resolver && a.validate && await Xe({
1053
+ name: n,
1054
+ eventType: e.type
1055
+ }), !g && y && U.state.next({ ...c }), a.resolver) {
1056
+ let e = G, { errors: t } = await Q([n]);
1057
+ if (e !== G) return;
1058
+ if (X([n]), l(h), !r) {
1059
+ !V(b) && U.state.next(b);
890
1060
  return;
891
1061
  }
892
- let t = Te(c.errors, h, a), r = Te(e, h, t.name || a);
893
- n = r.error, a = r.name, p = z(e);
894
- } else V([a], !0), n = (await je(l, E.disabled, y, ee, i.shouldUseNativeValidation))[a], V([a]), f(m), s && (n ? p = !1 : (I.isValid || L.isValid) && (p = await X({
895
- fields: h,
896
- onlyCheckValid: !0,
897
- name: a,
898
- eventType: t.type
899
- })));
900
- s && (l._f.deps && (!Array.isArray(l._f.deps) || l._f.deps.length > 0) && Ue(l._f.deps), _e(a, p, n, S));
1062
+ let i = ze(c.errors, u, n), a = ze(t, u, i.name || n);
1063
+ o = a.error, n = a.name, d = V(t);
1064
+ } else {
1065
+ let t = G, s = ++W;
1066
+ if (X([n], !0), o = (await de(i, A.disabled, x, le, a.shouldUseNativeValidation))[n], t !== G) return;
1067
+ if (X([n]), l(h), r) {
1068
+ if (o) d = !1;
1069
+ else if (B("isValid")) {
1070
+ if (d = await Ze({
1071
+ fields: u,
1072
+ onlyCheckValid: !0,
1073
+ name: n,
1074
+ eventType: e.type
1075
+ }), t !== G) return;
1076
+ l(h), s !== W && (d = void 0);
1077
+ }
1078
+ }
1079
+ }
1080
+ r && (i._f.deps && (!Array.isArray(i._f.deps) || i._f.deps.length > 0) && ct(i._f.deps), Je(n, d, o, b), f && Object.prototype.hasOwnProperty.call(j, n) && j[n](0));
901
1081
  }
902
- }, He = (e, t) => {
903
- if (x(c.errors, t) && e.focus) return e.focus(), 1;
904
- }, Ue = async (e, t = {}) => {
905
- let n, r, a = ne(e);
906
- if (i.resolver) {
907
- let t = await q(v(e) ? e : a);
908
- n = z(t), r = e ? !a.some((e) => x(t, e)) : n;
909
- } else e ? (r = (await Promise.all(a.map(async (e) => {
910
- let t = x(h, e);
911
- return await X({
1082
+ }, st = (e, t) => {
1083
+ if (w(c.errors, t) && e.focus) return e.focus(), 1;
1084
+ }, ct = async (e, t = {}) => {
1085
+ O.keepIsValid = !1;
1086
+ let n, r, i = fe(e), o = G;
1087
+ if (a.resolver) {
1088
+ let t = await Ye(C(e) ? e : i);
1089
+ n = V(t), r = e ? !i.some((e) => w(t, e)) : n;
1090
+ } else e ? (r = (await Promise.all(i.map(async (e) => {
1091
+ let t = w(u, e);
1092
+ return await Ze({
912
1093
  fields: t && t._f ? { [e]: t } : t,
913
- eventType: d.TRIGGER
1094
+ eventType: m.TRIGGER
914
1095
  });
915
- }))).every(Boolean), !(!r && !c.isValid) && B()) : r = n = await X({
916
- fields: h,
1096
+ }))).every(Boolean), (r || c.isValid) && J()) : r = n = await Ze({
1097
+ fields: u,
917
1098
  name: e,
918
- eventType: d.TRIGGER
1099
+ eventType: m.TRIGGER
919
1100
  });
920
- return R.state.next({
921
- ...!A(e) || (I.isValid || L.isValid) && n !== c.isValid ? {} : { name: e },
922
- ...i.resolver || !e ? { isValid: n } : {},
1101
+ if (o !== G) return r;
1102
+ if (t.delayError && a.delayError && L(e)) {
1103
+ let t = w(c.errors, e);
1104
+ t ? (Y(c.errors, e), j[e] = ue(e, () => Te(e, t)), j[e](a.delayError)) : K(e);
1105
+ }
1106
+ if (t.shouldTouch) for (let t of e ? i : A.mount) !A.array.has(t) && D(c.touchedFields, t, !0);
1107
+ return c.errors = { ...c.errors }, U.state.next({
1108
+ ...!L(e) || B("isValid") && n !== c.isValid ? {} : { name: e },
1109
+ ...a.resolver || !e ? { isValid: n } : {},
1110
+ ...t.shouldTouch && B("touchedFields") ? { touchedFields: c.touchedFields } : {},
923
1111
  errors: c.errors
924
- }), t.shouldFocus && !r && Y(h, He, e ? a : E.mount), r;
925
- }, We = (e, t) => {
926
- let n = { ...T.mount ? y : g };
927
- return t && (n = ie(t.dirtyFields ? c.dirtyFields : c.touchedFields, n)), v(e) ? n : A(e) ? x(n, e) : e.map((e) => x(n, e));
928
- }, Ge = (e, t) => ({
929
- invalid: !!x((t || c).errors, e),
930
- isDirty: !!x((t || c).dirtyFields, e),
931
- error: x((t || c).errors, e),
932
- isValidating: !!x(c.validatingFields, e),
933
- isTouched: !!x((t || c).touchedFields, e)
934
- }), Ke = (e) => {
935
- let t = e ? ne(e) : void 0;
936
- t?.forEach((e) => H(c.errors, e)), t ? t.forEach((e) => {
937
- R.state.next({
1112
+ }), t.shouldFocus && !r && ie(u, st, e ? i : A.mount), r;
1113
+ }, lt = ((e, t) => {
1114
+ let n = C(e) && !t ? { ...O.mount ? x : b } : O.mount ? x : b;
1115
+ return t && (n = ge(t.dirtyFields ? c.dirtyFields : c.touchedFields, n)), C(e) ? n : L(e) ? w(n, e) : e.map((e) => w(n, e));
1116
+ }), ut = ((e) => C(e) ? { ...c.errors } : L(e) ? w(c.errors, e) : e.map((e) => w(c.errors, e))), dt = (e, t) => {
1117
+ let n = t || c, r = w(n.errors, e);
1118
+ return {
1119
+ invalid: !!r,
1120
+ isDirty: !!w(n.dirtyFields, e),
1121
+ error: r,
1122
+ isValidating: !!w(n.validatingFields, e),
1123
+ isTouched: !!w(n.touchedFields, e)
1124
+ };
1125
+ }, ft = (e) => {
1126
+ let t = e ? fe(e) : void 0;
1127
+ t ? t.forEach((e) => {
1128
+ q(e), Y(c.errors, e), c.errors = { ...c.errors }, U.state.next({
938
1129
  name: e,
939
1130
  errors: c.errors
940
1131
  });
941
- }) : R.state.next({ errors: {} });
942
- }, qe = (e, t, n) => {
943
- let r = (x(h, e, { _f: {} })._f || {}).ref, { ref: i, message: a, type: o, ...s } = x(c.errors, e) || {};
944
- w(c.errors, e, {
945
- ...s,
1132
+ }) : (Object.keys(j).forEach(K), c.errors = {}, U.state.next({ errors: c.errors }));
1133
+ }, pt = (e, t, n) => {
1134
+ q(e);
1135
+ let r = w(u, e, { _f: {} }), i = r._f && r._f.ref, { ref: a, message: o, type: s, types: l, ...d } = w(c.errors, e) || {};
1136
+ D(c.errors, e, {
1137
+ ...d,
946
1138
  ...t,
947
- ref: r
948
- }), R.state.next({
1139
+ ref: i
1140
+ }), c.errors = { ...c.errors }, U.state.next({
949
1141
  name: e,
950
1142
  errors: c.errors,
951
1143
  isValid: !1
952
- }), n && n.shouldFocus && r && r.focus && r.focus();
953
- }, Je = (e, t) => {
954
- if (C(e)) {
955
- k++;
956
- let { unsubscribe: n } = R.state.subscribe({ next: (n) => "values" in n && e(n.values || Fe(void 0, t), n) }), r = !1;
1144
+ }), n && n.shouldFocus && i && i.focus && i.focus();
1145
+ }, mt = (e, t) => {
1146
+ if (E(e)) {
1147
+ let n = {};
1148
+ N.add(n);
1149
+ let { unsubscribe: r } = U.state.subscribe({ next: (n) => "values" in n && e(n.values || $e(void 0, t), n) });
957
1150
  return { unsubscribe: () => {
958
- r || (r = !0, k--, n());
1151
+ N.delete(n), r();
959
1152
  } };
960
1153
  }
961
- return Fe(e, t, !0);
962
- }, Ye = (e) => {
963
- let t = !!e.formState?.values;
964
- t && k++;
965
- let { unsubscribe: n } = R.state.subscribe({ next: (t) => {
966
- if (De(e.name, t.name, e.exact) && Ee(t, e.formState || I, st, e.reRenderRoot)) {
967
- let n = { ...y };
1154
+ return $e(e, t, !0);
1155
+ }, ht = (e) => {
1156
+ let t = {
1157
+ name: e.name,
1158
+ exact: e.exact
1159
+ };
1160
+ e.formState && e.formState.values && N.add(t);
1161
+ let { unsubscribe: n } = U.state.subscribe({ next: (t) => {
1162
+ if (He(e.name, t.name, e.exact) && Be(t, e.formState || R, e.reRenderRoot)) {
1163
+ let n = t.values || { ...x };
968
1164
  e.callback({
969
- values: n,
970
1165
  ...c,
971
1166
  ...t,
972
- defaultValues: g
1167
+ validatingFields: c.validatingFields,
1168
+ isValidating: c.isValidating,
1169
+ values: n,
1170
+ defaultValues: b
973
1171
  });
974
1172
  }
975
1173
  } });
976
- if (!t) return n;
977
- let r = !1;
978
1174
  return () => {
979
- r || (r = !0, k--, n());
1175
+ N.delete(t), n();
980
1176
  };
981
- }, Xe = (e) => (T.mount = !0, L = {
982
- ...L,
983
- ...e.formState
984
- }, Ye({
985
- ...e,
986
- formState: {
987
- ...F,
988
- ...e.formState
989
- }
990
- })), Ze = (e, t = {}) => {
991
- for (let n of e ? ne(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);
992
- R.state.next({ values: u(y) }), R.state.next({
1177
+ }, gt = (e) => {
1178
+ O.mount = !0;
1179
+ let t = Object.keys(e.formState || {}).filter((t) => e.formState && e.formState[t]);
1180
+ for (let e of t) z[e] = (z[e] || 0) + 1;
1181
+ let n = ht({
1182
+ ...e,
1183
+ formState: {
1184
+ ...I,
1185
+ ...e.formState
1186
+ }
1187
+ });
1188
+ return () => {
1189
+ for (let e of t.splice(0)) z[e]--;
1190
+ n();
1191
+ };
1192
+ }, _t = (e, t = {}) => {
1193
+ let n = e ? fe(e) : A.mount;
1194
+ t.keepIsValidating || me(n);
1195
+ for (let e of n) A.mount.delete(e), A.array.delete(e), A.disabled.delete(e), Y(u, e), !t.keepValue && Y(x, e), t.keepError || (q(e), Y(c.errors, e)), !t.keepDirty && Y(c.dirtyFields, e), !t.keepTouched && Y(c.touchedFields, e), !a.shouldUnregister && !t.keepDefaultValue && Y(b, e);
1196
+ t.keepError || (c.errors = { ...c.errors }), N.size && U.state.next({ values: p(x) }), U.state.next({
993
1197
  ...c,
994
- ...t.keepDirty ? { isDirty: Q() } : {}
995
- }), !t.keepIsValid && B();
996
- }, Qe = ({ disabled: e, name: t }) => {
997
- if (S(e) && T.mount || e || E.disabled.has(t)) {
998
- let n = E.disabled.has(t) !== !!e;
999
- e ? E.disabled.add(t) : E.disabled.delete(t), n && T.mount && !T.action && B();
1198
+ ...t.keepDirty ? {} : { isDirty: $() },
1199
+ ...t.keepIsValidating ? {} : { isValidating: !V(c.validatingFields) }
1200
+ }), !t.keepIsValid && J();
1201
+ }, vt = ({ disabled: e, name: t }) => {
1202
+ if (T(e) && O.mount || e || A.disabled.has(t)) {
1203
+ let n = A.disabled.has(t) !== !!e;
1204
+ e ? A.disabled.add(t) : A.disabled.delete(t), n && O.mount && !O.action && J();
1000
1205
  }
1001
- }, $e = (e, t = {}) => {
1002
- let n = x(h, e), r = S(t.disabled) || S(i.disabled), a = !E.registerName.has(e) && n && n._f && !n._f.mount;
1003
- return w(h, e, {
1206
+ }, yt = (e, t = {}) => {
1207
+ let n = w(u, e), r = T(t.disabled) || T(a.disabled), i = !A.registerName.has(e) && n && n._f && !n._f.mount;
1208
+ if (n && n._f || (ce[e] = ++se), D(u, e, {
1004
1209
  ...n || {},
1005
1210
  _f: {
1006
1211
  ...n && n._f ? n._f : { ref: { name: e } },
@@ -1008,92 +1213,122 @@ function Q(e = {}) {
1008
1213
  mount: !0,
1009
1214
  ...t
1010
1215
  }
1011
- }), E.mount.add(e), n && !a ? Qe({
1012
- disabled: S(t.disabled) ? t.disabled : i.disabled,
1216
+ }), A.mount.add(e), n && n._f) {
1217
+ let n = w(u, e);
1218
+ for (let e of _) e in t || delete n._f[e];
1219
+ }
1220
+ return n && !i ? vt({
1221
+ disabled: T(t.disabled) ? t.disabled : a.disabled,
1013
1222
  name: e
1014
- }) : me(e, !0, t.value), {
1015
- ...r ? { disabled: t.disabled || i.disabled } : {},
1016
- ...i.progressive ? {
1017
- required: !!t.required,
1018
- min: J(t.min),
1019
- max: J(t.max),
1020
- minLength: J(t.minLength),
1021
- maxLength: J(t.maxLength),
1022
- pattern: J(t.pattern)
1223
+ }) : Ie(e, !0, t.value), {
1224
+ ...r ? { disabled: t.disabled || a.disabled } : {},
1225
+ ...a.progressive ? {
1226
+ required: !!Fe(t.required),
1227
+ min: Fe(t.min),
1228
+ max: Fe(t.max),
1229
+ minLength: Fe(t.minLength),
1230
+ maxLength: Fe(t.maxLength),
1231
+ pattern: Fe(t.pattern)
1023
1232
  } : {},
1024
1233
  name: e,
1025
- onChange: Ve,
1026
- onBlur: Ve,
1234
+ onChange: ot,
1235
+ onBlur: ot,
1027
1236
  ref: (r) => {
1028
1237
  if (r) {
1029
- E.registerName.add(e), $e(e, t), E.registerName.delete(e), n = x(h, e);
1030
- let i = v(r.value) && r.querySelectorAll && r.querySelectorAll("input,select,textarea")[0] || r, a = le(i), o = n._f.refs || [];
1238
+ A.registerName.add(e), yt(e, t), A.registerName.delete(e), n = w(u, e);
1239
+ let i = C(r.value) && r.querySelectorAll && r.querySelectorAll("input,select,textarea")[0] || r, a = xe(i), o = n._f.refs || [];
1031
1240
  if (a ? o.find((e) => e === i) : i === n._f.ref) return;
1032
- w(h, e, { _f: {
1033
- ...n._f,
1034
- ...a ? {
1035
- refs: [
1036
- ...o.filter(ue),
1037
- i,
1038
- ...Array.isArray(x(g, e)) ? [{}] : []
1039
- ],
1040
- ref: {
1041
- type: i.type,
1042
- name: e
1043
- }
1044
- } : { ref: i }
1045
- } }), me(e, !1, void 0, i);
1046
- } 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);
1241
+ let s = { ...n._f };
1242
+ a ? (s.refs = [
1243
+ ...o.filter(Se),
1244
+ i,
1245
+ ...Array.isArray(w(b, e)) ? [{}] : []
1246
+ ], s.ref = {
1247
+ type: i.type,
1248
+ name: e
1249
+ }) : (s.ref = i, delete s.refs), D(u, e, { _f: s }), Ie(e, !1, void 0, i);
1250
+ } else n = w(u, e, {}), n._f && (n._f.mount = !1), (a.shouldUnregister || t.shouldUnregister) && !(d(A.array, e) && O.action) && A.unMount.add(e);
1047
1251
  }
1048
1252
  };
1049
- }, et = () => i.shouldFocusError && !i.shouldUseNativeValidation && Y(h, He, E.mount), tt = (e) => {
1050
- S(e) && (R.state.next({ disabled: e }), Y(h, (t, n) => {
1051
- let r = x(h, n);
1253
+ }, bt = () => a.shouldFocusError && !a.shouldUseNativeValidation && ie(u, st, A.mount), xt = (e) => {
1254
+ T(e) && (U.state.next({ disabled: e }), ie(u, (t, n) => {
1255
+ let r = w(u, n);
1052
1256
  r && (t.disabled = r._f.disabled || e, Array.isArray(r._f.refs) && r._f.refs.forEach((t) => {
1053
1257
  t.disabled = r._f.disabled || e;
1054
1258
  }));
1055
- }, 0, !1));
1056
- }, nt = (e, t) => async (n) => {
1057
- let r;
1259
+ }, 0));
1260
+ }, St = (e, t) => async (n) => {
1261
+ let r, i;
1058
1262
  n && (n.preventDefault && n.preventDefault(), n.persist && n.persist());
1059
- let a = u(y);
1060
- if (R.state.next({ isSubmitting: !0 }), i.resolver) {
1061
- let { errors: e, values: t } = await K();
1062
- V(), c.errors = e, a = u(t);
1063
- } else await X({
1064
- fields: h,
1065
- eventType: d.SUBMIT
1066
- });
1067
- if (E.disabled.size) for (let e of E.disabled) H(a, e);
1068
- if (H(c.errors, m), z(c.errors)) {
1069
- R.state.next({ errors: {} });
1263
+ let o = p(x);
1264
+ U.state.next({ isSubmitting: !0 });
1265
+ let s = G, l = (e) => {
1266
+ throw s === G && U.state.next({ isSubmitting: !1 }), e;
1267
+ };
1268
+ if (a.resolver) {
1269
+ let e;
1070
1270
  try {
1071
- await e(a, n);
1271
+ e = await Q();
1072
1272
  } catch (e) {
1073
- r = e;
1273
+ l(e);
1074
1274
  }
1075
- } else t && await t({ ...c.errors }, n), et(), setTimeout(et);
1076
- if (R.state.next({
1275
+ let { errors: t, values: n } = e;
1276
+ if (s !== G) return;
1277
+ X(), Object.keys(j).forEach(K), c.errors = t, o = p(n);
1278
+ } else {
1279
+ try {
1280
+ await Ze({
1281
+ fields: u,
1282
+ eventType: m.SUBMIT
1283
+ });
1284
+ } catch (e) {
1285
+ l(e);
1286
+ }
1287
+ if (s !== G) return;
1288
+ Y(c.errors, y), c.errors = { ...c.errors };
1289
+ }
1290
+ if (A.disabled.size) for (let e of A.disabled) Y(o, e);
1291
+ if (V(c.errors)) {
1292
+ U.state.next({ errors: {} });
1293
+ try {
1294
+ r = await e(o, n);
1295
+ } catch (e) {
1296
+ i = e;
1297
+ }
1298
+ } else {
1299
+ if (t) try {
1300
+ await t({ ...c.errors }, n);
1301
+ } catch (e) {
1302
+ l(e);
1303
+ }
1304
+ bt(), setTimeout(bt);
1305
+ }
1306
+ if (U.state.next({
1077
1307
  isSubmitted: !0,
1078
1308
  isSubmitting: !1,
1079
- isSubmitSuccessful: z(c.errors) && !r,
1309
+ isSubmitSuccessful: V(c.errors) && !i,
1080
1310
  submitCount: c.submitCount + 1,
1081
1311
  errors: c.errors
1082
- }), r) throw r;
1083
- }, rt = (e, t = {}) => {
1084
- x(h, e) && (v(t.defaultValue) ? $(e, u(x(g, e))) : ($(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 ? Q(e, u(x(g, e))) : Q()), t.keepError || (H(c.errors, e), I.isValid && B()), R.state.next({ ...c }));
1085
- }, it = (e, t = {}) => {
1086
- let n = e ? u(e) : g, r = u(n), a = z(e), o = r;
1087
- if (t.keepDefaultValues || (g = n), !t.keepValues) {
1312
+ }), i) throw i;
1313
+ return r;
1314
+ }, Ct = (e, t = {}) => {
1315
+ w(u, e) && (me([e]), C(t.defaultValue) ? it(e, p(w(b, e))) : (it(e, t.defaultValue), D(b, e, p(t.defaultValue))), t.keepTouched || Y(c.touchedFields, e), t.keepDirty || (Y(c.dirtyFields, e), c.isDirty = C(t.defaultValue) ? $() : $(e, p(w(b, e)))), t.keepError || (q(e), Y(c.errors, e), c.errors = { ...c.errors }, J()), U.state.next({
1316
+ ...c,
1317
+ isValidating: !V(c.validatingFields)
1318
+ }));
1319
+ }, wt = (e, t = {}) => {
1320
+ G++, W++;
1321
+ let n = e ? p(e) : b, r = p(n), i = V(e), o = r, s = u;
1322
+ if (Object.keys(j).forEach(K), t.keepDefaultValues || (b = n), !t.keepValues) {
1088
1323
  if (t.keepDirtyValues) {
1089
- let e = new Set([...E.mount, ...Object.keys(G(g, y))]);
1090
- for (let t of Array.from(e)) {
1091
- let e = x(c.dirtyFields, t), n = x(y, t), r = x(o, t);
1092
- e && !v(n) ? w(o, t, n) : !e && !v(r) && $(t, r);
1324
+ let e = /* @__PURE__ */ new Set([...A.mount, ...we(Z(b, x, void 0, s), c.dirtyFields)]);
1325
+ for (let t of e) {
1326
+ let e = w(c.dirtyFields, t), n = w(x, t), r = w(o, t);
1327
+ e && !C(n) ? D(o, t, n) : !e && !C(r) && it(t, r);
1093
1328
  }
1094
1329
  } else {
1095
- if (l && v(e)) for (let e of E.mount) {
1096
- let t = x(h, e);
1330
+ if (f && C(e)) for (let e of A.mount) {
1331
+ let t = w(u, e);
1097
1332
  if (t && t._f) {
1098
1333
  let e = Array.isArray(t._f.refs) ? t._f.refs[0] : t._f.ref;
1099
1334
  if (oe(e)) {
@@ -1105,199 +1340,248 @@ function Q(e = {}) {
1105
1340
  }
1106
1341
  }
1107
1342
  }
1108
- if (t.keepFieldsRef) for (let e of E.mount) $(e, x(o, e));
1109
- else h = {};
1343
+ if (t.keepFieldsRef) for (let e of A.mount) it(e, w(o, e));
1344
+ else u = {};
1110
1345
  }
1111
- if (i.shouldUnregister) {
1112
- if (y = t.keepDefaultValues ? u(g) : {}, t.keepFieldsRef) for (let e of E.mount) w(y, e, x(o, e));
1113
- } else y = u(o);
1114
- R.array.next({ values: { ...o } }), R.state.next({ values: { ...o } });
1346
+ if (a.shouldUnregister) {
1347
+ if (x = t.keepDefaultValues ? p(b) : {}, t.keepFieldsRef) for (let e of A.mount) D(x, e, w(o, e));
1348
+ } else x = p(o);
1349
+ U.array.next({ values: { ...o } }), U.state.next({
1350
+ name: void 0,
1351
+ type: void 0,
1352
+ values: { ...o }
1353
+ });
1115
1354
  }
1116
- E = {
1117
- mount: t.keepDirtyValues ? E.mount : /* @__PURE__ */ new Set(),
1355
+ A = {
1356
+ mount: t.keepDirtyValues ? A.mount : /* @__PURE__ */ new Set(),
1118
1357
  unMount: /* @__PURE__ */ new Set(),
1119
1358
  array: /* @__PURE__ */ new Set(),
1120
1359
  registerName: /* @__PURE__ */ new Set(),
1121
- disabled: /* @__PURE__ */ new Set(),
1360
+ disabled: t.keepValues || t.keepDirtyValues || t.keepFieldsRef ? new Set([...A.disabled].filter((e) => w(u, e))) : /* @__PURE__ */ new Set(),
1122
1361
  watch: /* @__PURE__ */ new Set(),
1123
1362
  watchAll: !1,
1124
1363
  focus: ""
1125
- }, 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({
1364
+ }, O.mount = !R.isValid || !!t.keepIsValid || !!t.keepDirtyValues || !a.shouldUnregister && !V(o), O.watch = !!a.shouldUnregister, O.keepIsValid = !!t.keepIsValid, O.action = !1, O.actionArrayLengths.clear(), k = !1, t.keepErrors || (c.errors = {}), U.state.next({
1126
1365
  submitCount: t.keepSubmitCount ? c.submitCount : 0,
1127
- isDirty: a ? !1 : t.keepDirty ? c.isDirty : t.keepValues ? Q() : !!(t.keepDefaultValues && !P(e, g)),
1366
+ isDirty: i ? !1 : t.keepDirty ? c.isDirty : t.keepValues ? $() : !!(t.keepDefaultValues && e && !P(e, b)),
1128
1367
  isSubmitted: t.keepIsSubmitted ? c.isSubmitted : !1,
1129
- dirtyFields: a ? {} : t.keepDirtyValues ? t.keepDefaultValues && y ? G(g, y) : c.dirtyFields : t.keepDefaultValues && e ? G(g, e) : t.keepDirty ? c.dirtyFields : {},
1368
+ dirtyFields: i ? {} : t.keepDirtyValues ? t.keepDefaultValues && x ? Z(b, x, void 0, s) : c.dirtyFields : t.keepDefaultValues && e ? Z(b, e, void 0, s) : t.keepDirty ? c.dirtyFields : t.keepValues ? Z(b, x, void 0, s) : {},
1130
1369
  touchedFields: t.keepTouched ? c.touchedFields : {},
1370
+ ...!t.keepIsValidating && (c.isValidating || !V(c.validatingFields)) ? {
1371
+ validatingFields: {},
1372
+ isValidating: !1
1373
+ } : null,
1131
1374
  errors: t.keepErrors ? c.errors : {},
1132
1375
  isSubmitSuccessful: t.keepIsSubmitSuccessful ? c.isSubmitSuccessful : !1,
1133
1376
  isSubmitting: !1,
1134
- defaultValues: g
1377
+ defaultValues: b
1135
1378
  });
1136
- }, at = (e, t) => it(C(e) ? e(y) : e, {
1137
- ...i.resetOptions,
1379
+ }, Tt = (e, t) => wt(E(e) ? e(x) : e, {
1380
+ ...a.resetOptions,
1138
1381
  ...t
1139
- }), ot = (e, t = {}) => {
1140
- let n = x(h, e), r = n && n._f;
1382
+ }), Et = (e, t = {}) => {
1383
+ let n = w(u, e), r = n && n._f;
1141
1384
  if (r) {
1142
1385
  let e = r.refs ? r.refs[0] : r.ref;
1143
1386
  e.focus && setTimeout(() => {
1144
- e.focus(), t.shouldSelect && C(e.select) && e.select();
1387
+ e.focus(), t.shouldSelect && E(e.select) && e.select();
1145
1388
  });
1146
1389
  }
1147
- }, st = (e) => {
1148
- c = {
1390
+ };
1391
+ U.state.subscribe({ next: (e) => {
1392
+ let { name: t, type: n, values: r, ...i } = e;
1393
+ Object.keys(i).length && (c = {
1149
1394
  ...c,
1150
- ...e
1151
- };
1152
- }, ct = {
1395
+ ...i
1396
+ });
1397
+ } });
1398
+ let Dt = {
1153
1399
  control: {
1154
- register: $e,
1155
- unregister: Ze,
1156
- getFieldState: Ge,
1157
- handleSubmit: nt,
1158
- setError: qe,
1159
- _subscribe: Ye,
1160
- _runSchema: K,
1161
- _updateIsValidating: V,
1162
- _focusError: et,
1163
- _getWatch: Fe,
1164
- _getDirty: Q,
1165
- _setValid: B,
1166
- _setFieldArray: fe,
1167
- _setDisabledField: Qe,
1168
- _setErrors: W,
1169
- _getFieldArray: Ie,
1170
- _reset: it,
1171
- _resetDefaultValues: () => C(i.defaultValues) && i.defaultValues().then((e) => {
1172
- at(e, i.resetOptions), R.state.next({ isLoading: !1 });
1400
+ register: yt,
1401
+ unregister: _t,
1402
+ getFieldState: dt,
1403
+ handleSubmit: St,
1404
+ setError: pt,
1405
+ _subscribe: ht,
1406
+ _runSchema: Q,
1407
+ _updateIsValidating: X,
1408
+ _focusError: bt,
1409
+ _getWatch: $e,
1410
+ _getDirty: $,
1411
+ _setValid: J,
1412
+ _setFieldArray: Ce,
1413
+ _setDisabledField: vt,
1414
+ _setErrors: Ee,
1415
+ _getFieldArray: et,
1416
+ _reset: wt,
1417
+ _resetDefaultValues: () => E(a.defaultValues) && a.defaultValues().then((e) => {
1418
+ Tt(e, a.resetOptions), U.state.next({ isLoading: !1 });
1173
1419
  }),
1174
- _removeUnmounted: Z,
1175
- _disableForm: tt,
1176
- _subjects: R,
1177
- _proxyFormState: I,
1420
+ _removeUnmounted: Qe,
1421
+ _disableForm: xt,
1422
+ _subjects: U,
1423
+ _proxyFormState: R,
1178
1424
  get _fields() {
1179
- return h;
1425
+ return u;
1180
1426
  },
1181
1427
  get _formValues() {
1182
- return y;
1428
+ return x;
1183
1429
  },
1184
1430
  get _state() {
1185
- return T;
1431
+ return O;
1186
1432
  },
1187
1433
  set _state(e) {
1188
- T = e;
1434
+ O = e;
1189
1435
  },
1190
1436
  get _defaultValues() {
1191
- return g;
1437
+ return b;
1192
1438
  },
1193
1439
  get _names() {
1194
- return E;
1440
+ return A;
1195
1441
  },
1196
1442
  set _names(e) {
1197
- E = e;
1443
+ A = e;
1198
1444
  },
1199
1445
  get _formState() {
1200
1446
  return c;
1201
1447
  },
1202
1448
  get _options() {
1203
- return i;
1449
+ return a;
1204
1450
  },
1205
1451
  set _options(e) {
1206
- i = {
1207
- ...i,
1452
+ a = {
1453
+ ...a,
1208
1454
  ...e
1209
- }, M = be(i.mode), N = be(i.reValidateMode);
1455
+ }, ee = ne(a.mode), F = ne(a.reValidateMode), le = a.criteriaMode === h.all;
1210
1456
  }
1211
1457
  },
1212
- subscribe: Xe,
1213
- trigger: Ue,
1214
- register: $e,
1215
- handleSubmit: nt,
1216
- watch: Je,
1217
- setValue: $,
1218
- setValues: Be,
1219
- getValues: We,
1220
- reset: at,
1221
- resetField: rt,
1458
+ subscribe: gt,
1459
+ trigger: ct,
1460
+ register: yt,
1461
+ handleSubmit: St,
1462
+ watch: mt,
1463
+ setValue: it,
1464
+ setValues: at,
1465
+ getValues: lt,
1466
+ getErrors: ut,
1467
+ reset: Tt,
1468
+ resetField: Ct,
1222
1469
  resetDefaultValues: (e, t = {}) => {
1223
- if (g = u(e), !t.keepDirty) {
1224
- let e = G(g, y);
1225
- c.dirtyFields = e, c.isDirty = !z(e);
1470
+ if (b = p(e), !t.keepDirty) {
1471
+ let e = Z(b, x, void 0, u);
1472
+ c.dirtyFields = e, c.isDirty = !V(e);
1226
1473
  }
1227
- t.keepIsValid || B(), R.state.next({
1474
+ t.keepIsValid || J(), U.state.next({
1228
1475
  ...c,
1229
- defaultValues: g
1476
+ defaultValues: b
1230
1477
  });
1231
1478
  },
1232
- clearErrors: Ke,
1233
- unregister: Ze,
1234
- setError: qe,
1235
- setFocus: ot,
1236
- getFieldState: Ge
1479
+ clearErrors: ft,
1480
+ unregister: _t,
1481
+ setError: pt,
1482
+ setFocus: Et,
1483
+ getFieldState: dt
1237
1484
  };
1238
1485
  return {
1239
- ...ct,
1240
- formControl: ct
1486
+ ...Dt,
1487
+ formControl: Dt
1241
1488
  };
1242
1489
  }
1243
- function Fe(t = {}) {
1244
- let n = e.useRef(void 0), r = e.useRef(void 0), i = e.useRef(t.formControl), [a, o] = e.useState(() => ({
1245
- ...u(Pe),
1246
- isLoading: C(t.defaultValues),
1490
+ var Q = {
1491
+ mode: Ge.mode,
1492
+ reValidateMode: Ge.reValidateMode,
1493
+ shouldFocusError: Ge.shouldFocusError,
1494
+ resolver: void 0,
1495
+ criteriaMode: void 0,
1496
+ delayError: void 0,
1497
+ shouldUnregister: void 0,
1498
+ shouldUseNativeValidation: void 0,
1499
+ context: void 0,
1500
+ progressive: void 0,
1501
+ resetOptions: void 0
1502
+ };
1503
+ function Ye(t = {}) {
1504
+ let n = e.useRef(void 0), r = e.useRef(void 0), i = e.useRef(t.formControl), a = e.useRef(!1), o = e.useRef(!!t.validate), s = e.useRef(!!t.errors), c = e.useRef(!1), [l, u] = e.useState(() => ({
1505
+ ...p(qe),
1506
+ isLoading: E(t.defaultValues),
1247
1507
  errors: t.errors || {},
1248
1508
  disabled: t.disabled || !1,
1249
- defaultValues: C(t.defaultValues) ? void 0 : t.defaultValues
1509
+ defaultValues: E(t.defaultValues) ? void 0 : t.defaultValues
1250
1510
  }));
1251
- if (!n.current || t.formControl && i.current !== t.formControl) if (i.current = t.formControl, t.formControl) n.current = {
1252
- ...t.formControl,
1253
- formState: a
1254
- }, t.defaultValues && !C(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
1255
- else {
1256
- let { formControl: e, ...r } = Q(t);
1257
- n.current = {
1258
- ...r,
1259
- formState: a
1260
- };
1511
+ if (!n.current || t.formControl && i.current !== t.formControl) {
1512
+ if (i.current = t.formControl, a.current = !1, t.formControl) n.current = {
1513
+ ...t.formControl,
1514
+ formState: l
1515
+ }, t.defaultValues && !E(t.defaultValues) && t.formControl.reset(t.defaultValues, t.resetOptions);
1516
+ else {
1517
+ let { formControl: e, ...r } = Je(t);
1518
+ n.current = {
1519
+ ...r,
1520
+ formState: l
1521
+ };
1522
+ }
1261
1523
  }
1262
- let s = n.current.control;
1263
- return s._options = t, O(() => {
1264
- let e = s._subscribe({
1265
- formState: s._proxyFormState,
1266
- callback: () => o({
1267
- ...s._formState,
1268
- defaultValues: s._defaultValues
1524
+ let d = n.current.control, f = d._options, m = {};
1525
+ for (let e in Q) e in f && !(e in t) && (m[e] = Q[e]);
1526
+ a.current && !t.disabled && (m.disabled = !1), d._options = {
1527
+ ...m,
1528
+ ...t,
1529
+ validate: t.validate
1530
+ };
1531
+ let h = () => ({
1532
+ ...d._formState,
1533
+ defaultValues: d._defaultValues
1534
+ }), { resyncIfNeeded: g, snapshot: _ } = F(h);
1535
+ return j(() => {
1536
+ g(!0, h, u);
1537
+ let e = d._subscribe({
1538
+ formState: d._proxyFormState,
1539
+ callback: () => u({
1540
+ ...d._formState,
1541
+ defaultValues: d._defaultValues
1269
1542
  }),
1270
1543
  reRenderRoot: !0
1271
1544
  });
1272
- return o((e) => ({
1545
+ return u((e) => ({
1273
1546
  ...e,
1274
1547
  isReady: !0
1275
- })), s._formState.isReady = !0, e;
1276
- }, [s]), e.useEffect(() => s._disableForm(t.disabled), [s, t.disabled]), e.useEffect(() => {
1277
- t.mode && (s._options.mode = t.mode), t.reValidateMode && (s._options.reValidateMode = t.reValidateMode);
1548
+ })), d._formState.isReady = !0, d._subjects.state.next({ isReady: !0 }), () => {
1549
+ e(), _(!0, h);
1550
+ };
1278
1551
  }, [
1279
- s,
1552
+ d,
1553
+ g,
1554
+ _
1555
+ ]), e.useEffect(() => {
1556
+ d._disableForm(a.current && !t.disabled ? !1 : t.disabled), a.current = !!t.disabled;
1557
+ }, [d, t.disabled]), e.useEffect(() => {
1558
+ t.mode && (d._options.mode = t.mode), t.reValidateMode && (d._options.reValidateMode = t.reValidateMode);
1559
+ }, [
1560
+ d,
1280
1561
  t.mode,
1281
1562
  t.reValidateMode
1282
1563
  ]), e.useEffect(() => {
1283
- t.errors && (s._setErrors(t.errors), s._focusError());
1284
- }, [s, t.errors]), e.useEffect(() => {
1285
- t.shouldUnregister && s._subjects.state.next({ values: s._getWatch() });
1286
- }, [s, t.shouldUnregister]), e.useEffect(() => {
1287
- if (s._proxyFormState.isDirty) {
1288
- let e = s._getDirty();
1289
- e !== a.isDirty && s._subjects.state.next({ isDirty: e });
1564
+ t.errors ? (d._setErrors(t.errors), d._focusError()) : s.current && d._setErrors({}), s.current = !!t.errors;
1565
+ }, [d, t.errors]), e.useEffect(() => {
1566
+ o.current && !t.validate && n.current && n.current.clearErrors(v), o.current = !!t.validate;
1567
+ }, [t.validate]), e.useEffect(() => {
1568
+ t.shouldUnregister && d._subjects.state.next({ values: d._getWatch() });
1569
+ }, [d, t.shouldUnregister]), e.useEffect(() => {
1570
+ if (d._proxyFormState.isDirty) {
1571
+ let e = d._getDirty();
1572
+ e !== l.isDirty && d._subjects.state.next({ isDirty: e });
1290
1573
  }
1291
- }, [s, a.isDirty]), e.useEffect(() => {
1292
- t.values && !P(t.values, r.current) ? (s._reset(t.values, {
1574
+ }, [d, l.isDirty]), e.useEffect(() => {
1575
+ t.values && !P(t.values, r.current) ? (d._reset(t.values, {
1293
1576
  keepFieldsRef: !0,
1294
- ...s._options.resetOptions
1295
- }), s._options.resetOptions?.keepIsValid || s._setValid(), r.current = t.values, o((e) => ({ ...e }))) : s._resetDefaultValues();
1296
- }, [s, t.values]), e.useEffect(() => {
1297
- s._state.mount || (s._setValid(), s._state.mount = !0), s._state.watch && (s._state.watch = !1, s._subjects.state.next({ ...s._formState })), s._removeUnmounted();
1298
- }), n.current.formState = e.useMemo(() => D(a, s), [s, a]), n.current;
1577
+ ...d._options.resetOptions
1578
+ }), d._options.resetOptions && d._options.resetOptions.keepIsValid || d._setValid(), r.current = t.values, u((e) => ({ ...e }))) : d._resetDefaultValues();
1579
+ }, [d, t.values]), e.useEffect(() => {
1580
+ d._state.mount && (c.current || t.values) || (d._setValid(), d._state.mount = !0), c.current = !0, d._state.watch && (d._state.watch = !1, d._subjects.state.next({ ...d._formState })), d._removeUnmounted();
1581
+ }), n.current.formState = e.useMemo(() => A(l, d), [d, l]), n.current;
1299
1582
  }
1300
- //#endregion
1301
- export { L as Controller, ee as appendErrors, x as get, w as set, Fe as useForm };
1583
+ var Xe = e.createContext(null);
1584
+ Xe.displayName = "HookFormContext";
1585
+ export { B as Controller, W as appendErrors, Je as createFormControl, w as get, D as set, z as useController, Ye as useForm, I as useFormState, R as useWatch };
1302
1586
 
1303
1587
  //# sourceMappingURL=index.esm.js.map