stone-kit 0.0.444 → 0.0.448
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.
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { jsx as D, jsxs as
|
|
2
|
-
import { I as
|
|
3
|
-
import { M as
|
|
4
|
-
import { Flex as
|
|
1
|
+
import { jsx as D, jsxs as te } from "react/jsx-runtime";
|
|
2
|
+
import { I as xt } from "../../../index-BaVdWc7x.js";
|
|
3
|
+
import { M as Vt } from "../../../Modal-DbD1tgiF.js";
|
|
4
|
+
import { Flex as Ft } from "../../Flex/ui/Flex.js";
|
|
5
5
|
import { Input as Ee } from "../../Input/ui/Input.js";
|
|
6
|
-
import
|
|
6
|
+
import z from "react";
|
|
7
7
|
import { Button as Ke } from "../../Button/ui/Button.js";
|
|
8
8
|
import { NewIcon as Ge } from "../../NewIcon/ui/NewIcon.js";
|
|
9
|
-
import { phoneReg as
|
|
9
|
+
import { phoneReg as pt, nameReg as At, emailReg as kt } from "../utils/reg.js";
|
|
10
10
|
import { CheckBox as Je } from "../../CheckBox/CheckBox.js";
|
|
11
|
-
import { TextArea as
|
|
12
|
-
import { useClientWidth as
|
|
13
|
-
const
|
|
14
|
-
btn:
|
|
15
|
-
modal:
|
|
16
|
-
modalBody:
|
|
17
|
-
root:
|
|
18
|
-
title:
|
|
19
|
-
description:
|
|
20
|
-
inputWrapper:
|
|
21
|
-
linkPolicy:
|
|
22
|
-
telegramLink:
|
|
23
|
-
telegramWrapper:
|
|
24
|
-
telegram:
|
|
25
|
-
orText:
|
|
11
|
+
import { TextArea as wt } from "../../TextArea/TextArea.js";
|
|
12
|
+
import { useClientWidth as Dt } from "../../../shared/useClientWidth.js";
|
|
13
|
+
const St = "_btn_7n08v_1", Et = "_modal_7n08v_9", Tt = "_modalBody_7n08v_16", Bt = "_root_7n08v_21", Ct = "_title_7n08v_34", Lt = "_description_7n08v_41", Mt = "_inputWrapper_7n08v_48", Rt = "_linkPolicy_7n08v_55", Ot = "_telegramLink_7n08v_60", Nt = "_telegramWrapper_7n08v_65", Ut = "_telegram_7n08v_60", It = "_orText_7n08v_88", I = {
|
|
14
|
+
btn: St,
|
|
15
|
+
modal: Et,
|
|
16
|
+
modalBody: Tt,
|
|
17
|
+
root: Bt,
|
|
18
|
+
title: Ct,
|
|
19
|
+
description: Lt,
|
|
20
|
+
inputWrapper: Mt,
|
|
21
|
+
linkPolicy: Rt,
|
|
22
|
+
telegramLink: Ot,
|
|
23
|
+
telegramWrapper: Nt,
|
|
24
|
+
telegram: Ut,
|
|
25
|
+
orText: It
|
|
26
26
|
};
|
|
27
27
|
var ve = (e) => e.type === "checkbox", ue = (e) => e instanceof Date, M = (e) => e == null;
|
|
28
|
-
const
|
|
29
|
-
var E = (e) => !M(e) && !Array.isArray(e) &&
|
|
28
|
+
const lt = (e) => typeof e == "object";
|
|
29
|
+
var E = (e) => !M(e) && !Array.isArray(e) && lt(e) && !ue(e), Pt = (e) => E(e) && e.target ? ve(e.target) ? e.target.checked : e.target.value : e, Wt = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, qt = (e, s) => e.has(Wt(s)), Ht = (e) => {
|
|
30
30
|
const s = e.constructor && e.constructor.prototype;
|
|
31
31
|
return E(s) && s.hasOwnProperty("isPrototypeOf");
|
|
32
32
|
}, Le = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
|
|
33
|
-
function
|
|
33
|
+
function H(e) {
|
|
34
34
|
let s;
|
|
35
|
-
const
|
|
35
|
+
const r = Array.isArray(e);
|
|
36
36
|
if (e instanceof Date)
|
|
37
37
|
s = new Date(e);
|
|
38
38
|
else if (e instanceof Set)
|
|
39
39
|
s = new Set(e);
|
|
40
|
-
else if (!(Le && (e instanceof Blob || e instanceof FileList)) && (
|
|
41
|
-
if (s =
|
|
40
|
+
else if (!(Le && (e instanceof Blob || e instanceof FileList)) && (r || E(e)))
|
|
41
|
+
if (s = r ? [] : {}, !r && !Ht(e))
|
|
42
42
|
s = e;
|
|
43
43
|
else
|
|
44
44
|
for (const n in e)
|
|
45
|
-
e.hasOwnProperty(n) && (s[n] =
|
|
45
|
+
e.hasOwnProperty(n) && (s[n] = H(e[n]));
|
|
46
46
|
else
|
|
47
47
|
return e;
|
|
48
48
|
return s;
|
|
49
49
|
}
|
|
50
|
-
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], k = (e) => e === void 0, f = (e, s,
|
|
50
|
+
var Ae = (e) => Array.isArray(e) ? e.filter(Boolean) : [], k = (e) => e === void 0, f = (e, s, r) => {
|
|
51
51
|
if (!s || !E(e))
|
|
52
|
-
return
|
|
52
|
+
return r;
|
|
53
53
|
const n = Ae(s.split(/[,[\].]+?/)).reduce((o, a) => M(o) ? o : o[a], e);
|
|
54
|
-
return k(n) || n === e ? k(e[s]) ?
|
|
55
|
-
}, re = (e) => typeof e == "boolean",
|
|
54
|
+
return k(n) || n === e ? k(e[s]) ? r : e[s] : n;
|
|
55
|
+
}, re = (e) => typeof e == "boolean", Me = (e) => /^\w*$/.test(e), at = (e) => Ae(e.replace(/["|']|\]/g, "").split(/\.|\[/)), V = (e, s, r) => {
|
|
56
56
|
let n = -1;
|
|
57
|
-
const o =
|
|
57
|
+
const o = Me(s) ? [s] : at(s), a = o.length, y = a - 1;
|
|
58
58
|
for (; ++n < a; ) {
|
|
59
59
|
const g = o[n];
|
|
60
|
-
let
|
|
60
|
+
let R = r;
|
|
61
61
|
if (n !== y) {
|
|
62
62
|
const O = e[g];
|
|
63
|
-
|
|
63
|
+
R = E(O) || Array.isArray(O) ? O : isNaN(+o[n + 1]) ? {} : [];
|
|
64
64
|
}
|
|
65
65
|
if (g === "__proto__")
|
|
66
66
|
return;
|
|
67
|
-
e[g] =
|
|
67
|
+
e[g] = R, e = e[g];
|
|
68
68
|
}
|
|
69
69
|
return e;
|
|
70
70
|
};
|
|
@@ -72,13 +72,13 @@ const Qe = {
|
|
|
72
72
|
BLUR: "blur",
|
|
73
73
|
FOCUS_OUT: "focusout",
|
|
74
74
|
CHANGE: "change"
|
|
75
|
-
},
|
|
75
|
+
}, K = {
|
|
76
76
|
onBlur: "onBlur",
|
|
77
77
|
onChange: "onChange",
|
|
78
78
|
onSubmit: "onSubmit",
|
|
79
79
|
onTouched: "onTouched",
|
|
80
80
|
all: "all"
|
|
81
|
-
},
|
|
81
|
+
}, Z = {
|
|
82
82
|
max: "max",
|
|
83
83
|
min: "min",
|
|
84
84
|
maxLength: "maxLength",
|
|
@@ -87,8 +87,8 @@ const Qe = {
|
|
|
87
87
|
required: "required",
|
|
88
88
|
validate: "validate"
|
|
89
89
|
};
|
|
90
|
-
|
|
91
|
-
var
|
|
90
|
+
z.createContext(null);
|
|
91
|
+
var zt = (e, s, r, n = !0) => {
|
|
92
92
|
const o = {
|
|
93
93
|
defaultValues: s._defaultValues
|
|
94
94
|
};
|
|
@@ -96,41 +96,41 @@ var zr = (e, s, t, n = !0) => {
|
|
|
96
96
|
Object.defineProperty(o, a, {
|
|
97
97
|
get: () => {
|
|
98
98
|
const y = a;
|
|
99
|
-
return s._proxyFormState[y] !==
|
|
99
|
+
return s._proxyFormState[y] !== K.all && (s._proxyFormState[y] = !n || K.all), e[y];
|
|
100
100
|
}
|
|
101
101
|
});
|
|
102
102
|
return o;
|
|
103
|
-
},
|
|
104
|
-
|
|
103
|
+
}, P = (e) => E(e) && !Object.keys(e).length, $t = (e, s, r, n) => {
|
|
104
|
+
r(e);
|
|
105
105
|
const { name: o, ...a } = e;
|
|
106
|
-
return
|
|
106
|
+
return P(a) || Object.keys(a).length >= Object.keys(s).length || Object.keys(a).find((y) => s[y] === K.all);
|
|
107
107
|
}, me = (e) => Array.isArray(e) ? e : [e];
|
|
108
|
-
function
|
|
109
|
-
const s =
|
|
110
|
-
s.current = e,
|
|
111
|
-
const
|
|
108
|
+
function jt(e) {
|
|
109
|
+
const s = z.useRef(e);
|
|
110
|
+
s.current = e, z.useEffect(() => {
|
|
111
|
+
const r = !e.disabled && s.current.subject && s.current.subject.subscribe({
|
|
112
112
|
next: s.current.next
|
|
113
113
|
});
|
|
114
114
|
return () => {
|
|
115
|
-
|
|
115
|
+
r && r.unsubscribe();
|
|
116
116
|
};
|
|
117
117
|
}, [e.disabled]);
|
|
118
118
|
}
|
|
119
|
-
var
|
|
120
|
-
...
|
|
119
|
+
var Y = (e) => typeof e == "string", Kt = (e, s, r, n, o) => Y(e) ? (n && s.watch.add(e), f(r, e, o)) : Array.isArray(e) ? e.map((a) => (n && s.watch.add(a), f(r, a))) : (n && (s.watchAll = !0), r), Gt = (e, s, r, n, o) => s ? {
|
|
120
|
+
...r[e],
|
|
121
121
|
types: {
|
|
122
|
-
...
|
|
122
|
+
...r[e] && r[e].types ? r[e].types : {},
|
|
123
123
|
[n]: o || !0
|
|
124
124
|
}
|
|
125
125
|
} : {}, Xe = (e) => ({
|
|
126
|
-
isOnSubmit: !e || e ===
|
|
127
|
-
isOnBlur: e ===
|
|
128
|
-
isOnChange: e ===
|
|
129
|
-
isOnAll: e ===
|
|
130
|
-
isOnTouch: e ===
|
|
131
|
-
}), Ye = (e, s,
|
|
132
|
-
const ge = (e, s,
|
|
133
|
-
for (const o of
|
|
126
|
+
isOnSubmit: !e || e === K.onSubmit,
|
|
127
|
+
isOnBlur: e === K.onBlur,
|
|
128
|
+
isOnChange: e === K.onChange,
|
|
129
|
+
isOnAll: e === K.all,
|
|
130
|
+
isOnTouch: e === K.onTouched
|
|
131
|
+
}), Ye = (e, s, r) => !r && (s.watchAll || s.watch.has(e) || [...s.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
|
|
132
|
+
const ge = (e, s, r, n) => {
|
|
133
|
+
for (const o of r || Object.keys(e)) {
|
|
134
134
|
const a = f(e, o);
|
|
135
135
|
if (a) {
|
|
136
136
|
const { _f: y, ...g } = a;
|
|
@@ -145,44 +145,44 @@ const ge = (e, s, t, n) => {
|
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
};
|
|
148
|
-
var
|
|
149
|
-
const n = me(f(e,
|
|
150
|
-
return V(n, "root", s[
|
|
151
|
-
},
|
|
148
|
+
var Jt = (e, s, r) => {
|
|
149
|
+
const n = me(f(e, r));
|
|
150
|
+
return V(n, "root", s[r]), V(e, r, n), e;
|
|
151
|
+
}, Re = (e) => e.type === "file", se = (e) => typeof e == "function", xe = (e) => {
|
|
152
152
|
if (!Le)
|
|
153
153
|
return !1;
|
|
154
154
|
const s = e ? e.ownerDocument : 0;
|
|
155
155
|
return e instanceof (s && s.defaultView ? s.defaultView.HTMLElement : HTMLElement);
|
|
156
|
-
}, be = (e) =>
|
|
156
|
+
}, be = (e) => Y(e), Oe = (e) => e.type === "radio", Ve = (e) => e instanceof RegExp;
|
|
157
157
|
const Ze = {
|
|
158
158
|
value: !1,
|
|
159
159
|
isValid: !1
|
|
160
|
-
},
|
|
161
|
-
var
|
|
160
|
+
}, et = { value: !0, isValid: !0 };
|
|
161
|
+
var nt = (e) => {
|
|
162
162
|
if (Array.isArray(e)) {
|
|
163
163
|
if (e.length > 1) {
|
|
164
|
-
const s = e.filter((
|
|
164
|
+
const s = e.filter((r) => r && r.checked && !r.disabled).map((r) => r.value);
|
|
165
165
|
return { value: s, isValid: !!s.length };
|
|
166
166
|
}
|
|
167
167
|
return e[0].checked && !e[0].disabled ? (
|
|
168
168
|
// @ts-expect-error expected to work in the browser
|
|
169
|
-
e[0].attributes && !k(e[0].attributes.value) ? k(e[0].value) || e[0].value === "" ?
|
|
169
|
+
e[0].attributes && !k(e[0].attributes.value) ? k(e[0].value) || e[0].value === "" ? et : { value: e[0].value, isValid: !0 } : et
|
|
170
170
|
) : Ze;
|
|
171
171
|
}
|
|
172
172
|
return Ze;
|
|
173
173
|
};
|
|
174
|
-
const
|
|
174
|
+
const tt = {
|
|
175
175
|
isValid: !1,
|
|
176
176
|
value: null
|
|
177
177
|
};
|
|
178
|
-
var
|
|
178
|
+
var ot = (e) => Array.isArray(e) ? e.reduce((s, r) => r && r.checked && !r.disabled ? {
|
|
179
179
|
isValid: !0,
|
|
180
|
-
value:
|
|
181
|
-
} : s,
|
|
182
|
-
function
|
|
180
|
+
value: r.value
|
|
181
|
+
} : s, tt) : tt;
|
|
182
|
+
function rt(e, s, r = "validate") {
|
|
183
183
|
if (be(e) || Array.isArray(e) && e.every(be) || re(e) && !e)
|
|
184
184
|
return {
|
|
185
|
-
type:
|
|
185
|
+
type: r,
|
|
186
186
|
message: be(e) ? e : "",
|
|
187
187
|
ref: s
|
|
188
188
|
};
|
|
@@ -190,103 +190,103 @@ function tr(e, s, t = "validate") {
|
|
|
190
190
|
var oe = (e) => E(e) && !Ve(e) ? e : {
|
|
191
191
|
value: e,
|
|
192
192
|
message: ""
|
|
193
|
-
},
|
|
194
|
-
const { ref: a, refs: y, required: g, maxLength:
|
|
195
|
-
if (!B ||
|
|
193
|
+
}, st = async (e, s, r, n, o) => {
|
|
194
|
+
const { ref: a, refs: y, required: g, maxLength: R, minLength: O, min: F, max: m, pattern: le, validate: G, name: C, valueAsNumber: ce, mount: B, disabled: J } = e._f, v = f(s, C);
|
|
195
|
+
if (!B || J)
|
|
196
196
|
return {};
|
|
197
|
-
const
|
|
198
|
-
n &&
|
|
199
|
-
}, p = {},
|
|
200
|
-
const
|
|
201
|
-
p[
|
|
202
|
-
type:
|
|
203
|
-
message:
|
|
197
|
+
const $ = y ? y[0] : a, j = (_) => {
|
|
198
|
+
n && $.reportValidity && ($.setCustomValidity(re(_) ? "" : _ || ""), $.reportValidity());
|
|
199
|
+
}, p = {}, Q = Oe(a), L = ve(a), X = Q || L, ee = (ce || Re(a)) && k(a.value) && k(v) || xe(a) && a.value === "" || v === "" || Array.isArray(v) && !v.length, N = Gt.bind(null, C, r, p), ae = (_, b, A, T = Z.maxLength, W = Z.minLength) => {
|
|
200
|
+
const U = _ ? b : A;
|
|
201
|
+
p[C] = {
|
|
202
|
+
type: _ ? T : W,
|
|
203
|
+
message: U,
|
|
204
204
|
ref: a,
|
|
205
|
-
...N(
|
|
205
|
+
...N(_ ? T : W, U)
|
|
206
206
|
};
|
|
207
207
|
};
|
|
208
|
-
if (o ? !Array.isArray(
|
|
209
|
-
const { value:
|
|
210
|
-
if (
|
|
211
|
-
type:
|
|
208
|
+
if (o ? !Array.isArray(v) || !v.length : g && (!X && (ee || M(v)) || re(v) && !v || L && !nt(y).isValid || Q && !ot(y).isValid)) {
|
|
209
|
+
const { value: _, message: b } = be(g) ? { value: !!g, message: g } : oe(g);
|
|
210
|
+
if (_ && (p[C] = {
|
|
211
|
+
type: Z.required,
|
|
212
212
|
message: b,
|
|
213
|
-
ref:
|
|
214
|
-
...N(
|
|
215
|
-
}, !
|
|
216
|
-
return
|
|
213
|
+
ref: $,
|
|
214
|
+
...N(Z.required, b)
|
|
215
|
+
}, !r))
|
|
216
|
+
return j(b), p;
|
|
217
217
|
}
|
|
218
|
-
if (!
|
|
219
|
-
let
|
|
220
|
-
const A = oe(
|
|
221
|
-
if (!M(
|
|
222
|
-
const W = a.valueAsNumber ||
|
|
223
|
-
M(A.value) || (
|
|
218
|
+
if (!ee && (!M(F) || !M(m))) {
|
|
219
|
+
let _, b;
|
|
220
|
+
const A = oe(m), T = oe(F);
|
|
221
|
+
if (!M(v) && !isNaN(v)) {
|
|
222
|
+
const W = a.valueAsNumber || v && +v;
|
|
223
|
+
M(A.value) || (_ = W > A.value), M(T.value) || (b = W < T.value);
|
|
224
224
|
} else {
|
|
225
|
-
const W = a.valueAsDate || new Date(
|
|
226
|
-
|
|
225
|
+
const W = a.valueAsDate || new Date(v), U = (ye) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + ye), de = a.type == "time", fe = a.type == "week";
|
|
226
|
+
Y(A.value) && v && (_ = de ? U(v) > U(A.value) : fe ? v > A.value : W > new Date(A.value)), Y(T.value) && v && (b = de ? U(v) < U(T.value) : fe ? v < T.value : W < new Date(T.value));
|
|
227
227
|
}
|
|
228
|
-
if ((
|
|
229
|
-
return
|
|
228
|
+
if ((_ || b) && (ae(!!_, A.message, T.message, Z.max, Z.min), !r))
|
|
229
|
+
return j(p[C].message), p;
|
|
230
230
|
}
|
|
231
|
-
if ((
|
|
232
|
-
const
|
|
233
|
-
if ((A || T) && (ae(A,
|
|
234
|
-
return
|
|
231
|
+
if ((R || O) && !ee && (Y(v) || o && Array.isArray(v))) {
|
|
232
|
+
const _ = oe(R), b = oe(O), A = !M(_.value) && v.length > +_.value, T = !M(b.value) && v.length < +b.value;
|
|
233
|
+
if ((A || T) && (ae(A, _.message, b.message), !r))
|
|
234
|
+
return j(p[C].message), p;
|
|
235
235
|
}
|
|
236
|
-
if (le && !
|
|
237
|
-
const { value:
|
|
238
|
-
if (Ve(
|
|
239
|
-
type:
|
|
236
|
+
if (le && !ee && Y(v)) {
|
|
237
|
+
const { value: _, message: b } = oe(le);
|
|
238
|
+
if (Ve(_) && !v.match(_) && (p[C] = {
|
|
239
|
+
type: Z.pattern,
|
|
240
240
|
message: b,
|
|
241
241
|
ref: a,
|
|
242
|
-
...N(
|
|
243
|
-
}, !
|
|
244
|
-
return
|
|
242
|
+
...N(Z.pattern, b)
|
|
243
|
+
}, !r))
|
|
244
|
+
return j(b), p;
|
|
245
245
|
}
|
|
246
|
-
if (
|
|
247
|
-
if (
|
|
248
|
-
const
|
|
249
|
-
if (b && (p[
|
|
246
|
+
if (G) {
|
|
247
|
+
if (se(G)) {
|
|
248
|
+
const _ = await G(v, s), b = rt(_, $);
|
|
249
|
+
if (b && (p[C] = {
|
|
250
250
|
...b,
|
|
251
|
-
...N(
|
|
252
|
-
}, !
|
|
253
|
-
return
|
|
254
|
-
} else if (E(
|
|
255
|
-
let
|
|
256
|
-
for (const b in
|
|
257
|
-
if (!
|
|
251
|
+
...N(Z.validate, b.message)
|
|
252
|
+
}, !r))
|
|
253
|
+
return j(b.message), p;
|
|
254
|
+
} else if (E(G)) {
|
|
255
|
+
let _ = {};
|
|
256
|
+
for (const b in G) {
|
|
257
|
+
if (!P(_) && !r)
|
|
258
258
|
break;
|
|
259
|
-
const A =
|
|
260
|
-
A && (
|
|
259
|
+
const A = rt(await G[b](v, s), $, b);
|
|
260
|
+
A && (_ = {
|
|
261
261
|
...A,
|
|
262
262
|
...N(b, A.message)
|
|
263
|
-
},
|
|
263
|
+
}, j(A.message), r && (p[C] = _));
|
|
264
264
|
}
|
|
265
|
-
if (!
|
|
266
|
-
ref:
|
|
267
|
-
...
|
|
268
|
-
}, !
|
|
265
|
+
if (!P(_) && (p[C] = {
|
|
266
|
+
ref: $,
|
|
267
|
+
..._
|
|
268
|
+
}, !r))
|
|
269
269
|
return p;
|
|
270
270
|
}
|
|
271
271
|
}
|
|
272
|
-
return
|
|
272
|
+
return j(!0), p;
|
|
273
273
|
};
|
|
274
|
-
function
|
|
275
|
-
const
|
|
274
|
+
function Qt(e, s) {
|
|
275
|
+
const r = s.slice(0, -1).length;
|
|
276
276
|
let n = 0;
|
|
277
|
-
for (; n <
|
|
277
|
+
for (; n < r; )
|
|
278
278
|
e = k(e) ? n++ : e[s[n++]];
|
|
279
279
|
return e;
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function Xt(e) {
|
|
282
282
|
for (const s in e)
|
|
283
283
|
if (e.hasOwnProperty(s) && !k(e[s]))
|
|
284
284
|
return !1;
|
|
285
285
|
return !0;
|
|
286
286
|
}
|
|
287
287
|
function S(e, s) {
|
|
288
|
-
const
|
|
289
|
-
return n && delete n[a], o !== 0 && (E(n) &&
|
|
288
|
+
const r = Array.isArray(s) ? s : Me(s) ? [s] : at(s), n = r.length === 1 ? e : Qt(e, r), o = r.length - 1, a = r[o];
|
|
289
|
+
return n && delete n[a], o !== 0 && (E(n) && P(n) || Array.isArray(n) && Xt(n)) && S(e, r.slice(0, -1)), e;
|
|
290
290
|
}
|
|
291
291
|
var Te = () => {
|
|
292
292
|
let e = [];
|
|
@@ -307,16 +307,16 @@ var Te = () => {
|
|
|
307
307
|
e = [];
|
|
308
308
|
}
|
|
309
309
|
};
|
|
310
|
-
}, Fe = (e) => M(e) || !
|
|
310
|
+
}, Fe = (e) => M(e) || !lt(e);
|
|
311
311
|
function ie(e, s) {
|
|
312
312
|
if (Fe(e) || Fe(s))
|
|
313
313
|
return e === s;
|
|
314
314
|
if (ue(e) && ue(s))
|
|
315
315
|
return e.getTime() === s.getTime();
|
|
316
|
-
const
|
|
317
|
-
if (
|
|
316
|
+
const r = Object.keys(e), n = Object.keys(s);
|
|
317
|
+
if (r.length !== n.length)
|
|
318
318
|
return !1;
|
|
319
|
-
for (const o of
|
|
319
|
+
for (const o of r) {
|
|
320
320
|
const a = e[o];
|
|
321
321
|
if (!n.includes(o))
|
|
322
322
|
return !1;
|
|
@@ -328,57 +328,57 @@ function ie(e, s) {
|
|
|
328
328
|
}
|
|
329
329
|
return !0;
|
|
330
330
|
}
|
|
331
|
-
var
|
|
331
|
+
var ut = (e) => e.type === "select-multiple", Yt = (e) => Oe(e) || ve(e), Be = (e) => xe(e) && e.isConnected, ct = (e) => {
|
|
332
332
|
for (const s in e)
|
|
333
|
-
if (
|
|
333
|
+
if (se(e[s]))
|
|
334
334
|
return !0;
|
|
335
335
|
return !1;
|
|
336
336
|
};
|
|
337
337
|
function pe(e, s = {}) {
|
|
338
|
-
const
|
|
339
|
-
if (E(e) ||
|
|
338
|
+
const r = Array.isArray(e);
|
|
339
|
+
if (E(e) || r)
|
|
340
340
|
for (const n in e)
|
|
341
|
-
Array.isArray(e[n]) || E(e[n]) && !
|
|
341
|
+
Array.isArray(e[n]) || E(e[n]) && !ct(e[n]) ? (s[n] = Array.isArray(e[n]) ? [] : {}, pe(e[n], s[n])) : M(e[n]) || (s[n] = !0);
|
|
342
342
|
return s;
|
|
343
343
|
}
|
|
344
|
-
function
|
|
344
|
+
function dt(e, s, r) {
|
|
345
345
|
const n = Array.isArray(e);
|
|
346
346
|
if (E(e) || n)
|
|
347
347
|
for (const o in e)
|
|
348
|
-
Array.isArray(e[o]) || E(e[o]) && !
|
|
349
|
-
return
|
|
348
|
+
Array.isArray(e[o]) || E(e[o]) && !ct(e[o]) ? k(s) || Fe(r[o]) ? r[o] = Array.isArray(e[o]) ? pe(e[o], []) : { ...pe(e[o]) } : dt(e[o], M(s) ? {} : s[o], r[o]) : r[o] = !ie(e[o], s[o]);
|
|
349
|
+
return r;
|
|
350
350
|
}
|
|
351
|
-
var _e = (e, s) =>
|
|
351
|
+
var _e = (e, s) => dt(e, s, pe(s)), ft = (e, { valueAsNumber: s, valueAsDate: r, setValueAs: n }) => k(e) ? e : s ? e === "" ? NaN : e && +e : r && Y(e) ? new Date(e) : n ? n(e) : e;
|
|
352
352
|
function Ce(e) {
|
|
353
353
|
const s = e.ref;
|
|
354
|
-
if (!(e.refs ? e.refs.every((
|
|
355
|
-
return
|
|
354
|
+
if (!(e.refs ? e.refs.every((r) => r.disabled) : s.disabled))
|
|
355
|
+
return Re(s) ? s.files : Oe(s) ? ot(e.refs).value : ut(s) ? [...s.selectedOptions].map(({ value: r }) => r) : ve(s) ? nt(e.refs).value : ft(k(s.value) ? e.ref.value : s.value, e);
|
|
356
356
|
}
|
|
357
|
-
var
|
|
357
|
+
var Zt = (e, s, r, n) => {
|
|
358
358
|
const o = {};
|
|
359
359
|
for (const a of e) {
|
|
360
360
|
const y = f(s, a);
|
|
361
361
|
y && V(o, a, y._f);
|
|
362
362
|
}
|
|
363
363
|
return {
|
|
364
|
-
criteriaMode:
|
|
364
|
+
criteriaMode: r,
|
|
365
365
|
names: [...e],
|
|
366
366
|
fields: o,
|
|
367
367
|
shouldUseNativeValidation: n
|
|
368
368
|
};
|
|
369
|
-
}, he = (e) => k(e) ? e : Ve(e) ? e.source : E(e) ? Ve(e.value) ? e.value.source : e.value : e,
|
|
370
|
-
function
|
|
371
|
-
const n = f(e,
|
|
372
|
-
if (n ||
|
|
369
|
+
}, he = (e) => k(e) ? e : Ve(e) ? e.source : E(e) ? Ve(e.value) ? e.value.source : e.value : e, er = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate);
|
|
370
|
+
function it(e, s, r) {
|
|
371
|
+
const n = f(e, r);
|
|
372
|
+
if (n || Me(r))
|
|
373
373
|
return {
|
|
374
374
|
error: n,
|
|
375
|
-
name:
|
|
375
|
+
name: r
|
|
376
376
|
};
|
|
377
|
-
const o =
|
|
377
|
+
const o = r.split(".");
|
|
378
378
|
for (; o.length; ) {
|
|
379
379
|
const a = o.join("."), y = f(s, a), g = f(e, a);
|
|
380
|
-
if (y && !Array.isArray(y) &&
|
|
381
|
-
return { name:
|
|
380
|
+
if (y && !Array.isArray(y) && r !== a)
|
|
381
|
+
return { name: r };
|
|
382
382
|
if (g && g.type)
|
|
383
383
|
return {
|
|
384
384
|
name: a,
|
|
@@ -387,23 +387,23 @@ function ir(e, s, t) {
|
|
|
387
387
|
o.pop();
|
|
388
388
|
}
|
|
389
389
|
return {
|
|
390
|
-
name:
|
|
390
|
+
name: r
|
|
391
391
|
};
|
|
392
392
|
}
|
|
393
|
-
var
|
|
394
|
-
const
|
|
395
|
-
mode:
|
|
396
|
-
reValidateMode:
|
|
393
|
+
var tr = (e, s, r, n, o) => o.isOnAll ? !1 : !r && o.isOnTouch ? !(s || e) : (r ? n.isOnBlur : o.isOnBlur) ? !e : (r ? n.isOnChange : o.isOnChange) ? e : !0, rr = (e, s) => !Ae(f(e, s)).length && S(e, s);
|
|
394
|
+
const sr = {
|
|
395
|
+
mode: K.onSubmit,
|
|
396
|
+
reValidateMode: K.onChange,
|
|
397
397
|
shouldFocusError: !0
|
|
398
398
|
};
|
|
399
|
-
function
|
|
399
|
+
function ir(e = {}) {
|
|
400
400
|
let s = {
|
|
401
|
-
...
|
|
401
|
+
...sr,
|
|
402
402
|
...e
|
|
403
|
-
},
|
|
403
|
+
}, r = {
|
|
404
404
|
submitCount: 0,
|
|
405
405
|
isDirty: !1,
|
|
406
|
-
isLoading:
|
|
406
|
+
isLoading: se(s.defaultValues),
|
|
407
407
|
isValidating: !1,
|
|
408
408
|
isSubmitted: !1,
|
|
409
409
|
isSubmitting: !1,
|
|
@@ -414,7 +414,7 @@ function it(e = {}) {
|
|
|
414
414
|
validatingFields: {},
|
|
415
415
|
errors: s.errors || {},
|
|
416
416
|
disabled: s.disabled || !1
|
|
417
|
-
}, n = {}, o = E(s.defaultValues) || E(s.values) ?
|
|
417
|
+
}, n = {}, o = E(s.defaultValues) || E(s.values) ? H(s.defaultValues || s.values) || {} : {}, a = s.shouldUnregister ? {} : H(o), y = {
|
|
418
418
|
action: !1,
|
|
419
419
|
mount: !1,
|
|
420
420
|
watch: !1
|
|
@@ -423,7 +423,7 @@ function it(e = {}) {
|
|
|
423
423
|
unMount: /* @__PURE__ */ new Set(),
|
|
424
424
|
array: /* @__PURE__ */ new Set(),
|
|
425
425
|
watch: /* @__PURE__ */ new Set()
|
|
426
|
-
},
|
|
426
|
+
}, R, O = 0;
|
|
427
427
|
const F = {
|
|
428
428
|
isDirty: !1,
|
|
429
429
|
dirtyFields: !1,
|
|
@@ -432,269 +432,269 @@ function it(e = {}) {
|
|
|
432
432
|
isValidating: !1,
|
|
433
433
|
isValid: !1,
|
|
434
434
|
errors: !1
|
|
435
|
-
},
|
|
435
|
+
}, m = {
|
|
436
436
|
values: Te(),
|
|
437
437
|
array: Te(),
|
|
438
438
|
state: Te()
|
|
439
|
-
}, le = Xe(s.mode),
|
|
440
|
-
clearTimeout(O), O = setTimeout(
|
|
441
|
-
}, B = async (
|
|
442
|
-
if (F.isValid ||
|
|
443
|
-
const i = s.resolver ?
|
|
444
|
-
i !==
|
|
439
|
+
}, le = Xe(s.mode), G = Xe(s.reValidateMode), C = s.criteriaMode === K.all, ce = (t) => (i) => {
|
|
440
|
+
clearTimeout(O), O = setTimeout(t, i);
|
|
441
|
+
}, B = async (t) => {
|
|
442
|
+
if (F.isValid || t) {
|
|
443
|
+
const i = s.resolver ? P((await X()).errors) : await N(n, !0);
|
|
444
|
+
i !== r.isValid && m.state.next({
|
|
445
445
|
isValid: i
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
|
-
},
|
|
449
|
-
(F.isValidating || F.validatingFields) && ((
|
|
450
|
-
l && (i ? V(
|
|
451
|
-
}),
|
|
452
|
-
validatingFields:
|
|
453
|
-
isValidating: !
|
|
448
|
+
}, J = (t, i) => {
|
|
449
|
+
(F.isValidating || F.validatingFields) && ((t || Array.from(g.mount)).forEach((l) => {
|
|
450
|
+
l && (i ? V(r.validatingFields, l, i) : S(r.validatingFields, l));
|
|
451
|
+
}), m.state.next({
|
|
452
|
+
validatingFields: r.validatingFields,
|
|
453
|
+
isValidating: !P(r.validatingFields)
|
|
454
454
|
}));
|
|
455
|
-
},
|
|
455
|
+
}, v = (t, i = [], l, d, c = !0, u = !0) => {
|
|
456
456
|
if (d && l) {
|
|
457
|
-
if (y.action = !0, u && Array.isArray(f(n,
|
|
458
|
-
const h = l(f(n,
|
|
459
|
-
c && V(n,
|
|
457
|
+
if (y.action = !0, u && Array.isArray(f(n, t))) {
|
|
458
|
+
const h = l(f(n, t), d.argA, d.argB);
|
|
459
|
+
c && V(n, t, h);
|
|
460
460
|
}
|
|
461
|
-
if (u && Array.isArray(f(
|
|
462
|
-
const h = l(f(
|
|
463
|
-
c && V(
|
|
461
|
+
if (u && Array.isArray(f(r.errors, t))) {
|
|
462
|
+
const h = l(f(r.errors, t), d.argA, d.argB);
|
|
463
|
+
c && V(r.errors, t, h), rr(r.errors, t);
|
|
464
464
|
}
|
|
465
|
-
if (F.touchedFields && u && Array.isArray(f(
|
|
466
|
-
const h = l(f(
|
|
467
|
-
c && V(
|
|
465
|
+
if (F.touchedFields && u && Array.isArray(f(r.touchedFields, t))) {
|
|
466
|
+
const h = l(f(r.touchedFields, t), d.argA, d.argB);
|
|
467
|
+
c && V(r.touchedFields, t, h);
|
|
468
468
|
}
|
|
469
|
-
F.dirtyFields && (
|
|
470
|
-
name:
|
|
471
|
-
isDirty:
|
|
472
|
-
dirtyFields:
|
|
473
|
-
errors:
|
|
474
|
-
isValid:
|
|
469
|
+
F.dirtyFields && (r.dirtyFields = _e(o, a)), m.state.next({
|
|
470
|
+
name: t,
|
|
471
|
+
isDirty: _(t, i),
|
|
472
|
+
dirtyFields: r.dirtyFields,
|
|
473
|
+
errors: r.errors,
|
|
474
|
+
isValid: r.isValid
|
|
475
475
|
});
|
|
476
476
|
} else
|
|
477
|
-
V(a,
|
|
478
|
-
},
|
|
479
|
-
V(
|
|
480
|
-
errors:
|
|
477
|
+
V(a, t, i);
|
|
478
|
+
}, $ = (t, i) => {
|
|
479
|
+
V(r.errors, t, i), m.state.next({
|
|
480
|
+
errors: r.errors
|
|
481
481
|
});
|
|
482
|
-
},
|
|
483
|
-
|
|
484
|
-
errors:
|
|
482
|
+
}, j = (t) => {
|
|
483
|
+
r.errors = t, m.state.next({
|
|
484
|
+
errors: r.errors,
|
|
485
485
|
isValid: !1
|
|
486
486
|
});
|
|
487
|
-
}, p = (
|
|
488
|
-
const c = f(n,
|
|
487
|
+
}, p = (t, i, l, d) => {
|
|
488
|
+
const c = f(n, t);
|
|
489
489
|
if (c) {
|
|
490
|
-
const u = f(a,
|
|
491
|
-
k(u) || d && d.defaultChecked || i ? V(a,
|
|
490
|
+
const u = f(a, t, k(l) ? f(o, t) : l);
|
|
491
|
+
k(u) || d && d.defaultChecked || i ? V(a, t, i ? u : Ce(c._f)) : T(t, u), y.mount && B();
|
|
492
492
|
}
|
|
493
|
-
},
|
|
493
|
+
}, Q = (t, i, l, d, c) => {
|
|
494
494
|
let u = !1, h = !1;
|
|
495
495
|
const x = {
|
|
496
|
-
name:
|
|
497
|
-
}, w = !!(f(n,
|
|
496
|
+
name: t
|
|
497
|
+
}, w = !!(f(n, t) && f(n, t)._f && f(n, t)._f.disabled);
|
|
498
498
|
if (!l || d) {
|
|
499
|
-
F.isDirty && (h =
|
|
500
|
-
const q = w || ie(f(o,
|
|
501
|
-
h = !!(!w && f(
|
|
499
|
+
F.isDirty && (h = r.isDirty, r.isDirty = x.isDirty = _(), u = h !== x.isDirty);
|
|
500
|
+
const q = w || ie(f(o, t), i);
|
|
501
|
+
h = !!(!w && f(r.dirtyFields, t)), q || w ? S(r.dirtyFields, t) : V(r.dirtyFields, t, !0), x.dirtyFields = r.dirtyFields, u = u || F.dirtyFields && h !== !q;
|
|
502
502
|
}
|
|
503
503
|
if (l) {
|
|
504
|
-
const q = f(
|
|
505
|
-
q || (V(
|
|
504
|
+
const q = f(r.touchedFields, t);
|
|
505
|
+
q || (V(r.touchedFields, t, l), x.touchedFields = r.touchedFields, u = u || F.touchedFields && q !== l);
|
|
506
506
|
}
|
|
507
|
-
return u && c &&
|
|
508
|
-
},
|
|
509
|
-
const c = f(
|
|
510
|
-
if (e.delayError && l ? (
|
|
507
|
+
return u && c && m.state.next(x), u ? x : {};
|
|
508
|
+
}, L = (t, i, l, d) => {
|
|
509
|
+
const c = f(r.errors, t), u = F.isValid && re(i) && r.isValid !== i;
|
|
510
|
+
if (e.delayError && l ? (R = ce(() => $(t, l)), R(e.delayError)) : (clearTimeout(O), R = null, l ? V(r.errors, t, l) : S(r.errors, t)), (l ? !ie(c, l) : c) || !P(d) || u) {
|
|
511
511
|
const h = {
|
|
512
512
|
...d,
|
|
513
513
|
...u && re(i) ? { isValid: i } : {},
|
|
514
|
-
errors:
|
|
515
|
-
name:
|
|
514
|
+
errors: r.errors,
|
|
515
|
+
name: t
|
|
516
516
|
};
|
|
517
|
-
|
|
518
|
-
...
|
|
517
|
+
r = {
|
|
518
|
+
...r,
|
|
519
519
|
...h
|
|
520
|
-
},
|
|
520
|
+
}, m.state.next(h);
|
|
521
521
|
}
|
|
522
|
-
}, X = async (
|
|
523
|
-
|
|
524
|
-
const i = await s.resolver(a, s.context,
|
|
525
|
-
return
|
|
526
|
-
},
|
|
527
|
-
const { errors: i } = await X(
|
|
528
|
-
if (
|
|
529
|
-
for (const l of
|
|
522
|
+
}, X = async (t) => {
|
|
523
|
+
J(t, !0);
|
|
524
|
+
const i = await s.resolver(a, s.context, Zt(t || g.mount, n, s.criteriaMode, s.shouldUseNativeValidation));
|
|
525
|
+
return J(t), i;
|
|
526
|
+
}, ee = async (t) => {
|
|
527
|
+
const { errors: i } = await X(t);
|
|
528
|
+
if (t)
|
|
529
|
+
for (const l of t) {
|
|
530
530
|
const d = f(i, l);
|
|
531
|
-
d ? V(
|
|
531
|
+
d ? V(r.errors, l, d) : S(r.errors, l);
|
|
532
532
|
}
|
|
533
533
|
else
|
|
534
|
-
|
|
534
|
+
r.errors = i;
|
|
535
535
|
return i;
|
|
536
|
-
}, N = async (
|
|
536
|
+
}, N = async (t, i, l = {
|
|
537
537
|
valid: !0
|
|
538
538
|
}) => {
|
|
539
|
-
for (const d in
|
|
540
|
-
const c =
|
|
539
|
+
for (const d in t) {
|
|
540
|
+
const c = t[d];
|
|
541
541
|
if (c) {
|
|
542
542
|
const { _f: u, ...h } = c;
|
|
543
543
|
if (u) {
|
|
544
544
|
const x = g.array.has(u.name);
|
|
545
|
-
|
|
546
|
-
const w = await
|
|
547
|
-
if (
|
|
545
|
+
J([d], !0);
|
|
546
|
+
const w = await st(c, a, C, s.shouldUseNativeValidation && !i, x);
|
|
547
|
+
if (J([d]), w[u.name] && (l.valid = !1, i))
|
|
548
548
|
break;
|
|
549
|
-
!i && (f(w, u.name) ? x ?
|
|
549
|
+
!i && (f(w, u.name) ? x ? Jt(r.errors, w, u.name) : V(r.errors, u.name, w[u.name]) : S(r.errors, u.name));
|
|
550
550
|
}
|
|
551
|
-
!
|
|
551
|
+
!P(h) && await N(h, i, l);
|
|
552
552
|
}
|
|
553
553
|
}
|
|
554
554
|
return l.valid;
|
|
555
555
|
}, ae = () => {
|
|
556
|
-
for (const
|
|
557
|
-
const i = f(n,
|
|
558
|
-
i && (i._f.refs ? i._f.refs.every((l) => !Be(l)) : !Be(i._f.ref)) && ke(
|
|
556
|
+
for (const t of g.unMount) {
|
|
557
|
+
const i = f(n, t);
|
|
558
|
+
i && (i._f.refs ? i._f.refs.every((l) => !Be(l)) : !Be(i._f.ref)) && ke(t);
|
|
559
559
|
}
|
|
560
560
|
g.unMount = /* @__PURE__ */ new Set();
|
|
561
|
-
},
|
|
562
|
-
...y.mount ? a : k(i) ? o :
|
|
563
|
-
}, l, i), A = (
|
|
564
|
-
const d = f(n,
|
|
561
|
+
}, _ = (t, i) => (t && i && V(a, t, i), !ie(Ne(), o)), b = (t, i, l) => Kt(t, g, {
|
|
562
|
+
...y.mount ? a : k(i) ? o : Y(t) ? { [t]: i } : i
|
|
563
|
+
}, l, i), A = (t) => Ae(f(y.mount ? a : o, t, e.shouldUnregister ? f(o, t, []) : [])), T = (t, i, l = {}) => {
|
|
564
|
+
const d = f(n, t);
|
|
565
565
|
let c = i;
|
|
566
566
|
if (d) {
|
|
567
567
|
const u = d._f;
|
|
568
|
-
u && (!u.disabled && V(a,
|
|
569
|
-
name:
|
|
568
|
+
u && (!u.disabled && V(a, t, ft(i, u)), c = xe(u.ref) && M(i) ? "" : i, ut(u.ref) ? [...u.ref.options].forEach((h) => h.selected = c.includes(h.value)) : u.refs ? ve(u.ref) ? u.refs.length > 1 ? u.refs.forEach((h) => (!h.defaultChecked || !h.disabled) && (h.checked = Array.isArray(c) ? !!c.find((x) => x === h.value) : c === h.value)) : u.refs[0] && (u.refs[0].checked = !!c) : u.refs.forEach((h) => h.checked = h.value === c) : Re(u.ref) ? u.ref.value = "" : (u.ref.value = c, u.ref.type || m.values.next({
|
|
569
|
+
name: t,
|
|
570
570
|
values: { ...a }
|
|
571
571
|
})));
|
|
572
572
|
}
|
|
573
|
-
(l.shouldDirty || l.shouldTouch) &&
|
|
574
|
-
}, W = (
|
|
573
|
+
(l.shouldDirty || l.shouldTouch) && Q(t, c, l.shouldTouch, l.shouldDirty, !0), l.shouldValidate && ye(t);
|
|
574
|
+
}, W = (t, i, l) => {
|
|
575
575
|
for (const d in i) {
|
|
576
|
-
const c = i[d], u = `${
|
|
577
|
-
(g.array.has(
|
|
576
|
+
const c = i[d], u = `${t}.${d}`, h = f(n, u);
|
|
577
|
+
(g.array.has(t) || !Fe(c) || h && !h._f) && !ue(c) ? W(u, c, l) : T(u, c, l);
|
|
578
578
|
}
|
|
579
|
-
},
|
|
580
|
-
const d = f(n,
|
|
581
|
-
V(a,
|
|
582
|
-
name:
|
|
579
|
+
}, U = (t, i, l = {}) => {
|
|
580
|
+
const d = f(n, t), c = g.array.has(t), u = H(i);
|
|
581
|
+
V(a, t, u), c ? (m.array.next({
|
|
582
|
+
name: t,
|
|
583
583
|
values: { ...a }
|
|
584
|
-
}), (F.isDirty || F.dirtyFields) && l.shouldDirty &&
|
|
585
|
-
name:
|
|
584
|
+
}), (F.isDirty || F.dirtyFields) && l.shouldDirty && m.state.next({
|
|
585
|
+
name: t,
|
|
586
586
|
dirtyFields: _e(o, a),
|
|
587
|
-
isDirty:
|
|
588
|
-
})) : d && !d._f && !M(u) ? W(
|
|
589
|
-
name: y.mount ?
|
|
587
|
+
isDirty: _(t, u)
|
|
588
|
+
})) : d && !d._f && !M(u) ? W(t, u, l) : T(t, u, l), Ye(t, g) && m.state.next({ ...r }), m.values.next({
|
|
589
|
+
name: y.mount ? t : void 0,
|
|
590
590
|
values: { ...a }
|
|
591
591
|
});
|
|
592
|
-
}, de = async (
|
|
592
|
+
}, de = async (t) => {
|
|
593
593
|
y.mount = !0;
|
|
594
|
-
const i =
|
|
594
|
+
const i = t.target;
|
|
595
595
|
let l = i.name, d = !0;
|
|
596
|
-
const c = f(n, l), u = () => i.type ? Ce(c._f) :
|
|
596
|
+
const c = f(n, l), u = () => i.type ? Ce(c._f) : Pt(t), h = (x) => {
|
|
597
597
|
d = Number.isNaN(x) || x === f(a, l, x);
|
|
598
598
|
};
|
|
599
599
|
if (c) {
|
|
600
600
|
let x, w;
|
|
601
|
-
const q = u(), ne =
|
|
602
|
-
V(a, l, q), ne ? (c._f.onBlur && c._f.onBlur(
|
|
603
|
-
const Se =
|
|
604
|
-
if (!ne &&
|
|
601
|
+
const q = u(), ne = t.type === Qe.BLUR || t.type === Qe.FOCUS_OUT, _t = !er(c._f) && !s.resolver && !f(r.errors, l) && !c._f.deps || tr(ne, f(r.touchedFields, l), r.isSubmitted, G, le), De = Ye(l, g, ne);
|
|
602
|
+
V(a, l, q), ne ? (c._f.onBlur && c._f.onBlur(t), R && R(0)) : c._f.onChange && c._f.onChange(t);
|
|
603
|
+
const Se = Q(l, q, ne, !1), mt = !P(Se) || De;
|
|
604
|
+
if (!ne && m.values.next({
|
|
605
605
|
name: l,
|
|
606
|
-
type:
|
|
606
|
+
type: t.type,
|
|
607
607
|
values: { ...a }
|
|
608
|
-
}),
|
|
609
|
-
return F.isValid && B(),
|
|
610
|
-
if (!ne && De &&
|
|
608
|
+
}), _t)
|
|
609
|
+
return F.isValid && B(), mt && m.state.next({ name: l, ...De ? {} : Se });
|
|
610
|
+
if (!ne && De && m.state.next({ ...r }), s.resolver) {
|
|
611
611
|
const { errors: $e } = await X([l]);
|
|
612
612
|
if (h(q), d) {
|
|
613
|
-
const
|
|
614
|
-
x = je.error, l = je.name, w =
|
|
613
|
+
const bt = it(r.errors, n, l), je = it($e, n, bt.name || l);
|
|
614
|
+
x = je.error, l = je.name, w = P($e);
|
|
615
615
|
}
|
|
616
616
|
} else
|
|
617
|
-
|
|
618
|
-
d && (c._f.deps && ye(c._f.deps),
|
|
617
|
+
J([l], !0), x = (await st(c, a, C, s.shouldUseNativeValidation))[l], J([l]), h(q), d && (x ? w = !1 : F.isValid && (w = await N(n, !0)));
|
|
618
|
+
d && (c._f.deps && ye(c._f.deps), L(l, w, x, Se));
|
|
619
619
|
}
|
|
620
|
-
}, fe = (
|
|
621
|
-
if (f(
|
|
622
|
-
return
|
|
623
|
-
}, ye = async (
|
|
620
|
+
}, fe = (t, i) => {
|
|
621
|
+
if (f(r.errors, i) && t.focus)
|
|
622
|
+
return t.focus(), 1;
|
|
623
|
+
}, ye = async (t, i = {}) => {
|
|
624
624
|
let l, d;
|
|
625
|
-
const c = me(
|
|
625
|
+
const c = me(t);
|
|
626
626
|
if (s.resolver) {
|
|
627
|
-
const u = await
|
|
628
|
-
l =
|
|
627
|
+
const u = await ee(k(t) ? t : c);
|
|
628
|
+
l = P(u), d = t ? !c.some((h) => f(u, h)) : l;
|
|
629
629
|
} else
|
|
630
|
-
|
|
630
|
+
t ? (d = (await Promise.all(c.map(async (u) => {
|
|
631
631
|
const h = f(n, u);
|
|
632
632
|
return await N(h && h._f ? { [u]: h } : h);
|
|
633
|
-
}))).every(Boolean), !(!d && !
|
|
634
|
-
return
|
|
635
|
-
...!
|
|
636
|
-
...s.resolver || !
|
|
637
|
-
errors:
|
|
638
|
-
}), i.shouldFocus && !d && ge(n, fe,
|
|
639
|
-
}, Ne = (
|
|
633
|
+
}))).every(Boolean), !(!d && !r.isValid) && B()) : d = l = await N(n);
|
|
634
|
+
return m.state.next({
|
|
635
|
+
...!Y(t) || F.isValid && l !== r.isValid ? {} : { name: t },
|
|
636
|
+
...s.resolver || !t ? { isValid: l } : {},
|
|
637
|
+
errors: r.errors
|
|
638
|
+
}), i.shouldFocus && !d && ge(n, fe, t ? c : g.mount), d;
|
|
639
|
+
}, Ne = (t) => {
|
|
640
640
|
const i = {
|
|
641
641
|
...y.mount ? a : o
|
|
642
642
|
};
|
|
643
|
-
return k(
|
|
644
|
-
}, Ue = (
|
|
645
|
-
invalid: !!f((i ||
|
|
646
|
-
isDirty: !!f((i ||
|
|
647
|
-
error: f((i ||
|
|
648
|
-
isValidating: !!f(
|
|
649
|
-
isTouched: !!f((i ||
|
|
650
|
-
}),
|
|
651
|
-
|
|
652
|
-
errors:
|
|
643
|
+
return k(t) ? i : Y(t) ? f(i, t) : t.map((l) => f(i, l));
|
|
644
|
+
}, Ue = (t, i) => ({
|
|
645
|
+
invalid: !!f((i || r).errors, t),
|
|
646
|
+
isDirty: !!f((i || r).dirtyFields, t),
|
|
647
|
+
error: f((i || r).errors, t),
|
|
648
|
+
isValidating: !!f(r.validatingFields, t),
|
|
649
|
+
isTouched: !!f((i || r).touchedFields, t)
|
|
650
|
+
}), yt = (t) => {
|
|
651
|
+
t && me(t).forEach((i) => S(r.errors, i)), m.state.next({
|
|
652
|
+
errors: t ? r.errors : {}
|
|
653
653
|
});
|
|
654
|
-
}, Ie = (
|
|
655
|
-
const d = (f(n,
|
|
656
|
-
V(
|
|
654
|
+
}, Ie = (t, i, l) => {
|
|
655
|
+
const d = (f(n, t, { _f: {} })._f || {}).ref, c = f(r.errors, t) || {}, { ref: u, message: h, type: x, ...w } = c;
|
|
656
|
+
V(r.errors, t, {
|
|
657
657
|
...w,
|
|
658
658
|
...i,
|
|
659
659
|
ref: d
|
|
660
|
-
}),
|
|
661
|
-
name:
|
|
662
|
-
errors:
|
|
660
|
+
}), m.state.next({
|
|
661
|
+
name: t,
|
|
662
|
+
errors: r.errors,
|
|
663
663
|
isValid: !1
|
|
664
664
|
}), l && l.shouldFocus && d && d.focus && d.focus();
|
|
665
|
-
},
|
|
666
|
-
next: (l) =>
|
|
667
|
-
}) : b(
|
|
668
|
-
for (const l of
|
|
669
|
-
g.mount.delete(l), g.array.delete(l), i.keepValue || (S(n, l), S(a, l)), !i.keepError && S(
|
|
670
|
-
|
|
665
|
+
}, ht = (t, i) => se(t) ? m.values.subscribe({
|
|
666
|
+
next: (l) => t(b(void 0, i), l)
|
|
667
|
+
}) : b(t, i, !0), ke = (t, i = {}) => {
|
|
668
|
+
for (const l of t ? me(t) : g.mount)
|
|
669
|
+
g.mount.delete(l), g.array.delete(l), i.keepValue || (S(n, l), S(a, l)), !i.keepError && S(r.errors, l), !i.keepDirty && S(r.dirtyFields, l), !i.keepTouched && S(r.touchedFields, l), !i.keepIsValidating && S(r.validatingFields, l), !s.shouldUnregister && !i.keepDefaultValue && S(o, l);
|
|
670
|
+
m.values.next({
|
|
671
671
|
values: { ...a }
|
|
672
|
-
}),
|
|
673
|
-
...
|
|
674
|
-
...i.keepDirty ? { isDirty:
|
|
672
|
+
}), m.state.next({
|
|
673
|
+
...r,
|
|
674
|
+
...i.keepDirty ? { isDirty: _() } : {}
|
|
675
675
|
}), !i.keepIsValid && B();
|
|
676
|
-
}, Pe = ({ disabled:
|
|
677
|
-
if (re(
|
|
678
|
-
const u =
|
|
679
|
-
V(a, i, u),
|
|
676
|
+
}, Pe = ({ disabled: t, name: i, field: l, fields: d, value: c }) => {
|
|
677
|
+
if (re(t) && y.mount || t) {
|
|
678
|
+
const u = t ? void 0 : k(c) ? Ce(l ? l._f : f(d, i)._f) : c;
|
|
679
|
+
V(a, i, u), Q(i, u, !1, !1, !0);
|
|
680
680
|
}
|
|
681
|
-
}, we = (
|
|
682
|
-
let l = f(n,
|
|
681
|
+
}, we = (t, i = {}) => {
|
|
682
|
+
let l = f(n, t);
|
|
683
683
|
const d = re(i.disabled);
|
|
684
|
-
return V(n,
|
|
684
|
+
return V(n, t, {
|
|
685
685
|
...l || {},
|
|
686
686
|
_f: {
|
|
687
|
-
...l && l._f ? l._f : { ref: { name:
|
|
688
|
-
name:
|
|
687
|
+
...l && l._f ? l._f : { ref: { name: t } },
|
|
688
|
+
name: t,
|
|
689
689
|
mount: !0,
|
|
690
690
|
...i
|
|
691
691
|
}
|
|
692
|
-
}), g.mount.add(
|
|
692
|
+
}), g.mount.add(t), l ? Pe({
|
|
693
693
|
field: l,
|
|
694
694
|
disabled: i.disabled,
|
|
695
|
-
name:
|
|
695
|
+
name: t,
|
|
696
696
|
value: i.value
|
|
697
|
-
}) : p(
|
|
697
|
+
}) : p(t, !0, i.value), {
|
|
698
698
|
...d ? { disabled: i.disabled } : {},
|
|
699
699
|
...s.progressive ? {
|
|
700
700
|
required: !!i.required,
|
|
@@ -704,79 +704,79 @@ function it(e = {}) {
|
|
|
704
704
|
maxLength: he(i.maxLength),
|
|
705
705
|
pattern: he(i.pattern)
|
|
706
706
|
} : {},
|
|
707
|
-
name:
|
|
707
|
+
name: t,
|
|
708
708
|
onChange: de,
|
|
709
709
|
onBlur: de,
|
|
710
710
|
ref: (c) => {
|
|
711
711
|
if (c) {
|
|
712
|
-
we(
|
|
713
|
-
const u = k(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h =
|
|
712
|
+
we(t, i), l = f(n, t);
|
|
713
|
+
const u = k(c.value) && c.querySelectorAll && c.querySelectorAll("input,select,textarea")[0] || c, h = Yt(u), x = l._f.refs || [];
|
|
714
714
|
if (h ? x.find((w) => w === u) : u === l._f.ref)
|
|
715
715
|
return;
|
|
716
|
-
V(n,
|
|
716
|
+
V(n, t, {
|
|
717
717
|
_f: {
|
|
718
718
|
...l._f,
|
|
719
719
|
...h ? {
|
|
720
720
|
refs: [
|
|
721
721
|
...x.filter(Be),
|
|
722
722
|
u,
|
|
723
|
-
...Array.isArray(f(o,
|
|
723
|
+
...Array.isArray(f(o, t)) ? [{}] : []
|
|
724
724
|
],
|
|
725
|
-
ref: { type: u.type, name:
|
|
725
|
+
ref: { type: u.type, name: t }
|
|
726
726
|
} : { ref: u }
|
|
727
727
|
}
|
|
728
|
-
}), p(
|
|
728
|
+
}), p(t, !1, void 0, u);
|
|
729
729
|
} else
|
|
730
|
-
l = f(n,
|
|
730
|
+
l = f(n, t, {}), l._f && (l._f.mount = !1), (s.shouldUnregister || i.shouldUnregister) && !(qt(g.array, t) && y.action) && g.unMount.add(t);
|
|
731
731
|
}
|
|
732
732
|
};
|
|
733
|
-
}, We = () => s.shouldFocusError && ge(n, fe, g.mount),
|
|
734
|
-
re(
|
|
733
|
+
}, We = () => s.shouldFocusError && ge(n, fe, g.mount), gt = (t) => {
|
|
734
|
+
re(t) && (m.state.next({ disabled: t }), ge(n, (i, l) => {
|
|
735
735
|
const d = f(n, l);
|
|
736
|
-
d && (i.disabled = d._f.disabled ||
|
|
737
|
-
c.disabled = d._f.disabled ||
|
|
736
|
+
d && (i.disabled = d._f.disabled || t, Array.isArray(d._f.refs) && d._f.refs.forEach((c) => {
|
|
737
|
+
c.disabled = d._f.disabled || t;
|
|
738
738
|
}));
|
|
739
739
|
}, 0, !1));
|
|
740
|
-
}, qe = (
|
|
740
|
+
}, qe = (t, i) => async (l) => {
|
|
741
741
|
let d;
|
|
742
742
|
l && (l.preventDefault && l.preventDefault(), l.persist && l.persist());
|
|
743
|
-
let c =
|
|
744
|
-
if (
|
|
743
|
+
let c = H(a);
|
|
744
|
+
if (m.state.next({
|
|
745
745
|
isSubmitting: !0
|
|
746
746
|
}), s.resolver) {
|
|
747
747
|
const { errors: u, values: h } = await X();
|
|
748
|
-
|
|
748
|
+
r.errors = u, c = h;
|
|
749
749
|
} else
|
|
750
750
|
await N(n);
|
|
751
|
-
if (S(
|
|
752
|
-
|
|
751
|
+
if (S(r.errors, "root"), P(r.errors)) {
|
|
752
|
+
m.state.next({
|
|
753
753
|
errors: {}
|
|
754
754
|
});
|
|
755
755
|
try {
|
|
756
|
-
await
|
|
756
|
+
await t(c, l);
|
|
757
757
|
} catch (u) {
|
|
758
758
|
d = u;
|
|
759
759
|
}
|
|
760
760
|
} else
|
|
761
|
-
i && await i({ ...
|
|
762
|
-
if (
|
|
761
|
+
i && await i({ ...r.errors }, l), We(), setTimeout(We);
|
|
762
|
+
if (m.state.next({
|
|
763
763
|
isSubmitted: !0,
|
|
764
764
|
isSubmitting: !1,
|
|
765
|
-
isSubmitSuccessful:
|
|
766
|
-
submitCount:
|
|
767
|
-
errors:
|
|
765
|
+
isSubmitSuccessful: P(r.errors) && !d,
|
|
766
|
+
submitCount: r.submitCount + 1,
|
|
767
|
+
errors: r.errors
|
|
768
768
|
}), d)
|
|
769
769
|
throw d;
|
|
770
|
-
},
|
|
771
|
-
f(n,
|
|
772
|
-
}, He = (
|
|
773
|
-
const l =
|
|
770
|
+
}, vt = (t, i = {}) => {
|
|
771
|
+
f(n, t) && (k(i.defaultValue) ? U(t, H(f(o, t))) : (U(t, i.defaultValue), V(o, t, H(i.defaultValue))), i.keepTouched || S(r.touchedFields, t), i.keepDirty || (S(r.dirtyFields, t), r.isDirty = i.defaultValue ? _(t, H(f(o, t))) : _()), i.keepError || (S(r.errors, t), F.isValid && B()), m.state.next({ ...r }));
|
|
772
|
+
}, He = (t, i = {}) => {
|
|
773
|
+
const l = t ? H(t) : o, d = H(l), c = P(t), u = c ? o : d;
|
|
774
774
|
if (i.keepDefaultValues || (o = l), !i.keepValues) {
|
|
775
775
|
if (i.keepDirtyValues)
|
|
776
776
|
for (const h of g.mount)
|
|
777
|
-
f(
|
|
777
|
+
f(r.dirtyFields, h) ? V(u, h, f(a, h)) : U(h, f(u, h));
|
|
778
778
|
else {
|
|
779
|
-
if (Le && k(
|
|
779
|
+
if (Le && k(t))
|
|
780
780
|
for (const h of g.mount) {
|
|
781
781
|
const x = f(n, h);
|
|
782
782
|
if (x && x._f) {
|
|
@@ -792,9 +792,9 @@ function it(e = {}) {
|
|
|
792
792
|
}
|
|
793
793
|
n = {};
|
|
794
794
|
}
|
|
795
|
-
a = e.shouldUnregister ? i.keepDefaultValues ?
|
|
795
|
+
a = e.shouldUnregister ? i.keepDefaultValues ? H(o) : {} : H(u), m.array.next({
|
|
796
796
|
values: { ...u }
|
|
797
|
-
}),
|
|
797
|
+
}), m.values.next({
|
|
798
798
|
values: { ...u }
|
|
799
799
|
});
|
|
800
800
|
}
|
|
@@ -805,17 +805,17 @@ function it(e = {}) {
|
|
|
805
805
|
watch: /* @__PURE__ */ new Set(),
|
|
806
806
|
watchAll: !1,
|
|
807
807
|
focus: ""
|
|
808
|
-
}, y.mount = !F.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister,
|
|
809
|
-
submitCount: i.keepSubmitCount ?
|
|
810
|
-
isDirty: c ? !1 : i.keepDirty ?
|
|
811
|
-
isSubmitted: i.keepIsSubmitted ?
|
|
812
|
-
dirtyFields: c ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? _e(o, a) :
|
|
813
|
-
touchedFields: i.keepTouched ?
|
|
814
|
-
errors: i.keepErrors ?
|
|
815
|
-
isSubmitSuccessful: i.keepIsSubmitSuccessful ?
|
|
808
|
+
}, y.mount = !F.isValid || !!i.keepIsValid || !!i.keepDirtyValues, y.watch = !!e.shouldUnregister, m.state.next({
|
|
809
|
+
submitCount: i.keepSubmitCount ? r.submitCount : 0,
|
|
810
|
+
isDirty: c ? !1 : i.keepDirty ? r.isDirty : !!(i.keepDefaultValues && !ie(t, o)),
|
|
811
|
+
isSubmitted: i.keepIsSubmitted ? r.isSubmitted : !1,
|
|
812
|
+
dirtyFields: c ? {} : i.keepDirtyValues ? i.keepDefaultValues && a ? _e(o, a) : r.dirtyFields : i.keepDefaultValues && t ? _e(o, t) : i.keepDirty ? r.dirtyFields : {},
|
|
813
|
+
touchedFields: i.keepTouched ? r.touchedFields : {},
|
|
814
|
+
errors: i.keepErrors ? r.errors : {},
|
|
815
|
+
isSubmitSuccessful: i.keepIsSubmitSuccessful ? r.isSubmitSuccessful : !1,
|
|
816
816
|
isSubmitting: !1
|
|
817
817
|
});
|
|
818
|
-
}, ze = (
|
|
818
|
+
}, ze = (t, i) => He(se(t) ? t(a) : t, i);
|
|
819
819
|
return {
|
|
820
820
|
control: {
|
|
821
821
|
register: we,
|
|
@@ -825,28 +825,28 @@ function it(e = {}) {
|
|
|
825
825
|
setError: Ie,
|
|
826
826
|
_executeSchema: X,
|
|
827
827
|
_getWatch: b,
|
|
828
|
-
_getDirty:
|
|
828
|
+
_getDirty: _,
|
|
829
829
|
_updateValid: B,
|
|
830
830
|
_removeUnmounted: ae,
|
|
831
|
-
_updateFieldArray:
|
|
831
|
+
_updateFieldArray: v,
|
|
832
832
|
_updateDisabledField: Pe,
|
|
833
833
|
_getFieldArray: A,
|
|
834
834
|
_reset: He,
|
|
835
|
-
_resetDefaultValues: () =>
|
|
836
|
-
ze(
|
|
835
|
+
_resetDefaultValues: () => se(s.defaultValues) && s.defaultValues().then((t) => {
|
|
836
|
+
ze(t, s.resetOptions), m.state.next({
|
|
837
837
|
isLoading: !1
|
|
838
838
|
});
|
|
839
839
|
}),
|
|
840
|
-
_updateFormState: (
|
|
841
|
-
|
|
842
|
-
...
|
|
843
|
-
...
|
|
840
|
+
_updateFormState: (t) => {
|
|
841
|
+
r = {
|
|
842
|
+
...r,
|
|
843
|
+
...t
|
|
844
844
|
};
|
|
845
845
|
},
|
|
846
|
-
_disableForm:
|
|
847
|
-
_subjects:
|
|
846
|
+
_disableForm: gt,
|
|
847
|
+
_subjects: m,
|
|
848
848
|
_proxyFormState: F,
|
|
849
|
-
_setErrors:
|
|
849
|
+
_setErrors: j,
|
|
850
850
|
get _fields() {
|
|
851
851
|
return n;
|
|
852
852
|
},
|
|
@@ -856,8 +856,8 @@ function it(e = {}) {
|
|
|
856
856
|
get _state() {
|
|
857
857
|
return y;
|
|
858
858
|
},
|
|
859
|
-
set _state(
|
|
860
|
-
y =
|
|
859
|
+
set _state(t) {
|
|
860
|
+
y = t;
|
|
861
861
|
},
|
|
862
862
|
get _defaultValues() {
|
|
863
863
|
return o;
|
|
@@ -865,38 +865,38 @@ function it(e = {}) {
|
|
|
865
865
|
get _names() {
|
|
866
866
|
return g;
|
|
867
867
|
},
|
|
868
|
-
set _names(
|
|
869
|
-
g =
|
|
868
|
+
set _names(t) {
|
|
869
|
+
g = t;
|
|
870
870
|
},
|
|
871
871
|
get _formState() {
|
|
872
|
-
return
|
|
872
|
+
return r;
|
|
873
873
|
},
|
|
874
|
-
set _formState(
|
|
875
|
-
|
|
874
|
+
set _formState(t) {
|
|
875
|
+
r = t;
|
|
876
876
|
},
|
|
877
877
|
get _options() {
|
|
878
878
|
return s;
|
|
879
879
|
},
|
|
880
|
-
set _options(
|
|
880
|
+
set _options(t) {
|
|
881
881
|
s = {
|
|
882
882
|
...s,
|
|
883
|
-
...
|
|
883
|
+
...t
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
886
|
},
|
|
887
887
|
trigger: ye,
|
|
888
888
|
register: we,
|
|
889
889
|
handleSubmit: qe,
|
|
890
|
-
watch:
|
|
891
|
-
setValue:
|
|
890
|
+
watch: ht,
|
|
891
|
+
setValue: U,
|
|
892
892
|
getValues: Ne,
|
|
893
893
|
reset: ze,
|
|
894
|
-
resetField:
|
|
895
|
-
clearErrors:
|
|
894
|
+
resetField: vt,
|
|
895
|
+
clearErrors: yt,
|
|
896
896
|
unregister: ke,
|
|
897
897
|
setError: Ie,
|
|
898
|
-
setFocus: (
|
|
899
|
-
const l = f(n,
|
|
898
|
+
setFocus: (t, i = {}) => {
|
|
899
|
+
const l = f(n, t), d = l && l._f;
|
|
900
900
|
if (d) {
|
|
901
901
|
const c = d.refs ? d.refs[0] : d.ref;
|
|
902
902
|
c.focus && (c.focus(), i.shouldSelect && c.select());
|
|
@@ -905,11 +905,11 @@ function it(e = {}) {
|
|
|
905
905
|
getFieldState: Ue
|
|
906
906
|
};
|
|
907
907
|
}
|
|
908
|
-
function
|
|
909
|
-
const s =
|
|
908
|
+
function lr(e = {}) {
|
|
909
|
+
const s = z.useRef(), r = z.useRef(), [n, o] = z.useState({
|
|
910
910
|
isDirty: !1,
|
|
911
911
|
isValidating: !1,
|
|
912
|
-
isLoading:
|
|
912
|
+
isLoading: se(e.defaultValues),
|
|
913
913
|
isSubmitted: !1,
|
|
914
914
|
isSubmitting: !1,
|
|
915
915
|
isSubmitSuccessful: !1,
|
|
@@ -920,118 +920,119 @@ function lt(e = {}) {
|
|
|
920
920
|
validatingFields: {},
|
|
921
921
|
errors: e.errors || {},
|
|
922
922
|
disabled: e.disabled || !1,
|
|
923
|
-
defaultValues:
|
|
923
|
+
defaultValues: se(e.defaultValues) ? void 0 : e.defaultValues
|
|
924
924
|
});
|
|
925
925
|
s.current || (s.current = {
|
|
926
|
-
...
|
|
926
|
+
...ir(e),
|
|
927
927
|
formState: n
|
|
928
928
|
});
|
|
929
929
|
const a = s.current.control;
|
|
930
|
-
return a._options = e,
|
|
930
|
+
return a._options = e, jt({
|
|
931
931
|
subject: a._subjects.state,
|
|
932
932
|
next: (y) => {
|
|
933
|
-
$
|
|
933
|
+
$t(y, a._proxyFormState, a._updateFormState) && o({ ...a._formState });
|
|
934
934
|
}
|
|
935
|
-
}),
|
|
935
|
+
}), z.useEffect(() => a._disableForm(e.disabled), [a, e.disabled]), z.useEffect(() => {
|
|
936
936
|
if (a._proxyFormState.isDirty) {
|
|
937
937
|
const y = a._getDirty();
|
|
938
938
|
y !== n.isDirty && a._subjects.state.next({
|
|
939
939
|
isDirty: y
|
|
940
940
|
});
|
|
941
941
|
}
|
|
942
|
-
}, [a, n.isDirty]),
|
|
943
|
-
e.values && !ie(e.values,
|
|
944
|
-
}, [e.values, a]),
|
|
942
|
+
}, [a, n.isDirty]), z.useEffect(() => {
|
|
943
|
+
e.values && !ie(e.values, r.current) ? (a._reset(e.values, a._options.resetOptions), r.current = e.values, o((y) => ({ ...y }))) : a._resetDefaultValues();
|
|
944
|
+
}, [e.values, a]), z.useEffect(() => {
|
|
945
945
|
e.errors && a._setErrors(e.errors);
|
|
946
|
-
}, [e.errors, a]),
|
|
946
|
+
}, [e.errors, a]), z.useEffect(() => {
|
|
947
947
|
a._state.mount || (a._updateValid(), a._state.mount = !0), a._state.watch && (a._state.watch = !1, a._subjects.state.next({ ...a._formState })), a._removeUnmounted();
|
|
948
|
-
}),
|
|
948
|
+
}), z.useEffect(() => {
|
|
949
949
|
e.shouldUnregister && a._subjects.values.next({
|
|
950
950
|
values: a._getWatch()
|
|
951
951
|
});
|
|
952
|
-
}, [e.shouldUnregister, a]), s.current.formState =
|
|
952
|
+
}, [e.shouldUnregister, a]), s.current.formState = zt(n, a), s.current;
|
|
953
953
|
}
|
|
954
|
-
const
|
|
954
|
+
const ar = "Я принимаю условия Политики обработки и защиты персональных данных, даю согласия на обработку персональных данных", Fr = ({
|
|
955
955
|
isFormOpen: e,
|
|
956
956
|
setIsFormOpen: s,
|
|
957
|
-
isNews:
|
|
957
|
+
isNews: r,
|
|
958
958
|
title: n,
|
|
959
959
|
isEmail: o,
|
|
960
960
|
isPhone: a,
|
|
961
961
|
isTextArea: y,
|
|
962
962
|
telegramLink: g = "https://t.me/stone_developer",
|
|
963
|
-
isRequiredPhone:
|
|
963
|
+
isRequiredPhone: R = !0,
|
|
964
964
|
isRequiredEmail: O = !1,
|
|
965
965
|
isRequiredPhoneOrEmail: F,
|
|
966
|
-
textAreaPlaceholder:
|
|
966
|
+
textAreaPlaceholder: m,
|
|
967
967
|
subTitle: le,
|
|
968
|
-
submitHandler:
|
|
969
|
-
modalWidth:
|
|
968
|
+
submitHandler: G,
|
|
969
|
+
modalWidth: C = "442px",
|
|
970
970
|
rowsTextArea: ce = 2,
|
|
971
|
-
advCheckBox: B = { text:
|
|
971
|
+
advCheckBox: B = { text: ar, isRequired: !0 },
|
|
972
|
+
isAdvCheckBox: J
|
|
972
973
|
}) => {
|
|
973
974
|
const {
|
|
974
|
-
register:
|
|
975
|
-
handleSubmit:
|
|
975
|
+
register: v,
|
|
976
|
+
handleSubmit: $,
|
|
976
977
|
trigger: j,
|
|
977
|
-
reset:
|
|
978
|
-
watch:
|
|
979
|
-
formState: { errors:
|
|
980
|
-
} =
|
|
981
|
-
required: O || F && !
|
|
982
|
-
pattern: { value:
|
|
978
|
+
reset: p,
|
|
979
|
+
watch: Q,
|
|
980
|
+
formState: { errors: L }
|
|
981
|
+
} = lr(), X = !!Q("email"), { onChange: ee, onBlur: N, ...ae } = v("phone", {
|
|
982
|
+
required: O || R || F && !X,
|
|
983
|
+
pattern: { value: pt, message: "" },
|
|
983
984
|
onBlur: () => j("phone")
|
|
984
|
-
}), { isMobile:
|
|
985
|
-
|
|
985
|
+
}), { isMobile: _, currentClientWidth: b } = Dt(), A = Q("personalCheckBox"), T = Q("advCheckBox"), W = (U) => {
|
|
986
|
+
G(U), p();
|
|
986
987
|
};
|
|
987
|
-
return
|
|
988
|
-
|
|
988
|
+
return b ? /* @__PURE__ */ D(
|
|
989
|
+
Vt,
|
|
989
990
|
{
|
|
990
991
|
isOpen: e,
|
|
991
992
|
emitIsOpen: () => s(!1),
|
|
992
|
-
additionalClass:
|
|
993
|
+
additionalClass: I.modal,
|
|
993
994
|
opacity: 0.7,
|
|
994
995
|
isTransparentBack: !0,
|
|
995
|
-
additionalClassModalBody:
|
|
996
|
-
children: /* @__PURE__ */
|
|
996
|
+
additionalClassModalBody: I.modalBody,
|
|
997
|
+
children: /* @__PURE__ */ te(
|
|
997
998
|
"div",
|
|
998
999
|
{
|
|
999
|
-
className:
|
|
1000
|
-
style: { width:
|
|
1000
|
+
className: I.root,
|
|
1001
|
+
style: { width: _ ? "100%" : C },
|
|
1001
1002
|
children: [
|
|
1002
1003
|
/* @__PURE__ */ D(
|
|
1003
1004
|
"div",
|
|
1004
1005
|
{
|
|
1005
|
-
className:
|
|
1006
|
+
className: I.title,
|
|
1006
1007
|
dangerouslySetInnerHTML: { __html: n ?? "Оставить обращение" }
|
|
1007
1008
|
}
|
|
1008
1009
|
),
|
|
1009
|
-
|
|
1010
|
+
r && /* @__PURE__ */ te("div", { className: I.telegramWrapper, children: [
|
|
1010
1011
|
/* @__PURE__ */ D(
|
|
1011
1012
|
"a",
|
|
1012
1013
|
{
|
|
1013
|
-
className:
|
|
1014
|
+
className: I.telegramLink,
|
|
1014
1015
|
href: g,
|
|
1015
1016
|
target: "_blank",
|
|
1016
|
-
children: /* @__PURE__ */
|
|
1017
|
+
children: /* @__PURE__ */ te("div", { className: I.telegram, children: [
|
|
1017
1018
|
/* @__PURE__ */ D("div", { children: "Подписаться в Telegram" }),
|
|
1018
1019
|
/* @__PURE__ */ D(Ge, { name: "telegram" })
|
|
1019
1020
|
] })
|
|
1020
1021
|
}
|
|
1021
1022
|
),
|
|
1022
|
-
/* @__PURE__ */ D("div", { className:
|
|
1023
|
+
/* @__PURE__ */ D("div", { className: I.orText, children: "или" })
|
|
1023
1024
|
] }),
|
|
1024
|
-
!
|
|
1025
|
+
!r && /* @__PURE__ */ D(
|
|
1025
1026
|
"div",
|
|
1026
1027
|
{
|
|
1027
|
-
className:
|
|
1028
|
+
className: I.description,
|
|
1028
1029
|
dangerouslySetInnerHTML: {
|
|
1029
|
-
__html: le && !
|
|
1030
|
+
__html: le && !r ? "Оставьте номер телефона для получения консультации" : `${/* @__PURE__ */ D("div", { children: "привет" })}`
|
|
1030
1031
|
}
|
|
1031
1032
|
}
|
|
1032
1033
|
),
|
|
1033
|
-
/* @__PURE__ */
|
|
1034
|
-
/* @__PURE__ */
|
|
1034
|
+
/* @__PURE__ */ te("form", { onSubmit: $(W), children: [
|
|
1035
|
+
/* @__PURE__ */ te(Ft, { className: I.inputWrapper, children: [
|
|
1035
1036
|
/* @__PURE__ */ D(
|
|
1036
1037
|
Ee,
|
|
1037
1038
|
{
|
|
@@ -1040,19 +1041,19 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1040
1041
|
variant: "light",
|
|
1041
1042
|
placeholder: "Введите имя",
|
|
1042
1043
|
"data-testid": "modal_name",
|
|
1043
|
-
...
|
|
1044
|
-
error: !!
|
|
1044
|
+
...v("name", { required: !0, pattern: At }),
|
|
1045
|
+
error: !!L.name
|
|
1045
1046
|
}
|
|
1046
1047
|
),
|
|
1047
1048
|
a && /* @__PURE__ */ D(
|
|
1048
|
-
|
|
1049
|
+
xt,
|
|
1049
1050
|
{
|
|
1050
1051
|
inputMode: "numeric",
|
|
1051
1052
|
name: "phone",
|
|
1052
1053
|
mask: "+7 (999) 999-99-99",
|
|
1053
|
-
onChange:
|
|
1054
|
+
onChange: ee,
|
|
1054
1055
|
placeholder: "+7 (- - -) - - - - - - -",
|
|
1055
|
-
onBlur:
|
|
1056
|
+
onBlur: N,
|
|
1056
1057
|
children: /* @__PURE__ */ D(
|
|
1057
1058
|
Ee,
|
|
1058
1059
|
{
|
|
@@ -1061,9 +1062,9 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1061
1062
|
type: "tel",
|
|
1062
1063
|
size_s: "small",
|
|
1063
1064
|
variant: "light",
|
|
1064
|
-
...
|
|
1065
|
-
...
|
|
1066
|
-
error: !!
|
|
1065
|
+
...ae,
|
|
1066
|
+
...v("phone"),
|
|
1067
|
+
error: !!L.phone
|
|
1067
1068
|
}
|
|
1068
1069
|
)
|
|
1069
1070
|
}
|
|
@@ -1076,48 +1077,48 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1076
1077
|
variant: "light",
|
|
1077
1078
|
placeholder: "Введите email",
|
|
1078
1079
|
"data-testid": "modal_email",
|
|
1079
|
-
...
|
|
1080
|
-
required: O || F && !
|
|
1081
|
-
pattern:
|
|
1080
|
+
...v("email", {
|
|
1081
|
+
required: O || F && !X,
|
|
1082
|
+
pattern: kt
|
|
1082
1083
|
}),
|
|
1083
|
-
error: !!
|
|
1084
|
+
error: !!L.email
|
|
1084
1085
|
}
|
|
1085
1086
|
),
|
|
1086
1087
|
y && /* @__PURE__ */ D(
|
|
1087
|
-
|
|
1088
|
+
wt,
|
|
1088
1089
|
{
|
|
1089
1090
|
"data-testid": "modal_textarea",
|
|
1090
|
-
placeholder:
|
|
1091
|
+
placeholder: m,
|
|
1091
1092
|
rows: ce,
|
|
1092
1093
|
width: "full",
|
|
1093
|
-
...
|
|
1094
|
+
...v("textarea")
|
|
1094
1095
|
}
|
|
1095
1096
|
),
|
|
1096
|
-
B && !
|
|
1097
|
+
B && !r && J && /* @__PURE__ */ D(
|
|
1097
1098
|
Je,
|
|
1098
1099
|
{
|
|
1099
1100
|
"data-testid": "modal_advCheckBox",
|
|
1100
|
-
isChecked:
|
|
1101
|
-
error: !!
|
|
1101
|
+
isChecked: T,
|
|
1102
|
+
error: !!L.advCheckBox,
|
|
1102
1103
|
text: B.text,
|
|
1103
|
-
...
|
|
1104
|
+
...v("advCheckBox", { required: B == null ? void 0 : B.isRequired })
|
|
1104
1105
|
}
|
|
1105
1106
|
),
|
|
1106
|
-
/* @__PURE__ */
|
|
1107
|
+
/* @__PURE__ */ te(
|
|
1107
1108
|
Je,
|
|
1108
1109
|
{
|
|
1109
1110
|
"data-testid": "modal_personalCheckBox",
|
|
1110
|
-
isChecked:
|
|
1111
|
-
error: !!
|
|
1112
|
-
...
|
|
1111
|
+
isChecked: A,
|
|
1112
|
+
error: !!L.personalCheckBox,
|
|
1113
|
+
...v("personalCheckBox", { required: !r }),
|
|
1113
1114
|
children: [
|
|
1114
|
-
|
|
1115
|
+
r && /* @__PURE__ */ te("div", { children: [
|
|
1115
1116
|
"Согласен(-на)",
|
|
1116
1117
|
" ",
|
|
1117
1118
|
/* @__PURE__ */ D(
|
|
1118
1119
|
"a",
|
|
1119
1120
|
{
|
|
1120
|
-
className:
|
|
1121
|
+
className: I.linkPolicy,
|
|
1121
1122
|
href: "/documents/soglasie-na-rassylki",
|
|
1122
1123
|
children: "получать новости, информацию по сделке и рекламу"
|
|
1123
1124
|
}
|
|
@@ -1125,13 +1126,13 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1125
1126
|
" ",
|
|
1126
1127
|
"от Stone"
|
|
1127
1128
|
] }),
|
|
1128
|
-
!
|
|
1129
|
+
!r && /* @__PURE__ */ te("div", { children: [
|
|
1129
1130
|
"Я принимаю условия",
|
|
1130
1131
|
" ",
|
|
1131
1132
|
/* @__PURE__ */ D(
|
|
1132
1133
|
"a",
|
|
1133
1134
|
{
|
|
1134
|
-
className:
|
|
1135
|
+
className: I.linkPolicy,
|
|
1135
1136
|
href: "/documents/docs",
|
|
1136
1137
|
children: "Политики обработки и защиты персональных данных"
|
|
1137
1138
|
}
|
|
@@ -1150,8 +1151,8 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1150
1151
|
type: "submit",
|
|
1151
1152
|
size: "large",
|
|
1152
1153
|
as: "button",
|
|
1153
|
-
additionalClass:
|
|
1154
|
-
disabled: !!
|
|
1154
|
+
additionalClass: I.modalBtn,
|
|
1155
|
+
disabled: !!L.name || !!L.phone && R || !!L.email && O || !!L.advCheckBox && (B == null ? void 0 : B.isRequired) || !!L.personalCheckBox && !r,
|
|
1155
1156
|
children: "Отправить запрос"
|
|
1156
1157
|
}
|
|
1157
1158
|
)
|
|
@@ -1159,7 +1160,7 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1159
1160
|
/* @__PURE__ */ D(
|
|
1160
1161
|
Ke,
|
|
1161
1162
|
{
|
|
1162
|
-
additionalClass:
|
|
1163
|
+
additionalClass: I.btn,
|
|
1163
1164
|
onClick: () => s(!1),
|
|
1164
1165
|
as: "button",
|
|
1165
1166
|
variant: "gray",
|
|
@@ -1183,5 +1184,5 @@ const at = "Я принимаю условия Политики обработк
|
|
|
1183
1184
|
) : null;
|
|
1184
1185
|
};
|
|
1185
1186
|
export {
|
|
1186
|
-
|
|
1187
|
+
Fr as ModalForm
|
|
1187
1188
|
};
|