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