stone-kit 0.0.875 → 0.0.877

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. package/dist/App.js +1 -1
  2. package/dist/Router.js +9 -9
  3. package/dist/_virtual/_commonjsHelpers.js +6 -0
  4. package/dist/_virtual/bind.js +4 -0
  5. package/dist/_virtual/index.js +4 -0
  6. package/dist/_virtual/index2.js +4 -0
  7. package/dist/_virtual/index3.js +4 -0
  8. package/dist/_virtual/react-is.development.js +4 -0
  9. package/dist/_virtual/react-is.production.min.js +4 -0
  10. package/dist/components/Button/ui/Button.js +44 -73
  11. package/dist/components/CheckBox/CheckBox.js +35 -46
  12. package/dist/components/CheckBoxNew/CheckBoxNew.js +19 -23
  13. package/dist/components/CheckboxSelect/ui/CheckboxSelect.js +24 -31
  14. package/dist/components/DestinationTab/ui/DestinationTab.js +35 -48
  15. package/dist/components/FieldInput/ui/FieldInput.js +7 -10
  16. package/dist/components/FilterWithSave/hooks/useFilterWithSave.js +61 -5
  17. package/dist/components/FilterWithSave/ui/FilterWithSave.js +266 -7
  18. package/dist/components/Flex/ui/Flex.js +26 -61
  19. package/dist/components/FormModal/ui/ModalForm.js +289 -14
  20. package/dist/components/GroupedInput/ui/GroupedInputs.js +5 -6
  21. package/dist/components/Input/ui/Input.js +74 -3307
  22. package/dist/components/Logo/ui/Logo.js +19 -31
  23. package/dist/components/Logo/ui/Logo.types.js +18 -10
  24. package/dist/components/LotCard/hooks/useLotCard.js +125 -11
  25. package/dist/components/LotCard/index.js +2 -2
  26. package/dist/components/LotCard/ui/LotCard.js +150 -9
  27. package/dist/components/LotCardSkeleton/ui/LotCardSkeleton.js +31 -58
  28. package/dist/components/MetroLabel/ui/MetroLabel.js +19 -24
  29. package/dist/components/MetroTag/ui/MetroTag.js +59 -72
  30. package/dist/components/Modal/ui/Modal.js +33 -38
  31. package/dist/components/ModalSuccess/ModalSuccess.js +26 -35
  32. package/dist/components/NewIcon/icons/PinTrans.js +3 -3
  33. package/dist/components/NewIcon/icons/SmallFilter.js +1 -1
  34. package/dist/components/NewIcon/ui/NewIcon.js +141 -301
  35. package/dist/components/ProjectCardSkeleton/ui/ProjectCardSkeleton.js +5 -15
  36. package/dist/components/RoundButton/ui/RoundButton.js +42 -60
  37. package/dist/components/Select/ui/Category.js +30 -29
  38. package/dist/components/Select/ui/Option.js +52 -5
  39. package/dist/components/Select/ui/Select.js +24 -23
  40. package/dist/components/SliderNavigation/ui/SliderNavigation.js +27 -28
  41. package/dist/components/SortSelect/hooks/useSortSelect.js +59 -4
  42. package/dist/components/SortSelect/index.js +1 -1
  43. package/dist/components/SortSelect/ui/SortSelect.js +114 -9
  44. package/dist/components/SummarySelect/ui/SummarySelect.js +59 -69
  45. package/dist/components/Switcher/ui/Switcher.js +13 -24
  46. package/dist/components/TabSelect/ui/TabSelect.js +28 -34
  47. package/dist/components/TabSwitcher/index.js +2 -2
  48. package/dist/components/TabSwitcher/ui/TabSwitcher.js +84 -7
  49. package/dist/components/Tag/ui/Tag.js +19 -67
  50. package/dist/components/Text/ui/Text.js +12 -13
  51. package/dist/components/TextArea/TextArea.js +11 -14
  52. package/dist/components/ZoomControls/ui/ZoomControls.js +8 -11
  53. package/dist/components/mobileButton/ui/MobileButton.js +34 -39
  54. package/dist/layout/Layout.js +7 -8
  55. package/dist/layout/components/Header/Header.js +41 -44
  56. package/dist/layout/components/Menu.js +111 -6
  57. package/dist/main.js +46 -42
  58. package/dist/node_modules/@remix-run/router/dist/router.js +431 -0
  59. package/dist/node_modules/classnames/bind.js +42 -0
  60. package/dist/{index-rKuIKazb.js → node_modules/classnames/index.js} +12 -15
  61. package/dist/node_modules/imask/esm/controls/html-contenteditable-mask-element.js +35 -0
  62. package/dist/node_modules/imask/esm/controls/html-input-mask-element.js +31 -0
  63. package/dist/node_modules/imask/esm/controls/html-mask-element.js +48 -0
  64. package/dist/node_modules/imask/esm/controls/input-history.js +30 -0
  65. package/dist/node_modules/imask/esm/controls/input.js +224 -0
  66. package/dist/node_modules/imask/esm/controls/mask-element.js +43 -0
  67. package/dist/node_modules/imask/esm/core/action-details.js +51 -0
  68. package/dist/node_modules/imask/esm/core/change-details.js +36 -0
  69. package/dist/node_modules/imask/esm/core/continuous-tail-details.js +44 -0
  70. package/dist/node_modules/imask/esm/core/holder.js +6 -0
  71. package/dist/node_modules/imask/esm/core/utils.js +80 -0
  72. package/dist/node_modules/imask/esm/index.js +50 -0
  73. package/dist/node_modules/imask/esm/masked/base.js +257 -0
  74. package/dist/node_modules/imask/esm/masked/date.js +118 -0
  75. package/dist/node_modules/imask/esm/masked/dynamic.js +224 -0
  76. package/dist/node_modules/imask/esm/masked/enum.js +70 -0
  77. package/dist/node_modules/imask/esm/masked/factory.js +51 -0
  78. package/dist/node_modules/imask/esm/masked/function.js +23 -0
  79. package/dist/node_modules/imask/esm/masked/number.js +215 -0
  80. package/dist/node_modules/imask/esm/masked/pattern/chunk-tail-details.js +110 -0
  81. package/dist/node_modules/imask/esm/masked/pattern/cursor.js +102 -0
  82. package/dist/node_modules/imask/esm/masked/pattern/fixed-definition.js +103 -0
  83. package/dist/node_modules/imask/esm/masked/pattern/input-definition.js +134 -0
  84. package/dist/node_modules/imask/esm/masked/pattern.js +339 -0
  85. package/dist/node_modules/imask/esm/masked/pipe.js +23 -0
  86. package/dist/node_modules/imask/esm/masked/range.js +82 -0
  87. package/dist/node_modules/imask/esm/masked/regexp.js +21 -0
  88. package/dist/node_modules/imask/esm/masked/repeat.js +106 -0
  89. package/dist/node_modules/object-assign/index.js +55 -0
  90. package/dist/node_modules/prop-types/checkPropTypes.js +55 -0
  91. package/dist/node_modules/prop-types/factoryWithThrowingShims.js +53 -0
  92. package/dist/node_modules/prop-types/factoryWithTypeCheckers.js +330 -0
  93. package/dist/node_modules/prop-types/index.js +15 -0
  94. package/dist/node_modules/prop-types/lib/ReactPropTypesSecret.js +11 -0
  95. package/dist/node_modules/prop-types/lib/has.js +7 -0
  96. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +95 -0
  97. package/dist/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +79 -0
  98. package/dist/node_modules/prop-types/node_modules/react-is/index.js +10 -0
  99. package/dist/node_modules/react-hook-form/dist/index.esm.js +1062 -0
  100. package/dist/node_modules/react-imask/esm/input.js +25 -0
  101. package/dist/node_modules/react-imask/esm/mixin.js +131 -0
  102. package/dist/node_modules/react-router/dist/index.js +486 -0
  103. package/dist/node_modules/react-router-dom/dist/index.js +424 -0
  104. package/dist/pages/ButtonsPage/ButtonState/ButtonState.js +1 -1
  105. package/dist/pages/ButtonsPage/Buttons.js +54 -62
  106. package/dist/pages/CheckboxPage/CheckboxPage.js +47 -51
  107. package/dist/pages/FormsPage/FormsPage.js +31 -32
  108. package/dist/pages/HomePage/HomePage.js +3 -4
  109. package/dist/pages/IconsPage/IconsPage.js +12 -10
  110. package/dist/pages/InputPage/InputPage.js +17 -12
  111. package/dist/pages/LogoPage/LogoPage.js +17 -14
  112. package/dist/pages/LotsPage/LotsPage.js +15 -15
  113. package/dist/pages/ModalsPage/ModalPage.js +19 -14
  114. package/dist/pages/SelectPage/SelectPage.js +42 -41
  115. package/dist/pages/TabsPage/TabsPage.js +49 -51
  116. package/dist/pages/TagsPage/TagsPage.js +10 -7
  117. package/dist/src/components/Button/ui/Button.module.scss.js +49 -0
  118. package/dist/src/components/CheckBox/s.module.scss.js +24 -0
  119. package/dist/src/components/CheckBoxNew/s.module.scss.js +13 -0
  120. package/dist/src/components/CheckboxSelect/ui/s.module.scss.js +19 -0
  121. package/dist/src/components/DestinationTab/ui/DestinationTab.module.scss.js +23 -0
  122. package/dist/src/components/FieldInput/ui/FieldInput.module.scss.js +11 -0
  123. package/dist/src/components/FilterWithSave/ui/s.module.scss.js +39 -0
  124. package/dist/src/components/Flex/ui/Flex.module.scss.js +41 -0
  125. package/dist/src/components/FormModal/ui/ModalForm.module.scss.js +31 -0
  126. package/dist/src/components/GroupedInput/ui/GroupedInputs.module.scss.js +7 -0
  127. package/dist/src/components/Input/ui/Input.module.scss.js +43 -0
  128. package/dist/src/components/Logo/assets/LogoBlack.svg.js +4 -0
  129. package/dist/src/components/Logo/assets/LogoDom.svg.js +4 -0
  130. package/dist/src/components/Logo/assets/LogoNewDom.svg.js +4 -0
  131. package/dist/src/components/Logo/assets/LogoNewOffice.svg.js +4 -0
  132. package/dist/src/components/Logo/assets/LogoOffice.svg.js +4 -0
  133. package/dist/src/components/Logo/assets/LogoRealty.svg.js +4 -0
  134. package/dist/src/components/Logo/assets/LogoValue.svg.js +4 -0
  135. package/dist/src/components/Logo/assets/LogoWhite.svg.js +4 -0
  136. package/dist/src/components/Logo/ui/Logo.module.scss.js +29 -0
  137. package/dist/src/components/LotCard/assets/testLot.webp.js +4 -0
  138. package/dist/src/components/LotCard/ui/LotCard.module.scss.js +71 -0
  139. package/dist/src/components/LotCardSkeleton/ui/LotCardSkeleton.module.scss.js +59 -0
  140. package/dist/src/components/MetroLabel/ui/MetroLabel.module.scss.js +15 -0
  141. package/dist/src/components/MetroTag/ui/MetroTag.module.scss.js +31 -0
  142. package/dist/src/components/Modal/ui/Modal.module.scss.js +15 -0
  143. package/dist/src/components/ModalSuccess/styles.module.scss.js +23 -0
  144. package/dist/src/components/NewIcon/assets/ArrowLong.svg.js +10 -0
  145. package/dist/src/components/NewIcon/assets/ArrowShort.svg.js +10 -0
  146. package/dist/src/components/NewIcon/assets/Auto.svg.js +10 -0
  147. package/dist/src/components/NewIcon/assets/Building.svg.js +10 -0
  148. package/dist/src/components/NewIcon/assets/Burger.svg.js +10 -0
  149. package/dist/src/components/NewIcon/assets/BurgerClose.svg.js +10 -0
  150. package/dist/src/components/NewIcon/assets/Call.svg.js +10 -0
  151. package/dist/src/components/NewIcon/assets/Callback.svg.js +10 -0
  152. package/dist/src/components/NewIcon/assets/Case.svg.js +10 -0
  153. package/dist/src/components/NewIcon/assets/Check.svg.js +10 -0
  154. package/dist/src/components/NewIcon/assets/Circle.svg.js +10 -0
  155. package/dist/src/components/NewIcon/assets/Close.svg.js +10 -0
  156. package/dist/src/components/NewIcon/assets/DirectionDown.svg.js +10 -0
  157. package/dist/src/components/NewIcon/assets/Download.svg.js +10 -0
  158. package/dist/src/components/NewIcon/assets/Filter.svg.js +10 -0
  159. package/dist/src/components/NewIcon/assets/Food.svg.js +10 -0
  160. package/dist/src/components/NewIcon/assets/Fullscreen.svg.js +10 -0
  161. package/dist/src/components/NewIcon/assets/Heart.svg.js +10 -0
  162. package/dist/src/components/NewIcon/assets/Layers.svg.js +10 -0
  163. package/dist/src/components/NewIcon/assets/LayersFilled.svg.js +10 -0
  164. package/dist/src/components/NewIcon/assets/Loader.svg.js +10 -0
  165. package/dist/src/components/NewIcon/assets/Lock.svg.js +10 -0
  166. package/dist/src/components/NewIcon/assets/Metro.svg.js +10 -0
  167. package/dist/src/components/NewIcon/assets/Minus.svg.js +10 -0
  168. package/dist/src/components/NewIcon/assets/MinusCheck.svg.js +10 -0
  169. package/dist/src/components/NewIcon/assets/Moon.svg.js +10 -0
  170. package/dist/src/components/NewIcon/assets/Park.svg.js +10 -0
  171. package/dist/src/components/NewIcon/assets/Pedestrian.svg.js +10 -0
  172. package/dist/src/components/NewIcon/assets/Phone.svg.js +10 -0
  173. package/dist/src/components/NewIcon/assets/PhoneFilled.svg.js +10 -0
  174. package/dist/src/components/NewIcon/assets/Pin.svg.js +10 -0
  175. package/dist/{PinTrans-D6OZq76b.js → src/components/NewIcon/assets/PinTrans.svg.js} +4 -4
  176. package/dist/src/components/NewIcon/assets/Play.svg.js +10 -0
  177. package/dist/src/components/NewIcon/assets/Play2.svg.js +10 -0
  178. package/dist/src/components/NewIcon/assets/Plus.svg.js +10 -0
  179. package/dist/src/components/NewIcon/assets/Redo.svg.js +10 -0
  180. package/dist/src/components/NewIcon/assets/Ruble.svg.js +10 -0
  181. package/dist/src/components/NewIcon/assets/Search.svg.js +10 -0
  182. package/dist/src/components/NewIcon/assets/SelectChecked.svg.js +10 -0
  183. package/dist/src/components/NewIcon/assets/SelectUnchecked.svg.js +10 -0
  184. package/dist/src/components/NewIcon/assets/Share.svg.js +10 -0
  185. package/dist/{SmallFilter-C-VKnbkP.js → src/components/NewIcon/assets/SmallFilter.svg.js} +3 -3
  186. package/dist/src/components/NewIcon/assets/Sport.svg.js +10 -0
  187. package/dist/src/components/NewIcon/assets/SquareMeter.svg.js +10 -0
  188. package/dist/src/components/NewIcon/assets/Star.svg.js +10 -0
  189. package/dist/src/components/NewIcon/assets/StarFilled.svg.js +10 -0
  190. package/dist/src/components/NewIcon/assets/Sun.svg.js +10 -0
  191. package/dist/src/components/NewIcon/assets/Telegram.svg.js +10 -0
  192. package/dist/src/components/NewIcon/assets/Timer.svg.js +10 -0
  193. package/dist/src/components/NewIcon/assets/TwoArrows.svg.js +10 -0
  194. package/dist/src/components/NewIcon/assets/User.svg.js +10 -0
  195. package/dist/src/components/NewIcon/assets/WhatsApp.svg.js +10 -0
  196. package/dist/src/components/NewIcon/assets/WithoutDecor.svg.js +10 -0
  197. package/dist/src/components/NewIcon/assets/arrowRight.svg.js +10 -0
  198. package/dist/src/components/NewIcon/assets/mail.svg.js +10 -0
  199. package/dist/src/components/NewIcon/ui/NewIcon.module.scss.js +4 -0
  200. package/dist/src/components/ProjectCardSkeleton/ui/ProjectCardSkeleton.module.scss.js +25 -0
  201. package/dist/src/components/RoundButton/ui/RoundButton.module.scss.js +29 -0
  202. package/dist/src/components/Select/ui/Select.module.scss.js +52 -0
  203. package/dist/src/components/SliderNavigation/ui/SliderNavigation.module.scss.js +7 -0
  204. package/dist/src/components/SortSelect/ui/SortSelect.module.scss.js +41 -0
  205. package/dist/src/components/SummarySelect/ui/SummarySelect.module.scss.js +25 -0
  206. package/dist/src/components/Switcher/ui/Switcher.module.scss.js +27 -0
  207. package/dist/src/components/TabSelect/ui/TabSelect.module.scss.js +17 -0
  208. package/dist/src/components/TabSwitcher/ui/TabSwitcher.module.scss.js +57 -0
  209. package/dist/src/components/Tag/ui/Tag.module.scss.js +70 -0
  210. package/dist/src/components/Text/ui/Text.module.scss.js +7 -0
  211. package/dist/src/components/TextArea/styles.module.scss.js +9 -0
  212. package/dist/src/components/ZoomControls/ui/ZoomControls.module.scss.js +11 -0
  213. package/dist/src/components/mobileButton/ui/MobileButton.module.scss.js +12 -0
  214. package/dist/src/layout/components/Header/s.module.scss.js +19 -0
  215. package/dist/src/layout/components/Menu.module.scss.js +9 -0
  216. package/dist/src/layout/style.module.scss.js +7 -0
  217. package/dist/src/pages/ButtonsPage/ButtonState/ButtonState.js +18 -0
  218. package/dist/{ButtonState.module-DtW3aevR.js → src/pages/ButtonsPage/ButtonState/ButtonState.module.scss.js} +4 -1
  219. package/dist/src/pages/ButtonsPage/ButtonsPage.module.scss.js +9 -0
  220. package/dist/src/pages/CheckboxPage/CheckboxPage.module.scss.js +13 -0
  221. package/dist/src/pages/FormsPage/FormsPage.module.scss.js +15 -0
  222. package/dist/src/pages/HomePage/HomePage.module.scss.js +7 -0
  223. package/dist/src/pages/IconsPage/IconsPage.module.scss.js +9 -0
  224. package/dist/src/pages/InputPage/InputPage.module.scss.js +4 -0
  225. package/dist/src/pages/LogoPage/LogoPage.module.scss.js +7 -0
  226. package/dist/src/pages/LotsPage/LotsPage.module.scss.js +13 -0
  227. package/dist/src/pages/ModalsPage/ModalPage.module.scss.js +4 -0
  228. package/dist/src/pages/SelectPage/SelectPage.module.scss.js +11 -0
  229. package/dist/src/pages/TabsPage/TabsPage.module.scss.js +17 -0
  230. package/dist/src/pages/TagsPage/TagsPage.module.scss.js +7 -0
  231. package/dist/src/stories/button.css.js +1 -0
  232. package/dist/src/stories/header.css.js +1 -0
  233. package/dist/src/stories/page.css.js +1 -0
  234. package/dist/stories/Button.js +24 -0
  235. package/dist/stories/Header.js +45 -0
  236. package/dist/stories/Page.js +59 -0
  237. package/dist/style.css +1 -1
  238. package/package.json +11 -6
  239. package/dist/FilterWithSave-Bp6rH8Pe.js +0 -2230
  240. package/dist/Menu-CgCfinVZ.js +0 -513
  241. package/dist/Option-BVIm7wOW.js +0 -83
  242. package/dist/index-DmANy9jd.js +0 -890
  243. package/dist/useSortSelect-CjZXLFOG.js +0 -80
