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