solid-hook-form 1.6.2 → 1.6.4
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.
- package/dist/main.d.ts +78 -4
- package/dist/main.js +343 -1380
- package/dist/main.jsx +395 -0
- package/package.json +8 -6
- package/dist/form_context.d.ts +0 -1
- package/dist/form_provider.d.ts +0 -7
- package/dist/logic/create_errors.d.ts +0 -10
- package/dist/logic/create_fields.d.ts +0 -6
- package/dist/logic/create_rules.d.ts +0 -8
- package/dist/logic/format_value.d.ts +0 -4
- package/dist/logic/get_value.d.ts +0 -1
- package/dist/logic/set_value.d.ts +0 -1
- package/dist/logic/validate.d.ts +0 -5
- package/dist/main.umd.cjs +0 -29
- package/dist/types/errors.d.ts +0 -10
- package/dist/types/form.d.ts +0 -32
- package/dist/types/path.d.ts +0 -1
- package/dist/types/validate.d.ts +0 -21
- package/dist/use_form.d.ts +0 -9
- package/dist/use_form_context.d.ts +0 -2
- package/dist/utils/get.d.ts +0 -1
- package/dist/utils/resolver.d.ts +0 -5
- package/dist/utils/set.d.ts +0 -1
package/dist/main.js
CHANGED
|
@@ -1,1427 +1,390 @@
|
|
|
1
|
-
import { createSignal
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { createContext, createSignal, createMemo, useContext } from 'solid-js';
|
|
2
|
+
import { createComponent } from 'solid-js/web';
|
|
3
|
+
|
|
4
|
+
// src/use_form.ts
|
|
5
|
+
|
|
6
|
+
// src/logic/get_value.ts
|
|
7
|
+
var getFieldValue = (event) => {
|
|
8
|
+
const field = event.target;
|
|
9
|
+
if (field instanceof HTMLSelectElement) {
|
|
10
|
+
return field.value;
|
|
11
|
+
}
|
|
12
|
+
if (field instanceof HTMLInputElement && field.type === "checkbox") {
|
|
13
|
+
return field.checked;
|
|
14
|
+
}
|
|
15
|
+
if (field instanceof HTMLInputElement && field.type === "file") {
|
|
16
|
+
return [...field.files || []];
|
|
17
|
+
}
|
|
18
|
+
return field.value;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// src/logic/set_value.ts
|
|
22
|
+
var setFieldValue = (field, value) => {
|
|
23
|
+
if (field instanceof HTMLSelectElement) {
|
|
24
|
+
field.value = value;
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (field instanceof HTMLInputElement && field.type === "checkbox") {
|
|
28
|
+
field.checked = value;
|
|
8
29
|
return;
|
|
9
30
|
}
|
|
10
|
-
if (
|
|
11
|
-
n.checked = u;
|
|
31
|
+
if (field instanceof HTMLInputElement && field.type === "file") {
|
|
12
32
|
return;
|
|
13
33
|
}
|
|
14
|
-
|
|
34
|
+
field.value = value;
|
|
15
35
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
* LICENSE file in the root directory of this source tree.
|
|
28
|
-
*/
|
|
29
|
-
var Le;
|
|
30
|
-
function tt() {
|
|
31
|
-
if (Le) return p;
|
|
32
|
-
Le = 1;
|
|
33
|
-
var n = Symbol.for("react.transitional.element"), u = Symbol.for("react.portal"), y = Symbol.for("react.fragment"), v = Symbol.for("react.strict_mode"), T = Symbol.for("react.profiler"), k = Symbol.for("react.consumer"), N = Symbol.for("react.context"), j = Symbol.for("react.forward_ref"), L = Symbol.for("react.suspense"), $ = Symbol.for("react.memo"), M = Symbol.for("react.lazy"), W = Symbol.iterator;
|
|
34
|
-
function B(t) {
|
|
35
|
-
return t === null || typeof t != "object" ? null : (t = W && t[W] || t["@@iterator"], typeof t == "function" ? t : null);
|
|
36
|
+
|
|
37
|
+
// src/utils/get.ts
|
|
38
|
+
var isDateObject = (value) => value instanceof Date;
|
|
39
|
+
var isNullOrUndefined = (value) => value == null;
|
|
40
|
+
var isObjectType = (value) => typeof value === "object";
|
|
41
|
+
var isObject = (value) => !isNullOrUndefined(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
|
|
42
|
+
var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
|
|
43
|
+
var isUndefined = (val) => val === void 0;
|
|
44
|
+
var get = (object, path, defaultValue) => {
|
|
45
|
+
if (!path || !isObject(object)) {
|
|
46
|
+
return defaultValue;
|
|
36
47
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
function U(t, o, f) {
|
|
49
|
-
this.props = t, this.context = o, this.refs = ee, this.updater = f || Q;
|
|
48
|
+
const result = compact(path.split(/[,[\].]+?/)).reduce(
|
|
49
|
+
(result2, key) => isNullOrUndefined(result2) ? result2 : result2[key],
|
|
50
|
+
object
|
|
51
|
+
);
|
|
52
|
+
return isUndefined(result) || result === object ? isUndefined(object[path]) ? defaultValue : object[path] : result;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
// src/logic/validate.ts
|
|
56
|
+
var getRuleValue = (rule) => {
|
|
57
|
+
if (rule instanceof RegExp) {
|
|
58
|
+
return rule;
|
|
50
59
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
throw Error(
|
|
54
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
55
|
-
);
|
|
56
|
-
this.updater.enqueueSetState(this, t, o, "setState");
|
|
57
|
-
}, U.prototype.forceUpdate = function(t) {
|
|
58
|
-
this.updater.enqueueForceUpdate(this, t, "forceUpdate");
|
|
59
|
-
};
|
|
60
|
-
function z() {
|
|
60
|
+
if (typeof rule === "string" || typeof rule === "number") {
|
|
61
|
+
return rule;
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
return rule.value;
|
|
64
|
+
};
|
|
65
|
+
var getRuleMessage = (rule) => {
|
|
66
|
+
if (typeof rule === "string") {
|
|
67
|
+
return rule;
|
|
65
68
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var X = Array.isArray, b = { H: null, A: null, T: null, S: null, V: null }, Z = Object.prototype.hasOwnProperty;
|
|
69
|
-
function J(t, o, f, c, R, S) {
|
|
70
|
-
return f = S.ref, {
|
|
71
|
-
$$typeof: n,
|
|
72
|
-
type: t,
|
|
73
|
-
key: o,
|
|
74
|
-
ref: f !== void 0 ? f : null,
|
|
75
|
-
props: S
|
|
76
|
-
};
|
|
69
|
+
if (typeof rule.message === "string") {
|
|
70
|
+
return rule.message;
|
|
77
71
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
void 0,
|
|
85
|
-
t.props
|
|
86
|
-
);
|
|
72
|
+
return "";
|
|
73
|
+
};
|
|
74
|
+
var validate = (values, name, rules = {}) => {
|
|
75
|
+
const value = get(values, name);
|
|
76
|
+
if (rules.required && !value) {
|
|
77
|
+
return { type: "required", message: getRuleMessage(rules.required) };
|
|
87
78
|
}
|
|
88
|
-
|
|
89
|
-
return
|
|
79
|
+
if (rules.min && Number(value) < Number(getRuleValue(rules.min))) {
|
|
80
|
+
return { type: "min", message: getRuleMessage(rules.min) };
|
|
90
81
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
return "$" + t.replace(/[=:]/g, function(f) {
|
|
94
|
-
return o[f];
|
|
95
|
-
});
|
|
82
|
+
if (rules.max && Number(value) > Number(getRuleValue(rules.max))) {
|
|
83
|
+
return { type: "max", message: getRuleMessage(rules.max) };
|
|
96
84
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
return typeof t == "object" && t !== null && t.key != null ? te("" + t.key) : o.toString(36);
|
|
85
|
+
if (rules.minLength && value.length < getRuleValue(rules.minLength)) {
|
|
86
|
+
return { type: "minLength", message: getRuleMessage(rules.minLength) };
|
|
100
87
|
}
|
|
101
|
-
|
|
88
|
+
if (rules.maxLength && value.length > getRuleValue(rules.maxLength)) {
|
|
89
|
+
return { type: "maxLength", message: getRuleMessage(rules.maxLength) };
|
|
102
90
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
case "fulfilled":
|
|
106
|
-
return t.value;
|
|
107
|
-
case "rejected":
|
|
108
|
-
throw t.reason;
|
|
109
|
-
default:
|
|
110
|
-
switch (typeof t.status == "string" ? t.then(V, V) : (t.status = "pending", t.then(
|
|
111
|
-
function(o) {
|
|
112
|
-
t.status === "pending" && (t.status = "fulfilled", t.value = o);
|
|
113
|
-
},
|
|
114
|
-
function(o) {
|
|
115
|
-
t.status === "pending" && (t.status = "rejected", t.reason = o);
|
|
116
|
-
}
|
|
117
|
-
)), t.status) {
|
|
118
|
-
case "fulfilled":
|
|
119
|
-
return t.value;
|
|
120
|
-
case "rejected":
|
|
121
|
-
throw t.reason;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
throw t;
|
|
91
|
+
if (rules.pattern && !getRuleValue(rules.pattern).test(value)) {
|
|
92
|
+
return { type: "pattern", message: getRuleMessage(rules.pattern) };
|
|
125
93
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
(
|
|
129
|
-
|
|
130
|
-
if (t === null) m = !0;
|
|
131
|
-
else
|
|
132
|
-
switch (S) {
|
|
133
|
-
case "bigint":
|
|
134
|
-
case "string":
|
|
135
|
-
case "number":
|
|
136
|
-
m = !0;
|
|
137
|
-
break;
|
|
138
|
-
case "object":
|
|
139
|
-
switch (t.$$typeof) {
|
|
140
|
-
case n:
|
|
141
|
-
case u:
|
|
142
|
-
m = !0;
|
|
143
|
-
break;
|
|
144
|
-
case M:
|
|
145
|
-
return m = t._init, E(
|
|
146
|
-
m(t._payload),
|
|
147
|
-
o,
|
|
148
|
-
f,
|
|
149
|
-
c,
|
|
150
|
-
R
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
if (m)
|
|
155
|
-
return R = R(t), m = c === "" ? "." + re(t, 0) : c, X(R) ? (f = "", m != null && (f = m.replace(C, "$&/") + "/"), E(R, o, f, "", function(ne) {
|
|
156
|
-
return ne;
|
|
157
|
-
})) : R != null && (q(R) && (R = Y(
|
|
158
|
-
R,
|
|
159
|
-
f + (R.key == null || t && t.key === R.key ? "" : ("" + R.key).replace(
|
|
160
|
-
C,
|
|
161
|
-
"$&/"
|
|
162
|
-
) + "/") + m
|
|
163
|
-
)), o.push(R)), 1;
|
|
164
|
-
m = 0;
|
|
165
|
-
var F = c === "" ? "." : c + ":";
|
|
166
|
-
if (X(t))
|
|
167
|
-
for (var A = 0; A < t.length; A++)
|
|
168
|
-
c = t[A], S = F + re(c, A), m += E(
|
|
169
|
-
c,
|
|
170
|
-
o,
|
|
171
|
-
f,
|
|
172
|
-
S,
|
|
173
|
-
R
|
|
174
|
-
);
|
|
175
|
-
else if (A = B(t), typeof A == "function")
|
|
176
|
-
for (t = A.call(t), A = 0; !(c = t.next()).done; )
|
|
177
|
-
c = c.value, S = F + re(c, A++), m += E(
|
|
178
|
-
c,
|
|
179
|
-
o,
|
|
180
|
-
f,
|
|
181
|
-
S,
|
|
182
|
-
R
|
|
183
|
-
);
|
|
184
|
-
else if (S === "object") {
|
|
185
|
-
if (typeof t.then == "function")
|
|
186
|
-
return E(
|
|
187
|
-
l(t),
|
|
188
|
-
o,
|
|
189
|
-
f,
|
|
190
|
-
c,
|
|
191
|
-
R
|
|
192
|
-
);
|
|
193
|
-
throw o = String(t), Error(
|
|
194
|
-
"Objects are not valid as a React child (found: " + (o === "[object Object]" ? "object with keys {" + Object.keys(t).join(", ") + "}" : o) + "). If you meant to render a collection of children, use an array instead."
|
|
195
|
-
);
|
|
94
|
+
if (rules.validate) {
|
|
95
|
+
const message = rules.validate(value, values);
|
|
96
|
+
if (message === false) {
|
|
97
|
+
return { type: "validate" };
|
|
196
98
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
function w(t, o, f) {
|
|
200
|
-
if (t == null) return t;
|
|
201
|
-
var c = [], R = 0;
|
|
202
|
-
return E(t, c, "", "", function(S) {
|
|
203
|
-
return o.call(f, S, R++);
|
|
204
|
-
}), c;
|
|
205
|
-
}
|
|
206
|
-
function P(t) {
|
|
207
|
-
if (t._status === -1) {
|
|
208
|
-
var o = t._result;
|
|
209
|
-
o = o(), o.then(
|
|
210
|
-
function(f) {
|
|
211
|
-
(t._status === 0 || t._status === -1) && (t._status = 1, t._result = f);
|
|
212
|
-
},
|
|
213
|
-
function(f) {
|
|
214
|
-
(t._status === 0 || t._status === -1) && (t._status = 2, t._result = f);
|
|
215
|
-
}
|
|
216
|
-
), t._status === -1 && (t._status = 0, t._result = o);
|
|
99
|
+
if (typeof message === "string") {
|
|
100
|
+
return { type: "validate", message };
|
|
217
101
|
}
|
|
218
|
-
if (t._status === 1) return t._result.default;
|
|
219
|
-
throw t._result;
|
|
220
102
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
message: typeof t == "object" && t !== null && typeof t.message == "string" ? String(t.message) : String(t),
|
|
227
|
-
error: t
|
|
228
|
-
});
|
|
229
|
-
if (!window.dispatchEvent(o)) return;
|
|
230
|
-
} else if (typeof process == "object" && typeof process.emit == "function") {
|
|
231
|
-
process.emit("uncaughtException", t);
|
|
232
|
-
return;
|
|
233
|
-
}
|
|
234
|
-
console.error(t);
|
|
103
|
+
};
|
|
104
|
+
var createErrors = () => {
|
|
105
|
+
const [errors, setErrors] = createSignal({});
|
|
106
|
+
const getError = (name) => {
|
|
107
|
+
return get(errors(), name);
|
|
235
108
|
};
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
only: function(t) {
|
|
261
|
-
if (!q(t))
|
|
262
|
-
throw Error(
|
|
263
|
-
"React.Children.only expected to receive a single React element child."
|
|
264
|
-
);
|
|
265
|
-
return t;
|
|
266
|
-
}
|
|
267
|
-
}, p.Component = U, p.Fragment = y, p.Profiler = T, p.PureComponent = x, p.StrictMode = v, p.Suspense = L, p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = b, p.__COMPILER_RUNTIME = {
|
|
268
|
-
__proto__: null,
|
|
269
|
-
c: function(t) {
|
|
270
|
-
return b.H.useMemoCache(t);
|
|
271
|
-
}
|
|
272
|
-
}, p.cache = function(t) {
|
|
273
|
-
return function() {
|
|
274
|
-
return t.apply(null, arguments);
|
|
275
|
-
};
|
|
276
|
-
}, p.cloneElement = function(t, o, f) {
|
|
277
|
-
if (t == null)
|
|
278
|
-
throw Error(
|
|
279
|
-
"The argument must be a React element, but you passed " + t + "."
|
|
280
|
-
);
|
|
281
|
-
var c = K({}, t.props), R = t.key, S = void 0;
|
|
282
|
-
if (o != null)
|
|
283
|
-
for (m in o.ref !== void 0 && (S = void 0), o.key !== void 0 && (R = "" + o.key), o)
|
|
284
|
-
!Z.call(o, m) || m === "key" || m === "__self" || m === "__source" || m === "ref" && o.ref === void 0 || (c[m] = o[m]);
|
|
285
|
-
var m = arguments.length - 2;
|
|
286
|
-
if (m === 1) c.children = f;
|
|
287
|
-
else if (1 < m) {
|
|
288
|
-
for (var F = Array(m), A = 0; A < m; A++)
|
|
289
|
-
F[A] = arguments[A + 2];
|
|
290
|
-
c.children = F;
|
|
291
|
-
}
|
|
292
|
-
return J(t.type, R, void 0, void 0, S, c);
|
|
293
|
-
}, p.createContext = function(t) {
|
|
294
|
-
return t = {
|
|
295
|
-
$$typeof: N,
|
|
296
|
-
_currentValue: t,
|
|
297
|
-
_currentValue2: t,
|
|
298
|
-
_threadCount: 0,
|
|
299
|
-
Provider: null,
|
|
300
|
-
Consumer: null
|
|
301
|
-
}, t.Provider = t, t.Consumer = {
|
|
302
|
-
$$typeof: k,
|
|
303
|
-
_context: t
|
|
304
|
-
}, t;
|
|
305
|
-
}, p.createElement = function(t, o, f) {
|
|
306
|
-
var c, R = {}, S = null;
|
|
307
|
-
if (o != null)
|
|
308
|
-
for (c in o.key !== void 0 && (S = "" + o.key), o)
|
|
309
|
-
Z.call(o, c) && c !== "key" && c !== "__self" && c !== "__source" && (R[c] = o[c]);
|
|
310
|
-
var m = arguments.length - 2;
|
|
311
|
-
if (m === 1) R.children = f;
|
|
312
|
-
else if (1 < m) {
|
|
313
|
-
for (var F = Array(m), A = 0; A < m; A++)
|
|
314
|
-
F[A] = arguments[A + 2];
|
|
315
|
-
R.children = F;
|
|
316
|
-
}
|
|
317
|
-
if (t && t.defaultProps)
|
|
318
|
-
for (c in m = t.defaultProps, m)
|
|
319
|
-
R[c] === void 0 && (R[c] = m[c]);
|
|
320
|
-
return J(t, S, void 0, void 0, null, R);
|
|
321
|
-
}, p.createRef = function() {
|
|
322
|
-
return { current: null };
|
|
323
|
-
}, p.forwardRef = function(t) {
|
|
324
|
-
return { $$typeof: j, render: t };
|
|
325
|
-
}, p.isValidElement = q, p.lazy = function(t) {
|
|
326
|
-
return {
|
|
327
|
-
$$typeof: M,
|
|
328
|
-
_payload: { _status: -1, _result: t },
|
|
329
|
-
_init: P
|
|
330
|
-
};
|
|
331
|
-
}, p.memo = function(t, o) {
|
|
332
|
-
return {
|
|
333
|
-
$$typeof: $,
|
|
334
|
-
type: t,
|
|
335
|
-
compare: o === void 0 ? null : o
|
|
336
|
-
};
|
|
337
|
-
}, p.startTransition = function(t) {
|
|
338
|
-
var o = b.T, f = {};
|
|
339
|
-
b.T = f;
|
|
340
|
-
try {
|
|
341
|
-
var c = t(), R = b.S;
|
|
342
|
-
R !== null && R(f, c), typeof c == "object" && c !== null && typeof c.then == "function" && c.then(ce, D);
|
|
343
|
-
} catch (S) {
|
|
344
|
-
D(S);
|
|
345
|
-
} finally {
|
|
346
|
-
b.T = o;
|
|
347
|
-
}
|
|
348
|
-
}, p.unstable_useCacheRefresh = function() {
|
|
349
|
-
return b.H.useCacheRefresh();
|
|
350
|
-
}, p.use = function(t) {
|
|
351
|
-
return b.H.use(t);
|
|
352
|
-
}, p.useActionState = function(t, o, f) {
|
|
353
|
-
return b.H.useActionState(t, o, f);
|
|
354
|
-
}, p.useCallback = function(t, o) {
|
|
355
|
-
return b.H.useCallback(t, o);
|
|
356
|
-
}, p.useContext = function(t) {
|
|
357
|
-
return b.H.useContext(t);
|
|
358
|
-
}, p.useDebugValue = function() {
|
|
359
|
-
}, p.useDeferredValue = function(t, o) {
|
|
360
|
-
return b.H.useDeferredValue(t, o);
|
|
361
|
-
}, p.useEffect = function(t, o, f) {
|
|
362
|
-
var c = b.H;
|
|
363
|
-
if (typeof f == "function")
|
|
364
|
-
throw Error(
|
|
365
|
-
"useEffect CRUD overload is not enabled in this build of React."
|
|
366
|
-
);
|
|
367
|
-
return c.useEffect(t, o);
|
|
368
|
-
}, p.useId = function() {
|
|
369
|
-
return b.H.useId();
|
|
370
|
-
}, p.useImperativeHandle = function(t, o, f) {
|
|
371
|
-
return b.H.useImperativeHandle(t, o, f);
|
|
372
|
-
}, p.useInsertionEffect = function(t, o) {
|
|
373
|
-
return b.H.useInsertionEffect(t, o);
|
|
374
|
-
}, p.useLayoutEffect = function(t, o) {
|
|
375
|
-
return b.H.useLayoutEffect(t, o);
|
|
376
|
-
}, p.useMemo = function(t, o) {
|
|
377
|
-
return b.H.useMemo(t, o);
|
|
378
|
-
}, p.useOptimistic = function(t, o) {
|
|
379
|
-
return b.H.useOptimistic(t, o);
|
|
380
|
-
}, p.useReducer = function(t, o, f) {
|
|
381
|
-
return b.H.useReducer(t, o, f);
|
|
382
|
-
}, p.useRef = function(t) {
|
|
383
|
-
return b.H.useRef(t);
|
|
384
|
-
}, p.useState = function(t) {
|
|
385
|
-
return b.H.useState(t);
|
|
386
|
-
}, p.useSyncExternalStore = function(t, o, f) {
|
|
387
|
-
return b.H.useSyncExternalStore(
|
|
388
|
-
t,
|
|
389
|
-
o,
|
|
390
|
-
f
|
|
391
|
-
);
|
|
392
|
-
}, p.useTransition = function() {
|
|
393
|
-
return b.H.useTransition();
|
|
394
|
-
}, p.version = "19.1.0", p;
|
|
395
|
-
}
|
|
396
|
-
var ae = { exports: {} };
|
|
397
|
-
/**
|
|
398
|
-
* @license React
|
|
399
|
-
* react.development.js
|
|
400
|
-
*
|
|
401
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
402
|
-
*
|
|
403
|
-
* This source code is licensed under the MIT license found in the
|
|
404
|
-
* LICENSE file in the root directory of this source tree.
|
|
405
|
-
*/
|
|
406
|
-
ae.exports;
|
|
407
|
-
var Me;
|
|
408
|
-
function rt() {
|
|
409
|
-
return Me || (Me = 1, function(n, u) {
|
|
410
|
-
process.env.NODE_ENV !== "production" && function() {
|
|
411
|
-
function y(e, r) {
|
|
412
|
-
Object.defineProperty(k.prototype, e, {
|
|
413
|
-
get: function() {
|
|
414
|
-
console.warn(
|
|
415
|
-
"%s(...) is deprecated in plain JavaScript React classes. %s",
|
|
416
|
-
r[0],
|
|
417
|
-
r[1]
|
|
418
|
-
);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
function v(e) {
|
|
423
|
-
return e === null || typeof e != "object" ? null : (e = _e && e[_e] || e["@@iterator"], typeof e == "function" ? e : null);
|
|
424
|
-
}
|
|
425
|
-
function T(e, r) {
|
|
426
|
-
e = (e = e.constructor) && (e.displayName || e.name) || "ReactClass";
|
|
427
|
-
var s = e + "." + r;
|
|
428
|
-
Ee[s] || (console.error(
|
|
429
|
-
"Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",
|
|
430
|
-
r,
|
|
431
|
-
e
|
|
432
|
-
), Ee[s] = !0);
|
|
433
|
-
}
|
|
434
|
-
function k(e, r, s) {
|
|
435
|
-
this.props = e, this.context = r, this.refs = he, this.updater = s || we;
|
|
436
|
-
}
|
|
437
|
-
function N() {
|
|
438
|
-
}
|
|
439
|
-
function j(e, r, s) {
|
|
440
|
-
this.props = e, this.context = r, this.refs = he, this.updater = s || we;
|
|
441
|
-
}
|
|
442
|
-
function L(e) {
|
|
443
|
-
return "" + e;
|
|
444
|
-
}
|
|
445
|
-
function $(e) {
|
|
446
|
-
try {
|
|
447
|
-
L(e);
|
|
448
|
-
var r = !1;
|
|
449
|
-
} catch {
|
|
450
|
-
r = !0;
|
|
451
|
-
}
|
|
452
|
-
if (r) {
|
|
453
|
-
r = console;
|
|
454
|
-
var s = r.error, i = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
455
|
-
return s.call(
|
|
456
|
-
r,
|
|
457
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
458
|
-
i
|
|
459
|
-
), L(e);
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
function M(e) {
|
|
463
|
-
if (e == null) return null;
|
|
464
|
-
if (typeof e == "function")
|
|
465
|
-
return e.$$typeof === ze ? null : e.displayName || e.name || null;
|
|
466
|
-
if (typeof e == "string") return e;
|
|
467
|
-
switch (e) {
|
|
468
|
-
case t:
|
|
469
|
-
return "Fragment";
|
|
470
|
-
case f:
|
|
471
|
-
return "Profiler";
|
|
472
|
-
case o:
|
|
473
|
-
return "StrictMode";
|
|
474
|
-
case m:
|
|
475
|
-
return "Suspense";
|
|
476
|
-
case F:
|
|
477
|
-
return "SuspenseList";
|
|
478
|
-
case We:
|
|
479
|
-
return "Activity";
|
|
480
|
-
}
|
|
481
|
-
if (typeof e == "object")
|
|
482
|
-
switch (typeof e.tag == "number" && console.error(
|
|
483
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
484
|
-
), e.$$typeof) {
|
|
485
|
-
case ce:
|
|
486
|
-
return "Portal";
|
|
487
|
-
case R:
|
|
488
|
-
return (e.displayName || "Context") + ".Provider";
|
|
489
|
-
case c:
|
|
490
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
491
|
-
case S:
|
|
492
|
-
var r = e.render;
|
|
493
|
-
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
494
|
-
case A:
|
|
495
|
-
return r = e.displayName || null, r !== null ? r : M(e.type) || "Memo";
|
|
496
|
-
case ne:
|
|
497
|
-
r = e._payload, e = e._init;
|
|
498
|
-
try {
|
|
499
|
-
return M(e(r));
|
|
500
|
-
} catch {
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
return null;
|
|
504
|
-
}
|
|
505
|
-
function W(e) {
|
|
506
|
-
if (e === t) return "<>";
|
|
507
|
-
if (typeof e == "object" && e !== null && e.$$typeof === ne)
|
|
508
|
-
return "<...>";
|
|
509
|
-
try {
|
|
510
|
-
var r = M(e);
|
|
511
|
-
return r ? "<" + r + ">" : "<...>";
|
|
512
|
-
} catch {
|
|
513
|
-
return "<...>";
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
function B() {
|
|
517
|
-
var e = g.A;
|
|
518
|
-
return e === null ? null : e.getOwner();
|
|
519
|
-
}
|
|
520
|
-
function Q() {
|
|
521
|
-
return Error("react-stack-top-frame");
|
|
522
|
-
}
|
|
523
|
-
function K(e) {
|
|
524
|
-
if (le.call(e, "key")) {
|
|
525
|
-
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
526
|
-
if (r && r.isReactWarning) return !1;
|
|
527
|
-
}
|
|
528
|
-
return e.key !== void 0;
|
|
529
|
-
}
|
|
530
|
-
function ee(e, r) {
|
|
531
|
-
function s() {
|
|
532
|
-
Oe || (Oe = !0, console.error(
|
|
533
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
534
|
-
r
|
|
535
|
-
));
|
|
536
|
-
}
|
|
537
|
-
s.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
538
|
-
get: s,
|
|
539
|
-
configurable: !0
|
|
540
|
-
});
|
|
541
|
-
}
|
|
542
|
-
function U() {
|
|
543
|
-
var e = M(this.type);
|
|
544
|
-
return Se[e] || (Se[e] = !0, console.error(
|
|
545
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
546
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
547
|
-
}
|
|
548
|
-
function z(e, r, s, i, a, _, d, O) {
|
|
549
|
-
return s = _.ref, e = {
|
|
550
|
-
$$typeof: D,
|
|
551
|
-
type: e,
|
|
552
|
-
key: r,
|
|
553
|
-
props: _,
|
|
554
|
-
_owner: a
|
|
555
|
-
}, (s !== void 0 ? s : null) !== null ? Object.defineProperty(e, "ref", {
|
|
556
|
-
enumerable: !1,
|
|
557
|
-
get: U
|
|
558
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
559
|
-
configurable: !1,
|
|
560
|
-
enumerable: !1,
|
|
561
|
-
writable: !0,
|
|
562
|
-
value: 0
|
|
563
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
564
|
-
configurable: !1,
|
|
565
|
-
enumerable: !1,
|
|
566
|
-
writable: !0,
|
|
567
|
-
value: null
|
|
568
|
-
}), Object.defineProperty(e, "_debugStack", {
|
|
569
|
-
configurable: !1,
|
|
570
|
-
enumerable: !1,
|
|
571
|
-
writable: !0,
|
|
572
|
-
value: d
|
|
573
|
-
}), Object.defineProperty(e, "_debugTask", {
|
|
574
|
-
configurable: !1,
|
|
575
|
-
enumerable: !1,
|
|
576
|
-
writable: !0,
|
|
577
|
-
value: O
|
|
578
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
579
|
-
}
|
|
580
|
-
function x(e, r) {
|
|
581
|
-
return r = z(
|
|
582
|
-
e.type,
|
|
583
|
-
r,
|
|
584
|
-
void 0,
|
|
585
|
-
void 0,
|
|
586
|
-
e._owner,
|
|
587
|
-
e.props,
|
|
588
|
-
e._debugStack,
|
|
589
|
-
e._debugTask
|
|
590
|
-
), e._store && (r._store.validated = e._store.validated), r;
|
|
591
|
-
}
|
|
592
|
-
function I(e) {
|
|
593
|
-
return typeof e == "object" && e !== null && e.$$typeof === D;
|
|
594
|
-
}
|
|
595
|
-
function X(e) {
|
|
596
|
-
var r = { "=": "=0", ":": "=2" };
|
|
597
|
-
return "$" + e.replace(/[=:]/g, function(s) {
|
|
598
|
-
return r[s];
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
function b(e, r) {
|
|
602
|
-
return typeof e == "object" && e !== null && e.key != null ? ($(e.key), X("" + e.key)) : r.toString(36);
|
|
603
|
-
}
|
|
604
|
-
function Z() {
|
|
605
|
-
}
|
|
606
|
-
function J(e) {
|
|
607
|
-
switch (e.status) {
|
|
608
|
-
case "fulfilled":
|
|
609
|
-
return e.value;
|
|
610
|
-
case "rejected":
|
|
611
|
-
throw e.reason;
|
|
612
|
-
default:
|
|
613
|
-
switch (typeof e.status == "string" ? e.then(Z, Z) : (e.status = "pending", e.then(
|
|
614
|
-
function(r) {
|
|
615
|
-
e.status === "pending" && (e.status = "fulfilled", e.value = r);
|
|
616
|
-
},
|
|
617
|
-
function(r) {
|
|
618
|
-
e.status === "pending" && (e.status = "rejected", e.reason = r);
|
|
619
|
-
}
|
|
620
|
-
)), e.status) {
|
|
621
|
-
case "fulfilled":
|
|
622
|
-
return e.value;
|
|
623
|
-
case "rejected":
|
|
624
|
-
throw e.reason;
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
throw e;
|
|
628
|
-
}
|
|
629
|
-
function Y(e, r, s, i, a) {
|
|
630
|
-
var _ = typeof e;
|
|
631
|
-
(_ === "undefined" || _ === "boolean") && (e = null);
|
|
632
|
-
var d = !1;
|
|
633
|
-
if (e === null) d = !0;
|
|
634
|
-
else
|
|
635
|
-
switch (_) {
|
|
636
|
-
case "bigint":
|
|
637
|
-
case "string":
|
|
638
|
-
case "number":
|
|
639
|
-
d = !0;
|
|
640
|
-
break;
|
|
641
|
-
case "object":
|
|
642
|
-
switch (e.$$typeof) {
|
|
643
|
-
case D:
|
|
644
|
-
case ce:
|
|
645
|
-
d = !0;
|
|
646
|
-
break;
|
|
647
|
-
case ne:
|
|
648
|
-
return d = e._init, Y(
|
|
649
|
-
d(e._payload),
|
|
650
|
-
r,
|
|
651
|
-
s,
|
|
652
|
-
i,
|
|
653
|
-
a
|
|
654
|
-
);
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
if (d) {
|
|
658
|
-
d = e, a = a(d);
|
|
659
|
-
var O = i === "" ? "." + b(d, 0) : i;
|
|
660
|
-
return Te(a) ? (s = "", O != null && (s = O.replace(ke, "$&/") + "/"), Y(a, r, s, "", function(G) {
|
|
661
|
-
return G;
|
|
662
|
-
})) : a != null && (I(a) && (a.key != null && (d && d.key === a.key || $(a.key)), s = x(
|
|
663
|
-
a,
|
|
664
|
-
s + (a.key == null || d && d.key === a.key ? "" : ("" + a.key).replace(
|
|
665
|
-
ke,
|
|
666
|
-
"$&/"
|
|
667
|
-
) + "/") + O
|
|
668
|
-
), i !== "" && d != null && I(d) && d.key == null && d._store && !d._store.validated && (s._store.validated = 2), a = s), r.push(a)), 1;
|
|
669
|
-
}
|
|
670
|
-
if (d = 0, O = i === "" ? "." : i + ":", Te(e))
|
|
671
|
-
for (var h = 0; h < e.length; h++)
|
|
672
|
-
i = e[h], _ = O + b(i, h), d += Y(
|
|
673
|
-
i,
|
|
674
|
-
r,
|
|
675
|
-
s,
|
|
676
|
-
_,
|
|
677
|
-
a
|
|
678
|
-
);
|
|
679
|
-
else if (h = v(e), typeof h == "function")
|
|
680
|
-
for (h === e.entries && (Ae || console.warn(
|
|
681
|
-
"Using Maps as children is not supported. Use an array of keyed ReactElements instead."
|
|
682
|
-
), Ae = !0), e = h.call(e), h = 0; !(i = e.next()).done; )
|
|
683
|
-
i = i.value, _ = O + b(i, h++), d += Y(
|
|
684
|
-
i,
|
|
685
|
-
r,
|
|
686
|
-
s,
|
|
687
|
-
_,
|
|
688
|
-
a
|
|
689
|
-
);
|
|
690
|
-
else if (_ === "object") {
|
|
691
|
-
if (typeof e.then == "function")
|
|
692
|
-
return Y(
|
|
693
|
-
J(e),
|
|
694
|
-
r,
|
|
695
|
-
s,
|
|
696
|
-
i,
|
|
697
|
-
a
|
|
698
|
-
);
|
|
699
|
-
throw r = String(e), Error(
|
|
700
|
-
"Objects are not valid as a React child (found: " + (r === "[object Object]" ? "object with keys {" + Object.keys(e).join(", ") + "}" : r) + "). If you meant to render a collection of children, use an array instead."
|
|
701
|
-
);
|
|
702
|
-
}
|
|
703
|
-
return d;
|
|
704
|
-
}
|
|
705
|
-
function q(e, r, s) {
|
|
706
|
-
if (e == null) return e;
|
|
707
|
-
var i = [], a = 0;
|
|
708
|
-
return Y(e, i, "", "", function(_) {
|
|
709
|
-
return r.call(s, _, a++);
|
|
710
|
-
}), i;
|
|
711
|
-
}
|
|
712
|
-
function te(e) {
|
|
713
|
-
if (e._status === -1) {
|
|
714
|
-
var r = e._result;
|
|
715
|
-
r = r(), r.then(
|
|
716
|
-
function(s) {
|
|
717
|
-
(e._status === 0 || e._status === -1) && (e._status = 1, e._result = s);
|
|
718
|
-
},
|
|
719
|
-
function(s) {
|
|
720
|
-
(e._status === 0 || e._status === -1) && (e._status = 2, e._result = s);
|
|
721
|
-
}
|
|
722
|
-
), e._status === -1 && (e._status = 0, e._result = r);
|
|
723
|
-
}
|
|
724
|
-
if (e._status === 1)
|
|
725
|
-
return r = e._result, r === void 0 && console.error(
|
|
726
|
-
`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
727
|
-
|
|
728
|
-
Your code should look like:
|
|
729
|
-
const MyComponent = lazy(() => import('./MyComponent'))
|
|
730
|
-
|
|
731
|
-
Did you accidentally put curly braces around the import?`,
|
|
732
|
-
r
|
|
733
|
-
), "default" in r || console.error(
|
|
734
|
-
`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
109
|
+
const appendError = (name, error) => {
|
|
110
|
+
setErrors((prev) => {
|
|
111
|
+
const newState = { ...prev, [name]: error };
|
|
112
|
+
return newState;
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
const removeError = (name) => {
|
|
116
|
+
setErrors((prev) => {
|
|
117
|
+
const newState = { ...prev };
|
|
118
|
+
delete newState[name];
|
|
119
|
+
return newState;
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
const resetErrors = () => {
|
|
123
|
+
setErrors({});
|
|
124
|
+
};
|
|
125
|
+
return {
|
|
126
|
+
errors,
|
|
127
|
+
appendError,
|
|
128
|
+
removeError,
|
|
129
|
+
resetErrors,
|
|
130
|
+
getError
|
|
131
|
+
};
|
|
132
|
+
};
|
|
735
133
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
), e;
|
|
751
|
-
}
|
|
752
|
-
function re() {
|
|
753
|
-
}
|
|
754
|
-
function V(e) {
|
|
755
|
-
if (pe === null)
|
|
756
|
-
try {
|
|
757
|
-
var r = ("require" + Math.random()).slice(0, 7);
|
|
758
|
-
pe = (n && n[r]).call(
|
|
759
|
-
n,
|
|
760
|
-
"timers"
|
|
761
|
-
).setImmediate;
|
|
762
|
-
} catch {
|
|
763
|
-
pe = function(i) {
|
|
764
|
-
Pe === !1 && (Pe = !0, typeof MessageChannel > "u" && console.error(
|
|
765
|
-
"This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."
|
|
766
|
-
));
|
|
767
|
-
var a = new MessageChannel();
|
|
768
|
-
a.port1.onmessage = i, a.port2.postMessage(void 0);
|
|
769
|
-
};
|
|
770
|
-
}
|
|
771
|
-
return pe(e);
|
|
772
|
-
}
|
|
773
|
-
function l(e) {
|
|
774
|
-
return 1 < e.length && typeof AggregateError == "function" ? new AggregateError(e) : e[0];
|
|
775
|
-
}
|
|
776
|
-
function E(e, r) {
|
|
777
|
-
r !== de - 1 && console.error(
|
|
778
|
-
"You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "
|
|
779
|
-
), de = r;
|
|
780
|
-
}
|
|
781
|
-
function w(e, r, s) {
|
|
782
|
-
var i = g.actQueue;
|
|
783
|
-
if (i !== null)
|
|
784
|
-
if (i.length !== 0)
|
|
785
|
-
try {
|
|
786
|
-
P(i), V(function() {
|
|
787
|
-
return w(e, r, s);
|
|
788
|
-
});
|
|
789
|
-
return;
|
|
790
|
-
} catch (a) {
|
|
791
|
-
g.thrownErrors.push(a);
|
|
792
|
-
}
|
|
793
|
-
else g.actQueue = null;
|
|
794
|
-
0 < g.thrownErrors.length ? (i = l(g.thrownErrors), g.thrownErrors.length = 0, s(i)) : r(e);
|
|
795
|
-
}
|
|
796
|
-
function P(e) {
|
|
797
|
-
if (!ve) {
|
|
798
|
-
ve = !0;
|
|
799
|
-
var r = 0;
|
|
800
|
-
try {
|
|
801
|
-
for (; r < e.length; r++) {
|
|
802
|
-
var s = e[r];
|
|
803
|
-
do {
|
|
804
|
-
g.didUsePromise = !1;
|
|
805
|
-
var i = s(!1);
|
|
806
|
-
if (i !== null) {
|
|
807
|
-
if (g.didUsePromise) {
|
|
808
|
-
e[r] = s, e.splice(0, r);
|
|
809
|
-
return;
|
|
810
|
-
}
|
|
811
|
-
s = i;
|
|
812
|
-
} else break;
|
|
813
|
-
} while (!0);
|
|
814
|
-
}
|
|
815
|
-
e.length = 0;
|
|
816
|
-
} catch (a) {
|
|
817
|
-
e.splice(0, r + 1), g.thrownErrors.push(a);
|
|
818
|
-
} finally {
|
|
819
|
-
ve = !1;
|
|
820
|
-
}
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
|
|
824
|
-
var D = Symbol.for("react.transitional.element"), ce = Symbol.for("react.portal"), t = Symbol.for("react.fragment"), o = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), c = Symbol.for("react.consumer"), R = Symbol.for("react.context"), S = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), A = Symbol.for("react.memo"), ne = Symbol.for("react.lazy"), We = Symbol.for("react.activity"), _e = Symbol.iterator, Ee = {}, we = {
|
|
825
|
-
isMounted: function() {
|
|
826
|
-
return !1;
|
|
827
|
-
},
|
|
828
|
-
enqueueForceUpdate: function(e) {
|
|
829
|
-
T(e, "forceUpdate");
|
|
830
|
-
},
|
|
831
|
-
enqueueReplaceState: function(e) {
|
|
832
|
-
T(e, "replaceState");
|
|
833
|
-
},
|
|
834
|
-
enqueueSetState: function(e) {
|
|
835
|
-
T(e, "setState");
|
|
836
|
-
}
|
|
837
|
-
}, Re = Object.assign, he = {};
|
|
838
|
-
Object.freeze(he), k.prototype.isReactComponent = {}, k.prototype.setState = function(e, r) {
|
|
839
|
-
if (typeof e != "object" && typeof e != "function" && e != null)
|
|
840
|
-
throw Error(
|
|
841
|
-
"takes an object of state variables to update or a function which returns an object of state variables."
|
|
842
|
-
);
|
|
843
|
-
this.updater.enqueueSetState(this, e, r, "setState");
|
|
844
|
-
}, k.prototype.forceUpdate = function(e) {
|
|
845
|
-
this.updater.enqueueForceUpdate(this, e, "forceUpdate");
|
|
846
|
-
};
|
|
847
|
-
var H = {
|
|
848
|
-
isMounted: [
|
|
849
|
-
"isMounted",
|
|
850
|
-
"Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."
|
|
851
|
-
],
|
|
852
|
-
replaceState: [
|
|
853
|
-
"replaceState",
|
|
854
|
-
"Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."
|
|
855
|
-
]
|
|
856
|
-
}, fe;
|
|
857
|
-
for (fe in H)
|
|
858
|
-
H.hasOwnProperty(fe) && y(fe, H[fe]);
|
|
859
|
-
N.prototype = k.prototype, H = j.prototype = new N(), H.constructor = j, Re(H, k.prototype), H.isPureReactComponent = !0;
|
|
860
|
-
var Te = Array.isArray, ze = Symbol.for("react.client.reference"), g = {
|
|
861
|
-
H: null,
|
|
862
|
-
A: null,
|
|
863
|
-
T: null,
|
|
864
|
-
S: null,
|
|
865
|
-
V: null,
|
|
866
|
-
actQueue: null,
|
|
867
|
-
isBatchingLegacy: !1,
|
|
868
|
-
didScheduleLegacyUpdate: !1,
|
|
869
|
-
didUsePromise: !1,
|
|
870
|
-
thrownErrors: [],
|
|
871
|
-
getCurrentStack: null,
|
|
872
|
-
recentlyCreatedOwnerStacks: 0
|
|
873
|
-
}, le = Object.prototype.hasOwnProperty, be = console.createTask ? console.createTask : function() {
|
|
874
|
-
return null;
|
|
875
|
-
};
|
|
876
|
-
H = {
|
|
877
|
-
"react-stack-bottom-frame": function(e) {
|
|
878
|
-
return e();
|
|
879
|
-
}
|
|
880
|
-
};
|
|
881
|
-
var Oe, Ce, Se = {}, xe = H["react-stack-bottom-frame"].bind(H, Q)(), Ve = be(W(Q)), Ae = !1, ke = /\/+/g, je = typeof reportError == "function" ? reportError : function(e) {
|
|
882
|
-
if (typeof window == "object" && typeof window.ErrorEvent == "function") {
|
|
883
|
-
var r = new window.ErrorEvent("error", {
|
|
884
|
-
bubbles: !0,
|
|
885
|
-
cancelable: !0,
|
|
886
|
-
message: typeof e == "object" && e !== null && typeof e.message == "string" ? String(e.message) : String(e),
|
|
887
|
-
error: e
|
|
888
|
-
});
|
|
889
|
-
if (!window.dispatchEvent(r)) return;
|
|
890
|
-
} else if (typeof process == "object" && typeof process.emit == "function") {
|
|
891
|
-
process.emit("uncaughtException", e);
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
console.error(e);
|
|
895
|
-
}, Pe = !1, pe = null, de = 0, me = !1, ve = !1, Ne = typeof queueMicrotask == "function" ? function(e) {
|
|
896
|
-
queueMicrotask(function() {
|
|
897
|
-
return queueMicrotask(e);
|
|
898
|
-
});
|
|
899
|
-
} : V;
|
|
900
|
-
H = Object.freeze({
|
|
901
|
-
__proto__: null,
|
|
902
|
-
c: function(e) {
|
|
903
|
-
return C().useMemoCache(e);
|
|
904
|
-
}
|
|
905
|
-
}), u.Children = {
|
|
906
|
-
map: q,
|
|
907
|
-
forEach: function(e, r, s) {
|
|
908
|
-
q(
|
|
909
|
-
e,
|
|
910
|
-
function() {
|
|
911
|
-
r.apply(this, arguments);
|
|
912
|
-
},
|
|
913
|
-
s
|
|
914
|
-
);
|
|
915
|
-
},
|
|
916
|
-
count: function(e) {
|
|
917
|
-
var r = 0;
|
|
918
|
-
return q(e, function() {
|
|
919
|
-
r++;
|
|
920
|
-
}), r;
|
|
921
|
-
},
|
|
922
|
-
toArray: function(e) {
|
|
923
|
-
return q(e, function(r) {
|
|
924
|
-
return r;
|
|
925
|
-
}) || [];
|
|
926
|
-
},
|
|
927
|
-
only: function(e) {
|
|
928
|
-
if (!I(e))
|
|
929
|
-
throw Error(
|
|
930
|
-
"React.Children.only expected to receive a single React element child."
|
|
931
|
-
);
|
|
932
|
-
return e;
|
|
933
|
-
}
|
|
934
|
-
}, u.Component = k, u.Fragment = t, u.Profiler = f, u.PureComponent = j, u.StrictMode = o, u.Suspense = m, u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE = g, u.__COMPILER_RUNTIME = H, u.act = function(e) {
|
|
935
|
-
var r = g.actQueue, s = de;
|
|
936
|
-
de++;
|
|
937
|
-
var i = g.actQueue = r !== null ? r : [], a = !1;
|
|
938
|
-
try {
|
|
939
|
-
var _ = e();
|
|
940
|
-
} catch (h) {
|
|
941
|
-
g.thrownErrors.push(h);
|
|
942
|
-
}
|
|
943
|
-
if (0 < g.thrownErrors.length)
|
|
944
|
-
throw E(r, s), e = l(g.thrownErrors), g.thrownErrors.length = 0, e;
|
|
945
|
-
if (_ !== null && typeof _ == "object" && typeof _.then == "function") {
|
|
946
|
-
var d = _;
|
|
947
|
-
return Ne(function() {
|
|
948
|
-
a || me || (me = !0, console.error(
|
|
949
|
-
"You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"
|
|
950
|
-
));
|
|
951
|
-
}), {
|
|
952
|
-
then: function(h, G) {
|
|
953
|
-
a = !0, d.then(
|
|
954
|
-
function(oe) {
|
|
955
|
-
if (E(r, s), s === 0) {
|
|
956
|
-
try {
|
|
957
|
-
P(i), V(function() {
|
|
958
|
-
return w(
|
|
959
|
-
oe,
|
|
960
|
-
h,
|
|
961
|
-
G
|
|
962
|
-
);
|
|
963
|
-
});
|
|
964
|
-
} catch (Be) {
|
|
965
|
-
g.thrownErrors.push(Be);
|
|
966
|
-
}
|
|
967
|
-
if (0 < g.thrownErrors.length) {
|
|
968
|
-
var Ge = l(
|
|
969
|
-
g.thrownErrors
|
|
970
|
-
);
|
|
971
|
-
g.thrownErrors.length = 0, G(Ge);
|
|
972
|
-
}
|
|
973
|
-
} else h(oe);
|
|
974
|
-
},
|
|
975
|
-
function(oe) {
|
|
976
|
-
E(r, s), 0 < g.thrownErrors.length && (oe = l(
|
|
977
|
-
g.thrownErrors
|
|
978
|
-
), g.thrownErrors.length = 0), G(oe);
|
|
979
|
-
}
|
|
980
|
-
);
|
|
981
|
-
}
|
|
982
|
-
};
|
|
983
|
-
}
|
|
984
|
-
var O = _;
|
|
985
|
-
if (E(r, s), s === 0 && (P(i), i.length !== 0 && Ne(function() {
|
|
986
|
-
a || me || (me = !0, console.error(
|
|
987
|
-
"A component suspended inside an `act` scope, but the `act` call was not awaited. When testing React components that depend on asynchronous data, you must await the result:\n\nawait act(() => ...)"
|
|
988
|
-
));
|
|
989
|
-
}), g.actQueue = null), 0 < g.thrownErrors.length)
|
|
990
|
-
throw e = l(g.thrownErrors), g.thrownErrors.length = 0, e;
|
|
991
|
-
return {
|
|
992
|
-
then: function(h, G) {
|
|
993
|
-
a = !0, s === 0 ? (g.actQueue = i, V(function() {
|
|
994
|
-
return w(
|
|
995
|
-
O,
|
|
996
|
-
h,
|
|
997
|
-
G
|
|
998
|
-
);
|
|
999
|
-
})) : h(O);
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
}, u.cache = function(e) {
|
|
1003
|
-
return function() {
|
|
1004
|
-
return e.apply(null, arguments);
|
|
1005
|
-
};
|
|
1006
|
-
}, u.captureOwnerStack = function() {
|
|
1007
|
-
var e = g.getCurrentStack;
|
|
1008
|
-
return e === null ? null : e();
|
|
1009
|
-
}, u.cloneElement = function(e, r, s) {
|
|
1010
|
-
if (e == null)
|
|
1011
|
-
throw Error(
|
|
1012
|
-
"The argument must be a React element, but you passed " + e + "."
|
|
1013
|
-
);
|
|
1014
|
-
var i = Re({}, e.props), a = e.key, _ = e._owner;
|
|
1015
|
-
if (r != null) {
|
|
1016
|
-
var d;
|
|
1017
|
-
e: {
|
|
1018
|
-
if (le.call(r, "ref") && (d = Object.getOwnPropertyDescriptor(
|
|
1019
|
-
r,
|
|
1020
|
-
"ref"
|
|
1021
|
-
).get) && d.isReactWarning) {
|
|
1022
|
-
d = !1;
|
|
1023
|
-
break e;
|
|
1024
|
-
}
|
|
1025
|
-
d = r.ref !== void 0;
|
|
1026
|
-
}
|
|
1027
|
-
d && (_ = B()), K(r) && ($(r.key), a = "" + r.key);
|
|
1028
|
-
for (O in r)
|
|
1029
|
-
!le.call(r, O) || O === "key" || O === "__self" || O === "__source" || O === "ref" && r.ref === void 0 || (i[O] = r[O]);
|
|
1030
|
-
}
|
|
1031
|
-
var O = arguments.length - 2;
|
|
1032
|
-
if (O === 1) i.children = s;
|
|
1033
|
-
else if (1 < O) {
|
|
1034
|
-
d = Array(O);
|
|
1035
|
-
for (var h = 0; h < O; h++)
|
|
1036
|
-
d[h] = arguments[h + 2];
|
|
1037
|
-
i.children = d;
|
|
1038
|
-
}
|
|
1039
|
-
for (i = z(
|
|
1040
|
-
e.type,
|
|
1041
|
-
a,
|
|
1042
|
-
void 0,
|
|
1043
|
-
void 0,
|
|
1044
|
-
_,
|
|
1045
|
-
i,
|
|
1046
|
-
e._debugStack,
|
|
1047
|
-
e._debugTask
|
|
1048
|
-
), a = 2; a < arguments.length; a++)
|
|
1049
|
-
_ = arguments[a], I(_) && _._store && (_._store.validated = 1);
|
|
1050
|
-
return i;
|
|
1051
|
-
}, u.createContext = function(e) {
|
|
1052
|
-
return e = {
|
|
1053
|
-
$$typeof: R,
|
|
1054
|
-
_currentValue: e,
|
|
1055
|
-
_currentValue2: e,
|
|
1056
|
-
_threadCount: 0,
|
|
1057
|
-
Provider: null,
|
|
1058
|
-
Consumer: null
|
|
1059
|
-
}, e.Provider = e, e.Consumer = {
|
|
1060
|
-
$$typeof: c,
|
|
1061
|
-
_context: e
|
|
1062
|
-
}, e._currentRenderer = null, e._currentRenderer2 = null, e;
|
|
1063
|
-
}, u.createElement = function(e, r, s) {
|
|
1064
|
-
for (var i = 2; i < arguments.length; i++) {
|
|
1065
|
-
var a = arguments[i];
|
|
1066
|
-
I(a) && a._store && (a._store.validated = 1);
|
|
1067
|
-
}
|
|
1068
|
-
if (i = {}, a = null, r != null)
|
|
1069
|
-
for (h in Ce || !("__self" in r) || "key" in r || (Ce = !0, console.warn(
|
|
1070
|
-
"Your app (or one of its dependencies) is using an outdated JSX transform. Update to the modern JSX transform for faster performance: https://react.dev/link/new-jsx-transform"
|
|
1071
|
-
)), K(r) && ($(r.key), a = "" + r.key), r)
|
|
1072
|
-
le.call(r, h) && h !== "key" && h !== "__self" && h !== "__source" && (i[h] = r[h]);
|
|
1073
|
-
var _ = arguments.length - 2;
|
|
1074
|
-
if (_ === 1) i.children = s;
|
|
1075
|
-
else if (1 < _) {
|
|
1076
|
-
for (var d = Array(_), O = 0; O < _; O++)
|
|
1077
|
-
d[O] = arguments[O + 2];
|
|
1078
|
-
Object.freeze && Object.freeze(d), i.children = d;
|
|
1079
|
-
}
|
|
1080
|
-
if (e && e.defaultProps)
|
|
1081
|
-
for (h in _ = e.defaultProps, _)
|
|
1082
|
-
i[h] === void 0 && (i[h] = _[h]);
|
|
1083
|
-
a && ee(
|
|
1084
|
-
i,
|
|
1085
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
1086
|
-
);
|
|
1087
|
-
var h = 1e4 > g.recentlyCreatedOwnerStacks++;
|
|
1088
|
-
return z(
|
|
1089
|
-
e,
|
|
1090
|
-
a,
|
|
1091
|
-
void 0,
|
|
1092
|
-
void 0,
|
|
1093
|
-
B(),
|
|
1094
|
-
i,
|
|
1095
|
-
h ? Error("react-stack-top-frame") : xe,
|
|
1096
|
-
h ? be(W(e)) : Ve
|
|
1097
|
-
);
|
|
1098
|
-
}, u.createRef = function() {
|
|
1099
|
-
var e = { current: null };
|
|
1100
|
-
return Object.seal(e), e;
|
|
1101
|
-
}, u.forwardRef = function(e) {
|
|
1102
|
-
e != null && e.$$typeof === A ? console.error(
|
|
1103
|
-
"forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."
|
|
1104
|
-
) : typeof e != "function" ? console.error(
|
|
1105
|
-
"forwardRef requires a render function but was given %s.",
|
|
1106
|
-
e === null ? "null" : typeof e
|
|
1107
|
-
) : e.length !== 0 && e.length !== 2 && console.error(
|
|
1108
|
-
"forwardRef render functions accept exactly two parameters: props and ref. %s",
|
|
1109
|
-
e.length === 1 ? "Did you forget to use the ref parameter?" : "Any additional parameter will be undefined."
|
|
1110
|
-
), e != null && e.defaultProps != null && console.error(
|
|
1111
|
-
"forwardRef render functions do not support defaultProps. Did you accidentally pass a React component?"
|
|
1112
|
-
);
|
|
1113
|
-
var r = { $$typeof: S, render: e }, s;
|
|
1114
|
-
return Object.defineProperty(r, "displayName", {
|
|
1115
|
-
enumerable: !1,
|
|
1116
|
-
configurable: !0,
|
|
1117
|
-
get: function() {
|
|
1118
|
-
return s;
|
|
1119
|
-
},
|
|
1120
|
-
set: function(i) {
|
|
1121
|
-
s = i, e.name || e.displayName || (Object.defineProperty(e, "name", { value: i }), e.displayName = i);
|
|
1122
|
-
}
|
|
1123
|
-
}), r;
|
|
1124
|
-
}, u.isValidElement = I, u.lazy = function(e) {
|
|
1125
|
-
return {
|
|
1126
|
-
$$typeof: ne,
|
|
1127
|
-
_payload: { _status: -1, _result: e },
|
|
1128
|
-
_init: te
|
|
1129
|
-
};
|
|
1130
|
-
}, u.memo = function(e, r) {
|
|
1131
|
-
e == null && console.error(
|
|
1132
|
-
"memo: The first argument must be a component. Instead received: %s",
|
|
1133
|
-
e === null ? "null" : typeof e
|
|
1134
|
-
), r = {
|
|
1135
|
-
$$typeof: A,
|
|
1136
|
-
type: e,
|
|
1137
|
-
compare: r === void 0 ? null : r
|
|
1138
|
-
};
|
|
1139
|
-
var s;
|
|
1140
|
-
return Object.defineProperty(r, "displayName", {
|
|
1141
|
-
enumerable: !1,
|
|
1142
|
-
configurable: !0,
|
|
1143
|
-
get: function() {
|
|
1144
|
-
return s;
|
|
1145
|
-
},
|
|
1146
|
-
set: function(i) {
|
|
1147
|
-
s = i, e.name || e.displayName || (Object.defineProperty(e, "name", { value: i }), e.displayName = i);
|
|
1148
|
-
}
|
|
1149
|
-
}), r;
|
|
1150
|
-
}, u.startTransition = function(e) {
|
|
1151
|
-
var r = g.T, s = {};
|
|
1152
|
-
g.T = s, s._updatedFibers = /* @__PURE__ */ new Set();
|
|
1153
|
-
try {
|
|
1154
|
-
var i = e(), a = g.S;
|
|
1155
|
-
a !== null && a(s, i), typeof i == "object" && i !== null && typeof i.then == "function" && i.then(re, je);
|
|
1156
|
-
} catch (_) {
|
|
1157
|
-
je(_);
|
|
1158
|
-
} finally {
|
|
1159
|
-
r === null && s._updatedFibers && (e = s._updatedFibers.size, s._updatedFibers.clear(), 10 < e && console.warn(
|
|
1160
|
-
"Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."
|
|
1161
|
-
)), g.T = r;
|
|
1162
|
-
}
|
|
1163
|
-
}, u.unstable_useCacheRefresh = function() {
|
|
1164
|
-
return C().useCacheRefresh();
|
|
1165
|
-
}, u.use = function(e) {
|
|
1166
|
-
return C().use(e);
|
|
1167
|
-
}, u.useActionState = function(e, r, s) {
|
|
1168
|
-
return C().useActionState(
|
|
1169
|
-
e,
|
|
1170
|
-
r,
|
|
1171
|
-
s
|
|
1172
|
-
);
|
|
1173
|
-
}, u.useCallback = function(e, r) {
|
|
1174
|
-
return C().useCallback(e, r);
|
|
1175
|
-
}, u.useContext = function(e) {
|
|
1176
|
-
var r = C();
|
|
1177
|
-
return e.$$typeof === c && console.error(
|
|
1178
|
-
"Calling useContext(Context.Consumer) is not supported and will cause bugs. Did you mean to call useContext(Context) instead?"
|
|
1179
|
-
), r.useContext(e);
|
|
1180
|
-
}, u.useDebugValue = function(e, r) {
|
|
1181
|
-
return C().useDebugValue(e, r);
|
|
1182
|
-
}, u.useDeferredValue = function(e, r) {
|
|
1183
|
-
return C().useDeferredValue(e, r);
|
|
1184
|
-
}, u.useEffect = function(e, r, s) {
|
|
1185
|
-
e == null && console.warn(
|
|
1186
|
-
"React Hook useEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1187
|
-
);
|
|
1188
|
-
var i = C();
|
|
1189
|
-
if (typeof s == "function")
|
|
1190
|
-
throw Error(
|
|
1191
|
-
"useEffect CRUD overload is not enabled in this build of React."
|
|
1192
|
-
);
|
|
1193
|
-
return i.useEffect(e, r);
|
|
1194
|
-
}, u.useId = function() {
|
|
1195
|
-
return C().useId();
|
|
1196
|
-
}, u.useImperativeHandle = function(e, r, s) {
|
|
1197
|
-
return C().useImperativeHandle(e, r, s);
|
|
1198
|
-
}, u.useInsertionEffect = function(e, r) {
|
|
1199
|
-
return e == null && console.warn(
|
|
1200
|
-
"React Hook useInsertionEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1201
|
-
), C().useInsertionEffect(e, r);
|
|
1202
|
-
}, u.useLayoutEffect = function(e, r) {
|
|
1203
|
-
return e == null && console.warn(
|
|
1204
|
-
"React Hook useLayoutEffect requires an effect callback. Did you forget to pass a callback to the hook?"
|
|
1205
|
-
), C().useLayoutEffect(e, r);
|
|
1206
|
-
}, u.useMemo = function(e, r) {
|
|
1207
|
-
return C().useMemo(e, r);
|
|
1208
|
-
}, u.useOptimistic = function(e, r) {
|
|
1209
|
-
return C().useOptimistic(e, r);
|
|
1210
|
-
}, u.useReducer = function(e, r, s) {
|
|
1211
|
-
return C().useReducer(e, r, s);
|
|
1212
|
-
}, u.useRef = function(e) {
|
|
1213
|
-
return C().useRef(e);
|
|
1214
|
-
}, u.useState = function(e) {
|
|
1215
|
-
return C().useState(e);
|
|
1216
|
-
}, u.useSyncExternalStore = function(e, r, s) {
|
|
1217
|
-
return C().useSyncExternalStore(
|
|
1218
|
-
e,
|
|
1219
|
-
r,
|
|
1220
|
-
s
|
|
1221
|
-
);
|
|
1222
|
-
}, u.useTransition = function() {
|
|
1223
|
-
return C().useTransition();
|
|
1224
|
-
}, u.version = "19.1.0", typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());
|
|
1225
|
-
}();
|
|
1226
|
-
}(ae, ae.exports)), ae.exports;
|
|
1227
|
-
}
|
|
1228
|
-
var $e;
|
|
1229
|
-
function nt() {
|
|
1230
|
-
return $e || ($e = 1, process.env.NODE_ENV === "production" ? ye.exports = tt() : ye.exports = rt()), ye.exports;
|
|
1231
|
-
}
|
|
1232
|
-
var ot = nt();
|
|
1233
|
-
const ut = /* @__PURE__ */ et(ot);
|
|
1234
|
-
var st = (n) => n instanceof Date, Ye = (n) => n == null;
|
|
1235
|
-
const it = (n) => typeof n == "object";
|
|
1236
|
-
var Ue = (n) => !Ye(n) && !Array.isArray(n) && it(n) && !st(n), qe = (n) => Array.isArray(n) ? n.filter(Boolean) : [], Ie = (n) => n === void 0, se = (n, u, y) => {
|
|
1237
|
-
if (!u || !Ue(n))
|
|
1238
|
-
return y;
|
|
1239
|
-
const v = qe(u.split(/[,[\].]+?/)).reduce((T, k) => Ye(T) ? T : T[k], n);
|
|
1240
|
-
return Ie(v) || v === n ? Ie(n[u]) ? y : n[u] : v;
|
|
1241
|
-
}, at = (n) => /^\w*$/.test(n), ct = (n) => qe(n.replace(/["|']|\]/g, "").split(/\.|\[/)), De = (n, u, y) => {
|
|
1242
|
-
let v = -1;
|
|
1243
|
-
const T = at(u) ? [u] : ct(u), k = T.length, N = k - 1;
|
|
1244
|
-
for (; ++v < k; ) {
|
|
1245
|
-
const j = T[v];
|
|
1246
|
-
let L = y;
|
|
1247
|
-
if (v !== N) {
|
|
1248
|
-
const $ = n[j];
|
|
1249
|
-
L = Ue($) || Array.isArray($) ? $ : isNaN(+T[v + 1]) ? {} : [];
|
|
134
|
+
// src/utils/set.ts
|
|
135
|
+
var isKey = (value) => /^\w*$/.test(value);
|
|
136
|
+
var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
|
|
137
|
+
var set = (object, path, value) => {
|
|
138
|
+
let index = -1;
|
|
139
|
+
const tempPath = isKey(path) ? [path] : stringToPath(path);
|
|
140
|
+
const length = tempPath.length;
|
|
141
|
+
const lastIndex = length - 1;
|
|
142
|
+
while (++index < length) {
|
|
143
|
+
const key = tempPath[index];
|
|
144
|
+
let newValue = value;
|
|
145
|
+
if (index !== lastIndex) {
|
|
146
|
+
const objValue = object[key];
|
|
147
|
+
newValue = isObject(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
|
|
1250
148
|
}
|
|
1251
|
-
if (
|
|
149
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
1252
150
|
return;
|
|
1253
|
-
|
|
151
|
+
}
|
|
152
|
+
object[key] = newValue;
|
|
153
|
+
object = object[key];
|
|
1254
154
|
}
|
|
1255
155
|
};
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
156
|
+
|
|
157
|
+
// src/logic/create_rules.ts
|
|
158
|
+
var createRules = () => {
|
|
159
|
+
const rules = {};
|
|
160
|
+
const addRule = (name, options) => {
|
|
161
|
+
rules[name] = {
|
|
162
|
+
required: options.required,
|
|
163
|
+
min: options.min,
|
|
164
|
+
max: options.max,
|
|
165
|
+
minLength: options.minLength,
|
|
166
|
+
maxLength: options.maxLength,
|
|
167
|
+
pattern: options.pattern,
|
|
168
|
+
valueAsNumber: options.valueAsNumber,
|
|
169
|
+
validate: options.validate
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
const getRule = (name) => {
|
|
173
|
+
return rules[name];
|
|
174
|
+
};
|
|
175
|
+
return { rules, addRule, getRule };
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
// src/logic/create_fields.ts
|
|
179
|
+
var createFields = () => {
|
|
180
|
+
const fields = {};
|
|
181
|
+
const getField = (name) => {
|
|
182
|
+
return fields[name];
|
|
183
|
+
};
|
|
184
|
+
const setField = (name, element) => {
|
|
185
|
+
fields[name] = element;
|
|
186
|
+
};
|
|
1280
187
|
return {
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
},
|
|
1285
|
-
removeError: (N) => {
|
|
1286
|
-
u((j) => {
|
|
1287
|
-
const L = { ...j };
|
|
1288
|
-
return delete L[N], L;
|
|
1289
|
-
});
|
|
1290
|
-
},
|
|
1291
|
-
resetErrors: () => {
|
|
1292
|
-
u({});
|
|
1293
|
-
},
|
|
1294
|
-
getError: (N) => se(n(), N)
|
|
188
|
+
fields,
|
|
189
|
+
getField,
|
|
190
|
+
setField
|
|
1295
191
|
};
|
|
1296
|
-
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// src/logic/format_value.ts
|
|
195
|
+
var formatValue = (value, rules) => {
|
|
196
|
+
if (rules.valueAsNumber) {
|
|
197
|
+
return Number(value);
|
|
198
|
+
}
|
|
199
|
+
return value;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// src/utils/resolver.ts
|
|
203
|
+
var getResolverFields = (fields) => {
|
|
204
|
+
return Object.entries(fields).reduce((acc, [name, ref]) => {
|
|
205
|
+
acc[name] = {
|
|
206
|
+
ref,
|
|
207
|
+
name
|
|
1308
208
|
};
|
|
1309
|
-
|
|
1310
|
-
},
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
209
|
+
return acc;
|
|
210
|
+
}, {});
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
// src/use_form.ts
|
|
214
|
+
var useForm = (arg = { defaultValues: {} }) => {
|
|
215
|
+
const { defaultValues, mode = "onInput", resolver } = arg;
|
|
216
|
+
const { fields, getField, setField } = createFields();
|
|
217
|
+
const { rules, addRule, getRule } = createRules();
|
|
218
|
+
const [values, setValues] = createSignal(defaultValues);
|
|
219
|
+
const { errors, appendError, removeError, resetErrors, getError } = createErrors();
|
|
220
|
+
const isValid = createMemo(() => {
|
|
221
|
+
return !Object.keys(errors()).length;
|
|
222
|
+
});
|
|
223
|
+
const setFieldError = (name, error) => {
|
|
224
|
+
const field = getField(name);
|
|
225
|
+
if (field) {
|
|
226
|
+
error.ref = field;
|
|
1317
227
|
}
|
|
228
|
+
appendError(name, error);
|
|
229
|
+
};
|
|
230
|
+
const clearFieldError = (name) => {
|
|
231
|
+
removeError(name);
|
|
1318
232
|
};
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
name: y
|
|
1322
|
-
}, u), {}), vt = (n = { defaultValues: {} }) => {
|
|
1323
|
-
const { defaultValues: u, mode: y = "onInput", resolver: v } = n, { fields: T, getField: k, setField: N } = dt(), { rules: j, addRule: L, getRule: $ } = pt(), [M, W] = He(u), { errors: B, appendError: Q, removeError: K, resetErrors: ee, getError: U } = lt(), z = Qe(() => !Object.keys(B()).length), x = (l, E) => {
|
|
1324
|
-
const w = k(l);
|
|
1325
|
-
w && (E.ref = w), Q(l, E);
|
|
1326
|
-
}, I = (l) => {
|
|
1327
|
-
K(l);
|
|
1328
|
-
}, X = async (l) => {
|
|
1329
|
-
if (!v)
|
|
233
|
+
const runSchema = async (names) => {
|
|
234
|
+
if (!resolver) {
|
|
1330
235
|
return;
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
236
|
+
}
|
|
237
|
+
const result = await resolver(values(), null, {
|
|
238
|
+
fields: getResolverFields(fields),
|
|
239
|
+
shouldUseNativeValidation: false
|
|
1334
240
|
});
|
|
1335
|
-
for (const
|
|
1336
|
-
const
|
|
1337
|
-
|
|
241
|
+
for (const name of names) {
|
|
242
|
+
const error = get(result.errors, name);
|
|
243
|
+
if (error) {
|
|
244
|
+
setFieldError(name, error);
|
|
245
|
+
} else {
|
|
246
|
+
clearFieldError(name);
|
|
247
|
+
}
|
|
1338
248
|
}
|
|
1339
|
-
}
|
|
1340
|
-
|
|
1341
|
-
|
|
249
|
+
};
|
|
250
|
+
const validateField = (name) => {
|
|
251
|
+
if (resolver) {
|
|
252
|
+
runSchema([name]);
|
|
1342
253
|
return;
|
|
1343
254
|
}
|
|
1344
|
-
const
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
255
|
+
const rule = getRule(name);
|
|
256
|
+
const error = validate(values(), name, rule);
|
|
257
|
+
if (error) {
|
|
258
|
+
setFieldError(name, error);
|
|
259
|
+
} else {
|
|
260
|
+
clearFieldError(name);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
const validateAllFields = async () => {
|
|
264
|
+
if (resolver) {
|
|
265
|
+
await runSchema(Object.keys(fields));
|
|
1349
266
|
return;
|
|
1350
267
|
}
|
|
1351
|
-
Object.keys(
|
|
1352
|
-
|
|
268
|
+
Object.keys(rules).forEach((key) => {
|
|
269
|
+
validateField(key);
|
|
1353
270
|
});
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
const
|
|
1357
|
-
for (const
|
|
1358
|
-
const
|
|
1359
|
-
if (
|
|
1360
|
-
|
|
271
|
+
};
|
|
272
|
+
const focusFirstError = () => {
|
|
273
|
+
const names = Object.keys(fields);
|
|
274
|
+
for (const name of names) {
|
|
275
|
+
const error = getError(name);
|
|
276
|
+
if (error) {
|
|
277
|
+
error.ref?.focus();
|
|
1361
278
|
break;
|
|
1362
279
|
}
|
|
1363
280
|
}
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
281
|
+
};
|
|
282
|
+
const onFieldChange = (event, name) => {
|
|
283
|
+
const value = formatValue(getFieldValue(event), rules[name]);
|
|
284
|
+
setValues((prev) => {
|
|
285
|
+
const newState = { ...prev };
|
|
286
|
+
set(newState, name, value);
|
|
287
|
+
return newState;
|
|
288
|
+
});
|
|
289
|
+
validateField(name);
|
|
290
|
+
};
|
|
291
|
+
const register = (name, options = {}) => {
|
|
292
|
+
addRule(name, options);
|
|
293
|
+
return {
|
|
294
|
+
name,
|
|
295
|
+
// value: get(values(), name),
|
|
296
|
+
onInput(event) {
|
|
297
|
+
if (mode === "onChange") {
|
|
298
|
+
onFieldChange(event, name);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
onChange(event) {
|
|
302
|
+
if (mode === "onChange") {
|
|
303
|
+
onFieldChange(event, name);
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
ref(element) {
|
|
307
|
+
const field = getField(name);
|
|
308
|
+
if (field) {
|
|
309
|
+
return;
|
|
310
|
+
}
|
|
311
|
+
setField(name, element);
|
|
312
|
+
if (element) {
|
|
313
|
+
setFieldValue(element, get(values(), name));
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
};
|
|
318
|
+
const getValues = (name) => {
|
|
319
|
+
if (name) {
|
|
320
|
+
return get(values(), name);
|
|
321
|
+
}
|
|
322
|
+
return values();
|
|
323
|
+
};
|
|
324
|
+
const setValue = (name, value) => {
|
|
325
|
+
setValues((prev) => {
|
|
326
|
+
const newValues = { ...prev };
|
|
327
|
+
set(newValues, name, value);
|
|
328
|
+
return newValues;
|
|
329
|
+
});
|
|
330
|
+
const field = getField(name);
|
|
331
|
+
if (field) {
|
|
332
|
+
setFieldValue(field, value);
|
|
1381
333
|
}
|
|
1382
|
-
}
|
|
334
|
+
};
|
|
335
|
+
const onSubmit = (submit) => {
|
|
336
|
+
return async (event) => {
|
|
337
|
+
event.preventDefault();
|
|
338
|
+
await validateAllFields();
|
|
339
|
+
if (isValid()) {
|
|
340
|
+
submit(getValues());
|
|
341
|
+
}
|
|
342
|
+
focusFirstError();
|
|
343
|
+
};
|
|
344
|
+
};
|
|
345
|
+
const reset = (newDefaultValues = {}) => {
|
|
346
|
+
const newValues = {
|
|
347
|
+
...structuredClone(defaultValues),
|
|
348
|
+
...newDefaultValues
|
|
349
|
+
};
|
|
350
|
+
setValues(() => newValues);
|
|
351
|
+
resetErrors();
|
|
352
|
+
Object.entries(fields).forEach(([name, field]) => {
|
|
353
|
+
if (field) {
|
|
354
|
+
setFieldValue(field, get(newValues, name));
|
|
355
|
+
}
|
|
356
|
+
});
|
|
357
|
+
};
|
|
1383
358
|
return {
|
|
1384
|
-
values
|
|
1385
|
-
errors
|
|
1386
|
-
isValid
|
|
1387
|
-
register
|
|
1388
|
-
getValues
|
|
1389
|
-
setValue
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
359
|
+
values,
|
|
360
|
+
errors,
|
|
361
|
+
isValid,
|
|
362
|
+
register,
|
|
363
|
+
getValues,
|
|
364
|
+
setValue,
|
|
365
|
+
onSubmit,
|
|
366
|
+
reset
|
|
367
|
+
};
|
|
368
|
+
};
|
|
369
|
+
var FormContext = createContext();
|
|
370
|
+
|
|
371
|
+
// src/form_provider.tsx
|
|
372
|
+
var FormProvider = (props) => {
|
|
373
|
+
return createComponent(FormContext.Provider, {
|
|
374
|
+
get value() {
|
|
375
|
+
return props.form;
|
|
1399
376
|
},
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
...structuredClone(u),
|
|
1403
|
-
...l
|
|
1404
|
-
};
|
|
1405
|
-
W(() => E), ee(), Object.entries(T).forEach(([w, P]) => {
|
|
1406
|
-
P && ge(P, se(E, w));
|
|
1407
|
-
});
|
|
377
|
+
get children() {
|
|
378
|
+
return props.children;
|
|
1408
379
|
}
|
|
1409
|
-
};
|
|
1410
|
-
}, Fe = Ke(), gt = (n) => Xe(Fe.Provider, {
|
|
1411
|
-
get value() {
|
|
1412
|
-
return n.form;
|
|
1413
|
-
},
|
|
1414
|
-
get children() {
|
|
1415
|
-
return n.children;
|
|
1416
|
-
}
|
|
1417
|
-
}), _t = () => {
|
|
1418
|
-
const n = Ze(Fe);
|
|
1419
|
-
if (!n)
|
|
1420
|
-
throw new Error("useFormContext: cannot find a FormProvider");
|
|
1421
|
-
return n;
|
|
380
|
+
});
|
|
1422
381
|
};
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
382
|
+
var useFormContext = () => {
|
|
383
|
+
const form = useContext(FormContext);
|
|
384
|
+
if (!form) {
|
|
385
|
+
throw new Error("useFormContext: cannot find a FormProvider");
|
|
386
|
+
}
|
|
387
|
+
return form;
|
|
1427
388
|
};
|
|
389
|
+
|
|
390
|
+
export { FormProvider, get, set, useForm, useFormContext };
|