zudoku 0.22.0 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (335) hide show
  1. package/dist/app/demo.js +1 -1
  2. package/dist/app/demo.js.map +1 -1
  3. package/dist/app/entry.client.js +1 -15
  4. package/dist/app/entry.client.js.map +1 -1
  5. package/dist/app/entry.server.js +1 -2
  6. package/dist/app/entry.server.js.map +1 -1
  7. package/dist/app/main.d.ts +1 -1
  8. package/dist/app/sentry.js +1 -1
  9. package/dist/app/sentry.js.map +1 -1
  10. package/dist/app/standalone.js +1 -1
  11. package/dist/app/standalone.js.map +1 -1
  12. package/dist/cli/cmds/build.js +1 -0
  13. package/dist/cli/cmds/build.js.map +1 -1
  14. package/dist/config/validators/common.d.ts +104 -104
  15. package/dist/config/validators/icon-types.d.ts +1 -1
  16. package/dist/config/validators/validate.d.ts +90 -90
  17. package/dist/lib/authentication/components/CallbackHandler.js +1 -1
  18. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  19. package/dist/lib/authentication/components/SignIn.js +1 -1
  20. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  21. package/dist/lib/authentication/components/SignOut.js +1 -1
  22. package/dist/lib/authentication/components/SignOut.js.map +1 -1
  23. package/dist/lib/components/AnchorLink.d.ts +1 -1
  24. package/dist/lib/components/AnchorLink.js +1 -1
  25. package/dist/lib/components/AnchorLink.js.map +1 -1
  26. package/dist/lib/components/Bootstrap.d.ts +1 -2
  27. package/dist/lib/components/Bootstrap.js +3 -3
  28. package/dist/lib/components/Bootstrap.js.map +1 -1
  29. package/dist/lib/components/Header.js +1 -1
  30. package/dist/lib/components/Header.js.map +1 -1
  31. package/dist/lib/components/Layout.js +1 -1
  32. package/dist/lib/components/Layout.js.map +1 -1
  33. package/dist/lib/components/NotFoundPage.js +1 -1
  34. package/dist/lib/components/NotFoundPage.js.map +1 -1
  35. package/dist/lib/components/SlotletProvider.d.ts +2 -2
  36. package/dist/lib/components/TopNavigation.js +1 -1
  37. package/dist/lib/components/TopNavigation.js.map +1 -1
  38. package/dist/lib/components/Zudoku.js +1 -1
  39. package/dist/lib/components/Zudoku.js.map +1 -1
  40. package/dist/lib/components/context/ZudokuContext.js +1 -1
  41. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  42. package/dist/lib/components/index.d.ts +4 -4
  43. package/dist/lib/components/index.js +1 -1
  44. package/dist/lib/components/index.js.map +1 -1
  45. package/dist/lib/components/navigation/SidebarCategory.js +1 -1
  46. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  47. package/dist/lib/components/navigation/SidebarItem.js +1 -1
  48. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  49. package/dist/lib/components/navigation/utils.js +1 -1
  50. package/dist/lib/components/navigation/utils.js.map +1 -1
  51. package/dist/lib/core/plugins.d.ts +3 -5
  52. package/dist/lib/core/plugins.js.map +1 -1
  53. package/dist/lib/errors/RouterError.js +1 -1
  54. package/dist/lib/errors/RouterError.js.map +1 -1
  55. package/dist/lib/plugins/api-keys/CreateApiKey.js +1 -1
  56. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
  57. package/dist/lib/plugins/api-keys/ProtectedRoute.js +1 -1
  58. package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -1
  59. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +1 -1
  60. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  61. package/dist/lib/plugins/markdown/MdxPage.js +1 -1
  62. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  63. package/dist/lib/plugins/markdown/index.d.ts +1 -0
  64. package/dist/lib/plugins/markdown/index.js.map +1 -1
  65. package/dist/lib/plugins/openapi/Route.js +1 -1
  66. package/dist/lib/plugins/openapi/Route.js.map +1 -1
  67. package/dist/lib/plugins/openapi/Sidecar.js +1 -1
  68. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  69. package/dist/lib/plugins/openapi/index.js +1 -1
  70. package/dist/lib/plugins/openapi/index.js.map +1 -1
  71. package/dist/lib/plugins/redirect/index.js +1 -1
  72. package/dist/lib/plugins/redirect/index.js.map +1 -1
  73. package/dist/lib/util/MdxComponents.d.ts +16 -16
  74. package/dist/lib/util/MdxComponents.js +1 -3
  75. package/dist/lib/util/MdxComponents.js.map +1 -1
  76. package/dist/lib/util/createVariantComponent.d.ts +2 -2
  77. package/dist/lib/util/useExposedProps.js +1 -1
  78. package/dist/lib/util/useExposedProps.js.map +1 -1
  79. package/dist/lib/util/useOnScreen.d.ts +1 -1
  80. package/dist/lib/util/useScrollToAnchor.js +1 -1
  81. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  82. package/dist/lib/util/useScrollToTop.js +1 -1
  83. package/dist/lib/util/useScrollToTop.js.map +1 -1
  84. package/dist/vite/config.js +15 -8
  85. package/dist/vite/config.js.map +1 -1
  86. package/dist/vite/css/collect.d.ts +2 -0
  87. package/dist/vite/css/collect.js +27 -0
  88. package/dist/vite/css/collect.js.map +1 -0
  89. package/dist/vite/css/plugin.d.ts +5 -0
  90. package/dist/vite/css/plugin.js +79 -0
  91. package/dist/vite/css/plugin.js.map +1 -0
  92. package/dist/vite/dev-server.js +7 -3
  93. package/dist/vite/dev-server.js.map +1 -1
  94. package/dist/vite/plugin-mdx.js +2 -0
  95. package/dist/vite/plugin-mdx.js.map +1 -1
  96. package/dist/vite/plugin.js +4 -0
  97. package/dist/vite/plugin.js.map +1 -1
  98. package/lib/{AnchorLink-BR0MvI7n.js → AnchorLink-DFZZbmvr.js} +13 -14
  99. package/lib/AnchorLink-DFZZbmvr.js.map +1 -0
  100. package/lib/{AuthenticationPlugin-D0Em0SwR.js → AuthenticationPlugin-DQy635W9.js} +15 -16
  101. package/lib/AuthenticationPlugin-DQy635W9.js.map +1 -0
  102. package/lib/{Button-jK0EsymC.js → Button-DeAoTouo.js} +4 -4
  103. package/lib/{Button-jK0EsymC.js.map → Button-DeAoTouo.js.map} +1 -1
  104. package/lib/{CategoryHeading-Bb9dqxD3.js → CategoryHeading-CBconmtI.js} +3 -3
  105. package/lib/{CategoryHeading-Bb9dqxD3.js.map → CategoryHeading-CBconmtI.js.map} +1 -1
  106. package/lib/ClientOnly-E7hGysn1.js.map +1 -1
  107. package/lib/{Dialog-k70Qfukb.js → Dialog-Bxv1yEIg.js} +3 -3
  108. package/lib/{Dialog-k70Qfukb.js.map → Dialog-Bxv1yEIg.js.map} +1 -1
  109. package/lib/{Markdown-CRsmPPfY.js → Markdown-CZDLNOFc.js} +3080 -3058
  110. package/lib/{Markdown-CRsmPPfY.js.map → Markdown-CZDLNOFc.js.map} +1 -1
  111. package/lib/{MdxPage-Wp8QU0-q.js → MdxPage-CBa4X6L5.js} +9 -9
  112. package/lib/MdxPage-CBa4X6L5.js.map +1 -0
  113. package/lib/OperationList-Bj-6EKhp.js +4889 -0
  114. package/lib/{OperationList-u8xHU9-b.js.map → OperationList-Bj-6EKhp.js.map} +1 -1
  115. package/lib/Route-C9cYcP-j.js +11 -0
  116. package/lib/Route-C9cYcP-j.js.map +1 -0
  117. package/lib/{Select-O9ZM3ZgX.js → Select-Bb_Hqc70.js} +5 -5
  118. package/lib/{Select-O9ZM3ZgX.js.map → Select-Bb_Hqc70.js.map} +1 -1
  119. package/lib/{SidebarBadge-DxFJcJ6V.js → SidebarBadge-Bm793GDY.js} +3 -3
  120. package/lib/{SidebarBadge-DxFJcJ6V.js.map → SidebarBadge-Bm793GDY.js.map} +1 -1
  121. package/lib/SlotletProvider-pfc9oejW.js +221 -0
  122. package/lib/SlotletProvider-pfc9oejW.js.map +1 -0
  123. package/lib/{Spinner-3cQDBVGr.js → Spinner-DuxJLLNE.js} +2 -2
  124. package/lib/{Spinner-3cQDBVGr.js.map → Spinner-DuxJLLNE.js.map} +1 -1
  125. package/lib/{SyntaxHighlight-C31iouiO.js → SyntaxHighlight-Bz-lOJtH.js} +8 -10
  126. package/lib/{SyntaxHighlight-C31iouiO.js.map → SyntaxHighlight-Bz-lOJtH.js.map} +1 -1
  127. package/lib/assets/{index-B_Jk_Yzp.js → index-C7jnHK4b.js} +218 -197
  128. package/lib/assets/index-C7jnHK4b.js.map +1 -0
  129. package/lib/assets/{worker-C_2va8B8.js → worker-BmEAZjUP.js} +5249 -4922
  130. package/lib/assets/worker-BmEAZjUP.js.map +1 -0
  131. package/lib/chunk-D52XG6IA-Dl7HLe6j.js +1823 -0
  132. package/lib/chunk-D52XG6IA-Dl7HLe6j.js.map +1 -0
  133. package/lib/{cn-BmFQLtkS.js → cn-qaFjX9_3.js} +2 -2
  134. package/lib/cn-qaFjX9_3.js.map +1 -0
  135. package/lib/{context-D1nXWxm7.js → context-h_UkBLvr.js} +2 -2
  136. package/lib/{context-D1nXWxm7.js.map → context-h_UkBLvr.js.map} +1 -1
  137. package/lib/{createServer-BCAHdrpE.js → createServer-BVFp6Bl3.js} +4521 -4195
  138. package/lib/createServer-BVFp6Bl3.js.map +1 -0
  139. package/lib/{hook-hEqe7fPB.js → hook-DMHiUaIV.js} +3 -3
  140. package/lib/{hook-hEqe7fPB.js.map → hook-DMHiUaIV.js.map} +1 -1
  141. package/lib/{index-CmdLGbbk.js → index-B6rTMjdI.js} +47 -47
  142. package/lib/{index-CmdLGbbk.js.map → index-B6rTMjdI.js.map} +1 -1
  143. package/lib/{index-CkwDvuPt.js → index-CBXSgjaE.js} +259 -238
  144. package/lib/index-CBXSgjaE.js.map +1 -0
  145. package/lib/index-CPNSgwSb.js +36 -0
  146. package/lib/index-CPNSgwSb.js.map +1 -0
  147. package/lib/index-LNp6rxyU.js.map +1 -1
  148. package/lib/index.esm-BSV1C092.js +692 -0
  149. package/lib/{index.esm-Bm8pj-bc.js.map → index.esm-BSV1C092.js.map} +1 -1
  150. package/lib/index.esm-BnnBRKJX.js +1214 -0
  151. package/lib/index.esm-BnnBRKJX.js.map +1 -0
  152. package/lib/invariant-Caa8-XvF.js.map +1 -1
  153. package/lib/jsx-runtime-Dx-03ztt.js +446 -0
  154. package/lib/jsx-runtime-Dx-03ztt.js.map +1 -0
  155. package/lib/object_hash-BNWPnMN9.js +787 -0
  156. package/lib/object_hash-BNWPnMN9.js.map +1 -0
  157. package/lib/post-processors/removeExtensions.js.map +1 -1
  158. package/lib/post-processors/removePaths.js.map +1 -1
  159. package/lib/post-processors/traverse.js.map +1 -1
  160. package/lib/prism-csharp.min-DUwvItt4.js +63 -0
  161. package/lib/{prism-csharp.min-Yizuc34Y.js.map → prism-csharp.min-DUwvItt4.js.map} +1 -1
  162. package/lib/prism-java.min-BtgBR4yd.js +35 -0
  163. package/lib/{prism-java.min-d5iT_mOd.js.map → prism-java.min-BtgBR4yd.js.map} +1 -1
  164. package/lib/prism-markup-BNGj0Tvm.js.map +1 -1
  165. package/lib/prism-ruby.min-DeDXCp1r.js +38 -0
  166. package/lib/{prism-ruby.min-C7LwcKyz.js.map → prism-ruby.min-DeDXCp1r.js.map} +1 -1
  167. package/lib/prism-typescript.min-CD7H2IYQ.js +34 -0
  168. package/lib/{prism-typescript.min-oSVeWCAd.js.map → prism-typescript.min-CD7H2IYQ.js.map} +1 -1
  169. package/lib/state-CFQsUZUP.js +202 -0
  170. package/lib/state-CFQsUZUP.js.map +1 -0
  171. package/lib/ui/Accordion.js +2 -2
  172. package/lib/ui/Accordion.js.map +1 -1
  173. package/lib/ui/ActionButton.js +4 -4
  174. package/lib/ui/ActionButton.js.map +1 -1
  175. package/lib/ui/Alert.js +3 -3
  176. package/lib/ui/Alert.js.map +1 -1
  177. package/lib/ui/AlertDialog.js +2 -2
  178. package/lib/ui/AlertDialog.js.map +1 -1
  179. package/lib/ui/Badge.js +3 -3
  180. package/lib/ui/Badge.js.map +1 -1
  181. package/lib/ui/Breadcrumb.js +2 -2
  182. package/lib/ui/Breadcrumb.js.map +1 -1
  183. package/lib/ui/Button.js +3 -3
  184. package/lib/ui/Button.js.map +1 -1
  185. package/lib/ui/Callout.js +2 -2
  186. package/lib/ui/Callout.js.map +1 -1
  187. package/lib/ui/Card.js +2 -2
  188. package/lib/ui/Card.js.map +1 -1
  189. package/lib/ui/Carousel.js +407 -401
  190. package/lib/ui/Carousel.js.map +1 -1
  191. package/lib/ui/Checkbox.js +2 -2
  192. package/lib/ui/Checkbox.js.map +1 -1
  193. package/lib/ui/Command.js +111 -108
  194. package/lib/ui/Command.js.map +1 -1
  195. package/lib/ui/Dialog.js +2 -2
  196. package/lib/ui/Dialog.js.map +1 -1
  197. package/lib/ui/Drawer.js +2 -2
  198. package/lib/ui/Drawer.js.map +1 -1
  199. package/lib/ui/DropdownMenu.js +2 -2
  200. package/lib/ui/DropdownMenu.js.map +1 -1
  201. package/lib/ui/Form.js +3 -3
  202. package/lib/ui/Form.js.map +1 -1
  203. package/lib/ui/HoverCard.js +2 -2
  204. package/lib/ui/Input.js +2 -2
  205. package/lib/ui/Input.js.map +1 -1
  206. package/lib/ui/Label.js +3 -3
  207. package/lib/ui/Pagination.js +2 -2
  208. package/lib/ui/Pagination.js.map +1 -1
  209. package/lib/ui/Popover.js +2 -2
  210. package/lib/ui/Popover.js.map +1 -1
  211. package/lib/ui/Progress.js +2 -2
  212. package/lib/ui/Progress.js.map +1 -1
  213. package/lib/ui/RadioGroup.js +2 -2
  214. package/lib/ui/RadioGroup.js.map +1 -1
  215. package/lib/ui/ScrollArea.js +2 -2
  216. package/lib/ui/ScrollArea.js.map +1 -1
  217. package/lib/ui/Select.js +2 -2
  218. package/lib/ui/Select.js.map +1 -1
  219. package/lib/ui/Skeleton.js +2 -2
  220. package/lib/ui/Skeleton.js.map +1 -1
  221. package/lib/ui/Slider.js +2 -2
  222. package/lib/ui/Switch.js +2 -2
  223. package/lib/ui/Switch.js.map +1 -1
  224. package/lib/ui/Tabs.js +2 -2
  225. package/lib/ui/Textarea.js +2 -2
  226. package/lib/ui/Textarea.js.map +1 -1
  227. package/lib/ui/Toggle.js +3 -3
  228. package/lib/ui/Toggle.js.map +1 -1
  229. package/lib/ui/ToggleGroup.js +2 -2
  230. package/lib/ui/ToggleGroup.js.map +1 -1
  231. package/lib/ui/Tooltip.js +2 -2
  232. package/lib/useExposedProps-DE9lR6MF.js +9 -0
  233. package/lib/useExposedProps-DE9lR6MF.js.map +1 -0
  234. package/lib/{utils-DcpDOncX.js → utils-R0j3Raw1.js} +30 -31
  235. package/lib/{utils-DcpDOncX.js.map → utils-R0j3Raw1.js.map} +1 -1
  236. package/lib/zudoku.auth-auth0.js +1 -1
  237. package/lib/zudoku.auth-auth0.js.map +1 -1
  238. package/lib/zudoku.auth-clerk.js +2 -2
  239. package/lib/zudoku.auth-clerk.js.map +1 -1
  240. package/lib/zudoku.auth-openid.js +348 -346
  241. package/lib/zudoku.auth-openid.js.map +1 -1
  242. package/lib/zudoku.components.js +679 -939
  243. package/lib/zudoku.components.js.map +1 -1
  244. package/lib/zudoku.openapi-worker.js +1 -1
  245. package/lib/zudoku.openapi-worker.js.map +1 -1
  246. package/lib/zudoku.plugin-api-catalog.js +3 -3
  247. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  248. package/lib/zudoku.plugin-api-keys.js +15 -16
  249. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  250. package/lib/zudoku.plugin-custom-pages.js +4 -4
  251. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  252. package/lib/zudoku.plugin-markdown.js +2 -2
  253. package/lib/zudoku.plugin-markdown.js.map +1 -1
  254. package/lib/zudoku.plugin-openapi.js +5 -5
  255. package/lib/zudoku.plugin-redirect.js +1 -1
  256. package/lib/zudoku.plugin-redirect.js.map +1 -1
  257. package/lib/zudoku.plugin-search-inkeep.js +1 -1
  258. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  259. package/package.json +35 -35
  260. package/src/app/demo.tsx +1 -1
  261. package/src/app/entry.client.tsx +1 -15
  262. package/src/app/entry.server.tsx +2 -2
  263. package/src/app/main.tsx +1 -1
  264. package/src/app/sentry.ts +1 -1
  265. package/src/app/standalone.tsx +1 -1
  266. package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
  267. package/src/lib/authentication/components/SignIn.tsx +1 -1
  268. package/src/lib/authentication/components/SignOut.tsx +1 -1
  269. package/src/lib/components/AnchorLink.tsx +1 -1
  270. package/src/lib/components/Bootstrap.tsx +4 -6
  271. package/src/lib/components/Header.tsx +1 -1
  272. package/src/lib/components/Layout.tsx +1 -1
  273. package/src/lib/components/NotFoundPage.tsx +1 -1
  274. package/src/lib/components/SlotletProvider.tsx +1 -1
  275. package/src/lib/components/TopNavigation.tsx +1 -1
  276. package/src/lib/components/Zudoku.tsx +1 -1
  277. package/src/lib/components/context/ZudokuContext.ts +1 -1
  278. package/src/lib/components/index.ts +1 -1
  279. package/src/lib/components/navigation/SidebarCategory.tsx +1 -1
  280. package/src/lib/components/navigation/SidebarItem.tsx +1 -1
  281. package/src/lib/components/navigation/utils.ts +1 -1
  282. package/src/lib/core/plugins.ts +3 -7
  283. package/src/lib/errors/RouterError.tsx +1 -1
  284. package/src/lib/plugins/api-keys/CreateApiKey.tsx +1 -1
  285. package/src/lib/plugins/api-keys/ProtectedRoute.tsx +1 -1
  286. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +1 -1
  287. package/src/lib/plugins/api-keys/index.tsx +1 -1
  288. package/src/lib/plugins/custom-pages/index.tsx +1 -1
  289. package/src/lib/plugins/markdown/MdxPage.tsx +1 -1
  290. package/src/lib/plugins/markdown/index.tsx +2 -1
  291. package/src/lib/plugins/openapi/Route.tsx +1 -1
  292. package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
  293. package/src/lib/plugins/openapi/index.tsx +1 -1
  294. package/src/lib/plugins/redirect/index.tsx +1 -1
  295. package/src/lib/util/MdxComponents.tsx +1 -3
  296. package/src/lib/util/createVariantComponent.tsx +2 -2
  297. package/src/lib/util/useExposedProps.tsx +1 -1
  298. package/src/lib/util/useScrollToAnchor.ts +1 -1
  299. package/src/lib/util/useScrollToTop.ts +1 -1
  300. package/lib/AnchorLink-BR0MvI7n.js.map +0 -1
  301. package/lib/AuthenticationPlugin-D0Em0SwR.js.map +0 -1
  302. package/lib/MdxPage-Wp8QU0-q.js.map +0 -1
  303. package/lib/OperationList-u8xHU9-b.js +0 -4706
  304. package/lib/Route-DlG_HTMu.js +0 -11
  305. package/lib/Route-DlG_HTMu.js.map +0 -1
  306. package/lib/SlotletProvider-BgvYIPQe.js +0 -252
  307. package/lib/SlotletProvider-BgvYIPQe.js.map +0 -1
  308. package/lib/assets/index-B_Jk_Yzp.js.map +0 -1
  309. package/lib/assets/worker-C_2va8B8.js.map +0 -1
  310. package/lib/cn-BmFQLtkS.js.map +0 -1
  311. package/lib/createServer-BCAHdrpE.js.map +0 -1
  312. package/lib/index-BuAyrJe3.js +0 -46
  313. package/lib/index-BuAyrJe3.js.map +0 -1
  314. package/lib/index-CkwDvuPt.js.map +0 -1
  315. package/lib/index-Czzd9rjU.js +0 -899
  316. package/lib/index-Czzd9rjU.js.map +0 -1
  317. package/lib/index-Yn8c3UWE.js +0 -921
  318. package/lib/index-Yn8c3UWE.js.map +0 -1
  319. package/lib/index.esm-Bm8pj-bc.js +0 -675
  320. package/lib/index.esm-C5mr_sKO.js +0 -1193
  321. package/lib/index.esm-C5mr_sKO.js.map +0 -1
  322. package/lib/jsx-runtime-B6kdoens.js +0 -635
  323. package/lib/jsx-runtime-B6kdoens.js.map +0 -1
  324. package/lib/object_hash-CvlLgU-M.js +0 -785
  325. package/lib/object_hash-CvlLgU-M.js.map +0 -1
  326. package/lib/prism-csharp.min-Yizuc34Y.js +0 -35
  327. package/lib/prism-java.min-d5iT_mOd.js +0 -7
  328. package/lib/prism-ruby.min-C7LwcKyz.js +0 -10
  329. package/lib/prism-typescript.min-oSVeWCAd.js +0 -6
  330. package/lib/router-lfyopgBI.js +0 -3024
  331. package/lib/router-lfyopgBI.js.map +0 -1
  332. package/lib/state-tsXBLONe.js +0 -203
  333. package/lib/state-tsXBLONe.js.map +0 -1
  334. package/lib/useExposedProps-CTPtylCV.js +0 -10
  335. package/lib/useExposedProps-CTPtylCV.js.map +0 -1
