@pnkx-lib/ui 1.2.1 → 1.2.3

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