opsfuse-ui 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/skills/opsfuse-components/SKILL.md +31 -22
- package/.claude/skills/opsfuse-ui-consistency/SKILL.md +15 -15
- package/LICENSE +17 -0
- package/README.md +76 -12
- package/dist/components/logo/LogoMaker.d.ts.map +1 -1
- package/dist/components/opsfuse-theme-provider.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts +2 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/combobox.d.ts.map +1 -1
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/empty.d.ts.map +1 -1
- package/dist/components/ui/sidebar.d.ts.map +1 -1
- package/dist/core.js +4 -3
- package/dist/date-fns-locale.js +1 -39647
- package/dist/date-fns.js +1 -3
- package/dist/extended.js +3 -2
- package/dist/hooks/use-mobile.d.ts +14 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -1
- package/dist/icons.js +1 -2
- package/dist/index.js +61 -2829
- package/dist/input-group-COKxQf1K.js +560 -0
- package/dist/input-otp-CBFh_Ez5.js +1181 -0
- package/dist/lib/document-dark-mode.d.ts.map +1 -1
- package/dist/lib/link.d.ts.map +1 -1
- package/dist/lib/portaled-layer.d.ts.map +1 -1
- package/dist/recharts.js +1 -2
- package/dist/style.css +50 -6
- package/dist/toggle-group-UI-J1H4k.js +3174 -0
- package/package.json +41 -14
- package/theme.css +47 -3
- package/dist/chunk-Dqa2HsxW.js +0 -20
- package/dist/clsx-BWCAbrjV.js +0 -16
- package/dist/date-fns-DTKqTajJ.js +0 -3871
- package/dist/es6-CLjPx7Zx.js +0 -23996
- package/dist/input-group-BAkukY-L.js +0 -5463
- package/dist/input-otp-DyyXKjPp.js +0 -10792
- package/dist/isSameWeek-B6PEe-M_.js +0 -537
- package/dist/lucide-react-Dil0H3iN.js +0 -38770
- package/dist/toggle-group-Bpg09Bg7.js +0 -11072
package/dist/index.js
CHANGED
|
@@ -1,57 +1,58 @@
|
|
|
1
|
-
|
|
2
|
-
import { t as fe } from "./
|
|
3
|
-
import {
|
|
4
|
-
import { t as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { A as e, B as t, C as n, F as r, I as i, L as a, M as o, N as s, R as c, S as l, _ as u, a as d, b as ee, c as te, d as ne, f as re, g as ie, h as ae, i as oe, j as se, k as ce, l as f, m as le, n as ue, o as de, p as fe, r as pe, s as me, t as he, u as ge, v as _e, x as p, y as m, z as h } from "./input-group-COKxQf1K.js";
|
|
3
|
+
import { $ as g, $n as _, $r as v, $t as y, A as b, An as x, Ar as S, At as C, B as w, Bn as T, Br as E, Bt as D, C as O, Cn as k, Cr as A, Ct as j, D as M, Dn as N, Dr as P, Dt as F, E as I, En as ve, Er as ye, Et as be, F as xe, Fn as Se, Fr as Ce, Ft as we, G as Te, Gn as Ee, Gr as De, Gt as Oe, H as ke, Hn as Ae, Hr as je, Ht as Me, I as Ne, In as Pe, Ir as Fe, It as Ie, J as Le, Jn as Re, Jr as ze, Jt as Be, K as Ve, Kn as He, Kr as Ue, Kt as We, L as Ge, Ln as Ke, Lr as qe, Lt as Je, M as Ye, Mn as Xe, Mr as Ze, Mt as Qe, N as $e, Nn as et, Nr as tt, Nt as nt, O as rt, On as it, Or as at, Ot as ot, P as st, Pn as ct, Pr as lt, Pt as ut, Q as dt, Qn as ft, Qr as pt, Qt as mt, R as ht, Rn as gt, Rr as _t, Rt as vt, S as yt, Sn as bt, Sr as xt, St, T as Ct, Tn as wt, Tr as Tt, Tt as Et, U as Dt, Un as Ot, Ur as kt, Ut as At, V as jt, Vn as Mt, Vr as Nt, Vt as Pt, W as Ft, Wn as It, Wr as Lt, Wt as Rt, X as zt, Xn as Bt, Xr as Vt, Xt as Ht, Y as Ut, Yn as Wt, Yr as Gt, Yt as Kt, Z as qt, Zn as Jt, Zr as Yt, Zt as Xt, _ as Zt, _n as Qt, _r as $t, _t as en, a as tn, ai as nn, an as rn, ar as an, at as on, b as sn, bn as cn, br as ln, bt as un, c as dn, ci as fn, cn as pn, cr as mn, ct as hn, d as gn, di as _n, dn as vn, dr as yn, dt as bn, ei as xn, en as Sn, er as Cn, et as wn, f as Tn, fn as En, fr as Dn, ft as On, g as kn, gn as An, gr as jn, gt as Mn, h as Nn, hn as Pn, hr as Fn, ht as In, i as Ln, ii as Rn, in as zn, ir as Bn, it as Vn, j as Hn, jn as Un, jr as L, jt as Wn, k as Gn, kn as Kn, kr as qn, kt as Jn, l as Yn, li as Xn, ln as Zn, lr as Qn, lt as $n, m as er, mn as tr, mr as nr, mt as rr, n as ir, ni as ar, nn as or, nr as sr, nt as cr, o as lr, oi as ur, on as dr, or as fr, ot as pr, p as mr, pn as hr, pr as gr, pt as _r, q as vr, qn as yr, qr as br, qt as xr, r as Sr, ri as Cr, rn as wr, rr as Tr, rt as Er, s as Dr, si as Or, sn as kr, sr as Ar, st as jr, t as Mr, ti as Nr, tn as Pr, tr as Fr, tt as Ir, u as Lr, ui as Rr, un as zr, ur as Br, ut as Vr, v as Hr, vn as Ur, vr as Wr, vt as Gr, w as Kr, wn as qr, wr as Jr, wt as Yr, x as Xr, xn as Zr, xr as Qr, xt as $r, y as ei, yn as ti, yr as ni, yt as ri, z as ii, zn as ai, zr as oi, zt as si } from "./toggle-group-UI-J1H4k.js";
|
|
4
|
+
import { $ as ci, A as li, B as R, C as ui, D as di, E as fi, F as pi, G as z, H as B, I as mi, J as V, K as hi, L as gi, M as _i, N as vi, O as yi, P as bi, Q as xi, R as Si, S as Ci, T as wi, U as Ti, V as H, W as U, X as Ei, Y as W, Z as G, _ as Di, a as Oi, b as ki, c as Ai, d as ji, et as K, f as Mi, g as Ni, h as Pi, i as Fi, j as Ii, k as Li, l as Ri, m as zi, n as Bi, nt as q, o as Vi, p as Hi, q as Ui, r as Wi, s as Gi, t as Ki, tt as J, u as qi, v as Ji, w as Yi, x as Xi, y as Zi, z as Y } from "./input-otp-CBFh_Ez5.js";
|
|
5
|
+
import * as Qi from "date-fns";
|
|
6
|
+
import * as $i from "lucide-react";
|
|
7
|
+
import { ChevronDownIcon as ea } from "lucide-react";
|
|
8
|
+
import * as ta from "recharts";
|
|
9
|
+
import * as na from "react";
|
|
10
|
+
import { jsx as X, jsxs as Z } from "react/jsx-runtime";
|
|
11
|
+
import { createFormHook as ra, createFormHookContexts as ia, useStore as Q } from "@tanstack/react-form";
|
|
11
12
|
//#region src/components/ui/autocomplete.tsx
|
|
12
|
-
function
|
|
13
|
-
let d =
|
|
14
|
-
return /* @__PURE__ */
|
|
13
|
+
function aa({ items: e, placeholder: n = "Select...", placeholderIcon: r, emptyMessage: i = "No items found.", disabled: o = !1, triggerWidth: s = "w-64", label: c, multiple: l, ...u }) {
|
|
14
|
+
let d = q();
|
|
15
|
+
return /* @__PURE__ */ Z("div", {
|
|
15
16
|
className: "flex flex-col gap-2",
|
|
16
|
-
children: [c && /* @__PURE__ */
|
|
17
|
+
children: [c && /* @__PURE__ */ X(f, { children: c }), /* @__PURE__ */ Z(Y, {
|
|
17
18
|
items: e,
|
|
18
19
|
multiple: l,
|
|
19
20
|
disabled: o,
|
|
20
21
|
...u,
|
|
21
|
-
children: [l ? /* @__PURE__ */
|
|
22
|
+
children: [l ? /* @__PURE__ */ Z(H, {
|
|
22
23
|
ref: d,
|
|
23
24
|
className: s,
|
|
24
|
-
children: [
|
|
25
|
+
children: [r ? /* @__PURE__ */ X("span", {
|
|
25
26
|
"data-icon": "inline-start",
|
|
26
27
|
className: "contents text-muted-foreground [&>svg:not([class*='size-'])]:size-4",
|
|
27
|
-
children:
|
|
28
|
-
}) : null, /* @__PURE__ */
|
|
29
|
-
let
|
|
30
|
-
return /* @__PURE__ */
|
|
31
|
-
placeholder:
|
|
28
|
+
children: r
|
|
29
|
+
}) : null, /* @__PURE__ */ X(J, { children: (e) => {
|
|
30
|
+
let t = e ?? [];
|
|
31
|
+
return /* @__PURE__ */ Z(na.Fragment, { children: [t.map((e) => /* @__PURE__ */ X(R, { children: e.label }, e.value)), /* @__PURE__ */ X(B, {
|
|
32
|
+
placeholder: n,
|
|
32
33
|
disabled: o
|
|
33
34
|
})] });
|
|
34
35
|
} })]
|
|
35
|
-
}) : /* @__PURE__ */
|
|
36
|
+
}) : /* @__PURE__ */ X(K, { render: /* @__PURE__ */ Z(a, {
|
|
36
37
|
variant: "outline",
|
|
37
|
-
className:
|
|
38
|
-
children: [/* @__PURE__ */
|
|
38
|
+
className: t(s, "justify-between font-normal"),
|
|
39
|
+
children: [/* @__PURE__ */ Z("span", {
|
|
39
40
|
className: "flex min-w-0 items-center gap-2",
|
|
40
|
-
children: [
|
|
41
|
+
children: [r ? /* @__PURE__ */ X("span", {
|
|
41
42
|
"data-icon": "inline-start",
|
|
42
43
|
className: "contents text-muted-foreground [&>svg:not([class*='size-'])]:size-4",
|
|
43
|
-
children:
|
|
44
|
-
}) : null, /* @__PURE__ */
|
|
45
|
-
}), /* @__PURE__ */
|
|
46
|
-
}) }), /* @__PURE__ */
|
|
44
|
+
children: r
|
|
45
|
+
}) : null, /* @__PURE__ */ X(J, { placeholder: n })]
|
|
46
|
+
}), /* @__PURE__ */ X(ea, { className: "ml-2 size-4 shrink-0 text-muted-foreground" })]
|
|
47
|
+
}) }), /* @__PURE__ */ Z(U, {
|
|
47
48
|
anchor: l ? d : void 0,
|
|
48
49
|
children: [
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
+
/* @__PURE__ */ X(V, {
|
|
50
51
|
showTrigger: !1,
|
|
51
52
|
placeholder: "Search"
|
|
52
53
|
}),
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
54
|
+
/* @__PURE__ */ X(z, { children: i }),
|
|
55
|
+
/* @__PURE__ */ X(G, { children: (e) => /* @__PURE__ */ X(W, {
|
|
55
56
|
value: e,
|
|
56
57
|
children: e.label
|
|
57
58
|
}, e.value) })
|
|
@@ -61,2823 +62,54 @@ function za({ items: e, placeholder: t = "Select...", placeholderIcon: n, emptyM
|
|
|
61
62
|
});
|
|
62
63
|
}
|
|
63
64
|
//#endregion
|
|
64
|
-
//#region node_modules/@tanstack/store/dist/alien.js
|
|
65
|
-
var E = /* @__PURE__ */ function(e) {
|
|
66
|
-
return e[e.None = 0] = "None", e[e.Mutable = 1] = "Mutable", e[e.Watching = 2] = "Watching", e[e.RecursedCheck = 4] = "RecursedCheck", e[e.Recursed = 8] = "Recursed", e[e.Dirty = 16] = "Dirty", e[e.Pending = 32] = "Pending", e;
|
|
67
|
-
}({});
|
|
68
|
-
/* @__NO_SIDE_EFFECTS__ */
|
|
69
|
-
function Ba({ update: e, notify: t, unwatched: n }) {
|
|
70
|
-
return {
|
|
71
|
-
link: r,
|
|
72
|
-
unlink: i,
|
|
73
|
-
propagate: a,
|
|
74
|
-
checkDirty: o,
|
|
75
|
-
shallowPropagate: s
|
|
76
|
-
};
|
|
77
|
-
function r(e, t, n) {
|
|
78
|
-
let r = t.depsTail;
|
|
79
|
-
if (r !== void 0 && r.dep === e) return;
|
|
80
|
-
let i = r === void 0 ? t.deps : r.nextDep;
|
|
81
|
-
if (i !== void 0 && i.dep === e) {
|
|
82
|
-
i.version = n, t.depsTail = i;
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
let a = e.subsTail;
|
|
86
|
-
if (a !== void 0 && a.version === n && a.sub === t) return;
|
|
87
|
-
let o = t.depsTail = e.subsTail = {
|
|
88
|
-
version: n,
|
|
89
|
-
dep: e,
|
|
90
|
-
sub: t,
|
|
91
|
-
prevDep: r,
|
|
92
|
-
nextDep: i,
|
|
93
|
-
prevSub: a,
|
|
94
|
-
nextSub: void 0
|
|
95
|
-
};
|
|
96
|
-
i !== void 0 && (i.prevDep = o), r === void 0 ? t.deps = o : r.nextDep = o, a === void 0 ? e.subs = o : a.nextSub = o;
|
|
97
|
-
}
|
|
98
|
-
function i(e, t = e.sub) {
|
|
99
|
-
let r = e.dep, i = e.prevDep, a = e.nextDep, o = e.nextSub, s = e.prevSub;
|
|
100
|
-
return a === void 0 ? t.depsTail = i : a.prevDep = i, i === void 0 ? t.deps = a : i.nextDep = a, o === void 0 ? r.subsTail = s : o.prevSub = s, s === void 0 ? (r.subs = o) === void 0 && n(r) : s.nextSub = o, a;
|
|
101
|
-
}
|
|
102
|
-
function a(e) {
|
|
103
|
-
let n = e.nextSub, r;
|
|
104
|
-
top: do {
|
|
105
|
-
let i = e.sub, a = i.flags;
|
|
106
|
-
if (a & (E.RecursedCheck | E.Recursed | E.Dirty | E.Pending) ? a & (E.RecursedCheck | E.Recursed) ? a & E.RecursedCheck ? !(a & (E.Dirty | E.Pending)) && c(e, i) ? (i.flags = a | (E.Recursed | E.Pending), a &= E.Mutable) : a = E.None : i.flags = a & ~E.Recursed | E.Pending : a = E.None : i.flags = a | E.Pending, a & E.Watching && t(i), a & E.Mutable) {
|
|
107
|
-
let t = i.subs;
|
|
108
|
-
if (t !== void 0) {
|
|
109
|
-
let i = (e = t).nextSub;
|
|
110
|
-
i !== void 0 && (r = {
|
|
111
|
-
value: n,
|
|
112
|
-
prev: r
|
|
113
|
-
}, n = i);
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if ((e = n) !== void 0) {
|
|
118
|
-
n = e.nextSub;
|
|
119
|
-
continue;
|
|
120
|
-
}
|
|
121
|
-
for (; r !== void 0;) if (e = r.value, r = r.prev, e !== void 0) {
|
|
122
|
-
n = e.nextSub;
|
|
123
|
-
continue top;
|
|
124
|
-
}
|
|
125
|
-
break;
|
|
126
|
-
} while (!0);
|
|
127
|
-
}
|
|
128
|
-
function o(t, n) {
|
|
129
|
-
let r, i = 0, a = !1;
|
|
130
|
-
top: do {
|
|
131
|
-
let o = t.dep, c = o.flags;
|
|
132
|
-
if (n.flags & E.Dirty) a = !0;
|
|
133
|
-
else if ((c & (E.Mutable | E.Dirty)) === (E.Mutable | E.Dirty)) {
|
|
134
|
-
if (e(o)) {
|
|
135
|
-
let e = o.subs;
|
|
136
|
-
e.nextSub !== void 0 && s(e), a = !0;
|
|
137
|
-
}
|
|
138
|
-
} else if ((c & (E.Mutable | E.Pending)) === (E.Mutable | E.Pending)) {
|
|
139
|
-
(t.nextSub !== void 0 || t.prevSub !== void 0) && (r = {
|
|
140
|
-
value: t,
|
|
141
|
-
prev: r
|
|
142
|
-
}), t = o.deps, n = o, ++i;
|
|
143
|
-
continue;
|
|
144
|
-
}
|
|
145
|
-
if (!a) {
|
|
146
|
-
let e = t.nextDep;
|
|
147
|
-
if (e !== void 0) {
|
|
148
|
-
t = e;
|
|
149
|
-
continue;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
for (; i--;) {
|
|
153
|
-
let i = n.subs, o = i.nextSub !== void 0;
|
|
154
|
-
if (o ? (t = r.value, r = r.prev) : t = i, a) {
|
|
155
|
-
if (e(n)) {
|
|
156
|
-
o && s(i), n = t.sub;
|
|
157
|
-
continue;
|
|
158
|
-
}
|
|
159
|
-
a = !1;
|
|
160
|
-
} else n.flags &= ~E.Pending;
|
|
161
|
-
n = t.sub;
|
|
162
|
-
let c = t.nextDep;
|
|
163
|
-
if (c !== void 0) {
|
|
164
|
-
t = c;
|
|
165
|
-
continue top;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return a;
|
|
169
|
-
} while (!0);
|
|
170
|
-
}
|
|
171
|
-
function s(e) {
|
|
172
|
-
do {
|
|
173
|
-
let n = e.sub, r = n.flags;
|
|
174
|
-
(r & (E.Pending | E.Dirty)) === E.Pending && (n.flags = r | E.Dirty, (r & (E.Watching | E.RecursedCheck)) === E.Watching && t(n));
|
|
175
|
-
} while ((e = e.nextSub) !== void 0);
|
|
176
|
-
}
|
|
177
|
-
function c(e, t) {
|
|
178
|
-
let n = t.depsTail;
|
|
179
|
-
for (; n !== void 0;) {
|
|
180
|
-
if (n === e) return !0;
|
|
181
|
-
n = n.prevDep;
|
|
182
|
-
}
|
|
183
|
-
return !1;
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region node_modules/@tanstack/store/dist/atom.js
|
|
188
|
-
function Va(e, t, n) {
|
|
189
|
-
let r = typeof e == "object", i = r ? e : void 0;
|
|
190
|
-
return {
|
|
191
|
-
next: (r ? e.next : e)?.bind(i),
|
|
192
|
-
error: (r ? e.error : t)?.bind(i),
|
|
193
|
-
complete: (r ? e.complete : n)?.bind(i)
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
var Ha = [], D = 0, { link: Ua, unlink: Wa, propagate: Ga, checkDirty: Ka, shallowPropagate: qa } = /* @__PURE__ */ Ba({
|
|
197
|
-
update(e) {
|
|
198
|
-
return e._update();
|
|
199
|
-
},
|
|
200
|
-
notify(e) {
|
|
201
|
-
Ha[Ya++] = e, e.flags &= ~E.Watching;
|
|
202
|
-
},
|
|
203
|
-
unwatched(e) {
|
|
204
|
-
e.depsTail !== void 0 && (e.depsTail = void 0, e.flags = E.Mutable | E.Dirty, A(e));
|
|
205
|
-
}
|
|
206
|
-
}), Ja = 0, Ya = 0, O, Xa = 0;
|
|
207
|
-
function k(e) {
|
|
208
|
-
try {
|
|
209
|
-
++Xa, e();
|
|
210
|
-
} finally {
|
|
211
|
-
--Xa || Za();
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
function A(e) {
|
|
215
|
-
let t = e.depsTail, n = t === void 0 ? e.deps : t.nextDep;
|
|
216
|
-
for (; n !== void 0;) n = Wa(n, e);
|
|
217
|
-
}
|
|
218
|
-
function Za() {
|
|
219
|
-
if (!(Xa > 0)) {
|
|
220
|
-
for (; Ja < Ya;) {
|
|
221
|
-
let e = Ha[Ja];
|
|
222
|
-
Ha[Ja++] = void 0, e.notify();
|
|
223
|
-
}
|
|
224
|
-
Ja = 0, Ya = 0;
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
function Qa(e, t) {
|
|
228
|
-
let n = typeof e == "function", r = e, i = {
|
|
229
|
-
_snapshot: n ? void 0 : e,
|
|
230
|
-
subs: void 0,
|
|
231
|
-
subsTail: void 0,
|
|
232
|
-
deps: void 0,
|
|
233
|
-
depsTail: void 0,
|
|
234
|
-
flags: n ? E.None : E.Mutable,
|
|
235
|
-
get() {
|
|
236
|
-
return O !== void 0 && Ua(i, O, D), i._snapshot;
|
|
237
|
-
},
|
|
238
|
-
subscribe(e) {
|
|
239
|
-
let t = Va(e), n = { current: !1 }, r = $a(() => {
|
|
240
|
-
i.get(), n.current ? t.next?.(i._snapshot) : n.current = !0;
|
|
241
|
-
});
|
|
242
|
-
return { unsubscribe: () => {
|
|
243
|
-
r.stop();
|
|
244
|
-
} };
|
|
245
|
-
},
|
|
246
|
-
_update(e) {
|
|
247
|
-
let a = O, o = t?.compare ?? Object.is;
|
|
248
|
-
if (n) O = i, ++D, i.depsTail = void 0;
|
|
249
|
-
else if (e === void 0) return !1;
|
|
250
|
-
n && (i.flags = E.Mutable | E.RecursedCheck);
|
|
251
|
-
try {
|
|
252
|
-
let t = i._snapshot, a = typeof e == "function" ? e(t) : e === void 0 && n ? r(t) : e;
|
|
253
|
-
return t === void 0 || !o(t, a) ? (i._snapshot = a, !0) : !1;
|
|
254
|
-
} finally {
|
|
255
|
-
O = a, n && (i.flags &= ~E.RecursedCheck), A(i);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
};
|
|
259
|
-
return n ? (i.flags = E.Mutable | E.Dirty, i.get = function() {
|
|
260
|
-
let e = i.flags;
|
|
261
|
-
if (e & E.Dirty || e & E.Pending && Ka(i.deps, i)) {
|
|
262
|
-
if (i._update()) {
|
|
263
|
-
let e = i.subs;
|
|
264
|
-
e !== void 0 && qa(e);
|
|
265
|
-
}
|
|
266
|
-
} else e & E.Pending && (i.flags = e & ~E.Pending);
|
|
267
|
-
return O !== void 0 && Ua(i, O, D), i._snapshot;
|
|
268
|
-
}) : i.set = function(e) {
|
|
269
|
-
if (i._update(e)) {
|
|
270
|
-
let e = i.subs;
|
|
271
|
-
e !== void 0 && (Ga(e), qa(e), Za());
|
|
272
|
-
}
|
|
273
|
-
}, i;
|
|
274
|
-
}
|
|
275
|
-
function $a(e) {
|
|
276
|
-
let t = () => {
|
|
277
|
-
let t = O;
|
|
278
|
-
O = n, ++D, n.depsTail = void 0, n.flags = E.Watching | E.RecursedCheck;
|
|
279
|
-
try {
|
|
280
|
-
return e();
|
|
281
|
-
} finally {
|
|
282
|
-
O = t, n.flags &= ~E.RecursedCheck, A(n);
|
|
283
|
-
}
|
|
284
|
-
}, n = {
|
|
285
|
-
deps: void 0,
|
|
286
|
-
depsTail: void 0,
|
|
287
|
-
subs: void 0,
|
|
288
|
-
subsTail: void 0,
|
|
289
|
-
flags: E.Watching | E.RecursedCheck,
|
|
290
|
-
notify() {
|
|
291
|
-
let e = this.flags;
|
|
292
|
-
e & E.Dirty || e & E.Pending && Ka(this.deps, this) ? t() : this.flags = E.Watching;
|
|
293
|
-
},
|
|
294
|
-
stop() {
|
|
295
|
-
this.flags = E.None, this.depsTail = void 0, A(this);
|
|
296
|
-
}
|
|
297
|
-
};
|
|
298
|
-
return t(), n;
|
|
299
|
-
}
|
|
300
|
-
//#endregion
|
|
301
|
-
//#region node_modules/@tanstack/store/dist/store.js
|
|
302
|
-
var eo = class {
|
|
303
|
-
constructor(e, t) {
|
|
304
|
-
this.atom = Qa(e), this.get = this.get.bind(this), this.setState = this.setState.bind(this), this.subscribe = this.subscribe.bind(this), t && (this.actions = t(this));
|
|
305
|
-
}
|
|
306
|
-
setState(e) {
|
|
307
|
-
this.atom.set(e);
|
|
308
|
-
}
|
|
309
|
-
get state() {
|
|
310
|
-
return this.atom.get();
|
|
311
|
-
}
|
|
312
|
-
get() {
|
|
313
|
-
return this.state;
|
|
314
|
-
}
|
|
315
|
-
subscribe(e) {
|
|
316
|
-
return this.atom.subscribe(Va(e));
|
|
317
|
-
}
|
|
318
|
-
}, to = class {
|
|
319
|
-
constructor(e) {
|
|
320
|
-
this.atom = Qa(e);
|
|
321
|
-
}
|
|
322
|
-
get state() {
|
|
323
|
-
return this.atom.get();
|
|
324
|
-
}
|
|
325
|
-
get() {
|
|
326
|
-
return this.state;
|
|
327
|
-
}
|
|
328
|
-
subscribe(e) {
|
|
329
|
-
return this.atom.subscribe(Va(e));
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
function j(e, t) {
|
|
333
|
-
return typeof e == "function" ? new to(e) : t ? new eo(e, t) : new eo(e);
|
|
334
|
-
}
|
|
335
|
-
//#endregion
|
|
336
|
-
//#region node_modules/@tanstack/pacer-lite/dist/lite-throttler.js
|
|
337
|
-
var no = class {
|
|
338
|
-
constructor(e, t) {
|
|
339
|
-
this.fn = e, this.options = t, this.lastExecutionTime = 0, this.isPending = !1, this.maybeExecute = (...e) => {
|
|
340
|
-
let t = Date.now() - this.lastExecutionTime;
|
|
341
|
-
if (this.options.leading && t >= this.options.wait) this.execute(...e);
|
|
342
|
-
else if (this.lastArgs = e, !this.timeoutId && this.options.trailing) {
|
|
343
|
-
let e = this.options.wait - t;
|
|
344
|
-
this.isPending = !0, this.timeoutId = setTimeout(() => {
|
|
345
|
-
this.lastArgs !== void 0 && this.execute(...this.lastArgs);
|
|
346
|
-
}, e);
|
|
347
|
-
}
|
|
348
|
-
}, this.execute = (...e) => {
|
|
349
|
-
this.fn(...e), this.options.onExecute?.(e, this), this.lastExecutionTime = Date.now(), this.clearTimeout(), this.lastArgs = void 0, this.isPending = !1;
|
|
350
|
-
}, this.flush = () => {
|
|
351
|
-
this.isPending && this.lastArgs && this.execute(...this.lastArgs);
|
|
352
|
-
}, this.cancel = () => {
|
|
353
|
-
this.clearTimeout(), this.lastArgs = void 0, this.isPending = !1;
|
|
354
|
-
}, this.clearTimeout = () => {
|
|
355
|
-
this.timeoutId &&= (clearTimeout(this.timeoutId), void 0);
|
|
356
|
-
}, this.options.leading === void 0 && this.options.trailing === void 0 && (this.options.leading = !0, this.options.trailing = !0);
|
|
357
|
-
}
|
|
358
|
-
};
|
|
359
|
-
function ro(e, t) {
|
|
360
|
-
return new no(e, t).maybeExecute;
|
|
361
|
-
}
|
|
362
|
-
//#endregion
|
|
363
|
-
//#region node_modules/@tanstack/devtools-event-client/dist/esm/plugin.js
|
|
364
|
-
var io = class {
|
|
365
|
-
#e = !0;
|
|
366
|
-
#t;
|
|
367
|
-
#n;
|
|
368
|
-
#r;
|
|
369
|
-
#i;
|
|
370
|
-
#a;
|
|
371
|
-
#o;
|
|
372
|
-
#s;
|
|
373
|
-
#c = 0;
|
|
374
|
-
#l = 5;
|
|
375
|
-
#u = !1;
|
|
376
|
-
#d = !1;
|
|
377
|
-
#f = null;
|
|
378
|
-
#p = () => {
|
|
379
|
-
this.debugLog("Connected to event bus"), this.#a = !0, this.#u = !1, this.debugLog("Emitting queued events", this.#i), this.#i.forEach((e) => this.emitEventToBus(e)), this.#i = [], this.stopConnectLoop(), this.#n().removeEventListener("tanstack-connect-success", this.#p);
|
|
380
|
-
};
|
|
381
|
-
#m = () => {
|
|
382
|
-
if (this.#c < this.#l) {
|
|
383
|
-
this.#c++, this.dispatchCustomEvent("tanstack-connect", {});
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
this.#n().removeEventListener("tanstack-connect", this.#m), this.#d = !0, this.debugLog("Max retries reached, giving up on connection"), this.stopConnectLoop();
|
|
387
|
-
};
|
|
388
|
-
#h = () => {
|
|
389
|
-
this.#u || (this.#u = !0, this.#n().addEventListener("tanstack-connect-success", this.#p), this.#m());
|
|
390
|
-
};
|
|
391
|
-
constructor({ pluginId: e, debug: t = !1, enabled: n = !0, reconnectEveryMs: r = 300 }) {
|
|
392
|
-
this.#t = e, this.#e = n, this.#n = this.getGlobalTarget, this.#r = t, this.debugLog(" Initializing event subscription for plugin", this.#t), this.#i = [], this.#a = !1, this.#d = !1, this.#o = null, this.#s = r;
|
|
393
|
-
}
|
|
394
|
-
startConnectLoop() {
|
|
395
|
-
this.#o !== null || this.#a || (this.debugLog(`Starting connect loop (every ${this.#s}ms)`), this.#o = setInterval(this.#m, this.#s));
|
|
396
|
-
}
|
|
397
|
-
stopConnectLoop() {
|
|
398
|
-
this.#u = !1, this.#o !== null && (clearInterval(this.#o), this.#o = null, this.#i = [], this.debugLog("Stopped connect loop"));
|
|
399
|
-
}
|
|
400
|
-
debugLog(...e) {
|
|
401
|
-
this.#r && console.log(`🌴 [tanstack-devtools:${this.#t}-plugin]`, ...e);
|
|
402
|
-
}
|
|
403
|
-
getGlobalTarget() {
|
|
404
|
-
if (typeof globalThis < "u" && globalThis.__TANSTACK_EVENT_TARGET__) return this.debugLog("Using global event target"), globalThis.__TANSTACK_EVENT_TARGET__;
|
|
405
|
-
if (typeof window < "u" && window.addEventListener !== void 0) return this.debugLog("Using window as event target"), window;
|
|
406
|
-
let e = typeof EventTarget < "u" ? new EventTarget() : void 0;
|
|
407
|
-
return e === void 0 || e.addEventListener === void 0 ? (this.debugLog("No event mechanism available, running in non-web environment"), {
|
|
408
|
-
addEventListener: () => {},
|
|
409
|
-
removeEventListener: () => {},
|
|
410
|
-
dispatchEvent: () => !1
|
|
411
|
-
}) : (this.debugLog("Using new EventTarget as fallback"), e);
|
|
412
|
-
}
|
|
413
|
-
getPluginId() {
|
|
414
|
-
return this.#t;
|
|
415
|
-
}
|
|
416
|
-
dispatchCustomEventShim(e, t) {
|
|
417
|
-
try {
|
|
418
|
-
let n = new Event(e, { detail: t });
|
|
419
|
-
this.#n().dispatchEvent(n);
|
|
420
|
-
} catch {
|
|
421
|
-
this.debugLog("Failed to dispatch shim event");
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
dispatchCustomEvent(e, t) {
|
|
425
|
-
try {
|
|
426
|
-
this.#n().dispatchEvent(new CustomEvent(e, { detail: t }));
|
|
427
|
-
} catch {
|
|
428
|
-
this.dispatchCustomEventShim(e, t);
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
emitEventToBus(e) {
|
|
432
|
-
this.debugLog("Emitting event to client bus", e), this.dispatchCustomEvent("tanstack-dispatch-event", e);
|
|
433
|
-
}
|
|
434
|
-
createEventPayload(e, t) {
|
|
435
|
-
return {
|
|
436
|
-
type: `${this.#t}:${e}`,
|
|
437
|
-
payload: t,
|
|
438
|
-
pluginId: this.#t
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
emit(e, t) {
|
|
442
|
-
if (!this.#e) {
|
|
443
|
-
this.debugLog("Event bus client is disabled, not emitting event", e, t);
|
|
444
|
-
return;
|
|
445
|
-
}
|
|
446
|
-
if (this.#f && (this.debugLog("Emitting event to internal event target", e, t), this.#f.dispatchEvent(new CustomEvent(`${this.#t}:${e}`, { detail: this.createEventPayload(e, t) }))), this.#d) {
|
|
447
|
-
this.debugLog("Previously failed to connect, not emitting to bus");
|
|
448
|
-
return;
|
|
449
|
-
}
|
|
450
|
-
if (!this.#a) {
|
|
451
|
-
this.debugLog("Bus not available, will be pushed as soon as connected"), this.#i.push(this.createEventPayload(e, t)), typeof CustomEvent < "u" && !this.#u && (this.#h(), this.startConnectLoop());
|
|
452
|
-
return;
|
|
453
|
-
}
|
|
454
|
-
return this.emitEventToBus(this.createEventPayload(e, t));
|
|
455
|
-
}
|
|
456
|
-
on(e, t, n) {
|
|
457
|
-
let r = n?.withEventTarget ?? !1, i = `${this.#t}:${e}`;
|
|
458
|
-
if (r && (this.#f ||= new EventTarget(), this.#f.addEventListener(i, (e) => {
|
|
459
|
-
t(e.detail);
|
|
460
|
-
})), !this.#e) return this.debugLog("Event bus client is disabled, not registering event", i), () => {};
|
|
461
|
-
let a = (e) => {
|
|
462
|
-
this.debugLog("Received event from bus", e.detail), t(e.detail);
|
|
463
|
-
};
|
|
464
|
-
return this.#n().addEventListener(i, a), this.debugLog("Registered event to bus", i), () => {
|
|
465
|
-
r && this.#f?.removeEventListener(i, a), this.#n().removeEventListener(i, a);
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
onAll(e) {
|
|
469
|
-
if (!this.#e) return this.debugLog("Event bus client is disabled, not registering event"), () => {};
|
|
470
|
-
let t = (t) => {
|
|
471
|
-
let n = t.detail;
|
|
472
|
-
e(n);
|
|
473
|
-
};
|
|
474
|
-
return this.#n().addEventListener("tanstack-devtools-global", t), () => this.#n().removeEventListener("tanstack-devtools-global", t);
|
|
475
|
-
}
|
|
476
|
-
onAllPluginEvents(e) {
|
|
477
|
-
if (!this.#e) return this.debugLog("Event bus client is disabled, not registering event"), () => {};
|
|
478
|
-
let t = (t) => {
|
|
479
|
-
let n = t.detail;
|
|
480
|
-
this.#t && n.pluginId !== this.#t || e(n);
|
|
481
|
-
};
|
|
482
|
-
return this.#n().addEventListener("tanstack-devtools-global", t), () => this.#n().removeEventListener("tanstack-devtools-global", t);
|
|
483
|
-
}
|
|
484
|
-
}, M = new class extends io {
|
|
485
|
-
constructor() {
|
|
486
|
-
super({
|
|
487
|
-
pluginId: "form-devtools",
|
|
488
|
-
reconnectEveryMs: 1e3
|
|
489
|
-
});
|
|
490
|
-
}
|
|
491
|
-
}();
|
|
492
|
-
//#endregion
|
|
493
|
-
//#region node_modules/@tanstack/form-core/dist/esm/utils.js
|
|
494
|
-
function N(e, t) {
|
|
495
|
-
return typeof e == "function" ? e(t) : e;
|
|
496
|
-
}
|
|
497
|
-
function P(e, t) {
|
|
498
|
-
return fo(t).reduce((e, t) => {
|
|
499
|
-
if (e === null) return null;
|
|
500
|
-
if (e !== void 0) return e[t];
|
|
501
|
-
}, e);
|
|
502
|
-
}
|
|
503
|
-
function F(e, t, n) {
|
|
504
|
-
let r = fo(t);
|
|
505
|
-
function i(e) {
|
|
506
|
-
if (!r.length) return N(n, e);
|
|
507
|
-
let t = r.shift();
|
|
508
|
-
if (typeof t == "string" || typeof t == "number" && !Array.isArray(e)) return typeof e == "object" ? (e === null && (e = {}), {
|
|
509
|
-
...e,
|
|
510
|
-
[t]: i(e[t])
|
|
511
|
-
}) : { [t]: i() };
|
|
512
|
-
if (Array.isArray(e) && typeof t == "number") {
|
|
513
|
-
let n = e.slice(0, t);
|
|
514
|
-
return [
|
|
515
|
-
...n.length ? n : Array(t),
|
|
516
|
-
i(e[t]),
|
|
517
|
-
...e.slice(t + 1)
|
|
518
|
-
];
|
|
519
|
-
}
|
|
520
|
-
return [...Array(t), i()];
|
|
521
|
-
}
|
|
522
|
-
return i(e);
|
|
523
|
-
}
|
|
524
|
-
function ao(e, t) {
|
|
525
|
-
let n = fo(t);
|
|
526
|
-
function r(e) {
|
|
527
|
-
if (!e) return;
|
|
528
|
-
if (n.length === 1) {
|
|
529
|
-
let t = n[0];
|
|
530
|
-
if (Array.isArray(e) && typeof t == "number") return e.filter((e, n) => n !== t);
|
|
531
|
-
let { [t]: r, ...i } = e;
|
|
532
|
-
return i;
|
|
533
|
-
}
|
|
534
|
-
let t = n.shift();
|
|
535
|
-
if ((typeof t == "string" || typeof t == "number" && !Array.isArray(e)) && typeof e == "object") return {
|
|
536
|
-
...e,
|
|
537
|
-
[t]: r(e[t])
|
|
538
|
-
};
|
|
539
|
-
if (typeof t == "number" && Array.isArray(e)) {
|
|
540
|
-
if (t >= e.length) return e;
|
|
541
|
-
let n = e.slice(0, t);
|
|
542
|
-
return [
|
|
543
|
-
...n.length ? n : Array(t),
|
|
544
|
-
r(e[t]),
|
|
545
|
-
...e.slice(t + 1)
|
|
546
|
-
];
|
|
547
|
-
}
|
|
548
|
-
throw Error("It seems we have created an infinite loop in deleteBy. ");
|
|
549
|
-
}
|
|
550
|
-
return r(e);
|
|
551
|
-
}
|
|
552
|
-
var oo = 46, so = 91, co = 93, lo = 48, uo = 57;
|
|
553
|
-
function fo(e) {
|
|
554
|
-
if (Array.isArray(e)) return [...e];
|
|
555
|
-
if (typeof e != "string") throw Error("Path must be a string.");
|
|
556
|
-
let t = e.length, n = [], r = +(t > 0 && e.charCodeAt(0) === so), i = !0, a = -1;
|
|
557
|
-
for (let o = r; o <= t; o++) {
|
|
558
|
-
let s = o < t ? e.charCodeAt(o) : -1;
|
|
559
|
-
if (o === t || s === oo || s === so || s === co) {
|
|
560
|
-
let t = o - r;
|
|
561
|
-
if (t > 0) {
|
|
562
|
-
let a = i && (t === 1 || e.charCodeAt(r) !== lo), s = e.slice(r, o);
|
|
563
|
-
if (a) {
|
|
564
|
-
let e = parseInt(s, 10);
|
|
565
|
-
t <= 15 || String(e) === s ? n.push(e) : n.push(s);
|
|
566
|
-
} else n.push(s);
|
|
567
|
-
} else a !== co && !(a === -1 && s === co) && !(a === s && (s === oo || s === so)) && n.push("");
|
|
568
|
-
r = o + 1, i = !0;
|
|
569
|
-
} else (s < lo || s > uo) && (i = !1);
|
|
570
|
-
a = s;
|
|
571
|
-
}
|
|
572
|
-
return n.length || n.push(""), n;
|
|
573
|
-
}
|
|
574
|
-
function po(e, t) {
|
|
575
|
-
return e.length === 0 ? t : t.length === 0 ? e : t.startsWith("[") || t.startsWith(".") ? e + t : `${e}.${t}`;
|
|
576
|
-
}
|
|
577
|
-
function mo(e) {
|
|
578
|
-
return !(Array.isArray(e) && e.length === 0);
|
|
579
|
-
}
|
|
580
|
-
function I(e, t) {
|
|
581
|
-
return t.validationLogic({
|
|
582
|
-
form: t.form,
|
|
583
|
-
group: t.group,
|
|
584
|
-
validators: t.validators,
|
|
585
|
-
event: {
|
|
586
|
-
type: e,
|
|
587
|
-
fieldName: t.fieldName,
|
|
588
|
-
async: !1
|
|
589
|
-
},
|
|
590
|
-
runValidation: (e) => e.validators.filter(Boolean).map((e) => ({
|
|
591
|
-
cause: e.cause,
|
|
592
|
-
validate: e.fn
|
|
593
|
-
}))
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
function L(e, t) {
|
|
597
|
-
let { asyncDebounceMs: n } = t, { onBlurAsyncDebounceMs: r, onChangeAsyncDebounceMs: i, onDynamicAsyncDebounceMs: a } = t.validators || {}, o = n ?? 0;
|
|
598
|
-
return t.validationLogic({
|
|
599
|
-
form: t.form,
|
|
600
|
-
group: t.group,
|
|
601
|
-
validators: t.validators,
|
|
602
|
-
event: {
|
|
603
|
-
type: e,
|
|
604
|
-
fieldName: t.fieldName,
|
|
605
|
-
async: !0
|
|
606
|
-
},
|
|
607
|
-
runValidation: (t) => t.validators.filter(Boolean).map((t) => {
|
|
608
|
-
let n = t?.cause || e, s = o;
|
|
609
|
-
switch (n) {
|
|
610
|
-
case "change":
|
|
611
|
-
s = i ?? o;
|
|
612
|
-
break;
|
|
613
|
-
case "blur":
|
|
614
|
-
s = r ?? o;
|
|
615
|
-
break;
|
|
616
|
-
case "dynamic":
|
|
617
|
-
s = a ?? o;
|
|
618
|
-
break;
|
|
619
|
-
case "submit":
|
|
620
|
-
s = 0;
|
|
621
|
-
break;
|
|
622
|
-
}
|
|
623
|
-
return e === "submit" && (s = 0), {
|
|
624
|
-
cause: n,
|
|
625
|
-
validate: t.fn,
|
|
626
|
-
debounceMs: s
|
|
627
|
-
};
|
|
628
|
-
})
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
var ho = (e) => !!e && typeof e == "object" && "fields" in e;
|
|
632
|
-
function R(e, t) {
|
|
633
|
-
if (Object.is(e, t)) return !0;
|
|
634
|
-
if (typeof e != "object" || !e || typeof t != "object" || !t) return !1;
|
|
635
|
-
if (e instanceof Date && t instanceof Date) return e.getTime() === t.getTime();
|
|
636
|
-
if (e instanceof Map && t instanceof Map) {
|
|
637
|
-
if (e.size !== t.size) return !1;
|
|
638
|
-
for (let [n, r] of e) if (!t.has(n) || !Object.is(r, t.get(n))) return !1;
|
|
639
|
-
return !0;
|
|
640
|
-
}
|
|
641
|
-
if (e instanceof Set && t instanceof Set) {
|
|
642
|
-
if (e.size !== t.size) return !1;
|
|
643
|
-
for (let n of e) if (!t.has(n)) return !1;
|
|
644
|
-
return !0;
|
|
645
|
-
}
|
|
646
|
-
let n = Object.keys(e), r = Object.keys(t);
|
|
647
|
-
if (n.length !== r.length || n.length === 0 && !Array.isArray(e) && !Array.isArray(t) && (Object.getPrototypeOf(e) !== Object.prototype || Object.getPrototypeOf(t) !== Object.prototype)) return !1;
|
|
648
|
-
for (let i of n) if (!r.includes(i) || !R(e[i], t[i])) return !1;
|
|
649
|
-
return !0;
|
|
650
|
-
}
|
|
651
|
-
var go = ({ newFormValidatorError: e, isPreviousErrorFromFormValidator: t, previousErrorValue: n }) => e ? {
|
|
652
|
-
newErrorValue: e,
|
|
653
|
-
newSource: "form"
|
|
654
|
-
} : t ? {
|
|
655
|
-
newErrorValue: void 0,
|
|
656
|
-
newSource: void 0
|
|
657
|
-
} : n ? {
|
|
658
|
-
newErrorValue: n,
|
|
659
|
-
newSource: "field"
|
|
660
|
-
} : {
|
|
661
|
-
newErrorValue: void 0,
|
|
662
|
-
newSource: void 0
|
|
663
|
-
}, _o = ({ formLevelError: e, fieldLevelError: t }) => t ? {
|
|
664
|
-
newErrorValue: t,
|
|
665
|
-
newSource: "field"
|
|
666
|
-
} : e ? {
|
|
667
|
-
newErrorValue: e,
|
|
668
|
-
newSource: "form"
|
|
669
|
-
} : {
|
|
670
|
-
newErrorValue: void 0,
|
|
671
|
-
newSource: void 0
|
|
672
|
-
};
|
|
673
|
-
function z(e, t) {
|
|
674
|
-
return e == null ? t : {
|
|
675
|
-
...e,
|
|
676
|
-
...t
|
|
677
|
-
};
|
|
678
|
-
}
|
|
679
|
-
for (var B = 256, V = [], H; B--;) V[B] = (B + 256).toString(16).substring(1);
|
|
680
|
-
function vo() {
|
|
681
|
-
let e = 0, t, n = "";
|
|
682
|
-
if (!H || B + 16 > 256) {
|
|
683
|
-
for (H = Array(256), e = 256; e--;) H[e] = 256 * Math.random() | 0;
|
|
684
|
-
e = 0, B = 0;
|
|
685
|
-
}
|
|
686
|
-
for (; e < 16; e++) t = H[B + e], e === 6 ? n += V[t & 15 | 64] : e === 8 ? n += V[t & 63 | 128] : n += V[t], e & 1 && e > 1 && e < 11 && (n += "-");
|
|
687
|
-
return B++, n;
|
|
688
|
-
}
|
|
689
|
-
var yo = ro((e) => M.emit("form-state", {
|
|
690
|
-
id: e.formId,
|
|
691
|
-
state: e.store.state
|
|
692
|
-
}), { wait: 300 });
|
|
693
|
-
function U(e) {
|
|
694
|
-
if (typeof e != "object" || !e) return e;
|
|
695
|
-
if (e instanceof Date) return new Date(e.getTime());
|
|
696
|
-
if (Array.isArray(e)) {
|
|
697
|
-
let t = [];
|
|
698
|
-
for (let n = 0; n < e.length; n++) t[n] = U(e[n]);
|
|
699
|
-
return t;
|
|
700
|
-
}
|
|
701
|
-
if (e instanceof Map) {
|
|
702
|
-
let t = /* @__PURE__ */ new Map();
|
|
703
|
-
return e.forEach((e, n) => {
|
|
704
|
-
t.set(n, U(e));
|
|
705
|
-
}), t;
|
|
706
|
-
}
|
|
707
|
-
if (e instanceof Set) {
|
|
708
|
-
let t = /* @__PURE__ */ new Set();
|
|
709
|
-
return e.forEach((e) => {
|
|
710
|
-
t.add(U(e));
|
|
711
|
-
}), t;
|
|
712
|
-
}
|
|
713
|
-
let t = {};
|
|
714
|
-
for (let n in e) Object.prototype.hasOwnProperty.call(e, n) && (t[n] = U(e[n]));
|
|
715
|
-
return t;
|
|
716
|
-
}
|
|
717
|
-
function W(e, t) {
|
|
718
|
-
return t === e || t.startsWith(`${e}.`) || t.startsWith(`${e}[`);
|
|
719
|
-
}
|
|
720
|
-
//#endregion
|
|
721
|
-
//#region node_modules/@tanstack/form-core/dist/esm/ValidationLogic.js
|
|
722
|
-
var G = (e) => {
|
|
723
|
-
if (!e.validators) return e.runValidation({
|
|
724
|
-
validators: [],
|
|
725
|
-
form: e.form
|
|
726
|
-
});
|
|
727
|
-
let t = e.event.async, n = t ? void 0 : {
|
|
728
|
-
fn: e.validators.onMount,
|
|
729
|
-
cause: "mount"
|
|
730
|
-
}, r = {
|
|
731
|
-
fn: t ? e.validators.onChangeAsync : e.validators.onChange,
|
|
732
|
-
cause: "change"
|
|
733
|
-
}, i = {
|
|
734
|
-
fn: t ? e.validators.onBlurAsync : e.validators.onBlur,
|
|
735
|
-
cause: "blur"
|
|
736
|
-
}, a = {
|
|
737
|
-
fn: t ? e.validators.onSubmitAsync : e.validators.onSubmit,
|
|
738
|
-
cause: "submit"
|
|
739
|
-
}, o = t ? void 0 : {
|
|
740
|
-
fn: () => void 0,
|
|
741
|
-
cause: "server"
|
|
742
|
-
};
|
|
743
|
-
switch (e.event.type) {
|
|
744
|
-
case "mount": return e.runValidation({
|
|
745
|
-
validators: [n],
|
|
746
|
-
form: e.form
|
|
747
|
-
});
|
|
748
|
-
case "submit": return e.runValidation({
|
|
749
|
-
validators: [
|
|
750
|
-
r,
|
|
751
|
-
i,
|
|
752
|
-
a,
|
|
753
|
-
o
|
|
754
|
-
],
|
|
755
|
-
form: e.form
|
|
756
|
-
});
|
|
757
|
-
case "server": return e.runValidation({
|
|
758
|
-
validators: [],
|
|
759
|
-
form: e.form
|
|
760
|
-
});
|
|
761
|
-
case "blur": return e.runValidation({
|
|
762
|
-
validators: [i, o],
|
|
763
|
-
form: e.form
|
|
764
|
-
});
|
|
765
|
-
case "change": return e.runValidation({
|
|
766
|
-
validators: [r, o],
|
|
767
|
-
form: e.form
|
|
768
|
-
});
|
|
769
|
-
default: throw Error(`Unknown validation event type: ${e.event.type}`);
|
|
770
|
-
}
|
|
771
|
-
};
|
|
772
|
-
//#endregion
|
|
773
|
-
//#region node_modules/@tanstack/form-core/dist/esm/standardSchemaValidator.js
|
|
774
|
-
function bo(e, t) {
|
|
775
|
-
let n = /* @__PURE__ */ new Map();
|
|
776
|
-
for (let r of e) {
|
|
777
|
-
let e = r.path ?? [], i = t, a = "";
|
|
778
|
-
for (let t = 0; t < e.length; t++) {
|
|
779
|
-
let n = e[t];
|
|
780
|
-
if (n === void 0) continue;
|
|
781
|
-
let r = typeof n == "object" ? n.key : n, o = Number(r);
|
|
782
|
-
Array.isArray(i) && !Number.isNaN(o) ? a += `[${o}]` : a += (t > 0 ? "." : "") + String(r), i = typeof i == "object" && i ? i[r] : void 0;
|
|
783
|
-
}
|
|
784
|
-
n.set(a, (n.get(a) ?? []).concat(r));
|
|
785
|
-
}
|
|
786
|
-
return Object.fromEntries(n);
|
|
787
|
-
}
|
|
788
|
-
var xo = (e, t) => {
|
|
789
|
-
let n = bo(e, t);
|
|
790
|
-
return {
|
|
791
|
-
form: n,
|
|
792
|
-
fields: n
|
|
793
|
-
};
|
|
794
|
-
}, K = {
|
|
795
|
-
validate({ value: e, validationSource: t }, n) {
|
|
796
|
-
let r = n["~standard"].validate(e);
|
|
797
|
-
if (r instanceof Promise) throw Error("async function passed to sync validator");
|
|
798
|
-
if (r.issues) return t === "field" ? r.issues : xo(r.issues, e);
|
|
799
|
-
},
|
|
800
|
-
async validateAsync({ value: e, validationSource: t }, n) {
|
|
801
|
-
let r = await n["~standard"].validate(e);
|
|
802
|
-
if (r.issues) return t === "field" ? r.issues : xo(r.issues, e);
|
|
803
|
-
}
|
|
804
|
-
}, So = (e) => !!e && "~standard" in e, q = {
|
|
805
|
-
isValidating: !1,
|
|
806
|
-
isTouched: !1,
|
|
807
|
-
isBlurred: !1,
|
|
808
|
-
isDirty: !1,
|
|
809
|
-
isPristine: !0,
|
|
810
|
-
isValid: !0,
|
|
811
|
-
isDefaultValue: !0,
|
|
812
|
-
errors: [],
|
|
813
|
-
errorMap: {},
|
|
814
|
-
errorSourceMap: {},
|
|
815
|
-
_arrayVersion: 0
|
|
816
|
-
};
|
|
817
|
-
function J(e) {
|
|
818
|
-
function t(t) {
|
|
819
|
-
let n = e.getFieldMeta(t) ?? q;
|
|
820
|
-
e.setFieldMeta(t, {
|
|
821
|
-
...n,
|
|
822
|
-
_arrayVersion: (n._arrayVersion || 0) + 1
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
function n(n, r, i) {
|
|
826
|
-
t(n);
|
|
827
|
-
let a = s(n, r, "move", i), c = Math.min(r, i), u = Math.max(r, i);
|
|
828
|
-
for (let e = c; e <= u; e++) a.push(o(n, e));
|
|
829
|
-
let d = Object.keys(e.fieldInfo).reduce((t, i) => (i.startsWith(o(n, r)) && t.set(i, e.getFieldMeta(i)), t), /* @__PURE__ */ new Map());
|
|
830
|
-
l(a, r < i ? "up" : "down"), Object.keys(e.fieldInfo).filter((e) => e.startsWith(o(n, i))).forEach((t) => {
|
|
831
|
-
let a = t.replace(o(n, i), o(n, r)), s = d.get(a);
|
|
832
|
-
s && e.setFieldMeta(t, s);
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
function r(e, n) {
|
|
836
|
-
t(e), l(s(e, n, "remove"), "up");
|
|
837
|
-
}
|
|
838
|
-
function i(n, r, i) {
|
|
839
|
-
t(n), s(n, r, "swap", i).forEach((t) => {
|
|
840
|
-
if (!t.toString().startsWith(o(n, r))) return;
|
|
841
|
-
let a = t.toString().replace(o(n, r), o(n, i)), [s, c] = [e.getFieldMeta(t), e.getFieldMeta(a)];
|
|
842
|
-
s && e.setFieldMeta(a, s), c && e.setFieldMeta(t, c);
|
|
843
|
-
});
|
|
844
|
-
}
|
|
845
|
-
function a(n, r) {
|
|
846
|
-
t(n);
|
|
847
|
-
let i = s(n, r, "insert");
|
|
848
|
-
l(i, "down"), i.forEach((t) => {
|
|
849
|
-
t.toString().startsWith(o(n, r)) && e.setFieldMeta(t, u());
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
function o(e, t) {
|
|
853
|
-
return `${e}[${t}]`;
|
|
854
|
-
}
|
|
855
|
-
function s(t, n, r, i) {
|
|
856
|
-
let a = [o(t, n)];
|
|
857
|
-
switch (r) {
|
|
858
|
-
case "swap":
|
|
859
|
-
a.push(o(t, i));
|
|
860
|
-
break;
|
|
861
|
-
case "move": {
|
|
862
|
-
let [e, r] = [Math.min(n, i), Math.max(n, i)];
|
|
863
|
-
for (let n = e; n <= r; n++) a.push(o(t, n));
|
|
864
|
-
break;
|
|
865
|
-
}
|
|
866
|
-
default: {
|
|
867
|
-
let r = e.getFieldValue(t), i = Array.isArray(r) ? r.length : 0;
|
|
868
|
-
for (let e = n + 1; e < i; e++) a.push(o(t, e));
|
|
869
|
-
break;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
return Object.keys(e.fieldInfo).filter((e) => a.some((t) => e.startsWith(t)));
|
|
873
|
-
}
|
|
874
|
-
function c(e, t) {
|
|
875
|
-
return e.replace(/\[(\d+)\]/, (e, n) => {
|
|
876
|
-
let r = parseInt(n, 10);
|
|
877
|
-
return `[${t === "up" ? r + 1 : Math.max(0, r - 1)}]`;
|
|
878
|
-
});
|
|
879
|
-
}
|
|
880
|
-
function l(t, n) {
|
|
881
|
-
(n === "up" ? t : [...t].reverse()).forEach((t) => {
|
|
882
|
-
let r = c(t.toString(), n), i = e.getFieldMeta(r);
|
|
883
|
-
i ? e.setFieldMeta(t, i) : e.setFieldMeta(t, u());
|
|
884
|
-
});
|
|
885
|
-
}
|
|
886
|
-
let u = () => q;
|
|
887
|
-
return {
|
|
888
|
-
bumpArrayVersion: t,
|
|
889
|
-
handleArrayMove: n,
|
|
890
|
-
handleArrayRemove: r,
|
|
891
|
-
handleArraySwap: i,
|
|
892
|
-
handleArrayInsert: a
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
//#endregion
|
|
896
|
-
//#region node_modules/@tanstack/form-core/dist/esm/FormApi.js
|
|
897
|
-
function Co(e) {
|
|
898
|
-
return {
|
|
899
|
-
values: e.values ?? {},
|
|
900
|
-
errorMap: e.errorMap ?? {},
|
|
901
|
-
fieldMetaBase: e.fieldMetaBase ?? {},
|
|
902
|
-
formGroupStateBase: e.formGroupStateBase ?? {},
|
|
903
|
-
isSubmitted: e.isSubmitted ?? !1,
|
|
904
|
-
isSubmitting: e.isSubmitting ?? !1,
|
|
905
|
-
isValidating: e.isValidating ?? !1,
|
|
906
|
-
submissionAttempts: e.submissionAttempts ?? 0,
|
|
907
|
-
isSubmitSuccessful: e.isSubmitSuccessful ?? !1,
|
|
908
|
-
validationMetaMap: e.validationMetaMap ?? {
|
|
909
|
-
onChange: void 0,
|
|
910
|
-
onBlur: void 0,
|
|
911
|
-
onSubmit: void 0,
|
|
912
|
-
onMount: void 0,
|
|
913
|
-
onServer: void 0,
|
|
914
|
-
onDynamic: void 0
|
|
915
|
-
}
|
|
916
|
-
};
|
|
917
|
-
}
|
|
918
|
-
var wo = class {
|
|
919
|
-
constructor(e) {
|
|
920
|
-
this.options = {}, this.fieldInfo = {}, this.formGroupApis = /* @__PURE__ */ new Set(), this.mount = () => {
|
|
921
|
-
let e = this.store.subscribe(() => {
|
|
922
|
-
yo(this);
|
|
923
|
-
}), t = M.on("request-form-state", (e) => {
|
|
924
|
-
e.payload.id === this._formId && M.emit("form-api", {
|
|
925
|
-
id: this._formId,
|
|
926
|
-
state: this.store.state,
|
|
927
|
-
options: this.options
|
|
928
|
-
});
|
|
929
|
-
}), n = M.on("request-form-reset", (e) => {
|
|
930
|
-
e.payload.id === this._formId && this.reset();
|
|
931
|
-
}), r = M.on("request-form-force-submit", (e) => {
|
|
932
|
-
e.payload.id === this._formId && (this._devtoolsSubmissionOverride = !0, this.handleSubmit(), this._devtoolsSubmissionOverride = !1);
|
|
933
|
-
}), i = () => {
|
|
934
|
-
r(), n(), t(), e.unsubscribe(), M.emit("form-unmounted", { id: this._formId });
|
|
935
|
-
};
|
|
936
|
-
this.options.listeners?.onMount?.({ formApi: this });
|
|
937
|
-
let { onMount: a } = this.options.validators || {};
|
|
938
|
-
return M.emit("form-api", {
|
|
939
|
-
id: this._formId,
|
|
940
|
-
state: this.store.state,
|
|
941
|
-
options: this.options
|
|
942
|
-
}), a && this.validateSync("mount"), i;
|
|
943
|
-
}, this.update = (e) => {
|
|
944
|
-
if (!e) return;
|
|
945
|
-
let t = this.options;
|
|
946
|
-
this.options = e;
|
|
947
|
-
let n = e.defaultValues && !R(e.defaultValues, t.defaultValues) && !this.state.isTouched, r = !R(e.defaultState, t.defaultState) && !this.state.isTouched;
|
|
948
|
-
if (!(!n && !r)) {
|
|
949
|
-
if (k(() => {
|
|
950
|
-
this.baseStore.setState(() => Co(Object.assign({}, this.state, r ? e.defaultState : {}, n ? { values: e.defaultValues } : {})));
|
|
951
|
-
}), n) {
|
|
952
|
-
let e = J(this);
|
|
953
|
-
for (let t of Object.keys(this.fieldInfo)) Array.isArray(this.getFieldValue(t)) && e.bumpArrayVersion(t);
|
|
954
|
-
}
|
|
955
|
-
M.emit("form-api", {
|
|
956
|
-
id: this._formId,
|
|
957
|
-
state: this.store.state,
|
|
958
|
-
options: this.options
|
|
959
|
-
});
|
|
960
|
-
}
|
|
961
|
-
}, this.reset = (e, t) => {
|
|
962
|
-
let { fieldMeta: n } = this.state, r = this.resetFieldMeta(n);
|
|
963
|
-
e && !t?.keepDefaultValues && (this.options = {
|
|
964
|
-
...this.options,
|
|
965
|
-
defaultValues: e
|
|
966
|
-
}), this.baseStore.setState(() => {
|
|
967
|
-
let t = e ?? this.options.defaultValues ?? this.options.defaultState?.values;
|
|
968
|
-
return e || Object.values(this.fieldInfo).forEach((e) => {
|
|
969
|
-
e.instance && e.instance.options.defaultValue !== void 0 && (t = F(t, e.instance.name, e.instance.options.defaultValue));
|
|
970
|
-
}), Co({
|
|
971
|
-
...this.options.defaultState,
|
|
972
|
-
values: t,
|
|
973
|
-
fieldMetaBase: r
|
|
974
|
-
});
|
|
975
|
-
});
|
|
976
|
-
}, this.validateAllFields = async (e) => {
|
|
977
|
-
let t = [];
|
|
978
|
-
return k(() => {
|
|
979
|
-
Object.values(this.fieldInfo).forEach((n) => {
|
|
980
|
-
if (!n.instance) return;
|
|
981
|
-
let r = n.instance;
|
|
982
|
-
t.push(Promise.resolve().then(() => r.validate(e, {
|
|
983
|
-
skipFormValidation: !0,
|
|
984
|
-
skipGroupValidation: !0
|
|
985
|
-
}))), n.instance.store.state.meta.isTouched || n.instance.setMeta((e) => ({
|
|
986
|
-
...e,
|
|
987
|
-
isTouched: !0
|
|
988
|
-
}));
|
|
989
|
-
});
|
|
990
|
-
}), (await Promise.all(t)).flat();
|
|
991
|
-
}, this.validateArrayFieldsStartingFrom = async (e, t, n) => {
|
|
992
|
-
let r = this.getFieldValue(e), i = Array.isArray(r) ? Math.max(r.length - 1, 0) : null, a = [`${e}[${t}]`];
|
|
993
|
-
for (let n = t + 1; n <= (i ?? 0); n++) a.push(`${e}[${n}]`);
|
|
994
|
-
let o = Object.keys(this.fieldInfo).filter((e) => a.some((t) => e.startsWith(t))), s = [];
|
|
995
|
-
return k(() => {
|
|
996
|
-
o.forEach((e) => {
|
|
997
|
-
s.push(Promise.resolve().then(() => this.validateField(e, n)));
|
|
998
|
-
});
|
|
999
|
-
}), (await Promise.all(s)).flat();
|
|
1000
|
-
}, this.validateField = (e, t) => {
|
|
1001
|
-
let n = this.fieldInfo[e]?.instance;
|
|
1002
|
-
if (!n) {
|
|
1003
|
-
let { hasErrored: n } = this.validateSync(t);
|
|
1004
|
-
return n && !this.options.asyncAlways ? this.getFieldMeta(e)?.errors ?? [] : this.validateAsync(t).then(() => this.getFieldMeta(e)?.errors ?? []);
|
|
1005
|
-
}
|
|
1006
|
-
return n.store.state.meta.isTouched || n.setMeta((e) => ({
|
|
1007
|
-
...e,
|
|
1008
|
-
isTouched: !0
|
|
1009
|
-
})), n.validate(t);
|
|
1010
|
-
}, this.validateSync = (e, t) => {
|
|
1011
|
-
let n = I(e, {
|
|
1012
|
-
...this.options,
|
|
1013
|
-
form: this,
|
|
1014
|
-
group: t?.group,
|
|
1015
|
-
validationLogic: this.options.validationLogic || G
|
|
1016
|
-
}), r = !1, i = {};
|
|
1017
|
-
return k(() => {
|
|
1018
|
-
for (let e of n) {
|
|
1019
|
-
if (!e.validate) continue;
|
|
1020
|
-
let { formError: n, fieldErrors: a } = To(this.runValidator({
|
|
1021
|
-
validate: e.validate,
|
|
1022
|
-
value: {
|
|
1023
|
-
value: this.state.values,
|
|
1024
|
-
formApi: this,
|
|
1025
|
-
validationSource: "form"
|
|
1026
|
-
},
|
|
1027
|
-
type: "validate"
|
|
1028
|
-
})), o = Y(e.cause), s = /* @__PURE__ */ new Set([...Object.keys(this.state.fieldMeta), ...Object.keys(a || {})]);
|
|
1029
|
-
t?.filterFieldNames && (s = new Set([...s].filter(t.filterFieldNames)));
|
|
1030
|
-
for (let e of s) {
|
|
1031
|
-
if (this.baseStore.state.fieldMetaBase[e] === void 0 && !a?.[e]) continue;
|
|
1032
|
-
let { errorMap: t, errorSourceMap: n } = this.getFieldMeta(e) ?? q, r = a?.[e], { newErrorValue: s, newSource: c } = go({
|
|
1033
|
-
newFormValidatorError: r,
|
|
1034
|
-
isPreviousErrorFromFormValidator: n?.[o] === "form",
|
|
1035
|
-
previousErrorValue: t?.[o]
|
|
1036
|
-
});
|
|
1037
|
-
c === "form" && (i[e] = {
|
|
1038
|
-
...i[e],
|
|
1039
|
-
[o]: r
|
|
1040
|
-
}), t?.[o] !== s && this.setFieldMeta(e, (e = q) => ({
|
|
1041
|
-
...e,
|
|
1042
|
-
errorMap: {
|
|
1043
|
-
...e.errorMap,
|
|
1044
|
-
[o]: s
|
|
1045
|
-
},
|
|
1046
|
-
errorSourceMap: {
|
|
1047
|
-
...e.errorSourceMap,
|
|
1048
|
-
[o]: c
|
|
1049
|
-
}
|
|
1050
|
-
}));
|
|
1051
|
-
}
|
|
1052
|
-
t?.dontUpdateFormErrorMap || this.state.errorMap?.[o] !== n && this.baseStore.setState((e) => ({
|
|
1053
|
-
...e,
|
|
1054
|
-
errorMap: {
|
|
1055
|
-
...e.errorMap,
|
|
1056
|
-
[o]: n
|
|
1057
|
-
}
|
|
1058
|
-
})), (n || a) && (r = !0);
|
|
1059
|
-
}
|
|
1060
|
-
if (t?.dontUpdateFormErrorMap) return;
|
|
1061
|
-
let a = Y("submit");
|
|
1062
|
-
this.state.errorMap?.[a] && e !== "submit" && !r && this.baseStore.setState((e) => ({
|
|
1063
|
-
...e,
|
|
1064
|
-
errorMap: {
|
|
1065
|
-
...e.errorMap,
|
|
1066
|
-
[a]: void 0
|
|
1067
|
-
}
|
|
1068
|
-
}));
|
|
1069
|
-
let o = Y("server");
|
|
1070
|
-
this.state.errorMap?.[o] && e !== "server" && !r && this.baseStore.setState((e) => ({
|
|
1071
|
-
...e,
|
|
1072
|
-
errorMap: {
|
|
1073
|
-
...e.errorMap,
|
|
1074
|
-
[o]: void 0
|
|
1075
|
-
}
|
|
1076
|
-
}));
|
|
1077
|
-
}), {
|
|
1078
|
-
hasErrored: r,
|
|
1079
|
-
fieldsErrorMap: i
|
|
1080
|
-
};
|
|
1081
|
-
}, this.validateAsync = async (e, t) => {
|
|
1082
|
-
let n = L(e, {
|
|
1083
|
-
...this.options,
|
|
1084
|
-
form: this,
|
|
1085
|
-
group: t?.group,
|
|
1086
|
-
validationLogic: this.options.validationLogic || G
|
|
1087
|
-
});
|
|
1088
|
-
this.state.isFormValidating || this.baseStore.setState((e) => ({
|
|
1089
|
-
...e,
|
|
1090
|
-
isFormValidating: !0
|
|
1091
|
-
}));
|
|
1092
|
-
let r = [], i;
|
|
1093
|
-
for (let e of n) {
|
|
1094
|
-
if (!e.validate) continue;
|
|
1095
|
-
let n = Y(e.cause);
|
|
1096
|
-
this.state.validationMetaMap[n]?.lastAbortController.abort();
|
|
1097
|
-
let a = new AbortController();
|
|
1098
|
-
this.state.validationMetaMap[n] = { lastAbortController: a }, r.push(new Promise(async (n) => {
|
|
1099
|
-
let r;
|
|
1100
|
-
try {
|
|
1101
|
-
r = await new Promise((t, n) => {
|
|
1102
|
-
setTimeout(async () => {
|
|
1103
|
-
if (a.signal.aborted) return t(void 0);
|
|
1104
|
-
try {
|
|
1105
|
-
t(await this.runValidator({
|
|
1106
|
-
validate: e.validate,
|
|
1107
|
-
value: {
|
|
1108
|
-
value: this.state.values,
|
|
1109
|
-
formApi: this,
|
|
1110
|
-
validationSource: "form",
|
|
1111
|
-
signal: a.signal
|
|
1112
|
-
},
|
|
1113
|
-
type: "validateAsync"
|
|
1114
|
-
}));
|
|
1115
|
-
} catch (e) {
|
|
1116
|
-
n(e);
|
|
1117
|
-
}
|
|
1118
|
-
}, e.debounceMs);
|
|
1119
|
-
});
|
|
1120
|
-
} catch (e) {
|
|
1121
|
-
r = e;
|
|
1122
|
-
}
|
|
1123
|
-
let { formError: o, fieldErrors: s } = To(r);
|
|
1124
|
-
s && (i = i ? {
|
|
1125
|
-
...i,
|
|
1126
|
-
...s
|
|
1127
|
-
} : s);
|
|
1128
|
-
let c = Y(e.cause), l = Object.keys(this.state.fieldMeta);
|
|
1129
|
-
t?.filterFieldNames && (l = l.filter(t.filterFieldNames));
|
|
1130
|
-
for (let e of l) {
|
|
1131
|
-
if (this.baseStore.state.fieldMetaBase[e] === void 0) continue;
|
|
1132
|
-
let t = this.getFieldMeta(e);
|
|
1133
|
-
if (!t) continue;
|
|
1134
|
-
let { errorMap: n, errorSourceMap: r } = t, a = i?.[e], { newErrorValue: o, newSource: s } = go({
|
|
1135
|
-
newFormValidatorError: a,
|
|
1136
|
-
isPreviousErrorFromFormValidator: r?.[c] === "form",
|
|
1137
|
-
previousErrorValue: n?.[c]
|
|
1138
|
-
});
|
|
1139
|
-
n?.[c] !== o && this.setFieldMeta(e, (e) => ({
|
|
1140
|
-
...e,
|
|
1141
|
-
errorMap: {
|
|
1142
|
-
...e.errorMap,
|
|
1143
|
-
[c]: o
|
|
1144
|
-
},
|
|
1145
|
-
errorSourceMap: {
|
|
1146
|
-
...e.errorSourceMap,
|
|
1147
|
-
[c]: s
|
|
1148
|
-
}
|
|
1149
|
-
}));
|
|
1150
|
-
}
|
|
1151
|
-
t?.dontUpdateFormErrorMap || this.baseStore.setState((e) => ({
|
|
1152
|
-
...e,
|
|
1153
|
-
errorMap: {
|
|
1154
|
-
...e.errorMap,
|
|
1155
|
-
[c]: o
|
|
1156
|
-
}
|
|
1157
|
-
})), n(i ? {
|
|
1158
|
-
fieldErrors: i,
|
|
1159
|
-
errorMapKey: c
|
|
1160
|
-
} : void 0);
|
|
1161
|
-
}));
|
|
1162
|
-
}
|
|
1163
|
-
let a = [], o = {};
|
|
1164
|
-
if (r.length) {
|
|
1165
|
-
a = await Promise.all(r);
|
|
1166
|
-
for (let e of a) if (e?.fieldErrors) {
|
|
1167
|
-
let { errorMapKey: t } = e;
|
|
1168
|
-
for (let [n, r] of Object.entries(e.fieldErrors)) o[n] = {
|
|
1169
|
-
...o[n] || {},
|
|
1170
|
-
[t]: r
|
|
1171
|
-
};
|
|
1172
|
-
}
|
|
1173
|
-
}
|
|
1174
|
-
return this.baseStore.setState((e) => ({
|
|
1175
|
-
...e,
|
|
1176
|
-
isFormValidating: !1
|
|
1177
|
-
})), o;
|
|
1178
|
-
}, this.validate = (e, t) => {
|
|
1179
|
-
let { hasErrored: n, fieldsErrorMap: r } = this.validateSync(e, t);
|
|
1180
|
-
return n && !this.options.asyncAlways ? r : this.validateAsync(e, t);
|
|
1181
|
-
}, this._handleSubmit = async (e) => {
|
|
1182
|
-
this.baseStore.setState((e) => ({
|
|
1183
|
-
...e,
|
|
1184
|
-
isSubmitted: !1,
|
|
1185
|
-
submissionAttempts: e.submissionAttempts + 1,
|
|
1186
|
-
isSubmitSuccessful: !1
|
|
1187
|
-
})), k(() => {
|
|
1188
|
-
Object.values(this.fieldInfo).forEach((e) => {
|
|
1189
|
-
e.instance && (e.instance.store.state.meta.isTouched || e.instance.setMeta((e) => ({
|
|
1190
|
-
...e,
|
|
1191
|
-
isTouched: !0
|
|
1192
|
-
})));
|
|
1193
|
-
});
|
|
1194
|
-
});
|
|
1195
|
-
let t = e ?? this.options.onSubmitMeta;
|
|
1196
|
-
if (!this.state.canSubmit && !this._devtoolsSubmissionOverride) {
|
|
1197
|
-
this.options.onSubmitInvalid?.({
|
|
1198
|
-
value: this.state.values,
|
|
1199
|
-
formApi: this,
|
|
1200
|
-
meta: t
|
|
1201
|
-
});
|
|
1202
|
-
return;
|
|
1203
|
-
}
|
|
1204
|
-
this.baseStore.setState((e) => ({
|
|
1205
|
-
...e,
|
|
1206
|
-
isSubmitting: !0
|
|
1207
|
-
}));
|
|
1208
|
-
let n = () => {
|
|
1209
|
-
this.baseStore.setState((e) => ({
|
|
1210
|
-
...e,
|
|
1211
|
-
isSubmitting: !1
|
|
1212
|
-
}));
|
|
1213
|
-
};
|
|
1214
|
-
if (await this.validateAllFields("submit"), !this.state.isFieldsValid) {
|
|
1215
|
-
n(), this.options.onSubmitInvalid?.({
|
|
1216
|
-
value: this.state.values,
|
|
1217
|
-
formApi: this,
|
|
1218
|
-
meta: t
|
|
1219
|
-
}), M.emit("form-submission", {
|
|
1220
|
-
id: this._formId,
|
|
1221
|
-
submissionAttempt: this.state.submissionAttempts,
|
|
1222
|
-
successful: !1,
|
|
1223
|
-
stage: "validateAllFields",
|
|
1224
|
-
errors: Object.values(this.state.fieldMeta).map((e) => e.errors).flat()
|
|
1225
|
-
});
|
|
1226
|
-
return;
|
|
1227
|
-
}
|
|
1228
|
-
if (await this.validate("submit"), !this.state.isValid) {
|
|
1229
|
-
n(), this.options.onSubmitInvalid?.({
|
|
1230
|
-
value: this.state.values,
|
|
1231
|
-
formApi: this,
|
|
1232
|
-
meta: t
|
|
1233
|
-
}), M.emit("form-submission", {
|
|
1234
|
-
id: this._formId,
|
|
1235
|
-
submissionAttempt: this.state.submissionAttempts,
|
|
1236
|
-
successful: !1,
|
|
1237
|
-
stage: "validate",
|
|
1238
|
-
errors: this.state.errors
|
|
1239
|
-
});
|
|
1240
|
-
return;
|
|
1241
|
-
}
|
|
1242
|
-
k(() => {
|
|
1243
|
-
Object.values(this.fieldInfo).forEach((e) => {
|
|
1244
|
-
e.instance?.triggerOnSubmitListener();
|
|
1245
|
-
});
|
|
1246
|
-
}), this.options.listeners?.onSubmit?.({
|
|
1247
|
-
formApi: this,
|
|
1248
|
-
meta: t
|
|
1249
|
-
});
|
|
1250
|
-
try {
|
|
1251
|
-
await this.options.onSubmit?.({
|
|
1252
|
-
value: this.state.values,
|
|
1253
|
-
formApi: this,
|
|
1254
|
-
meta: t
|
|
1255
|
-
}), k(() => {
|
|
1256
|
-
this.baseStore.setState((e) => ({
|
|
1257
|
-
...e,
|
|
1258
|
-
isSubmitted: !0,
|
|
1259
|
-
isSubmitSuccessful: !0
|
|
1260
|
-
})), M.emit("form-submission", {
|
|
1261
|
-
id: this._formId,
|
|
1262
|
-
submissionAttempt: this.state.submissionAttempts,
|
|
1263
|
-
successful: !0
|
|
1264
|
-
}), n();
|
|
1265
|
-
});
|
|
1266
|
-
} catch (e) {
|
|
1267
|
-
throw this.baseStore.setState((e) => ({
|
|
1268
|
-
...e,
|
|
1269
|
-
isSubmitSuccessful: !1
|
|
1270
|
-
})), M.emit("form-submission", {
|
|
1271
|
-
id: this._formId,
|
|
1272
|
-
submissionAttempt: this.state.submissionAttempts,
|
|
1273
|
-
successful: !1,
|
|
1274
|
-
stage: "inflight",
|
|
1275
|
-
onError: e
|
|
1276
|
-
}), n(), e;
|
|
1277
|
-
}
|
|
1278
|
-
}, this.getFieldValue = (e) => P(this.state.values, e), this.getFieldMeta = (e) => this.state.fieldMeta[e], this.getFormGroupMeta = (e) => this.formGroupMetaDerived.state[e], this.getFieldInfo = (e) => this.fieldInfo[e] ||= {
|
|
1279
|
-
instance: null,
|
|
1280
|
-
validationMetaMap: {
|
|
1281
|
-
onChange: void 0,
|
|
1282
|
-
onBlur: void 0,
|
|
1283
|
-
onSubmit: void 0,
|
|
1284
|
-
onMount: void 0,
|
|
1285
|
-
onServer: void 0,
|
|
1286
|
-
onDynamic: void 0
|
|
1287
|
-
}
|
|
1288
|
-
}, this.setFieldMeta = (e, t) => {
|
|
1289
|
-
this.baseStore.setState((n) => ({
|
|
1290
|
-
...n,
|
|
1291
|
-
fieldMetaBase: {
|
|
1292
|
-
...n.fieldMetaBase,
|
|
1293
|
-
[e]: N(t, n.fieldMetaBase[e])
|
|
1294
|
-
}
|
|
1295
|
-
}));
|
|
1296
|
-
}, this.resetFieldMeta = (e) => Object.keys(e).reduce((e, t) => {
|
|
1297
|
-
let n = t;
|
|
1298
|
-
return e[n] = q, e;
|
|
1299
|
-
}, {}), this.setFieldValue = (e, t, n) => {
|
|
1300
|
-
let r = n?.dontUpdateMeta ?? !1, i = n?.dontRunListeners ?? !1, a = n?.dontValidate ?? !1;
|
|
1301
|
-
k(() => {
|
|
1302
|
-
r || this.setFieldMeta(e, (e) => ({
|
|
1303
|
-
...e,
|
|
1304
|
-
isTouched: !0,
|
|
1305
|
-
isDirty: !0,
|
|
1306
|
-
errorMap: {
|
|
1307
|
-
...e?.errorMap,
|
|
1308
|
-
onMount: void 0
|
|
1309
|
-
}
|
|
1310
|
-
})), this.baseStore.setState((n) => ({
|
|
1311
|
-
...n,
|
|
1312
|
-
values: F(n.values, e, t)
|
|
1313
|
-
}));
|
|
1314
|
-
}), i || this.getFieldInfo(e).instance?.triggerOnChangeListener(), a || this.validateField(e, "change");
|
|
1315
|
-
}, this.deleteField = (e) => {
|
|
1316
|
-
let t = [...Object.keys(this.fieldInfo).filter((t) => {
|
|
1317
|
-
let n = e.toString();
|
|
1318
|
-
return t !== n && t.startsWith(n);
|
|
1319
|
-
}), e];
|
|
1320
|
-
this.baseStore.setState((e) => {
|
|
1321
|
-
let n = { ...e };
|
|
1322
|
-
return t.forEach((e) => {
|
|
1323
|
-
n.values = ao(n.values, e), delete this.fieldInfo[e], delete n.fieldMetaBase[e];
|
|
1324
|
-
}), n;
|
|
1325
|
-
});
|
|
1326
|
-
}, this.pushFieldValue = (e, t, n) => {
|
|
1327
|
-
this.setFieldValue(e, (e) => [...Array.isArray(e) ? e : [], t], n), J(this).bumpArrayVersion(e);
|
|
1328
|
-
}, this.insertFieldValue = async (e, t, n, r) => {
|
|
1329
|
-
this.setFieldValue(e, (e) => [
|
|
1330
|
-
...e.slice(0, t),
|
|
1331
|
-
n,
|
|
1332
|
-
...e.slice(t)
|
|
1333
|
-
], z(r, { dontValidate: !0 }));
|
|
1334
|
-
let i = r?.dontValidate ?? !1;
|
|
1335
|
-
i || await this.validateField(e, "change"), J(this).handleArrayInsert(e, t), i || await this.validateArrayFieldsStartingFrom(e, t, "change");
|
|
1336
|
-
}, this.replaceFieldValue = async (e, t, n, r) => {
|
|
1337
|
-
this.setFieldValue(e, (e) => e.map((e, r) => r === t ? n : e), z(r, { dontValidate: !0 })), J(this).bumpArrayVersion(e), (r?.dontValidate ?? !1) || (await this.validateField(e, "change"), await this.validateArrayFieldsStartingFrom(e, t, "change"));
|
|
1338
|
-
}, this.removeFieldValue = async (e, t, n) => {
|
|
1339
|
-
let r = this.getFieldValue(e), i = Array.isArray(r) ? Math.max(r.length - 1, 0) : null;
|
|
1340
|
-
if (this.setFieldValue(e, (e) => e.filter((e, n) => n !== t), z(n, { dontValidate: !0 })), J(this).handleArrayRemove(e, t), i !== null) {
|
|
1341
|
-
let t = `${e}[${i}]`;
|
|
1342
|
-
this.deleteField(t);
|
|
1343
|
-
}
|
|
1344
|
-
(n?.dontValidate ?? !1) || (await this.validateField(e, "change"), await this.validateArrayFieldsStartingFrom(e, t, "change"));
|
|
1345
|
-
}, this.swapFieldValues = (e, t, n, r) => {
|
|
1346
|
-
this.setFieldValue(e, (e) => {
|
|
1347
|
-
let r = e[t], i = e[n];
|
|
1348
|
-
return F(F(e, `${t}`, i), `${n}`, r);
|
|
1349
|
-
}, z(r, { dontValidate: !0 })), J(this).handleArraySwap(e, t, n), (r?.dontValidate ?? !1) || (this.validateField(e, "change"), this.validateField(`${e}[${t}]`, "change"), this.validateField(`${e}[${n}]`, "change"));
|
|
1350
|
-
}, this.moveFieldValues = (e, t, n, r) => {
|
|
1351
|
-
this.setFieldValue(e, (e) => {
|
|
1352
|
-
let r = [...e];
|
|
1353
|
-
return r.splice(n, 0, r.splice(t, 1)[0]), r;
|
|
1354
|
-
}, z(r, { dontValidate: !0 })), J(this).handleArrayMove(e, t, n), (r?.dontValidate ?? !1) || (this.validateField(e, "change"), this.validateField(`${e}[${t}]`, "change"), this.validateField(`${e}[${n}]`, "change"));
|
|
1355
|
-
}, this.clearFieldValues = (e, t) => {
|
|
1356
|
-
let n = this.getFieldValue(e), r = Array.isArray(n) ? Math.max(n.length - 1, 0) : null;
|
|
1357
|
-
if (this.setFieldValue(e, [], z(t, { dontValidate: !0 })), J(this).bumpArrayVersion(e), r !== null) for (let t = 0; t <= r; t++) {
|
|
1358
|
-
let n = `${e}[${t}]`;
|
|
1359
|
-
this.deleteField(n);
|
|
1360
|
-
}
|
|
1361
|
-
(t?.dontValidate ?? !1) || this.validateField(e, "change");
|
|
1362
|
-
}, this.resetField = (e) => {
|
|
1363
|
-
this.baseStore.setState((t) => {
|
|
1364
|
-
let n = this.getFieldInfo(e).instance?.options.defaultValue, r = P(this.options.defaultValues, e), i = n ?? r;
|
|
1365
|
-
return {
|
|
1366
|
-
...t,
|
|
1367
|
-
fieldMetaBase: {
|
|
1368
|
-
...t.fieldMetaBase,
|
|
1369
|
-
[e]: q
|
|
1370
|
-
},
|
|
1371
|
-
values: i === void 0 ? t.values : F(t.values, e, i)
|
|
1372
|
-
};
|
|
1373
|
-
});
|
|
1374
|
-
}, this.setErrorMap = (e) => {
|
|
1375
|
-
k(() => {
|
|
1376
|
-
Object.entries(e).forEach(([e, t]) => {
|
|
1377
|
-
let n = e;
|
|
1378
|
-
if (ho(t)) {
|
|
1379
|
-
let { formError: e, fieldErrors: r } = To(t);
|
|
1380
|
-
for (let e of Object.keys(this.fieldInfo)) this.getFieldMeta(e) && this.setFieldMeta(e, (t) => ({
|
|
1381
|
-
...t,
|
|
1382
|
-
errorMap: {
|
|
1383
|
-
...t.errorMap,
|
|
1384
|
-
[n]: r?.[e]
|
|
1385
|
-
},
|
|
1386
|
-
errorSourceMap: {
|
|
1387
|
-
...t.errorSourceMap,
|
|
1388
|
-
[n]: "form"
|
|
1389
|
-
}
|
|
1390
|
-
}));
|
|
1391
|
-
this.baseStore.setState((t) => ({
|
|
1392
|
-
...t,
|
|
1393
|
-
errorMap: {
|
|
1394
|
-
...t.errorMap,
|
|
1395
|
-
[n]: e
|
|
1396
|
-
}
|
|
1397
|
-
}));
|
|
1398
|
-
} else this.baseStore.setState((e) => ({
|
|
1399
|
-
...e,
|
|
1400
|
-
errorMap: {
|
|
1401
|
-
...e.errorMap,
|
|
1402
|
-
[n]: t
|
|
1403
|
-
}
|
|
1404
|
-
}));
|
|
1405
|
-
});
|
|
1406
|
-
});
|
|
1407
|
-
}, this.getAllErrors = () => ({
|
|
1408
|
-
form: {
|
|
1409
|
-
errors: this.state.errors,
|
|
1410
|
-
errorMap: this.state.errorMap
|
|
1411
|
-
},
|
|
1412
|
-
fields: Object.entries(this.state.fieldMeta).reduce((e, [t, n]) => (Object.keys(n).length && n.errors.length && (e[t] = {
|
|
1413
|
-
errors: n.errors,
|
|
1414
|
-
errorMap: n.errorMap
|
|
1415
|
-
}), e), {})
|
|
1416
|
-
}), this.parseValuesWithSchema = (e) => K.validate({
|
|
1417
|
-
value: this.state.values,
|
|
1418
|
-
validationSource: "form"
|
|
1419
|
-
}, e), this.parseValuesWithSchemaAsync = (e) => K.validateAsync({
|
|
1420
|
-
value: this.state.values,
|
|
1421
|
-
validationSource: "form"
|
|
1422
|
-
}, e), this.timeoutIds = {
|
|
1423
|
-
validations: {},
|
|
1424
|
-
listeners: {},
|
|
1425
|
-
formListeners: {}
|
|
1426
|
-
}, this._formId = e?.formId ?? vo(), this._devtoolsSubmissionOverride = !1;
|
|
1427
|
-
let t = Co({
|
|
1428
|
-
...e?.defaultState,
|
|
1429
|
-
values: e?.defaultValues ?? e?.defaultState?.values
|
|
1430
|
-
});
|
|
1431
|
-
if (e?.transform) {
|
|
1432
|
-
t = e.transform({ state: t }).state;
|
|
1433
|
-
for (let e of Object.keys(t.errorMap)) {
|
|
1434
|
-
let n = t.errorMap[e];
|
|
1435
|
-
if (!(n === void 0 || !ho(n))) for (let r of Object.keys(n.fields)) {
|
|
1436
|
-
let i = n.fields[r];
|
|
1437
|
-
if (i === void 0) continue;
|
|
1438
|
-
let a = t.fieldMetaBase[r];
|
|
1439
|
-
t.fieldMetaBase[r] = {
|
|
1440
|
-
isTouched: !1,
|
|
1441
|
-
isValidating: !1,
|
|
1442
|
-
isBlurred: !1,
|
|
1443
|
-
isDirty: !1,
|
|
1444
|
-
_arrayVersion: 0,
|
|
1445
|
-
...a ?? {},
|
|
1446
|
-
errorSourceMap: {
|
|
1447
|
-
...a?.errorSourceMap ?? {},
|
|
1448
|
-
onChange: "form"
|
|
1449
|
-
},
|
|
1450
|
-
errorMap: {
|
|
1451
|
-
...a?.errorMap ?? {},
|
|
1452
|
-
[e]: i
|
|
1453
|
-
}
|
|
1454
|
-
};
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
}
|
|
1458
|
-
this.baseStore = j(t);
|
|
1459
|
-
let n;
|
|
1460
|
-
this.fieldMetaDerived = j((e) => {
|
|
1461
|
-
let t = this.baseStore.get(), r = 0, i = {};
|
|
1462
|
-
for (let a of Object.keys(t.fieldMetaBase)) {
|
|
1463
|
-
let o = t.fieldMetaBase[a], s = n?.fieldMetaBase[a], c = e?.[a], l = P(t.values, a), u = c?.errors;
|
|
1464
|
-
if (!s || o.errorMap !== s.errorMap) {
|
|
1465
|
-
u = Object.values(o.errorMap ?? {}).filter((e) => e !== void 0);
|
|
1466
|
-
let e = this.getFieldInfo(a)?.instance;
|
|
1467
|
-
(!e || !e.options.disableErrorFlat) && (u = u.flat(1));
|
|
1468
|
-
}
|
|
1469
|
-
let d = !mo(u), f = !o.isDirty, p = R(l, this.getFieldInfo(a)?.instance?.options.defaultValue ?? P(this.options.defaultValues, a));
|
|
1470
|
-
if (c && c.isPristine === f && c.isValid === d && c.isDefaultValue === p && c.errors === u && o === s) {
|
|
1471
|
-
i[a] = c, r++;
|
|
1472
|
-
continue;
|
|
1473
|
-
}
|
|
1474
|
-
i[a] = {
|
|
1475
|
-
...o,
|
|
1476
|
-
errors: u ?? [],
|
|
1477
|
-
isPristine: f,
|
|
1478
|
-
isValid: d,
|
|
1479
|
-
isDefaultValue: p
|
|
1480
|
-
};
|
|
1481
|
-
}
|
|
1482
|
-
return Object.keys(t.fieldMetaBase).length ? e && r === Object.keys(t.fieldMetaBase).length ? e : (n = this.baseStore.get(), i) : i;
|
|
1483
|
-
}), this.formGroupMetaDerived = j((e) => {
|
|
1484
|
-
let t = this.baseStore.get(), n = this.fieldMetaDerived.get(), r = {};
|
|
1485
|
-
for (let i of this.formGroupApis) {
|
|
1486
|
-
let a = i.name, o = t.formGroupStateBase[a] ?? {
|
|
1487
|
-
isSubmitted: !1,
|
|
1488
|
-
isSubmitting: !1,
|
|
1489
|
-
isValidating: !1,
|
|
1490
|
-
submissionAttempts: 0,
|
|
1491
|
-
isSubmitSuccessful: !1
|
|
1492
|
-
}, s = n[a], c = !1, l = !0, u = !1, d = !1, f = !0, p = !1;
|
|
1493
|
-
for (let e in n) {
|
|
1494
|
-
if (e === a || !W(a, e)) continue;
|
|
1495
|
-
let t = n[e];
|
|
1496
|
-
t && (t.isValidating && (c = !0), t.isValid || (l = !1), t.isTouched && (u = !0), t.isBlurred && (d = !0), t.isDefaultValue || (f = !1), t.isDirty && (p = !0));
|
|
1497
|
-
}
|
|
1498
|
-
let m = !p, h = !!c || o.isValidating, g = s?.errorMap ?? {}, _ = s?.errorSourceMap ?? {}, v = !!(g.onMount || Object.entries(n).some(([e, t]) => t && e !== a && W(a, e) && t.errorMap.onMount)), y = e?.[a], b = y?.errors ?? [];
|
|
1499
|
-
(!y || y.__srcErrorMap !== g) && (b = Object.values(g).reduce((e, t) => {
|
|
1500
|
-
if (t === void 0) return e;
|
|
1501
|
-
if (t && typeof t == "object" && "fields" in t) {
|
|
1502
|
-
let n = t.group;
|
|
1503
|
-
return n !== void 0 && e.push(n), e;
|
|
1504
|
-
}
|
|
1505
|
-
return e.push(t), e;
|
|
1506
|
-
}, []));
|
|
1507
|
-
let x = b.length === 0, ee = l && x, te = i.options.canSubmitWhenInvalid ?? !1, ne = o.submissionAttempts === 0 && !u && !v || !h && !o.isSubmitting && ee || te;
|
|
1508
|
-
if (y && y.errorMap === g && y.errorSourceMap === _ && y.errors === b && y.isFieldsValidating === c && y.isFieldsValid === l && y.isGroupValid === x && y.isValid === ee && y.canSubmit === ne && y.isTouched === u && y.isBlurred === d && y.isPristine === m && y.isDefaultValue === f && y.isDirty === p && y.isValidating === h && y.isSubmitting === o.isSubmitting && y.isSubmitted === o.isSubmitted && y.submissionAttempts === o.submissionAttempts && y.isSubmitSuccessful === o.isSubmitSuccessful) {
|
|
1509
|
-
r[a] = y;
|
|
1510
|
-
continue;
|
|
1511
|
-
}
|
|
1512
|
-
let re = {
|
|
1513
|
-
...o,
|
|
1514
|
-
errorMap: g,
|
|
1515
|
-
errorSourceMap: _,
|
|
1516
|
-
_arrayVersion: s?._arrayVersion ?? 0,
|
|
1517
|
-
isTouched: u,
|
|
1518
|
-
isBlurred: d,
|
|
1519
|
-
isDirty: p,
|
|
1520
|
-
isPristine: m,
|
|
1521
|
-
isDefaultValue: f,
|
|
1522
|
-
isValid: ee,
|
|
1523
|
-
errors: b,
|
|
1524
|
-
isValidating: h,
|
|
1525
|
-
isFieldsValidating: c,
|
|
1526
|
-
isFieldsValid: l,
|
|
1527
|
-
isGroupValid: x,
|
|
1528
|
-
canSubmit: ne
|
|
1529
|
-
};
|
|
1530
|
-
Object.defineProperty(re, "__srcErrorMap", {
|
|
1531
|
-
value: g,
|
|
1532
|
-
enumerable: !1,
|
|
1533
|
-
configurable: !0
|
|
1534
|
-
}), r[a] = re;
|
|
1535
|
-
}
|
|
1536
|
-
return r;
|
|
1537
|
-
});
|
|
1538
|
-
let r;
|
|
1539
|
-
this.store = j((e) => {
|
|
1540
|
-
let t = this.baseStore.get(), n = this.fieldMetaDerived.get(), i = Object.values(n).filter(Boolean), a = i.some((e) => e.isValidating), o = i.every((e) => e.isValid), s = i.some((e) => e.isTouched), c = i.some((e) => e.isBlurred), l = i.every((e) => e.isDefaultValue), u = s && t.errorMap?.onMount, d = i.some((e) => e.isDirty), f = !d, p = !!(t.errorMap?.onMount || i.some((e) => e?.errorMap?.onMount)), m = !!a, h = e?.errors ?? [];
|
|
1541
|
-
(!r || t.errorMap !== r.errorMap) && (h = Object.values(t.errorMap).reduce((e, t) => t === void 0 ? e : t && ho(t) ? (e.push(t.form), e) : (e.push(t), e), []));
|
|
1542
|
-
let g = h.length === 0, _ = o && g, v = this.options.canSubmitWhenInvalid ?? !1, y = t.submissionAttempts === 0 && !s && !p || !m && !t.isSubmitting && _ || v, b = t.errorMap;
|
|
1543
|
-
if (u && (h = h.filter((e) => e !== t.errorMap.onMount), b = Object.assign(b, { onMount: void 0 })), e && r && e.errorMap === b && e.fieldMeta === this.fieldMetaDerived.state && e.errors === h && e.isFieldsValidating === a && e.isFieldsValid === o && e.isFormValid === g && e.isValid === _ && e.canSubmit === y && e.isTouched === s && e.isBlurred === c && e.isPristine === f && e.isDefaultValue === l && e.isDirty === d && R(r, t)) return e;
|
|
1544
|
-
let x = {
|
|
1545
|
-
...t,
|
|
1546
|
-
errorMap: b,
|
|
1547
|
-
fieldMeta: this.fieldMetaDerived.state,
|
|
1548
|
-
errors: h,
|
|
1549
|
-
isFieldsValidating: a,
|
|
1550
|
-
isFieldsValid: o,
|
|
1551
|
-
isFormValid: g,
|
|
1552
|
-
isValid: _,
|
|
1553
|
-
canSubmit: y,
|
|
1554
|
-
isTouched: s,
|
|
1555
|
-
isBlurred: c,
|
|
1556
|
-
isPristine: f,
|
|
1557
|
-
isDefaultValue: l,
|
|
1558
|
-
isDirty: d
|
|
1559
|
-
};
|
|
1560
|
-
return r = this.baseStore.get(), x;
|
|
1561
|
-
}), this.handleSubmit = this.handleSubmit.bind(this), this.update(e || {});
|
|
1562
|
-
}
|
|
1563
|
-
get state() {
|
|
1564
|
-
return this.store.state;
|
|
1565
|
-
}
|
|
1566
|
-
get formId() {
|
|
1567
|
-
return this._formId;
|
|
1568
|
-
}
|
|
1569
|
-
runValidator(e) {
|
|
1570
|
-
return So(e.validate) ? K[e.type](e.value, e.validate) : e.validate(e.value);
|
|
1571
|
-
}
|
|
1572
|
-
handleSubmit(e) {
|
|
1573
|
-
return this._handleSubmit(e);
|
|
1574
|
-
}
|
|
1575
|
-
};
|
|
1576
|
-
function To(e) {
|
|
1577
|
-
return e ? ho(e) ? {
|
|
1578
|
-
formError: To(e.form).formError,
|
|
1579
|
-
fieldErrors: e.fields
|
|
1580
|
-
} : { formError: e } : { formError: void 0 };
|
|
1581
|
-
}
|
|
1582
|
-
function Y(e) {
|
|
1583
|
-
switch (e) {
|
|
1584
|
-
case "submit": return "onSubmit";
|
|
1585
|
-
case "blur": return "onBlur";
|
|
1586
|
-
case "mount": return "onMount";
|
|
1587
|
-
case "server": return "onServer";
|
|
1588
|
-
case "dynamic": return "onDynamic";
|
|
1589
|
-
default: return "onChange";
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
//#endregion
|
|
1593
|
-
//#region node_modules/@tanstack/form-core/dist/esm/FieldApi.js
|
|
1594
|
-
var Eo = class e {
|
|
1595
|
-
constructor(t) {
|
|
1596
|
-
this.options = {}, this.mount = () => {
|
|
1597
|
-
this.options.defaultValue !== void 0 && !this.getMeta().isTouched && this.form.setFieldValue(this.name, this.options.defaultValue, { dontUpdateMeta: !0 });
|
|
1598
|
-
let e = this.getInfo();
|
|
1599
|
-
e.instance = this, this.update(this.options);
|
|
1600
|
-
let { onMount: t } = this.options.validators || {};
|
|
1601
|
-
if (t) {
|
|
1602
|
-
let e = this.runValidator({
|
|
1603
|
-
validate: t,
|
|
1604
|
-
value: {
|
|
1605
|
-
value: this.state.value,
|
|
1606
|
-
fieldApi: this,
|
|
1607
|
-
validationSource: "field"
|
|
1608
|
-
},
|
|
1609
|
-
type: "validate"
|
|
1610
|
-
});
|
|
1611
|
-
e && this.setMeta((t) => ({
|
|
1612
|
-
...t,
|
|
1613
|
-
errorMap: {
|
|
1614
|
-
...t?.errorMap,
|
|
1615
|
-
onMount: e
|
|
1616
|
-
},
|
|
1617
|
-
errorSourceMap: {
|
|
1618
|
-
...t?.errorSourceMap,
|
|
1619
|
-
onMount: "field"
|
|
1620
|
-
}
|
|
1621
|
-
}));
|
|
1622
|
-
}
|
|
1623
|
-
return this.options.listeners?.onMount?.({
|
|
1624
|
-
value: this.state.value,
|
|
1625
|
-
fieldApi: this
|
|
1626
|
-
}), () => {
|
|
1627
|
-
for (let [e, t] of Object.entries(this.timeoutIds.validations)) t && (clearTimeout(t), this.timeoutIds.validations[e] = null);
|
|
1628
|
-
for (let [e, t] of Object.entries(this.timeoutIds.listeners)) t && (clearTimeout(t), this.timeoutIds.listeners[e] = null);
|
|
1629
|
-
for (let [e, t] of Object.entries(this.timeoutIds.formListeners)) t && (clearTimeout(t), this.timeoutIds.formListeners[e] = null);
|
|
1630
|
-
let e = this.form.fieldInfo[this.name];
|
|
1631
|
-
if (e && e.instance === this) {
|
|
1632
|
-
for (let [t, n] of Object.entries(e.validationMetaMap)) n?.lastAbortController.abort(), e.validationMetaMap[t] = void 0;
|
|
1633
|
-
this.form.baseStore.setState((e) => ({
|
|
1634
|
-
...e,
|
|
1635
|
-
fieldMetaBase: {
|
|
1636
|
-
...e.fieldMetaBase,
|
|
1637
|
-
[this.name]: {
|
|
1638
|
-
...q,
|
|
1639
|
-
isTouched: e.fieldMetaBase[this.name]?.isTouched ?? q.isTouched,
|
|
1640
|
-
isBlurred: e.fieldMetaBase[this.name]?.isBlurred ?? q.isBlurred,
|
|
1641
|
-
isDirty: e.fieldMetaBase[this.name]?.isDirty ?? q.isDirty
|
|
1642
|
-
}
|
|
1643
|
-
}
|
|
1644
|
-
})), e.instance = null, this.options.listeners?.onUnmount?.({
|
|
1645
|
-
value: this.state.value,
|
|
1646
|
-
fieldApi: this
|
|
1647
|
-
}), this.form.options.listeners?.onFieldUnmount?.({
|
|
1648
|
-
formApi: this.form,
|
|
1649
|
-
fieldApi: this
|
|
1650
|
-
});
|
|
1651
|
-
}
|
|
1652
|
-
};
|
|
1653
|
-
}, this.update = (e) => {
|
|
1654
|
-
this.options = e, this.name = e.name, !this.state.meta.isTouched && this.options.defaultValue !== void 0 && (R(this.form.getFieldValue(this.name), e.defaultValue) || this.form.setFieldValue(this.name, e.defaultValue, {
|
|
1655
|
-
dontUpdateMeta: !0,
|
|
1656
|
-
dontValidate: !0,
|
|
1657
|
-
dontRunListeners: !0
|
|
1658
|
-
})), this.form.getFieldMeta(this.name) || this.form.setFieldMeta(this.name, this.state.meta);
|
|
1659
|
-
}, this.getValue = () => this.form.getFieldValue(this.name), this.setValue = (e, t) => {
|
|
1660
|
-
this.form.setFieldValue(this.name, e, z(t, {
|
|
1661
|
-
dontRunListeners: !0,
|
|
1662
|
-
dontValidate: !0
|
|
1663
|
-
})), t?.dontRunListeners || this.triggerOnChangeListener(), t?.dontValidate || this.validate("change");
|
|
1664
|
-
}, this.getMeta = () => this.store.state.meta, this.setMeta = (e) => this.form.setFieldMeta(this.name, e), this.getInfo = () => this.form.getFieldInfo(this.name), this.pushValue = (e, t) => {
|
|
1665
|
-
this.form.pushFieldValue(this.name, e, z(t, { dontRunListeners: !0 })), t?.dontRunListeners || this.triggerOnChangeListener();
|
|
1666
|
-
}, this.insertValue = (e, t, n) => {
|
|
1667
|
-
this.form.insertFieldValue(this.name, e, t, z(n, { dontRunListeners: !0 })), n?.dontRunListeners || this.triggerOnChangeListener();
|
|
1668
|
-
}, this.replaceValue = (e, t, n) => {
|
|
1669
|
-
this.form.replaceFieldValue(this.name, e, t, z(n, { dontRunListeners: !0 })), n?.dontRunListeners || this.triggerOnChangeListener();
|
|
1670
|
-
}, this.removeValue = (e, t) => {
|
|
1671
|
-
this.form.removeFieldValue(this.name, e, z(t, { dontRunListeners: !0 })), t?.dontRunListeners || this.triggerOnChangeListener();
|
|
1672
|
-
}, this.swapValues = (e, t, n) => {
|
|
1673
|
-
this.form.swapFieldValues(this.name, e, t, z(n, { dontRunListeners: !0 })), n?.dontRunListeners || this.triggerOnChangeListener();
|
|
1674
|
-
}, this.moveValue = (e, t, n) => {
|
|
1675
|
-
this.form.moveFieldValues(this.name, e, t, z(n, { dontRunListeners: !0 })), n?.dontRunListeners || this.triggerOnChangeListener();
|
|
1676
|
-
}, this.clearValues = (e) => {
|
|
1677
|
-
this.form.clearFieldValues(this.name, z(e, { dontRunListeners: !0 })), e?.dontRunListeners || this.triggerOnChangeListener();
|
|
1678
|
-
}, this.getLinkedFields = (t) => {
|
|
1679
|
-
let n = Object.values(this.form.fieldInfo), r = [];
|
|
1680
|
-
for (let i of n) {
|
|
1681
|
-
if (!i.instance || !(i.instance instanceof e)) continue;
|
|
1682
|
-
let { onChangeListenTo: n, onBlurListenTo: a } = i.instance.options.validators || {};
|
|
1683
|
-
t === "change" && n?.includes(this.name) && r.push(i.instance), t === "blur" && a?.includes(this.name) && r.push(i.instance);
|
|
1684
|
-
}
|
|
1685
|
-
return r;
|
|
1686
|
-
}, this.validateSync = (e, t) => {
|
|
1687
|
-
let n = I(e, {
|
|
1688
|
-
...this.options,
|
|
1689
|
-
form: this.form,
|
|
1690
|
-
fieldName: this.name,
|
|
1691
|
-
validationLogic: this.form.options.validationLogic || G
|
|
1692
|
-
}), r = this.getLinkedFields(e).reduce((t, n) => {
|
|
1693
|
-
let r = I(e, {
|
|
1694
|
-
...n.options,
|
|
1695
|
-
form: n.form,
|
|
1696
|
-
fieldName: n.name,
|
|
1697
|
-
validationLogic: n.form.options.validationLogic || G
|
|
1698
|
-
});
|
|
1699
|
-
return r.forEach((e) => {
|
|
1700
|
-
e.field = n;
|
|
1701
|
-
}), t.concat(r);
|
|
1702
|
-
}, []), i = !1;
|
|
1703
|
-
k(() => {
|
|
1704
|
-
let e = (e, n) => {
|
|
1705
|
-
let r = X(n.cause), a = n.validate ? Do(e.runValidator({
|
|
1706
|
-
validate: n.validate,
|
|
1707
|
-
value: {
|
|
1708
|
-
value: e.store.state.value,
|
|
1709
|
-
validationSource: "field",
|
|
1710
|
-
fieldApi: e
|
|
1711
|
-
},
|
|
1712
|
-
type: "validate"
|
|
1713
|
-
})) : void 0, o = t[r], { newErrorValue: s, newSource: c } = _o({
|
|
1714
|
-
formLevelError: o,
|
|
1715
|
-
fieldLevelError: a
|
|
1716
|
-
});
|
|
1717
|
-
e.state.meta.errorMap?.[r] !== s && e.setMeta((e) => ({
|
|
1718
|
-
...e,
|
|
1719
|
-
errorMap: {
|
|
1720
|
-
...e.errorMap,
|
|
1721
|
-
[r]: s
|
|
1722
|
-
},
|
|
1723
|
-
errorSourceMap: {
|
|
1724
|
-
...e.errorSourceMap,
|
|
1725
|
-
[r]: c
|
|
1726
|
-
}
|
|
1727
|
-
})), s && (i = !0);
|
|
1728
|
-
};
|
|
1729
|
-
for (let t of n) e(this, t);
|
|
1730
|
-
for (let t of r) t.validate && e(t.field, t);
|
|
1731
|
-
});
|
|
1732
|
-
let a = X("submit");
|
|
1733
|
-
return this.state.meta.errorMap?.[a] && e !== "submit" && !i && this.setMeta((e) => ({
|
|
1734
|
-
...e,
|
|
1735
|
-
errorMap: {
|
|
1736
|
-
...e.errorMap,
|
|
1737
|
-
[a]: void 0
|
|
1738
|
-
},
|
|
1739
|
-
errorSourceMap: {
|
|
1740
|
-
...e.errorSourceMap,
|
|
1741
|
-
[a]: void 0
|
|
1742
|
-
}
|
|
1743
|
-
})), { hasErrored: i };
|
|
1744
|
-
}, this.validateAsync = async (e, t) => {
|
|
1745
|
-
let n = L(e, {
|
|
1746
|
-
...this.options,
|
|
1747
|
-
form: this.form,
|
|
1748
|
-
fieldName: this.name,
|
|
1749
|
-
validationLogic: this.form.options.validationLogic || G
|
|
1750
|
-
}), r = await t, i = this.getLinkedFields(e), a = i.reduce((t, n) => {
|
|
1751
|
-
let r = L(e, {
|
|
1752
|
-
...n.options,
|
|
1753
|
-
form: n.form,
|
|
1754
|
-
fieldName: n.name,
|
|
1755
|
-
validationLogic: n.form.options.validationLogic || G
|
|
1756
|
-
});
|
|
1757
|
-
return r.forEach((e) => {
|
|
1758
|
-
e.field = n;
|
|
1759
|
-
}), t.concat(r);
|
|
1760
|
-
}, []), o = [], s = [], c = n.some((e) => e.validate) || a.some((e) => e.validate);
|
|
1761
|
-
if (c) {
|
|
1762
|
-
this.state.meta.isValidating || this.setMeta((e) => ({
|
|
1763
|
-
...e,
|
|
1764
|
-
isValidating: !0
|
|
1765
|
-
}));
|
|
1766
|
-
for (let e of i) e.setMeta((e) => ({
|
|
1767
|
-
...e,
|
|
1768
|
-
isValidating: !0
|
|
1769
|
-
}));
|
|
1770
|
-
}
|
|
1771
|
-
let l = (e, t, n) => {
|
|
1772
|
-
let i = X(t.cause), a = e.getInfo();
|
|
1773
|
-
a.validationMetaMap[i]?.lastAbortController.abort();
|
|
1774
|
-
let o = new AbortController();
|
|
1775
|
-
a.validationMetaMap[i] = { lastAbortController: o }, n.push(new Promise(async (n) => {
|
|
1776
|
-
let a;
|
|
1777
|
-
try {
|
|
1778
|
-
a = await new Promise((n, r) => {
|
|
1779
|
-
e.timeoutIds.validations[t.cause] && clearTimeout(e.timeoutIds.validations[t.cause]), e.timeoutIds.validations[t.cause] = setTimeout(async () => {
|
|
1780
|
-
if (o.signal.aborted) return n(void 0);
|
|
1781
|
-
try {
|
|
1782
|
-
n(await this.runValidator({
|
|
1783
|
-
validate: t.validate,
|
|
1784
|
-
value: {
|
|
1785
|
-
value: e.store.state.value,
|
|
1786
|
-
fieldApi: e,
|
|
1787
|
-
signal: o.signal,
|
|
1788
|
-
validationSource: "field"
|
|
1789
|
-
},
|
|
1790
|
-
type: "validateAsync"
|
|
1791
|
-
}));
|
|
1792
|
-
} catch (e) {
|
|
1793
|
-
r(e);
|
|
1794
|
-
}
|
|
1795
|
-
}, t.debounceMs);
|
|
1796
|
-
});
|
|
1797
|
-
} catch (e) {
|
|
1798
|
-
a = e;
|
|
1799
|
-
}
|
|
1800
|
-
if (o.signal.aborted) return n(void 0);
|
|
1801
|
-
let s = Do(a), c = r[e.name]?.[i], { newErrorValue: l, newSource: u } = _o({
|
|
1802
|
-
formLevelError: c,
|
|
1803
|
-
fieldLevelError: s
|
|
1804
|
-
});
|
|
1805
|
-
if (e.getInfo().instance !== e) return n(void 0);
|
|
1806
|
-
e.setMeta((e) => ({
|
|
1807
|
-
...e,
|
|
1808
|
-
errorMap: {
|
|
1809
|
-
...e?.errorMap,
|
|
1810
|
-
[i]: l
|
|
1811
|
-
},
|
|
1812
|
-
errorSourceMap: {
|
|
1813
|
-
...e.errorSourceMap,
|
|
1814
|
-
[i]: u
|
|
1815
|
-
}
|
|
1816
|
-
})), n(l);
|
|
1817
|
-
}));
|
|
1818
|
-
};
|
|
1819
|
-
for (let e of n) e.validate && l(this, e, o);
|
|
1820
|
-
for (let e of a) e.validate && l(e.field, e, s);
|
|
1821
|
-
let u = [];
|
|
1822
|
-
if ((o.length || s.length) && (u = await Promise.all(o), await Promise.all(s)), c) {
|
|
1823
|
-
this.setMeta((e) => ({
|
|
1824
|
-
...e,
|
|
1825
|
-
isValidating: !1
|
|
1826
|
-
}));
|
|
1827
|
-
for (let e of i) e.setMeta((e) => ({
|
|
1828
|
-
...e,
|
|
1829
|
-
isValidating: !1
|
|
1830
|
-
}));
|
|
1831
|
-
}
|
|
1832
|
-
return u.filter(Boolean);
|
|
1833
|
-
}, this.validate = (e, t) => {
|
|
1834
|
-
if (!this.state.meta.isTouched) return [];
|
|
1835
|
-
let n = t?.skipGroupValidation ? [] : Array.from(this.form.formGroupApis).filter((e) => this.name.startsWith(e.name)), r = (t?.skipFormValidation ? { fieldsErrorMap: {} } : this.form.validateSync(e)).fieldsErrorMap[this.name] ?? {};
|
|
1836
|
-
if (!t?.skipFormValidation) for (let t of n) {
|
|
1837
|
-
if (t.state.meta.submissionAttempts === 0) continue;
|
|
1838
|
-
let { fieldsErrorMap: n } = this.form.validateSync(e, {
|
|
1839
|
-
group: t,
|
|
1840
|
-
dontUpdateFormErrorMap: !0,
|
|
1841
|
-
filterFieldNames: (e) => W(t.name, e)
|
|
1842
|
-
});
|
|
1843
|
-
r = {
|
|
1844
|
-
...r,
|
|
1845
|
-
...n[this.name] ?? {}
|
|
1846
|
-
};
|
|
1847
|
-
}
|
|
1848
|
-
let { hasErrored: i } = this.validateSync(e, r), a = /* @__PURE__ */ new WeakMap();
|
|
1849
|
-
for (let t of n) {
|
|
1850
|
-
let { hasErrored: n } = t.validateSync(e, {}, { skipRelatedFieldValidation: !0 });
|
|
1851
|
-
a.set(t, n);
|
|
1852
|
-
}
|
|
1853
|
-
if (i && !this.options.asyncAlways) {
|
|
1854
|
-
this.getInfo().validationMetaMap[X(e)]?.lastAbortController.abort();
|
|
1855
|
-
let t = [];
|
|
1856
|
-
for (let r of n) r.getInfo().validationMetaMap[X(e)]?.lastAbortController.abort(), t.push(r.state.meta.errors);
|
|
1857
|
-
return [...this.state.meta.errors, ...t.flat()];
|
|
1858
|
-
}
|
|
1859
|
-
let o = t?.skipFormValidation ? Promise.resolve({}) : this.form.validateAsync(e), s = this.validateAsync(e, o), c = [];
|
|
1860
|
-
for (let t of n) a.get(t) && !t.options.asyncAlways || c.push(t.validateAsync(e, o, { skipRelatedFieldValidation: !0 }));
|
|
1861
|
-
return c.length === 0 ? s : Promise.all([s, ...c]).then((e) => e.flat());
|
|
1862
|
-
}, this.handleChange = (e) => {
|
|
1863
|
-
this.setValue(e);
|
|
1864
|
-
}, this.handleBlur = () => {
|
|
1865
|
-
this.state.meta.isTouched || this.setMeta((e) => ({
|
|
1866
|
-
...e,
|
|
1867
|
-
isTouched: !0
|
|
1868
|
-
})), this.state.meta.isBlurred || this.setMeta((e) => ({
|
|
1869
|
-
...e,
|
|
1870
|
-
isBlurred: !0
|
|
1871
|
-
})), this.validate("blur"), this.triggerOnBlurListener();
|
|
1872
|
-
}, this.setErrorMap = (e) => {
|
|
1873
|
-
this.setMeta((t) => ({
|
|
1874
|
-
...t,
|
|
1875
|
-
errorMap: {
|
|
1876
|
-
...t.errorMap,
|
|
1877
|
-
...e
|
|
1878
|
-
}
|
|
1879
|
-
}));
|
|
1880
|
-
}, this.parseValueWithSchema = (e) => K.validate({
|
|
1881
|
-
value: this.state.value,
|
|
1882
|
-
validationSource: "field"
|
|
1883
|
-
}, e), this.parseValueWithSchemaAsync = (e) => K.validateAsync({
|
|
1884
|
-
value: this.state.value,
|
|
1885
|
-
validationSource: "field"
|
|
1886
|
-
}, e), this.triggerOnBlurListener = () => {
|
|
1887
|
-
let e = this.form.options.listeners?.onBlurDebounceMs;
|
|
1888
|
-
e && e > 0 ? (this.timeoutIds.formListeners.blur && clearTimeout(this.timeoutIds.formListeners.blur), this.timeoutIds.formListeners.blur = setTimeout(() => {
|
|
1889
|
-
this.form.options.listeners?.onBlur?.({
|
|
1890
|
-
formApi: this.form,
|
|
1891
|
-
fieldApi: this
|
|
1892
|
-
});
|
|
1893
|
-
}, e)) : this.form.options.listeners?.onBlur?.({
|
|
1894
|
-
formApi: this.form,
|
|
1895
|
-
fieldApi: this
|
|
1896
|
-
});
|
|
1897
|
-
let t = this.options.listeners?.onBlurDebounceMs;
|
|
1898
|
-
t && t > 0 ? (this.timeoutIds.listeners.blur && clearTimeout(this.timeoutIds.listeners.blur), this.timeoutIds.listeners.blur = setTimeout(() => {
|
|
1899
|
-
this.options.listeners?.onBlur?.({
|
|
1900
|
-
value: this.state.value,
|
|
1901
|
-
fieldApi: this
|
|
1902
|
-
});
|
|
1903
|
-
}, t)) : this.options.listeners?.onBlur?.({
|
|
1904
|
-
value: this.state.value,
|
|
1905
|
-
fieldApi: this
|
|
1906
|
-
});
|
|
1907
|
-
}, this.triggerOnChangeListener = () => {
|
|
1908
|
-
let e = this.form.options.listeners?.onChangeDebounceMs;
|
|
1909
|
-
e && e > 0 ? (this.timeoutIds.formListeners.change && clearTimeout(this.timeoutIds.formListeners.change), this.timeoutIds.formListeners.change = setTimeout(() => {
|
|
1910
|
-
this.form.options.listeners?.onChange?.({
|
|
1911
|
-
formApi: this.form,
|
|
1912
|
-
fieldApi: this
|
|
1913
|
-
});
|
|
1914
|
-
}, e)) : this.form.options.listeners?.onChange?.({
|
|
1915
|
-
formApi: this.form,
|
|
1916
|
-
fieldApi: this
|
|
1917
|
-
});
|
|
1918
|
-
let t = this.options.listeners?.onChangeDebounceMs;
|
|
1919
|
-
t && t > 0 ? (this.timeoutIds.listeners.change && clearTimeout(this.timeoutIds.listeners.change), this.timeoutIds.listeners.change = setTimeout(() => {
|
|
1920
|
-
this.options.listeners?.onChange?.({
|
|
1921
|
-
value: this.state.value,
|
|
1922
|
-
fieldApi: this
|
|
1923
|
-
});
|
|
1924
|
-
}, t)) : this.options.listeners?.onChange?.({
|
|
1925
|
-
value: this.state.value,
|
|
1926
|
-
fieldApi: this
|
|
1927
|
-
});
|
|
1928
|
-
for (let e of this.form.formGroupApis) W(e.name, this.name) && e.triggerOnChangeListener();
|
|
1929
|
-
}, this.triggerOnSubmitListener = () => {
|
|
1930
|
-
this.options.listeners?.onSubmit?.({
|
|
1931
|
-
value: this.state.value,
|
|
1932
|
-
fieldApi: this
|
|
1933
|
-
});
|
|
1934
|
-
}, this.form = t.form, this.name = t.name, this.options = t, this.timeoutIds = {
|
|
1935
|
-
validations: {},
|
|
1936
|
-
listeners: {},
|
|
1937
|
-
formListeners: {}
|
|
1938
|
-
}, this.store = j((e) => {
|
|
1939
|
-
this.form.store.get();
|
|
1940
|
-
let n = this.form.getFieldMeta(this.name) ?? {
|
|
1941
|
-
...q,
|
|
1942
|
-
...t.defaultMeta
|
|
1943
|
-
}, r = this.form.getFieldValue(this.name);
|
|
1944
|
-
return !n.isTouched && r === void 0 && this.options.defaultValue !== void 0 && !R(r, this.options.defaultValue) && (r = this.options.defaultValue), e && e.value === r && e.meta === n ? e : {
|
|
1945
|
-
value: r,
|
|
1946
|
-
meta: n
|
|
1947
|
-
};
|
|
1948
|
-
});
|
|
1949
|
-
}
|
|
1950
|
-
get state() {
|
|
1951
|
-
return this.store.state;
|
|
1952
|
-
}
|
|
1953
|
-
runValidator(e) {
|
|
1954
|
-
return So(e.validate) ? K[e.type](e.value, e.validate) : e.validate(e.value);
|
|
1955
|
-
}
|
|
1956
|
-
};
|
|
1957
|
-
function Do(e) {
|
|
1958
|
-
if (e) return e;
|
|
1959
|
-
}
|
|
1960
|
-
function X(e) {
|
|
1961
|
-
switch (e) {
|
|
1962
|
-
case "submit": return "onSubmit";
|
|
1963
|
-
case "blur": return "onBlur";
|
|
1964
|
-
case "mount": return "onMount";
|
|
1965
|
-
case "server": return "onServer";
|
|
1966
|
-
case "dynamic": return "onDynamic";
|
|
1967
|
-
default: return "onChange";
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
//#endregion
|
|
1971
|
-
//#region node_modules/@tanstack/form-core/dist/esm/FormGroupApi.js
|
|
1972
|
-
function Oo(e) {
|
|
1973
|
-
return {
|
|
1974
|
-
isSubmitted: e.isSubmitted ?? !1,
|
|
1975
|
-
isSubmitting: e.isSubmitting ?? !1,
|
|
1976
|
-
isValidating: e.isValidating ?? !1,
|
|
1977
|
-
submissionAttempts: e.submissionAttempts ?? 0,
|
|
1978
|
-
isSubmitSuccessful: e.isSubmitSuccessful ?? !1
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1981
|
-
function ko(e) {
|
|
1982
|
-
return {
|
|
1983
|
-
...q,
|
|
1984
|
-
...e,
|
|
1985
|
-
errors: [],
|
|
1986
|
-
isPristine: !0,
|
|
1987
|
-
isValid: !0,
|
|
1988
|
-
isDefaultValue: !0,
|
|
1989
|
-
isFieldsValidating: !1,
|
|
1990
|
-
isFieldsValid: !0,
|
|
1991
|
-
isGroupValid: !0,
|
|
1992
|
-
canSubmit: !0,
|
|
1993
|
-
isSubmitting: !1,
|
|
1994
|
-
isSubmitted: !1,
|
|
1995
|
-
isValidating: !1,
|
|
1996
|
-
submissionAttempts: 0,
|
|
1997
|
-
isSubmitSuccessful: !1
|
|
1998
|
-
};
|
|
1999
|
-
}
|
|
2000
|
-
var Ao = class e {
|
|
2001
|
-
constructor(t) {
|
|
2002
|
-
this.options = {}, this.setFormGroupState = (e) => {
|
|
2003
|
-
this.form.baseStore.setState((t) => {
|
|
2004
|
-
let n = t.formGroupStateBase[this.name] ?? Oo({});
|
|
2005
|
-
return {
|
|
2006
|
-
...t,
|
|
2007
|
-
formGroupStateBase: {
|
|
2008
|
-
...t.formGroupStateBase,
|
|
2009
|
-
[this.name]: e(n)
|
|
2010
|
-
}
|
|
2011
|
-
};
|
|
2012
|
-
});
|
|
2013
|
-
}, this._lastDistributedFieldNames = {}, this.update = (e) => {
|
|
2014
|
-
this.options = e, this.name = e.name, !this.state.meta.isTouched && this.options.defaultValue !== void 0 && (R(this.form.getFieldValue(this.name), e.defaultValue) || this.form.setFieldValue(this.name, e.defaultValue, {
|
|
2015
|
-
dontUpdateMeta: !0,
|
|
2016
|
-
dontValidate: !0,
|
|
2017
|
-
dontRunListeners: !0
|
|
2018
|
-
})), this.form.getFieldMeta(this.name) || this.form.setFieldMeta(this.name, {
|
|
2019
|
-
...q,
|
|
2020
|
-
...this.options.defaultMeta
|
|
2021
|
-
});
|
|
2022
|
-
}, this.mount = () => {
|
|
2023
|
-
this.update(this.options), this.form.formGroupApis.add(this), this.fieldInfo.instance = this, this.form.baseStore.setState((e) => ({
|
|
2024
|
-
...e,
|
|
2025
|
-
formGroupStateBase: {
|
|
2026
|
-
...e.formGroupStateBase,
|
|
2027
|
-
[this.name]: e.formGroupStateBase[this.name] ?? Oo({ ...this.options.defaultState })
|
|
2028
|
-
}
|
|
2029
|
-
}));
|
|
2030
|
-
let { onMount: e } = this.options.validators || {};
|
|
2031
|
-
if (e) {
|
|
2032
|
-
let t = this.runValidator({
|
|
2033
|
-
validate: e,
|
|
2034
|
-
value: {
|
|
2035
|
-
value: this.state.value,
|
|
2036
|
-
groupApi: this,
|
|
2037
|
-
validationSource: "form"
|
|
2038
|
-
},
|
|
2039
|
-
type: "validate"
|
|
2040
|
-
}), n = t, r;
|
|
2041
|
-
Mo(t) && (n = t.group, r = t.fields);
|
|
2042
|
-
let i = jo(n);
|
|
2043
|
-
i && this.setMeta((e) => ({
|
|
2044
|
-
...e,
|
|
2045
|
-
errorMap: {
|
|
2046
|
-
...e.errorMap,
|
|
2047
|
-
onMount: i
|
|
2048
|
-
},
|
|
2049
|
-
errorSourceMap: {
|
|
2050
|
-
...e.errorSourceMap,
|
|
2051
|
-
onMount: "field"
|
|
2052
|
-
}
|
|
2053
|
-
})), this.distributeFieldErrors("onMount", r);
|
|
2054
|
-
}
|
|
2055
|
-
return this.options.listeners?.onMount?.({
|
|
2056
|
-
value: this.state.value,
|
|
2057
|
-
groupApi: this
|
|
2058
|
-
}), () => {
|
|
2059
|
-
for (let [e, t] of Object.entries(this.timeoutIds.validations)) t && (clearTimeout(t), this.timeoutIds.validations[e] = null);
|
|
2060
|
-
for (let [e, t] of Object.entries(this.timeoutIds.listeners)) t && (clearTimeout(t), this.timeoutIds.listeners[e] = null);
|
|
2061
|
-
for (let [e, t] of Object.entries(this.timeoutIds.formListeners)) t && (clearTimeout(t), this.timeoutIds.formListeners[e] = null);
|
|
2062
|
-
if (this.fieldInfo.instance === this) {
|
|
2063
|
-
for (let [e, t] of Object.entries(this.fieldInfo.validationMetaMap)) t?.lastAbortController.abort(), this.fieldInfo.validationMetaMap[e] = void 0;
|
|
2064
|
-
this.form.formGroupApis.delete(this), this.form.baseStore.setState((e) => ({
|
|
2065
|
-
...e,
|
|
2066
|
-
formGroupStateBase: {
|
|
2067
|
-
...e.formGroupStateBase,
|
|
2068
|
-
[this.name]: Oo({})
|
|
2069
|
-
}
|
|
2070
|
-
})), this.fieldInfo.instance = null, this.options.listeners?.onUnmount?.({
|
|
2071
|
-
value: this.state.value,
|
|
2072
|
-
groupApi: this
|
|
2073
|
-
});
|
|
2074
|
-
}
|
|
2075
|
-
};
|
|
2076
|
-
}, this.setValue = (e, t) => {
|
|
2077
|
-
this.form.setFieldValue(this.name, e, z(t, {
|
|
2078
|
-
dontRunListeners: !0,
|
|
2079
|
-
dontValidate: !0
|
|
2080
|
-
})), t?.dontRunListeners || this.triggerOnChangeListener(), t?.dontValidate || this.validate("change");
|
|
2081
|
-
}, this.getMeta = () => this.store.state.meta, this.setMeta = (e) => this.form.setFieldMeta(this.name, e), this.getInfo = () => this.fieldInfo, this.getRelatedFields = () => {
|
|
2082
|
-
let e = Object.values(this.form.fieldInfo), t = [];
|
|
2083
|
-
for (let n of e) n.instance && n.instance instanceof Eo && n.instance.name.startsWith(this.name) && t.push(n.instance);
|
|
2084
|
-
return t;
|
|
2085
|
-
}, this.getRelatedFieldMetasDerived = () => {
|
|
2086
|
-
let e = Object.entries(this.form.fieldMetaDerived.state), t = [];
|
|
2087
|
-
for (let [n, r] of e) n !== this.name && W(this.name, n) && t.push({
|
|
2088
|
-
...r,
|
|
2089
|
-
name: n
|
|
2090
|
-
});
|
|
2091
|
-
return t;
|
|
2092
|
-
}, this.buildChildFieldName = (e) => e === "" ? this.name : e.startsWith("[") ? `${this.name}${e}` : `${this.name}.${e}`, this.distributeFieldErrors = (e, t) => {
|
|
2093
|
-
let n = this._lastDistributedFieldNames[e] ?? /* @__PURE__ */ new Set(), r = /* @__PURE__ */ new Set();
|
|
2094
|
-
if (t) for (let [e, n] of Object.entries(t)) n == null || n === !1 || r.add(this.buildChildFieldName(e));
|
|
2095
|
-
let i = /* @__PURE__ */ new Set([...n, ...r]), a = !1;
|
|
2096
|
-
for (let n of i) {
|
|
2097
|
-
let r = n.startsWith(this.name + "[") ? n.slice(this.name.length) : n.slice(this.name.length + 1), i = t?.[r], o = this.form.getFieldMeta(n);
|
|
2098
|
-
if (!o && !i) continue;
|
|
2099
|
-
let s = o?.errorMap[e], { newErrorValue: c, newSource: l } = go({
|
|
2100
|
-
newFormValidatorError: i,
|
|
2101
|
-
isPreviousErrorFromFormValidator: o?.errorSourceMap[e] === "form",
|
|
2102
|
-
previousErrorValue: s
|
|
2103
|
-
});
|
|
2104
|
-
c && (a = !0), !(s === c && o?.errorSourceMap[e] === l) && this.form.setFieldMeta(n, (t) => ({
|
|
2105
|
-
...t,
|
|
2106
|
-
errorMap: {
|
|
2107
|
-
...t.errorMap,
|
|
2108
|
-
[e]: c
|
|
2109
|
-
},
|
|
2110
|
-
errorSourceMap: {
|
|
2111
|
-
...t.errorSourceMap,
|
|
2112
|
-
[e]: l
|
|
2113
|
-
}
|
|
2114
|
-
}));
|
|
2115
|
-
}
|
|
2116
|
-
return this._lastDistributedFieldNames[e] = r, a;
|
|
2117
|
-
}, this.validateSync = (t, n, r = {}) => {
|
|
2118
|
-
let i = I(t, {
|
|
2119
|
-
...this.options,
|
|
2120
|
-
form: this.form,
|
|
2121
|
-
group: this,
|
|
2122
|
-
validationLogic: this.options.validationLogic || this.form.options.validationLogic || G
|
|
2123
|
-
}), a = (r.skipRelatedFieldValidation ? [] : this.getRelatedFields()).reduce((e, n) => {
|
|
2124
|
-
let r = I(t, {
|
|
2125
|
-
...n.options,
|
|
2126
|
-
form: n.form,
|
|
2127
|
-
validationLogic: n.form.options.validationLogic || G
|
|
2128
|
-
});
|
|
2129
|
-
return r.forEach((e) => {
|
|
2130
|
-
e.field = n;
|
|
2131
|
-
}), e.concat(r);
|
|
2132
|
-
}, []), o = !1;
|
|
2133
|
-
k(() => {
|
|
2134
|
-
let t = (t, r) => {
|
|
2135
|
-
let i = Po(r.cause), a = t === this, s;
|
|
2136
|
-
r.validate && (s = t.runValidator({
|
|
2137
|
-
validate: r.validate,
|
|
2138
|
-
value: {
|
|
2139
|
-
value: t.store.state.value,
|
|
2140
|
-
validationSource: a ? "form" : "field",
|
|
2141
|
-
...t instanceof e ? { groupApi: t } : { fieldApi: t }
|
|
2142
|
-
},
|
|
2143
|
-
type: "validate"
|
|
2144
|
-
}));
|
|
2145
|
-
let c = s, l;
|
|
2146
|
-
a && Mo(s) && (c = s.group, l = s.fields);
|
|
2147
|
-
let u = jo(c), d = n[i], { newErrorValue: f, newSource: p } = _o({
|
|
2148
|
-
formLevelError: d,
|
|
2149
|
-
fieldLevelError: u
|
|
2150
|
-
});
|
|
2151
|
-
t.state.meta.errorMap?.[i] !== f && t.setMeta((e) => ({
|
|
2152
|
-
...e,
|
|
2153
|
-
errorMap: {
|
|
2154
|
-
...e.errorMap,
|
|
2155
|
-
[i]: f
|
|
2156
|
-
},
|
|
2157
|
-
errorSourceMap: {
|
|
2158
|
-
...e.errorSourceMap,
|
|
2159
|
-
[i]: p
|
|
2160
|
-
}
|
|
2161
|
-
})), f && (o = !0), a && this.distributeFieldErrors(i, l) && (o = !0);
|
|
2162
|
-
};
|
|
2163
|
-
for (let e of i) t(this, e);
|
|
2164
|
-
for (let e of a) e.validate && t(e.field, e);
|
|
2165
|
-
});
|
|
2166
|
-
let s = Po("submit");
|
|
2167
|
-
return this.state.meta.errorMap?.[s] && t !== "submit" && !o && this.setMeta((e) => ({
|
|
2168
|
-
...e,
|
|
2169
|
-
errorMap: {
|
|
2170
|
-
...e.errorMap,
|
|
2171
|
-
[s]: void 0
|
|
2172
|
-
},
|
|
2173
|
-
errorSourceMap: {
|
|
2174
|
-
...e.errorSourceMap,
|
|
2175
|
-
[s]: void 0
|
|
2176
|
-
}
|
|
2177
|
-
})), { hasErrored: o };
|
|
2178
|
-
}, this.validateAsync = async (t, n, r = {}) => {
|
|
2179
|
-
let i = L(t, {
|
|
2180
|
-
...this.options,
|
|
2181
|
-
form: this.form,
|
|
2182
|
-
group: this,
|
|
2183
|
-
validationLogic: this.options.validationLogic || this.form.options.validationLogic || G
|
|
2184
|
-
}), a = await n, o = r.skipRelatedFieldValidation ? [] : this.getRelatedFields(), s = o.reduce((e, n) => {
|
|
2185
|
-
let r = L(t, {
|
|
2186
|
-
...n.options,
|
|
2187
|
-
form: n.form,
|
|
2188
|
-
validationLogic: n.form.options.validationLogic || G
|
|
2189
|
-
});
|
|
2190
|
-
return r.forEach((e) => {
|
|
2191
|
-
e.field = n;
|
|
2192
|
-
}), e.concat(r);
|
|
2193
|
-
}, []), c = [], l = [], u = i.some((e) => e.validate) || s.some((e) => e.validate);
|
|
2194
|
-
if (u) {
|
|
2195
|
-
this.state.meta.isValidating || this.setMeta((e) => ({
|
|
2196
|
-
...e,
|
|
2197
|
-
isValidating: !0
|
|
2198
|
-
}));
|
|
2199
|
-
for (let e of o) e.setMeta((e) => ({
|
|
2200
|
-
...e,
|
|
2201
|
-
isValidating: !0
|
|
2202
|
-
}));
|
|
2203
|
-
}
|
|
2204
|
-
let d = (t, n, r) => {
|
|
2205
|
-
let i = Po(n.cause), o = t.getInfo();
|
|
2206
|
-
o.validationMetaMap[i]?.lastAbortController.abort();
|
|
2207
|
-
let s = new AbortController();
|
|
2208
|
-
o.validationMetaMap[i] = { lastAbortController: s };
|
|
2209
|
-
let c = t === this;
|
|
2210
|
-
r.push(new Promise(async (r) => {
|
|
2211
|
-
let o;
|
|
2212
|
-
try {
|
|
2213
|
-
o = await new Promise((r, i) => {
|
|
2214
|
-
t.timeoutIds.validations[n.cause] && clearTimeout(t.timeoutIds.validations[n.cause]), t.timeoutIds.validations[n.cause] = setTimeout(async () => {
|
|
2215
|
-
if (s.signal.aborted) return r(void 0);
|
|
2216
|
-
try {
|
|
2217
|
-
r(await this.runValidator({
|
|
2218
|
-
validate: n.validate,
|
|
2219
|
-
value: {
|
|
2220
|
-
value: t.store.state.value,
|
|
2221
|
-
signal: s.signal,
|
|
2222
|
-
validationSource: c ? "form" : "field",
|
|
2223
|
-
...t instanceof e ? { groupApi: t } : { fieldApi: t }
|
|
2224
|
-
},
|
|
2225
|
-
type: "validateAsync"
|
|
2226
|
-
}));
|
|
2227
|
-
} catch (e) {
|
|
2228
|
-
i(e);
|
|
2229
|
-
}
|
|
2230
|
-
}, n.debounceMs);
|
|
2231
|
-
});
|
|
2232
|
-
} catch (e) {
|
|
2233
|
-
o = e;
|
|
2234
|
-
}
|
|
2235
|
-
if (s.signal.aborted) return r(void 0);
|
|
2236
|
-
let l = o, u;
|
|
2237
|
-
c && Mo(o) && (l = o.group, u = o.fields);
|
|
2238
|
-
let d = jo(l), f = a[t.name]?.[i], { newErrorValue: p, newSource: m } = _o({
|
|
2239
|
-
formLevelError: f,
|
|
2240
|
-
fieldLevelError: d
|
|
2241
|
-
});
|
|
2242
|
-
if (t.getInfo().instance !== t) return r(void 0);
|
|
2243
|
-
t.setMeta((e) => ({
|
|
2244
|
-
...e,
|
|
2245
|
-
errorMap: {
|
|
2246
|
-
...e?.errorMap,
|
|
2247
|
-
[i]: p
|
|
2248
|
-
},
|
|
2249
|
-
errorSourceMap: {
|
|
2250
|
-
...e.errorSourceMap,
|
|
2251
|
-
[i]: m
|
|
2252
|
-
}
|
|
2253
|
-
})), c && this.distributeFieldErrors(i, u), r(p);
|
|
2254
|
-
}));
|
|
2255
|
-
};
|
|
2256
|
-
for (let e of i) e.validate && d(this, e, c);
|
|
2257
|
-
for (let e of s) e.validate && d(e.field, e, l);
|
|
2258
|
-
let f = [];
|
|
2259
|
-
if ((c.length || l.length) && (f = await Promise.all(c), await Promise.all(l)), u) {
|
|
2260
|
-
this.setMeta((e) => ({
|
|
2261
|
-
...e,
|
|
2262
|
-
isValidating: !1
|
|
2263
|
-
}));
|
|
2264
|
-
for (let e of o) e.setMeta((e) => ({
|
|
2265
|
-
...e,
|
|
2266
|
-
isValidating: !1
|
|
2267
|
-
}));
|
|
2268
|
-
}
|
|
2269
|
-
return f.filter(Boolean);
|
|
2270
|
-
}, this.validateAllFields = async (e) => {
|
|
2271
|
-
let t = [];
|
|
2272
|
-
return k(() => {
|
|
2273
|
-
Object.values(this.getRelatedFields()).forEach((n) => {
|
|
2274
|
-
t.push(Promise.resolve().then(() => n.validate(e, {
|
|
2275
|
-
skipFormValidation: !0,
|
|
2276
|
-
skipGroupValidation: !0
|
|
2277
|
-
}))), n.store.state.meta.isTouched || n.setMeta((e) => ({
|
|
2278
|
-
...e,
|
|
2279
|
-
isTouched: !0
|
|
2280
|
-
}));
|
|
2281
|
-
});
|
|
2282
|
-
}), (await Promise.all(t)).flat();
|
|
2283
|
-
}, this.validateArrayFieldsStartingFrom = (e, t, n) => this.form.validateArrayFieldsStartingFrom(e, t, n), this.validateField = (e, t) => this.form.validateField(e, t), this.getFieldValue = (e) => this.form.getFieldValue(e), this.getFieldMeta = (e) => this.form.getFieldMeta(e), this.setFieldMeta = (e, t) => this.form.setFieldMeta(e, t), this.setFieldValue = (e, t) => this.form.setFieldValue(e, t), this.deleteField = (e) => this.form.deleteField(e), this.pushFieldValue = (e, t) => this.form.pushFieldValue(e, t), this.insertFieldValue = (e, t, n) => this.form.insertFieldValue(e, t, n), this.replaceFieldValue = (e, t, n) => this.form.replaceFieldValue(e, t, n), this.swapFieldValues = (e, t, n) => this.form.swapFieldValues(e, t, n), this.moveFieldValues = (e, t, n) => this.form.moveFieldValues(e, t, n), this.clearFieldValues = (e) => this.form.clearFieldValues(e), this.resetField = (e) => this.form.resetField(e), this.removeFieldValue = (e, t) => this.form.removeFieldValue(e, t), this.areRelatedFieldsValid = () => Object.values(this.getRelatedFields()).every((e) => e.state.meta.isValid), this.validate = (e, t) => {
|
|
2284
|
-
let { fieldsErrorMap: n } = t?.skipFormValidation ? { fieldsErrorMap: {} } : this.form.validateSync(e, {
|
|
2285
|
-
dontUpdateFormErrorMap: !0,
|
|
2286
|
-
filterFieldNames: (e) => W(this.name, e)
|
|
2287
|
-
}), { hasErrored: r } = this.validateSync(e, n[this.name] ?? {}, { skipRelatedFieldValidation: t?.skipRelatedFieldValidation });
|
|
2288
|
-
if (r && !this.options.asyncAlways) return this.getInfo().validationMetaMap[Po(e)]?.lastAbortController.abort(), this.state.meta.errors;
|
|
2289
|
-
let i = t?.skipFormValidation ? Promise.resolve({}) : this.form.validateAsync(e, {
|
|
2290
|
-
dontUpdateFormErrorMap: !0,
|
|
2291
|
-
filterFieldNames: (e) => W(this.name, e)
|
|
2292
|
-
});
|
|
2293
|
-
return this.validateAsync(e, i, { skipRelatedFieldValidation: t?.skipRelatedFieldValidation });
|
|
2294
|
-
}, this.triggerOnChangeListener = () => {
|
|
2295
|
-
let e = this.form.options.listeners?.onChangeGroupDebounceMs;
|
|
2296
|
-
e && e > 0 ? (this.timeoutIds.formListeners.change && clearTimeout(this.timeoutIds.formListeners.change), this.timeoutIds.formListeners.change = setTimeout(() => {
|
|
2297
|
-
this.form.options.listeners?.onChangeGroup?.({
|
|
2298
|
-
formApi: this.form,
|
|
2299
|
-
groupApi: this
|
|
2300
|
-
});
|
|
2301
|
-
}, e)) : this.form.options.listeners?.onChangeGroup?.({
|
|
2302
|
-
formApi: this.form,
|
|
2303
|
-
groupApi: this
|
|
2304
|
-
});
|
|
2305
|
-
let t = this.options.listeners?.onChangeDebounceMs;
|
|
2306
|
-
t && t > 0 ? (this.timeoutIds.listeners.change && clearTimeout(this.timeoutIds.listeners.change), this.timeoutIds.listeners.change = setTimeout(() => {
|
|
2307
|
-
this.options.listeners?.onChange?.({
|
|
2308
|
-
value: this.state.value,
|
|
2309
|
-
groupApi: this
|
|
2310
|
-
});
|
|
2311
|
-
}, t)) : this.options.listeners?.onChange?.({
|
|
2312
|
-
value: this.state.value,
|
|
2313
|
-
groupApi: this
|
|
2314
|
-
});
|
|
2315
|
-
}, this.triggerOnSubmitListener = () => {
|
|
2316
|
-
this.options.listeners?.onSubmit?.({
|
|
2317
|
-
value: this.state.value,
|
|
2318
|
-
groupApi: this
|
|
2319
|
-
});
|
|
2320
|
-
}, this._handleSubmit = async (e) => {
|
|
2321
|
-
this.setFormGroupState((e) => ({
|
|
2322
|
-
...e,
|
|
2323
|
-
isSubmitted: !1,
|
|
2324
|
-
submissionAttempts: e.submissionAttempts + 1,
|
|
2325
|
-
isSubmitSuccessful: !1
|
|
2326
|
-
})), k(() => {
|
|
2327
|
-
Object.values(this.getRelatedFields()).forEach((e) => {
|
|
2328
|
-
e.state.meta.isTouched || e.setMeta((e) => ({
|
|
2329
|
-
...e,
|
|
2330
|
-
isTouched: !0
|
|
2331
|
-
}));
|
|
2332
|
-
});
|
|
2333
|
-
});
|
|
2334
|
-
let t = e ?? this.options.onSubmitMeta;
|
|
2335
|
-
this.setFormGroupState((e) => ({
|
|
2336
|
-
...e,
|
|
2337
|
-
isSubmitting: !0
|
|
2338
|
-
}));
|
|
2339
|
-
let n = () => {
|
|
2340
|
-
this.setFormGroupState((e) => ({
|
|
2341
|
-
...e,
|
|
2342
|
-
isSubmitting: !1
|
|
2343
|
-
}));
|
|
2344
|
-
};
|
|
2345
|
-
if (await this.validateAllFields("submit"), !this.areRelatedFieldsValid()) {
|
|
2346
|
-
n(), this.options.onGroupSubmitInvalid?.({
|
|
2347
|
-
value: this.state.value,
|
|
2348
|
-
groupApi: this,
|
|
2349
|
-
meta: t
|
|
2350
|
-
});
|
|
2351
|
-
return;
|
|
2352
|
-
}
|
|
2353
|
-
if (await this.validate("submit", { skipRelatedFieldValidation: !0 }), !this.areRelatedFieldsValid() || !this.state.meta.isValid) {
|
|
2354
|
-
n(), this.options.onGroupSubmitInvalid?.({
|
|
2355
|
-
value: this.state.value,
|
|
2356
|
-
groupApi: this,
|
|
2357
|
-
meta: t
|
|
2358
|
-
});
|
|
2359
|
-
return;
|
|
2360
|
-
}
|
|
2361
|
-
k(() => {
|
|
2362
|
-
Object.values(this.getRelatedFields()).forEach((e) => {
|
|
2363
|
-
e.options.listeners?.onGroupSubmit?.({
|
|
2364
|
-
value: e.state.value,
|
|
2365
|
-
fieldApi: e
|
|
2366
|
-
});
|
|
2367
|
-
});
|
|
2368
|
-
}), this.options.listeners?.onSubmit?.({
|
|
2369
|
-
groupApi: this,
|
|
2370
|
-
value: this.state.value
|
|
2371
|
-
});
|
|
2372
|
-
try {
|
|
2373
|
-
await this.options.onGroupSubmit?.({
|
|
2374
|
-
value: this.state.value,
|
|
2375
|
-
groupApi: this,
|
|
2376
|
-
meta: t
|
|
2377
|
-
}), k(() => {
|
|
2378
|
-
this.setFormGroupState((e) => ({
|
|
2379
|
-
...e,
|
|
2380
|
-
isSubmitted: !0,
|
|
2381
|
-
isSubmitSuccessful: !0
|
|
2382
|
-
})), n();
|
|
2383
|
-
});
|
|
2384
|
-
} catch (e) {
|
|
2385
|
-
throw this.setFormGroupState((e) => ({
|
|
2386
|
-
...e,
|
|
2387
|
-
isSubmitSuccessful: !1
|
|
2388
|
-
})), n(), e;
|
|
2389
|
-
}
|
|
2390
|
-
}, this.form = t.form, this.name = t.name, this.options = t, this.timeoutIds = {
|
|
2391
|
-
validations: {},
|
|
2392
|
-
listeners: {},
|
|
2393
|
-
formListeners: {}
|
|
2394
|
-
}, this.fieldInfo = {
|
|
2395
|
-
instance: null,
|
|
2396
|
-
validationMetaMap: {
|
|
2397
|
-
onChange: void 0,
|
|
2398
|
-
onBlur: void 0,
|
|
2399
|
-
onSubmit: void 0,
|
|
2400
|
-
onMount: void 0,
|
|
2401
|
-
onServer: void 0,
|
|
2402
|
-
onDynamic: void 0
|
|
2403
|
-
}
|
|
2404
|
-
}, this.store = j((e) => {
|
|
2405
|
-
this.form.formGroupMetaDerived.get(), this.form.baseStore.get();
|
|
2406
|
-
let n = this.form.getFormGroupMeta(this.name) ?? ko(t.defaultMeta), r = this.form.getFieldValue(this.name);
|
|
2407
|
-
return !n.isTouched && r === void 0 && this.options.defaultValue !== void 0 && !R(r, this.options.defaultValue) && (r = this.options.defaultValue), e && e.value === r && e.meta === n ? e : {
|
|
2408
|
-
value: r,
|
|
2409
|
-
meta: n
|
|
2410
|
-
};
|
|
2411
|
-
}), this.handleSubmit = this.handleSubmit.bind(this);
|
|
2412
|
-
}
|
|
2413
|
-
get state() {
|
|
2414
|
-
return this.store.state;
|
|
2415
|
-
}
|
|
2416
|
-
runValidator(e) {
|
|
2417
|
-
if (So(e.validate)) {
|
|
2418
|
-
let t = K[e.type](e.value, e.validate);
|
|
2419
|
-
return e.type === "validate" ? No(t) : t.then(No);
|
|
2420
|
-
}
|
|
2421
|
-
return e.validate(e.value);
|
|
2422
|
-
}
|
|
2423
|
-
handleSubmit(e) {
|
|
2424
|
-
return this._handleSubmit(e);
|
|
2425
|
-
}
|
|
2426
|
-
};
|
|
2427
|
-
function jo(e) {
|
|
2428
|
-
if (e) return e;
|
|
2429
|
-
}
|
|
2430
|
-
function Mo(e) {
|
|
2431
|
-
return !!e && typeof e == "object" && "fields" in e;
|
|
2432
|
-
}
|
|
2433
|
-
function No(e) {
|
|
2434
|
-
if (!e || typeof e != "object" || !("form" in e) && !("fields" in e)) return e;
|
|
2435
|
-
let { form: t, fields: n, ...r } = e;
|
|
2436
|
-
return {
|
|
2437
|
-
...r,
|
|
2438
|
-
group: t,
|
|
2439
|
-
fields: n
|
|
2440
|
-
};
|
|
2441
|
-
}
|
|
2442
|
-
function Po(e) {
|
|
2443
|
-
switch (e) {
|
|
2444
|
-
case "submit": return "onSubmit";
|
|
2445
|
-
case "blur": return "onBlur";
|
|
2446
|
-
case "mount": return "onMount";
|
|
2447
|
-
case "server": return "onServer";
|
|
2448
|
-
case "dynamic": return "onDynamic";
|
|
2449
|
-
default: return "onChange";
|
|
2450
|
-
}
|
|
2451
|
-
}
|
|
2452
|
-
//#endregion
|
|
2453
|
-
//#region node_modules/@tanstack/form-core/dist/esm/FieldGroupApi.js
|
|
2454
|
-
var Fo = class e {
|
|
2455
|
-
constructor(t) {
|
|
2456
|
-
if (this.getFormFieldName = (e) => {
|
|
2457
|
-
if (typeof this.fieldsMap == "string") return po(this.fieldsMap, e);
|
|
2458
|
-
let t = fo(e)[0];
|
|
2459
|
-
if (typeof t != "string") return "";
|
|
2460
|
-
let n = e.slice(t.length), r = this.fieldsMap[t];
|
|
2461
|
-
return po(r, n);
|
|
2462
|
-
}, this.getFormFieldOptions = (e) => {
|
|
2463
|
-
let t = { ...e }, n = t.validators;
|
|
2464
|
-
if (t.name = this.getFormFieldName(e.name), n && (n.onChangeListenTo || n.onBlurListenTo)) {
|
|
2465
|
-
let e = { ...n }, r = (e) => {
|
|
2466
|
-
if (e) return e.map((e) => this.getFormFieldName(e));
|
|
2467
|
-
};
|
|
2468
|
-
e.onChangeListenTo = r(n.onChangeListenTo), e.onBlurListenTo = r(n.onBlurListenTo), t.validators = e;
|
|
2469
|
-
}
|
|
2470
|
-
return t;
|
|
2471
|
-
}, this.mount = () => () => {}, this.validateArrayFieldsStartingFrom = async (e, t, n) => this.form.validateArrayFieldsStartingFrom(this.getFormFieldName(e), t, n), this.validateField = (e, t) => this.form.validateField(this.getFormFieldName(e), t), this.getFieldValue = (e) => this.form.getFieldValue(this.getFormFieldName(e)), this.getFieldMeta = (e) => this.form.getFieldMeta(this.getFormFieldName(e)), this.setFieldMeta = (e, t) => this.form.setFieldMeta(this.getFormFieldName(e), t), this.setFieldValue = (e, t, n) => this.form.setFieldValue(this.getFormFieldName(e), t, n), this.deleteField = (e) => this.form.deleteField(this.getFormFieldName(e)), this.pushFieldValue = (e, t, n) => this.form.pushFieldValue(this.getFormFieldName(e), t, n), this.insertFieldValue = async (e, t, n, r) => this.form.insertFieldValue(this.getFormFieldName(e), t, n, r), this.replaceFieldValue = async (e, t, n, r) => this.form.replaceFieldValue(this.getFormFieldName(e), t, n, r), this.removeFieldValue = async (e, t, n) => this.form.removeFieldValue(this.getFormFieldName(e), t, n), this.swapFieldValues = (e, t, n, r) => this.form.swapFieldValues(this.getFormFieldName(e), t, n, r), this.moveFieldValues = (e, t, n, r) => this.form.moveFieldValues(this.getFormFieldName(e), t, n, r), this.clearFieldValues = (e, t) => this.form.clearFieldValues(this.getFormFieldName(e), t), this.resetField = (e) => this.form.resetField(this.getFormFieldName(e)), this.validateAllFields = (e) => this.form.validateAllFields(e), t.form instanceof e) {
|
|
2472
|
-
let e = t.form;
|
|
2473
|
-
if (this.form = e.form, typeof t.fields == "string") this.fieldsMap = e.getFormFieldName(t.fields);
|
|
2474
|
-
else {
|
|
2475
|
-
let n = { ...t.fields };
|
|
2476
|
-
for (let t in n) n[t] = e.getFormFieldName(n[t]);
|
|
2477
|
-
this.fieldsMap = n;
|
|
2478
|
-
}
|
|
2479
|
-
} else this.form = t.form, this.fieldsMap = t.fields;
|
|
2480
|
-
this.store = j(() => {
|
|
2481
|
-
let e = this.form.store.get(), t;
|
|
2482
|
-
if (typeof this.fieldsMap == "string") t = P(e.values, this.fieldsMap);
|
|
2483
|
-
else {
|
|
2484
|
-
t = {};
|
|
2485
|
-
let n = this.fieldsMap;
|
|
2486
|
-
for (let r in n) t[r] = P(e.values, n[r]);
|
|
2487
|
-
}
|
|
2488
|
-
return { values: t };
|
|
2489
|
-
});
|
|
2490
|
-
}
|
|
2491
|
-
get state() {
|
|
2492
|
-
return this.store.state;
|
|
2493
|
-
}
|
|
2494
|
-
async handleSubmit(e) {
|
|
2495
|
-
return this.form.handleSubmit(e);
|
|
2496
|
-
}
|
|
2497
|
-
};
|
|
2498
|
-
//#endregion
|
|
2499
|
-
//#region node_modules/@tanstack/form-core/dist/esm/transform.js
|
|
2500
|
-
function Io(e, t) {
|
|
2501
|
-
if (!t) return;
|
|
2502
|
-
let n = Object.assign({}, e, { state: U(e.state) });
|
|
2503
|
-
t(n), n.fieldInfo !== e.fieldInfo && (e.fieldInfo = n.fieldInfo), n.options !== e.options && (e.options = n.options);
|
|
2504
|
-
let r = Object.keys({
|
|
2505
|
-
values: null,
|
|
2506
|
-
validationMetaMap: null,
|
|
2507
|
-
fieldMetaBase: null,
|
|
2508
|
-
formGroupStateBase: null,
|
|
2509
|
-
isSubmitting: null,
|
|
2510
|
-
isSubmitted: null,
|
|
2511
|
-
isValidating: null,
|
|
2512
|
-
submissionAttempts: null,
|
|
2513
|
-
isSubmitSuccessful: null,
|
|
2514
|
-
_force_re_eval: null
|
|
2515
|
-
}).reduce((t, r) => (e.state[r] !== n.state[r] && (t[r] = n.state[r]), t), {});
|
|
2516
|
-
return k(() => {
|
|
2517
|
-
Object.keys(r).length && e.baseStore.setState((e) => ({
|
|
2518
|
-
...e,
|
|
2519
|
-
...r
|
|
2520
|
-
})), n.state.errorMap !== e.state.errorMap && e.setErrorMap(n.state.errorMap);
|
|
2521
|
-
}), n;
|
|
2522
|
-
}
|
|
2523
|
-
//#endregion
|
|
2524
|
-
//#region node_modules/@tanstack/react-store/dist/useSelector.js
|
|
2525
|
-
function Lo(e, t) {
|
|
2526
|
-
return e === t;
|
|
2527
|
-
}
|
|
2528
|
-
function Ro(e, t = (e) => e, n) {
|
|
2529
|
-
let r = n?.compare ?? Lo, i = Ma((t) => {
|
|
2530
|
-
let { unsubscribe: n } = e.subscribe(t);
|
|
2531
|
-
return n;
|
|
2532
|
-
}, [e]), a = Ma(() => e.get(), [e]);
|
|
2533
|
-
return La(i, a, a, t, r);
|
|
2534
|
-
}
|
|
2535
|
-
//#endregion
|
|
2536
|
-
//#region node_modules/@tanstack/react-store/dist/useStore.js
|
|
2537
|
-
var Z = (e, t = (e) => e, n) => Ro(e, t, { compare: n }), Q = typeof window < "u" ? Fa : Pa;
|
|
2538
|
-
//#endregion
|
|
2539
|
-
//#region node_modules/@tanstack/react-form/dist/esm/useField.js
|
|
2540
|
-
function zo(e) {
|
|
2541
|
-
let [t, n] = C(() => ({
|
|
2542
|
-
form: e.form,
|
|
2543
|
-
name: e.name
|
|
2544
|
-
})), [r, i] = C(() => new Eo({ ...e }));
|
|
2545
|
-
(t.form !== e.form || t.name !== e.name) && (i(new Eo({ ...e })), n({
|
|
2546
|
-
form: e.form,
|
|
2547
|
-
name: e.name
|
|
2548
|
-
}));
|
|
2549
|
-
let a = Z(r.store, e.mode === "array" ? (e) => e.meta._arrayVersion || 0 : (e) => e.value), o = Z(r.store, (e) => e.meta.isTouched), s = Z(r.store, (e) => e.meta.isBlurred), c = Z(r.store, (e) => e.meta.isDirty), l = Z(r.store, (e) => e.meta.errorMap), u = Z(r.store, (e) => e.meta.errorSourceMap), d = Z(r.store, (e) => e.meta.isValidating), f = S(() => ({
|
|
2550
|
-
...r,
|
|
2551
|
-
get state() {
|
|
2552
|
-
return {
|
|
2553
|
-
value: e.mode === "array" ? r.state.value : a,
|
|
2554
|
-
get meta() {
|
|
2555
|
-
return {
|
|
2556
|
-
...r.state.meta,
|
|
2557
|
-
isTouched: o,
|
|
2558
|
-
isBlurred: s,
|
|
2559
|
-
isDirty: c,
|
|
2560
|
-
errorMap: l,
|
|
2561
|
-
errorSourceMap: u,
|
|
2562
|
-
isValidating: d
|
|
2563
|
-
};
|
|
2564
|
-
}
|
|
2565
|
-
};
|
|
2566
|
-
}
|
|
2567
|
-
}), [
|
|
2568
|
-
r,
|
|
2569
|
-
e.mode,
|
|
2570
|
-
a,
|
|
2571
|
-
o,
|
|
2572
|
-
s,
|
|
2573
|
-
c,
|
|
2574
|
-
l,
|
|
2575
|
-
u,
|
|
2576
|
-
d
|
|
2577
|
-
]);
|
|
2578
|
-
return Q(r.mount, [r]), Q(() => {
|
|
2579
|
-
r.update(e);
|
|
2580
|
-
}), f;
|
|
2581
|
-
}
|
|
2582
|
-
var Bo = (({ children: e, ...t }) => {
|
|
2583
|
-
let n = zo(t);
|
|
2584
|
-
return /* @__PURE__ */ w(Ra, { children: S(() => N(e, n), [e, n]) });
|
|
2585
|
-
});
|
|
2586
|
-
//#endregion
|
|
2587
|
-
//#region node_modules/@tanstack/react-form/dist/esm/useUUID.js
|
|
2588
|
-
function Vo() {
|
|
2589
|
-
return C(() => vo())[0];
|
|
2590
|
-
}
|
|
2591
|
-
//#endregion
|
|
2592
|
-
//#region node_modules/@tanstack/react-form/dist/esm/useFormId.js
|
|
2593
|
-
var Ho = Aa, Uo = Aa.version.split(".")[0] === "17" ? Vo : Ho.useId;
|
|
2594
|
-
//#endregion
|
|
2595
|
-
//#region node_modules/@tanstack/react-form/dist/esm/useFormGroup.js
|
|
2596
|
-
function Wo(e) {
|
|
2597
|
-
let [t, n] = C(() => ({
|
|
2598
|
-
form: e.form,
|
|
2599
|
-
name: e.name
|
|
2600
|
-
})), [r, i] = C(() => new Ao({ ...e }));
|
|
2601
|
-
(t.form !== e.form || t.name !== e.name) && (i(new Ao({ ...e })), n({
|
|
2602
|
-
form: e.form,
|
|
2603
|
-
name: e.name
|
|
2604
|
-
}));
|
|
2605
|
-
let a = Z(r.store, (e) => e.value), o = Z(r.store, (e) => e.meta.isTouched), s = Z(r.store, (e) => e.meta.isBlurred), c = Z(r.store, (e) => e.meta.isDirty), l = Z(r.store, (e) => e.meta.errorMap), u = Z(r.store, (e) => e.meta.errorSourceMap), d = Z(r.store, (e) => e.meta.isValidating), f = Z(r.store, (e) => e.meta.isSubmitting), p = Z(r.store, (e) => e.meta.isSubmitted), m = Z(r.store, (e) => e.meta.submissionAttempts), h = Z(r.store, (e) => e.meta.isSubmitSuccessful), g = Z(r.store, (e) => e.meta.canSubmit), _ = Z(r.store, (e) => e.meta.isValid), v = Z(r.store, (e) => e.meta.isFieldsValid), y = Z(r.store, (e) => e.meta.isFieldsValidating), b = Z(r.store, (e) => e.meta.isGroupValid), x = S(() => ({
|
|
2606
|
-
...r,
|
|
2607
|
-
handleSubmit: ((...e) => r._handleSubmit(...e)),
|
|
2608
|
-
get state() {
|
|
2609
|
-
return {
|
|
2610
|
-
...r.state,
|
|
2611
|
-
value: a,
|
|
2612
|
-
get meta() {
|
|
2613
|
-
return {
|
|
2614
|
-
...r.state.meta,
|
|
2615
|
-
isTouched: o,
|
|
2616
|
-
isBlurred: s,
|
|
2617
|
-
isDirty: c,
|
|
2618
|
-
errorMap: l,
|
|
2619
|
-
errorSourceMap: u,
|
|
2620
|
-
isValidating: d,
|
|
2621
|
-
isSubmitting: f,
|
|
2622
|
-
isSubmitted: p,
|
|
2623
|
-
submissionAttempts: m,
|
|
2624
|
-
isSubmitSuccessful: h,
|
|
2625
|
-
canSubmit: g,
|
|
2626
|
-
isValid: _,
|
|
2627
|
-
isFieldsValid: v,
|
|
2628
|
-
isFieldsValidating: y,
|
|
2629
|
-
isGroupValid: b
|
|
2630
|
-
};
|
|
2631
|
-
}
|
|
2632
|
-
};
|
|
2633
|
-
}
|
|
2634
|
-
}), [
|
|
2635
|
-
r,
|
|
2636
|
-
a,
|
|
2637
|
-
o,
|
|
2638
|
-
s,
|
|
2639
|
-
c,
|
|
2640
|
-
l,
|
|
2641
|
-
u,
|
|
2642
|
-
d,
|
|
2643
|
-
f,
|
|
2644
|
-
p,
|
|
2645
|
-
m,
|
|
2646
|
-
h,
|
|
2647
|
-
g,
|
|
2648
|
-
_,
|
|
2649
|
-
v,
|
|
2650
|
-
y,
|
|
2651
|
-
b
|
|
2652
|
-
]);
|
|
2653
|
-
return Q(r.mount, [r]), Q(() => {
|
|
2654
|
-
r.update(e);
|
|
2655
|
-
}), x;
|
|
2656
|
-
}
|
|
2657
|
-
var Go = (({ children: e, ...t }) => {
|
|
2658
|
-
let n = Wo(t);
|
|
2659
|
-
return /* @__PURE__ */ w(Ra, { children: S(() => N(e, n), [e, n]) });
|
|
2660
|
-
});
|
|
2661
|
-
//#endregion
|
|
2662
|
-
//#region node_modules/@tanstack/react-form/dist/esm/useForm.js
|
|
2663
|
-
function Ko({ form: e, selector: t = (e) => e, children: n }) {
|
|
2664
|
-
return /* @__PURE__ */ w(Ra, { children: N(n, Z(e.store, t)) });
|
|
2665
|
-
}
|
|
2666
|
-
function qo(e) {
|
|
2667
|
-
let t = Uo(), [n, r] = C(e?.formId), [i, a] = C(() => new wo({
|
|
2668
|
-
...e,
|
|
2669
|
-
formId: e?.formId ?? t
|
|
2670
|
-
}));
|
|
2671
|
-
if (n !== e?.formId) {
|
|
2672
|
-
let n = e?.formId ?? t;
|
|
2673
|
-
a(new wo({
|
|
2674
|
-
...e,
|
|
2675
|
-
formId: n
|
|
2676
|
-
})), r(n);
|
|
2677
|
-
}
|
|
2678
|
-
let o = S(() => {
|
|
2679
|
-
let e = {
|
|
2680
|
-
...i,
|
|
2681
|
-
handleSubmit: ((...e) => i._handleSubmit(...e)),
|
|
2682
|
-
get formId() {
|
|
2683
|
-
return i._formId;
|
|
2684
|
-
},
|
|
2685
|
-
get state() {
|
|
2686
|
-
return i.store.state;
|
|
2687
|
-
}
|
|
2688
|
-
};
|
|
2689
|
-
return e.Field = function(e) {
|
|
2690
|
-
return /* @__PURE__ */ w(Bo, {
|
|
2691
|
-
...e,
|
|
2692
|
-
form: i
|
|
2693
|
-
});
|
|
2694
|
-
}, e.FormGroup = function(e) {
|
|
2695
|
-
return /* @__PURE__ */ w(Go, {
|
|
2696
|
-
...e,
|
|
2697
|
-
form: i
|
|
2698
|
-
});
|
|
2699
|
-
}, e.Subscribe = function(e) {
|
|
2700
|
-
return /* @__PURE__ */ w(Ko, {
|
|
2701
|
-
form: i,
|
|
2702
|
-
selector: e.selector,
|
|
2703
|
-
children: e.children
|
|
2704
|
-
});
|
|
2705
|
-
}, e;
|
|
2706
|
-
}, [i]);
|
|
2707
|
-
Q(i.mount, []), Q(() => {
|
|
2708
|
-
i.update(e);
|
|
2709
|
-
});
|
|
2710
|
-
let s = Ia(!1);
|
|
2711
|
-
return Q(() => {
|
|
2712
|
-
s.current && e?.transform && Io(i, e.transform);
|
|
2713
|
-
}, [i, e?.transform]), Q(() => {
|
|
2714
|
-
s.current = !0;
|
|
2715
|
-
}), o;
|
|
2716
|
-
}
|
|
2717
|
-
//#endregion
|
|
2718
|
-
//#region node_modules/@tanstack/react-form/dist/esm/useFieldGroup.js
|
|
2719
|
-
function Jo({ lens: e, selector: t = (e) => e, children: n }) {
|
|
2720
|
-
return /* @__PURE__ */ w(Ra, { children: N(n, Z(e.store, t)) });
|
|
2721
|
-
}
|
|
2722
|
-
function Yo(e) {
|
|
2723
|
-
let [t] = C(() => {
|
|
2724
|
-
let n = new Fo(e), r = e.form instanceof Fo ? e.form.form : e.form, i = n;
|
|
2725
|
-
return i.AppForm = function(e) {
|
|
2726
|
-
return /* @__PURE__ */ w(r.AppForm, { ...e });
|
|
2727
|
-
}, i.AppField = function(e) {
|
|
2728
|
-
return /* @__PURE__ */ w(r.AppField, { ...t.getFormFieldOptions(e) });
|
|
2729
|
-
}, i.Field = function(e) {
|
|
2730
|
-
return /* @__PURE__ */ w(r.Field, { ...t.getFormFieldOptions(e) });
|
|
2731
|
-
}, i.Subscribe = function(e) {
|
|
2732
|
-
return /* @__PURE__ */ w(Jo, {
|
|
2733
|
-
lens: t,
|
|
2734
|
-
selector: e.selector,
|
|
2735
|
-
children: e.children
|
|
2736
|
-
});
|
|
2737
|
-
}, Object.assign(i, { ...e.formComponents });
|
|
2738
|
-
});
|
|
2739
|
-
return Q(t.mount, [t]), t;
|
|
2740
|
-
}
|
|
2741
|
-
//#endregion
|
|
2742
|
-
//#region node_modules/@tanstack/react-form/dist/esm/createFormHook.js
|
|
2743
|
-
var Xo = ja(null), Zo = ja(null);
|
|
2744
|
-
function Qo() {
|
|
2745
|
-
let e = Na(Zo);
|
|
2746
|
-
if (!e) throw Error("`formContext` only works when within a `formComponent` passed to `createFormHook`");
|
|
2747
|
-
return e;
|
|
2748
|
-
}
|
|
2749
|
-
function $o() {
|
|
2750
|
-
function e() {
|
|
2751
|
-
let e = Na(Xo);
|
|
2752
|
-
if (!e) throw Error("`fieldContext` only works when within a `fieldComponent` passed to `createFormHook`");
|
|
2753
|
-
return e;
|
|
2754
|
-
}
|
|
2755
|
-
return {
|
|
2756
|
-
fieldContext: Xo,
|
|
2757
|
-
useFieldContext: e,
|
|
2758
|
-
useFormContext: Qo,
|
|
2759
|
-
formContext: Zo
|
|
2760
|
-
};
|
|
2761
|
-
}
|
|
2762
|
-
function es({ fieldComponents: e, fieldContext: t, formContext: n, formComponents: r }) {
|
|
2763
|
-
function i(i) {
|
|
2764
|
-
let a = qo(i), o = S(() => ({ children: e }) => /* @__PURE__ */ w(n.Provider, {
|
|
2765
|
-
value: a,
|
|
2766
|
-
children: e
|
|
2767
|
-
}), [a]), s = S(() => (({ children: n, ...r }) => /* @__PURE__ */ w(a.Field, {
|
|
2768
|
-
...r,
|
|
2769
|
-
children: (r) => /* @__PURE__ */ w(t.Provider, {
|
|
2770
|
-
value: r,
|
|
2771
|
-
children: n(Object.assign(r, e))
|
|
2772
|
-
})
|
|
2773
|
-
})), [a]);
|
|
2774
|
-
return S(() => Object.assign(a, {
|
|
2775
|
-
AppField: s,
|
|
2776
|
-
AppForm: o,
|
|
2777
|
-
...r
|
|
2778
|
-
}), [
|
|
2779
|
-
a,
|
|
2780
|
-
s,
|
|
2781
|
-
o
|
|
2782
|
-
]);
|
|
2783
|
-
}
|
|
2784
|
-
function a({ render: e, props: t }) {
|
|
2785
|
-
return function(n) {
|
|
2786
|
-
return e({
|
|
2787
|
-
...t,
|
|
2788
|
-
...n
|
|
2789
|
-
});
|
|
2790
|
-
};
|
|
2791
|
-
}
|
|
2792
|
-
function o({ render: e, props: t, defaultValues: n }) {
|
|
2793
|
-
return function(i) {
|
|
2794
|
-
let a = Yo(S(() => ({
|
|
2795
|
-
form: i.form,
|
|
2796
|
-
fields: i.fields,
|
|
2797
|
-
defaultValues: n,
|
|
2798
|
-
formComponents: r
|
|
2799
|
-
}), [i.form, i.fields]));
|
|
2800
|
-
return e({
|
|
2801
|
-
...t,
|
|
2802
|
-
...i,
|
|
2803
|
-
group: a
|
|
2804
|
-
});
|
|
2805
|
-
};
|
|
2806
|
-
}
|
|
2807
|
-
function s(e) {
|
|
2808
|
-
return Qo();
|
|
2809
|
-
}
|
|
2810
|
-
function c(i) {
|
|
2811
|
-
return es({
|
|
2812
|
-
fieldContext: t,
|
|
2813
|
-
formContext: n,
|
|
2814
|
-
fieldComponents: {
|
|
2815
|
-
...e,
|
|
2816
|
-
...i.fieldComponents
|
|
2817
|
-
},
|
|
2818
|
-
formComponents: {
|
|
2819
|
-
...r,
|
|
2820
|
-
...i.formComponents
|
|
2821
|
-
}
|
|
2822
|
-
});
|
|
2823
|
-
}
|
|
2824
|
-
return {
|
|
2825
|
-
useAppForm: i,
|
|
2826
|
-
withForm: a,
|
|
2827
|
-
withFieldGroup: o,
|
|
2828
|
-
useTypedAppFormContext: s,
|
|
2829
|
-
extendForm: c
|
|
2830
|
-
};
|
|
2831
|
-
}
|
|
2832
|
-
//#endregion
|
|
2833
65
|
//#region src/components/ui/form.tsx
|
|
2834
|
-
var { fieldContext:
|
|
2835
|
-
function
|
|
2836
|
-
return /* @__PURE__ */
|
|
66
|
+
var { fieldContext: oa, formContext: sa, useFieldContext: $, useFormContext: ca } = ia();
|
|
67
|
+
function la({ className: e, ...n }) {
|
|
68
|
+
return /* @__PURE__ */ X("div", {
|
|
2837
69
|
"data-slot": "form-item",
|
|
2838
|
-
className:
|
|
2839
|
-
...
|
|
70
|
+
className: t("flex flex-col gap-1.5", e),
|
|
71
|
+
...n
|
|
2840
72
|
});
|
|
2841
73
|
}
|
|
2842
|
-
function
|
|
2843
|
-
let
|
|
2844
|
-
return /* @__PURE__ */
|
|
74
|
+
function ua({ className: e, ...n }) {
|
|
75
|
+
let r = $(), i = Q(r.store, (e) => e.meta.errors);
|
|
76
|
+
return /* @__PURE__ */ X(f, {
|
|
2845
77
|
"data-slot": "form-label",
|
|
2846
|
-
htmlFor: String(
|
|
2847
|
-
className:
|
|
2848
|
-
...
|
|
78
|
+
htmlFor: String(r.name),
|
|
79
|
+
className: t(i.length > 0 && "text-destructive", e),
|
|
80
|
+
...n
|
|
2849
81
|
});
|
|
2850
82
|
}
|
|
2851
|
-
function
|
|
2852
|
-
let
|
|
2853
|
-
return /* @__PURE__ */
|
|
83
|
+
function da({ className: e, ...n }) {
|
|
84
|
+
let r = $(), i = Q(r.store, (e) => e.meta.errors), a = String(r.name);
|
|
85
|
+
return /* @__PURE__ */ X("div", {
|
|
2854
86
|
"data-slot": "form-control",
|
|
2855
87
|
id: a,
|
|
2856
88
|
"aria-describedby": `${a}-description ${a}-message`,
|
|
2857
89
|
"aria-invalid": i.length > 0 || void 0,
|
|
2858
|
-
className:
|
|
2859
|
-
...
|
|
90
|
+
className: t("w-full", e),
|
|
91
|
+
...n
|
|
2860
92
|
});
|
|
2861
93
|
}
|
|
2862
|
-
function
|
|
2863
|
-
let
|
|
2864
|
-
return /* @__PURE__ */
|
|
94
|
+
function fa({ className: e, ...n }) {
|
|
95
|
+
let r = $();
|
|
96
|
+
return /* @__PURE__ */ X("p", {
|
|
2865
97
|
"data-slot": "form-description",
|
|
2866
|
-
id: `${String(
|
|
2867
|
-
className:
|
|
2868
|
-
...
|
|
98
|
+
id: `${String(r.name)}-description`,
|
|
99
|
+
className: t("text-sm text-muted-foreground", e),
|
|
100
|
+
...n
|
|
2869
101
|
});
|
|
2870
102
|
}
|
|
2871
|
-
function
|
|
2872
|
-
let i = $(), a =
|
|
2873
|
-
return o ? /* @__PURE__ */
|
|
103
|
+
function pa({ className: e, children: n, ...r }) {
|
|
104
|
+
let i = $(), a = Q(i.store, (e) => e.meta.errors), o = n ?? (a.length > 0 ? a[0]?.message ?? String(a[0]) : null);
|
|
105
|
+
return o ? /* @__PURE__ */ X("p", {
|
|
2874
106
|
"data-slot": "form-message",
|
|
2875
107
|
id: `${String(i.name)}-message`,
|
|
2876
108
|
role: "alert",
|
|
2877
|
-
className:
|
|
2878
|
-
...
|
|
109
|
+
className: t("text-sm font-normal text-destructive", e),
|
|
110
|
+
...r,
|
|
2879
111
|
children: o
|
|
2880
112
|
}) : null;
|
|
2881
113
|
}
|
|
2882
114
|
//#endregion
|
|
2883
|
-
export {
|
|
115
|
+
export { nr as Accordion, Fn as AccordionContent, jn as AccordionItem, $t as AccordionTrigger, xn as Alert, Nr as AlertAction, ar as AlertDescription, je as AlertDialog, kt as AlertDialogAction, Lt as AlertDialogCancel, De as AlertDialogContent, Ue as AlertDialogDescription, br as AlertDialogFooter, ze as AlertDialogHeader, Gt as AlertDialogMedia, Vt as AlertDialogOverlay, Yt as AlertDialogPortal, pt as AlertDialogTitle, v as AlertDialogTrigger, Cr as AlertProvider, Rn as AlertTitle, gr as AspectRatio, aa as Autocomplete, Dn as Avatar, Br as Badge, Tr as Breadcrumb, Bn as BreadcrumbEllipsis, an as BreadcrumbItem, fr as BreadcrumbLink, Ar as BreadcrumbList, mn as BreadcrumbPage, Qn as BreadcrumbSeparator, a as Button, ft as ButtonGroup, _ as ButtonGroupSeparator, Cn as ButtonGroupText, Y as CCombobox, mi as Calendar, gi as CalendarDayButton, Ee as Card, He as CardAction, yr as CardContent, Re as CardDescription, Wt as CardFooter, Bt as CardHeader, Jt as CardTitle, li as Carousel, Ii as CarouselContent, _i as CarouselItem, vi as CarouselNext, bi as CarouselPrevious, Yi as ChartContainer, wi as ChartLegend, fi as ChartLegendContent, di as ChartStyle, yi as ChartTooltip, Li as ChartTooltipContent, It as Checkbox, Mt as Collapsible, Ae as CollapsibleContent, Ot as CollapsibleTrigger, Si as Combobox, R as ComboboxChip, H as ComboboxChips, B as ComboboxChipsInput, Ti as ComboboxCollection, U as ComboboxContent, z as ComboboxEmpty, hi as ComboboxField, Ui as ComboboxGroup, V as ComboboxInput, W as ComboboxItem, Ei as ComboboxLabel, G as ComboboxList, xi as ComboboxSeparator, ci as ComboboxStatus, K as ComboboxTrigger, J as ComboboxValue, Pi as Command, Ni as CommandDialog, Di as CommandEmpty, Ji as CommandGroup, Zi as CommandInput, ki as CommandItem, Xi as CommandList, Ci as CommandSeparator, ui as CommandShortcut, E as ConfirmationDialogProvider, ve as ContextMenu, N as ContextMenuCheckboxItem, it as ContextMenuContent, Kn as ContextMenuGroup, x as ContextMenuItem, Un as ContextMenuLabel, Xe as ContextMenuPortal, et as ContextMenuRadioGroup, ct as ContextMenuRadioItem, Se as ContextMenuSeparator, Pe as ContextMenuShortcut, Ke as ContextMenuSub, gt as ContextMenuSubContent, ai as ContextMenuSubTrigger, T as ContextMenuTrigger, r as DEFAULT_OPSFUSE_BRAND_THEME, Qi as DateFns, re as Dialog, fe as DialogClose, le as DialogContent, ae as DialogDescription, ie as DialogFooter, u as DialogHeader, _e as DialogOverlay, m as DialogPortal, ee as DialogProvider, p as DialogTitle, l as DialogTrigger, qr as DirectionProvider, Oi as Drawer, Vi as DrawerClose, Gi as DrawerContent, Ai as DrawerDescription, Ri as DrawerFooter, qi as DrawerHeader, ji as DrawerOverlay, Mi as DrawerPortal, Hi as DrawerTitle, zi as DrawerTrigger, k as DropdownMenu, bt as Empty, En as Field, hr as FieldContent, tr as FieldDescription, Pn as FieldError, An as FieldGroup, Qt as FieldLabel, Ur as FieldLegend, ti as FieldSeparator, cn as FieldSet, Zr as FieldTitle, da as FormControl, fa as FormDescription, la as FormItem, ua as FormLabel, pa as FormMessage, Zn as HoverCard, zr as HoverCardContent, vn as HoverCardTrigger, te as Input, he as InputGroup, ue as InputGroupAddon, pe as InputGroupButton, oe as InputGroupInput, d as InputGroupText, de as InputGroupTextarea, Ki as InputOTP, Bi as InputOTPGroup, Wi as InputOTPSeparator, Fi as InputOTPSlot, mt as Item, y as ItemActions, Sn as ItemContent, Pr as ItemDescription, or as ItemFooter, wr as ItemGroup, zn as ItemHeader, rn as ItemMedia, dr as ItemSeparator, kr as ItemTitle, Ht as Kbd, Xt as KbdGroup, f as Label, $i as Lucide, ut as Menubar, we as MenubarCheckboxItem, Ie as MenubarContent, Je as MenubarGroup, vt as MenubarItem, si as MenubarLabel, D as MenubarMenu, Pt as MenubarPortal, Me as MenubarRadioGroup, At as MenubarRadioItem, Rt as MenubarSeparator, Oe as MenubarShortcut, We as MenubarSub, xr as MenubarSubContent, Be as MenubarSubTrigger, Kt as MenubarTrigger, Et as NavigationMenu, be as NavigationMenuContent, F as NavigationMenuIndicator, ot as NavigationMenuItem, Jn as NavigationMenuLink, C as NavigationMenuList, Wn as NavigationMenuTrigger, Qe as NavigationMenuViewport, i as OPSFUSE_BRAND_THEMES, s as OPSFUSE_THEME_SCOPE, ni as OpsfuseRoot, ln as OpsfuseThemeProvider, pn as PageHeader, Gr as Pagination, ri as PaginationContent, un as PaginationEllipsis, $r as PaginationItem, St as PaginationLink, j as PaginationNext, Yr as PaginationPrevious, en as PaginationWrapper, Vr as Popover, bn as PopoverAnchor, On as PopoverContent, _r as PopoverDescription, rr as PopoverHeader, In as PopoverTitle, Mn as PopoverTrigger, $n as Progress, jr as RadioGroup, hn as RadioGroupItem, ta as Recharts, _n as RecruitSmartly, Vn as ResizableHandle, on as ResizablePanel, pr as ResizablePanelGroup, Te as SSelect, Jr as STooltip, cr as ScrollArea, Er as ScrollBar, Ft as Select, Ve as SelectContent, vr as SelectField, Le as SelectGroup, Ut as SelectItem, zt as SelectLabel, qt as SelectScrollDownButton, dt as SelectScrollUpButton, g as SelectSeparator, wn as SelectTrigger, Ir as SelectValue, sr as Separator, S as Sheet, L as SheetClose, Ze as SheetContent, tt as SheetDescription, lt as SheetFooter, Ce as SheetHeader, Fe as SheetProvider, qe as SheetTitle, _t as SheetTrigger, ei as Sidebar, sn as SidebarContent, Xr as SidebarFooter, yt as SidebarGroup, O as SidebarGroupAction, Kr as SidebarGroupContent, Ct as SidebarGroupLabel, I as SidebarHeader, M as SidebarInput, rt as SidebarInset, Gn as SidebarMenu, b as SidebarMenuAction, Hn as SidebarMenuBadge, Ye as SidebarMenuButton, $e as SidebarMenuItem, st as SidebarMenuSkeleton, xe as SidebarMenuSub, Ne as SidebarMenuSubButton, Ge as SidebarMenuSubItem, ht as SidebarProvider, ii as SidebarRail, w as SidebarSeparator, jt as SidebarTrigger, Dt as Skeleton, Rr as SkillReady, P as Slider, at as SliderDialogProvider, h as Spinner, Hr as Switch, Lr as Table, gn as TableBody, Tn as TableCaption, mr as TableCell, er as TableFooter, Nn as TableHead, kn as TableHeader, Zt as TableRow, lr as Tabs, tn as TabsComponent, Dr as TabsContent, dn as TabsList, Yn as TabsTrigger, Xn as TalentScan, me as Textarea, ge as Toaster, Sr as Toggle, Mr as ToggleGroup, ir as ToggleGroupItem, xt as Tooltip, A as TooltipContent, Tt as TooltipProvider, ye as TooltipTrigger, fn as Verity, Or as WorkLog, yn as badgeVariants, Fr as buttonGroupVariants, c as buttonVariants, t as cn, Nt as confirm, ra as createFormHook, nn as dismissAlert, oa as fieldContext, sa as formContext, ce as mergeOpsfusePortalSurface, nt as navigationMenuTriggerStyle, n as openDialog, oi as openSheet, qn as openSlider, e as opsfuseBrandThemeClass, ur as showAlert, ne as toast, Ln as toggleVariants, pi as useCarousel, q as useComboboxAnchor, wt as useDirection, $ as useFieldContext, ca as useFormContext, Wr as useIsMobile, Qr as useLinkComponent, se as useOpsfuseBrandTheme, o as useOpsfusePortalSurface, ke as useSidebar };
|