@@ -0,0 +1,1214 @@
1
+ import b from "react";
2
+ var he = (e) => e.type === "checkbox", le = (e) => e instanceof Date, $ = (e) => e == null;
3
+ const fr = (e) => typeof e == "object";
4
+ var L = (e) => !$(e) && !Array.isArray(e) && fr(e) && !le(e), dr = (e) => L(e) && e.target ? he(e.target) ? e.target.checked : e.target.value : e, Lr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, yr = (e, t) => e.has(Lr(t)), Rr = (e) => {
5
+ const t = e.constructor && e.constructor.prototype;
6
+ return L(t) && t.hasOwnProperty("isPrototypeOf");
7
+ }, He = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
8
+ function B(e) {
9
+ let t;
10
+ const r = Array.isArray(e), i = typeof FileList < "u" ? e instanceof FileList : !1;
11
+ if (e instanceof Date)
12
+ t = new Date(e);
13
+ else if (e instanceof Set)
14
+ t = new Set(e);
15
+ else if (!(He && (e instanceof Blob || i)) && (r || L(e)))
16
+ if (t = r ? [] : {}, !r && !Rr(e))
17
+ t = e;
18
+ else
19
+ for (const u in e)
20
+ e.hasOwnProperty(u) && (t[u] = B(e[u]));
21
+ else
22
+ return e;
23
+ return t;
24
+ }
25
+ var be = (e) => Array.isArray(e) ? e.filter(Boolean) : [], C = (e) => e === void 0, c = (e, t, r) => {
26
+ if (!t || !L(e))
27
+ return r;
28
+ const i = be(t.split(/[,[\].]+?/)).reduce((u, n) => $(u) ? u : u[n], e);
29
+ return C(i) || i === e ? C(e[t]) ? r : e[t] : i;
30
+ }, G = (e) => typeof e == "boolean", $e = (e) => /^\w*$/.test(e), _r = (e) => be(e.replace(/["|']|\]/g, "").split(/\.|\[/)), E = (e, t, r) => {
31
+ let i = -1;
32
+ const u = $e(t) ? [t] : _r(t), n = u.length, y = n - 1;
33
+ for (; ++i < n; ) {
34
+ const _ = u[i];
35
+ let F = r;
36
+ if (i !== y) {
37
+ const p = e[_];
38
+ F = L(p) || Array.isArray(p) ? p : isNaN(+u[i + 1]) ? {} : [];
39
+ }
40
+ if (_ === "__proto__" || _ === "constructor" || _ === "prototype")
41
+ return;
42
+ e[_] = F, e = e[_];
43
+ }
44
+ return e;
45
+ };
46
+ const Fe = {
47
+ BLUR: "blur",
48
+ FOCUS_OUT: "focusout",
49
+ CHANGE: "change"
50
+ }, z = {
51
+ onBlur: "onBlur",
52
+ onChange: "onChange",
53
+ onSubmit: "onSubmit",
54
+ onTouched: "onTouched",
55
+ all: "all"
56
+ }, te = {
57
+ max: "max",
58
+ min: "min",
59
+ maxLength: "maxLength",
60
+ minLength: "minLength",
61
+ pattern: "pattern",
62
+ required: "required",
63
+ validate: "validate"
64
+ }, gr = b.createContext(null), pe = () => b.useContext(gr), rt = (e) => {
65
+ const { children: t, ...r } = e;
66
+ return b.createElement(gr.Provider, { value: r }, t);
67
+ };
68
+ var vr = (e, t, r, i = !0) => {
69
+ const u = {
70
+ defaultValues: t._defaultValues
71
+ };
72
+ for (const n in e)
73
+ Object.defineProperty(u, n, {
74
+ get: () => {
75
+ const y = n;
76
+ return t._proxyFormState[y] !== z.all && (t._proxyFormState[y] = !i || z.all), r && (r[y] = !0), e[y];
77
+ }
78
+ });
79
+ return u;
80
+ }, H = (e) => L(e) && !Object.keys(e).length, hr = (e, t, r, i) => {
81
+ r(e);
82
+ const { name: u, ...n } = e;
83
+ return H(n) || Object.keys(n).length >= Object.keys(t).length || Object.keys(n).find((y) => t[y] === (!i || z.all));
84
+ }, K = (e) => Array.isArray(e) ? e : [e], br = (e, t, r) => !e || !t || e === t || K(e).some((i) => i && (r ? i === t : i.startsWith(t) || t.startsWith(i)));
85
+ function Se(e) {
86
+ const t = b.useRef(e);
87
+ t.current = e, b.useEffect(() => {
88
+ const r = !e.disabled && t.current.subject && t.current.subject.subscribe({
89
+ next: t.current.next
90
+ });
91
+ return () => {
92
+ r && r.unsubscribe();
93
+ };
94
+ }, [e.disabled]);
95
+ }
96
+ function Mr(e) {
97
+ const t = pe(), { control: r = t.control, disabled: i, name: u, exact: n } = e || {}, [y, _] = b.useState(r._formState), F = b.useRef(!0), p = b.useRef({
98
+ isDirty: !1,
99
+ isLoading: !1,
100
+ dirtyFields: !1,
101
+ touchedFields: !1,
102
+ validatingFields: !1,
103
+ isValidating: !1,
104
+ isValid: !1,
105
+ errors: !1
106
+ }), S = b.useRef(u);
107
+ return S.current = u, Se({
108
+ disabled: i,
109
+ next: (m) => F.current && br(S.current, m.name, n) && hr(m, p.current, r._updateFormState) && _({
110
+ ...r._formState,
111
+ ...m
112
+ }),
113
+ subject: r._subjects.state
114
+ }), b.useEffect(() => (F.current = !0, p.current.isValid && r._updateValid(!0), () => {
115
+ F.current = !1;
116
+ }), [r]), b.useMemo(() => vr(y, r, p.current, !1), [y, r]);
117
+ }
118
+ var re = (e) => typeof e == "string", mr = (e, t, r, i, u) => re(e) ? (i && t.watch.add(e), c(r, e, u)) : Array.isArray(e) ? e.map((n) => (i && t.watch.add(n), c(r, n))) : (i && (t.watchAll = !0), r);
119
+ function Nr(e) {
120
+ const t = pe(), { control: r = t.control, name: i, defaultValue: u, disabled: n, exact: y } = e || {}, _ = b.useRef(i);
121
+ _.current = i, Se({
122
+ disabled: n,
123
+ subject: r._subjects.values,
124
+ next: (S) => {
125
+ br(_.current, S.name, y) && p(B(mr(_.current, r._names, S.values || r._formValues, !1, u)));
126
+ }
127
+ });
128
+ const [F, p] = b.useState(r._getWatch(i, u));
129
+ return b.useEffect(() => r._removeUnmounted()), F;
130
+ }
131
+ function Br(e) {
132
+ const t = pe(), { name: r, disabled: i, control: u = t.control, shouldUnregister: n } = e, y = yr(u._names.array, r), _ = Nr({
133
+ control: u,
134
+ name: r,
135
+ defaultValue: c(u._formValues, r, c(u._defaultValues, r, e.defaultValue)),
136
+ exact: !0
137
+ }), F = Mr({
138
+ control: u,
139
+ name: r,
140
+ exact: !0
141
+ }), p = b.useRef(u.register(r, {
142
+ ...e.rules,
143
+ value: _,
144
+ ...G(e.disabled) ? { disabled: e.disabled } : {}
145
+ })), S = b.useMemo(() => Object.defineProperties({}, {
146
+ invalid: {
147
+ enumerable: !0,
148
+ get: () => !!c(F.errors, r)
149
+ },
150
+ isDirty: {
151
+ enumerable: !0,
152
+ get: () => !!c(F.dirtyFields, r)
153
+ },
154
+ isTouched: {
155
+ enumerable: !0,
156
+ get: () => !!c(F.touchedFields, r)
157
+ },
158
+ isValidating: {
159
+ enumerable: !0,
160
+ get: () => !!c(F.validatingFields, r)
161
+ },
162
+ error: {
163
+ enumerable: !0,
164
+ get: () => c(F.errors, r)
165
+ }
166
+ }), [F, r]), m = b.useMemo(() => ({
167
+ name: r,
168
+ value: _,
169
+ ...G(i) || F.disabled ? { disabled: F.disabled || i } : {},
170
+ onChange: (R) => p.current.onChange({
171
+ target: {
172
+ value: dr(R),
173
+ name: r
174
+ },
175
+ type: Fe.CHANGE
176
+ }),
177
+ onBlur: () => p.current.onBlur({
178
+ target: {
179
+ value: c(u._formValues, r),
180
+ name: r
181
+ },
182
+ type: Fe.BLUR
183
+ }),
184
+ ref: (R) => {
185
+ const D = c(u._fields, r);
186
+ D && R && (D._f.ref = {
187
+ focus: () => R.focus(),
188
+ select: () => R.select(),
189
+ setCustomValidity: (T) => R.setCustomValidity(T),
190
+ reportValidity: () => R.reportValidity()
191
+ });
192
+ }
193
+ }), [
194
+ r,
195
+ u._formValues,
196
+ i,
197
+ F.disabled,
198
+ _,
199
+ u._fields
200
+ ]);
201
+ return b.useEffect(() => {
202
+ const R = u._options.shouldUnregister || n, D = (T, ae) => {
203
+ const q = c(u._fields, T);
204
+ q && q._f && (q._f.mount = ae);
205
+ };
206
+ if (D(r, !0), R) {
207
+ const T = B(c(u._options.defaultValues, r));
208
+ E(u._defaultValues, r, T), C(c(u._formValues, r)) && E(u._formValues, r, T);
209
+ }
210
+ return () => {
211
+ (y ? R && !u._state.action : R) ? u.unregister(r) : D(r, !1);
212
+ };
213
+ }, [r, u, y, n]), b.useEffect(() => {
214
+ G(i) && c(u._fields, r) && u._updateDisabledField({
215
+ disabled: i,
216
+ fields: u._fields,
217
+ name: r,
218
+ value: c(u._fields, r)._f.value
219
+ });
220
+ }, [i, r, u]), b.useMemo(() => ({
221
+ field: m,
222
+ formState: F,
223
+ fieldState: S
224
+ }), [m, F, S]);
225
+ }
226
+ const tt = (e) => e.render(Br(e));
227
+ var Ir = (e, t, r, i, u) => t ? {
228
+ ...r[e],
229
+ types: {
230
+ ...r[e] && r[e].types ? r[e].types : {},
231
+ [i]: u || !0
232
+ }
233
+ } : {}, se = () => {
234
+ const e = typeof performance > "u" ? Date.now() : performance.now() * 1e3;
235
+ return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (t) => {
236
+ const r = (Math.random() * 16 + e) % 16 | 0;
237
+ return (t == "x" ? r : r & 3 | 8).toString(16);
238
+ });
239
+ }, Ce = (e, t, r = {}) => r.shouldFocus || C(r.shouldFocus) ? r.focusName || `${e}.${C(r.focusIndex) ? t : r.focusIndex}.` : "", ve = (e) => ({
240
+ isOnSubmit: !e || e === z.onSubmit,
241
+ isOnBlur: e === z.onBlur,
242
+ isOnChange: e === z.onChange,
243
+ isOnAll: e === z.all,
244
+ isOnTouch: e === z.onTouched
245
+ }), je = (e, t, r) => !r && (t.watchAll || t.watch.has(e) || [...t.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
246
+ const ce = (e, t, r, i) => {
247
+ for (const u of r || Object.keys(e)) {
248
+ const n = c(e, u);
249
+ if (n) {
250
+ const { _f: y, ..._ } = n;
251
+ if (y) {
252
+ if (y.refs && y.refs[0] && t(y.refs[0], u) && !i)
253
+ return !0;
254
+ if (y.ref && t(y.ref, y.name) && !i)
255
+ return !0;
256
+ if (ce(_, t))
257
+ break;
258
+ } else if (L(_) && ce(_, t))
259
+ break;
260
+ }
261
+ }
262
+ };
263
+ var Fr = (e, t, r) => {
264
+ const i = K(c(e, r));
265
+ return E(i, "root", t[r]), E(e, r, i), e;
266
+ }, Ke = (e) => e.type === "file", ee = (e) => typeof e == "function", Ae = (e) => {
267
+ if (!He)
268
+ return !1;
269
+ const t = e ? e.ownerDocument : 0;
270
+ return e instanceof (t && t.defaultView ? t.defaultView.HTMLElement : HTMLElement);
271
+ }, me = (e) => re(e), Ge = (e) => e.type === "radio", Ve = (e) => e instanceof RegExp;
272
+ const ir = {
273
+ value: !1,
274
+ isValid: !1
275
+ }, ar = { value: !0, isValid: !0 };
276
+ var Ar = (e) => {
277
+ if (Array.isArray(e)) {
278
+ if (e.length > 1) {
279
+ const t = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
280
+ return { value: t, isValid: !!t.length };
281
+ }
282
+ return e[0].checked && !e[0].disabled ? (
283
+ // @ts-expect-error expected to work in the browser
284
+ e[0].attributes && !C(e[0].attributes.value) ? C(e[0].value) || e[0].value === "" ? ar : { value: e[0].value, isValid: !0 } : ar
285
+ ) : ir;
286
+ }
287
+ return ir;
288
+ };
289
+ const ur = {
290
+ isValid: !1,
291
+ value: null
292
+ };
293
+ var Vr = (e) => Array.isArray(e) ? e.reduce((t, r) => r && r.checked && !r.disabled ? {
294
+ isValid: !0,
295
+ value: r.value
296
+ } : t, ur) : ur;
297
+ function nr(e, t, r = "validate") {
298
+ if (me(e) || Array.isArray(e) && e.every(me) || G(e) && !e)
299
+ return {
300
+ type: r,
301
+ message: me(e) ? e : "",
302
+ ref: t
303
+ };
304
+ }
305
+ var oe = (e) => L(e) && !Ve(e) ? e : {
306
+ value: e,
307
+ message: ""
308
+ }, We = async (e, t, r, i, u) => {
309
+ const { ref: n, refs: y, required: _, maxLength: F, minLength: p, min: S, max: m, pattern: R, validate: D, name: T, valueAsNumber: ae, mount: q, disabled: Z } = e._f, w = c(t, T);
310
+ if (!q || Z)
311
+ return {};
312
+ const J = y ? y[0] : n, Q = (x) => {
313
+ i && J.reportValidity && (J.setCustomValidity(G(x) ? "" : x || ""), J.reportValidity());
314
+ }, U = {}, v = Ge(n), h = he(n), A = v || h, O = (ae || Ke(n)) && C(n.value) && C(w) || Ae(n) && n.value === "" || w === "" || Array.isArray(w) && !w.length, I = Ir.bind(null, T, r, U), ue = (x, k, N, W = te.maxLength, X = te.minLength) => {
315
+ const Y = x ? k : N;
316
+ U[T] = {
317
+ type: x ? W : X,
318
+ message: Y,
319
+ ref: n,
320
+ ...I(x ? W : X, Y)
321
+ };
322
+ };
323
+ if (u ? !Array.isArray(w) || !w.length : _ && (!A && (O || $(w)) || G(w) && !w || h && !Ar(y).isValid || v && !Vr(y).isValid)) {
324
+ const { value: x, message: k } = me(_) ? { value: !!_, message: _ } : oe(_);
325
+ if (x && (U[T] = {
326
+ type: te.required,
327
+ message: k,
328
+ ref: J,
329
+ ...I(te.required, k)
330
+ }, !r))
331
+ return Q(k), U;
332
+ }
333
+ if (!O && (!$(S) || !$(m))) {
334
+ let x, k;
335
+ const N = oe(m), W = oe(S);
336
+ if (!$(w) && !isNaN(w)) {
337
+ const X = n.valueAsNumber || w && +w;
338
+ $(N.value) || (x = X > N.value), $(W.value) || (k = X < W.value);
339
+ } else {
340
+ const X = n.valueAsDate || new Date(w), Y = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), fe = n.type == "time", de = n.type == "week";
341
+ re(N.value) && w && (x = fe ? Y(w) > Y(N.value) : de ? w > N.value : X > new Date(N.value)), re(W.value) && w && (k = fe ? Y(w) < Y(W.value) : de ? w < W.value : X < new Date(W.value));
342
+ }
343
+ if ((x || k) && (ue(!!x, N.message, W.message, te.max, te.min), !r))
344
+ return Q(U[T].message), U;
345
+ }
346
+ if ((F || p) && !O && (re(w) || u && Array.isArray(w))) {
347
+ const x = oe(F), k = oe(p), N = !$(x.value) && w.length > +x.value, W = !$(k.value) && w.length < +k.value;
348
+ if ((N || W) && (ue(N, x.message, k.message), !r))
349
+ return Q(U[T].message), U;
350
+ }
351
+ if (R && !O && re(w)) {
352
+ const { value: x, message: k } = oe(R);
353
+ if (Ve(x) && !w.match(x) && (U[T] = {
354
+ type: te.pattern,
355
+ message: k,
356
+ ref: n,
357
+ ...I(te.pattern, k)
358
+ }, !r))
359
+ return Q(k), U;
360
+ }
361
+ if (D) {
362
+ if (ee(D)) {
363
+ const x = await D(w, t), k = nr(x, J);
364
+ if (k && (U[T] = {
365
+ ...k,
366
+ ...I(te.validate, k.message)
367
+ }, !r))
368
+ return Q(k.message), U;
369
+ } else if (L(D)) {
370
+ let x = {};
371
+ for (const k in D) {
372
+ if (!H(x) && !r)
373
+ break;
374
+ const N = nr(await D[k](w, t), J, k);
375
+ N && (x = {
376
+ ...N,
377
+ ...I(k, N.message)
378
+ }, Q(N.message), r && (U[T] = x));
379
+ }
380
+ if (!H(x) && (U[T] = {
381
+ ref: J,
382
+ ...x
383
+ }, !r))
384
+ return U;
385
+ }
386
+ }
387
+ return Q(!0), U;
388
+ }, Oe = (e, t) => [
389
+ ...e,
390
+ ...K(t)
391
+ ], Te = (e) => Array.isArray(e) ? e.map(() => {
392
+ }) : void 0;
393
+ function Ue(e, t, r) {
394
+ return [
395
+ ...e.slice(0, t),
396
+ ...K(r),
397
+ ...e.slice(t)
398
+ ];
399
+ }
400
+ var Le = (e, t, r) => Array.isArray(e) ? (C(e[r]) && (e[r] = void 0), e.splice(r, 0, e.splice(t, 1)[0]), e) : [], Re = (e, t) => [
401
+ ...K(t),
402
+ ...K(e)
403
+ ];
404
+ function Pr(e, t) {
405
+ let r = 0;
406
+ const i = [...e];
407
+ for (const u of t)
408
+ i.splice(u - r, 1), r++;
409
+ return be(i).length ? i : [];
410
+ }
411
+ var Me = (e, t) => C(t) ? [] : Pr(e, K(t).sort((r, i) => r - i)), Ne = (e, t, r) => {
412
+ [e[t], e[r]] = [e[r], e[t]];
413
+ };
414
+ function jr(e, t) {
415
+ const r = t.slice(0, -1).length;
416
+ let i = 0;
417
+ for (; i < r; )
418
+ e = C(e) ? i++ : e[t[i++]];
419
+ return e;
420
+ }
421
+ function Wr(e) {
422
+ for (const t in e)
423
+ if (e.hasOwnProperty(t) && !C(e[t]))
424
+ return !1;
425
+ return !0;
426
+ }
427
+ function M(e, t) {
428
+ const r = Array.isArray(t) ? t : $e(t) ? [t] : _r(t), i = r.length === 1 ? e : jr(e, r), u = r.length - 1, n = r[u];
429
+ return i && delete i[n], u !== 0 && (L(i) && H(i) || Array.isArray(i) && Wr(i)) && M(e, r.slice(0, -1)), e;
430
+ }
431
+ var lr = (e, t, r) => (e[t] = r, e);
432
+ function st(e) {
433
+ const t = pe(), { control: r = t.control, name: i, keyName: u = "id", shouldUnregister: n, rules: y } = e, [_, F] = b.useState(r._getFieldArray(i)), p = b.useRef(r._getFieldArray(i).map(se)), S = b.useRef(_), m = b.useRef(i), R = b.useRef(!1);
434
+ m.current = i, S.current = _, r._names.array.add(i), y && r.register(i, y), Se({
435
+ next: ({ values: v, name: h }) => {
436
+ if (h === m.current || !h) {
437
+ const A = c(v, m.current);
438
+ Array.isArray(A) && (F(A), p.current = A.map(se));
439
+ }
440
+ },
441
+ subject: r._subjects.array
442
+ });
443
+ const D = b.useCallback((v) => {
444
+ R.current = !0, r._updateFieldArray(i, v);
445
+ }, [r, i]), T = (v, h) => {
446
+ const A = K(B(v)), O = Oe(r._getFieldArray(i), A);
447
+ r._names.focus = Ce(i, O.length - 1, h), p.current = Oe(p.current, A.map(se)), D(O), F(O), r._updateFieldArray(i, O, Oe, {
448
+ argA: Te(v)
449
+ });
450
+ }, ae = (v, h) => {
451
+ const A = K(B(v)), O = Re(r._getFieldArray(i), A);
452
+ r._names.focus = Ce(i, 0, h), p.current = Re(p.current, A.map(se)), D(O), F(O), r._updateFieldArray(i, O, Re, {
453
+ argA: Te(v)
454
+ });
455
+ }, q = (v) => {
456
+ const h = Me(r._getFieldArray(i), v);
457
+ p.current = Me(p.current, v), D(h), F(h), !Array.isArray(c(r._fields, i)) && E(r._fields, i, void 0), r._updateFieldArray(i, h, Me, {
458
+ argA: v
459
+ });
460
+ }, Z = (v, h, A) => {
461
+ const O = K(B(h)), I = Ue(r._getFieldArray(i), v, O);
462
+ r._names.focus = Ce(i, v, A), p.current = Ue(p.current, v, O.map(se)), D(I), F(I), r._updateFieldArray(i, I, Ue, {
463
+ argA: v,
464
+ argB: Te(h)
465
+ });
466
+ }, w = (v, h) => {
467
+ const A = r._getFieldArray(i);
468
+ Ne(A, v, h), Ne(p.current, v, h), D(A), F(A), r._updateFieldArray(i, A, Ne, {
469
+ argA: v,
470
+ argB: h
471
+ }, !1);
472
+ }, J = (v, h) => {
473
+ const A = r._getFieldArray(i);
474
+ Le(A, v, h), Le(p.current, v, h), D(A), F(A), r._updateFieldArray(i, A, Le, {
475
+ argA: v,
476
+ argB: h
477
+ }, !1);
478
+ }, Q = (v, h) => {
479
+ const A = B(h), O = lr(r._getFieldArray(i), v, A);
480
+ p.current = [...O].map((I, ue) => !I || ue === v ? se() : p.current[ue]), D(O), F([...O]), r._updateFieldArray(i, O, lr, {
481
+ argA: v,
482
+ argB: A
483
+ }, !0, !1);
484
+ }, U = (v) => {
485
+ const h = K(B(v));
486
+ p.current = h.map(se), D([...h]), F([...h]), r._updateFieldArray(i, [...h], (A) => A, {}, !0, !1);
487
+ };
488
+ return b.useEffect(() => {
489
+ if (r._state.action = !1, je(i, r._names) && r._subjects.state.next({
490
+ ...r._formState
491
+ }), R.current && (!ve(r._options.mode).isOnSubmit || r._formState.isSubmitted))
492
+ if (r._options.resolver)
493
+ r._executeSchema([i]).then((v) => {
494
+ const h = c(v.errors, i), A = c(r._formState.errors, i);
495
+ (A ? !h && A.type || h && (A.type !== h.type || A.message !== h.message) : h && h.type) && (h ? E(r._formState.errors, i, h) : M(r._formState.errors, i), r._subjects.state.next({
496
+ errors: r._formState.errors
497
+ }));
498
+ });
499
+ else {
500
+ const v = c(r._fields, i);
501
+ v && v._f && !(ve(r._options.reValidateMode).isOnSubmit && ve(r._options.mode).isOnSubmit) && We(v, r._formValues, r._options.criteriaMode === z.all, r._options.shouldUseNativeValidation, !0).then((h) => !H(h) && r._subjects.state.next({
502
+ errors: Fr(r._formState.errors, h, i)
503
+ }));
504
+ }
505
+ r._subjects.values.next({
506
+ name: i,
507
+ values: { ...r._formValues }
508
+ }), r._names.focus && ce(r._fields, (v, h) => {
509
+ if (r._names.focus && h.startsWith(r._names.focus) && v.focus)
510
+ return v.focus(), 1;
511
+ }), r._names.focus = "", r._updateValid(), R.current = !1;
512
+ }, [_, i, r]), b.useEffect(() => (!c(r._formValues, i) && r._updateFieldArray(i), () => {
513
+ (r._options.shouldUnregister || n) && r.unregister(i);
514
+ }), [i, r, u, n]), {
515
+ swap: b.useCallback(w, [D, i, r]),
516
+ move: b.useCallback(J, [D, i, r]),
517
+ prepend: b.useCallback(ae, [D, i, r]),
518
+ append: b.useCallback(T, [D, i, r]),
519
+ remove: b.useCallback(q, [D, i, r]),
520
+ insert: b.useCallback(Z, [D, i, r]),
521
+ update: b.useCallback(Q, [D, i, r]),
522
+ replace: b.useCallback(U, [D, i, r]),
523
+ fields: b.useMemo(() => _.map((v, h) => ({
524
+ ...v,
525
+ [u]: p.current[h] || se()
526
+ })), [_, u])
527
+ };
528
+ }
529
+ var Be = () => {
530
+ let e = [];
531
+ return {
532
+ get observers() {
533
+ return e;
534
+ },
535
+ next: (u) => {
536
+ for (const n of e)
537
+ n.next && n.next(u);
538
+ },
539
+ subscribe: (u) => (e.push(u), {
540
+ unsubscribe: () => {
541
+ e = e.filter((n) => n !== u);
542
+ }
543
+ }),
544
+ unsubscribe: () => {
545
+ e = [];
546
+ }
547
+ };
548
+ }, qe = (e) => $(e) || !fr(e);
549
+ function ie(e, t) {
550
+ if (qe(e) || qe(t))
551
+ return e === t;
552
+ if (le(e) && le(t))
553
+ return e.getTime() === t.getTime();
554
+ const r = Object.keys(e), i = Object.keys(t);
555
+ if (r.length !== i.length)
556
+ return !1;
557
+ for (const u of r) {
558
+ const n = e[u];
559
+ if (!i.includes(u))
560
+ return !1;
561
+ if (u !== "ref") {
562
+ const y = t[u];
563
+ if (le(n) && le(y) || L(n) && L(y) || Array.isArray(n) && Array.isArray(y) ? !ie(n, y) : n !== y)
564
+ return !1;
565
+ }
566
+ }
567
+ return !0;
568
+ }
569
+ var xr = (e) => e.type === "select-multiple", qr = (e) => Ge(e) || he(e), Ie = (e) => Ae(e) && e.isConnected, pr = (e) => {
570
+ for (const t in e)
571
+ if (ee(e[t]))
572
+ return !0;
573
+ return !1;
574
+ };
575
+ function xe(e, t = {}) {
576
+ const r = Array.isArray(e);
577
+ if (L(e) || r)
578
+ for (const i in e)
579
+ Array.isArray(e[i]) || L(e[i]) && !pr(e[i]) ? (t[i] = Array.isArray(e[i]) ? [] : {}, xe(e[i], t[i])) : $(e[i]) || (t[i] = !0);
580
+ return t;
581
+ }
582
+ function Sr(e, t, r) {
583
+ const i = Array.isArray(e);
584
+ if (L(e) || i)
585
+ for (const u in e)
586
+ Array.isArray(e[u]) || L(e[u]) && !pr(e[u]) ? C(t) || qe(r[u]) ? r[u] = Array.isArray(e[u]) ? xe(e[u], []) : { ...xe(e[u]) } : Sr(e[u], $(t) ? {} : t[u], r[u]) : r[u] = !ie(e[u], t[u]);
587
+ return r;
588
+ }
589
+ var _e = (e, t) => Sr(e, t, xe(t)), wr = (e, { valueAsNumber: t, valueAsDate: r, setValueAs: i }) => C(e) ? e : t ? e === "" ? NaN : e && +e : r && re(e) ? new Date(e) : i ? i(e) : e;
590
+ function Pe(e) {
591
+ const t = e.ref;
592
+ if (!(e.refs ? e.refs.every((r) => r.disabled) : t.disabled))
593
+ return Ke(t) ? t.files : Ge(t) ? Vr(e.refs).value : xr(t) ? [...t.selectedOptions].map(({ value: r }) => r) : he(t) ? Ar(e.refs).value : wr(C(t.value) ? e.ref.value : t.value, e);
594
+ }
595
+ var Hr = (e, t, r, i) => {
596
+ const u = {};
597
+ for (const n of e) {
598
+ const y = c(t, n);
599
+ y && E(u, n, y._f);
600
+ }
601
+ return {
602
+ criteriaMode: r,
603
+ names: [...e],
604
+ fields: u,
605
+ shouldUseNativeValidation: i
606
+ };
607
+ }, ge = (e) => C(e) ? e : Ve(e) ? e.source : L(e) ? Ve(e.value) ? e.value.source : e.value : e;
608
+ const or = "AsyncFunction";
609
+ var $r = (e) => !!e && !!e.validate && !!(ee(e.validate) && e.validate.constructor.name === or || L(e.validate) && Object.values(e.validate).find((t) => t.constructor.name === or)), Kr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
610
+ function cr(e, t, r) {
611
+ const i = c(e, r);
612
+ if (i || $e(r))
613
+ return {
614
+ error: i,
615
+ name: r
616
+ };
617
+ const u = r.split(".");
618
+ for (; u.length; ) {
619
+ const n = u.join("."), y = c(t, n), _ = c(e, n);
620
+ if (y && !Array.isArray(y) && r !== n)
621
+ return { name: r };
622
+ if (_ && _.type)
623
+ return {
624
+ name: n,
625
+ error: _
626
+ };
627
+ u.pop();
628
+ }
629
+ return {
630
+ name: r
631
+ };
632
+ }
633
+ var Gr = (e, t, r, i, u) => u.isOnAll ? !1 : !r && u.isOnTouch ? !(t || e) : (r ? i.isOnBlur : u.isOnBlur) ? !e : (r ? i.isOnChange : u.isOnChange) ? e : !0, Yr = (e, t) => !be(c(e, t)).length && M(e, t);
634
+ const zr = {
635
+ mode: z.onSubmit,
636
+ reValidateMode: z.onChange,
637
+ shouldFocusError: !0
638
+ };
639
+ function Jr(e = {}) {
640
+ let t = {
641
+ ...zr,
642
+ ...e
643
+ }, r = {
644
+ submitCount: 0,
645
+ isDirty: !1,
646
+ isLoading: ee(t.defaultValues),
647
+ isValidating: !1,
648
+ isSubmitted: !1,
649
+ isSubmitting: !1,
650
+ isSubmitSuccessful: !1,
651
+ isValid: !1,
652
+ touchedFields: {},
653
+ dirtyFields: {},
654
+ validatingFields: {},
655
+ errors: t.errors || {},
656
+ disabled: t.disabled || !1
657
+ }, i = {}, u = L(t.defaultValues) || L(t.values) ? B(t.defaultValues || t.values) || {} : {}, n = t.shouldUnregister ? {} : B(u), y = {
658
+ action: !1,
659
+ mount: !1,
660
+ watch: !1
661
+ }, _ = {
662
+ mount: /* @__PURE__ */ new Set(),
663
+ unMount: /* @__PURE__ */ new Set(),
664
+ array: /* @__PURE__ */ new Set(),
665
+ watch: /* @__PURE__ */ new Set()
666
+ }, F, p = 0;
667
+ const S = {
668
+ isDirty: !1,
669
+ dirtyFields: !1,
670
+ validatingFields: !1,
671
+ touchedFields: !1,
672
+ isValidating: !1,
673
+ isValid: !1,
674
+ errors: !1
675
+ }, m = {
676
+ values: Be(),
677
+ array: Be(),
678
+ state: Be()
679
+ }, R = ve(t.mode), D = ve(t.reValidateMode), T = t.criteriaMode === z.all, ae = (s) => (a) => {
680
+ clearTimeout(p), p = setTimeout(s, a);
681
+ }, q = async (s) => {
682
+ if (!t.disabled && (S.isValid || s)) {
683
+ const a = t.resolver ? H((await A()).errors) : await I(i, !0);
684
+ a !== r.isValid && m.state.next({
685
+ isValid: a
686
+ });
687
+ }
688
+ }, Z = (s, a) => {
689
+ !t.disabled && (S.isValidating || S.validatingFields) && ((s || Array.from(_.mount)).forEach((l) => {
690
+ l && (a ? E(r.validatingFields, l, a) : M(r.validatingFields, l));
691
+ }), m.state.next({
692
+ validatingFields: r.validatingFields,
693
+ isValidating: !H(r.validatingFields)
694
+ }));
695
+ }, w = (s, a = [], l, d, f = !0, o = !0) => {
696
+ if (d && l && !t.disabled) {
697
+ if (y.action = !0, o && Array.isArray(c(i, s))) {
698
+ const g = l(c(i, s), d.argA, d.argB);
699
+ f && E(i, s, g);
700
+ }
701
+ if (o && Array.isArray(c(r.errors, s))) {
702
+ const g = l(c(r.errors, s), d.argA, d.argB);
703
+ f && E(r.errors, s, g), Yr(r.errors, s);
704
+ }
705
+ if (S.touchedFields && o && Array.isArray(c(r.touchedFields, s))) {
706
+ const g = l(c(r.touchedFields, s), d.argA, d.argB);
707
+ f && E(r.touchedFields, s, g);
708
+ }
709
+ S.dirtyFields && (r.dirtyFields = _e(u, n)), m.state.next({
710
+ name: s,
711
+ isDirty: x(s, a),
712
+ dirtyFields: r.dirtyFields,
713
+ errors: r.errors,
714
+ isValid: r.isValid
715
+ });
716
+ } else
717
+ E(n, s, a);
718
+ }, J = (s, a) => {
719
+ E(r.errors, s, a), m.state.next({
720
+ errors: r.errors
721
+ });
722
+ }, Q = (s) => {
723
+ r.errors = s, m.state.next({
724
+ errors: r.errors,
725
+ isValid: !1
726
+ });
727
+ }, U = (s, a, l, d) => {
728
+ const f = c(i, s);
729
+ if (f) {
730
+ const o = c(n, s, C(l) ? c(u, s) : l);
731
+ C(o) || d && d.defaultChecked || a ? E(n, s, a ? o : Pe(f._f)) : W(s, o), y.mount && q();
732
+ }
733
+ }, v = (s, a, l, d, f) => {
734
+ let o = !1, g = !1;
735
+ const V = {
736
+ name: s
737
+ };
738
+ if (!t.disabled) {
739
+ const P = !!(c(i, s) && c(i, s)._f && c(i, s)._f.disabled);
740
+ if (!l || d) {
741
+ S.isDirty && (g = r.isDirty, r.isDirty = V.isDirty = x(), o = g !== V.isDirty);
742
+ const j = P || ie(c(u, s), a);
743
+ g = !!(!P && c(r.dirtyFields, s)), j || P ? M(r.dirtyFields, s) : E(r.dirtyFields, s, !0), V.dirtyFields = r.dirtyFields, o = o || S.dirtyFields && g !== !j;
744
+ }
745
+ if (l) {
746
+ const j = c(r.touchedFields, s);
747
+ j || (E(r.touchedFields, s, l), V.touchedFields = r.touchedFields, o = o || S.touchedFields && j !== l);
748
+ }
749
+ o && f && m.state.next(V);
750
+ }
751
+ return o ? V : {};
752
+ }, h = (s, a, l, d) => {
753
+ const f = c(r.errors, s), o = S.isValid && G(a) && r.isValid !== a;
754
+ if (t.delayError && l ? (F = ae(() => J(s, l)), F(t.delayError)) : (clearTimeout(p), F = null, l ? E(r.errors, s, l) : M(r.errors, s)), (l ? !ie(f, l) : f) || !H(d) || o) {
755
+ const g = {
756
+ ...d,
757
+ ...o && G(a) ? { isValid: a } : {},
758
+ errors: r.errors,
759
+ name: s
760
+ };
761
+ r = {
762
+ ...r,
763
+ ...g
764
+ }, m.state.next(g);
765
+ }
766
+ }, A = async (s) => {
767
+ Z(s, !0);
768
+ const a = await t.resolver(n, t.context, Hr(s || _.mount, i, t.criteriaMode, t.shouldUseNativeValidation));
769
+ return Z(s), a;
770
+ }, O = async (s) => {
771
+ const { errors: a } = await A(s);
772
+ if (s)
773
+ for (const l of s) {
774
+ const d = c(a, l);
775
+ d ? E(r.errors, l, d) : M(r.errors, l);
776
+ }
777
+ else
778
+ r.errors = a;
779
+ return a;
780
+ }, I = async (s, a, l = {
781
+ valid: !0
782
+ }) => {
783
+ for (const d in s) {
784
+ const f = s[d];
785
+ if (f) {
786
+ const { _f: o, ...g } = f;
787
+ if (o) {
788
+ const V = _.array.has(o.name), P = f._f && $r(f._f);
789
+ P && S.validatingFields && Z([d], !0);
790
+ const j = await We(f, n, T, t.shouldUseNativeValidation && !a, V);
791
+ if (P && S.validatingFields && Z([d]), j[o.name] && (l.valid = !1, a))
792
+ break;
793
+ !a && (c(j, o.name) ? V ? Fr(r.errors, j, o.name) : E(r.errors, o.name, j[o.name]) : M(r.errors, o.name));
794
+ }
795
+ !H(g) && await I(g, a, l);
796
+ }
797
+ }
798
+ return l.valid;
799
+ }, ue = () => {
800
+ for (const s of _.unMount) {
801
+ const a = c(i, s);
802
+ a && (a._f.refs ? a._f.refs.every((l) => !Ie(l)) : !Ie(a._f.ref)) && we(s);
803
+ }
804
+ _.unMount = /* @__PURE__ */ new Set();
805
+ }, x = (s, a) => !t.disabled && (s && a && E(n, s, a), !ie(Ye(), u)), k = (s, a, l) => mr(s, _, {
806
+ ...y.mount ? n : C(a) ? u : re(s) ? { [s]: a } : a
807
+ }, l, a), N = (s) => be(c(y.mount ? n : u, s, t.shouldUnregister ? c(u, s, []) : [])), W = (s, a, l = {}) => {
808
+ const d = c(i, s);
809
+ let f = a;
810
+ if (d) {
811
+ const o = d._f;
812
+ o && (!o.disabled && E(n, s, wr(a, o)), f = Ae(o.ref) && $(a) ? "" : a, xr(o.ref) ? [...o.ref.options].forEach((g) => g.selected = f.includes(g.value)) : o.refs ? he(o.ref) ? o.refs.length > 1 ? o.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(f) ? !!f.find((V) => V === g.value) : f === g.value)) : o.refs[0] && (o.refs[0].checked = !!f) : o.refs.forEach((g) => g.checked = g.value === f) : Ke(o.ref) ? o.ref.value = "" : (o.ref.value = f, o.ref.type || m.values.next({
813
+ name: s,
814
+ values: { ...n }
815
+ })));
816
+ }
817
+ (l.shouldDirty || l.shouldTouch) && v(s, f, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ye(s);
818
+ }, X = (s, a, l) => {
819
+ for (const d in a) {
820
+ const f = a[d], o = `${s}.${d}`, g = c(i, o);
821
+ (_.array.has(s) || L(f) || g && !g._f) && !le(f) ? X(o, f, l) : W(o, f, l);
822
+ }
823
+ }, Y = (s, a, l = {}) => {
824
+ const d = c(i, s), f = _.array.has(s), o = B(a);
825
+ E(n, s, o), f ? (m.array.next({
826
+ name: s,
827
+ values: { ...n }
828
+ }), (S.isDirty || S.dirtyFields) && l.shouldDirty && m.state.next({
829
+ name: s,
830
+ dirtyFields: _e(u, n),
831
+ isDirty: x(s, o)
832
+ })) : d && !d._f && !$(o) ? X(s, o, l) : W(s, o, l), je(s, _) && m.state.next({ ...r }), m.values.next({
833
+ name: y.mount ? s : void 0,
834
+ values: { ...n }
835
+ });
836
+ }, fe = async (s) => {
837
+ y.mount = !0;
838
+ const a = s.target;
839
+ let l = a.name, d = !0;
840
+ const f = c(i, l), o = () => a.type ? Pe(f._f) : dr(s), g = (V) => {
841
+ d = Number.isNaN(V) || le(V) && isNaN(V.getTime()) || ie(V, c(n, l, V));
842
+ };
843
+ if (f) {
844
+ let V, P;
845
+ const j = o(), ne = s.type === Fe.BLUR || s.type === Fe.FOCUS_OUT, Or = !Kr(f._f) && !t.resolver && !c(r.errors, l) && !f._f.deps || Gr(ne, c(r.touchedFields, l), r.isSubmitted, D, R), ke = je(l, _, ne);
846
+ E(n, l, j), ne ? (f._f.onBlur && f._f.onBlur(s), F && F(0)) : f._f.onChange && f._f.onChange(s);
847
+ const Ee = v(l, j, ne, !1), Tr = !H(Ee) || ke;
848
+ if (!ne && m.values.next({
849
+ name: l,
850
+ type: s.type,
851
+ values: { ...n }
852
+ }), Or)
853
+ return S.isValid && (t.mode === "onBlur" ? ne && q() : q()), Tr && m.state.next({ name: l, ...ke ? {} : Ee });
854
+ if (!ne && ke && m.state.next({ ...r }), t.resolver) {
855
+ const { errors: tr } = await A([l]);
856
+ if (g(j), d) {
857
+ const Ur = cr(r.errors, i, l), sr = cr(tr, i, Ur.name || l);
858
+ V = sr.error, l = sr.name, P = H(tr);
859
+ }
860
+ } else
861
+ Z([l], !0), V = (await We(f, n, T, t.shouldUseNativeValidation))[l], Z([l]), g(j), d && (V ? P = !1 : S.isValid && (P = await I(i, !0)));
862
+ d && (f._f.deps && ye(f._f.deps), h(l, P, V, Ee));
863
+ }
864
+ }, de = (s, a) => {
865
+ if (c(r.errors, a) && s.focus)
866
+ return s.focus(), 1;
867
+ }, ye = async (s, a = {}) => {
868
+ let l, d;
869
+ const f = K(s);
870
+ if (t.resolver) {
871
+ const o = await O(C(s) ? s : f);
872
+ l = H(o), d = s ? !f.some((g) => c(o, g)) : l;
873
+ } else s ? (d = (await Promise.all(f.map(async (o) => {
874
+ const g = c(i, o);
875
+ return await I(g && g._f ? { [o]: g } : g);
876
+ }))).every(Boolean), !(!d && !r.isValid) && q()) : d = l = await I(i);
877
+ return m.state.next({
878
+ ...!re(s) || S.isValid && l !== r.isValid ? {} : { name: s },
879
+ ...t.resolver || !s ? { isValid: l } : {},
880
+ errors: r.errors
881
+ }), a.shouldFocus && !d && ce(i, de, s ? f : _.mount), d;
882
+ }, Ye = (s) => {
883
+ const a = {
884
+ ...y.mount ? n : u
885
+ };
886
+ return C(s) ? a : re(s) ? c(a, s) : s.map((l) => c(a, l));
887
+ }, ze = (s, a) => ({
888
+ invalid: !!c((a || r).errors, s),
889
+ isDirty: !!c((a || r).dirtyFields, s),
890
+ error: c((a || r).errors, s),
891
+ isValidating: !!c(r.validatingFields, s),
892
+ isTouched: !!c((a || r).touchedFields, s)
893
+ }), Dr = (s) => {
894
+ s && K(s).forEach((a) => M(r.errors, a)), m.state.next({
895
+ errors: s ? r.errors : {}
896
+ });
897
+ }, Je = (s, a, l) => {
898
+ const d = (c(i, s, { _f: {} })._f || {}).ref, f = c(r.errors, s) || {}, { ref: o, message: g, type: V, ...P } = f;
899
+ E(r.errors, s, {
900
+ ...P,
901
+ ...a,
902
+ ref: d
903
+ }), m.state.next({
904
+ name: s,
905
+ errors: r.errors,
906
+ isValid: !1
907
+ }), l && l.shouldFocus && d && d.focus && d.focus();
908
+ }, kr = (s, a) => ee(s) ? m.values.subscribe({
909
+ next: (l) => s(k(void 0, a), l)
910
+ }) : k(s, a, !0), we = (s, a = {}) => {
911
+ for (const l of s ? K(s) : _.mount)
912
+ _.mount.delete(l), _.array.delete(l), a.keepValue || (M(i, l), M(n, l)), !a.keepError && M(r.errors, l), !a.keepDirty && M(r.dirtyFields, l), !a.keepTouched && M(r.touchedFields, l), !a.keepIsValidating && M(r.validatingFields, l), !t.shouldUnregister && !a.keepDefaultValue && M(u, l);
913
+ m.values.next({
914
+ values: { ...n }
915
+ }), m.state.next({
916
+ ...r,
917
+ ...a.keepDirty ? { isDirty: x() } : {}
918
+ }), !a.keepIsValid && q();
919
+ }, Qe = ({ disabled: s, name: a, field: l, fields: d, value: f }) => {
920
+ if (G(s) && y.mount || s) {
921
+ const o = s ? void 0 : C(f) ? Pe(l ? l._f : c(d, a)._f) : f;
922
+ (s || !s && !C(o)) && E(n, a, o), v(a, o, !1, !1, !0);
923
+ }
924
+ }, De = (s, a = {}) => {
925
+ let l = c(i, s);
926
+ const d = G(a.disabled) || G(t.disabled);
927
+ return E(i, s, {
928
+ ...l || {},
929
+ _f: {
930
+ ...l && l._f ? l._f : { ref: { name: s } },
931
+ name: s,
932
+ mount: !0,
933
+ ...a
934
+ }
935
+ }), _.mount.add(s), l ? Qe({
936
+ field: l,
937
+ disabled: G(a.disabled) ? a.disabled : t.disabled,
938
+ name: s,
939
+ value: a.value
940
+ }) : U(s, !0, a.value), {
941
+ ...d ? { disabled: a.disabled || t.disabled } : {},
942
+ ...t.progressive ? {
943
+ required: !!a.required,
944
+ min: ge(a.min),
945
+ max: ge(a.max),
946
+ minLength: ge(a.minLength),
947
+ maxLength: ge(a.maxLength),
948
+ pattern: ge(a.pattern)
949
+ } : {},
950
+ name: s,
951
+ onChange: fe,
952
+ onBlur: fe,
953
+ ref: (f) => {
954
+ if (f) {
955
+ De(s, a), l = c(i, s);
956
+ const o = C(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, g = qr(o), V = l._f.refs || [];
957
+ if (g ? V.find((P) => P === o) : o === l._f.ref)
958
+ return;
959
+ E(i, s, {
960
+ _f: {
961
+ ...l._f,
962
+ ...g ? {
963
+ refs: [
964
+ ...V.filter(Ie),
965
+ o,
966
+ ...Array.isArray(c(u, s)) ? [{}] : []
967
+ ],
968
+ ref: { type: o.type, name: s }
969
+ } : { ref: o }
970
+ }
971
+ }), U(s, !1, void 0, o);
972
+ } else
973
+ l = c(i, s, {}), l._f && (l._f.mount = !1), (t.shouldUnregister || a.shouldUnregister) && !(yr(_.array, s) && y.action) && _.unMount.add(s);
974
+ }
975
+ };
976
+ }, Xe = () => t.shouldFocusError && ce(i, de, _.mount), Er = (s) => {
977
+ G(s) && (m.state.next({ disabled: s }), ce(i, (a, l) => {
978
+ const d = c(i, l);
979
+ d && (a.disabled = d._f.disabled || s, Array.isArray(d._f.refs) && d._f.refs.forEach((f) => {
980
+ f.disabled = d._f.disabled || s;
981
+ }));
982
+ }, 0, !1));
983
+ }, Ze = (s, a) => async (l) => {
984
+ let d;
985
+ if (l && (l.preventDefault && l.preventDefault(), l.persist && l.persist()), t.disabled) {
986
+ a && await a({ ...r.errors }, l);
987
+ return;
988
+ }
989
+ let f = B(n);
990
+ if (m.state.next({
991
+ isSubmitting: !0
992
+ }), t.resolver) {
993
+ const { errors: o, values: g } = await A();
994
+ r.errors = o, f = g;
995
+ } else
996
+ await I(i);
997
+ if (M(r.errors, "root"), H(r.errors)) {
998
+ m.state.next({
999
+ errors: {}
1000
+ });
1001
+ try {
1002
+ await s(f, l);
1003
+ } catch (o) {
1004
+ d = o;
1005
+ }
1006
+ } else
1007
+ a && await a({ ...r.errors }, l), Xe(), setTimeout(Xe);
1008
+ if (m.state.next({
1009
+ isSubmitted: !0,
1010
+ isSubmitting: !1,
1011
+ isSubmitSuccessful: H(r.errors) && !d,
1012
+ submitCount: r.submitCount + 1,
1013
+ errors: r.errors
1014
+ }), d)
1015
+ throw d;
1016
+ }, Cr = (s, a = {}) => {
1017
+ c(i, s) && (C(a.defaultValue) ? Y(s, B(c(u, s))) : (Y(s, a.defaultValue), E(u, s, B(a.defaultValue))), a.keepTouched || M(r.touchedFields, s), a.keepDirty || (M(r.dirtyFields, s), r.isDirty = a.defaultValue ? x(s, B(c(u, s))) : x()), a.keepError || (M(r.errors, s), S.isValid && q()), m.state.next({ ...r }));
1018
+ }, er = (s, a = {}) => {
1019
+ const l = s ? B(s) : u, d = B(l), f = H(s), o = f ? u : d;
1020
+ if (a.keepDefaultValues || (u = l), !a.keepValues) {
1021
+ if (a.keepDirtyValues) {
1022
+ const g = /* @__PURE__ */ new Set([
1023
+ ..._.mount,
1024
+ ...Object.keys(_e(u, n))
1025
+ ]);
1026
+ for (const V of Array.from(g))
1027
+ c(r.dirtyFields, V) ? E(o, V, c(n, V)) : Y(V, c(o, V));
1028
+ } else {
1029
+ if (He && C(s))
1030
+ for (const g of _.mount) {
1031
+ const V = c(i, g);
1032
+ if (V && V._f) {
1033
+ const P = Array.isArray(V._f.refs) ? V._f.refs[0] : V._f.ref;
1034
+ if (Ae(P)) {
1035
+ const j = P.closest("form");
1036
+ if (j) {
1037
+ j.reset();
1038
+ break;
1039
+ }
1040
+ }
1041
+ }
1042
+ }
1043
+ i = {};
1044
+ }
1045
+ n = t.shouldUnregister ? a.keepDefaultValues ? B(u) : {} : B(o), m.array.next({
1046
+ values: { ...o }
1047
+ }), m.values.next({
1048
+ values: { ...o }
1049
+ });
1050
+ }
1051
+ _ = {
1052
+ mount: a.keepDirtyValues ? _.mount : /* @__PURE__ */ new Set(),
1053
+ unMount: /* @__PURE__ */ new Set(),
1054
+ array: /* @__PURE__ */ new Set(),
1055
+ watch: /* @__PURE__ */ new Set(),
1056
+ watchAll: !1,
1057
+ focus: ""
1058
+ }, y.mount = !S.isValid || !!a.keepIsValid || !!a.keepDirtyValues, y.watch = !!t.shouldUnregister, m.state.next({
1059
+ submitCount: a.keepSubmitCount ? r.submitCount : 0,
1060
+ isDirty: f ? !1 : a.keepDirty ? r.isDirty : !!(a.keepDefaultValues && !ie(s, u)),
1061
+ isSubmitted: a.keepIsSubmitted ? r.isSubmitted : !1,
1062
+ dirtyFields: f ? {} : a.keepDirtyValues ? a.keepDefaultValues && n ? _e(u, n) : r.dirtyFields : a.keepDefaultValues && s ? _e(u, s) : a.keepDirty ? r.dirtyFields : {},
1063
+ touchedFields: a.keepTouched ? r.touchedFields : {},
1064
+ errors: a.keepErrors ? r.errors : {},
1065
+ isSubmitSuccessful: a.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
1066
+ isSubmitting: !1
1067
+ });
1068
+ }, rr = (s, a) => er(ee(s) ? s(n) : s, a);
1069
+ return {
1070
+ control: {
1071
+ register: De,
1072
+ unregister: we,
1073
+ getFieldState: ze,
1074
+ handleSubmit: Ze,
1075
+ setError: Je,
1076
+ _executeSchema: A,
1077
+ _getWatch: k,
1078
+ _getDirty: x,
1079
+ _updateValid: q,
1080
+ _removeUnmounted: ue,
1081
+ _updateFieldArray: w,
1082
+ _updateDisabledField: Qe,
1083
+ _getFieldArray: N,
1084
+ _reset: er,
1085
+ _resetDefaultValues: () => ee(t.defaultValues) && t.defaultValues().then((s) => {
1086
+ rr(s, t.resetOptions), m.state.next({
1087
+ isLoading: !1
1088
+ });
1089
+ }),
1090
+ _updateFormState: (s) => {
1091
+ r = {
1092
+ ...r,
1093
+ ...s
1094
+ };
1095
+ },
1096
+ _disableForm: Er,
1097
+ _subjects: m,
1098
+ _proxyFormState: S,
1099
+ _setErrors: Q,
1100
+ get _fields() {
1101
+ return i;
1102
+ },
1103
+ get _formValues() {
1104
+ return n;
1105
+ },
1106
+ get _state() {
1107
+ return y;
1108
+ },
1109
+ set _state(s) {
1110
+ y = s;
1111
+ },
1112
+ get _defaultValues() {
1113
+ return u;
1114
+ },
1115
+ get _names() {
1116
+ return _;
1117
+ },
1118
+ set _names(s) {
1119
+ _ = s;
1120
+ },
1121
+ get _formState() {
1122
+ return r;
1123
+ },
1124
+ set _formState(s) {
1125
+ r = s;
1126
+ },
1127
+ get _options() {
1128
+ return t;
1129
+ },
1130
+ set _options(s) {
1131
+ t = {
1132
+ ...t,
1133
+ ...s
1134
+ };
1135
+ }
1136
+ },
1137
+ trigger: ye,
1138
+ register: De,
1139
+ handleSubmit: Ze,
1140
+ watch: kr,
1141
+ setValue: Y,
1142
+ getValues: Ye,
1143
+ reset: rr,
1144
+ resetField: Cr,
1145
+ clearErrors: Dr,
1146
+ unregister: we,
1147
+ setError: Je,
1148
+ setFocus: (s, a = {}) => {
1149
+ const l = c(i, s), d = l && l._f;
1150
+ if (d) {
1151
+ const f = d.refs ? d.refs[0] : d.ref;
1152
+ f.focus && (f.focus(), a.shouldSelect && ee(f.select) && f.select());
1153
+ }
1154
+ },
1155
+ getFieldState: ze
1156
+ };
1157
+ }
1158
+ function it(e = {}) {
1159
+ const t = b.useRef(), r = b.useRef(), [i, u] = b.useState({
1160
+ isDirty: !1,
1161
+ isValidating: !1,
1162
+ isLoading: ee(e.defaultValues),
1163
+ isSubmitted: !1,
1164
+ isSubmitting: !1,
1165
+ isSubmitSuccessful: !1,
1166
+ isValid: !1,
1167
+ submitCount: 0,
1168
+ dirtyFields: {},
1169
+ touchedFields: {},
1170
+ validatingFields: {},
1171
+ errors: e.errors || {},
1172
+ disabled: e.disabled || !1,
1173
+ defaultValues: ee(e.defaultValues) ? void 0 : e.defaultValues
1174
+ });
1175
+ t.current || (t.current = {
1176
+ ...Jr(e),
1177
+ formState: i
1178
+ });
1179
+ const n = t.current.control;
1180
+ return n._options = e, Se({
1181
+ subject: n._subjects.state,
1182
+ next: (y) => {
1183
+ hr(y, n._proxyFormState, n._updateFormState, !0) && u({ ...n._formState });
1184
+ }
1185
+ }), b.useEffect(() => n._disableForm(e.disabled), [n, e.disabled]), b.useEffect(() => {
1186
+ if (n._proxyFormState.isDirty) {
1187
+ const y = n._getDirty();
1188
+ y !== i.isDirty && n._subjects.state.next({
1189
+ isDirty: y
1190
+ });
1191
+ }
1192
+ }, [n, i.isDirty]), b.useEffect(() => {
1193
+ e.values && !ie(e.values, r.current) ? (n._reset(e.values, n._options.resetOptions), r.current = e.values, u((y) => ({ ...y }))) : n._resetDefaultValues();
1194
+ }, [e.values, n]), b.useEffect(() => {
1195
+ e.errors && n._setErrors(e.errors);
1196
+ }, [e.errors, n]), b.useEffect(() => {
1197
+ n._state.mount || (n._updateValid(), n._state.mount = !0), n._state.watch && (n._state.watch = !1, n._subjects.state.next({ ...n._formState })), n._removeUnmounted();
1198
+ }), b.useEffect(() => {
1199
+ e.shouldUnregister && n._subjects.values.next({
1200
+ values: n._getWatch()
1201
+ });
1202
+ }, [e.shouldUnregister, n]), b.useMemo(() => ({
1203
+ ...t.current,
1204
+ formState: vr(i, n)
1205
+ }), [i, n]);
1206
+ }
1207
+ export {
1208
+ tt as C,
1209
+ rt as F,
1210
+ it as a,
1211
+ st as b,
1212
+ pe as u
1213
+ };
1214
+ //# sourceMappingURL=index.esm-BnnBRKJX.js.map