@@ -0,0 +1,1062 @@
1
+ import m from "react";
2
+ var ce = (e) => e.type === "checkbox", ie = (e) => e instanceof Date, O = (e) => e == null;
3
+ const et = (e) => typeof e == "object";
4
+ var T = (e) => !O(e) && !Array.isArray(e) && et(e) && !ie(e), tt = (e) => T(e) && e.target ? ce(e.target) ? e.target.checked : e.target.value : e, At = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, rt = (e, s) => e.has(At(s)), xt = (e) => {
5
+ const s = e.constructor && e.constructor.prototype;
6
+ return T(s) && s.hasOwnProperty("isPrototypeOf");
7
+ }, Re = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
8
+ function p(e) {
9
+ let s;
10
+ const t = Array.isArray(e);
11
+ if (e instanceof Date)
12
+ s = new Date(e);
13
+ else if (e instanceof Set)
14
+ s = new Set(e);
15
+ else if (!(Re && (e instanceof Blob || e instanceof FileList)) && (t || T(e)))
16
+ if (s = t ? [] : {}, !t && !xt(e))
17
+ s = e;
18
+ else
19
+ for (const u in e)
20
+ e.hasOwnProperty(u) && (s[u] = p(e[u]));
21
+ else
22
+ return e;
23
+ return s;
24
+ }
25
+ var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], w = (e) => e === void 0, f = (e, s, t) => {
26
+ if (!s || !T(e))
27
+ return t;
28
+ const u = Ae(s.split(/[,[\].]+?/)).reduce((n, a) => O(n) ? n : n[a], e);
29
+ return w(u) || u === e ? w(e[s]) ? t : e[s] : u;
30
+ }, j = (e) => typeof e == "boolean", Te = (e) => /^\w*$/.test(e), st = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), x = (e, s, t) => {
31
+ let u = -1;
32
+ const n = Te(s) ? [s] : st(s), a = n.length, y = a - 1;
33
+ for (; ++u < a; ) {
34
+ const h = n[u];
35
+ let D = t;
36
+ if (u !== y) {
37
+ const S = e[h];
38
+ D = T(S) || Array.isArray(S) ? S : isNaN(+n[u + 1]) ? {} : [];
39
+ }
40
+ if (h === "__proto__")
41
+ return;
42
+ e[h] = D, e = e[h];
43
+ }
44
+ return e;
45
+ };
46
+ const ve = {
47
+ BLUR: "blur",
48
+ FOCUS_OUT: "focusout",
49
+ CHANGE: "change"
50
+ }, W = {
51
+ onBlur: "onBlur",
52
+ onChange: "onChange",
53
+ onSubmit: "onSubmit",
54
+ onTouched: "onTouched",
55
+ all: "all"
56
+ }, z = {
57
+ max: "max",
58
+ min: "min",
59
+ maxLength: "maxLength",
60
+ minLength: "minLength",
61
+ pattern: "pattern",
62
+ required: "required",
63
+ validate: "validate"
64
+ }, mt = m.createContext(null), Le = () => m.useContext(mt);
65
+ var it = (e, s, t, u = !0) => {
66
+ const n = {
67
+ defaultValues: s._defaultValues
68
+ };
69
+ for (const a in e)
70
+ Object.defineProperty(n, a, {
71
+ get: () => {
72
+ const y = a;
73
+ return s._proxyFormState[y] !== W.all && (s._proxyFormState[y] = !u || W.all), t && (t[y] = !0), e[y];
74
+ }
75
+ });
76
+ return n;
77
+ }, M = (e) => T(e) && !Object.keys(e).length, ut = (e, s, t, u) => {
78
+ t(e);
79
+ const { name: n, ...a } = e;
80
+ return M(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === (!u || W.all));
81
+ }, oe = (e) => Array.isArray(e) ? e : [e], lt = (e, s, t) => !e || !s || e === s || oe(e).some((u) => u && (t ? u === s : u.startsWith(s) || s.startsWith(u)));
82
+ function Ue(e) {
83
+ const s = m.useRef(e);
84
+ s.current = e, m.useEffect(() => {
85
+ const t = !e.disabled && s.current.subject && s.current.subject.subscribe({
86
+ next: s.current.next
87
+ });
88
+ return () => {
89
+ t && t.unsubscribe();
90
+ };
91
+ }, [e.disabled]);
92
+ }
93
+ function Dt(e) {
94
+ const s = Le(), { control: t = s.control, disabled: u, name: n, exact: a } = e || {}, [y, h] = m.useState(t._formState), D = m.useRef(!0), S = m.useRef({
95
+ isDirty: !1,
96
+ isLoading: !1,
97
+ dirtyFields: !1,
98
+ touchedFields: !1,
99
+ validatingFields: !1,
100
+ isValidating: !1,
101
+ isValid: !1,
102
+ errors: !1
103
+ }), _ = m.useRef(n);
104
+ return _.current = n, Ue({
105
+ disabled: u,
106
+ next: (v) => D.current && lt(_.current, v.name, a) && ut(v, S.current, t._updateFormState) && h({
107
+ ...t._formState,
108
+ ...v
109
+ }),
110
+ subject: t._subjects.state
111
+ }), m.useEffect(() => (D.current = !0, S.current.isValid && t._updateValid(!0), () => {
112
+ D.current = !1;
113
+ }), [t]), it(y, t, S.current, !1);
114
+ }
115
+ var $ = (e) => typeof e == "string", at = (e, s, t, u, n) => $(e) ? (u && s.watch.add(e), f(t, e, n)) : Array.isArray(e) ? e.map((a) => (u && s.watch.add(a), f(t, a))) : (u && (s.watchAll = !0), t);
116
+ function wt(e) {
117
+ const s = Le(), { control: t = s.control, name: u, defaultValue: n, disabled: a, exact: y } = e || {}, h = m.useRef(u);
118
+ h.current = u, Ue({
119
+ disabled: a,
120
+ subject: t._subjects.values,
121
+ next: (_) => {
122
+ lt(h.current, _.name, y) && S(p(at(h.current, t._names, _.values || t._formValues, !1, n)));
123
+ }
124
+ });
125
+ const [D, S] = m.useState(t._getWatch(u, n));
126
+ return m.useEffect(() => t._removeUnmounted()), D;
127
+ }
128
+ function Et(e) {
129
+ const s = Le(), { name: t, disabled: u, control: n = s.control, shouldUnregister: a } = e, y = rt(n._names.array, t), h = wt({
130
+ control: n,
131
+ name: t,
132
+ defaultValue: f(n._formValues, t, f(n._defaultValues, t, e.defaultValue)),
133
+ exact: !0
134
+ }), D = Dt({
135
+ control: n,
136
+ name: t,
137
+ exact: !0
138
+ }), S = m.useRef(n.register(t, {
139
+ ...e.rules,
140
+ value: h,
141
+ ...j(e.disabled) ? { disabled: e.disabled } : {}
142
+ }));
143
+ return m.useEffect(() => {
144
+ const _ = n._options.shouldUnregister || a, v = (N, H) => {
145
+ const L = f(n._fields, N);
146
+ L && L._f && (L._f.mount = H);
147
+ };
148
+ if (v(t, !0), _) {
149
+ const N = p(f(n._options.defaultValues, t));
150
+ x(n._defaultValues, t, N), w(f(n._formValues, t)) && x(n._formValues, t, N);
151
+ }
152
+ return () => {
153
+ (y ? _ && !n._state.action : _) ? n.unregister(t) : v(t, !1);
154
+ };
155
+ }, [t, n, y, a]), m.useEffect(() => {
156
+ f(n._fields, t) && n._updateDisabledField({
157
+ disabled: u,
158
+ fields: n._fields,
159
+ name: t,
160
+ value: f(n._fields, t)._f.value
161
+ });
162
+ }, [u, t, n]), {
163
+ field: {
164
+ name: t,
165
+ value: h,
166
+ ...j(u) || D.disabled ? { disabled: D.disabled || u } : {},
167
+ onChange: m.useCallback((_) => S.current.onChange({
168
+ target: {
169
+ value: tt(_),
170
+ name: t
171
+ },
172
+ type: ve.CHANGE
173
+ }), [t]),
174
+ onBlur: m.useCallback(() => S.current.onBlur({
175
+ target: {
176
+ value: f(n._formValues, t),
177
+ name: t
178
+ },
179
+ type: ve.BLUR
180
+ }), [t, n]),
181
+ ref: m.useCallback((_) => {
182
+ const v = f(n._fields, t);
183
+ v && _ && (v._f.ref = {
184
+ focus: () => _.focus(),
185
+ select: () => _.select(),
186
+ setCustomValidity: (N) => _.setCustomValidity(N),
187
+ reportValidity: () => _.reportValidity()
188
+ });
189
+ }, [n._fields, t])
190
+ },
191
+ formState: D,
192
+ fieldState: Object.defineProperties({}, {
193
+ invalid: {
194
+ enumerable: !0,
195
+ get: () => !!f(D.errors, t)
196
+ },
197
+ isDirty: {
198
+ enumerable: !0,
199
+ get: () => !!f(D.dirtyFields, t)
200
+ },
201
+ isTouched: {
202
+ enumerable: !0,
203
+ get: () => !!f(D.touchedFields, t)
204
+ },
205
+ isValidating: {
206
+ enumerable: !0,
207
+ get: () => !!f(D.validatingFields, t)
208
+ },
209
+ error: {
210
+ enumerable: !0,
211
+ get: () => f(D.errors, t)
212
+ }
213
+ })
214
+ };
215
+ }
216
+ const Wt = (e) => e.render(Et(e));
217
+ var St = (e, s, t, u, n) => s ? {
218
+ ...t[e],
219
+ types: {
220
+ ...t[e] && t[e].types ? t[e].types : {},
221
+ [u]: n || !0
222
+ }
223
+ } : {}, Ke = (e) => ({
224
+ isOnSubmit: !e || e === W.onSubmit,
225
+ isOnBlur: e === W.onBlur,
226
+ isOnChange: e === W.onChange,
227
+ isOnAll: e === W.all,
228
+ isOnTouch: e === W.onTouched
229
+ }), Ge = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((u) => e.startsWith(u) && /^\.\w+/.test(e.slice(u.length))));
230
+ const fe = (e, s, t, u) => {
231
+ for (const n of t || Object.keys(e)) {
232
+ const a = f(e, n);
233
+ if (a) {
234
+ const { _f: y, ...h } = a;
235
+ if (y) {
236
+ if (y.refs && y.refs[0] && s(y.refs[0], n) && !u)
237
+ break;
238
+ if (y.ref && s(y.ref, y.name) && !u)
239
+ break;
240
+ fe(h, s);
241
+ } else
242
+ T(h) && fe(h, s);
243
+ }
244
+ }
245
+ };
246
+ var kt = (e, s, t) => {
247
+ const u = oe(f(e, t));
248
+ return x(u, "root", s[t]), x(e, t, u), e;
249
+ }, Oe = (e) => e.type === "file", X = (e) => typeof e == "function", _e = (e) => {
250
+ if (!Re)
251
+ return !1;
252
+ const s = e ? e.ownerDocument : 0;
253
+ return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
254
+ }, he = (e) => $(e), pe = (e) => e.type === "radio", be = (e) => e instanceof RegExp;
255
+ const ze = {
256
+ value: !1,
257
+ isValid: !1
258
+ }, Je = { value: !0, isValid: !0 };
259
+ var nt = (e) => {
260
+ if (Array.isArray(e)) {
261
+ if (e.length > 1) {
262
+ const s = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
263
+ return { value: s, isValid: !!s.length };
264
+ }
265
+ return e[0].checked && !e[0].disabled ? (
266
+ // @ts-expect-error expected to work in the browser
267
+ e[0].attributes && !w(e[0].attributes.value) ? w(e[0].value) || e[0].value === "" ? Je : { value: e[0].value, isValid: !0 } : Je
268
+ ) : ze;
269
+ }
270
+ return ze;
271
+ };
272
+ const Qe = {
273
+ isValid: !1,
274
+ value: null
275
+ };
276
+ var ot = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
277
+ isValid: !0,
278
+ value: t.value
279
+ } : s, Qe) : Qe;
280
+ function Xe(e, s, t = "validate") {
281
+ if (he(e) || Array.isArray(e) && e.every(he) || j(e) && !e)
282
+ return {
283
+ type: t,
284
+ message: he(e) ? e : "",
285
+ ref: s
286
+ };
287
+ }
288
+ var se = (e) => T(e) && !be(e) ? e : {
289
+ value: e,
290
+ message: ""
291
+ }, Ye = async (e, s, t, u, n) => {
292
+ const { ref: a, refs: y, required: h, maxLength: D, minLength: S, min: _, max: v, pattern: N, validate: H, name: L, valueAsNumber: xe, mount: J, disabled: Q } = e._f, V = f(s, L);
293
+ if (!J || Q)
294
+ return {};
295
+ const K = y ? y[0] : a, G = (b) => {
296
+ u && K.reportValidity && (K.setCustomValidity(j(b) ? "" : b || ""), K.reportValidity());
297
+ }, k = {}, ee = pe(a), de = ce(a), Y = ee || de, te = (xe || Oe(a)) && w(a.value) && w(V) || _e(a) && a.value === "" || V === "" || Array.isArray(V) && !V.length, P = St.bind(null, L, t, k), ye = (b, F, C, U = z.maxLength, q = z.minLength) => {
298
+ const I = b ? F : C;
299
+ k[L] = {
300
+ type: b ? U : q,
301
+ message: I,
302
+ ref: a,
303
+ ...P(b ? U : q, I)
304
+ };
305
+ };
306
+ if (n ? !Array.isArray(V) || !V.length : h && (!Y && (te || O(V)) || j(V) && !V || de && !nt(y).isValid || ee && !ot(y).isValid)) {
307
+ const { value: b, message: F } = he(h) ? { value: !!h, message: h } : se(h);
308
+ if (b && (k[L] = {
309
+ type: z.required,
310
+ message: F,
311
+ ref: K,
312
+ ...P(z.required, F)
313
+ }, !t))
314
+ return G(F), k;
315
+ }
316
+ if (!te && (!O(_) || !O(v))) {
317
+ let b, F;
318
+ const C = se(v), U = se(_);
319
+ if (!O(V) && !isNaN(V)) {
320
+ const q = a.valueAsNumber || V && +V;
321
+ O(C.value) || (b = q > C.value), O(U.value) || (F = q < U.value);
322
+ } else {
323
+ const q = a.valueAsDate || new Date(V), I = (ae) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ae), ue = a.type == "time", le = a.type == "week";
324
+ $(C.value) && V && (b = ue ? I(V) > I(C.value) : le ? V > C.value : q > new Date(C.value)), $(U.value) && V && (F = ue ? I(V) < I(U.value) : le ? V < U.value : q < new Date(U.value));
325
+ }
326
+ if ((b || F) && (ye(!!b, C.message, U.message, z.max, z.min), !t))
327
+ return G(k[L].message), k;
328
+ }
329
+ if ((D || S) && !te && ($(V) || n && Array.isArray(V))) {
330
+ const b = se(D), F = se(S), C = !O(b.value) && V.length > +b.value, U = !O(F.value) && V.length < +F.value;
331
+ if ((C || U) && (ye(C, b.message, F.message), !t))
332
+ return G(k[L].message), k;
333
+ }
334
+ if (N && !te && $(V)) {
335
+ const { value: b, message: F } = se(N);
336
+ if (be(b) && !V.match(b) && (k[L] = {
337
+ type: z.pattern,
338
+ message: F,
339
+ ref: a,
340
+ ...P(z.pattern, F)
341
+ }, !t))
342
+ return G(F), k;
343
+ }
344
+ if (H) {
345
+ if (X(H)) {
346
+ const b = await H(V, s), F = Xe(b, K);
347
+ if (F && (k[L] = {
348
+ ...F,
349
+ ...P(z.validate, F.message)
350
+ }, !t))
351
+ return G(F.message), k;
352
+ } else if (T(H)) {
353
+ let b = {};
354
+ for (const F in H) {
355
+ if (!M(b) && !t)
356
+ break;
357
+ const C = Xe(await H[F](V, s), K, F);
358
+ C && (b = {
359
+ ...C,
360
+ ...P(F, C.message)
361
+ }, G(C.message), t && (k[L] = b));
362
+ }
363
+ if (!M(b) && (k[L] = {
364
+ ref: K,
365
+ ...b
366
+ }, !t))
367
+ return k;
368
+ }
369
+ }
370
+ return G(!0), k;
371
+ };
372
+ function Ct(e, s) {
373
+ const t = s.slice(0, -1).length;
374
+ let u = 0;
375
+ for (; u < t; )
376
+ e = w(e) ? u++ : e[s[u++]];
377
+ return e;
378
+ }
379
+ function Rt(e) {
380
+ for (const s in e)
381
+ if (e.hasOwnProperty(s) && !w(e[s]))
382
+ return !1;
383
+ return !0;
384
+ }
385
+ function R(e, s) {
386
+ const t = Array.isArray(s) ? s : Te(s) ? [s] : st(s), u = t.length === 1 ? e : Ct(e, t), n = t.length - 1, a = t[n];
387
+ return u && delete u[a], n !== 0 && (T(u) && M(u) || Array.isArray(u) && Rt(u)) && R(e, t.slice(0, -1)), e;
388
+ }
389
+ var Se = () => {
390
+ let e = [];
391
+ return {
392
+ get observers() {
393
+ return e;
394
+ },
395
+ next: (n) => {
396
+ for (const a of e)
397
+ a.next && a.next(n);
398
+ },
399
+ subscribe: (n) => (e.push(n), {
400
+ unsubscribe: () => {
401
+ e = e.filter((a) => a !== n);
402
+ }
403
+ }),
404
+ unsubscribe: () => {
405
+ e = [];
406
+ }
407
+ };
408
+ }, Ve = (e) => O(e) || !et(e);
409
+ function Z(e, s) {
410
+ if (Ve(e) || Ve(s))
411
+ return e === s;
412
+ if (ie(e) && ie(s))
413
+ return e.getTime() === s.getTime();
414
+ const t = Object.keys(e), u = Object.keys(s);
415
+ if (t.length !== u.length)
416
+ return !1;
417
+ for (const n of t) {
418
+ const a = e[n];
419
+ if (!u.includes(n))
420
+ return !1;
421
+ if (n !== "ref") {
422
+ const y = s[n];
423
+ if (ie(a) && ie(y) || T(a) && T(y) || Array.isArray(a) && Array.isArray(y) ? !Z(a, y) : a !== y)
424
+ return !1;
425
+ }
426
+ }
427
+ return !0;
428
+ }
429
+ var ft = (e) => e.type === "select-multiple", Tt = (e) => pe(e) || ce(e), ke = (e) => _e(e) && e.isConnected, ct = (e) => {
430
+ for (const s in e)
431
+ if (X(e[s]))
432
+ return !0;
433
+ return !1;
434
+ };
435
+ function Fe(e, s = {}) {
436
+ const t = Array.isArray(e);
437
+ if (T(e) || t)
438
+ for (const u in e)
439
+ Array.isArray(e[u]) || T(e[u]) && !ct(e[u]) ? (s[u] = Array.isArray(e[u]) ? [] : {}, Fe(e[u], s[u])) : O(e[u]) || (s[u] = !0);
440
+ return s;
441
+ }
442
+ function dt(e, s, t) {
443
+ const u = Array.isArray(e);
444
+ if (T(e) || u)
445
+ for (const n in e)
446
+ Array.isArray(e[n]) || T(e[n]) && !ct(e[n]) ? w(s) || Ve(t[n]) ? t[n] = Array.isArray(e[n]) ? Fe(e[n], []) : { ...Fe(e[n]) } : dt(e[n], O(s) ? {} : s[n], t[n]) : t[n] = !Z(e[n], s[n]);
447
+ return t;
448
+ }
449
+ var ge = (e, s) => dt(e, s, Fe(s)), yt = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: u }) => w(e) ? e : s ? e === "" ? NaN : e && +e : t && $(e) ? new Date(e) : u ? u(e) : e;
450
+ function Ce(e) {
451
+ const s = e.ref;
452
+ if (!(e.refs ? e.refs.every((t) => t.disabled) : s.disabled))
453
+ return Oe(s) ? s.files : pe(s) ? ot(e.refs).value : ft(s) ? [...s.selectedOptions].map(({ value: t }) => t) : ce(s) ? nt(e.refs).value : yt(w(s.value) ? e.ref.value : s.value, e);
454
+ }
455
+ var Lt = (e, s, t, u) => {
456
+ const n = {};
457
+ for (const a of e) {
458
+ const y = f(s, a);
459
+ y && x(n, a, y._f);
460
+ }
461
+ return {
462
+ criteriaMode: t,
463
+ names: [...e],
464
+ fields: n,
465
+ shouldUseNativeValidation: u
466
+ };
467
+ }, ne = (e) => w(e) ? e : be(e) ? e.source : T(e) ? be(e.value) ? e.value.source : e.value : e, Ut = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
468
+ function Ze(e, s, t) {
469
+ const u = f(e, t);
470
+ if (u || Te(t))
471
+ return {
472
+ error: u,
473
+ name: t
474
+ };
475
+ const n = t.split(".");
476
+ for (; n.length; ) {
477
+ const a = n.join("."), y = f(s, a), h = f(e, a);
478
+ if (y && !Array.isArray(y) && t !== a)
479
+ return { name: t };
480
+ if (h && h.type)
481
+ return {
482
+ name: a,
483
+ error: h
484
+ };
485
+ n.pop();
486
+ }
487
+ return {
488
+ name: t
489
+ };
490
+ }
491
+ var Ot = (e, s, t, u, n) => n.isOnAll ? !1 : !t && n.isOnTouch ? !(s || e) : (t ? u.isOnBlur : n.isOnBlur) ? !e : (t ? u.isOnChange : n.isOnChange) ? e : !0, pt = (e, s) => !Ae(f(e, s)).length && R(e, s);
492
+ const Mt = {
493
+ mode: W.onSubmit,
494
+ reValidateMode: W.onChange,
495
+ shouldFocusError: !0
496
+ };
497
+ function Bt(e = {}) {
498
+ let s = {
499
+ ...Mt,
500
+ ...e
501
+ }, t = {
502
+ submitCount: 0,
503
+ isDirty: !1,
504
+ isLoading: X(s.defaultValues),
505
+ isValidating: !1,
506
+ isSubmitted: !1,
507
+ isSubmitting: !1,
508
+ isSubmitSuccessful: !1,
509
+ isValid: !1,
510
+ touchedFields: {},
511
+ dirtyFields: {},
512
+ validatingFields: {},
513
+ errors: s.errors || {},
514
+ disabled: s.disabled || !1
515
+ }, u = {}, n = T(s.defaultValues) || T(s.values) ? p(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : p(n), y = {
516
+ action: !1,
517
+ mount: !1,
518
+ watch: !1
519
+ }, h = {
520
+ mount: /* @__PURE__ */ new Set(),
521
+ unMount: /* @__PURE__ */ new Set(),
522
+ array: /* @__PURE__ */ new Set(),
523
+ watch: /* @__PURE__ */ new Set()
524
+ }, D, S = 0;
525
+ const _ = {
526
+ isDirty: !1,
527
+ dirtyFields: !1,
528
+ validatingFields: !1,
529
+ touchedFields: !1,
530
+ isValidating: !1,
531
+ isValid: !1,
532
+ errors: !1
533
+ }, v = {
534
+ values: Se(),
535
+ array: Se(),
536
+ state: Se()
537
+ }, N = Ke(s.mode), H = Ke(s.reValidateMode), L = s.criteriaMode === W.all, xe = (r) => (i) => {
538
+ clearTimeout(S), S = setTimeout(r, i);
539
+ }, J = async (r) => {
540
+ if (_.isValid || r) {
541
+ const i = s.resolver ? M((await Y()).errors) : await P(u, !0);
542
+ i !== t.isValid && v.state.next({
543
+ isValid: i
544
+ });
545
+ }
546
+ }, Q = (r, i) => {
547
+ (_.isValidating || _.validatingFields) && ((r || Array.from(h.mount)).forEach((l) => {
548
+ l && (i ? x(t.validatingFields, l, i) : R(t.validatingFields, l));
549
+ }), v.state.next({
550
+ validatingFields: t.validatingFields,
551
+ isValidating: !M(t.validatingFields)
552
+ }));
553
+ }, V = (r, i = [], l, d, c = !0, o = !0) => {
554
+ if (d && l) {
555
+ if (y.action = !0, o && Array.isArray(f(u, r))) {
556
+ const g = l(f(u, r), d.argA, d.argB);
557
+ c && x(u, r, g);
558
+ }
559
+ if (o && Array.isArray(f(t.errors, r))) {
560
+ const g = l(f(t.errors, r), d.argA, d.argB);
561
+ c && x(t.errors, r, g), pt(t.errors, r);
562
+ }
563
+ if (_.touchedFields && o && Array.isArray(f(t.touchedFields, r))) {
564
+ const g = l(f(t.touchedFields, r), d.argA, d.argB);
565
+ c && x(t.touchedFields, r, g);
566
+ }
567
+ _.dirtyFields && (t.dirtyFields = ge(n, a)), v.state.next({
568
+ name: r,
569
+ isDirty: b(r, i),
570
+ dirtyFields: t.dirtyFields,
571
+ errors: t.errors,
572
+ isValid: t.isValid
573
+ });
574
+ } else
575
+ x(a, r, i);
576
+ }, K = (r, i) => {
577
+ x(t.errors, r, i), v.state.next({
578
+ errors: t.errors
579
+ });
580
+ }, G = (r) => {
581
+ t.errors = r, v.state.next({
582
+ errors: t.errors,
583
+ isValid: !1
584
+ });
585
+ }, k = (r, i, l, d) => {
586
+ const c = f(u, r);
587
+ if (c) {
588
+ const o = f(a, r, w(l) ? f(n, r) : l);
589
+ w(o) || d && d.defaultChecked || i ? x(a, r, i ? o : Ce(c._f)) : U(r, o), y.mount && J();
590
+ }
591
+ }, ee = (r, i, l, d, c) => {
592
+ let o = !1, g = !1;
593
+ const A = {
594
+ name: r
595
+ }, E = !!(f(u, r) && f(u, r)._f && f(u, r)._f.disabled);
596
+ if (!l || d) {
597
+ _.isDirty && (g = t.isDirty, t.isDirty = A.isDirty = b(), o = g !== A.isDirty);
598
+ const B = E || Z(f(n, r), i);
599
+ g = !!(!E && f(t.dirtyFields, r)), B || E ? R(t.dirtyFields, r) : x(t.dirtyFields, r, !0), A.dirtyFields = t.dirtyFields, o = o || _.dirtyFields && g !== !B;
600
+ }
601
+ if (l) {
602
+ const B = f(t.touchedFields, r);
603
+ B || (x(t.touchedFields, r, l), A.touchedFields = t.touchedFields, o = o || _.touchedFields && B !== l);
604
+ }
605
+ return o && c && v.state.next(A), o ? A : {};
606
+ }, de = (r, i, l, d) => {
607
+ const c = f(t.errors, r), o = _.isValid && j(i) && t.isValid !== i;
608
+ if (e.delayError && l ? (D = xe(() => K(r, l)), D(e.delayError)) : (clearTimeout(S), D = null, l ? x(t.errors, r, l) : R(t.errors, r)), (l ? !Z(c, l) : c) || !M(d) || o) {
609
+ const g = {
610
+ ...d,
611
+ ...o && j(i) ? { isValid: i } : {},
612
+ errors: t.errors,
613
+ name: r
614
+ };
615
+ t = {
616
+ ...t,
617
+ ...g
618
+ }, v.state.next(g);
619
+ }
620
+ }, Y = async (r) => {
621
+ Q(r, !0);
622
+ const i = await s.resolver(a, s.context, Lt(r || h.mount, u, s.criteriaMode, s.shouldUseNativeValidation));
623
+ return Q(r), i;
624
+ }, te = async (r) => {
625
+ const { errors: i } = await Y(r);
626
+ if (r)
627
+ for (const l of r) {
628
+ const d = f(i, l);
629
+ d ? x(t.errors, l, d) : R(t.errors, l);
630
+ }
631
+ else
632
+ t.errors = i;
633
+ return i;
634
+ }, P = async (r, i, l = {
635
+ valid: !0
636
+ }) => {
637
+ for (const d in r) {
638
+ const c = r[d];
639
+ if (c) {
640
+ const { _f: o, ...g } = c;
641
+ if (o) {
642
+ const A = h.array.has(o.name);
643
+ Q([d], !0);
644
+ const E = await Ye(c, a, L, s.shouldUseNativeValidation && !i, A);
645
+ if (Q([d]), E[o.name] && (l.valid = !1, i))
646
+ break;
647
+ !i && (f(E, o.name) ? A ? kt(t.errors, E, o.name) : x(t.errors, o.name, E[o.name]) : R(t.errors, o.name));
648
+ }
649
+ !M(g) && await P(g, i, l);
650
+ }
651
+ }
652
+ return l.valid;
653
+ }, ye = () => {
654
+ for (const r of h.unMount) {
655
+ const i = f(u, r);
656
+ i && (i._f.refs ? i._f.refs.every((l) => !ke(l)) : !ke(i._f.ref)) && me(r);
657
+ }
658
+ h.unMount = /* @__PURE__ */ new Set();
659
+ }, b = (r, i) => (r && i && x(a, r, i), !Z(Me(), n)), F = (r, i, l) => at(r, h, {
660
+ ...y.mount ? a : w(i) ? n : $(r) ? { [r]: i } : i
661
+ }, l, i), C = (r) => Ae(f(y.mount ? a : n, r, e.shouldUnregister ? f(n, r, []) : [])), U = (r, i, l = {}) => {
662
+ const d = f(u, r);
663
+ let c = i;
664
+ if (d) {
665
+ const o = d._f;
666
+ o && (!o.disabled && x(a, r, yt(i, o)), c = _e(o.ref) && O(i) ? "" : i, ft(o.ref) ? [...o.ref.options].forEach((g) => g.selected = c.includes(g.value)) : o.refs ? ce(o.ref) ? o.refs.length > 1 ? o.refs.forEach((g) => (!g.defaultChecked || !g.disabled) && (g.checked = Array.isArray(c) ? !!c.find((A) => A === g.value) : c === g.value)) : o.refs[0] && (o.refs[0].checked = !!c) : o.refs.forEach((g) => g.checked = g.value === c) : Oe(o.ref) ? o.ref.value = "" : (o.ref.value = c, o.ref.type || v.values.next({
667
+ name: r,
668
+ values: { ...a }
669
+ })));
670
+ }
671
+ (l.shouldDirty || l.shouldTouch) && ee(r, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ae(r);
672
+ }, q = (r, i, l) => {
673
+ for (const d in i) {
674
+ const c = i[d], o = `${r}.${d}`, g = f(u, o);
675
+ (h.array.has(r) || !Ve(c) || g && !g._f) && !ie(c) ? q(o, c, l) : U(o, c, l);
676
+ }
677
+ }, I = (r, i, l = {}) => {
678
+ const d = f(u, r), c = h.array.has(r), o = p(i);
679
+ x(a, r, o), c ? (v.array.next({
680
+ name: r,
681
+ values: { ...a }
682
+ }), (_.isDirty || _.dirtyFields) && l.shouldDirty && v.state.next({
683
+ name: r,
684
+ dirtyFields: ge(n, a),
685
+ isDirty: b(r, o)
686
+ })) : d && !d._f && !O(o) ? q(r, o, l) : U(r, o, l), Ge(r, h) && v.state.next({ ...t }), v.values.next({
687
+ name: y.mount ? r : void 0,
688
+ values: { ...a }
689
+ });
690
+ }, ue = async (r) => {
691
+ y.mount = !0;
692
+ const i = r.target;
693
+ let l = i.name, d = !0;
694
+ const c = f(u, l), o = () => i.type ? Ce(c._f) : tt(r), g = (A) => {
695
+ d = Number.isNaN(A) || A === f(a, l, A);
696
+ };
697
+ if (c) {
698
+ let A, E;
699
+ const B = o(), re = r.type === ve.BLUR || r.type === ve.FOCUS_OUT, bt = !Ut(c._f) && !s.resolver && !f(t.errors, l) && !c._f.deps || Ot(re, f(t.touchedFields, l), t.isSubmitted, H, N), we = Ge(l, h, re);
700
+ x(a, l, B), re ? (c._f.onBlur && c._f.onBlur(r), D && D(0)) : c._f.onChange && c._f.onChange(r);
701
+ const Ee = ee(l, B, re, !1), Vt = !M(Ee) || we;
702
+ if (!re && v.values.next({
703
+ name: l,
704
+ type: r.type,
705
+ values: { ...a }
706
+ }), bt)
707
+ return _.isValid && J(), Vt && v.state.next({ name: l, ...we ? {} : Ee });
708
+ if (!re && we && v.state.next({ ...t }), s.resolver) {
709
+ const { errors: je } = await Y([l]);
710
+ if (g(B), d) {
711
+ const Ft = Ze(t.errors, u, l), $e = Ze(je, u, Ft.name || l);
712
+ A = $e.error, l = $e.name, E = M(je);
713
+ }
714
+ } else
715
+ Q([l], !0), A = (await Ye(c, a, L, s.shouldUseNativeValidation))[l], Q([l]), g(B), d && (A ? E = !1 : _.isValid && (E = await P(u, !0)));
716
+ d && (c._f.deps && ae(c._f.deps), de(l, E, A, Ee));
717
+ }
718
+ }, le = (r, i) => {
719
+ if (f(t.errors, i) && r.focus)
720
+ return r.focus(), 1;
721
+ }, ae = async (r, i = {}) => {
722
+ let l, d;
723
+ const c = oe(r);
724
+ if (s.resolver) {
725
+ const o = await te(w(r) ? r : c);
726
+ l = M(o), d = r ? !c.some((g) => f(o, g)) : l;
727
+ } else
728
+ r ? (d = (await Promise.all(c.map(async (o) => {
729
+ const g = f(u, o);
730
+ return await P(g && g._f ? { [o]: g } : g);
731
+ }))).every(Boolean), !(!d && !t.isValid) && J()) : d = l = await P(u);
732
+ return v.state.next({
733
+ ...!$(r) || _.isValid && l !== t.isValid ? {} : { name: r },
734
+ ...s.resolver || !r ? { isValid: l } : {},
735
+ errors: t.errors
736
+ }), i.shouldFocus && !d && fe(u, le, r ? c : h.mount), d;
737
+ }, Me = (r) => {
738
+ const i = {
739
+ ...y.mount ? a : n
740
+ };
741
+ return w(r) ? i : $(r) ? f(i, r) : r.map((l) => f(i, l));
742
+ }, Be = (r, i) => ({
743
+ invalid: !!f((i || t).errors, r),
744
+ isDirty: !!f((i || t).dirtyFields, r),
745
+ error: f((i || t).errors, r),
746
+ isValidating: !!f(t.validatingFields, r),
747
+ isTouched: !!f((i || t).touchedFields, r)
748
+ }), gt = (r) => {
749
+ r && oe(r).forEach((i) => R(t.errors, i)), v.state.next({
750
+ errors: r ? t.errors : {}
751
+ });
752
+ }, Pe = (r, i, l) => {
753
+ const d = (f(u, r, { _f: {} })._f || {}).ref, c = f(t.errors, r) || {}, { ref: o, message: g, type: A, ...E } = c;
754
+ x(t.errors, r, {
755
+ ...E,
756
+ ...i,
757
+ ref: d
758
+ }), v.state.next({
759
+ name: r,
760
+ errors: t.errors,
761
+ isValid: !1
762
+ }), l && l.shouldFocus && d && d.focus && d.focus();
763
+ }, ht = (r, i) => X(r) ? v.values.subscribe({
764
+ next: (l) => r(F(void 0, i), l)
765
+ }) : F(r, i, !0), me = (r, i = {}) => {
766
+ for (const l of r ? oe(r) : h.mount)
767
+ h.mount.delete(l), h.array.delete(l), i.keepValue || (R(u, l), R(a, l)), !i.keepError && R(t.errors, l), !i.keepDirty && R(t.dirtyFields, l), !i.keepTouched && R(t.touchedFields, l), !i.keepIsValidating && R(t.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && R(n, l);
768
+ v.values.next({
769
+ values: { ...a }
770
+ }), v.state.next({
771
+ ...t,
772
+ ...i.keepDirty ? { isDirty: b() } : {}
773
+ }), !i.keepIsValid && J();
774
+ }, Ie = ({ disabled: r, name: i, field: l, fields: d, value: c }) => {
775
+ if (j(r) && y.mount || r) {
776
+ const o = r ? void 0 : w(c) ? Ce(l ? l._f : f(d, i)._f) : c;
777
+ x(a, i, o), ee(i, o, !1, !1, !0);
778
+ }
779
+ }, De = (r, i = {}) => {
780
+ let l = f(u, r);
781
+ const d = j(i.disabled);
782
+ return x(u, r, {
783
+ ...l || {},
784
+ _f: {
785
+ ...l && l._f ? l._f : { ref: { name: r } },
786
+ name: r,
787
+ mount: !0,
788
+ ...i
789
+ }
790
+ }), h.mount.add(r), l ? Ie({
791
+ field: l,
792
+ disabled: i.disabled,
793
+ name: r,
794
+ value: i.value
795
+ }) : k(r, !0, i.value), {
796
+ ...d ? { disabled: i.disabled } : {},
797
+ ...s.progressive ? {
798
+ required: !!i.required,
799
+ min: ne(i.min),
800
+ max: ne(i.max),
801
+ minLength: ne(i.minLength),
802
+ maxLength: ne(i.maxLength),
803
+ pattern: ne(i.pattern)
804
+ } : {},
805
+ name: r,
806
+ onChange: ue,
807
+ onBlur: ue,
808
+ ref: (c) => {
809
+ if (c) {
810
+ De(r, i), l = f(u, r);
811
+ const o = w(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, g = Tt(o), A = l._f.refs || [];
812
+ if (g ? A.find((E) => E === o) : o === l._f.ref)
813
+ return;
814
+ x(u, r, {
815
+ _f: {
816
+ ...l._f,
817
+ ...g ? {
818
+ refs: [
819
+ ...A.filter(ke),
820
+ o,
821
+ ...Array.isArray(f(n, r)) ? [{}] : []
822
+ ],
823
+ ref: { type: o.type, name: r }
824
+ } : { ref: o }
825
+ }
826
+ }), k(r, !1, void 0, o);
827
+ } else
828
+ l = f(u, r, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(rt(h.array, r) && y.action) && h.unMount.add(r);
829
+ }
830
+ };
831
+ }, Ne = () => s.shouldFocusError && fe(u, le, h.mount), vt = (r) => {
832
+ j(r) && (v.state.next({ disabled: r }), fe(u, (i, l) => {
833
+ const d = f(u, l);
834
+ d && (i.disabled = d._f.disabled || r, Array.isArray(d._f.refs) && d._f.refs.forEach((c) => {
835
+ c.disabled = d._f.disabled || r;
836
+ }));
837
+ }, 0, !1));
838
+ }, qe = (r, i) => async (l) => {
839
+ let d;
840
+ l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
841
+ let c = p(a);
842
+ if (v.state.next({
843
+ isSubmitting: !0
844
+ }), s.resolver) {
845
+ const { errors: o, values: g } = await Y();
846
+ t.errors = o, c = g;
847
+ } else
848
+ await P(u);
849
+ if (R(t.errors, "root"), M(t.errors)) {
850
+ v.state.next({
851
+ errors: {}
852
+ });
853
+ try {
854
+ await r(c, l);
855
+ } catch (o) {
856
+ d = o;
857
+ }
858
+ } else
859
+ i && await i({ ...t.errors }, l), Ne(), setTimeout(Ne);
860
+ if (v.state.next({
861
+ isSubmitted: !0,
862
+ isSubmitting: !1,
863
+ isSubmitSuccessful: M(t.errors) && !d,
864
+ submitCount: t.submitCount + 1,
865
+ errors: t.errors
866
+ }), d)
867
+ throw d;
868
+ }, _t = (r, i = {}) => {
869
+ f(u, r) && (w(i.defaultValue) ? I(r, p(f(n, r))) : (I(r, i.defaultValue), x(n, r, p(i.defaultValue))), i.keepTouched || R(t.touchedFields, r), i.keepDirty || (R(t.dirtyFields, r), t.isDirty = i.defaultValue ? b(r, p(f(n, r))) : b()), i.keepError || (R(t.errors, r), _.isValid && J()), v.state.next({ ...t }));
870
+ }, We = (r, i = {}) => {
871
+ const l = r ? p(r) : n, d = p(l), c = M(r), o = c ? n : d;
872
+ if (i.keepDefaultValues || (n = l), !i.keepValues) {
873
+ if (i.keepDirtyValues)
874
+ for (const g of h.mount)
875
+ f(t.dirtyFields, g) ? x(o, g, f(a, g)) : I(g, f(o, g));
876
+ else {
877
+ if (Re && w(r))
878
+ for (const g of h.mount) {
879
+ const A = f(u, g);
880
+ if (A && A._f) {
881
+ const E = Array.isArray(A._f.refs) ? A._f.refs[0] : A._f.ref;
882
+ if (_e(E)) {
883
+ const B = E.closest("form");
884
+ if (B) {
885
+ B.reset();
886
+ break;
887
+ }
888
+ }
889
+ }
890
+ }
891
+ u = {};
892
+ }
893
+ a = e.shouldUnregister ? i.keepDefaultValues ? p(n) : {} : p(o), v.array.next({
894
+ values: { ...o }
895
+ }), v.values.next({
896
+ values: { ...o }
897
+ });
898
+ }
899
+ h = {
900
+ mount: i.keepDirtyValues ? h.mount : /* @__PURE__ */ new Set(),
901
+ unMount: /* @__PURE__ */ new Set(),
902
+ array: /* @__PURE__ */ new Set(),
903
+ watch: /* @__PURE__ */ new Set(),
904
+ watchAll: !1,
905
+ focus: ""
906
+ }, y.mount = !_.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, v.state.next({
907
+ submitCount: i.keepSubmitCount ? t.submitCount : 0,
908
+ isDirty: c ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !Z(r, n)),
909
+ isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
910
+ dirtyFields: c ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? ge(n, a) : t.dirtyFields : i.keepDefaultValues && r ? ge(n, r) : i.keepDirty ? t.dirtyFields : {},
911
+ touchedFields: i.keepTouched ? t.touchedFields : {},
912
+ errors: i.keepErrors ? t.errors : {},
913
+ isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
914
+ isSubmitting: !1
915
+ });
916
+ }, He = (r, i) => We(X(r) ? r(a) : r, i);
917
+ return {
918
+ control: {
919
+ register: De,
920
+ unregister: me,
921
+ getFieldState: Be,
922
+ handleSubmit: qe,
923
+ setError: Pe,
924
+ _executeSchema: Y,
925
+ _getWatch: F,
926
+ _getDirty: b,
927
+ _updateValid: J,
928
+ _removeUnmounted: ye,
929
+ _updateFieldArray: V,
930
+ _updateDisabledField: Ie,
931
+ _getFieldArray: C,
932
+ _reset: We,
933
+ _resetDefaultValues: () => X(s.defaultValues) && s.defaultValues().then((r) => {
934
+ He(r, s.resetOptions), v.state.next({
935
+ isLoading: !1
936
+ });
937
+ }),
938
+ _updateFormState: (r) => {
939
+ t = {
940
+ ...t,
941
+ ...r
942
+ };
943
+ },
944
+ _disableForm: vt,
945
+ _subjects: v,
946
+ _proxyFormState: _,
947
+ _setErrors: G,
948
+ get _fields() {
949
+ return u;
950
+ },
951
+ get _formValues() {
952
+ return a;
953
+ },
954
+ get _state() {
955
+ return y;
956
+ },
957
+ set _state(r) {
958
+ y = r;
959
+ },
960
+ get _defaultValues() {
961
+ return n;
962
+ },
963
+ get _names() {
964
+ return h;
965
+ },
966
+ set _names(r) {
967
+ h = r;
968
+ },
969
+ get _formState() {
970
+ return t;
971
+ },
972
+ set _formState(r) {
973
+ t = r;
974
+ },
975
+ get _options() {
976
+ return s;
977
+ },
978
+ set _options(r) {
979
+ s = {
980
+ ...s,
981
+ ...r
982
+ };
983
+ }
984
+ },
985
+ trigger: ae,
986
+ register: De,
987
+ handleSubmit: qe,
988
+ watch: ht,
989
+ setValue: I,
990
+ getValues: Me,
991
+ reset: He,
992
+ resetField: _t,
993
+ clearErrors: gt,
994
+ unregister: me,
995
+ setError: Pe,
996
+ setFocus: (r, i = {}) => {
997
+ const l = f(u, r), d = l && l._f;
998
+ if (d) {
999
+ const c = d.refs ? d.refs[0] : d.ref;
1000
+ c.focus && (c.focus(), i.shouldSelect && c.select());
1001
+ }
1002
+ },
1003
+ getFieldState: Be
1004
+ };
1005
+ }
1006
+ function Ht(e = {}) {
1007
+ const s = m.useRef(), t = m.useRef(), [u, n] = m.useState({
1008
+ isDirty: !1,
1009
+ isValidating: !1,
1010
+ isLoading: X(e.defaultValues),
1011
+ isSubmitted: !1,
1012
+ isSubmitting: !1,
1013
+ isSubmitSuccessful: !1,
1014
+ isValid: !1,
1015
+ submitCount: 0,
1016
+ dirtyFields: {},
1017
+ touchedFields: {},
1018
+ validatingFields: {},
1019
+ errors: e.errors || {},
1020
+ disabled: e.disabled || !1,
1021
+ defaultValues: X(e.defaultValues) ? void 0 : e.defaultValues
1022
+ });
1023
+ s.current || (s.current = {
1024
+ ...Bt(e),
1025
+ formState: u
1026
+ });
1027
+ const a = s.current.control;
1028
+ return a._options = e, Ue({
1029
+ subject: a._subjects.state,
1030
+ next: (y) => {
1031
+ ut(y, a._proxyFormState, a._updateFormState, !0) && n({ ...a._formState });
1032
+ }
1033
+ }), m.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), m.useEffect(() => {
1034
+ if (a._proxyFormState.isDirty) {
1035
+ const y = a._getDirty();
1036
+ y !== u.isDirty && a._subjects.state.next({
1037
+ isDirty: y
1038
+ });
1039
+ }
1040
+ }, [a, u.isDirty]), m.useEffect(() => {
1041
+ e.values && !Z(e.values, t.current) ? (a._reset(e.values, a._options.resetOptions), t.current = e.values, n((y) => ({ ...y }))) : a._resetDefaultValues();
1042
+ }, [e.values, a]), m.useEffect(() => {
1043
+ e.errors && a._setErrors(e.errors);
1044
+ }, [e.errors, a]), m.useEffect(() => {
1045
+ a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
1046
+ }), m.useEffect(() => {
1047
+ e.shouldUnregister && a._subjects.values.next({
1048
+ values: a._getWatch()
1049
+ });
1050
+ }, [e.shouldUnregister, a]), s.current.formState = it(u, a), s.current;
1051
+ }
1052
+ export {
1053
+ Wt as Controller,
1054
+ St as appendErrors,
1055
+ f as get,
1056
+ x as set,
1057
+ Et as useController,
1058
+ Ht as useForm,
1059
+ Le as useFormContext,
1060
+ Dt as useFormState,
1061
+ wt as useWatch
1062
+ };