@pnkx-lib/ui 1.1.16 → 1.1.17

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,2263 +0,0 @@
1
- import * as be from "react";
2
- import T, { createContext as Er, useContext as Cr, useEffect as Ar } from "react";
3
- import { Typography as Tr } from "antd";
4
- var Wn = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
- function kr(e) {
6
- return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
7
- }
8
- var Le = { exports: {} }, Ve = {};
9
- /**
10
- * @license React
11
- * react-jsx-runtime.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */
18
- var xt;
19
- function Vr() {
20
- if (xt) return Ve;
21
- xt = 1;
22
- var e = Symbol.for("react.transitional.element"), r = Symbol.for("react.fragment");
23
- function t(n, s, i) {
24
- var l = null;
25
- if (i !== void 0 && (l = "" + i), s.key !== void 0 && (l = "" + s.key), "key" in s) {
26
- i = {};
27
- for (var c in s)
28
- c !== "key" && (i[c] = s[c]);
29
- } else i = s;
30
- return s = i.ref, {
31
- $$typeof: e,
32
- type: n,
33
- key: l,
34
- ref: s !== void 0 ? s : null,
35
- props: i
36
- };
37
- }
38
- return Ve.Fragment = r, Ve.jsx = t, Ve.jsxs = t, Ve;
39
- }
40
- var Re = {};
41
- /**
42
- * @license React
43
- * react-jsx-runtime.development.js
44
- *
45
- * Copyright (c) Meta Platforms, Inc. and affiliates.
46
- *
47
- * This source code is licensed under the MIT license found in the
48
- * LICENSE file in the root directory of this source tree.
49
- */
50
- var wt;
51
- function Rr() {
52
- return wt || (wt = 1, process.env.NODE_ENV !== "production" && function() {
53
- function e(f) {
54
- if (f == null) return null;
55
- if (typeof f == "function")
56
- return f.$$typeof === fe ? null : f.displayName || f.name || null;
57
- if (typeof f == "string") return f;
58
- switch (f) {
59
- case R:
60
- return "Fragment";
61
- case M:
62
- return "Profiler";
63
- case W:
64
- return "StrictMode";
65
- case P:
66
- return "Suspense";
67
- case ye:
68
- return "SuspenseList";
69
- case ne:
70
- return "Activity";
71
- }
72
- if (typeof f == "object")
73
- switch (typeof f.tag == "number" && console.error(
74
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
75
- ), f.$$typeof) {
76
- case Y:
77
- return "Portal";
78
- case z:
79
- return (f.displayName || "Context") + ".Provider";
80
- case w:
81
- return (f._context.displayName || "Context") + ".Consumer";
82
- case U:
83
- var S = f.render;
84
- return f = f.displayName, f || (f = S.displayName || S.name || "", f = f !== "" ? "ForwardRef(" + f + ")" : "ForwardRef"), f;
85
- case me:
86
- return S = f.displayName || null, S !== null ? S : e(f.type) || "Memo";
87
- case xe:
88
- S = f._payload, f = f._init;
89
- try {
90
- return e(f(S));
91
- } catch {
92
- }
93
- }
94
- return null;
95
- }
96
- function r(f) {
97
- return "" + f;
98
- }
99
- function t(f) {
100
- try {
101
- r(f);
102
- var S = !1;
103
- } catch {
104
- S = !0;
105
- }
106
- if (S) {
107
- S = console;
108
- var V = S.error, j = typeof Symbol == "function" && Symbol.toStringTag && f[Symbol.toStringTag] || f.constructor.name || "Object";
109
- return V.call(
110
- S,
111
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
112
- j
113
- ), r(f);
114
- }
115
- }
116
- function n(f) {
117
- if (f === R) return "<>";
118
- if (typeof f == "object" && f !== null && f.$$typeof === xe)
119
- return "<...>";
120
- try {
121
- var S = e(f);
122
- return S ? "<" + S + ">" : "<...>";
123
- } catch {
124
- return "<...>";
125
- }
126
- }
127
- function s() {
128
- var f = Z.A;
129
- return f === null ? null : f.getOwner();
130
- }
131
- function i() {
132
- return Error("react-stack-top-frame");
133
- }
134
- function l(f) {
135
- if (C.call(f, "key")) {
136
- var S = Object.getOwnPropertyDescriptor(f, "key").get;
137
- if (S && S.isReactWarning) return !1;
138
- }
139
- return f.key !== void 0;
140
- }
141
- function c(f, S) {
142
- function V() {
143
- B || (B = !0, console.error(
144
- "%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)",
145
- S
146
- ));
147
- }
148
- V.isReactWarning = !0, Object.defineProperty(f, "key", {
149
- get: V,
150
- configurable: !0
151
- });
152
- }
153
- function h() {
154
- var f = e(this.type);
155
- return G[f] || (G[f] = !0, console.error(
156
- "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."
157
- )), f = this.props.ref, f !== void 0 ? f : null;
158
- }
159
- function v(f, S, V, j, oe, te, Te, we) {
160
- return V = te.ref, f = {
161
- $$typeof: K,
162
- type: f,
163
- key: S,
164
- props: te,
165
- _owner: oe
166
- }, (V !== void 0 ? V : null) !== null ? Object.defineProperty(f, "ref", {
167
- enumerable: !1,
168
- get: h
169
- }) : Object.defineProperty(f, "ref", { enumerable: !1, value: null }), f._store = {}, Object.defineProperty(f._store, "validated", {
170
- configurable: !1,
171
- enumerable: !1,
172
- writable: !0,
173
- value: 0
174
- }), Object.defineProperty(f, "_debugInfo", {
175
- configurable: !1,
176
- enumerable: !1,
177
- writable: !0,
178
- value: null
179
- }), Object.defineProperty(f, "_debugStack", {
180
- configurable: !1,
181
- enumerable: !1,
182
- writable: !0,
183
- value: Te
184
- }), Object.defineProperty(f, "_debugTask", {
185
- configurable: !1,
186
- enumerable: !1,
187
- writable: !0,
188
- value: we
189
- }), Object.freeze && (Object.freeze(f.props), Object.freeze(f)), f;
190
- }
191
- function _(f, S, V, j, oe, te, Te, we) {
192
- var I = S.children;
193
- if (I !== void 0)
194
- if (j)
195
- if (E(I)) {
196
- for (j = 0; j < I.length; j++)
197
- x(I[j]);
198
- Object.freeze && Object.freeze(I);
199
- } else
200
- console.error(
201
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
202
- );
203
- else x(I);
204
- if (C.call(S, "key")) {
205
- I = e(f);
206
- var le = Object.keys(S).filter(function(ke) {
207
- return ke !== "key";
208
- });
209
- j = 0 < le.length ? "{key: someKey, " + le.join(": ..., ") + ": ...}" : "{key: someKey}", he[I + j] || (le = 0 < le.length ? "{" + le.join(": ..., ") + ": ...}" : "{}", console.error(
210
- `A props object containing a "key" prop is being spread into JSX:
211
- let props = %s;
212
- <%s {...props} />
213
- React keys must be passed directly to JSX without using spread:
214
- let props = %s;
215
- <%s key={someKey} {...props} />`,
216
- j,
217
- I,
218
- le,
219
- I
220
- ), he[I + j] = !0);
221
- }
222
- if (I = null, V !== void 0 && (t(V), I = "" + V), l(S) && (t(S.key), I = "" + S.key), "key" in S) {
223
- V = {};
224
- for (var Se in S)
225
- Se !== "key" && (V[Se] = S[Se]);
226
- } else V = S;
227
- return I && c(
228
- V,
229
- typeof f == "function" ? f.displayName || f.name || "Unknown" : f
230
- ), v(
231
- f,
232
- I,
233
- te,
234
- oe,
235
- s(),
236
- V,
237
- Te,
238
- we
239
- );
240
- }
241
- function x(f) {
242
- typeof f == "object" && f !== null && f.$$typeof === K && f._store && (f._store.validated = 1);
243
- }
244
- var p = T, K = Symbol.for("react.transitional.element"), Y = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), W = Symbol.for("react.strict_mode"), M = Symbol.for("react.profiler"), w = Symbol.for("react.consumer"), z = Symbol.for("react.context"), U = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), ye = Symbol.for("react.suspense_list"), me = Symbol.for("react.memo"), xe = Symbol.for("react.lazy"), ne = Symbol.for("react.activity"), fe = Symbol.for("react.client.reference"), Z = p.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, C = Object.prototype.hasOwnProperty, E = Array.isArray, F = console.createTask ? console.createTask : function() {
245
- return null;
246
- };
247
- p = {
248
- "react-stack-bottom-frame": function(f) {
249
- return f();
250
- }
251
- };
252
- var B, G = {}, ee = p["react-stack-bottom-frame"].bind(
253
- p,
254
- i
255
- )(), se = F(n(i)), he = {};
256
- Re.Fragment = R, Re.jsx = function(f, S, V, j, oe) {
257
- var te = 1e4 > Z.recentlyCreatedOwnerStacks++;
258
- return _(
259
- f,
260
- S,
261
- V,
262
- !1,
263
- j,
264
- oe,
265
- te ? Error("react-stack-top-frame") : ee,
266
- te ? F(n(f)) : se
267
- );
268
- }, Re.jsxs = function(f, S, V, j, oe) {
269
- var te = 1e4 > Z.recentlyCreatedOwnerStacks++;
270
- return _(
271
- f,
272
- S,
273
- V,
274
- !0,
275
- j,
276
- oe,
277
- te ? Error("react-stack-top-frame") : ee,
278
- te ? F(n(f)) : se
279
- );
280
- };
281
- }()), Re;
282
- }
283
- var St;
284
- function Fr() {
285
- return St || (St = 1, process.env.NODE_ENV === "production" ? Le.exports = Vr() : Le.exports = Rr()), Le.exports;
286
- }
287
- var _e = Fr();
288
- const qn = T.memo(
289
- ({ errorMessage: e, isTouched: r, isSubmitted: t }) => !(r || t) || !e ? null : /* @__PURE__ */ _e.jsx("div", { className: "ml-2 text-red-600", children: e })
290
- ), { Title: Or, Paragraph: Dr, Text: Pr } = Tr, Nr = {
291
- Title: (e) => /* @__PURE__ */ _e.jsx(Or, { ...e }),
292
- Paragraph: (e) => /* @__PURE__ */ _e.jsx(Dr, { ...e }),
293
- Text: (e) => /* @__PURE__ */ _e.jsx(Pr, { ...e })
294
- }, Yn = ({ label: e, required: r }) => {
295
- //! State
296
- //! Function
297
- //! Render
298
- return /* @__PURE__ */ _e.jsxs("div", { className: "flex gap-1 mb-2 items-baseline", children: [
299
- /* @__PURE__ */ _e.jsx(Nr.Text, { children: e }),
300
- r && /* @__PURE__ */ _e.jsx("span", { className: "text-red-600 h-0", children: "*" })
301
- ] });
302
- };
303
- var je = (e) => e.type === "checkbox", ve = (e) => e instanceof Date, X = (e) => e == null;
304
- const zt = (e) => typeof e == "object";
305
- var D = (e) => !X(e) && !Array.isArray(e) && zt(e) && !ve(e), Gt = (e) => D(e) && e.target ? je(e.target) ? e.target.checked : e.target.value : e, Mr = (e) => e.substring(0, e.search(/\.\d+(\.|$)/)) || e, Jt = (e, r) => e.has(Mr(r)), jr = (e) => {
306
- const r = e.constructor && e.constructor.prototype;
307
- return D(r) && r.hasOwnProperty("isPrototypeOf");
308
- }, st = typeof window < "u" && typeof window.HTMLElement < "u" && typeof document < "u";
309
- function $(e) {
310
- let r;
311
- const t = Array.isArray(e), n = typeof FileList < "u" ? e instanceof FileList : !1;
312
- if (e instanceof Date)
313
- r = new Date(e);
314
- else if (e instanceof Set)
315
- r = new Set(e);
316
- else if (!(st && (e instanceof Blob || n)) && (t || D(e)))
317
- if (r = t ? [] : {}, !t && !jr(e))
318
- r = e;
319
- else
320
- for (const s in e)
321
- e.hasOwnProperty(s) && (r[s] = $(e[s]));
322
- else
323
- return e;
324
- return r;
325
- }
326
- var qe = (e) => Array.isArray(e) ? e.filter(Boolean) : [], O = (e) => e === void 0, y = (e, r, t) => {
327
- if (!r || !D(e))
328
- return t;
329
- const n = qe(r.split(/[,[\].]+?/)).reduce((s, i) => X(s) ? s : s[i], e);
330
- return O(n) || n === e ? O(e[r]) ? t : e[r] : n;
331
- }, re = (e) => typeof e == "boolean", it = (e) => /^\w*$/.test(e), Qt = (e) => qe(e.replace(/["|']|\]/g, "").split(/\.|\[/)), k = (e, r, t) => {
332
- let n = -1;
333
- const s = it(r) ? [r] : Qt(r), i = s.length, l = i - 1;
334
- for (; ++n < i; ) {
335
- const c = s[n];
336
- let h = t;
337
- if (n !== l) {
338
- const v = e[c];
339
- h = D(v) || Array.isArray(v) ? v : isNaN(+s[n + 1]) ? {} : [];
340
- }
341
- if (c === "__proto__" || c === "constructor" || c === "prototype")
342
- return;
343
- e[c] = h, e = e[c];
344
- }
345
- };
346
- const Ue = {
347
- BLUR: "blur",
348
- FOCUS_OUT: "focusout",
349
- CHANGE: "change"
350
- }, ie = {
351
- onBlur: "onBlur",
352
- onChange: "onChange",
353
- onSubmit: "onSubmit",
354
- onTouched: "onTouched",
355
- all: "all"
356
- }, de = {
357
- max: "max",
358
- min: "min",
359
- maxLength: "maxLength",
360
- minLength: "minLength",
361
- pattern: "pattern",
362
- required: "required",
363
- validate: "validate"
364
- }, Lr = T.createContext(null), at = () => T.useContext(Lr);
365
- var Xt = (e, r, t, n = !0) => {
366
- const s = {
367
- defaultValues: r._defaultValues
368
- };
369
- for (const i in e)
370
- Object.defineProperty(s, i, {
371
- get: () => {
372
- const l = i;
373
- return r._proxyFormState[l] !== ie.all && (r._proxyFormState[l] = !n || ie.all), t && (t[l] = !0), e[l];
374
- }
375
- });
376
- return s;
377
- };
378
- const ot = typeof window < "u" ? be.useLayoutEffect : be.useEffect;
379
- function Ir(e) {
380
- const r = at(), { control: t = r.control, disabled: n, name: s, exact: i } = e || {}, [l, c] = T.useState(t._formState), h = T.useRef({
381
- isDirty: !1,
382
- isLoading: !1,
383
- dirtyFields: !1,
384
- touchedFields: !1,
385
- validatingFields: !1,
386
- isValidating: !1,
387
- isValid: !1,
388
- errors: !1
389
- });
390
- return ot(() => t._subscribe({
391
- name: s,
392
- formState: h.current,
393
- exact: i,
394
- callback: (v) => {
395
- !n && c({
396
- ...t._formState,
397
- ...v
398
- });
399
- }
400
- }), [s, n, i]), T.useEffect(() => {
401
- h.current.isValid && t._setValid(!0);
402
- }, [t]), T.useMemo(() => Xt(l, t, h.current, !1), [l, t]);
403
- }
404
- var ue = (e) => typeof e == "string", Kt = (e, r, t, n, s) => ue(e) ? (n && r.watch.add(e), y(t, e, s)) : Array.isArray(e) ? e.map((i) => (n && r.watch.add(i), y(t, i))) : (n && (r.watchAll = !0), t);
405
- function Hr(e) {
406
- const r = at(), { control: t = r.control, name: n, defaultValue: s, disabled: i, exact: l } = e || {}, c = T.useRef(s), [h, v] = T.useState(t._getWatch(n, c.current));
407
- return ot(() => t._subscribe({
408
- name: n,
409
- formState: {
410
- values: !0
411
- },
412
- exact: l,
413
- callback: (_) => !i && v(Kt(n, t._names, _.values || t._formValues, !1, c.current))
414
- }), [n, t, i, l]), T.useEffect(() => t._removeUnmounted()), h;
415
- }
416
- function Ur(e) {
417
- const r = at(), { name: t, disabled: n, control: s = r.control, shouldUnregister: i } = e, l = Jt(s._names.array, t), c = Hr({
418
- control: s,
419
- name: t,
420
- defaultValue: y(s._formValues, t, y(s._defaultValues, t, e.defaultValue)),
421
- exact: !0
422
- }), h = Ir({
423
- control: s,
424
- name: t,
425
- exact: !0
426
- }), v = T.useRef(e), _ = T.useRef(s.register(t, {
427
- ...e.rules,
428
- value: c,
429
- ...re(e.disabled) ? { disabled: e.disabled } : {}
430
- })), x = T.useMemo(() => Object.defineProperties({}, {
431
- invalid: {
432
- enumerable: !0,
433
- get: () => !!y(h.errors, t)
434
- },
435
- isDirty: {
436
- enumerable: !0,
437
- get: () => !!y(h.dirtyFields, t)
438
- },
439
- isTouched: {
440
- enumerable: !0,
441
- get: () => !!y(h.touchedFields, t)
442
- },
443
- isValidating: {
444
- enumerable: !0,
445
- get: () => !!y(h.validatingFields, t)
446
- },
447
- error: {
448
- enumerable: !0,
449
- get: () => y(h.errors, t)
450
- }
451
- }), [h, t]), p = T.useCallback((W) => _.current.onChange({
452
- target: {
453
- value: Gt(W),
454
- name: t
455
- },
456
- type: Ue.CHANGE
457
- }), [t]), K = T.useCallback(() => _.current.onBlur({
458
- target: {
459
- value: y(s._formValues, t),
460
- name: t
461
- },
462
- type: Ue.BLUR
463
- }), [t, s._formValues]), Y = T.useCallback((W) => {
464
- const M = y(s._fields, t);
465
- M && W && (M._f.ref = W);
466
- }, [s._fields, t]), R = T.useMemo(() => ({
467
- name: t,
468
- value: c,
469
- ...re(n) || h.disabled ? { disabled: h.disabled || n } : {},
470
- onChange: p,
471
- onBlur: K,
472
- ref: Y
473
- }), [t, n, h.disabled, p, K, Y, c]);
474
- return T.useEffect(() => {
475
- const W = s._options.shouldUnregister || i;
476
- s.register(t, {
477
- ...v.current.rules,
478
- ...re(v.current.disabled) ? { disabled: v.current.disabled } : {}
479
- });
480
- const M = (w, z) => {
481
- const U = y(s._fields, w);
482
- U && U._f && (U._f.mount = z);
483
- };
484
- if (M(t, !0), W) {
485
- const w = $(y(s._options.defaultValues, t));
486
- k(s._defaultValues, t, w), O(y(s._formValues, t)) && k(s._formValues, t, w);
487
- }
488
- return !l && s.register(t), () => {
489
- (l ? W && !s._state.action : W) ? s.unregister(t) : M(t, !1);
490
- };
491
- }, [t, s, l, i]), T.useEffect(() => {
492
- s._setDisabledField({
493
- disabled: n,
494
- name: t
495
- });
496
- }, [n, t, s]), T.useMemo(() => ({
497
- field: R,
498
- formState: h,
499
- fieldState: x
500
- }), [R, h, x]);
501
- }
502
- const zn = (e) => e.render(Ur(e));
503
- var Br = (e, r, t, n, s) => r ? {
504
- ...t[e],
505
- types: {
506
- ...t[e] && t[e].types ? t[e].types : {},
507
- [n]: s || !0
508
- }
509
- } : {}, Pe = (e) => Array.isArray(e) ? e : [e], Et = () => {
510
- let e = [];
511
- return {
512
- get observers() {
513
- return e;
514
- },
515
- next: (s) => {
516
- for (const i of e)
517
- i.next && i.next(s);
518
- },
519
- subscribe: (s) => (e.push(s), {
520
- unsubscribe: () => {
521
- e = e.filter((i) => i !== s);
522
- }
523
- }),
524
- unsubscribe: () => {
525
- e = [];
526
- }
527
- };
528
- }, Ke = (e) => X(e) || !zt(e);
529
- function ge(e, r) {
530
- if (Ke(e) || Ke(r))
531
- return e === r;
532
- if (ve(e) && ve(r))
533
- return e.getTime() === r.getTime();
534
- const t = Object.keys(e), n = Object.keys(r);
535
- if (t.length !== n.length)
536
- return !1;
537
- for (const s of t) {
538
- const i = e[s];
539
- if (!n.includes(s))
540
- return !1;
541
- if (s !== "ref") {
542
- const l = r[s];
543
- if (ve(i) && ve(l) || D(i) && D(l) || Array.isArray(i) && Array.isArray(l) ? !ge(i, l) : i !== l)
544
- return !1;
545
- }
546
- }
547
- return !0;
548
- }
549
- var Q = (e) => D(e) && !Object.keys(e).length, lt = (e) => e.type === "file", ae = (e) => typeof e == "function", Be = (e) => {
550
- if (!st)
551
- return !1;
552
- const r = e ? e.ownerDocument : 0;
553
- return e instanceof (r && r.defaultView ? r.defaultView.HTMLElement : HTMLElement);
554
- }, Zt = (e) => e.type === "select-multiple", ut = (e) => e.type === "radio", $r = (e) => ut(e) || je(e), Je = (e) => Be(e) && e.isConnected;
555
- function Wr(e, r) {
556
- const t = r.slice(0, -1).length;
557
- let n = 0;
558
- for (; n < t; )
559
- e = O(e) ? n++ : e[r[n++]];
560
- return e;
561
- }
562
- function qr(e) {
563
- for (const r in e)
564
- if (e.hasOwnProperty(r) && !O(e[r]))
565
- return !1;
566
- return !0;
567
- }
568
- function L(e, r) {
569
- const t = Array.isArray(r) ? r : it(r) ? [r] : Qt(r), n = t.length === 1 ? e : Wr(e, t), s = t.length - 1, i = t[s];
570
- return n && delete n[i], s !== 0 && (D(n) && Q(n) || Array.isArray(n) && qr(n)) && L(e, t.slice(0, -1)), e;
571
- }
572
- var er = (e) => {
573
- for (const r in e)
574
- if (ae(e[r]))
575
- return !0;
576
- return !1;
577
- };
578
- function $e(e, r = {}) {
579
- const t = Array.isArray(e);
580
- if (D(e) || t)
581
- for (const n in e)
582
- Array.isArray(e[n]) || D(e[n]) && !er(e[n]) ? (r[n] = Array.isArray(e[n]) ? [] : {}, $e(e[n], r[n])) : X(e[n]) || (r[n] = !0);
583
- return r;
584
- }
585
- function tr(e, r, t) {
586
- const n = Array.isArray(e);
587
- if (D(e) || n)
588
- for (const s in e)
589
- Array.isArray(e[s]) || D(e[s]) && !er(e[s]) ? O(r) || Ke(t[s]) ? t[s] = Array.isArray(e[s]) ? $e(e[s], []) : { ...$e(e[s]) } : tr(e[s], X(r) ? {} : r[s], t[s]) : t[s] = !ge(e[s], r[s]);
590
- return t;
591
- }
592
- var Fe = (e, r) => tr(e, r, $e(r));
593
- const Ct = {
594
- value: !1,
595
- isValid: !1
596
- }, At = { value: !0, isValid: !0 };
597
- var rr = (e) => {
598
- if (Array.isArray(e)) {
599
- if (e.length > 1) {
600
- const r = e.filter((t) => t && t.checked && !t.disabled).map((t) => t.value);
601
- return { value: r, isValid: !!r.length };
602
- }
603
- return e[0].checked && !e[0].disabled ? (
604
- // @ts-expect-error expected to work in the browser
605
- e[0].attributes && !O(e[0].attributes.value) ? O(e[0].value) || e[0].value === "" ? At : { value: e[0].value, isValid: !0 } : At
606
- ) : Ct;
607
- }
608
- return Ct;
609
- }, nr = (e, { valueAsNumber: r, valueAsDate: t, setValueAs: n }) => O(e) ? e : r ? e === "" ? NaN : e && +e : t && ue(e) ? new Date(e) : n ? n(e) : e;
610
- const Tt = {
611
- isValid: !1,
612
- value: null
613
- };
614
- var sr = (e) => Array.isArray(e) ? e.reduce((r, t) => t && t.checked && !t.disabled ? {
615
- isValid: !0,
616
- value: t.value
617
- } : r, Tt) : Tt;
618
- function kt(e) {
619
- const r = e.ref;
620
- return lt(r) ? r.files : ut(r) ? sr(e.refs).value : Zt(r) ? [...r.selectedOptions].map(({ value: t }) => t) : je(r) ? rr(e.refs).value : nr(O(r.value) ? e.ref.value : r.value, e);
621
- }
622
- var Yr = (e, r, t, n) => {
623
- const s = {};
624
- for (const i of e) {
625
- const l = y(r, i);
626
- l && k(s, i, l._f);
627
- }
628
- return {
629
- criteriaMode: t,
630
- names: [...e],
631
- fields: s,
632
- shouldUseNativeValidation: n
633
- };
634
- }, We = (e) => e instanceof RegExp, Oe = (e) => O(e) ? e : We(e) ? e.source : D(e) ? We(e.value) ? e.value.source : e.value : e, Vt = (e) => ({
635
- isOnSubmit: !e || e === ie.onSubmit,
636
- isOnBlur: e === ie.onBlur,
637
- isOnChange: e === ie.onChange,
638
- isOnAll: e === ie.all,
639
- isOnTouch: e === ie.onTouched
640
- });
641
- const Rt = "AsyncFunction";
642
- var zr = (e) => !!e && !!e.validate && !!(ae(e.validate) && e.validate.constructor.name === Rt || D(e.validate) && Object.values(e.validate).find((r) => r.constructor.name === Rt)), Gr = (e) => e.mount && (e.required || e.min || e.max || e.maxLength || e.minLength || e.pattern || e.validate), Ft = (e, r, t) => !t && (r.watchAll || r.watch.has(e) || [...r.watch].some((n) => e.startsWith(n) && /^\.\w+/.test(e.slice(n.length))));
643
- const Ne = (e, r, t, n) => {
644
- for (const s of t || Object.keys(e)) {
645
- const i = y(e, s);
646
- if (i) {
647
- const { _f: l, ...c } = i;
648
- if (l) {
649
- if (l.refs && l.refs[0] && r(l.refs[0], s) && !n)
650
- return !0;
651
- if (l.ref && r(l.ref, l.name) && !n)
652
- return !0;
653
- if (Ne(c, r))
654
- break;
655
- } else if (D(c) && Ne(c, r))
656
- break;
657
- }
658
- }
659
- };
660
- function Ot(e, r, t) {
661
- const n = y(e, t);
662
- if (n || it(t))
663
- return {
664
- error: n,
665
- name: t
666
- };
667
- const s = t.split(".");
668
- for (; s.length; ) {
669
- const i = s.join("."), l = y(r, i), c = y(e, i);
670
- if (l && !Array.isArray(l) && t !== i)
671
- return { name: t };
672
- if (c && c.type)
673
- return {
674
- name: i,
675
- error: c
676
- };
677
- s.pop();
678
- }
679
- return {
680
- name: t
681
- };
682
- }
683
- var Jr = (e, r, t, n) => {
684
- t(e);
685
- const { name: s, ...i } = e;
686
- return Q(i) || Object.keys(i).length >= Object.keys(r).length || Object.keys(i).find((l) => r[l] === (!n || ie.all));
687
- }, Qr = (e, r, t) => !e || !r || e === r || Pe(e).some((n) => n && (t ? n === r : n.startsWith(r) || r.startsWith(n))), Xr = (e, r, t, n, s) => s.isOnAll ? !1 : !t && s.isOnTouch ? !(r || e) : (t ? n.isOnBlur : s.isOnBlur) ? !e : (t ? n.isOnChange : s.isOnChange) ? e : !0, Kr = (e, r) => !qe(y(e, r)).length && L(e, r), Zr = (e, r, t) => {
688
- const n = Pe(y(e, t));
689
- return k(n, "root", r[t]), k(e, t, n), e;
690
- }, He = (e) => ue(e);
691
- function Dt(e, r, t = "validate") {
692
- if (He(e) || Array.isArray(e) && e.every(He) || re(e) && !e)
693
- return {
694
- type: t,
695
- message: He(e) ? e : "",
696
- ref: r
697
- };
698
- }
699
- var Ee = (e) => D(e) && !We(e) ? e : {
700
- value: e,
701
- message: ""
702
- }, Pt = async (e, r, t, n, s, i) => {
703
- const { ref: l, refs: c, required: h, maxLength: v, minLength: _, min: x, max: p, pattern: K, validate: Y, name: R, valueAsNumber: W, mount: M } = e._f, w = y(t, R);
704
- if (!M || r.has(R))
705
- return {};
706
- const z = c ? c[0] : l, U = (C) => {
707
- s && z.reportValidity && (z.setCustomValidity(re(C) ? "" : C || ""), z.reportValidity());
708
- }, P = {}, ye = ut(l), me = je(l), xe = ye || me, ne = (W || lt(l)) && O(l.value) && O(w) || Be(l) && l.value === "" || w === "" || Array.isArray(w) && !w.length, fe = Br.bind(null, R, n, P), Z = (C, E, F, B = de.maxLength, G = de.minLength) => {
709
- const ee = C ? E : F;
710
- P[R] = {
711
- type: C ? B : G,
712
- message: ee,
713
- ref: l,
714
- ...fe(C ? B : G, ee)
715
- };
716
- };
717
- if (i ? !Array.isArray(w) || !w.length : h && (!xe && (ne || X(w)) || re(w) && !w || me && !rr(c).isValid || ye && !sr(c).isValid)) {
718
- const { value: C, message: E } = He(h) ? { value: !!h, message: h } : Ee(h);
719
- if (C && (P[R] = {
720
- type: de.required,
721
- message: E,
722
- ref: z,
723
- ...fe(de.required, E)
724
- }, !n))
725
- return U(E), P;
726
- }
727
- if (!ne && (!X(x) || !X(p))) {
728
- let C, E;
729
- const F = Ee(p), B = Ee(x);
730
- if (!X(w) && !isNaN(w)) {
731
- const G = l.valueAsNumber || w && +w;
732
- X(F.value) || (C = G > F.value), X(B.value) || (E = G < B.value);
733
- } else {
734
- const G = l.valueAsDate || new Date(w), ee = (f) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + f), se = l.type == "time", he = l.type == "week";
735
- ue(F.value) && w && (C = se ? ee(w) > ee(F.value) : he ? w > F.value : G > new Date(F.value)), ue(B.value) && w && (E = se ? ee(w) < ee(B.value) : he ? w < B.value : G < new Date(B.value));
736
- }
737
- if ((C || E) && (Z(!!C, F.message, B.message, de.max, de.min), !n))
738
- return U(P[R].message), P;
739
- }
740
- if ((v || _) && !ne && (ue(w) || i && Array.isArray(w))) {
741
- const C = Ee(v), E = Ee(_), F = !X(C.value) && w.length > +C.value, B = !X(E.value) && w.length < +E.value;
742
- if ((F || B) && (Z(F, C.message, E.message), !n))
743
- return U(P[R].message), P;
744
- }
745
- if (K && !ne && ue(w)) {
746
- const { value: C, message: E } = Ee(K);
747
- if (We(C) && !w.match(C) && (P[R] = {
748
- type: de.pattern,
749
- message: E,
750
- ref: l,
751
- ...fe(de.pattern, E)
752
- }, !n))
753
- return U(E), P;
754
- }
755
- if (Y) {
756
- if (ae(Y)) {
757
- const C = await Y(w, t), E = Dt(C, z);
758
- if (E && (P[R] = {
759
- ...E,
760
- ...fe(de.validate, E.message)
761
- }, !n))
762
- return U(E.message), P;
763
- } else if (D(Y)) {
764
- let C = {};
765
- for (const E in Y) {
766
- if (!Q(C) && !n)
767
- break;
768
- const F = Dt(await Y[E](w, t), z, E);
769
- F && (C = {
770
- ...F,
771
- ...fe(E, F.message)
772
- }, U(F.message), n && (P[R] = C));
773
- }
774
- if (!Q(C) && (P[R] = {
775
- ref: z,
776
- ...C
777
- }, !n))
778
- return P;
779
- }
780
- }
781
- return U(!0), P;
782
- };
783
- const en = {
784
- mode: ie.onSubmit,
785
- reValidateMode: ie.onChange,
786
- shouldFocusError: !0
787
- };
788
- function tn(e = {}) {
789
- let r = {
790
- ...en,
791
- ...e
792
- }, t = {
793
- submitCount: 0,
794
- isDirty: !1,
795
- isReady: !1,
796
- isLoading: ae(r.defaultValues),
797
- isValidating: !1,
798
- isSubmitted: !1,
799
- isSubmitting: !1,
800
- isSubmitSuccessful: !1,
801
- isValid: !1,
802
- touchedFields: {},
803
- dirtyFields: {},
804
- validatingFields: {},
805
- errors: r.errors || {},
806
- disabled: r.disabled || !1
807
- };
808
- const n = {};
809
- let s = D(r.defaultValues) || D(r.values) ? $(r.defaultValues || r.values) || {} : {}, i = r.shouldUnregister ? {} : $(s), l = {
810
- action: !1,
811
- mount: !1,
812
- watch: !1
813
- }, c = {
814
- mount: /* @__PURE__ */ new Set(),
815
- disabled: /* @__PURE__ */ new Set(),
816
- unMount: /* @__PURE__ */ new Set(),
817
- array: /* @__PURE__ */ new Set(),
818
- watch: /* @__PURE__ */ new Set()
819
- }, h, v = 0;
820
- const _ = {
821
- isDirty: !1,
822
- dirtyFields: !1,
823
- validatingFields: !1,
824
- touchedFields: !1,
825
- isValidating: !1,
826
- isValid: !1,
827
- errors: !1
828
- };
829
- let x = {
830
- ..._
831
- };
832
- const p = {
833
- array: Et(),
834
- state: Et()
835
- }, K = Vt(r.mode), Y = Vt(r.reValidateMode), R = r.criteriaMode === ie.all, W = (a) => (o) => {
836
- clearTimeout(v), v = setTimeout(a, o);
837
- }, M = async (a) => {
838
- if (!r.disabled && (_.isValid || x.isValid || a)) {
839
- const o = r.resolver ? Q((await ne()).errors) : await Z(n, !0);
840
- o !== t.isValid && p.state.next({
841
- isValid: o
842
- });
843
- }
844
- }, w = (a, o) => {
845
- !r.disabled && (_.isValidating || _.validatingFields || x.isValidating || x.validatingFields) && ((a || Array.from(c.mount)).forEach((u) => {
846
- u && (o ? k(t.validatingFields, u, o) : L(t.validatingFields, u));
847
- }), p.state.next({
848
- validatingFields: t.validatingFields,
849
- isValidating: !Q(t.validatingFields)
850
- }));
851
- }, z = (a, o = [], u, m, g = !0, d = !0) => {
852
- if (m && u && !r.disabled) {
853
- if (l.action = !0, d && Array.isArray(y(n, a))) {
854
- const b = u(y(n, a), m.argA, m.argB);
855
- g && k(n, a, b);
856
- }
857
- if (d && Array.isArray(y(t.errors, a))) {
858
- const b = u(y(t.errors, a), m.argA, m.argB);
859
- g && k(t.errors, a, b), Kr(t.errors, a);
860
- }
861
- if ((_.touchedFields || x.touchedFields) && d && Array.isArray(y(t.touchedFields, a))) {
862
- const b = u(y(t.touchedFields, a), m.argA, m.argB);
863
- g && k(t.touchedFields, a, b);
864
- }
865
- (_.dirtyFields || x.dirtyFields) && (t.dirtyFields = Fe(s, i)), p.state.next({
866
- name: a,
867
- isDirty: E(a, o),
868
- dirtyFields: t.dirtyFields,
869
- errors: t.errors,
870
- isValid: t.isValid
871
- });
872
- } else
873
- k(i, a, o);
874
- }, U = (a, o) => {
875
- k(t.errors, a, o), p.state.next({
876
- errors: t.errors
877
- });
878
- }, P = (a) => {
879
- t.errors = a, p.state.next({
880
- errors: t.errors,
881
- isValid: !1
882
- });
883
- }, ye = (a, o, u, m) => {
884
- const g = y(n, a);
885
- if (g) {
886
- const d = y(i, a, O(u) ? y(s, a) : u);
887
- O(d) || m && m.defaultChecked || o ? k(i, a, o ? d : kt(g._f)) : G(a, d), l.mount && M();
888
- }
889
- }, me = (a, o, u, m, g) => {
890
- let d = !1, b = !1;
891
- const A = {
892
- name: a
893
- };
894
- if (!r.disabled) {
895
- if (!u || m) {
896
- (_.isDirty || x.isDirty) && (b = t.isDirty, t.isDirty = A.isDirty = E(), d = b !== A.isDirty);
897
- const N = ge(y(s, a), o);
898
- b = !!y(t.dirtyFields, a), N ? L(t.dirtyFields, a) : k(t.dirtyFields, a, !0), A.dirtyFields = t.dirtyFields, d = d || (_.dirtyFields || x.dirtyFields) && b !== !N;
899
- }
900
- if (u) {
901
- const N = y(t.touchedFields, a);
902
- N || (k(t.touchedFields, a, u), A.touchedFields = t.touchedFields, d = d || (_.touchedFields || x.touchedFields) && N !== u);
903
- }
904
- d && g && p.state.next(A);
905
- }
906
- return d ? A : {};
907
- }, xe = (a, o, u, m) => {
908
- const g = y(t.errors, a), d = (_.isValid || x.isValid) && re(o) && t.isValid !== o;
909
- if (r.delayError && u ? (h = W(() => U(a, u)), h(r.delayError)) : (clearTimeout(v), h = null, u ? k(t.errors, a, u) : L(t.errors, a)), (u ? !ge(g, u) : g) || !Q(m) || d) {
910
- const b = {
911
- ...m,
912
- ...d && re(o) ? { isValid: o } : {},
913
- errors: t.errors,
914
- name: a
915
- };
916
- t = {
917
- ...t,
918
- ...b
919
- }, p.state.next(b);
920
- }
921
- }, ne = async (a) => {
922
- w(a, !0);
923
- const o = await r.resolver(i, r.context, Yr(a || c.mount, n, r.criteriaMode, r.shouldUseNativeValidation));
924
- return w(a), o;
925
- }, fe = async (a) => {
926
- const { errors: o } = await ne(a);
927
- if (a)
928
- for (const u of a) {
929
- const m = y(o, u);
930
- m ? k(t.errors, u, m) : L(t.errors, u);
931
- }
932
- else
933
- t.errors = o;
934
- return o;
935
- }, Z = async (a, o, u = {
936
- valid: !0
937
- }) => {
938
- for (const m in a) {
939
- const g = a[m];
940
- if (g) {
941
- const { _f: d, ...b } = g;
942
- if (d) {
943
- const A = c.array.has(d.name), N = g._f && zr(g._f);
944
- N && _.validatingFields && w([m], !0);
945
- const q = await Pt(g, c.disabled, i, R, r.shouldUseNativeValidation && !o, A);
946
- if (N && _.validatingFields && w([m]), q[d.name] && (u.valid = !1, o))
947
- break;
948
- !o && (y(q, d.name) ? A ? Zr(t.errors, q, d.name) : k(t.errors, d.name, q[d.name]) : L(t.errors, d.name));
949
- }
950
- !Q(b) && await Z(b, o, u);
951
- }
952
- }
953
- return u.valid;
954
- }, C = () => {
955
- for (const a of c.unMount) {
956
- const o = y(n, a);
957
- o && (o._f.refs ? o._f.refs.every((u) => !Je(u)) : !Je(o._f.ref)) && le(a);
958
- }
959
- c.unMount = /* @__PURE__ */ new Set();
960
- }, E = (a, o) => !r.disabled && (a && o && k(i, a, o), !ge(V(), s)), F = (a, o, u) => Kt(a, c, {
961
- ...l.mount ? i : O(o) ? s : ue(a) ? { [a]: o } : o
962
- }, u, o), B = (a) => qe(y(l.mount ? i : s, a, r.shouldUnregister ? y(s, a, []) : [])), G = (a, o, u = {}) => {
963
- const m = y(n, a);
964
- let g = o;
965
- if (m) {
966
- const d = m._f;
967
- d && (!d.disabled && k(i, a, nr(o, d)), g = Be(d.ref) && X(o) ? "" : o, Zt(d.ref) ? [...d.ref.options].forEach((b) => b.selected = g.includes(b.value)) : d.refs ? je(d.ref) ? d.refs.length > 1 ? d.refs.forEach((b) => (!b.defaultChecked || !b.disabled) && (b.checked = Array.isArray(g) ? !!g.find((A) => A === b.value) : g === b.value)) : d.refs[0] && (d.refs[0].checked = !!g) : d.refs.forEach((b) => b.checked = b.value === g) : lt(d.ref) ? d.ref.value = "" : (d.ref.value = g, d.ref.type || p.state.next({
968
- name: a,
969
- values: $(i)
970
- })));
971
- }
972
- (u.shouldDirty || u.shouldTouch) && me(a, g, u.shouldTouch, u.shouldDirty, !0), u.shouldValidate && S(a);
973
- }, ee = (a, o, u) => {
974
- for (const m in o) {
975
- const g = o[m], d = `${a}.${m}`, b = y(n, d);
976
- (c.array.has(a) || D(g) || b && !b._f) && !ve(g) ? ee(d, g, u) : G(d, g, u);
977
- }
978
- }, se = (a, o, u = {}) => {
979
- const m = y(n, a), g = c.array.has(a), d = $(o);
980
- k(i, a, d), g ? (p.array.next({
981
- name: a,
982
- values: $(i)
983
- }), (_.isDirty || _.dirtyFields || x.isDirty || x.dirtyFields) && u.shouldDirty && p.state.next({
984
- name: a,
985
- dirtyFields: Fe(s, i),
986
- isDirty: E(a, d)
987
- })) : m && !m._f && !X(d) ? ee(a, d, u) : G(a, d, u), Ft(a, c) && p.state.next({ ...t }), p.state.next({
988
- name: l.mount ? a : void 0,
989
- values: $(i)
990
- });
991
- }, he = async (a) => {
992
- l.mount = !0;
993
- const o = a.target;
994
- let u = o.name, m = !0;
995
- const g = y(n, u), d = (b) => {
996
- m = Number.isNaN(b) || ve(b) && isNaN(b.getTime()) || ge(b, y(i, u, b));
997
- };
998
- if (g) {
999
- let b, A;
1000
- const N = o.type ? kt(g._f) : Gt(a), q = a.type === Ue.BLUR || a.type === Ue.FOCUS_OUT, xr = !Gr(g._f) && !r.resolver && !y(t.errors, u) && !g._f.deps || Xr(q, y(t.touchedFields, u), t.isSubmitted, Y, K), ze = Ft(u, c, q);
1001
- k(i, u, N), q ? (g._f.onBlur && g._f.onBlur(a), h && h(0)) : g._f.onChange && g._f.onChange(a);
1002
- const Ge = me(u, N, q), wr = !Q(Ge) || ze;
1003
- if (!q && p.state.next({
1004
- name: u,
1005
- type: a.type,
1006
- values: $(i)
1007
- }), xr)
1008
- return (_.isValid || x.isValid) && (r.mode === "onBlur" ? q && M() : q || M()), wr && p.state.next({ name: u, ...ze ? {} : Ge });
1009
- if (!q && ze && p.state.next({ ...t }), r.resolver) {
1010
- const { errors: _t } = await ne([u]);
1011
- if (d(N), m) {
1012
- const Sr = Ot(t.errors, n, u), pt = Ot(_t, n, Sr.name || u);
1013
- b = pt.error, u = pt.name, A = Q(_t);
1014
- }
1015
- } else
1016
- w([u], !0), b = (await Pt(g, c.disabled, i, R, r.shouldUseNativeValidation))[u], w([u]), d(N), m && (b ? A = !1 : (_.isValid || x.isValid) && (A = await Z(n, !0)));
1017
- m && (g._f.deps && S(g._f.deps), xe(u, A, b, Ge));
1018
- }
1019
- }, f = (a, o) => {
1020
- if (y(t.errors, o) && a.focus)
1021
- return a.focus(), 1;
1022
- }, S = async (a, o = {}) => {
1023
- let u, m;
1024
- const g = Pe(a);
1025
- if (r.resolver) {
1026
- const d = await fe(O(a) ? a : g);
1027
- u = Q(d), m = a ? !g.some((b) => y(d, b)) : u;
1028
- } else a ? (m = (await Promise.all(g.map(async (d) => {
1029
- const b = y(n, d);
1030
- return await Z(b && b._f ? { [d]: b } : b);
1031
- }))).every(Boolean), !(!m && !t.isValid) && M()) : m = u = await Z(n);
1032
- return p.state.next({
1033
- ...!ue(a) || (_.isValid || x.isValid) && u !== t.isValid ? {} : { name: a },
1034
- ...r.resolver || !a ? { isValid: u } : {},
1035
- errors: t.errors
1036
- }), o.shouldFocus && !m && Ne(n, f, a ? g : c.mount), m;
1037
- }, V = (a) => {
1038
- const o = {
1039
- ...l.mount ? i : s
1040
- };
1041
- return O(a) ? o : ue(a) ? y(o, a) : a.map((u) => y(o, u));
1042
- }, j = (a, o) => ({
1043
- invalid: !!y((o || t).errors, a),
1044
- isDirty: !!y((o || t).dirtyFields, a),
1045
- error: y((o || t).errors, a),
1046
- isValidating: !!y(t.validatingFields, a),
1047
- isTouched: !!y((o || t).touchedFields, a)
1048
- }), oe = (a) => {
1049
- a && Pe(a).forEach((o) => L(t.errors, o)), p.state.next({
1050
- errors: a ? t.errors : {}
1051
- });
1052
- }, te = (a, o, u) => {
1053
- const m = (y(n, a, { _f: {} })._f || {}).ref, g = y(t.errors, a) || {}, { ref: d, message: b, type: A, ...N } = g;
1054
- k(t.errors, a, {
1055
- ...N,
1056
- ...o,
1057
- ref: m
1058
- }), p.state.next({
1059
- name: a,
1060
- errors: t.errors,
1061
- isValid: !1
1062
- }), u && u.shouldFocus && m && m.focus && m.focus();
1063
- }, Te = (a, o) => ae(a) ? p.state.subscribe({
1064
- next: (u) => a(F(void 0, o), u)
1065
- }) : F(a, o, !0), we = (a) => p.state.subscribe({
1066
- next: (o) => {
1067
- Qr(a.name, o.name, a.exact) && Jr(o, a.formState || _, pr, a.reRenderRoot) && a.callback({
1068
- values: { ...i },
1069
- ...t,
1070
- ...o
1071
- });
1072
- }
1073
- }).unsubscribe, I = (a) => (l.mount = !0, x = {
1074
- ...x,
1075
- ...a.formState
1076
- }, we({
1077
- ...a,
1078
- formState: x
1079
- })), le = (a, o = {}) => {
1080
- for (const u of a ? Pe(a) : c.mount)
1081
- c.mount.delete(u), c.array.delete(u), o.keepValue || (L(n, u), L(i, u)), !o.keepError && L(t.errors, u), !o.keepDirty && L(t.dirtyFields, u), !o.keepTouched && L(t.touchedFields, u), !o.keepIsValidating && L(t.validatingFields, u), !r.shouldUnregister && !o.keepDefaultValue && L(s, u);
1082
- p.state.next({
1083
- values: $(i)
1084
- }), p.state.next({
1085
- ...t,
1086
- ...o.keepDirty ? { isDirty: E() } : {}
1087
- }), !o.keepIsValid && M();
1088
- }, Se = ({ disabled: a, name: o }) => {
1089
- (re(a) && l.mount || a || c.disabled.has(o)) && (a ? c.disabled.add(o) : c.disabled.delete(o));
1090
- }, ke = (a, o = {}) => {
1091
- let u = y(n, a);
1092
- const m = re(o.disabled) || re(r.disabled);
1093
- return k(n, a, {
1094
- ...u || {},
1095
- _f: {
1096
- ...u && u._f ? u._f : { ref: { name: a } },
1097
- name: a,
1098
- mount: !0,
1099
- ...o
1100
- }
1101
- }), c.mount.add(a), u ? Se({
1102
- disabled: re(o.disabled) ? o.disabled : r.disabled,
1103
- name: a
1104
- }) : ye(a, !0, o.value), {
1105
- ...m ? { disabled: o.disabled || r.disabled } : {},
1106
- ...r.progressive ? {
1107
- required: !!o.required,
1108
- min: Oe(o.min),
1109
- max: Oe(o.max),
1110
- minLength: Oe(o.minLength),
1111
- maxLength: Oe(o.maxLength),
1112
- pattern: Oe(o.pattern)
1113
- } : {},
1114
- name: a,
1115
- onChange: he,
1116
- onBlur: he,
1117
- ref: (g) => {
1118
- if (g) {
1119
- ke(a, o), u = y(n, a);
1120
- const d = O(g.value) && g.querySelectorAll && g.querySelectorAll("input,select,textarea")[0] || g, b = $r(d), A = u._f.refs || [];
1121
- if (b ? A.find((N) => N === d) : d === u._f.ref)
1122
- return;
1123
- k(n, a, {
1124
- _f: {
1125
- ...u._f,
1126
- ...b ? {
1127
- refs: [
1128
- ...A.filter(Je),
1129
- d,
1130
- ...Array.isArray(y(s, a)) ? [{}] : []
1131
- ],
1132
- ref: { type: d.type, name: a }
1133
- } : { ref: d }
1134
- }
1135
- }), ye(a, !1, void 0, d);
1136
- } else
1137
- u = y(n, a, {}), u._f && (u._f.mount = !1), (r.shouldUnregister || o.shouldUnregister) && !(Jt(c.array, a) && l.action) && c.unMount.add(a);
1138
- }
1139
- };
1140
- }, gt = () => r.shouldFocusError && Ne(n, f, c.mount), br = (a) => {
1141
- re(a) && (p.state.next({ disabled: a }), Ne(n, (o, u) => {
1142
- const m = y(n, u);
1143
- m && (o.disabled = m._f.disabled || a, Array.isArray(m._f.refs) && m._f.refs.forEach((g) => {
1144
- g.disabled = m._f.disabled || a;
1145
- }));
1146
- }, 0, !1));
1147
- }, yt = (a, o) => async (u) => {
1148
- let m;
1149
- u && (u.preventDefault && u.preventDefault(), u.persist && u.persist());
1150
- let g = $(i);
1151
- if (p.state.next({
1152
- isSubmitting: !0
1153
- }), r.resolver) {
1154
- const { errors: d, values: b } = await ne();
1155
- t.errors = d, g = b;
1156
- } else
1157
- await Z(n);
1158
- if (c.disabled.size)
1159
- for (const d of c.disabled)
1160
- k(g, d, void 0);
1161
- if (L(t.errors, "root"), Q(t.errors)) {
1162
- p.state.next({
1163
- errors: {}
1164
- });
1165
- try {
1166
- await a(g, u);
1167
- } catch (d) {
1168
- m = d;
1169
- }
1170
- } else
1171
- o && await o({ ...t.errors }, u), gt(), setTimeout(gt);
1172
- if (p.state.next({
1173
- isSubmitted: !0,
1174
- isSubmitting: !1,
1175
- isSubmitSuccessful: Q(t.errors) && !m,
1176
- submitCount: t.submitCount + 1,
1177
- errors: t.errors
1178
- }), m)
1179
- throw m;
1180
- }, vr = (a, o = {}) => {
1181
- y(n, a) && (O(o.defaultValue) ? se(a, $(y(s, a))) : (se(a, o.defaultValue), k(s, a, $(o.defaultValue))), o.keepTouched || L(t.touchedFields, a), o.keepDirty || (L(t.dirtyFields, a), t.isDirty = o.defaultValue ? E(a, $(y(s, a))) : E()), o.keepError || (L(t.errors, a), _.isValid && M()), p.state.next({ ...t }));
1182
- }, mt = (a, o = {}) => {
1183
- const u = a ? $(a) : s, m = $(u), g = Q(a), d = g ? s : m;
1184
- if (o.keepDefaultValues || (s = u), !o.keepValues) {
1185
- if (o.keepDirtyValues) {
1186
- const b = /* @__PURE__ */ new Set([
1187
- ...c.mount,
1188
- ...Object.keys(Fe(s, i))
1189
- ]);
1190
- for (const A of Array.from(b))
1191
- y(t.dirtyFields, A) ? k(d, A, y(i, A)) : se(A, y(d, A));
1192
- } else {
1193
- if (st && O(a))
1194
- for (const b of c.mount) {
1195
- const A = y(n, b);
1196
- if (A && A._f) {
1197
- const N = Array.isArray(A._f.refs) ? A._f.refs[0] : A._f.ref;
1198
- if (Be(N)) {
1199
- const q = N.closest("form");
1200
- if (q) {
1201
- q.reset();
1202
- break;
1203
- }
1204
- }
1205
- }
1206
- }
1207
- for (const b of c.mount)
1208
- se(b, y(d, b));
1209
- }
1210
- i = $(d), p.array.next({
1211
- values: { ...d }
1212
- }), p.state.next({
1213
- values: { ...d }
1214
- });
1215
- }
1216
- c = {
1217
- mount: o.keepDirtyValues ? c.mount : /* @__PURE__ */ new Set(),
1218
- unMount: /* @__PURE__ */ new Set(),
1219
- array: /* @__PURE__ */ new Set(),
1220
- disabled: /* @__PURE__ */ new Set(),
1221
- watch: /* @__PURE__ */ new Set(),
1222
- watchAll: !1,
1223
- focus: ""
1224
- }, l.mount = !_.isValid || !!o.keepIsValid || !!o.keepDirtyValues, l.watch = !!r.shouldUnregister, p.state.next({
1225
- submitCount: o.keepSubmitCount ? t.submitCount : 0,
1226
- isDirty: g ? !1 : o.keepDirty ? t.isDirty : !!(o.keepDefaultValues && !ge(a, s)),
1227
- isSubmitted: o.keepIsSubmitted ? t.isSubmitted : !1,
1228
- dirtyFields: g ? {} : o.keepDirtyValues ? o.keepDefaultValues && i ? Fe(s, i) : t.dirtyFields : o.keepDefaultValues && a ? Fe(s, a) : o.keepDirty ? t.dirtyFields : {},
1229
- touchedFields: o.keepTouched ? t.touchedFields : {},
1230
- errors: o.keepErrors ? t.errors : {},
1231
- isSubmitSuccessful: o.keepIsSubmitSuccessful ? t.isSubmitSuccessful : !1,
1232
- isSubmitting: !1
1233
- });
1234
- }, bt = (a, o) => mt(ae(a) ? a(i) : a, o), _r = (a, o = {}) => {
1235
- const u = y(n, a), m = u && u._f;
1236
- if (m) {
1237
- const g = m.refs ? m.refs[0] : m.ref;
1238
- g.focus && (g.focus(), o.shouldSelect && ae(g.select) && g.select());
1239
- }
1240
- }, pr = (a) => {
1241
- t = {
1242
- ...t,
1243
- ...a
1244
- };
1245
- }, vt = {
1246
- control: {
1247
- register: ke,
1248
- unregister: le,
1249
- getFieldState: j,
1250
- handleSubmit: yt,
1251
- setError: te,
1252
- _subscribe: we,
1253
- _runSchema: ne,
1254
- _getWatch: F,
1255
- _getDirty: E,
1256
- _setValid: M,
1257
- _setFieldArray: z,
1258
- _setDisabledField: Se,
1259
- _setErrors: P,
1260
- _getFieldArray: B,
1261
- _reset: mt,
1262
- _resetDefaultValues: () => ae(r.defaultValues) && r.defaultValues().then((a) => {
1263
- bt(a, r.resetOptions), p.state.next({
1264
- isLoading: !1
1265
- });
1266
- }),
1267
- _removeUnmounted: C,
1268
- _disableForm: br,
1269
- _subjects: p,
1270
- _proxyFormState: _,
1271
- get _fields() {
1272
- return n;
1273
- },
1274
- get _formValues() {
1275
- return i;
1276
- },
1277
- get _state() {
1278
- return l;
1279
- },
1280
- set _state(a) {
1281
- l = a;
1282
- },
1283
- get _defaultValues() {
1284
- return s;
1285
- },
1286
- get _names() {
1287
- return c;
1288
- },
1289
- set _names(a) {
1290
- c = a;
1291
- },
1292
- get _formState() {
1293
- return t;
1294
- },
1295
- get _options() {
1296
- return r;
1297
- },
1298
- set _options(a) {
1299
- r = {
1300
- ...r,
1301
- ...a
1302
- };
1303
- }
1304
- },
1305
- subscribe: I,
1306
- trigger: S,
1307
- register: ke,
1308
- handleSubmit: yt,
1309
- watch: Te,
1310
- setValue: se,
1311
- getValues: V,
1312
- reset: bt,
1313
- resetField: vr,
1314
- clearErrors: oe,
1315
- unregister: le,
1316
- setError: te,
1317
- setFocus: _r,
1318
- getFieldState: j
1319
- };
1320
- return {
1321
- ...vt,
1322
- formControl: vt
1323
- };
1324
- }
1325
- function Gn(e = {}) {
1326
- const r = T.useRef(void 0), t = T.useRef(void 0), [n, s] = T.useState({
1327
- isDirty: !1,
1328
- isValidating: !1,
1329
- isLoading: ae(e.defaultValues),
1330
- isSubmitted: !1,
1331
- isSubmitting: !1,
1332
- isSubmitSuccessful: !1,
1333
- isValid: !1,
1334
- submitCount: 0,
1335
- dirtyFields: {},
1336
- touchedFields: {},
1337
- validatingFields: {},
1338
- errors: e.errors || {},
1339
- disabled: e.disabled || !1,
1340
- isReady: !1,
1341
- defaultValues: ae(e.defaultValues) ? void 0 : e.defaultValues
1342
- });
1343
- r.current || (r.current = {
1344
- ...e.formControl ? e.formControl : tn(e),
1345
- formState: n
1346
- }, e.formControl && e.defaultValues && !ae(e.defaultValues) && e.formControl.reset(e.defaultValues, e.resetOptions));
1347
- const i = r.current.control;
1348
- return i._options = e, ot(() => {
1349
- const l = i._subscribe({
1350
- formState: i._proxyFormState,
1351
- callback: () => s({ ...i._formState }),
1352
- reRenderRoot: !0
1353
- });
1354
- return s((c) => ({
1355
- ...c,
1356
- isReady: !0
1357
- })), i._formState.isReady = !0, l;
1358
- }, [i]), T.useEffect(() => i._disableForm(e.disabled), [i, e.disabled]), T.useEffect(() => {
1359
- e.mode && (i._options.mode = e.mode), e.reValidateMode && (i._options.reValidateMode = e.reValidateMode), e.errors && !Q(e.errors) && i._setErrors(e.errors);
1360
- }, [i, e.errors, e.mode, e.reValidateMode]), T.useEffect(() => {
1361
- e.shouldUnregister && i._subjects.state.next({
1362
- values: i._getWatch()
1363
- });
1364
- }, [i, e.shouldUnregister]), T.useEffect(() => {
1365
- if (i._proxyFormState.isDirty) {
1366
- const l = i._getDirty();
1367
- l !== n.isDirty && i._subjects.state.next({
1368
- isDirty: l
1369
- });
1370
- }
1371
- }, [i, n.isDirty]), T.useEffect(() => {
1372
- e.values && !ge(e.values, t.current) ? (i._reset(e.values, i._options.resetOptions), t.current = e.values, s((l) => ({ ...l }))) : i._resetDefaultValues();
1373
- }, [i, e.values]), T.useEffect(() => {
1374
- i._state.mount || (i._setValid(), i._state.mount = !0), i._state.watch && (i._state.watch = !1, i._subjects.state.next({ ...i._formState })), i._removeUnmounted();
1375
- }), r.current.formState = Xt(n, i), r.current;
1376
- }
1377
- var ir = /* @__PURE__ */ Er({});
1378
- function Ze() {
1379
- return Ze = Object.assign ? Object.assign.bind() : function(e) {
1380
- for (var r = 1; r < arguments.length; r++) {
1381
- var t = arguments[r];
1382
- for (var n in t) ({}).hasOwnProperty.call(t, n) && (e[n] = t[n]);
1383
- }
1384
- return e;
1385
- }, Ze.apply(null, arguments);
1386
- }
1387
- function rn(e) {
1388
- if (Array.isArray(e)) return e;
1389
- }
1390
- function nn(e, r) {
1391
- var t = e == null ? null : typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
1392
- if (t != null) {
1393
- var n, s, i, l, c = [], h = !0, v = !1;
1394
- try {
1395
- if (i = (t = t.call(e)).next, r !== 0) for (; !(h = (n = i.call(t)).done) && (c.push(n.value), c.length !== r); h = !0) ;
1396
- } catch (_) {
1397
- v = !0, s = _;
1398
- } finally {
1399
- try {
1400
- if (!h && t.return != null && (l = t.return(), Object(l) !== l)) return;
1401
- } finally {
1402
- if (v) throw s;
1403
- }
1404
- }
1405
- return c;
1406
- }
1407
- }
1408
- function Nt(e, r) {
1409
- (r == null || r > e.length) && (r = e.length);
1410
- for (var t = 0, n = Array(r); t < r; t++) n[t] = e[t];
1411
- return n;
1412
- }
1413
- function sn(e, r) {
1414
- if (e) {
1415
- if (typeof e == "string") return Nt(e, r);
1416
- var t = {}.toString.call(e).slice(8, -1);
1417
- return t === "Object" && e.constructor && (t = e.constructor.name), t === "Map" || t === "Set" ? Array.from(e) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? Nt(e, r) : void 0;
1418
- }
1419
- }
1420
- function an() {
1421
- throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1422
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
1423
- }
1424
- function ar(e, r) {
1425
- return rn(e) || nn(e, r) || sn(e, r) || an();
1426
- }
1427
- function pe(e) {
1428
- "@babel/helpers - typeof";
1429
- return pe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(r) {
1430
- return typeof r;
1431
- } : function(r) {
1432
- return r && typeof Symbol == "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
1433
- }, pe(e);
1434
- }
1435
- function on(e, r) {
1436
- if (pe(e) != "object" || !e) return e;
1437
- var t = e[Symbol.toPrimitive];
1438
- if (t !== void 0) {
1439
- var n = t.call(e, r);
1440
- if (pe(n) != "object") return n;
1441
- throw new TypeError("@@toPrimitive must return a primitive value.");
1442
- }
1443
- return (r === "string" ? String : Number)(e);
1444
- }
1445
- function ln(e) {
1446
- var r = on(e, "string");
1447
- return pe(r) == "symbol" ? r : r + "";
1448
- }
1449
- function J(e, r, t) {
1450
- return (r = ln(r)) in e ? Object.defineProperty(e, r, {
1451
- value: t,
1452
- enumerable: !0,
1453
- configurable: !0,
1454
- writable: !0
1455
- }) : e[r] = t, e;
1456
- }
1457
- function un(e, r) {
1458
- if (e == null) return {};
1459
- var t = {};
1460
- for (var n in e) if ({}.hasOwnProperty.call(e, n)) {
1461
- if (r.indexOf(n) !== -1) continue;
1462
- t[n] = e[n];
1463
- }
1464
- return t;
1465
- }
1466
- function or(e, r) {
1467
- if (e == null) return {};
1468
- var t, n, s = un(e, r);
1469
- if (Object.getOwnPropertySymbols) {
1470
- var i = Object.getOwnPropertySymbols(e);
1471
- for (n = 0; n < i.length; n++) t = i[n], r.indexOf(t) === -1 && {}.propertyIsEnumerable.call(e, t) && (s[t] = e[t]);
1472
- }
1473
- return s;
1474
- }
1475
- var Qe = { exports: {} };
1476
- /*!
1477
- Copyright (c) 2018 Jed Watson.
1478
- Licensed under the MIT License (MIT), see
1479
- http://jedwatson.github.io/classnames
1480
- */
1481
- var Mt;
1482
- function cn() {
1483
- return Mt || (Mt = 1, function(e) {
1484
- (function() {
1485
- var r = {}.hasOwnProperty;
1486
- function t() {
1487
- for (var i = "", l = 0; l < arguments.length; l++) {
1488
- var c = arguments[l];
1489
- c && (i = s(i, n(c)));
1490
- }
1491
- return i;
1492
- }
1493
- function n(i) {
1494
- if (typeof i == "string" || typeof i == "number")
1495
- return i;
1496
- if (typeof i != "object")
1497
- return "";
1498
- if (Array.isArray(i))
1499
- return t.apply(null, i);
1500
- if (i.toString !== Object.prototype.toString && !i.toString.toString().includes("[native code]"))
1501
- return i.toString();
1502
- var l = "";
1503
- for (var c in i)
1504
- r.call(i, c) && i[c] && (l = s(l, c));
1505
- return l;
1506
- }
1507
- function s(i, l) {
1508
- return l ? i ? i + " " + l : i + l : i;
1509
- }
1510
- e.exports ? (t.default = t, e.exports = t) : window.classNames = t;
1511
- })();
1512
- }(Qe)), Qe.exports;
1513
- }
1514
- var fn = cn();
1515
- const dn = /* @__PURE__ */ kr(fn), H = Math.round;
1516
- function Xe(e, r) {
1517
- const t = e.replace(/^[^(]*\((.*)/, "$1").replace(/\).*/, "").match(/\d*\.?\d+%?/g) || [], n = t.map((s) => parseFloat(s));
1518
- for (let s = 0; s < 3; s += 1)
1519
- n[s] = r(n[s] || 0, t[s] || "", s);
1520
- return t[3] ? n[3] = t[3].includes("%") ? n[3] / 100 : n[3] : n[3] = 1, n;
1521
- }
1522
- const jt = (e, r, t) => t === 0 ? e : e / 100;
1523
- function De(e, r) {
1524
- const t = r || 255;
1525
- return e > t ? t : e < 0 ? 0 : e;
1526
- }
1527
- class Ce {
1528
- constructor(r) {
1529
- J(this, "isValid", !0), J(this, "r", 0), J(this, "g", 0), J(this, "b", 0), J(this, "a", 1), J(this, "_h", void 0), J(this, "_s", void 0), J(this, "_l", void 0), J(this, "_v", void 0), J(this, "_max", void 0), J(this, "_min", void 0), J(this, "_brightness", void 0);
1530
- function t(n) {
1531
- return n[0] in r && n[1] in r && n[2] in r;
1532
- }
1533
- if (r) if (typeof r == "string") {
1534
- let s = function(i) {
1535
- return n.startsWith(i);
1536
- };
1537
- const n = r.trim();
1538
- /^#?[A-F\d]{3,8}$/i.test(n) ? this.fromHexString(n) : s("rgb") ? this.fromRgbString(n) : s("hsl") ? this.fromHslString(n) : (s("hsv") || s("hsb")) && this.fromHsvString(n);
1539
- } else if (r instanceof Ce)
1540
- this.r = r.r, this.g = r.g, this.b = r.b, this.a = r.a, this._h = r._h, this._s = r._s, this._l = r._l, this._v = r._v;
1541
- else if (t("rgb"))
1542
- this.r = De(r.r), this.g = De(r.g), this.b = De(r.b), this.a = typeof r.a == "number" ? De(r.a, 1) : 1;
1543
- else if (t("hsl"))
1544
- this.fromHsl(r);
1545
- else if (t("hsv"))
1546
- this.fromHsv(r);
1547
- else
1548
- throw new Error("@ant-design/fast-color: unsupported input " + JSON.stringify(r));
1549
- }
1550
- // ======================= Setter =======================
1551
- setR(r) {
1552
- return this._sc("r", r);
1553
- }
1554
- setG(r) {
1555
- return this._sc("g", r);
1556
- }
1557
- setB(r) {
1558
- return this._sc("b", r);
1559
- }
1560
- setA(r) {
1561
- return this._sc("a", r, 1);
1562
- }
1563
- setHue(r) {
1564
- const t = this.toHsv();
1565
- return t.h = r, this._c(t);
1566
- }
1567
- // ======================= Getter =======================
1568
- /**
1569
- * Returns the perceived luminance of a color, from 0-1.
1570
- * @see http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
1571
- */
1572
- getLuminance() {
1573
- function r(i) {
1574
- const l = i / 255;
1575
- return l <= 0.03928 ? l / 12.92 : Math.pow((l + 0.055) / 1.055, 2.4);
1576
- }
1577
- const t = r(this.r), n = r(this.g), s = r(this.b);
1578
- return 0.2126 * t + 0.7152 * n + 0.0722 * s;
1579
- }
1580
- getHue() {
1581
- if (typeof this._h > "u") {
1582
- const r = this.getMax() - this.getMin();
1583
- r === 0 ? this._h = 0 : this._h = H(60 * (this.r === this.getMax() ? (this.g - this.b) / r + (this.g < this.b ? 6 : 0) : this.g === this.getMax() ? (this.b - this.r) / r + 2 : (this.r - this.g) / r + 4));
1584
- }
1585
- return this._h;
1586
- }
1587
- getSaturation() {
1588
- if (typeof this._s > "u") {
1589
- const r = this.getMax() - this.getMin();
1590
- r === 0 ? this._s = 0 : this._s = r / this.getMax();
1591
- }
1592
- return this._s;
1593
- }
1594
- getLightness() {
1595
- return typeof this._l > "u" && (this._l = (this.getMax() + this.getMin()) / 510), this._l;
1596
- }
1597
- getValue() {
1598
- return typeof this._v > "u" && (this._v = this.getMax() / 255), this._v;
1599
- }
1600
- /**
1601
- * Returns the perceived brightness of the color, from 0-255.
1602
- * Note: this is not the b of HSB
1603
- * @see http://www.w3.org/TR/AERT#color-contrast
1604
- */
1605
- getBrightness() {
1606
- return typeof this._brightness > "u" && (this._brightness = (this.r * 299 + this.g * 587 + this.b * 114) / 1e3), this._brightness;
1607
- }
1608
- // ======================== Func ========================
1609
- darken(r = 10) {
1610
- const t = this.getHue(), n = this.getSaturation();
1611
- let s = this.getLightness() - r / 100;
1612
- return s < 0 && (s = 0), this._c({
1613
- h: t,
1614
- s: n,
1615
- l: s,
1616
- a: this.a
1617
- });
1618
- }
1619
- lighten(r = 10) {
1620
- const t = this.getHue(), n = this.getSaturation();
1621
- let s = this.getLightness() + r / 100;
1622
- return s > 1 && (s = 1), this._c({
1623
- h: t,
1624
- s: n,
1625
- l: s,
1626
- a: this.a
1627
- });
1628
- }
1629
- /**
1630
- * Mix the current color a given amount with another color, from 0 to 100.
1631
- * 0 means no mixing (return current color).
1632
- */
1633
- mix(r, t = 50) {
1634
- const n = this._c(r), s = t / 100, i = (c) => (n[c] - this[c]) * s + this[c], l = {
1635
- r: H(i("r")),
1636
- g: H(i("g")),
1637
- b: H(i("b")),
1638
- a: H(i("a") * 100) / 100
1639
- };
1640
- return this._c(l);
1641
- }
1642
- /**
1643
- * Mix the color with pure white, from 0 to 100.
1644
- * Providing 0 will do nothing, providing 100 will always return white.
1645
- */
1646
- tint(r = 10) {
1647
- return this.mix({
1648
- r: 255,
1649
- g: 255,
1650
- b: 255,
1651
- a: 1
1652
- }, r);
1653
- }
1654
- /**
1655
- * Mix the color with pure black, from 0 to 100.
1656
- * Providing 0 will do nothing, providing 100 will always return black.
1657
- */
1658
- shade(r = 10) {
1659
- return this.mix({
1660
- r: 0,
1661
- g: 0,
1662
- b: 0,
1663
- a: 1
1664
- }, r);
1665
- }
1666
- onBackground(r) {
1667
- const t = this._c(r), n = this.a + t.a * (1 - this.a), s = (i) => H((this[i] * this.a + t[i] * t.a * (1 - this.a)) / n);
1668
- return this._c({
1669
- r: s("r"),
1670
- g: s("g"),
1671
- b: s("b"),
1672
- a: n
1673
- });
1674
- }
1675
- // ======================= Status =======================
1676
- isDark() {
1677
- return this.getBrightness() < 128;
1678
- }
1679
- isLight() {
1680
- return this.getBrightness() >= 128;
1681
- }
1682
- // ======================== MISC ========================
1683
- equals(r) {
1684
- return this.r === r.r && this.g === r.g && this.b === r.b && this.a === r.a;
1685
- }
1686
- clone() {
1687
- return this._c(this);
1688
- }
1689
- // ======================= Format =======================
1690
- toHexString() {
1691
- let r = "#";
1692
- const t = (this.r || 0).toString(16);
1693
- r += t.length === 2 ? t : "0" + t;
1694
- const n = (this.g || 0).toString(16);
1695
- r += n.length === 2 ? n : "0" + n;
1696
- const s = (this.b || 0).toString(16);
1697
- if (r += s.length === 2 ? s : "0" + s, typeof this.a == "number" && this.a >= 0 && this.a < 1) {
1698
- const i = H(this.a * 255).toString(16);
1699
- r += i.length === 2 ? i : "0" + i;
1700
- }
1701
- return r;
1702
- }
1703
- /** CSS support color pattern */
1704
- toHsl() {
1705
- return {
1706
- h: this.getHue(),
1707
- s: this.getSaturation(),
1708
- l: this.getLightness(),
1709
- a: this.a
1710
- };
1711
- }
1712
- /** CSS support color pattern */
1713
- toHslString() {
1714
- const r = this.getHue(), t = H(this.getSaturation() * 100), n = H(this.getLightness() * 100);
1715
- return this.a !== 1 ? `hsla(${r},${t}%,${n}%,${this.a})` : `hsl(${r},${t}%,${n}%)`;
1716
- }
1717
- /** Same as toHsb */
1718
- toHsv() {
1719
- return {
1720
- h: this.getHue(),
1721
- s: this.getSaturation(),
1722
- v: this.getValue(),
1723
- a: this.a
1724
- };
1725
- }
1726
- toRgb() {
1727
- return {
1728
- r: this.r,
1729
- g: this.g,
1730
- b: this.b,
1731
- a: this.a
1732
- };
1733
- }
1734
- toRgbString() {
1735
- return this.a !== 1 ? `rgba(${this.r},${this.g},${this.b},${this.a})` : `rgb(${this.r},${this.g},${this.b})`;
1736
- }
1737
- toString() {
1738
- return this.toRgbString();
1739
- }
1740
- // ====================== Privates ======================
1741
- /** Return a new FastColor object with one channel changed */
1742
- _sc(r, t, n) {
1743
- const s = this.clone();
1744
- return s[r] = De(t, n), s;
1745
- }
1746
- _c(r) {
1747
- return new this.constructor(r);
1748
- }
1749
- getMax() {
1750
- return typeof this._max > "u" && (this._max = Math.max(this.r, this.g, this.b)), this._max;
1751
- }
1752
- getMin() {
1753
- return typeof this._min > "u" && (this._min = Math.min(this.r, this.g, this.b)), this._min;
1754
- }
1755
- fromHexString(r) {
1756
- const t = r.replace("#", "");
1757
- function n(s, i) {
1758
- return parseInt(t[s] + t[i || s], 16);
1759
- }
1760
- t.length < 6 ? (this.r = n(0), this.g = n(1), this.b = n(2), this.a = t[3] ? n(3) / 255 : 1) : (this.r = n(0, 1), this.g = n(2, 3), this.b = n(4, 5), this.a = t[6] ? n(6, 7) / 255 : 1);
1761
- }
1762
- fromHsl({
1763
- h: r,
1764
- s: t,
1765
- l: n,
1766
- a: s
1767
- }) {
1768
- if (this._h = r % 360, this._s = t, this._l = n, this.a = typeof s == "number" ? s : 1, t <= 0) {
1769
- const p = H(n * 255);
1770
- this.r = p, this.g = p, this.b = p;
1771
- }
1772
- let i = 0, l = 0, c = 0;
1773
- const h = r / 60, v = (1 - Math.abs(2 * n - 1)) * t, _ = v * (1 - Math.abs(h % 2 - 1));
1774
- h >= 0 && h < 1 ? (i = v, l = _) : h >= 1 && h < 2 ? (i = _, l = v) : h >= 2 && h < 3 ? (l = v, c = _) : h >= 3 && h < 4 ? (l = _, c = v) : h >= 4 && h < 5 ? (i = _, c = v) : h >= 5 && h < 6 && (i = v, c = _);
1775
- const x = n - v / 2;
1776
- this.r = H((i + x) * 255), this.g = H((l + x) * 255), this.b = H((c + x) * 255);
1777
- }
1778
- fromHsv({
1779
- h: r,
1780
- s: t,
1781
- v: n,
1782
- a: s
1783
- }) {
1784
- this._h = r % 360, this._s = t, this._v = n, this.a = typeof s == "number" ? s : 1;
1785
- const i = H(n * 255);
1786
- if (this.r = i, this.g = i, this.b = i, t <= 0)
1787
- return;
1788
- const l = r / 60, c = Math.floor(l), h = l - c, v = H(n * (1 - t) * 255), _ = H(n * (1 - t * h) * 255), x = H(n * (1 - t * (1 - h)) * 255);
1789
- switch (c) {
1790
- case 0:
1791
- this.g = x, this.b = v;
1792
- break;
1793
- case 1:
1794
- this.r = _, this.b = v;
1795
- break;
1796
- case 2:
1797
- this.r = v, this.b = x;
1798
- break;
1799
- case 3:
1800
- this.r = v, this.g = _;
1801
- break;
1802
- case 4:
1803
- this.r = x, this.g = v;
1804
- break;
1805
- case 5:
1806
- default:
1807
- this.g = v, this.b = _;
1808
- break;
1809
- }
1810
- }
1811
- fromHsvString(r) {
1812
- const t = Xe(r, jt);
1813
- this.fromHsv({
1814
- h: t[0],
1815
- s: t[1],
1816
- v: t[2],
1817
- a: t[3]
1818
- });
1819
- }
1820
- fromHslString(r) {
1821
- const t = Xe(r, jt);
1822
- this.fromHsl({
1823
- h: t[0],
1824
- s: t[1],
1825
- l: t[2],
1826
- a: t[3]
1827
- });
1828
- }
1829
- fromRgbString(r) {
1830
- const t = Xe(r, (n, s) => (
1831
- // Convert percentage to number. e.g. 50% -> 128
1832
- s.includes("%") ? H(n / 100 * 255) : n
1833
- ));
1834
- this.r = t[0], this.g = t[1], this.b = t[2], this.a = t[3];
1835
- }
1836
- }
1837
- var Ie = 2, Lt = 0.16, hn = 0.05, gn = 0.05, yn = 0.15, lr = 5, ur = 4, mn = [{
1838
- index: 7,
1839
- amount: 15
1840
- }, {
1841
- index: 6,
1842
- amount: 25
1843
- }, {
1844
- index: 5,
1845
- amount: 30
1846
- }, {
1847
- index: 5,
1848
- amount: 45
1849
- }, {
1850
- index: 5,
1851
- amount: 65
1852
- }, {
1853
- index: 5,
1854
- amount: 85
1855
- }, {
1856
- index: 4,
1857
- amount: 90
1858
- }, {
1859
- index: 3,
1860
- amount: 95
1861
- }, {
1862
- index: 2,
1863
- amount: 97
1864
- }, {
1865
- index: 1,
1866
- amount: 98
1867
- }];
1868
- function It(e, r, t) {
1869
- var n;
1870
- return Math.round(e.h) >= 60 && Math.round(e.h) <= 240 ? n = t ? Math.round(e.h) - Ie * r : Math.round(e.h) + Ie * r : n = t ? Math.round(e.h) + Ie * r : Math.round(e.h) - Ie * r, n < 0 ? n += 360 : n >= 360 && (n -= 360), n;
1871
- }
1872
- function Ht(e, r, t) {
1873
- if (e.h === 0 && e.s === 0)
1874
- return e.s;
1875
- var n;
1876
- return t ? n = e.s - Lt * r : r === ur ? n = e.s + Lt : n = e.s + hn * r, n > 1 && (n = 1), t && r === lr && n > 0.1 && (n = 0.1), n < 0.06 && (n = 0.06), Math.round(n * 100) / 100;
1877
- }
1878
- function Ut(e, r, t) {
1879
- var n;
1880
- return t ? n = e.v + gn * r : n = e.v - yn * r, n = Math.max(0, Math.min(1, n)), Math.round(n * 100) / 100;
1881
- }
1882
- function bn(e) {
1883
- for (var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = [], n = new Ce(e), s = n.toHsv(), i = lr; i > 0; i -= 1) {
1884
- var l = new Ce({
1885
- h: It(s, i, !0),
1886
- s: Ht(s, i, !0),
1887
- v: Ut(s, i, !0)
1888
- });
1889
- t.push(l);
1890
- }
1891
- t.push(n);
1892
- for (var c = 1; c <= ur; c += 1) {
1893
- var h = new Ce({
1894
- h: It(s, c),
1895
- s: Ht(s, c),
1896
- v: Ut(s, c)
1897
- });
1898
- t.push(h);
1899
- }
1900
- return r.theme === "dark" ? mn.map(function(v) {
1901
- var _ = v.index, x = v.amount;
1902
- return new Ce(r.backgroundColor || "#141414").mix(t[_], x).toHexString();
1903
- }) : t.map(function(v) {
1904
- return v.toHexString();
1905
- });
1906
- }
1907
- var et = ["#e6f4ff", "#bae0ff", "#91caff", "#69b1ff", "#4096ff", "#1677ff", "#0958d9", "#003eb3", "#002c8c", "#001d66"];
1908
- et.primary = et[5];
1909
- function Bt(e, r) {
1910
- var t = Object.keys(e);
1911
- if (Object.getOwnPropertySymbols) {
1912
- var n = Object.getOwnPropertySymbols(e);
1913
- r && (n = n.filter(function(s) {
1914
- return Object.getOwnPropertyDescriptor(e, s).enumerable;
1915
- })), t.push.apply(t, n);
1916
- }
1917
- return t;
1918
- }
1919
- function ce(e) {
1920
- for (var r = 1; r < arguments.length; r++) {
1921
- var t = arguments[r] != null ? arguments[r] : {};
1922
- r % 2 ? Bt(Object(t), !0).forEach(function(n) {
1923
- J(e, n, t[n]);
1924
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Bt(Object(t)).forEach(function(n) {
1925
- Object.defineProperty(e, n, Object.getOwnPropertyDescriptor(t, n));
1926
- });
1927
- }
1928
- return e;
1929
- }
1930
- function vn() {
1931
- return !!(typeof window < "u" && window.document && window.document.createElement);
1932
- }
1933
- function _n(e, r) {
1934
- if (!e)
1935
- return !1;
1936
- if (e.contains)
1937
- return e.contains(r);
1938
- for (var t = r; t; ) {
1939
- if (t === e)
1940
- return !0;
1941
- t = t.parentNode;
1942
- }
1943
- return !1;
1944
- }
1945
- var $t = "data-rc-order", Wt = "data-rc-priority", pn = "rc-util-key", tt = /* @__PURE__ */ new Map();
1946
- function cr() {
1947
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = e.mark;
1948
- return r ? r.startsWith("data-") ? r : "data-".concat(r) : pn;
1949
- }
1950
- function ct(e) {
1951
- if (e.attachTo)
1952
- return e.attachTo;
1953
- var r = document.querySelector("head");
1954
- return r || document.body;
1955
- }
1956
- function xn(e) {
1957
- return e === "queue" ? "prependQueue" : e ? "prepend" : "append";
1958
- }
1959
- function ft(e) {
1960
- return Array.from((tt.get(e) || e).children).filter(function(r) {
1961
- return r.tagName === "STYLE";
1962
- });
1963
- }
1964
- function fr(e) {
1965
- var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1966
- if (!vn())
1967
- return null;
1968
- var t = r.csp, n = r.prepend, s = r.priority, i = s === void 0 ? 0 : s, l = xn(n), c = l === "prependQueue", h = document.createElement("style");
1969
- h.setAttribute($t, l), c && i && h.setAttribute(Wt, "".concat(i)), t != null && t.nonce && (h.nonce = t == null ? void 0 : t.nonce), h.innerHTML = e;
1970
- var v = ct(r), _ = v.firstChild;
1971
- if (n) {
1972
- if (c) {
1973
- var x = (r.styles || ft(v)).filter(function(p) {
1974
- if (!["prepend", "prependQueue"].includes(p.getAttribute($t)))
1975
- return !1;
1976
- var K = Number(p.getAttribute(Wt) || 0);
1977
- return i >= K;
1978
- });
1979
- if (x.length)
1980
- return v.insertBefore(h, x[x.length - 1].nextSibling), h;
1981
- }
1982
- v.insertBefore(h, _);
1983
- } else
1984
- v.appendChild(h);
1985
- return h;
1986
- }
1987
- function wn(e) {
1988
- var r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, t = ct(r);
1989
- return (r.styles || ft(t)).find(function(n) {
1990
- return n.getAttribute(cr(r)) === e;
1991
- });
1992
- }
1993
- function Sn(e, r) {
1994
- var t = tt.get(e);
1995
- if (!t || !_n(document, t)) {
1996
- var n = fr("", r), s = n.parentNode;
1997
- tt.set(e, s), e.removeChild(n);
1998
- }
1999
- }
2000
- function En(e, r) {
2001
- var t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, n = ct(t), s = ft(n), i = ce(ce({}, t), {}, {
2002
- styles: s
2003
- });
2004
- Sn(n, i);
2005
- var l = wn(r, i);
2006
- if (l) {
2007
- var c, h;
2008
- if ((c = i.csp) !== null && c !== void 0 && c.nonce && l.nonce !== ((h = i.csp) === null || h === void 0 ? void 0 : h.nonce)) {
2009
- var v;
2010
- l.nonce = (v = i.csp) === null || v === void 0 ? void 0 : v.nonce;
2011
- }
2012
- return l.innerHTML !== e && (l.innerHTML = e), l;
2013
- }
2014
- var _ = fr(e, i);
2015
- return _.setAttribute(cr(i), r), _;
2016
- }
2017
- function dr(e) {
2018
- var r;
2019
- return e == null || (r = e.getRootNode) === null || r === void 0 ? void 0 : r.call(e);
2020
- }
2021
- function Cn(e) {
2022
- return dr(e) instanceof ShadowRoot;
2023
- }
2024
- function An(e) {
2025
- return Cn(e) ? dr(e) : null;
2026
- }
2027
- var rt = {}, dt = [], Tn = function(r) {
2028
- dt.push(r);
2029
- };
2030
- function kn(e, r) {
2031
- if (process.env.NODE_ENV !== "production" && !e && console !== void 0) {
2032
- var t = dt.reduce(function(n, s) {
2033
- return s(n ?? "", "warning");
2034
- }, r);
2035
- t && console.error("Warning: ".concat(t));
2036
- }
2037
- }
2038
- function Vn(e, r) {
2039
- if (process.env.NODE_ENV !== "production" && !e && console !== void 0) {
2040
- var t = dt.reduce(function(n, s) {
2041
- return s(n ?? "", "note");
2042
- }, r);
2043
- t && console.warn("Note: ".concat(t));
2044
- }
2045
- }
2046
- function Rn() {
2047
- rt = {};
2048
- }
2049
- function hr(e, r, t) {
2050
- !r && !rt[t] && (e(!1, t), rt[t] = !0);
2051
- }
2052
- function Ye(e, r) {
2053
- hr(kn, e, r);
2054
- }
2055
- function Fn(e, r) {
2056
- hr(Vn, e, r);
2057
- }
2058
- Ye.preMessage = Tn;
2059
- Ye.resetWarned = Rn;
2060
- Ye.noteOnce = Fn;
2061
- function On(e) {
2062
- return e.replace(/-(.)/g, function(r, t) {
2063
- return t.toUpperCase();
2064
- });
2065
- }
2066
- function Dn(e, r) {
2067
- Ye(e, "[@ant-design/icons] ".concat(r));
2068
- }
2069
- function qt(e) {
2070
- return pe(e) === "object" && typeof e.name == "string" && typeof e.theme == "string" && (pe(e.icon) === "object" || typeof e.icon == "function");
2071
- }
2072
- function Yt() {
2073
- var e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2074
- return Object.keys(e).reduce(function(r, t) {
2075
- var n = e[t];
2076
- switch (t) {
2077
- case "class":
2078
- r.className = n, delete r.class;
2079
- break;
2080
- default:
2081
- delete r[t], r[On(t)] = n;
2082
- }
2083
- return r;
2084
- }, {});
2085
- }
2086
- function nt(e, r, t) {
2087
- return t ? /* @__PURE__ */ T.createElement(e.tag, ce(ce({
2088
- key: r
2089
- }, Yt(e.attrs)), t), (e.children || []).map(function(n, s) {
2090
- return nt(n, "".concat(r, "-").concat(e.tag, "-").concat(s));
2091
- })) : /* @__PURE__ */ T.createElement(e.tag, ce({
2092
- key: r
2093
- }, Yt(e.attrs)), (e.children || []).map(function(n, s) {
2094
- return nt(n, "".concat(r, "-").concat(e.tag, "-").concat(s));
2095
- }));
2096
- }
2097
- function gr(e) {
2098
- return bn(e)[0];
2099
- }
2100
- function yr(e) {
2101
- return e ? Array.isArray(e) ? e : [e] : [];
2102
- }
2103
- var Pn = `
2104
- .anticon {
2105
- display: inline-flex;
2106
- align-items: center;
2107
- color: inherit;
2108
- font-style: normal;
2109
- line-height: 0;
2110
- text-align: center;
2111
- text-transform: none;
2112
- vertical-align: -0.125em;
2113
- text-rendering: optimizeLegibility;
2114
- -webkit-font-smoothing: antialiased;
2115
- -moz-osx-font-smoothing: grayscale;
2116
- }
2117
-
2118
- .anticon > * {
2119
- line-height: 1;
2120
- }
2121
-
2122
- .anticon svg {
2123
- display: inline-block;
2124
- }
2125
-
2126
- .anticon::before {
2127
- display: none;
2128
- }
2129
-
2130
- .anticon .anticon-icon {
2131
- display: block;
2132
- }
2133
-
2134
- .anticon[tabindex] {
2135
- cursor: pointer;
2136
- }
2137
-
2138
- .anticon-spin::before,
2139
- .anticon-spin {
2140
- display: inline-block;
2141
- -webkit-animation: loadingCircle 1s infinite linear;
2142
- animation: loadingCircle 1s infinite linear;
2143
- }
2144
-
2145
- @-webkit-keyframes loadingCircle {
2146
- 100% {
2147
- -webkit-transform: rotate(360deg);
2148
- transform: rotate(360deg);
2149
- }
2150
- }
2151
-
2152
- @keyframes loadingCircle {
2153
- 100% {
2154
- -webkit-transform: rotate(360deg);
2155
- transform: rotate(360deg);
2156
- }
2157
- }
2158
- `, Nn = function(r) {
2159
- var t = Cr(ir), n = t.csp, s = t.prefixCls, i = t.layer, l = Pn;
2160
- s && (l = l.replace(/anticon/g, s)), i && (l = "@layer ".concat(i, ` {
2161
- `).concat(l, `
2162
- }`)), Ar(function() {
2163
- var c = r.current, h = An(c);
2164
- En(l, "@ant-design-icons", {
2165
- prepend: !i,
2166
- csp: n,
2167
- attachTo: h
2168
- });
2169
- }, []);
2170
- }, Mn = ["icon", "className", "onClick", "style", "primaryColor", "secondaryColor"], Me = {
2171
- primaryColor: "#333",
2172
- secondaryColor: "#E6E6E6",
2173
- calculated: !1
2174
- };
2175
- function jn(e) {
2176
- var r = e.primaryColor, t = e.secondaryColor;
2177
- Me.primaryColor = r, Me.secondaryColor = t || gr(r), Me.calculated = !!t;
2178
- }
2179
- function Ln() {
2180
- return ce({}, Me);
2181
- }
2182
- var Ae = function(r) {
2183
- var t = r.icon, n = r.className, s = r.onClick, i = r.style, l = r.primaryColor, c = r.secondaryColor, h = or(r, Mn), v = be.useRef(), _ = Me;
2184
- if (l && (_ = {
2185
- primaryColor: l,
2186
- secondaryColor: c || gr(l)
2187
- }), Nn(v), Dn(qt(t), "icon should be icon definiton, but got ".concat(t)), !qt(t))
2188
- return null;
2189
- var x = t;
2190
- return x && typeof x.icon == "function" && (x = ce(ce({}, x), {}, {
2191
- icon: x.icon(_.primaryColor, _.secondaryColor)
2192
- })), nt(x.icon, "svg-".concat(x.name), ce(ce({
2193
- className: n,
2194
- onClick: s,
2195
- style: i,
2196
- "data-icon": x.name,
2197
- width: "1em",
2198
- height: "1em",
2199
- fill: "currentColor",
2200
- "aria-hidden": "true"
2201
- }, h), {}, {
2202
- ref: v
2203
- }));
2204
- };
2205
- Ae.displayName = "IconReact";
2206
- Ae.getTwoToneColors = Ln;
2207
- Ae.setTwoToneColors = jn;
2208
- function mr(e) {
2209
- var r = yr(e), t = ar(r, 2), n = t[0], s = t[1];
2210
- return Ae.setTwoToneColors({
2211
- primaryColor: n,
2212
- secondaryColor: s
2213
- });
2214
- }
2215
- function In() {
2216
- var e = Ae.getTwoToneColors();
2217
- return e.calculated ? [e.primaryColor, e.secondaryColor] : e.primaryColor;
2218
- }
2219
- var Hn = ["className", "icon", "spin", "rotate", "tabIndex", "onClick", "twoToneColor"];
2220
- mr(et.primary);
2221
- var ht = /* @__PURE__ */ be.forwardRef(function(e, r) {
2222
- var t = e.className, n = e.icon, s = e.spin, i = e.rotate, l = e.tabIndex, c = e.onClick, h = e.twoToneColor, v = or(e, Hn), _ = be.useContext(ir), x = _.prefixCls, p = x === void 0 ? "anticon" : x, K = _.rootClassName, Y = dn(K, p, J(J({}, "".concat(p, "-").concat(n.name), !!n.name), "".concat(p, "-spin"), !!s || n.name === "loading"), t), R = l;
2223
- R === void 0 && c && (R = -1);
2224
- var W = i ? {
2225
- msTransform: "rotate(".concat(i, "deg)"),
2226
- transform: "rotate(".concat(i, "deg)")
2227
- } : void 0, M = yr(h), w = ar(M, 2), z = w[0], U = w[1];
2228
- return /* @__PURE__ */ be.createElement("span", Ze({
2229
- role: "img",
2230
- "aria-label": n.name
2231
- }, v, {
2232
- ref: r,
2233
- tabIndex: R,
2234
- onClick: c,
2235
- className: Y
2236
- }), /* @__PURE__ */ be.createElement(Ae, {
2237
- icon: n,
2238
- primaryColor: z,
2239
- secondaryColor: U,
2240
- style: W
2241
- }));
2242
- });
2243
- ht.displayName = "AntdIcon";
2244
- ht.getTwoToneColor = In;
2245
- ht.setTwoToneColor = mr;
2246
- export {
2247
- zn as C,
2248
- qn as E,
2249
- ht as I,
2250
- Yn as L,
2251
- Nr as T,
2252
- Ze as _,
2253
- ir as a,
2254
- Wn as b,
2255
- dn as c,
2256
- pe as d,
2257
- sn as e,
2258
- J as f,
2259
- kr as g,
2260
- _e as j,
2261
- ln as t,
2262
- Gn as u
2263
- };