stone-kit 0.0.1032 → 0.0.1034

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 (91) hide show
  1. package/dist/App.js +4 -4
  2. package/dist/Option-D-8xnCui.js +94 -0
  3. package/dist/Router.js +1 -1
  4. package/dist/chunk-4WY6JWTD-BeveLKf_.js +1582 -0
  5. package/dist/components/Button/ui/Button.js +1 -1
  6. package/dist/components/CheckBoxNew/CheckBoxNew.js +1 -1
  7. package/dist/components/CheckboxSelect/ui/CheckboxSelect.d.ts +4 -0
  8. package/dist/components/CheckboxSelect/ui/CheckboxSelect.js +20 -19
  9. package/dist/components/CommercialLotCard/CommercialLotCard.d.ts +1 -1
  10. package/dist/components/CommercialLotCard/CommercialLotCard.js +62 -41
  11. package/dist/components/CommercialLotCard/components/Price/Price.js +1 -1
  12. package/dist/components/CommercialLotCard/components/Snippets/Snippets.js +1 -1
  13. package/dist/components/CommercialLotCard/types/CommercialLotCard.types.d.ts +2 -0
  14. package/dist/components/DestinationTab/ui/DestinationTab.js +1 -1
  15. package/dist/components/FieldInput/ui/FieldInput.d.ts +1 -1
  16. package/dist/components/FieldInput/ui/FieldInput.js +21 -12
  17. package/dist/components/FieldInput/ui/FieldInput.types.d.ts +1 -0
  18. package/dist/components/FilterWithSave/hooks/useFilterWithSave.d.ts +1 -1
  19. package/dist/components/FilterWithSave/ui/FilterWithSave.js +2 -7
  20. package/dist/components/Flex/ui/Flex.js +1 -1
  21. package/dist/components/FormModal/ui/ModalForm.d.ts +10 -1
  22. package/dist/components/FormModal/ui/ModalForm.js +803 -719
  23. package/dist/components/GroupedInput/ui/GroupedInputs.js +1 -1
  24. package/dist/components/Input/ui/Input.js +1 -22
  25. package/dist/components/Logo/ui/Logo.js +1 -1
  26. package/dist/components/LotCard/hooks/useLotCard.js +2 -2
  27. package/dist/components/LotCard/ui/LotCard.d.ts +1 -1
  28. package/dist/components/LotCard/ui/LotCard.js +108 -88
  29. package/dist/components/LotCard/ui/LotCard.types.d.ts +2 -0
  30. package/dist/components/LotCardSkeleton/ui/LotCardSkeleton.js +1 -1
  31. package/dist/components/MetroLabel/ui/MetroLabel.js +1 -1
  32. package/dist/components/MetroTag/ui/MetroTag.js +1 -1
  33. package/dist/components/NewIcon/ui/NewIcon.js +119 -114
  34. package/dist/components/RoundButton/ui/RoundButton.js +1 -1
  35. package/dist/components/RoundButton/ui/RoundButton.types.d.ts +1 -0
  36. package/dist/components/Select/ui/Category.js +2 -2
  37. package/dist/components/Select/ui/Option.d.ts +2 -1
  38. package/dist/components/Select/ui/Option.js +2 -2
  39. package/dist/components/Select/ui/Select.d.ts +1 -1
  40. package/dist/components/Select/ui/Select.js +88 -82
  41. package/dist/components/Select/ui/Select.types.d.ts +5 -0
  42. package/dist/components/SliderNavigation/ui/SliderNavigation.js +1 -1
  43. package/dist/components/SortSelect/hooks/useSortSelect.js +2 -2
  44. package/dist/components/SortSelect/ui/SortSelect.js +2 -2
  45. package/dist/components/SummarySelect/ui/SummarySelect.d.ts +1 -0
  46. package/dist/components/SummarySelect/ui/SummarySelect.js +60 -57
  47. package/dist/components/Switcher/ui/Switcher.js +1 -1
  48. package/dist/components/TabSelect/ui/TabSelect.js +1 -1
  49. package/dist/components/TabSwitcher/ui/TabSwitcher.js +91 -90
  50. package/dist/components/TabSwitcher/ui/TabSwitcher.types.d.ts +1 -0
  51. package/dist/components/Tag/ui/Tag.js +1 -1
  52. package/dist/components/Text/ui/Text.js +1 -1
  53. package/dist/components/TextArea/TextArea.js +1 -1
  54. package/dist/components/mobileButton/ui/MobileButton.js +1 -1
  55. package/dist/{index-3E04UaC2.js → index-BJwl9stn.js} +785 -784
  56. package/dist/{index-B2JRaoNz.js → index-YnD2EP-S.js} +0 -5
  57. package/dist/layout/components/Header/Header.js +1 -1
  58. package/dist/layout/components/Menu.js +107 -4
  59. package/dist/pages/FormsPage/FormsPage.js +1 -0
  60. package/dist/pages/TabsPage/TabsPage.js +56 -42
  61. package/dist/stone-kit.css +1 -1
  62. package/dist/stories/entities/CommercialLotCard/CommercialLotCard.stories.js +1 -1
  63. package/dist/stories/shared/ui/Button/Button.stories.js +1 -1
  64. package/dist/stories/shared/ui/CheckBox/CheckBox.stories.js +1 -1
  65. package/dist/stories/shared/ui/CheckBox/CheckBoxNew.stories.js +1 -1
  66. package/dist/stories/shared/ui/CheckboxSelect/CheckboxSelect.stories.js +1 -1
  67. package/dist/stories/shared/ui/DestinationTab/DestinationTab.stories.js +1 -1
  68. package/dist/stories/shared/ui/FieldInput/FieldInput.stories.js +1 -1
  69. package/dist/stories/shared/ui/FilterWithSave/FilterWithSave.stories.js +1 -1
  70. package/dist/stories/shared/ui/FormModal/FormModal.stories.js +1 -1
  71. package/dist/stories/shared/ui/GroupedInput/GroupedInput.stories.js +1 -1
  72. package/dist/stories/shared/ui/Logo/Logo.stories.js +1 -1
  73. package/dist/stories/shared/ui/MobileButton/MobileButton.stories.js +1 -1
  74. package/dist/stories/shared/ui/Modal/Modal.stories.js +1 -1
  75. package/dist/stories/shared/ui/ModalSuccess/ModalSuccess.stories.js +1 -1
  76. package/dist/stories/shared/ui/RoundButton/RoundButton.stories.js +1 -1
  77. package/dist/stories/shared/ui/Select/Select.stories.js +1 -1
  78. package/dist/stories/shared/ui/SliderNavigation/SliderNavigation.stories.js +1 -1
  79. package/dist/stories/shared/ui/SortSelect/SortSelect.stories.js +1 -1
  80. package/dist/stories/shared/ui/SummarySelect/SummarySelect.stories.js +1 -1
  81. package/dist/stories/shared/ui/Switcher/Switcher.stories.js +1 -1
  82. package/dist/stories/shared/ui/TabSelect/TabSelect.stories.js +1 -1
  83. package/dist/stories/shared/ui/TabSwitcher/TabSwitcher.stories.js +1 -1
  84. package/dist/stories/shared/ui/ZoomControls/ZoomControls.stories.js +1 -1
  85. package/dist/useLotCard-I7_rgnqj.js +187 -0
  86. package/dist/{useSortSelect-B8HOGdOt.js → useSortSelect-IeonkD5d.js} +1 -1
  87. package/package.json +5 -5
  88. package/dist/Menu-CdJTzN7T.js +0 -494
  89. package/dist/Option-rFBMQAPk.js +0 -87
  90. package/dist/index-CBdtKu-u.js +0 -891
  91. package/dist/useLotCard-DG9doKCX.js +0 -186
@@ -1,82 +1,82 @@
1
- import { jsx as R, jsxs as ce } from "react/jsx-runtime";
2
- import b, { useEffect as Ze } from "react";
3
- import { nameReg as Lt, phoneReg as Mt, emailReg as Rt } from "../utils/reg.js";
4
- import { TextArea as Ot } from "../../TextArea/TextArea.js";
5
- import { c as Nt } from "../../../index-B2JRaoNz.js";
1
+ import { jsx as L, jsxs as de } from "react/jsx-runtime";
2
+ import v, { useEffect as Me } from "react";
3
+ import { nameReg as Rt, phoneReg as Lt, emailReg as Ot } from "../utils/reg.js";
4
+ import { TextArea as Mt } from "../../TextArea/TextArea.js";
5
+ import { c as Nt } from "../../../index-YnD2EP-S.js";
6
6
  import { useClientWidth as Ut } from "../../../shared/useClientWidth.js";
7
- import { Modal as Pt } from "../../Modal/ui/Modal.js";
8
- import { NewIcon as et } from "../../NewIcon/ui/NewIcon.js";
9
- import { Flex as It } from "../../Flex/ui/Flex.js";
10
- import { Input as Re } from "../../Input/ui/Input.js";
11
- import { CheckBox as tt } from "../../CheckBox/CheckBox.js";
12
- import { Button as rt } from "../../Button/ui/Button.js";
13
- const Wt = "_btn_ky28a_1", qt = "_modal_ky28a_9", Ht = "_modalBody_ky28a_16", zt = "_root_ky28a_21", $t = "_title_ky28a_34", Kt = "_description_ky28a_41", jt = "_inputWrapper_ky28a_48", Gt = "_linkPolicy_ky28a_55", Yt = "_telegramLink_ky28a_60", Jt = "_telegramWrapper_ky28a_65", Qt = "_telegram_ky28a_60", Xt = "_orText_ky28a_88", Zt = "_checkboxText_ky28a_116", I = {
7
+ import { Modal as It } from "../../Modal/ui/Modal.js";
8
+ import { NewIcon as tt } from "../../NewIcon/ui/NewIcon.js";
9
+ import { Flex as Pt } from "../../Flex/ui/Flex.js";
10
+ import { Input as Ne } from "../../Input/ui/Input.js";
11
+ import { CheckBox as rt } from "../../CheckBox/CheckBox.js";
12
+ import { Button as st } from "../../Button/ui/Button.js";
13
+ const Wt = "_btn_ky28a_1", qt = "_modal_ky28a_9", Ht = "_modalBody_ky28a_16", zt = "_root_ky28a_21", $t = "_title_ky28a_34", jt = "_description_ky28a_41", Gt = "_inputWrapper_ky28a_48", Kt = "_linkPolicy_ky28a_55", Jt = "_telegramLink_ky28a_60", Qt = "_telegramWrapper_ky28a_65", Xt = "_telegram_ky28a_60", Zt = "_orText_ky28a_88", Yt = "_checkboxText_ky28a_116", U = {
14
14
  btn: Wt,
15
15
  modal: qt,
16
16
  modalBody: Ht,
17
17
  root: zt,
18
18
  title: $t,
19
- description: Kt,
20
- inputWrapper: jt,
21
- linkPolicy: Gt,
22
- telegramLink: Yt,
23
- telegramWrapper: Jt,
24
- telegram: Qt,
25
- orText: Xt,
26
- checkboxText: Zt
19
+ description: jt,
20
+ inputWrapper: Gt,
21
+ linkPolicy: Kt,
22
+ telegramLink: Jt,
23
+ telegramWrapper: Qt,
24
+ telegram: Xt,
25
+ orText: Zt,
26
+ checkboxText: Yt
27
27
  };
28
- var ke = (e) => e.type === "checkbox", fe = (e) => e instanceof Date, K = (e) => e == null;
29
- const ht = (e) => typeof e == "object";
30
- var N = (e) => !K(e) && !Array.isArray(e) && ht(e) && !fe(e), mt = (e) => N(e) && e.target ? ke(e.target) ? e.target.checked : e.target.value : e, er = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, _t = (e, s) => e.has(er(s)), tr = (e) => {
28
+ var Fe = (e) => e.type === "checkbox", ye = (e) => e instanceof Date, Q = (e) => e == null;
29
+ const mt = (e) => typeof e == "object";
30
+ var P = (e) => !Q(e) && !Array.isArray(e) && mt(e) && !ye(e), _t = (e) => P(e) && e.target ? Fe(e.target) ? e.target.checked : e.target.value : e, er = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, gt = (e, s) => e.has(er(s)), tr = (e) => {
31
31
  const s = e.constructor && e.constructor.prototype;
32
- return N(s) && s.hasOwnProperty("isPrototypeOf");
33
- }, Pe = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
34
- function P(e) {
32
+ return P(s) && s.hasOwnProperty("isPrototypeOf");
33
+ }, qe = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
34
+ function W(e) {
35
35
  let s;
36
- const t = Array.isArray(e), a = typeof FileList < "u" ? e instanceof FileList : !1;
36
+ const t = Array.isArray(e), i = typeof FileList < "u" ? e instanceof FileList : !1;
37
37
  if (e instanceof Date)
38
38
  s = new Date(e);
39
- else if (!(Pe && (e instanceof Blob || a)) && (t || N(e)))
39
+ else if (!(qe && (e instanceof Blob || i)) && (t || P(e)))
40
40
  if (s = t ? [] : Object.create(Object.getPrototypeOf(e)), !t && !tr(e))
41
41
  s = e;
42
42
  else
43
43
  for (const o in e)
44
- e.hasOwnProperty(o) && (s[o] = P(e[o]));
44
+ e.hasOwnProperty(o) && (s[o] = W(e[o]));
45
45
  else
46
46
  return e;
47
47
  return s;
48
48
  }
49
- var De = (e) => /^\w*$/.test(e), L = (e) => e === void 0, Ie = (e) => Array.isArray(e) ? e.filter(Boolean) : [], We = (e) => Ie(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
50
- if (!s || !N(e))
49
+ var Ee = (e) => /^\w*$/.test(e), O = (e) => e === void 0, He = (e) => Array.isArray(e) ? e.filter(Boolean) : [], ze = (e) => He(e.replace(/["|']|\]/g, "").split(/\.|\[/)), y = (e, s, t) => {
50
+ if (!s || !P(e))
51
51
  return t;
52
- const a = (De(s) ? [s] : We(s)).reduce((o, l) => K(o) ? o : o[l], e);
53
- return L(a) || a === e ? L(e[s]) ? t : e[s] : a;
54
- }, J = (e) => typeof e == "boolean", B = (e, s, t) => {
55
- let a = -1;
56
- const o = De(s) ? [s] : We(s), l = o.length, d = l - 1;
57
- for (; ++a < l; ) {
58
- const c = o[a];
59
- let S = t;
60
- if (a !== d) {
61
- const D = e[c];
62
- S = N(D) || Array.isArray(D) ? D : isNaN(+o[a + 1]) ? {} : [];
52
+ const i = (Ee(s) ? [s] : ze(s)).reduce((o, l) => Q(o) ? o : o[l], e);
53
+ return O(i) || i === e ? O(e[s]) ? t : e[s] : i;
54
+ }, Z = (e) => typeof e == "boolean", B = (e, s, t) => {
55
+ let i = -1;
56
+ const o = Ee(s) ? [s] : ze(s), l = o.length, c = l - 1;
57
+ for (; ++i < l; ) {
58
+ const d = o[i];
59
+ let D = t;
60
+ if (i !== c) {
61
+ const w = e[d];
62
+ D = P(w) || Array.isArray(w) ? w : isNaN(+o[i + 1]) ? {} : [];
63
63
  }
64
- if (c === "__proto__" || c === "constructor" || c === "prototype")
64
+ if (d === "__proto__" || d === "constructor" || d === "prototype")
65
65
  return;
66
- e[c] = S, e = e[c];
66
+ e[d] = D, e = e[d];
67
67
  }
68
68
  };
69
- const we = {
69
+ const Ce = {
70
70
  BLUR: "blur",
71
71
  FOCUS_OUT: "focusout",
72
72
  CHANGE: "change"
73
- }, se = {
73
+ }, ie = {
74
74
  onBlur: "onBlur",
75
75
  onChange: "onChange",
76
76
  onSubmit: "onSubmit",
77
77
  onTouched: "onTouched",
78
78
  all: "all"
79
- }, ae = {
79
+ }, oe = {
80
80
  max: "max",
81
81
  min: "min",
82
82
  maxLength: "maxLength",
@@ -84,25 +84,25 @@ const we = {
84
84
  pattern: "pattern",
85
85
  required: "required",
86
86
  validate: "validate"
87
- }, gt = b.createContext(null);
88
- gt.displayName = "HookFormContext";
89
- const qe = () => b.useContext(gt);
90
- var vt = (e, s, t, a = !0) => {
87
+ }, vt = v.createContext(null);
88
+ vt.displayName = "HookFormContext";
89
+ const $e = () => v.useContext(vt);
90
+ var bt = (e, s, t, i = !0) => {
91
91
  const o = {
92
92
  defaultValues: s._defaultValues
93
93
  };
94
94
  for (const l in e)
95
95
  Object.defineProperty(o, l, {
96
96
  get: () => {
97
- const d = l;
98
- return s._proxyFormState[d] !== se.all && (s._proxyFormState[d] = !a || se.all), t && (t[d] = !0), e[d];
97
+ const c = l;
98
+ return s._proxyFormState[c] !== ie.all && (s._proxyFormState[c] = !i || ie.all), t && (t[c] = !0), e[c];
99
99
  }
100
100
  });
101
101
  return o;
102
102
  };
103
- const He = typeof window < "u" ? b.useLayoutEffect : b.useEffect;
103
+ const je = typeof window < "u" ? v.useLayoutEffect : v.useEffect;
104
104
  function rr(e) {
105
- const s = qe(), { control: t = s.control, disabled: a, name: o, exact: l } = e || {}, [d, c] = b.useState(t._formState), S = b.useRef({
105
+ const s = $e(), { control: t = s.control, disabled: i, name: o, exact: l } = e || {}, [c, d] = v.useState(t._formState), D = v.useRef({
106
106
  isDirty: !1,
107
107
  isLoading: !1,
108
108
  dirtyFields: !1,
@@ -112,167 +112,182 @@ function rr(e) {
112
112
  isValid: !1,
113
113
  errors: !1
114
114
  });
115
- return He(() => t._subscribe({
115
+ return je(() => t._subscribe({
116
116
  name: o,
117
- formState: S.current,
117
+ formState: D.current,
118
118
  exact: l,
119
- callback: (D) => {
120
- !a && c({
119
+ callback: (w) => {
120
+ !i && d({
121
121
  ...t._formState,
122
- ...D
122
+ ...w
123
123
  });
124
124
  }
125
- }), [o, a, l]), b.useEffect(() => {
126
- S.current.isValid && t._setValid(!0);
127
- }, [t]), b.useMemo(() => vt(d, t, S.current, !1), [d, t]);
125
+ }), [o, i, l]), v.useEffect(() => {
126
+ D.current.isValid && t._setValid(!0);
127
+ }, [t]), v.useMemo(() => bt(c, t, D.current, !1), [c, t]);
128
128
  }
129
- var Q = (e) => typeof e == "string", bt = (e, s, t, a, o) => Q(e) ? (a && s.watch.add(e), y(t, e, o)) : Array.isArray(e) ? e.map((l) => (a && s.watch.add(l), y(t, l))) : (a && (s.watchAll = !0), t), Ne = (e) => K(e) || !ht(e);
130
- function le(e, s, t = /* @__PURE__ */ new WeakSet()) {
131
- if (Ne(e) || Ne(s))
129
+ var Y = (e) => typeof e == "string", Ie = (e, s, t, i, o) => Y(e) ? (i && s.watch.add(e), y(t, e, o)) : Array.isArray(e) ? e.map((l) => (i && s.watch.add(l), y(t, l))) : (i && (s.watchAll = !0), t), Pe = (e) => Q(e) || !mt(e);
130
+ function ae(e, s, t = /* @__PURE__ */ new WeakSet()) {
131
+ if (Pe(e) || Pe(s))
132
132
  return e === s;
133
- if (fe(e) && fe(s))
133
+ if (ye(e) && ye(s))
134
134
  return e.getTime() === s.getTime();
135
- const a = Object.keys(e), o = Object.keys(s);
136
- if (a.length !== o.length)
135
+ const i = Object.keys(e), o = Object.keys(s);
136
+ if (i.length !== o.length)
137
137
  return !1;
138
138
  if (t.has(e) || t.has(s))
139
139
  return !0;
140
140
  t.add(e), t.add(s);
141
- for (const l of a) {
142
- const d = e[l];
141
+ for (const l of i) {
142
+ const c = e[l];
143
143
  if (!o.includes(l))
144
144
  return !1;
145
145
  if (l !== "ref") {
146
- const c = s[l];
147
- if (fe(d) && fe(c) || N(d) && N(c) || Array.isArray(d) && Array.isArray(c) ? !le(d, c, t) : d !== c)
146
+ const d = s[l];
147
+ if (ye(c) && ye(d) || P(c) && P(d) || Array.isArray(c) && Array.isArray(d) ? !ae(c, d, t) : c !== d)
148
148
  return !1;
149
149
  }
150
150
  }
151
151
  return !0;
152
152
  }
153
153
  function sr(e) {
154
- const s = qe(), { control: t = s.control, name: a, defaultValue: o, disabled: l, exact: d, compute: c } = e || {}, S = b.useRef(o), D = b.useRef(c), _ = b.useRef(void 0);
155
- D.current = c;
156
- const x = b.useMemo(() => t._getWatch(a, S.current), [t, a]), [g, j] = b.useState(D.current ? D.current(x) : x);
157
- return He(() => t._subscribe({
158
- name: a,
154
+ const s = $e(), { control: t = s.control, name: i, defaultValue: o, disabled: l, exact: c, compute: d } = e || {}, D = v.useRef(o), w = v.useRef(d), g = v.useRef(void 0), x = v.useRef(t), _ = v.useRef(i);
155
+ w.current = d;
156
+ const [ee, H] = v.useState(() => {
157
+ const F = t._getWatch(i, D.current);
158
+ return w.current ? w.current(F) : F;
159
+ }), S = v.useCallback((F) => {
160
+ const V = Ie(i, t._names, F || t._formValues, !1, D.current);
161
+ return w.current ? w.current(V) : V;
162
+ }, [t._formValues, t._names, i]), N = v.useCallback((F) => {
163
+ if (!l) {
164
+ const V = Ie(i, t._names, F || t._formValues, !1, D.current);
165
+ if (w.current) {
166
+ const z = w.current(V);
167
+ ae(z, g.current) || (H(z), g.current = z);
168
+ } else
169
+ H(V);
170
+ }
171
+ }, [t._formValues, t._names, l, i]);
172
+ je(() => ((x.current !== t || !ae(_.current, i)) && (x.current = t, _.current = i, N()), t._subscribe({
173
+ name: i,
159
174
  formState: {
160
175
  values: !0
161
176
  },
162
- exact: d,
163
- callback: (q) => {
164
- if (!l) {
165
- const p = bt(a, t._names, q.values || t._formValues, !1, S.current);
166
- if (D.current) {
167
- const M = D.current(p);
168
- le(M, _.current) || (j(M), _.current = M);
169
- } else
170
- j(p);
171
- }
177
+ exact: c,
178
+ callback: (F) => {
179
+ N(F.values);
172
180
  }
173
- }), [t, l, a, d]), b.useEffect(() => t._removeUnmounted()), g;
181
+ })), [t, c, i, N]), v.useEffect(() => t._removeUnmounted());
182
+ const te = x.current !== t, b = _.current, C = v.useMemo(() => {
183
+ if (l)
184
+ return null;
185
+ const F = !te && !ae(b, i);
186
+ return te || F ? S() : null;
187
+ }, [l, te, i, b, S]);
188
+ return C !== null ? C : ee;
174
189
  }
175
190
  function ir(e) {
176
- const s = qe(), { name: t, disabled: a, control: o = s.control, shouldUnregister: l, defaultValue: d } = e, c = _t(o._names.array, t), S = b.useMemo(() => y(o._formValues, t, y(o._defaultValues, t, d)), [o, t, d]), D = sr({
191
+ const s = $e(), { name: t, disabled: i, control: o = s.control, shouldUnregister: l, defaultValue: c } = e, d = gt(o._names.array, t), D = v.useMemo(() => y(o._formValues, t, y(o._defaultValues, t, c)), [o, t, c]), w = sr({
177
192
  control: o,
178
193
  name: t,
179
- defaultValue: S,
194
+ defaultValue: D,
180
195
  exact: !0
181
- }), _ = rr({
196
+ }), g = rr({
182
197
  control: o,
183
198
  name: t,
184
199
  exact: !0
185
- }), x = b.useRef(e), g = b.useRef(void 0), j = b.useRef(o.register(t, {
200
+ }), x = v.useRef(e), _ = v.useRef(void 0), ee = v.useRef(o.register(t, {
186
201
  ...e.rules,
187
- value: D,
188
- ...J(e.disabled) ? { disabled: e.disabled } : {}
202
+ value: w,
203
+ ...Z(e.disabled) ? { disabled: e.disabled } : {}
189
204
  }));
190
205
  x.current = e;
191
- const q = b.useMemo(() => Object.defineProperties({}, {
206
+ const H = v.useMemo(() => Object.defineProperties({}, {
192
207
  invalid: {
193
208
  enumerable: !0,
194
- get: () => !!y(_.errors, t)
209
+ get: () => !!y(g.errors, t)
195
210
  },
196
211
  isDirty: {
197
212
  enumerable: !0,
198
- get: () => !!y(_.dirtyFields, t)
213
+ get: () => !!y(g.dirtyFields, t)
199
214
  },
200
215
  isTouched: {
201
216
  enumerable: !0,
202
- get: () => !!y(_.touchedFields, t)
217
+ get: () => !!y(g.touchedFields, t)
203
218
  },
204
219
  isValidating: {
205
220
  enumerable: !0,
206
- get: () => !!y(_.validatingFields, t)
221
+ get: () => !!y(g.validatingFields, t)
207
222
  },
208
223
  error: {
209
224
  enumerable: !0,
210
- get: () => y(_.errors, t)
225
+ get: () => y(g.errors, t)
211
226
  }
212
- }), [_, t]), p = b.useCallback((T) => j.current.onChange({
227
+ }), [g, t]), S = v.useCallback((C) => ee.current.onChange({
213
228
  target: {
214
- value: mt(T),
229
+ value: _t(C),
215
230
  name: t
216
231
  },
217
- type: we.CHANGE
218
- }), [t]), M = b.useCallback(() => j.current.onBlur({
232
+ type: Ce.CHANGE
233
+ }), [t]), N = v.useCallback(() => ee.current.onBlur({
219
234
  target: {
220
235
  value: y(o._formValues, t),
221
236
  name: t
222
237
  },
223
- type: we.BLUR
224
- }), [t, o._formValues]), ne = b.useCallback((T) => {
225
- const U = y(o._fields, t);
226
- U && T && (U._f.ref = {
227
- focus: () => T.focus && T.focus(),
228
- select: () => T.select && T.select(),
229
- setCustomValidity: (w) => T.setCustomValidity(w),
230
- reportValidity: () => T.reportValidity()
238
+ type: Ce.BLUR
239
+ }), [t, o._formValues]), te = v.useCallback((C) => {
240
+ const F = y(o._fields, t);
241
+ F && C && (F._f.ref = {
242
+ focus: () => C.focus && C.focus(),
243
+ select: () => C.select && C.select(),
244
+ setCustomValidity: (V) => C.setCustomValidity(V),
245
+ reportValidity: () => C.reportValidity()
231
246
  });
232
- }, [o._fields, t]), v = b.useMemo(() => ({
247
+ }, [o._fields, t]), b = v.useMemo(() => ({
233
248
  name: t,
234
- value: D,
235
- ...J(a) || _.disabled ? { disabled: _.disabled || a } : {},
236
- onChange: p,
237
- onBlur: M,
238
- ref: ne
239
- }), [t, a, _.disabled, p, M, ne, D]);
240
- return b.useEffect(() => {
241
- const T = o._options.shouldUnregister || l, U = g.current;
242
- U && U !== t && !c && o.unregister(U), o.register(t, {
249
+ value: w,
250
+ ...Z(i) || g.disabled ? { disabled: g.disabled || i } : {},
251
+ onChange: S,
252
+ onBlur: N,
253
+ ref: te
254
+ }), [t, i, g.disabled, S, N, te, w]);
255
+ return v.useEffect(() => {
256
+ const C = o._options.shouldUnregister || l, F = _.current;
257
+ F && F !== t && !d && o.unregister(F), o.register(t, {
243
258
  ...x.current.rules,
244
- ...J(x.current.disabled) ? { disabled: x.current.disabled } : {}
259
+ ...Z(x.current.disabled) ? { disabled: x.current.disabled } : {}
245
260
  });
246
- const w = (X, H) => {
247
- const re = y(o._fields, X);
248
- re && re._f && (re._f.mount = H);
261
+ const V = (z, j) => {
262
+ const X = y(o._fields, z);
263
+ X && X._f && (X._f.mount = j);
249
264
  };
250
- if (w(t, !0), T) {
251
- const X = P(y(o._options.defaultValues, t, x.current.defaultValue));
252
- B(o._defaultValues, t, X), L(y(o._formValues, t)) && B(o._formValues, t, X);
265
+ if (V(t, !0), C) {
266
+ const z = W(y(o._options.defaultValues, t, x.current.defaultValue));
267
+ B(o._defaultValues, t, z), O(y(o._formValues, t)) && B(o._formValues, t, z);
253
268
  }
254
- return !c && o.register(t), g.current = t, () => {
255
- (c ? T && !o._state.action : T) ? o.unregister(t) : w(t, !1);
269
+ return !d && o.register(t), _.current = t, () => {
270
+ (d ? C && !o._state.action : C) ? o.unregister(t) : V(t, !1);
256
271
  };
257
- }, [t, o, c, l]), b.useEffect(() => {
272
+ }, [t, o, d, l]), v.useEffect(() => {
258
273
  o._setDisabledField({
259
- disabled: a,
274
+ disabled: i,
260
275
  name: t
261
276
  });
262
- }, [a, t, o]), b.useMemo(() => ({
263
- field: v,
264
- formState: _,
265
- fieldState: q
266
- }), [v, _, q]);
277
+ }, [i, t, o]), v.useMemo(() => ({
278
+ field: b,
279
+ formState: g,
280
+ fieldState: H
281
+ }), [b, g, H]);
267
282
  }
268
283
  const ar = (e) => e.render(ir(e));
269
- var lr = (e, s, t, a, o) => s ? {
284
+ var lr = (e, s, t, i, o) => s ? {
270
285
  ...t[e],
271
286
  types: {
272
287
  ...t[e] && t[e].types ? t[e].types : {},
273
- [a]: o || !0
288
+ [i]: o || !0
274
289
  }
275
- } : {}, Ve = (e) => Array.isArray(e) ? e : [e], st = () => {
290
+ } : {}, ke = (e) => Array.isArray(e) ? e : [e], it = () => {
276
291
  let e = [];
277
292
  return {
278
293
  get observers() {
@@ -294,63 +309,63 @@ var lr = (e, s, t, a, o) => s ? {
294
309
  };
295
310
  function Vt(e, s) {
296
311
  const t = {};
297
- for (const a in e)
298
- if (e.hasOwnProperty(a)) {
299
- const o = e[a], l = s[a];
300
- if (o && N(o) && l) {
301
- const d = Vt(o, l);
302
- N(d) && (t[a] = d);
303
- } else e[a] && (t[a] = l);
312
+ for (const i in e)
313
+ if (e.hasOwnProperty(i)) {
314
+ const o = e[i], l = s[i];
315
+ if (o && P(o) && l) {
316
+ const c = Vt(o, l);
317
+ P(c) && (t[i] = c);
318
+ } else e[i] && (t[i] = l);
304
319
  }
305
320
  return t;
306
321
  }
307
- var $ = (e) => N(e) && !Object.keys(e).length, ze = (e) => e.type === "file", ie = (e) => typeof e == "function", Ce = (e) => {
308
- if (!Pe)
322
+ var J = (e) => P(e) && !Object.keys(e).length, Ge = (e) => e.type === "file", le = (e) => typeof e == "function", De = (e) => {
323
+ if (!qe)
309
324
  return !1;
310
325
  const s = e ? e.ownerDocument : 0;
311
326
  return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
312
- }, xt = (e) => e.type === "select-multiple", $e = (e) => e.type === "radio", nr = (e) => $e(e) || ke(e), Oe = (e) => Ce(e) && e.isConnected;
327
+ }, kt = (e) => e.type === "select-multiple", Ke = (e) => e.type === "radio", nr = (e) => Ke(e) || Fe(e), Ue = (e) => De(e) && e.isConnected;
313
328
  function or(e, s) {
314
329
  const t = s.slice(0, -1).length;
315
- let a = 0;
316
- for (; a < t; )
317
- e = L(e) ? a++ : e[s[a++]];
330
+ let i = 0;
331
+ for (; i < t; )
332
+ e = O(e) ? i++ : e[s[i++]];
318
333
  return e;
319
334
  }
320
335
  function ur(e) {
321
336
  for (const s in e)
322
- if (e.hasOwnProperty(s) && !L(e[s]))
337
+ if (e.hasOwnProperty(s) && !O(e[s]))
323
338
  return !1;
324
339
  return !0;
325
340
  }
326
- function O(e, s) {
327
- const t = Array.isArray(s) ? s : De(s) ? [s] : We(s), a = t.length === 1 ? e : or(e, t), o = t.length - 1, l = t[o];
328
- return a && delete a[l], o !== 0 && (N(a) && $(a) || Array.isArray(a) && ur(a)) && O(e, t.slice(0, -1)), e;
341
+ function I(e, s) {
342
+ const t = Array.isArray(s) ? s : Ee(s) ? [s] : ze(s), i = t.length === 1 ? e : or(e, t), o = t.length - 1, l = t[o];
343
+ return i && delete i[l], o !== 0 && (P(i) && J(i) || Array.isArray(i) && ur(i)) && I(e, t.slice(0, -1)), e;
329
344
  }
330
- var dr = (e) => {
345
+ var cr = (e) => {
331
346
  for (const s in e)
332
- if (ie(e[s]))
347
+ if (le(e[s]))
333
348
  return !0;
334
349
  return !1;
335
350
  };
336
- function kt(e) {
337
- return Array.isArray(e) || N(e) && !dr(e);
351
+ function xt(e) {
352
+ return Array.isArray(e) || P(e) && !cr(e);
338
353
  }
339
- function Ue(e, s = {}) {
354
+ function We(e, s = {}) {
340
355
  for (const t in e)
341
- kt(e[t]) ? (s[t] = Array.isArray(e[t]) ? [] : {}, Ue(e[t], s[t])) : L(e[t]) || (s[t] = !0);
356
+ xt(e[t]) ? (s[t] = Array.isArray(e[t]) ? [] : {}, We(e[t], s[t])) : O(e[t]) || (s[t] = !0);
342
357
  return s;
343
358
  }
344
- function me(e, s, t) {
345
- t || (t = Ue(s));
346
- for (const a in e)
347
- kt(e[a]) ? L(s) || Ne(t[a]) ? t[a] = Ue(e[a], Array.isArray(e[a]) ? [] : {}) : me(e[a], K(s) ? {} : s[a], t[a]) : t[a] = !le(e[a], s[a]);
359
+ function ge(e, s, t) {
360
+ t || (t = We(s));
361
+ for (const i in e)
362
+ xt(e[i]) ? O(s) || Pe(t[i]) ? t[i] = We(e[i], Array.isArray(e[i]) ? [] : {}) : ge(e[i], Q(s) ? {} : s[i], t[i]) : t[i] = !ae(e[i], s[i]);
348
363
  return t;
349
364
  }
350
- const it = {
365
+ const at = {
351
366
  value: !1,
352
367
  isValid: !1
353
- }, at = { value: !0, isValid: !0 };
368
+ }, lt = { value: !0, isValid: !0 };
354
369
  var Ft = (e) => {
355
370
  if (Array.isArray(e)) {
356
371
  if (e.length > 1) {
@@ -359,82 +374,82 @@ var Ft = (e) => {
359
374
  }
360
375
  return e[0].checked && !e[0].disabled ? (
361
376
  // @ts-expect-error expected to work in the browser
362
- e[0].attributes && !L(e[0].attributes.value) ? L(e[0].value) || e[0].value === "" ? at : { value: e[0].value, isValid: !0 } : at
363
- ) : it;
377
+ e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ? lt : { value: e[0].value, isValid: !0 } : lt
378
+ ) : at;
364
379
  }
365
- return it;
366
- }, At = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: a }) => L(e) ? e : s ? e === "" ? NaN : e && +e : t && Q(e) ? new Date(e) : a ? a(e) : e;
367
- const lt = {
380
+ return at;
381
+ }, pt = (e, { valueAsNumber: s, valueAsDate: t, setValueAs: i }) => O(e) ? e : s ? e === "" ? NaN : e && +e : t && Y(e) ? new Date(e) : i ? i(e) : e;
382
+ const nt = {
368
383
  isValid: !1,
369
384
  value: null
370
385
  };
371
- var pt = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
386
+ var At = (e) => Array.isArray(e) ? e.reduce((s, t) => t && t.checked && !t.disabled ? {
372
387
  isValid: !0,
373
388
  value: t.value
374
- } : s, lt) : lt;
375
- function nt(e) {
389
+ } : s, nt) : nt;
390
+ function ot(e) {
376
391
  const s = e.ref;
377
- return ze(s) ? s.files : $e(s) ? pt(e.refs).value : xt(s) ? [...s.selectedOptions].map(({ value: t }) => t) : ke(s) ? Ft(e.refs).value : At(L(s.value) ? e.ref.value : s.value, e);
392
+ return Ge(s) ? s.files : Ke(s) ? At(e.refs).value : kt(s) ? [...s.selectedOptions].map(({ value: t }) => t) : Fe(s) ? Ft(e.refs).value : pt(O(s.value) ? e.ref.value : s.value, e);
378
393
  }
379
- var cr = (e, s, t, a) => {
394
+ var dr = (e, s, t, i) => {
380
395
  const o = {};
381
396
  for (const l of e) {
382
- const d = y(s, l);
383
- d && B(o, l, d._f);
397
+ const c = y(s, l);
398
+ c && B(o, l, c._f);
384
399
  }
385
400
  return {
386
401
  criteriaMode: t,
387
402
  names: [...e],
388
403
  fields: o,
389
- shouldUseNativeValidation: a
404
+ shouldUseNativeValidation: i
390
405
  };
391
- }, Se = (e) => e instanceof RegExp, be = (e) => L(e) ? e : Se(e) ? e.source : N(e) ? Se(e.value) ? e.value.source : e.value : e, ot = (e) => ({
392
- isOnSubmit: !e || e === se.onSubmit,
393
- isOnBlur: e === se.onBlur,
394
- isOnChange: e === se.onChange,
395
- isOnAll: e === se.all,
396
- isOnTouch: e === se.onTouched
406
+ }, Se = (e) => e instanceof RegExp, Ve = (e) => O(e) ? e : Se(e) ? e.source : P(e) ? Se(e.value) ? e.value.source : e.value : e, ut = (e) => ({
407
+ isOnSubmit: !e || e === ie.onSubmit,
408
+ isOnBlur: e === ie.onBlur,
409
+ isOnChange: e === ie.onChange,
410
+ isOnAll: e === ie.all,
411
+ isOnTouch: e === ie.onTouched
397
412
  });
398
- const ut = "AsyncFunction";
399
- var fr = (e) => !!e && !!e.validate && !!(ie(e.validate) && e.validate.constructor.name === ut || N(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === ut)), yr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), dt = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((a) => e.startsWith(a) && /^\.\w+/.test(e.slice(a.length))));
400
- const xe = (e, s, t, a) => {
413
+ const ct = "AsyncFunction";
414
+ var fr = (e) => !!e && !!e.validate && !!(le(e.validate) && e.validate.constructor.name === ct || P(e.validate) && Object.values(e.validate).find((s) => s.constructor.name === ct)), yr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), dt = (e, s, t) => !t && (s.watchAll || s.watch.has(e) || [...s.watch].some((i) => e.startsWith(i) && /^\.\w+/.test(e.slice(i.length))));
415
+ const xe = (e, s, t, i) => {
401
416
  for (const o of t || Object.keys(e)) {
402
417
  const l = y(e, o);
403
418
  if (l) {
404
- const { _f: d, ...c } = l;
405
- if (d) {
406
- if (d.refs && d.refs[0] && s(d.refs[0], o) && !a)
419
+ const { _f: c, ...d } = l;
420
+ if (c) {
421
+ if (c.refs && c.refs[0] && s(c.refs[0], o) && !i)
407
422
  return !0;
408
- if (d.ref && s(d.ref, d.name) && !a)
423
+ if (c.ref && s(c.ref, c.name) && !i)
409
424
  return !0;
410
- if (xe(c, s))
425
+ if (xe(d, s))
411
426
  break;
412
- } else if (N(c) && xe(c, s))
427
+ } else if (P(d) && xe(d, s))
413
428
  break;
414
429
  }
415
430
  }
416
431
  };
417
- function ct(e, s, t) {
418
- const a = y(e, t);
419
- if (a || De(t))
432
+ function ft(e, s, t) {
433
+ const i = y(e, t);
434
+ if (i || Ee(t))
420
435
  return {
421
- error: a,
436
+ error: i,
422
437
  name: t
423
438
  };
424
439
  const o = t.split(".");
425
440
  for (; o.length; ) {
426
- const l = o.join("."), d = y(s, l), c = y(e, l);
427
- if (d && !Array.isArray(d) && t !== l)
441
+ const l = o.join("."), c = y(s, l), d = y(e, l);
442
+ if (c && !Array.isArray(c) && t !== l)
428
443
  return { name: t };
429
- if (c && c.type)
444
+ if (d && d.type)
430
445
  return {
431
446
  name: l,
432
- error: c
447
+ error: d
433
448
  };
434
- if (c && c.root && c.root.type)
449
+ if (d && d.root && d.root.type)
435
450
  return {
436
451
  name: `${l}.root`,
437
- error: c.root
452
+ error: d.root
438
453
  };
439
454
  o.pop();
440
455
  }
@@ -442,109 +457,109 @@ function ct(e, s, t) {
442
457
  name: t
443
458
  };
444
459
  }
445
- var hr = (e, s, t, a) => {
460
+ var hr = (e, s, t, i) => {
446
461
  t(e);
447
462
  const { name: o, ...l } = e;
448
- return $(l) || Object.keys(l).length >= Object.keys(s).length || Object.keys(l).find((d) => s[d] === (!a || se.all));
449
- }, mr = (e, s, t) => !e || !s || e === s || Ve(e).some((a) => a && (t ? a === s : a.startsWith(s) || s.startsWith(a))), _r = (e, s, t, a, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(s || e) : (t ? a.isOnBlur : o.isOnBlur) ? !e : (t ? a.isOnChange : o.isOnChange) ? e : !0, gr = (e, s) => !Ie(y(e, s)).length && O(e, s), vr = (e, s, t) => {
450
- const a = Ve(y(e, t));
451
- return B(a, "root", s[t]), B(e, t, a), e;
463
+ return J(l) || Object.keys(l).length >= Object.keys(s).length || Object.keys(l).find((c) => s[c] === (!i || ie.all));
464
+ }, mr = (e, s, t) => !e || !s || e === s || ke(e).some((i) => i && (t ? i === s : i.startsWith(s) || s.startsWith(i))), _r = (e, s, t, i, o) => o.isOnAll ? !1 : !t && o.isOnTouch ? !(s || e) : (t ? i.isOnBlur : o.isOnBlur) ? !e : (t ? i.isOnChange : o.isOnChange) ? e : !0, gr = (e, s) => !He(y(e, s)).length && I(e, s), vr = (e, s, t) => {
465
+ const i = ke(y(e, t));
466
+ return B(i, "root", s[t]), B(e, t, i), e;
452
467
  };
453
- function ft(e, s, t = "validate") {
454
- if (Q(e) || Array.isArray(e) && e.every(Q) || J(e) && !e)
468
+ function yt(e, s, t = "validate") {
469
+ if (Y(e) || Array.isArray(e) && e.every(Y) || Z(e) && !e)
455
470
  return {
456
471
  type: t,
457
- message: Q(e) ? e : "",
472
+ message: Y(e) ? e : "",
458
473
  ref: s
459
474
  };
460
475
  }
461
- var he = (e) => N(e) && !Se(e) ? e : {
476
+ var _e = (e) => P(e) && !Se(e) ? e : {
462
477
  value: e,
463
478
  message: ""
464
- }, yt = async (e, s, t, a, o, l) => {
465
- const { ref: d, refs: c, required: S, maxLength: D, minLength: _, min: x, max: g, pattern: j, validate: q, name: p, valueAsNumber: M, mount: ne } = e._f, v = y(t, p);
466
- if (!ne || s.has(p))
479
+ }, ht = async (e, s, t, i, o, l) => {
480
+ const { ref: c, refs: d, required: D, maxLength: w, minLength: g, min: x, max: _, pattern: ee, validate: H, name: S, valueAsNumber: N, mount: te } = e._f, b = y(t, S);
481
+ if (!te || s.has(S))
467
482
  return {};
468
- const T = c ? c[0] : d, U = (V) => {
469
- o && T.reportValidity && (T.setCustomValidity(J(V) ? "" : V || ""), T.reportValidity());
470
- }, w = {}, X = $e(d), H = ke(d), re = X || H, z = (M || ze(d)) && L(d.value) && L(v) || Ce(d) && d.value === "" || v === "" || Array.isArray(v) && !v.length, G = lr.bind(null, p, a, w), Z = (V, k, C, F = ae.maxLength, W = ae.minLength) => {
471
- const Y = V ? k : C;
472
- w[p] = {
473
- type: V ? F : W,
474
- message: Y,
475
- ref: d,
476
- ...G(V ? F : W, Y)
483
+ const C = d ? d[0] : c, F = (k) => {
484
+ o && C.reportValidity && (C.setCustomValidity(Z(k) ? "" : k || ""), C.reportValidity());
485
+ }, V = {}, z = Ke(c), j = Fe(c), X = z || j, G = (N || Ge(c)) && O(c.value) && O(b) || De(c) && c.value === "" || b === "" || Array.isArray(b) && !b.length, se = lr.bind(null, S, i, V), $ = (k, p, R, M = oe.maxLength, q = oe.minLength) => {
486
+ const T = k ? p : R;
487
+ V[S] = {
488
+ type: k ? M : q,
489
+ message: T,
490
+ ref: c,
491
+ ...se(k ? M : q, T)
477
492
  };
478
493
  };
479
- if (l ? !Array.isArray(v) || !v.length : S && (!re && (z || K(v)) || J(v) && !v || H && !Ft(c).isValid || X && !pt(c).isValid)) {
480
- const { value: V, message: k } = Q(S) ? { value: !!S, message: S } : he(S);
481
- if (V && (w[p] = {
482
- type: ae.required,
483
- message: k,
484
- ref: T,
485
- ...G(ae.required, k)
486
- }, !a))
487
- return U(k), w;
494
+ if (l ? !Array.isArray(b) || !b.length : D && (!X && (G || Q(b)) || Z(b) && !b || j && !Ft(d).isValid || z && !At(d).isValid)) {
495
+ const { value: k, message: p } = Y(D) ? { value: !!D, message: D } : _e(D);
496
+ if (k && (V[S] = {
497
+ type: oe.required,
498
+ message: p,
499
+ ref: C,
500
+ ...se(oe.required, p)
501
+ }, !i))
502
+ return F(p), V;
488
503
  }
489
- if (!z && (!K(x) || !K(g))) {
490
- let V, k;
491
- const C = he(g), F = he(x);
492
- if (!K(v) && !isNaN(v)) {
493
- const W = d.valueAsNumber || v && +v;
494
- K(C.value) || (V = W > C.value), K(F.value) || (k = W < F.value);
504
+ if (!G && (!Q(x) || !Q(_))) {
505
+ let k, p;
506
+ const R = _e(_), M = _e(x);
507
+ if (!Q(b) && !isNaN(b)) {
508
+ const q = c.valueAsNumber || b && +b;
509
+ Q(R.value) || (k = q > R.value), Q(M.value) || (p = q < M.value);
495
510
  } else {
496
- const W = d.valueAsDate || new Date(v), Y = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), oe = d.type == "time", ue = d.type == "week";
497
- Q(C.value) && v && (V = oe ? Y(v) > Y(C.value) : ue ? v > C.value : W > new Date(C.value)), Q(F.value) && v && (k = oe ? Y(v) < Y(F.value) : ue ? v < F.value : W < new Date(F.value));
511
+ const q = c.valueAsDate || new Date(b), T = (fe) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + fe), ue = c.type == "time", ne = c.type == "week";
512
+ Y(R.value) && b && (k = ue ? T(b) > T(R.value) : ne ? b > R.value : q > new Date(R.value)), Y(M.value) && b && (p = ue ? T(b) < T(M.value) : ne ? b < M.value : q < new Date(M.value));
498
513
  }
499
- if ((V || k) && (Z(!!V, C.message, F.message, ae.max, ae.min), !a))
500
- return U(w[p].message), w;
514
+ if ((k || p) && ($(!!k, R.message, M.message, oe.max, oe.min), !i))
515
+ return F(V[S].message), V;
501
516
  }
502
- if ((D || _) && !z && (Q(v) || l && Array.isArray(v))) {
503
- const V = he(D), k = he(_), C = !K(V.value) && v.length > +V.value, F = !K(k.value) && v.length < +k.value;
504
- if ((C || F) && (Z(C, V.message, k.message), !a))
505
- return U(w[p].message), w;
517
+ if ((w || g) && !G && (Y(b) || l && Array.isArray(b))) {
518
+ const k = _e(w), p = _e(g), R = !Q(k.value) && b.length > +k.value, M = !Q(p.value) && b.length < +p.value;
519
+ if ((R || M) && ($(R, k.message, p.message), !i))
520
+ return F(V[S].message), V;
506
521
  }
507
- if (j && !z && Q(v)) {
508
- const { value: V, message: k } = he(j);
509
- if (Se(V) && !v.match(V) && (w[p] = {
510
- type: ae.pattern,
511
- message: k,
512
- ref: d,
513
- ...G(ae.pattern, k)
514
- }, !a))
515
- return U(k), w;
522
+ if (ee && !G && Y(b)) {
523
+ const { value: k, message: p } = _e(ee);
524
+ if (Se(k) && !b.match(k) && (V[S] = {
525
+ type: oe.pattern,
526
+ message: p,
527
+ ref: c,
528
+ ...se(oe.pattern, p)
529
+ }, !i))
530
+ return F(p), V;
516
531
  }
517
- if (q) {
518
- if (ie(q)) {
519
- const V = await q(v, t), k = ft(V, T);
520
- if (k && (w[p] = {
521
- ...k,
522
- ...G(ae.validate, k.message)
523
- }, !a))
524
- return U(k.message), w;
525
- } else if (N(q)) {
526
- let V = {};
527
- for (const k in q) {
528
- if (!$(V) && !a)
532
+ if (H) {
533
+ if (le(H)) {
534
+ const k = await H(b, t), p = yt(k, C);
535
+ if (p && (V[S] = {
536
+ ...p,
537
+ ...se(oe.validate, p.message)
538
+ }, !i))
539
+ return F(p.message), V;
540
+ } else if (P(H)) {
541
+ let k = {};
542
+ for (const p in H) {
543
+ if (!J(k) && !i)
529
544
  break;
530
- const C = ft(await q[k](v, t), T, k);
531
- C && (V = {
532
- ...C,
533
- ...G(k, C.message)
534
- }, U(C.message), a && (w[p] = V));
545
+ const R = yt(await H[p](b, t), C, p);
546
+ R && (k = {
547
+ ...R,
548
+ ...se(p, R.message)
549
+ }, F(R.message), i && (V[S] = k));
535
550
  }
536
- if (!$(V) && (w[p] = {
537
- ref: T,
538
- ...V
539
- }, !a))
540
- return w;
551
+ if (!J(k) && (V[S] = {
552
+ ref: C,
553
+ ...k
554
+ }, !i))
555
+ return V;
541
556
  }
542
557
  }
543
- return U(!0), w;
558
+ return F(!0), V;
544
559
  };
545
560
  const br = {
546
- mode: se.onSubmit,
547
- reValidateMode: se.onChange,
561
+ mode: ie.onSubmit,
562
+ reValidateMode: ie.onChange,
548
563
  shouldFocusError: !0
549
564
  };
550
565
  function Vr(e = {}) {
@@ -555,7 +570,7 @@ function Vr(e = {}) {
555
570
  submitCount: 0,
556
571
  isDirty: !1,
557
572
  isReady: !1,
558
- isLoading: ie(s.defaultValues),
573
+ isLoading: le(s.defaultValues),
559
574
  isValidating: !1,
560
575
  isSubmitted: !1,
561
576
  isSubmitting: !1,
@@ -566,18 +581,18 @@ function Vr(e = {}) {
566
581
  validatingFields: {},
567
582
  errors: s.errors || {},
568
583
  disabled: s.disabled || !1
569
- }, a = {}, o = N(s.defaultValues) || N(s.values) ? P(s.defaultValues || s.values) || {} : {}, l = s.shouldUnregister ? {} : P(o), d = {
584
+ }, i = {}, o = P(s.defaultValues) || P(s.values) ? W(s.defaultValues || s.values) || {} : {}, l = s.shouldUnregister ? {} : W(o), c = {
570
585
  action: !1,
571
586
  mount: !1,
572
587
  watch: !1
573
- }, c = {
588
+ }, d = {
574
589
  mount: /* @__PURE__ */ new Set(),
575
590
  disabled: /* @__PURE__ */ new Set(),
576
591
  unMount: /* @__PURE__ */ new Set(),
577
592
  array: /* @__PURE__ */ new Set(),
578
593
  watch: /* @__PURE__ */ new Set()
579
- }, S, D = 0;
580
- const _ = {
594
+ }, D, w = 0;
595
+ const g = {
581
596
  isDirty: !1,
582
597
  dirtyFields: !1,
583
598
  validatingFields: !1,
@@ -587,112 +602,112 @@ function Vr(e = {}) {
587
602
  errors: !1
588
603
  };
589
604
  let x = {
590
- ..._
605
+ ...g
591
606
  };
592
- const g = {
593
- array: st(),
594
- state: st()
595
- }, j = s.criteriaMode === se.all, q = (r) => (i) => {
596
- clearTimeout(D), D = setTimeout(r, i);
597
- }, p = async (r) => {
598
- if (!s.disabled && (_.isValid || x.isValid || r)) {
599
- const i = s.resolver ? $((await H()).errors) : await z(a, !0);
600
- i !== t.isValid && g.state.next({
601
- isValid: i
607
+ const _ = {
608
+ array: it(),
609
+ state: it()
610
+ }, ee = s.criteriaMode === ie.all, H = (r) => (a) => {
611
+ clearTimeout(w), w = setTimeout(r, a);
612
+ }, S = async (r) => {
613
+ if (!s.disabled && (g.isValid || x.isValid || r)) {
614
+ const a = s.resolver ? J((await j()).errors) : await G(i, !0);
615
+ a !== t.isValid && _.state.next({
616
+ isValid: a
602
617
  });
603
618
  }
604
- }, M = (r, i) => {
605
- !s.disabled && (_.isValidating || _.validatingFields || x.isValidating || x.validatingFields) && ((r || Array.from(c.mount)).forEach((n) => {
606
- n && (i ? B(t.validatingFields, n, i) : O(t.validatingFields, n));
607
- }), g.state.next({
619
+ }, N = (r, a) => {
620
+ !s.disabled && (g.isValidating || g.validatingFields || x.isValidating || x.validatingFields) && ((r || Array.from(d.mount)).forEach((n) => {
621
+ n && (a ? B(t.validatingFields, n, a) : I(t.validatingFields, n));
622
+ }), _.state.next({
608
623
  validatingFields: t.validatingFields,
609
- isValidating: !$(t.validatingFields)
624
+ isValidating: !J(t.validatingFields)
610
625
  }));
611
- }, ne = (r, i = [], n, h, f = !0, u = !0) => {
626
+ }, te = (r, a = [], n, h, f = !0, u = !0) => {
612
627
  if (h && n && !s.disabled) {
613
- if (d.action = !0, u && Array.isArray(y(a, r))) {
614
- const m = n(y(a, r), h.argA, h.argB);
615
- f && B(a, r, m);
628
+ if (c.action = !0, u && Array.isArray(y(i, r))) {
629
+ const m = n(y(i, r), h.argA, h.argB);
630
+ f && B(i, r, m);
616
631
  }
617
632
  if (u && Array.isArray(y(t.errors, r))) {
618
633
  const m = n(y(t.errors, r), h.argA, h.argB);
619
634
  f && B(t.errors, r, m), gr(t.errors, r);
620
635
  }
621
- if ((_.touchedFields || x.touchedFields) && u && Array.isArray(y(t.touchedFields, r))) {
636
+ if ((g.touchedFields || x.touchedFields) && u && Array.isArray(y(t.touchedFields, r))) {
622
637
  const m = n(y(t.touchedFields, r), h.argA, h.argB);
623
638
  f && B(t.touchedFields, r, m);
624
639
  }
625
- (_.dirtyFields || x.dirtyFields) && (t.dirtyFields = me(o, l)), g.state.next({
640
+ (g.dirtyFields || x.dirtyFields) && (t.dirtyFields = ge(o, l)), _.state.next({
626
641
  name: r,
627
- isDirty: Z(r, i),
642
+ isDirty: $(r, a),
628
643
  dirtyFields: t.dirtyFields,
629
644
  errors: t.errors,
630
645
  isValid: t.isValid
631
646
  });
632
647
  } else
633
- B(l, r, i);
634
- }, v = (r, i) => {
635
- B(t.errors, r, i), g.state.next({
648
+ B(l, r, a);
649
+ }, b = (r, a) => {
650
+ B(t.errors, r, a), _.state.next({
636
651
  errors: t.errors
637
652
  });
638
- }, T = (r) => {
639
- t.errors = r, g.state.next({
653
+ }, C = (r) => {
654
+ t.errors = r, _.state.next({
640
655
  errors: t.errors,
641
656
  isValid: !1
642
657
  });
643
- }, U = (r, i, n, h) => {
644
- const f = y(a, r);
658
+ }, F = (r, a, n, h) => {
659
+ const f = y(i, r);
645
660
  if (f) {
646
- const u = y(l, r, L(n) ? y(o, r) : n);
647
- L(u) || h && h.defaultChecked || i ? B(l, r, i ? u : nt(f._f)) : C(r, u), d.mount && p();
661
+ const u = y(l, r, O(n) ? y(o, r) : n);
662
+ O(u) || h && h.defaultChecked || a ? B(l, r, a ? u : ot(f._f)) : R(r, u), c.mount && S();
648
663
  }
649
- }, w = (r, i, n, h, f) => {
664
+ }, V = (r, a, n, h, f) => {
650
665
  let u = !1, m = !1;
651
666
  const A = {
652
667
  name: r
653
668
  };
654
669
  if (!s.disabled) {
655
670
  if (!n || h) {
656
- (_.isDirty || x.isDirty) && (m = t.isDirty, t.isDirty = A.isDirty = Z(), u = m !== A.isDirty);
657
- const E = le(y(o, r), i);
658
- m = !!y(t.dirtyFields, r), E ? O(t.dirtyFields, r) : B(t.dirtyFields, r, !0), A.dirtyFields = t.dirtyFields, u = u || (_.dirtyFields || x.dirtyFields) && m !== !E;
671
+ (g.isDirty || x.isDirty) && (m = t.isDirty, t.isDirty = A.isDirty = $(), u = m !== A.isDirty);
672
+ const E = ae(y(o, r), a);
673
+ m = !!y(t.dirtyFields, r), E ? I(t.dirtyFields, r) : B(t.dirtyFields, r, !0), A.dirtyFields = t.dirtyFields, u = u || (g.dirtyFields || x.dirtyFields) && m !== !E;
659
674
  }
660
675
  if (n) {
661
676
  const E = y(t.touchedFields, r);
662
- E || (B(t.touchedFields, r, n), A.touchedFields = t.touchedFields, u = u || (_.touchedFields || x.touchedFields) && E !== n);
677
+ E || (B(t.touchedFields, r, n), A.touchedFields = t.touchedFields, u = u || (g.touchedFields || x.touchedFields) && E !== n);
663
678
  }
664
- u && f && g.state.next(A);
679
+ u && f && _.state.next(A);
665
680
  }
666
681
  return u ? A : {};
667
- }, X = (r, i, n, h) => {
668
- const f = y(t.errors, r), u = (_.isValid || x.isValid) && J(i) && t.isValid !== i;
669
- if (s.delayError && n ? (S = q(() => v(r, n)), S(s.delayError)) : (clearTimeout(D), S = null, n ? B(t.errors, r, n) : O(t.errors, r)), (n ? !le(f, n) : f) || !$(h) || u) {
682
+ }, z = (r, a, n, h) => {
683
+ const f = y(t.errors, r), u = (g.isValid || x.isValid) && Z(a) && t.isValid !== a;
684
+ if (s.delayError && n ? (D = H(() => b(r, n)), D(s.delayError)) : (clearTimeout(w), D = null, n ? B(t.errors, r, n) : I(t.errors, r)), (n ? !ae(f, n) : f) || !J(h) || u) {
670
685
  const m = {
671
686
  ...h,
672
- ...u && J(i) ? { isValid: i } : {},
687
+ ...u && Z(a) ? { isValid: a } : {},
673
688
  errors: t.errors,
674
689
  name: r
675
690
  };
676
691
  t = {
677
692
  ...t,
678
693
  ...m
679
- }, g.state.next(m);
694
+ }, _.state.next(m);
680
695
  }
681
- }, H = async (r) => {
682
- M(r, !0);
683
- const i = await s.resolver(l, s.context, cr(r || c.mount, a, s.criteriaMode, s.shouldUseNativeValidation));
684
- return M(r), i;
685
- }, re = async (r) => {
686
- const { errors: i } = await H(r);
696
+ }, j = async (r) => {
697
+ N(r, !0);
698
+ const a = await s.resolver(l, s.context, dr(r || d.mount, i, s.criteriaMode, s.shouldUseNativeValidation));
699
+ return N(r), a;
700
+ }, X = async (r) => {
701
+ const { errors: a } = await j(r);
687
702
  if (r)
688
703
  for (const n of r) {
689
- const h = y(i, n);
690
- h ? B(t.errors, n, h) : O(t.errors, n);
704
+ const h = y(a, n);
705
+ h ? B(t.errors, n, h) : I(t.errors, n);
691
706
  }
692
707
  else
693
- t.errors = i;
694
- return i;
695
- }, z = async (r, i, n = {
708
+ t.errors = a;
709
+ return a;
710
+ }, G = async (r, a, n = {
696
711
  valid: !0
697
712
  }) => {
698
713
  for (const h in r) {
@@ -700,231 +715,231 @@ function Vr(e = {}) {
700
715
  if (f) {
701
716
  const { _f: u, ...m } = f;
702
717
  if (u) {
703
- const A = c.array.has(u.name), E = f._f && fr(f._f);
704
- E && _.validatingFields && M([u.name], !0);
705
- const te = await yt(f, c.disabled, l, j, s.shouldUseNativeValidation && !i, A);
706
- if (E && _.validatingFields && M([u.name]), te[u.name] && (n.valid = !1, i))
718
+ const A = d.array.has(u.name), E = f._f && fr(f._f);
719
+ E && g.validatingFields && N([u.name], !0);
720
+ const re = await ht(f, d.disabled, l, ee, s.shouldUseNativeValidation && !a, A);
721
+ if (E && g.validatingFields && N([u.name]), re[u.name] && (n.valid = !1, a))
707
722
  break;
708
- !i && (y(te, u.name) ? A ? vr(t.errors, te, u.name) : B(t.errors, u.name, te[u.name]) : O(t.errors, u.name));
723
+ !a && (y(re, u.name) ? A ? vr(t.errors, re, u.name) : B(t.errors, u.name, re[u.name]) : I(t.errors, u.name));
709
724
  }
710
- !$(m) && await z(m, i, n);
725
+ !J(m) && await G(m, a, n);
711
726
  }
712
727
  }
713
728
  return n.valid;
714
- }, G = () => {
715
- for (const r of c.unMount) {
716
- const i = y(a, r);
717
- i && (i._f.refs ? i._f.refs.every((n) => !Oe(n)) : !Oe(i._f.ref)) && ve(r);
729
+ }, se = () => {
730
+ for (const r of d.unMount) {
731
+ const a = y(i, r);
732
+ a && (a._f.refs ? a._f.refs.every((n) => !Ue(n)) : !Ue(a._f.ref)) && K(r);
718
733
  }
719
- c.unMount = /* @__PURE__ */ new Set();
720
- }, Z = (r, i) => !s.disabled && (r && i && B(l, r, i), !le(ye(), o)), V = (r, i, n) => bt(r, c, {
721
- ...d.mount ? l : L(i) ? o : Q(r) ? { [r]: i } : i
722
- }, n, i), k = (r) => Ie(y(d.mount ? l : o, r, s.shouldUnregister ? y(o, r, []) : [])), C = (r, i, n = {}) => {
723
- const h = y(a, r);
724
- let f = i;
734
+ d.unMount = /* @__PURE__ */ new Set();
735
+ }, $ = (r, a) => !s.disabled && (r && a && B(l, r, a), !ae(fe(), o)), k = (r, a, n) => Ie(r, d, {
736
+ ...c.mount ? l : O(a) ? o : Y(r) ? { [r]: a } : a
737
+ }, n, a), p = (r) => He(y(c.mount ? l : o, r, s.shouldUnregister ? y(o, r, []) : [])), R = (r, a, n = {}) => {
738
+ const h = y(i, r);
739
+ let f = a;
725
740
  if (h) {
726
741
  const u = h._f;
727
- u && (!u.disabled && B(l, r, At(i, u)), f = Ce(u.ref) && K(i) ? "" : i, xt(u.ref) ? [...u.ref.options].forEach((m) => m.selected = f.includes(m.value)) : u.refs ? ke(u.ref) ? u.refs.forEach((m) => {
742
+ u && (!u.disabled && B(l, r, pt(a, u)), f = De(u.ref) && Q(a) ? "" : a, kt(u.ref) ? [...u.ref.options].forEach((m) => m.selected = f.includes(m.value)) : u.refs ? Fe(u.ref) ? u.refs.forEach((m) => {
728
743
  (!m.defaultChecked || !m.disabled) && (Array.isArray(f) ? m.checked = !!f.find((A) => A === m.value) : m.checked = f === m.value || !!f);
729
- }) : u.refs.forEach((m) => m.checked = m.value === f) : ze(u.ref) ? u.ref.value = "" : (u.ref.value = f, u.ref.type || g.state.next({
744
+ }) : u.refs.forEach((m) => m.checked = m.value === f) : Ge(u.ref) ? u.ref.value = "" : (u.ref.value = f, u.ref.type || _.state.next({
730
745
  name: r,
731
- values: P(l)
746
+ values: W(l)
732
747
  })));
733
748
  }
734
- (n.shouldDirty || n.shouldTouch) && w(r, f, n.shouldTouch, n.shouldDirty, !0), n.shouldValidate && ue(r);
735
- }, F = (r, i, n) => {
736
- for (const h in i) {
737
- if (!i.hasOwnProperty(h))
749
+ (n.shouldDirty || n.shouldTouch) && V(r, f, n.shouldTouch, n.shouldDirty, !0), n.shouldValidate && ne(r);
750
+ }, M = (r, a, n) => {
751
+ for (const h in a) {
752
+ if (!a.hasOwnProperty(h))
738
753
  return;
739
- const f = i[h], u = r + "." + h, m = y(a, u);
740
- (c.array.has(r) || N(f) || m && !m._f) && !fe(f) ? F(u, f, n) : C(u, f, n);
754
+ const f = a[h], u = r + "." + h, m = y(i, u);
755
+ (d.array.has(r) || P(f) || m && !m._f) && !ye(f) ? M(u, f, n) : R(u, f, n);
741
756
  }
742
- }, W = (r, i, n = {}) => {
743
- const h = y(a, r), f = c.array.has(r), u = P(i);
744
- B(l, r, u), f ? (g.array.next({
757
+ }, q = (r, a, n = {}) => {
758
+ const h = y(i, r), f = d.array.has(r), u = W(a);
759
+ B(l, r, u), f ? (_.array.next({
745
760
  name: r,
746
- values: P(l)
747
- }), (_.isDirty || _.dirtyFields || x.isDirty || x.dirtyFields) && n.shouldDirty && g.state.next({
761
+ values: W(l)
762
+ }), (g.isDirty || g.dirtyFields || x.isDirty || x.dirtyFields) && n.shouldDirty && _.state.next({
748
763
  name: r,
749
- dirtyFields: me(o, l),
750
- isDirty: Z(r, u)
751
- })) : h && !h._f && !K(u) ? F(r, u, n) : C(r, u, n), dt(r, c) && g.state.next({ ...t, name: r }), g.state.next({
752
- name: d.mount ? r : void 0,
753
- values: P(l)
764
+ dirtyFields: ge(o, l),
765
+ isDirty: $(r, u)
766
+ })) : h && !h._f && !Q(u) ? M(r, u, n) : R(r, u, n), dt(r, d) && _.state.next({ ...t, name: r }), _.state.next({
767
+ name: c.mount ? r : void 0,
768
+ values: W(l)
754
769
  });
755
- }, Y = async (r) => {
756
- d.mount = !0;
757
- const i = r.target;
758
- let n = i.name, h = !0;
759
- const f = y(a, n), u = (E) => {
760
- h = Number.isNaN(E) || fe(E) && isNaN(E.getTime()) || le(E, y(l, n, E));
761
- }, m = ot(s.mode), A = ot(s.reValidateMode);
770
+ }, T = async (r) => {
771
+ c.mount = !0;
772
+ const a = r.target;
773
+ let n = a.name, h = !0;
774
+ const f = y(i, n), u = (E) => {
775
+ h = Number.isNaN(E) || ye(E) && isNaN(E.getTime()) || ae(E, y(l, n, E));
776
+ }, m = ut(s.mode), A = ut(s.reValidateMode);
762
777
  if (f) {
763
- let E, te;
764
- const pe = i.type ? nt(f._f) : mt(r), de = r.type === we.BLUR || r.type === we.FOCUS_OUT, Et = !yr(f._f) && !s.resolver && !y(t.errors, n) && !f._f.deps || _r(de, y(t.touchedFields, n), t.isSubmitted, A, m), Le = dt(n, c, de);
765
- B(l, n, pe), de ? (!i || !i.readOnly) && (f._f.onBlur && f._f.onBlur(r), S && S(0)) : f._f.onChange && f._f.onChange(r);
766
- const Me = w(n, pe, de), Bt = !$(Me) || Le;
767
- if (!de && g.state.next({
778
+ let E, re;
779
+ const we = a.type ? ot(f._f) : _t(r), ce = r.type === Ce.BLUR || r.type === Ce.FOCUS_OUT, Et = !yr(f._f) && !s.resolver && !y(t.errors, n) && !f._f.deps || _r(ce, y(t.touchedFields, n), t.isSubmitted, A, m), Le = dt(n, d, ce);
780
+ B(l, n, we), ce ? (!a || !a.readOnly) && (f._f.onBlur && f._f.onBlur(r), D && D(0)) : f._f.onChange && f._f.onChange(r);
781
+ const Oe = V(n, we, ce), Bt = !J(Oe) || Le;
782
+ if (!ce && _.state.next({
768
783
  name: n,
769
784
  type: r.type,
770
- values: P(l)
785
+ values: W(l)
771
786
  }), Et)
772
- return (_.isValid || x.isValid) && (s.mode === "onBlur" ? de && p() : de || p()), Bt && g.state.next({ name: n, ...Le ? {} : Me });
773
- if (!de && Le && g.state.next({ ...t }), s.resolver) {
774
- const { errors: Qe } = await H([n]);
775
- if (u(pe), h) {
776
- const Tt = ct(t.errors, a, n), Xe = ct(Qe, a, Tt.name || n);
777
- E = Xe.error, n = Xe.name, te = $(Qe);
787
+ return (g.isValid || x.isValid) && (s.mode === "onBlur" ? ce && S() : ce || S()), Bt && _.state.next({ name: n, ...Le ? {} : Oe });
788
+ if (!ce && Le && _.state.next({ ...t }), s.resolver) {
789
+ const { errors: Ye } = await j([n]);
790
+ if (u(we), h) {
791
+ const Tt = ft(t.errors, i, n), et = ft(Ye, i, Tt.name || n);
792
+ E = et.error, n = et.name, re = J(Ye);
778
793
  }
779
794
  } else
780
- M([n], !0), E = (await yt(f, c.disabled, l, j, s.shouldUseNativeValidation))[n], M([n]), u(pe), h && (E ? te = !1 : (_.isValid || x.isValid) && (te = await z(a, !0)));
781
- h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ue(f._f.deps), X(n, te, E, Me));
795
+ N([n], !0), E = (await ht(f, d.disabled, l, ee, s.shouldUseNativeValidation))[n], N([n]), u(we), h && (E ? re = !1 : (g.isValid || x.isValid) && (re = await G(i, !0)));
796
+ h && (f._f.deps && (!Array.isArray(f._f.deps) || f._f.deps.length > 0) && ne(f._f.deps), z(n, re, E, Oe));
782
797
  }
783
- }, oe = (r, i) => {
784
- if (y(t.errors, i) && r.focus)
798
+ }, ue = (r, a) => {
799
+ if (y(t.errors, a) && r.focus)
785
800
  return r.focus(), 1;
786
- }, ue = async (r, i = {}) => {
801
+ }, ne = async (r, a = {}) => {
787
802
  let n, h;
788
- const f = Ve(r);
803
+ const f = ke(r);
789
804
  if (s.resolver) {
790
- const u = await re(L(r) ? r : f);
791
- n = $(u), h = r ? !f.some((m) => y(u, m)) : n;
805
+ const u = await X(O(r) ? r : f);
806
+ n = J(u), h = r ? !f.some((m) => y(u, m)) : n;
792
807
  } else r ? (h = (await Promise.all(f.map(async (u) => {
793
- const m = y(a, u);
794
- return await z(m && m._f ? { [u]: m } : m);
795
- }))).every(Boolean), !(!h && !t.isValid) && p()) : h = n = await z(a);
796
- return g.state.next({
797
- ...!Q(r) || (_.isValid || x.isValid) && n !== t.isValid ? {} : { name: r },
808
+ const m = y(i, u);
809
+ return await G(m && m._f ? { [u]: m } : m);
810
+ }))).every(Boolean), !(!h && !t.isValid) && S()) : h = n = await G(i);
811
+ return _.state.next({
812
+ ...!Y(r) || (g.isValid || x.isValid) && n !== t.isValid ? {} : { name: r },
798
813
  ...s.resolver || !r ? { isValid: n } : {},
799
814
  errors: t.errors
800
- }), i.shouldFocus && !h && xe(a, oe, r ? f : c.mount), h;
801
- }, ye = (r, i) => {
815
+ }), a.shouldFocus && !h && xe(i, ue, r ? f : d.mount), h;
816
+ }, fe = (r, a) => {
802
817
  let n = {
803
- ...d.mount ? l : o
818
+ ...c.mount ? l : o
804
819
  };
805
- return i && (n = Vt(i.dirtyFields ? t.dirtyFields : t.touchedFields, n)), L(r) ? n : Q(r) ? y(n, r) : r.map((h) => y(n, h));
806
- }, Fe = (r, i) => ({
807
- invalid: !!y((i || t).errors, r),
808
- isDirty: !!y((i || t).dirtyFields, r),
809
- error: y((i || t).errors, r),
820
+ return a && (n = Vt(a.dirtyFields ? t.dirtyFields : t.touchedFields, n)), O(r) ? n : Y(r) ? y(n, r) : r.map((h) => y(n, h));
821
+ }, pe = (r, a) => ({
822
+ invalid: !!y((a || t).errors, r),
823
+ isDirty: !!y((a || t).dirtyFields, r),
824
+ error: y((a || t).errors, r),
810
825
  isValidating: !!y(t.validatingFields, r),
811
- isTouched: !!y((i || t).touchedFields, r)
812
- }), Ee = (r) => {
813
- r && Ve(r).forEach((i) => O(t.errors, i)), g.state.next({
826
+ isTouched: !!y((a || t).touchedFields, r)
827
+ }), Be = (r) => {
828
+ r && ke(r).forEach((a) => I(t.errors, a)), _.state.next({
814
829
  errors: r ? t.errors : {}
815
830
  });
816
- }, Ae = (r, i, n) => {
817
- const h = (y(a, r, { _f: {} })._f || {}).ref, f = y(t.errors, r) || {}, { ref: u, message: m, type: A, ...E } = f;
831
+ }, he = (r, a, n) => {
832
+ const h = (y(i, r, { _f: {} })._f || {}).ref, f = y(t.errors, r) || {}, { ref: u, message: m, type: A, ...E } = f;
818
833
  B(t.errors, r, {
819
834
  ...E,
820
- ...i,
835
+ ...a,
821
836
  ref: h
822
- }), g.state.next({
837
+ }), _.state.next({
823
838
  name: r,
824
839
  errors: t.errors,
825
840
  isValid: !1
826
841
  }), n && n.shouldFocus && h && h.focus && h.focus();
827
- }, _e = (r, i) => ie(r) ? g.state.subscribe({
828
- next: (n) => "values" in n && r(V(void 0, i), n)
829
- }) : V(r, i, !0), ee = (r) => g.state.subscribe({
830
- next: (i) => {
831
- mr(r.name, i.name, r.exact) && hr(i, r.formState || _, Dt, r.reRenderRoot) && r.callback({
842
+ }, Te = (r, a) => le(r) ? _.state.subscribe({
843
+ next: (n) => "values" in n && r(k(void 0, a), n)
844
+ }) : k(r, a, !0), Ae = (r) => _.state.subscribe({
845
+ next: (a) => {
846
+ mr(r.name, a.name, r.exact) && hr(a, r.formState || g, St, r.reRenderRoot) && r.callback({
832
847
  values: { ...l },
833
848
  ...t,
834
- ...i,
849
+ ...a,
835
850
  defaultValues: o
836
851
  });
837
852
  }
838
- }).unsubscribe, ge = (r) => (d.mount = !0, x = {
853
+ }).unsubscribe, ve = (r) => (c.mount = !0, x = {
839
854
  ...x,
840
855
  ...r.formState
841
- }, ee({
856
+ }, Ae({
842
857
  ...r,
843
858
  formState: x
844
- })), ve = (r, i = {}) => {
845
- for (const n of r ? Ve(r) : c.mount)
846
- c.mount.delete(n), c.array.delete(n), i.keepValue || (O(a, n), O(l, n)), !i.keepError && O(t.errors, n), !i.keepDirty && O(t.dirtyFields, n), !i.keepTouched && O(t.touchedFields, n), !i.keepIsValidating && O(t.validatingFields, n), !s.shouldUnregister && !i.keepDefaultValue && O(o, n);
847
- g.state.next({
848
- values: P(l)
849
- }), g.state.next({
859
+ })), K = (r, a = {}) => {
860
+ for (const n of r ? ke(r) : d.mount)
861
+ d.mount.delete(n), d.array.delete(n), a.keepValue || (I(i, n), I(l, n)), !a.keepError && I(t.errors, n), !a.keepDirty && I(t.dirtyFields, n), !a.keepTouched && I(t.touchedFields, n), !a.keepIsValidating && I(t.validatingFields, n), !s.shouldUnregister && !a.keepDefaultValue && I(o, n);
862
+ _.state.next({
863
+ values: W(l)
864
+ }), _.state.next({
850
865
  ...t,
851
- ...i.keepDirty ? { isDirty: Z() } : {}
852
- }), !i.keepIsValid && p();
853
- }, Ke = ({ disabled: r, name: i }) => {
854
- (J(r) && d.mount || r || c.disabled.has(i)) && (r ? c.disabled.add(i) : c.disabled.delete(i));
855
- }, Be = (r, i = {}) => {
856
- let n = y(a, r);
857
- const h = J(i.disabled) || J(s.disabled);
858
- return B(a, r, {
866
+ ...a.keepDirty ? { isDirty: $() } : {}
867
+ }), !a.keepIsValid && S();
868
+ }, me = ({ disabled: r, name: a }) => {
869
+ (Z(r) && c.mount || r || d.disabled.has(a)) && (r ? d.disabled.add(a) : d.disabled.delete(a));
870
+ }, be = (r, a = {}) => {
871
+ let n = y(i, r);
872
+ const h = Z(a.disabled) || Z(s.disabled);
873
+ return B(i, r, {
859
874
  ...n || {},
860
875
  _f: {
861
876
  ...n && n._f ? n._f : { ref: { name: r } },
862
877
  name: r,
863
878
  mount: !0,
864
- ...i
879
+ ...a
865
880
  }
866
- }), c.mount.add(r), n ? Ke({
867
- disabled: J(i.disabled) ? i.disabled : s.disabled,
881
+ }), d.mount.add(r), n ? me({
882
+ disabled: Z(a.disabled) ? a.disabled : s.disabled,
868
883
  name: r
869
- }) : U(r, !0, i.value), {
870
- ...h ? { disabled: i.disabled || s.disabled } : {},
884
+ }) : F(r, !0, a.value), {
885
+ ...h ? { disabled: a.disabled || s.disabled } : {},
871
886
  ...s.progressive ? {
872
- required: !!i.required,
873
- min: be(i.min),
874
- max: be(i.max),
875
- minLength: be(i.minLength),
876
- maxLength: be(i.maxLength),
877
- pattern: be(i.pattern)
887
+ required: !!a.required,
888
+ min: Ve(a.min),
889
+ max: Ve(a.max),
890
+ minLength: Ve(a.minLength),
891
+ maxLength: Ve(a.maxLength),
892
+ pattern: Ve(a.pattern)
878
893
  } : {},
879
894
  name: r,
880
- onChange: Y,
881
- onBlur: Y,
895
+ onChange: T,
896
+ onBlur: T,
882
897
  ref: (f) => {
883
898
  if (f) {
884
- Be(r, i), n = y(a, r);
885
- const u = L(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m = nr(u), A = n._f.refs || [];
899
+ be(r, a), n = y(i, r);
900
+ const u = O(f.value) && f.querySelectorAll && f.querySelectorAll("input,select,textarea")[0] || f, m = nr(u), A = n._f.refs || [];
886
901
  if (m ? A.find((E) => E === u) : u === n._f.ref)
887
902
  return;
888
- B(a, r, {
903
+ B(i, r, {
889
904
  _f: {
890
905
  ...n._f,
891
906
  ...m ? {
892
907
  refs: [
893
- ...A.filter(Oe),
908
+ ...A.filter(Ue),
894
909
  u,
895
910
  ...Array.isArray(y(o, r)) ? [{}] : []
896
911
  ],
897
912
  ref: { type: u.type, name: r }
898
913
  } : { ref: u }
899
914
  }
900
- }), U(r, !1, void 0, u);
915
+ }), F(r, !1, void 0, u);
901
916
  } else
902
- n = y(a, r, {}), n._f && (n._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(_t(c.array, r) && d.action) && c.unMount.add(r);
917
+ n = y(i, r, {}), n._f && (n._f.mount = !1), (s.shouldUnregister || a.shouldUnregister) && !(gt(d.array, r) && c.action) && d.unMount.add(r);
903
918
  }
904
919
  };
905
- }, Te = () => s.shouldFocusError && xe(a, oe, c.mount), wt = (r) => {
906
- J(r) && (g.state.next({ disabled: r }), xe(a, (i, n) => {
907
- const h = y(a, n);
908
- h && (i.disabled = h._f.disabled || r, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
920
+ }, Re = () => s.shouldFocusError && xe(i, ue, d.mount), wt = (r) => {
921
+ Z(r) && (_.state.next({ disabled: r }), xe(i, (a, n) => {
922
+ const h = y(i, n);
923
+ h && (a.disabled = h._f.disabled || r, Array.isArray(h._f.refs) && h._f.refs.forEach((f) => {
909
924
  f.disabled = h._f.disabled || r;
910
925
  }));
911
926
  }, 0, !1));
912
- }, je = (r, i) => async (n) => {
927
+ }, Je = (r, a) => async (n) => {
913
928
  let h;
914
929
  n && (n.preventDefault && n.preventDefault(), n.persist && n.persist());
915
- let f = P(l);
916
- if (g.state.next({
930
+ let f = W(l);
931
+ if (_.state.next({
917
932
  isSubmitting: !0
918
933
  }), s.resolver) {
919
- const { errors: u, values: m } = await H();
920
- t.errors = u, f = P(m);
934
+ const { errors: u, values: m } = await j();
935
+ t.errors = u, f = W(m);
921
936
  } else
922
- await z(a);
923
- if (c.disabled.size)
924
- for (const u of c.disabled)
925
- O(f, u);
926
- if (O(t.errors, "root"), $(t.errors)) {
927
- g.state.next({
937
+ await G(i);
938
+ if (d.disabled.size)
939
+ for (const u of d.disabled)
940
+ I(f, u);
941
+ if (I(t.errors, "root"), J(t.errors)) {
942
+ _.state.next({
928
943
  errors: {}
929
944
  });
930
945
  try {
@@ -933,131 +948,131 @@ function Vr(e = {}) {
933
948
  h = u;
934
949
  }
935
950
  } else
936
- i && await i({ ...t.errors }, n), Te(), setTimeout(Te);
937
- if (g.state.next({
951
+ a && await a({ ...t.errors }, n), Re(), setTimeout(Re);
952
+ if (_.state.next({
938
953
  isSubmitted: !0,
939
954
  isSubmitting: !1,
940
- isSubmitSuccessful: $(t.errors) && !h,
955
+ isSubmitSuccessful: J(t.errors) && !h,
941
956
  submitCount: t.submitCount + 1,
942
957
  errors: t.errors
943
958
  }), h)
944
959
  throw h;
945
- }, Ct = (r, i = {}) => {
946
- y(a, r) && (L(i.defaultValue) ? W(r, P(y(o, r))) : (W(r, i.defaultValue), B(o, r, P(i.defaultValue))), i.keepTouched || O(t.touchedFields, r), i.keepDirty || (O(t.dirtyFields, r), t.isDirty = i.defaultValue ? Z(r, P(y(o, r))) : Z()), i.keepError || (O(t.errors, r), _.isValid && p()), g.state.next({ ...t }));
947
- }, Ge = (r, i = {}) => {
948
- const n = r ? P(r) : o, h = P(n), f = $(r), u = f ? o : h;
949
- if (i.keepDefaultValues || (o = n), !i.keepValues) {
950
- if (i.keepDirtyValues) {
960
+ }, Ct = (r, a = {}) => {
961
+ y(i, r) && (O(a.defaultValue) ? q(r, W(y(o, r))) : (q(r, a.defaultValue), B(o, r, W(a.defaultValue))), a.keepTouched || I(t.touchedFields, r), a.keepDirty || (I(t.dirtyFields, r), t.isDirty = a.defaultValue ? $(r, W(y(o, r))) : $()), a.keepError || (I(t.errors, r), g.isValid && S()), _.state.next({ ...t }));
962
+ }, Qe = (r, a = {}) => {
963
+ const n = r ? W(r) : o, h = W(n), f = J(r), u = f ? o : h;
964
+ if (a.keepDefaultValues || (o = n), !a.keepValues) {
965
+ if (a.keepDirtyValues) {
951
966
  const m = /* @__PURE__ */ new Set([
952
- ...c.mount,
953
- ...Object.keys(me(o, l))
967
+ ...d.mount,
968
+ ...Object.keys(ge(o, l))
954
969
  ]);
955
970
  for (const A of Array.from(m))
956
- y(t.dirtyFields, A) ? B(u, A, y(l, A)) : W(A, y(u, A));
971
+ y(t.dirtyFields, A) ? B(u, A, y(l, A)) : q(A, y(u, A));
957
972
  } else {
958
- if (Pe && L(r))
959
- for (const m of c.mount) {
960
- const A = y(a, m);
973
+ if (qe && O(r))
974
+ for (const m of d.mount) {
975
+ const A = y(i, m);
961
976
  if (A && A._f) {
962
977
  const E = Array.isArray(A._f.refs) ? A._f.refs[0] : A._f.ref;
963
- if (Ce(E)) {
964
- const te = E.closest("form");
965
- if (te) {
966
- te.reset();
978
+ if (De(E)) {
979
+ const re = E.closest("form");
980
+ if (re) {
981
+ re.reset();
967
982
  break;
968
983
  }
969
984
  }
970
985
  }
971
986
  }
972
- if (i.keepFieldsRef)
973
- for (const m of c.mount)
974
- W(m, y(u, m));
987
+ if (a.keepFieldsRef)
988
+ for (const m of d.mount)
989
+ q(m, y(u, m));
975
990
  else
976
- a = {};
991
+ i = {};
977
992
  }
978
- l = s.shouldUnregister ? i.keepDefaultValues ? P(o) : {} : P(u), g.array.next({
993
+ l = s.shouldUnregister ? a.keepDefaultValues ? W(o) : {} : W(u), _.array.next({
979
994
  values: { ...u }
980
- }), g.state.next({
995
+ }), _.state.next({
981
996
  values: { ...u }
982
997
  });
983
998
  }
984
- c = {
985
- mount: i.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
999
+ d = {
1000
+ mount: a.keepDirtyValues ? d.mount : /* @__PURE__ */ new Set(),
986
1001
  unMount: /* @__PURE__ */ new Set(),
987
1002
  array: /* @__PURE__ */ new Set(),
988
1003
  disabled: /* @__PURE__ */ new Set(),
989
1004
  watch: /* @__PURE__ */ new Set(),
990
1005
  watchAll: !1,
991
1006
  focus: ""
992
- }, d.mount = !_.isValid || !!i.keepIsValid || !!i.keepDirtyValues, d.watch = !!s.shouldUnregister, g.state.next({
993
- submitCount: i.keepSubmitCount ? t.submitCount : 0,
994
- isDirty: f ? !1 : i.keepDirty ? t.isDirty : !!(i.keepDefaultValues && !le(r, o)),
995
- isSubmitted: i.keepIsSubmitted ? t.isSubmitted : !1,
996
- dirtyFields: f ? {} : i.keepDirtyValues ? i.keepDefaultValues && l ? me(o, l) : t.dirtyFields : i.keepDefaultValues && r ? me(o, r) : i.keepDirty ? t.dirtyFields : {},
997
- touchedFields: i.keepTouched ? t.touchedFields : {},
998
- errors: i.keepErrors ? t.errors : {},
999
- isSubmitSuccessful: i.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1007
+ }, c.mount = !g.isValid || !!a.keepIsValid || !!a.keepDirtyValues || !s.shouldUnregister && !J(u), c.watch = !!s.shouldUnregister, _.state.next({
1008
+ submitCount: a.keepSubmitCount ? t.submitCount : 0,
1009
+ isDirty: f ? !1 : a.keepDirty ? t.isDirty : !!(a.keepDefaultValues && !ae(r, o)),
1010
+ isSubmitted: a.keepIsSubmitted ? t.isSubmitted : !1,
1011
+ dirtyFields: f ? {} : a.keepDirtyValues ? a.keepDefaultValues && l ? ge(o, l) : t.dirtyFields : a.keepDefaultValues && r ? ge(o, r) : a.keepDirty ? t.dirtyFields : {},
1012
+ touchedFields: a.keepTouched ? t.touchedFields : {},
1013
+ errors: a.keepErrors ? t.errors : {},
1014
+ isSubmitSuccessful: a.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1000
1015
  isSubmitting: !1,
1001
1016
  defaultValues: o
1002
1017
  });
1003
- }, Ye = (r, i) => Ge(ie(r) ? r(l) : r, i), St = (r, i = {}) => {
1004
- const n = y(a, r), h = n && n._f;
1018
+ }, Xe = (r, a) => Qe(le(r) ? r(l) : r, a), Dt = (r, a = {}) => {
1019
+ const n = y(i, r), h = n && n._f;
1005
1020
  if (h) {
1006
1021
  const f = h.refs ? h.refs[0] : h.ref;
1007
- f.focus && (f.focus(), i.shouldSelect && ie(f.select) && f.select());
1022
+ f.focus && (f.focus(), a.shouldSelect && le(f.select) && f.select());
1008
1023
  }
1009
- }, Dt = (r) => {
1024
+ }, St = (r) => {
1010
1025
  t = {
1011
1026
  ...t,
1012
1027
  ...r
1013
1028
  };
1014
- }, Je = {
1029
+ }, Ze = {
1015
1030
  control: {
1016
- register: Be,
1017
- unregister: ve,
1018
- getFieldState: Fe,
1019
- handleSubmit: je,
1020
- setError: Ae,
1021
- _subscribe: ee,
1022
- _runSchema: H,
1023
- _focusError: Te,
1024
- _getWatch: V,
1025
- _getDirty: Z,
1026
- _setValid: p,
1027
- _setFieldArray: ne,
1028
- _setDisabledField: Ke,
1029
- _setErrors: T,
1030
- _getFieldArray: k,
1031
- _reset: Ge,
1032
- _resetDefaultValues: () => ie(s.defaultValues) && s.defaultValues().then((r) => {
1033
- Ye(r, s.resetOptions), g.state.next({
1031
+ register: be,
1032
+ unregister: K,
1033
+ getFieldState: pe,
1034
+ handleSubmit: Je,
1035
+ setError: he,
1036
+ _subscribe: Ae,
1037
+ _runSchema: j,
1038
+ _focusError: Re,
1039
+ _getWatch: k,
1040
+ _getDirty: $,
1041
+ _setValid: S,
1042
+ _setFieldArray: te,
1043
+ _setDisabledField: me,
1044
+ _setErrors: C,
1045
+ _getFieldArray: p,
1046
+ _reset: Qe,
1047
+ _resetDefaultValues: () => le(s.defaultValues) && s.defaultValues().then((r) => {
1048
+ Xe(r, s.resetOptions), _.state.next({
1034
1049
  isLoading: !1
1035
1050
  });
1036
1051
  }),
1037
- _removeUnmounted: G,
1052
+ _removeUnmounted: se,
1038
1053
  _disableForm: wt,
1039
- _subjects: g,
1040
- _proxyFormState: _,
1054
+ _subjects: _,
1055
+ _proxyFormState: g,
1041
1056
  get _fields() {
1042
- return a;
1057
+ return i;
1043
1058
  },
1044
1059
  get _formValues() {
1045
1060
  return l;
1046
1061
  },
1047
1062
  get _state() {
1048
- return d;
1063
+ return c;
1049
1064
  },
1050
1065
  set _state(r) {
1051
- d = r;
1066
+ c = r;
1052
1067
  },
1053
1068
  get _defaultValues() {
1054
1069
  return o;
1055
1070
  },
1056
1071
  get _names() {
1057
- return c;
1072
+ return d;
1058
1073
  },
1059
1074
  set _names(r) {
1060
- c = r;
1075
+ d = r;
1061
1076
  },
1062
1077
  get _formState() {
1063
1078
  return t;
@@ -1072,31 +1087,31 @@ function Vr(e = {}) {
1072
1087
  };
1073
1088
  }
1074
1089
  },
1075
- subscribe: ge,
1076
- trigger: ue,
1077
- register: Be,
1078
- handleSubmit: je,
1079
- watch: _e,
1080
- setValue: W,
1081
- getValues: ye,
1082
- reset: Ye,
1090
+ subscribe: ve,
1091
+ trigger: ne,
1092
+ register: be,
1093
+ handleSubmit: Je,
1094
+ watch: Te,
1095
+ setValue: q,
1096
+ getValues: fe,
1097
+ reset: Xe,
1083
1098
  resetField: Ct,
1084
- clearErrors: Ee,
1085
- unregister: ve,
1086
- setError: Ae,
1087
- setFocus: St,
1088
- getFieldState: Fe
1099
+ clearErrors: Be,
1100
+ unregister: K,
1101
+ setError: he,
1102
+ setFocus: Dt,
1103
+ getFieldState: pe
1089
1104
  };
1090
1105
  return {
1091
- ...Je,
1092
- formControl: Je
1106
+ ...Ze,
1107
+ formControl: Ze
1093
1108
  };
1094
1109
  }
1095
- function xr(e = {}) {
1096
- const s = b.useRef(void 0), t = b.useRef(void 0), [a, o] = b.useState({
1110
+ function kr(e = {}) {
1111
+ const s = v.useRef(void 0), t = v.useRef(void 0), [i, o] = v.useState({
1097
1112
  isDirty: !1,
1098
1113
  isValidating: !1,
1099
- isLoading: ie(e.defaultValues),
1114
+ isLoading: le(e.defaultValues),
1100
1115
  isSubmitted: !1,
1101
1116
  isSubmitting: !1,
1102
1117
  isSubmitSuccessful: !1,
@@ -1108,283 +1123,351 @@ function xr(e = {}) {
1108
1123
  errors: e.errors || {},
1109
1124
  disabled: e.disabled || !1,
1110
1125
  isReady: !1,
1111
- defaultValues: ie(e.defaultValues) ? void 0 : e.defaultValues
1126
+ defaultValues: le(e.defaultValues) ? void 0 : e.defaultValues
1112
1127
  });
1113
1128
  if (!s.current)
1114
1129
  if (e.formControl)
1115
1130
  s.current = {
1116
1131
  ...e.formControl,
1117
- formState: a
1118
- }, e.defaultValues && !ie(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1132
+ formState: i
1133
+ }, e.defaultValues && !le(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions);
1119
1134
  else {
1120
- const { formControl: d, ...c } = Vr(e);
1135
+ const { formControl: c, ...d } = Vr(e);
1121
1136
  s.current = {
1122
- ...c,
1123
- formState: a
1137
+ ...d,
1138
+ formState: i
1124
1139
  };
1125
1140
  }
1126
1141
  const l = s.current.control;
1127
- return l._options = e, He(() => {
1128
- const d = l._subscribe({
1142
+ return l._options = e, je(() => {
1143
+ const c = l._subscribe({
1129
1144
  formState: l._proxyFormState,
1130
1145
  callback: () => o({ ...l._formState }),
1131
1146
  reRenderRoot: !0
1132
1147
  });
1133
- return o((c) => ({
1134
- ...c,
1148
+ return o((d) => ({
1149
+ ...d,
1135
1150
  isReady: !0
1136
- })), l._formState.isReady = !0, d;
1137
- }, [l]), b.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), b.useEffect(() => {
1151
+ })), l._formState.isReady = !0, c;
1152
+ }, [l]), v.useEffect(() => l._disableForm(e.disabled), [l, e.disabled]), v.useEffect(() => {
1138
1153
  e.mode && (l._options.mode = e.mode), e.reValidateMode && (l._options.reValidateMode = e.reValidateMode);
1139
- }, [l, e.mode, e.reValidateMode]), b.useEffect(() => {
1154
+ }, [l, e.mode, e.reValidateMode]), v.useEffect(() => {
1140
1155
  e.errors && (l._setErrors(e.errors), l._focusError());
1141
- }, [l, e.errors]), b.useEffect(() => {
1156
+ }, [l, e.errors]), v.useEffect(() => {
1142
1157
  e.shouldUnregister && l._subjects.state.next({
1143
1158
  values: l._getWatch()
1144
1159
  });
1145
- }, [l, e.shouldUnregister]), b.useEffect(() => {
1160
+ }, [l, e.shouldUnregister]), v.useEffect(() => {
1146
1161
  if (l._proxyFormState.isDirty) {
1147
- const d = l._getDirty();
1148
- d !== a.isDirty && l._subjects.state.next({
1149
- isDirty: d
1162
+ const c = l._getDirty();
1163
+ c !== i.isDirty && l._subjects.state.next({
1164
+ isDirty: c
1150
1165
  });
1151
1166
  }
1152
- }, [l, a.isDirty]), b.useEffect(() => {
1153
- e.values && !le(e.values, t.current) ? (l._reset(e.values, {
1167
+ }, [l, i.isDirty]), v.useEffect(() => {
1168
+ e.values && !ae(e.values, t.current) ? (l._reset(e.values, {
1154
1169
  keepFieldsRef: !0,
1155
1170
  ...l._options.resetOptions
1156
- }), t.current = e.values, o((d) => ({ ...d }))) : l._resetDefaultValues();
1157
- }, [l, e.values]), b.useEffect(() => {
1171
+ }), t.current = e.values, o((c) => ({ ...c }))) : l._resetDefaultValues();
1172
+ }, [l, e.values]), v.useEffect(() => {
1158
1173
  l._state.mount || (l._setValid(), l._state.mount = !0), l._state.watch && (l._state.watch = !1, l._subjects.state.next({ ...l._formState })), l._removeUnmounted();
1159
- }), s.current.formState = vt(a, l), s.current;
1174
+ }), s.current.formState = bt(i, l), s.current;
1160
1175
  }
1161
- const kr = Nt.bind(I), Fr = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", Nr = ({
1176
+ var xr = /* @__PURE__ */ ((e) => (e.PRIVACY_POLICY = "privacy-policy", e.PERSONAL_DATA = "personal-data", e.MAILING = "mailing", e.STONE_VALUE = "stone-value", e))(xr || {});
1177
+ const Fr = Nt.bind(U), pr = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", Ur = ({
1162
1178
  isFormOpen: e,
1163
1179
  setIsFormOpen: s,
1164
1180
  isNews: t,
1165
- title: a,
1181
+ title: i,
1166
1182
  isEmail: o,
1167
1183
  isPhone: l,
1168
- isTextArea: d,
1169
- telegramLink: c = "https://t.me/stone_developer",
1170
- isRequiredPhone: S = !0,
1171
- isRequiredEmail: D = !1,
1172
- isRequiredPhoneOrEmail: _,
1184
+ isTextArea: c,
1185
+ telegramLink: d = "https://t.me/stone_developer",
1186
+ isRequiredPhone: D = !0,
1187
+ isRequiredEmail: w = !1,
1188
+ isRequiredPhoneOrEmail: g,
1173
1189
  textAreaPlaceholder: x,
1174
- subTitle: g,
1175
- submitHandler: j,
1176
- modalWidth: q = "442px",
1177
- rowsTextArea: p = 2,
1178
- advCheckBox: M = { text: Fr, isRequired: !0 },
1179
- isAdvCheckBox: ne,
1180
- addTitleClassName: v,
1181
- createPortalObj: T,
1182
- telegramClickHandler: U = () => null,
1183
- blurHandler: w,
1184
- handlerButton: X,
1185
- block_name: H,
1186
- emitCheckBox: re,
1187
- emitAdvCheckBox: z
1190
+ subTitle: _,
1191
+ submitHandler: ee,
1192
+ modalWidth: H = "442px",
1193
+ rowsTextArea: S = 2,
1194
+ advCheckBox: N = { text: pr, isRequired: !0 },
1195
+ isAdvCheckBox: te,
1196
+ addTitleClassName: b,
1197
+ createPortalObj: C,
1198
+ telegramClickHandler: F = () => null,
1199
+ blurHandler: V,
1200
+ handlerButton: z,
1201
+ block_name: j,
1202
+ policiesMap: X,
1203
+ emitCheckBox: G,
1204
+ emitAdvCheckBox: se
1188
1205
  }) => {
1189
1206
  const {
1190
- register: G,
1191
- handleSubmit: Z,
1192
- reset: V,
1193
- control: k,
1194
- watch: C,
1195
- formState: { errors: F }
1196
- } = xr(), W = !!C("email"), Y = C("personalCheckBox"), oe = C("advCheckBox");
1197
- Ze(() => {
1198
- typeof Y < "u" && re && re();
1199
- }, [re, Y]), Ze(() => {
1200
- typeof oe < "u" && z && z();
1201
- }, [z, oe]);
1202
- const { isMobile: ue, currentClientWidth: ye } = Ut(), Fe = C("personalCheckBox"), Ee = C("advCheckBox"), Ae = (ee) => {
1203
- j(ee), V();
1204
- }, _e = (ee, { action_element_status: ge, action_element: ve }) => {
1205
- w && w({
1206
- e: ee,
1207
- analyticParams: { action_element: ve, action_element_status: ge, block_name: H }
1207
+ register: $,
1208
+ handleSubmit: k,
1209
+ reset: p,
1210
+ control: R,
1211
+ watch: M,
1212
+ setValue: q,
1213
+ formState: { errors: T }
1214
+ } = kr(), ue = !!M("email"), ne = M("personalCheckBox"), fe = M("advCheckBox");
1215
+ Me(() => {
1216
+ typeof ne < "u" && G && G();
1217
+ }, [G, ne]), Me(() => {
1218
+ typeof fe < "u" && se && se();
1219
+ }, [se, fe]);
1220
+ const { isMobile: pe, currentClientWidth: Be } = Ut(), he = M("personalCheckBox"), Te = M("advCheckBox"), Ae = (K) => {
1221
+ ee(K), p();
1222
+ }, ve = (K, { action_element_status: me, action_element: be }) => {
1223
+ V && V({
1224
+ e: K,
1225
+ analyticParams: { action_element: be, action_element_status: me, block_name: j }
1208
1226
  });
1209
1227
  };
1210
- return ye ? /* @__PURE__ */ R(
1211
- Pt,
1228
+ return Me(() => {
1229
+ const K = ["personal-data", "privacy-policy", ...t ? [
1230
+ "mailing"
1231
+ /* MAILING */
1232
+ ] : []];
1233
+ he ? q(
1234
+ "policy-slug",
1235
+ K.join(", "),
1236
+ { shouldDirty: !0 }
1237
+ ) : q("policy-slug", "", { shouldDirty: !0 });
1238
+ }, [he]), Be ? /* @__PURE__ */ L(
1239
+ It,
1212
1240
  {
1213
- additionalClass: I.modal,
1214
- additionalClassModalBody: I.modalBody,
1215
- createPortalObj: T,
1241
+ additionalClass: U.modal,
1242
+ additionalClassModalBody: U.modalBody,
1243
+ createPortalObj: C,
1216
1244
  isOpen: e,
1217
1245
  isTransparentBack: !0,
1218
1246
  emitIsOpen: () => s(!1),
1219
1247
  opacity: 0.7,
1220
- children: /* @__PURE__ */ ce(
1248
+ children: /* @__PURE__ */ de(
1221
1249
  "div",
1222
1250
  {
1223
- className: I.root,
1224
- style: { width: ue ? "100%" : q },
1251
+ className: U.root,
1252
+ style: { width: pe ? "100%" : H },
1225
1253
  "data-testid": "modal_window",
1226
1254
  children: [
1227
- /* @__PURE__ */ R(
1255
+ /* @__PURE__ */ L(
1228
1256
  "div",
1229
1257
  {
1230
- className: kr(I.title, v),
1231
- dangerouslySetInnerHTML: { __html: a ?? "Оставить обращение" }
1258
+ className: Fr(U.title, b),
1259
+ dangerouslySetInnerHTML: { __html: i ?? "Оставить обращение" }
1232
1260
  }
1233
1261
  ),
1234
- t && /* @__PURE__ */ ce("div", { className: I.telegramWrapper, children: [
1235
- /* @__PURE__ */ R(
1262
+ t && /* @__PURE__ */ de("div", { className: U.telegramWrapper, children: [
1263
+ /* @__PURE__ */ L(
1236
1264
  "a",
1237
1265
  {
1238
- className: I.telegramLink,
1239
- href: c,
1266
+ className: U.telegramLink,
1267
+ href: d,
1240
1268
  target: "_blank",
1241
1269
  "data-testid": "modal_telegram_link",
1242
- children: /* @__PURE__ */ ce(
1270
+ children: /* @__PURE__ */ de(
1243
1271
  "div",
1244
1272
  {
1245
- className: I.telegram,
1246
- onClick: U,
1273
+ className: U.telegram,
1274
+ onClick: F,
1247
1275
  children: [
1248
- /* @__PURE__ */ R("div", { children: "Подписаться в Telegram" }),
1249
- /* @__PURE__ */ R(et, { name: "telegram" })
1276
+ /* @__PURE__ */ L("div", { children: "Подписаться в Telegram" }),
1277
+ /* @__PURE__ */ L(tt, { name: "telegram" })
1250
1278
  ]
1251
1279
  }
1252
1280
  )
1253
1281
  }
1254
1282
  ),
1255
- /* @__PURE__ */ R("div", { className: I.orText, children: "или" })
1283
+ /* @__PURE__ */ L("div", { className: U.orText, children: "или" })
1256
1284
  ] }),
1257
- !t && /* @__PURE__ */ R(
1285
+ !t && /* @__PURE__ */ L(
1258
1286
  "div",
1259
1287
  {
1260
- className: I.description,
1288
+ className: U.description,
1261
1289
  dangerouslySetInnerHTML: {
1262
- __html: g && !t ? "Оставьте номер телефона для получения консультации" : `${/* @__PURE__ */ R("div", { children: "привет" })}`
1290
+ __html: _ && !t ? "Оставьте номер телефона для получения консультации" : `${/* @__PURE__ */ L("div", { children: "привет" })}`
1263
1291
  }
1264
1292
  }
1265
1293
  ),
1266
- /* @__PURE__ */ ce("form", { onSubmit: Z(Ae), children: [
1267
- /* @__PURE__ */ ce(It, { className: I.inputWrapper, children: [
1268
- /* @__PURE__ */ R(
1269
- Re,
1294
+ /* @__PURE__ */ de("form", { onSubmit: k(Ae), children: [
1295
+ /* @__PURE__ */ de(Pt, { className: U.inputWrapper, children: [
1296
+ /* @__PURE__ */ L(
1297
+ Ne,
1270
1298
  {
1271
1299
  width: "full",
1272
1300
  size_s: "large",
1273
1301
  variant: "light",
1274
1302
  placeholder: "Введите имя",
1275
1303
  "data-testid": "modal_name",
1276
- ...G("name", { required: !0, pattern: Lt }),
1277
- onBlur: (ee) => _e(ee, {
1278
- action_element_status: F.name ? "error" : "success",
1279
- action_element: `input_${H}_name`
1304
+ ...$("name", { required: !0, pattern: Rt }),
1305
+ onBlur: (K) => ve(K, {
1306
+ action_element_status: T.name ? "error" : "success",
1307
+ action_element: `input_${j}_name`
1280
1308
  }),
1281
- error: !!F.name
1309
+ error: !!T.name
1282
1310
  }
1283
1311
  ),
1284
- l && /* @__PURE__ */ R(
1312
+ l && /* @__PURE__ */ L(
1285
1313
  ar,
1286
1314
  {
1287
1315
  name: "phone",
1288
- control: k,
1316
+ control: R,
1289
1317
  rules: {
1290
- required: D || S || _ && !W,
1291
- pattern: { value: Mt, message: "" }
1318
+ required: w || D || g && !ue,
1319
+ pattern: { value: Lt, message: "" }
1292
1320
  },
1293
1321
  defaultValue: "",
1294
- render: ({ field: ee }) => /* @__PURE__ */ R(
1295
- Re,
1322
+ render: ({ field: K }) => /* @__PURE__ */ L(
1323
+ Ne,
1296
1324
  {
1297
1325
  inputMode: "numeric",
1298
1326
  isPhoneIMask: !0,
1299
- ...ee,
1327
+ ...K,
1300
1328
  width: "full",
1301
1329
  "data-testid": "phone_modal",
1302
1330
  type: "tel",
1303
- error: !!F.phone,
1331
+ error: !!T.phone,
1304
1332
  size_s: "large",
1305
1333
  variant: "light",
1306
- onBlur: (ge) => _e(ge, {
1307
- action_element_status: F.phone ? "error" : "success",
1308
- action_element: `input_${H}_phone`
1334
+ onBlur: (me) => ve(me, {
1335
+ action_element_status: T.phone ? "error" : "success",
1336
+ action_element: `input_${j}_phone`
1309
1337
  })
1310
1338
  }
1311
1339
  )
1312
1340
  }
1313
1341
  ),
1314
- o && /* @__PURE__ */ R(
1315
- Re,
1342
+ o && /* @__PURE__ */ L(
1343
+ Ne,
1316
1344
  {
1317
1345
  width: "full",
1318
1346
  size_s: "large",
1319
1347
  variant: "light",
1320
1348
  placeholder: "Введите email",
1321
1349
  "data-testid": "modal_email",
1322
- ...G("email", {
1323
- required: D || _ && !W,
1324
- pattern: Rt
1350
+ ...$("email", {
1351
+ required: w || g && !ue,
1352
+ pattern: Ot
1325
1353
  }),
1326
- error: !!F.email,
1327
- onBlur: (ee) => _e(ee, {
1328
- action_element_status: F.email ? "error" : "success",
1329
- action_element: `input_${H}_email`
1354
+ error: !!T.email,
1355
+ onBlur: (K) => ve(K, {
1356
+ action_element_status: T.email ? "error" : "success",
1357
+ action_element: `input_${j}_email`
1330
1358
  })
1331
1359
  }
1332
1360
  ),
1333
- d && /* @__PURE__ */ R(
1334
- Ot,
1361
+ c && /* @__PURE__ */ L(
1362
+ Mt,
1335
1363
  {
1336
1364
  "data-testid": "modal_textarea",
1337
1365
  placeholder: x,
1338
- rows: p,
1366
+ rows: S,
1339
1367
  width: "full",
1340
- ...G("textarea")
1368
+ ...$("textarea")
1341
1369
  }
1342
1370
  ),
1343
- M && !t && ne && /* @__PURE__ */ R(
1344
- tt,
1371
+ N && !t && te && /* @__PURE__ */ L(
1372
+ rt,
1345
1373
  {
1346
1374
  "data-testid": "modal_advCheckBox",
1347
- isChecked: Ee,
1348
- error: !!F.advCheckBox,
1349
- text: M.text,
1350
- ...G("advCheckBox", { required: M?.isRequired })
1375
+ isChecked: Te,
1376
+ error: !!T.advCheckBox,
1377
+ text: N.text,
1378
+ ...$("advCheckBox", { required: N?.isRequired })
1351
1379
  }
1352
1380
  ),
1353
- /* @__PURE__ */ ce(
1354
- tt,
1381
+ /* @__PURE__ */ de(
1382
+ rt,
1355
1383
  {
1356
1384
  "data-testid": "modal_personalCheckBox",
1357
- isChecked: Fe,
1358
- error: !!F.personalCheckBox,
1359
- ...G("personalCheckBox", { required: !t }),
1385
+ isChecked: he,
1386
+ error: !!T.personalCheckBox,
1387
+ ...$("personalCheckBox", { required: !t }),
1360
1388
  children: [
1361
- t && /* @__PURE__ */ ce("div", { className: I.checkboxText, children: [
1362
- "Согласен(-на)",
1389
+ t && /* @__PURE__ */ de("div", { className: U.checkboxText, children: [
1390
+ "Я принимаю условия",
1363
1391
  " ",
1364
- /* @__PURE__ */ R(
1392
+ /* @__PURE__ */ L(
1365
1393
  "a",
1366
1394
  {
1367
- className: I.linkPolicy,
1368
- href: "/documents/soglasie-na-rassylki",
1369
- children: "получать новости, информацию по сделке и рекламу"
1395
+ className: U.linkPolicy,
1396
+ href: X[
1397
+ "personal-data"
1398
+ /* PERSONAL_DATA */
1399
+ ],
1400
+ target: "_blank",
1401
+ rel: "noopener noreferrer",
1402
+ children: "Политики обработки"
1370
1403
  }
1371
1404
  ),
1372
1405
  " ",
1373
- "от Stone"
1406
+ "и",
1407
+ " ",
1408
+ /* @__PURE__ */ L(
1409
+ "a",
1410
+ {
1411
+ className: U.linkPolicy,
1412
+ href: X[
1413
+ "privacy-policy"
1414
+ /* PRIVACY_POLICY */
1415
+ ],
1416
+ target: "_blank",
1417
+ rel: "noopener noreferrer",
1418
+ children: "защиты персональных данных"
1419
+ }
1420
+ ),
1421
+ ", даю",
1422
+ " ",
1423
+ /* @__PURE__ */ L(
1424
+ "a",
1425
+ {
1426
+ className: U.linkPolicy,
1427
+ href: X.mailing,
1428
+ target: "_blank",
1429
+ rel: "noopener noreferrer",
1430
+ children: "согласие на получение новостных и рекламных сообщений"
1431
+ }
1432
+ )
1374
1433
  ] }),
1375
- !t && /* @__PURE__ */ ce("div", { className: I.checkboxText, children: [
1434
+ !t && /* @__PURE__ */ de("div", { className: U.checkboxText, children: [
1376
1435
  "Я принимаю условия",
1377
1436
  " ",
1378
- /* @__PURE__ */ R("a", { className: I.linkPolicy, href: "/documents/politika-konfidenczialnosti", children: "Политики обработки и защиты персональных данных" }),
1437
+ /* @__PURE__ */ L(
1438
+ "a",
1439
+ {
1440
+ className: U.linkPolicy,
1441
+ href: X[
1442
+ "privacy-policy"
1443
+ /* PRIVACY_POLICY */
1444
+ ],
1445
+ target: "_blank",
1446
+ rel: "noopener noreferrer",
1447
+ children: "Политики обработки и защиты персональных данных"
1448
+ }
1449
+ ),
1379
1450
  ", даю",
1380
1451
  " ",
1381
- /* @__PURE__ */ R("a", { className: I.linkPolicy, href: "/documents/docs", children: "согласие на обработку персональных данных" })
1452
+ /* @__PURE__ */ L(
1453
+ "a",
1454
+ {
1455
+ className: U.linkPolicy,
1456
+ href: X[
1457
+ "personal-data"
1458
+ /* PERSONAL_DATA */
1459
+ ],
1460
+ target: "_blank",
1461
+ rel: "noopener noreferrer",
1462
+ children: "согласие на обработку персональных данных"
1463
+ }
1464
+ )
1382
1465
  ] })
1383
1466
  ]
1384
1467
  }
1385
1468
  ),
1386
- /* @__PURE__ */ R(
1387
- rt,
1469
+ /* @__PURE__ */ L(
1470
+ st,
1388
1471
  {
1389
1472
  "data-testid": "modal_submit",
1390
1473
  variant: "blue",
@@ -1392,26 +1475,26 @@ const kr = Nt.bind(I), Fr = "Я принимаю условия Политики
1392
1475
  type: "submit",
1393
1476
  size: "large",
1394
1477
  as: "button",
1395
- additionalClass: I.modalBtn,
1478
+ additionalClass: U.modalBtn,
1396
1479
  onClick: () => {
1397
- X && X();
1480
+ z && z();
1398
1481
  },
1399
- disabled: !!F.name || !!F.phone && S || !!F.email && D || !!F.advCheckBox && M?.isRequired || !!F.personalCheckBox && !t,
1482
+ disabled: !!T.name || !!T.phone && D || !!T.email && w || !!T.advCheckBox && N?.isRequired || !!T.personalCheckBox && !t,
1400
1483
  children: "Отправить запрос"
1401
1484
  }
1402
1485
  )
1403
1486
  ] }),
1404
- /* @__PURE__ */ R(
1405
- rt,
1487
+ /* @__PURE__ */ L(
1488
+ st,
1406
1489
  {
1407
- additionalClass: I.btn,
1490
+ additionalClass: U.btn,
1408
1491
  onClick: () => s(!1),
1409
1492
  as: "button",
1410
1493
  variant: "gray",
1411
1494
  type: "button",
1412
1495
  size: "small",
1413
- children: /* @__PURE__ */ R(
1414
- et,
1496
+ children: /* @__PURE__ */ L(
1497
+ tt,
1415
1498
  {
1416
1499
  name: "close",
1417
1500
  size: "16",
@@ -1428,5 +1511,6 @@ const kr = Nt.bind(I), Fr = "Я принимаю условия Политики
1428
1511
  ) : null;
1429
1512
  };
1430
1513
  export {
1431
- Nr as ModalForm
1514
+ Ur as ModalForm,
1515
+ xr as POLICY_TYPE
1432
1516
  };