@golemui/core 1.0.0-rc.2 → 1.0.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/index.js +1292 -1216
- package/index.umd.cjs +8 -8
- package/lib/errors.d.ts +1 -0
- package/lib/utils/decoder.d.ts +5 -9
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -1,283 +1,329 @@
|
|
|
1
|
-
import { BehaviorSubject as
|
|
1
|
+
import { BehaviorSubject as rr, distinctUntilChanged as F, Subject as ct, pipe as j, map as k, filter as Se, combineLatest as nr, startWith as or } from "rxjs";
|
|
2
2
|
import "@standard-schema/spec";
|
|
3
|
-
function
|
|
4
|
-
const
|
|
5
|
-
if (
|
|
3
|
+
function sr(e, t) {
|
|
4
|
+
const r = e["~standard"].validate(t);
|
|
5
|
+
if (r instanceof Promise)
|
|
6
6
|
throw new TypeError("Schema validation must be synchronous");
|
|
7
|
-
return
|
|
7
|
+
return r;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function ir(e) {
|
|
10
10
|
return e.issues === void 0;
|
|
11
11
|
}
|
|
12
|
-
var
|
|
12
|
+
var ur = class {
|
|
13
|
+
value;
|
|
13
14
|
constructor(e) {
|
|
14
15
|
this.value = e;
|
|
15
16
|
}
|
|
16
17
|
map(e) {
|
|
17
|
-
return
|
|
18
|
+
return T(e(this.value));
|
|
18
19
|
}
|
|
19
20
|
isOk() {
|
|
20
21
|
return !0;
|
|
21
22
|
}
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
}, dr = class At {
|
|
24
|
+
issues;
|
|
25
|
+
constructor(t) {
|
|
26
|
+
this.issues = t;
|
|
25
27
|
}
|
|
26
|
-
map(
|
|
27
|
-
return
|
|
28
|
+
map(t) {
|
|
29
|
+
return new At(this.issues);
|
|
28
30
|
}
|
|
29
31
|
isOk() {
|
|
30
32
|
return !1;
|
|
31
33
|
}
|
|
32
34
|
};
|
|
33
|
-
function
|
|
34
|
-
return new
|
|
35
|
-
}
|
|
36
|
-
function
|
|
37
|
-
return new
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
35
|
+
function T(e) {
|
|
36
|
+
return new ur(e);
|
|
37
|
+
}
|
|
38
|
+
function v(e) {
|
|
39
|
+
return new dr(e);
|
|
40
|
+
}
|
|
41
|
+
function $t(e) {
|
|
42
|
+
return e.reduce((t, r) => typeof r == "number" ? `${t}[${r}]` : t.length === 0 ? String(r) : `${t}.${r}`, "");
|
|
43
|
+
}
|
|
44
|
+
function lt(e) {
|
|
45
|
+
return e.map((t) => t.path.length === 0 ? t.message : `${$t(t.path)}: ${t.message}`).join("; ");
|
|
46
|
+
}
|
|
47
|
+
var C = class We {
|
|
48
|
+
decodeFn;
|
|
49
|
+
constructor(t) {
|
|
50
|
+
this.decodeFn = t;
|
|
45
51
|
}
|
|
46
|
-
parse(
|
|
47
|
-
let
|
|
48
|
-
if (
|
|
49
|
-
|
|
52
|
+
parse(t) {
|
|
53
|
+
let r = this.decode(t);
|
|
54
|
+
if (r.isOk()) return r.value;
|
|
55
|
+
{
|
|
56
|
+
let n = r;
|
|
57
|
+
throw Error(lt(n.issues), { cause: n.issues });
|
|
58
|
+
}
|
|
50
59
|
}
|
|
51
|
-
decode(
|
|
52
|
-
return this.decodeFn(
|
|
60
|
+
decode(t) {
|
|
61
|
+
return this.decodeFn(t);
|
|
53
62
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
"~standard" = {
|
|
64
|
+
version: 1,
|
|
65
|
+
vendor: "ts.data.json",
|
|
66
|
+
validate: (t) => {
|
|
67
|
+
let r = this.decode(t);
|
|
68
|
+
return r.isOk() ? { value: r.value } : { issues: r.issues.map((n) => ({
|
|
69
|
+
message: n.message,
|
|
70
|
+
path: n.path.length > 0 ? n.path.map((o) => ({ key: o })) : void 0
|
|
71
|
+
})) };
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
decodePromise(t) {
|
|
75
|
+
return new Promise((r, n) => {
|
|
76
|
+
let o = this.decode(t);
|
|
77
|
+
if (o.isOk()) return r(o.value);
|
|
78
|
+
{
|
|
79
|
+
let s = o;
|
|
80
|
+
return n(Error(lt(s.issues), { cause: s.issues }));
|
|
81
|
+
}
|
|
58
82
|
});
|
|
59
83
|
}
|
|
60
|
-
map(
|
|
61
|
-
return new
|
|
62
|
-
let n = this.decodeFn(
|
|
63
|
-
return n.isOk() ?
|
|
84
|
+
map(t) {
|
|
85
|
+
return new We((r) => {
|
|
86
|
+
let n = this.decodeFn(r);
|
|
87
|
+
return n.isOk() ? T(t(n.value)) : v(n.issues);
|
|
64
88
|
});
|
|
65
89
|
}
|
|
66
|
-
flatMap(
|
|
67
|
-
return new
|
|
68
|
-
let n = this.decodeFn(
|
|
69
|
-
return n.isOk() ?
|
|
90
|
+
flatMap(t) {
|
|
91
|
+
return new We((r) => {
|
|
92
|
+
let n = this.decodeFn(r);
|
|
93
|
+
return n.isOk() ? t(n.value).decode(r) : v(n.issues);
|
|
70
94
|
});
|
|
71
95
|
}
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
}, X = (e, t) => [{
|
|
97
|
+
message: `${JSON.stringify(e)} is not a valid ${t}`,
|
|
98
|
+
path: []
|
|
99
|
+
}], Ue = (e, t) => e.map((r) => ({
|
|
100
|
+
...r,
|
|
101
|
+
path: [t, ...r.path]
|
|
102
|
+
}));
|
|
103
|
+
function Me(e) {
|
|
104
|
+
return new C((t) => {
|
|
75
105
|
if (t instanceof Array) {
|
|
76
|
-
let n = [];
|
|
106
|
+
let r = [], n = [];
|
|
77
107
|
for (let o = 0; o < t.length; o++) {
|
|
78
|
-
let
|
|
79
|
-
|
|
80
|
-
else return w(ot(r, o, i.error));
|
|
108
|
+
let s = e.decode(t[o]);
|
|
109
|
+
s.isOk() ? r.push(s.value) : n.push(...Ue(s.issues, o));
|
|
81
110
|
}
|
|
82
|
-
return
|
|
83
|
-
} else return
|
|
111
|
+
return n.length > 0 ? v(n) : T(r);
|
|
112
|
+
} else return v(X(t, "array"));
|
|
84
113
|
});
|
|
85
114
|
}
|
|
86
|
-
function
|
|
87
|
-
return new
|
|
115
|
+
function cr() {
|
|
116
|
+
return new C((e) => typeof e == "boolean" ? T(e) : v(X(e, "boolean")));
|
|
117
|
+
}
|
|
118
|
+
function lr(e, t) {
|
|
119
|
+
return new C((r) => {
|
|
120
|
+
if (typeof r != "object" || !r) return v(X(r, "object"));
|
|
121
|
+
let n = r[e];
|
|
122
|
+
return Object.prototype.hasOwnProperty.call(t, n) ? t[n].decode(r) : v([{
|
|
123
|
+
message: `"${e}" must be one of ${Object.keys(t).map((o) => JSON.stringify(o)).join(", ")}, but got ${JSON.stringify(n)}`,
|
|
124
|
+
path: [e]
|
|
125
|
+
}]);
|
|
126
|
+
});
|
|
88
127
|
}
|
|
89
|
-
function
|
|
90
|
-
return new
|
|
128
|
+
function St(e) {
|
|
129
|
+
return new C((t) => e().decode(t));
|
|
91
130
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
131
|
+
function Q(e) {
|
|
132
|
+
return new C((t) => t === e ? T(e) : v([{
|
|
133
|
+
message: `${JSON.stringify(t)} is not exactly ${JSON.stringify(e)}`,
|
|
134
|
+
path: []
|
|
135
|
+
}]));
|
|
95
136
|
}
|
|
96
|
-
function
|
|
97
|
-
return new
|
|
137
|
+
function Ee() {
|
|
138
|
+
return new C((e) => typeof e == "number" ? T(e) : v(X(e, "number")));
|
|
98
139
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
let n = {};
|
|
140
|
+
function oe(e) {
|
|
141
|
+
return new C((t) => {
|
|
142
|
+
if (typeof t == "object" && t) {
|
|
143
|
+
let r = {}, n = [];
|
|
104
144
|
for (let o in e) if (Object.prototype.hasOwnProperty.call(e, o)) {
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
else return w(dt(r, o, i.error));
|
|
145
|
+
let s, i = e[o];
|
|
146
|
+
s = i instanceof C ? i.decode(t[o]) : i.decoder.decode(t[i.fromKey]), s.isOk() ? r[o] = s.value : n.push(...Ue(s.issues, o));
|
|
108
147
|
}
|
|
109
|
-
return
|
|
110
|
-
} else return
|
|
148
|
+
return n.length > 0 ? v(n) : T(r);
|
|
149
|
+
} else return v(X(t, "object"));
|
|
111
150
|
});
|
|
112
151
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
152
|
+
function x(e) {
|
|
153
|
+
return new C((t) => {
|
|
154
|
+
let r = [];
|
|
116
155
|
for (let n = 0; n < e.length; n++) {
|
|
117
156
|
let o = e[n].decode(t);
|
|
118
157
|
if (o.isOk()) return o;
|
|
158
|
+
r.push(o.issues);
|
|
119
159
|
}
|
|
120
|
-
return
|
|
160
|
+
return v([{
|
|
161
|
+
message: `no alternative matched (tried ${e.length})`,
|
|
162
|
+
path: []
|
|
163
|
+
}, ...ar(r)]);
|
|
121
164
|
});
|
|
122
165
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
166
|
+
function ar(e) {
|
|
167
|
+
let t = /* @__PURE__ */ new Map();
|
|
168
|
+
for (let r of e) for (let n of r) {
|
|
169
|
+
let o = JSON.stringify(n.path), s = t.get(o);
|
|
170
|
+
s ? s.messages.includes(n.message) || s.messages.push(n.message) : t.set(o, {
|
|
171
|
+
path: n.path,
|
|
172
|
+
messages: [n.message]
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return Array.from(t.values()).map(({ path: r, messages: n }) => ({
|
|
176
|
+
message: n.join(" or "),
|
|
177
|
+
path: r
|
|
178
|
+
}));
|
|
179
|
+
}
|
|
180
|
+
function y(e) {
|
|
181
|
+
return new C((t) => t === void 0 ? T(void 0) : e.decode(t));
|
|
182
|
+
}
|
|
183
|
+
function fr(e) {
|
|
184
|
+
return new C((t) => {
|
|
185
|
+
if (typeof t == "object" && t) {
|
|
186
|
+
let r = {}, n = [];
|
|
131
187
|
for (let o in t) if (Object.prototype.hasOwnProperty.call(t, o)) {
|
|
132
|
-
let
|
|
133
|
-
|
|
134
|
-
else return w(ct(r, o, i.error));
|
|
188
|
+
let s = e.decode(t[o]);
|
|
189
|
+
s.isOk() ? r[o] = s.value : n.push(...Ue(s.issues, o));
|
|
135
190
|
}
|
|
136
|
-
return
|
|
137
|
-
} else return
|
|
191
|
+
return n.length > 0 ? v(n) : T(r);
|
|
192
|
+
} else return v(X(t, "object"));
|
|
138
193
|
});
|
|
139
194
|
}
|
|
140
|
-
function
|
|
141
|
-
return new
|
|
195
|
+
function w() {
|
|
196
|
+
return new C((e) => typeof e == "string" ? T(e) : v(X(e, "string")));
|
|
142
197
|
}
|
|
143
|
-
function
|
|
144
|
-
return new
|
|
198
|
+
function z() {
|
|
199
|
+
return new C((e) => T(e));
|
|
145
200
|
}
|
|
146
|
-
function
|
|
147
|
-
return new
|
|
201
|
+
function se(e) {
|
|
202
|
+
return new C((t) => {
|
|
148
203
|
if (typeof t != "object" || t === null)
|
|
149
|
-
return
|
|
150
|
-
const
|
|
151
|
-
for (const [
|
|
152
|
-
const s =
|
|
204
|
+
return v([{ message: `Expected object literal, got "${typeof t}"`, path: [] }]);
|
|
205
|
+
const r = {};
|
|
206
|
+
for (const [n, o] of Object.entries(e)) {
|
|
207
|
+
const s = o.decoder.decode(t[n]);
|
|
153
208
|
if (!s.isOk())
|
|
154
|
-
return
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
209
|
+
return v(
|
|
210
|
+
s.issues.map((i) => ({
|
|
211
|
+
message: i.message,
|
|
212
|
+
path: [n, ...i.path]
|
|
213
|
+
}))
|
|
214
|
+
);
|
|
215
|
+
if (r[n] = s.value, o.suffixed) {
|
|
216
|
+
for (const [i, d] of Object.entries(t))
|
|
217
|
+
if (i.startsWith(n + ".")) {
|
|
218
|
+
const c = o.decoder.decode(d);
|
|
219
|
+
if (!c.isOk())
|
|
220
|
+
return v(
|
|
221
|
+
c.issues.map((l) => ({
|
|
222
|
+
message: l.message,
|
|
223
|
+
path: [i, ...l.path]
|
|
224
|
+
}))
|
|
225
|
+
);
|
|
226
|
+
r[i] = c.value;
|
|
162
227
|
}
|
|
163
228
|
}
|
|
164
229
|
}
|
|
165
|
-
return
|
|
230
|
+
return T(r);
|
|
166
231
|
});
|
|
167
232
|
}
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
return
|
|
171
|
-
}), U = (e) =>
|
|
172
|
-
{
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
233
|
+
const Et = () => crypto.randomUUID().slice(0, 8), hr = (e) => typeof e != "function" && e.kind === "display", te = (e) => typeof e != "function" && e.kind === "action", I = (e) => typeof e != "function" && e.kind === "input", he = (e) => typeof e != "function" && e.kind === "layout", ie = (e) => typeof e == "function", pr = oe({ in: Me(w()) }), He = oe({ when: w() }), ve = x([pr, He]), mr = oe({ from: Me(w()) }), we = x([mr, He]), Pe = x([cr(), He]), gr = new C((e) => {
|
|
234
|
+
const t = typeof e;
|
|
235
|
+
return t === "function" ? T(e) : v([{ message: `Expected a function, got '${t}'`, path: [] }]);
|
|
236
|
+
}), U = (e) => x([e, gr]), Ge = se({
|
|
237
|
+
load: { suffixed: !0, decoder: U(y(w())) },
|
|
238
|
+
click: { suffixed: !0, decoder: U(y(w())) },
|
|
239
|
+
change: { suffixed: !0, decoder: U(y(w())) },
|
|
240
|
+
filter: { suffixed: !0, decoder: U(y(w())) },
|
|
241
|
+
blur: { suffixed: !0, decoder: U(y(w())) }
|
|
242
|
+
}), yr = oe({
|
|
243
|
+
key: w(),
|
|
244
|
+
default: y(w()),
|
|
245
|
+
params: y(z())
|
|
246
|
+
}), vt = x([w(), yr]), Be = y(w()).map((e) => e || Et()), Ar = se({
|
|
247
|
+
kind: { decoder: Q("display") },
|
|
248
|
+
uid: { decoder: Be },
|
|
249
|
+
type: { decoder: w() },
|
|
250
|
+
size: { suffixed: !0, decoder: y(Ee()) },
|
|
251
|
+
include: { decoder: y(ve) },
|
|
252
|
+
exclude: { decoder: y(we) },
|
|
253
|
+
props: { decoder: y(z()) }
|
|
254
|
+
}), $r = se({
|
|
255
|
+
kind: { decoder: Q("action") },
|
|
256
|
+
uid: { decoder: Be },
|
|
257
|
+
type: { decoder: w() },
|
|
258
|
+
actionType: {
|
|
259
|
+
decoder: y(x([Q("button"), Q("submit")]))
|
|
178
260
|
},
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
{
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
261
|
+
size: { suffixed: !0, decoder: y(Ee()) },
|
|
262
|
+
include: { decoder: y(ve) },
|
|
263
|
+
exclude: { decoder: y(we) },
|
|
264
|
+
label: {
|
|
265
|
+
suffixed: !0,
|
|
266
|
+
decoder: U(y(vt))
|
|
185
267
|
},
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
{
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
exclude: { decoder: m(Ee) },
|
|
195
|
-
props: { decoder: m(X()) }
|
|
196
|
-
},
|
|
197
|
-
"DisplayWidget"
|
|
198
|
-
), yt = ie(
|
|
199
|
-
{
|
|
200
|
-
kind: { decoder: q("action") },
|
|
201
|
-
uid: { decoder: Be },
|
|
202
|
-
type: { decoder: E() },
|
|
203
|
-
actionType: {
|
|
204
|
-
decoder: m(z([q("button"), q("submit")], "button | submit "))
|
|
205
|
-
},
|
|
206
|
-
size: { suffixed: !0, decoder: m(Se()) },
|
|
207
|
-
include: { decoder: m(ve) },
|
|
208
|
-
exclude: { decoder: m(Ee) },
|
|
209
|
-
label: {
|
|
210
|
-
suffixed: !0,
|
|
211
|
-
decoder: U(m(Ar))
|
|
212
|
-
},
|
|
213
|
-
disabled: { suffixed: !0, decoder: m(_e) },
|
|
214
|
-
on: { decoder: m(He) },
|
|
215
|
-
props: { decoder: m(X()) }
|
|
216
|
-
},
|
|
217
|
-
"ActionWidget"
|
|
218
|
-
), At = new F((e) => {
|
|
219
|
-
const r = typeof e;
|
|
220
|
-
if (r === "function") {
|
|
221
|
-
const t = e, n = t(void 0);
|
|
222
|
-
return t.uid = n.uid || yr(), t.type = n.type, t.path = n.path, W(t);
|
|
268
|
+
disabled: { suffixed: !0, decoder: y(Pe) },
|
|
269
|
+
on: { decoder: y(Ge) },
|
|
270
|
+
props: { decoder: y(z()) }
|
|
271
|
+
}), Sr = new C((e) => {
|
|
272
|
+
const t = typeof e;
|
|
273
|
+
if (t === "function") {
|
|
274
|
+
const r = e, n = r(void 0);
|
|
275
|
+
return r.uid = n.uid || Et(), r.type = n.type, r.path = n.path, T(r);
|
|
223
276
|
} else
|
|
224
|
-
return
|
|
225
|
-
}),
|
|
226
|
-
{
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
decoder: U(m(Ar))
|
|
240
|
-
},
|
|
241
|
-
path: { decoder: E() },
|
|
242
|
-
defaultValue: { decoder: m(X()) },
|
|
243
|
-
validator: {
|
|
244
|
-
suffixed: !0,
|
|
245
|
-
decoder: U(m(X()))
|
|
246
|
-
}
|
|
277
|
+
return v([{ message: `Expected a function, got '${t}'`, path: [] }]);
|
|
278
|
+
}), Er = se({
|
|
279
|
+
kind: { decoder: Q("input") },
|
|
280
|
+
uid: { decoder: y(w()) },
|
|
281
|
+
type: { decoder: w() },
|
|
282
|
+
size: { suffixed: !0, decoder: y(Ee()) },
|
|
283
|
+
include: { decoder: y(ve) },
|
|
284
|
+
exclude: { decoder: y(we) },
|
|
285
|
+
disabled: { suffixed: !0, decoder: y(Pe) },
|
|
286
|
+
readonly: { suffixed: !0, decoder: y(Pe) },
|
|
287
|
+
on: { decoder: y(Ge) },
|
|
288
|
+
props: { decoder: y(z()) },
|
|
289
|
+
label: {
|
|
290
|
+
suffixed: !0,
|
|
291
|
+
decoder: U(y(vt))
|
|
247
292
|
},
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
t.template = Ge.parse(t.template);
|
|
293
|
+
path: { decoder: w() },
|
|
294
|
+
defaultValue: { decoder: y(z()) },
|
|
295
|
+
validator: {
|
|
296
|
+
suffixed: !0,
|
|
297
|
+
decoder: U(y(z()))
|
|
254
298
|
}
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
()
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
|
|
299
|
+
}).map((e) => {
|
|
300
|
+
const t = { ...e };
|
|
301
|
+
if (e.uid || (t.uid = `${e.path}-${e.type}`), e.type === "repeater") {
|
|
302
|
+
const r = e.props;
|
|
303
|
+
r.template = Ke.parse(r.template);
|
|
304
|
+
}
|
|
305
|
+
return t;
|
|
306
|
+
}), vr = St(() => {
|
|
307
|
+
const e = lr("kind", {
|
|
308
|
+
input: Er,
|
|
309
|
+
layout: Ke,
|
|
310
|
+
display: Ar,
|
|
311
|
+
action: $r
|
|
312
|
+
});
|
|
313
|
+
return new C(
|
|
314
|
+
(t) => typeof t == "function" ? Sr.decode(t) : e.decode(t)
|
|
315
|
+
);
|
|
316
|
+
}), Ke = se({
|
|
317
|
+
kind: { decoder: Q("layout") },
|
|
318
|
+
uid: { decoder: Be },
|
|
319
|
+
type: { decoder: w() },
|
|
320
|
+
size: { suffixed: !0, decoder: y(Ee()) },
|
|
321
|
+
include: { decoder: y(ve) },
|
|
322
|
+
exclude: { decoder: y(we) },
|
|
323
|
+
props: { decoder: y(z()) },
|
|
324
|
+
on: { decoder: y(Ge) },
|
|
325
|
+
children: { decoder: Me(vr) }
|
|
326
|
+
}), B = class B {
|
|
281
327
|
constructor() {
|
|
282
328
|
this.widgetLoaders = {}, this._ready = !1;
|
|
283
329
|
}
|
|
@@ -287,21 +333,21 @@ const yr = () => crypto.randomUUID().slice(0, 8), at = (e) => typeof e != "funct
|
|
|
287
333
|
get ready() {
|
|
288
334
|
return this._ready;
|
|
289
335
|
}
|
|
290
|
-
setWidgetLoaders(
|
|
291
|
-
this.widgetLoaders =
|
|
336
|
+
setWidgetLoaders(t) {
|
|
337
|
+
this.widgetLoaders = t, this._ready = !0;
|
|
292
338
|
}
|
|
293
|
-
async loadWidget(
|
|
294
|
-
const
|
|
295
|
-
if (!
|
|
296
|
-
const n =
|
|
297
|
-
|
|
339
|
+
async loadWidget(t) {
|
|
340
|
+
const r = this.widgetLoaders[t];
|
|
341
|
+
if (!B.sharedCache.has(r)) {
|
|
342
|
+
const n = r().catch((o) => (B.sharedCache.delete(r), Promise.reject(o)));
|
|
343
|
+
B.sharedCache.set(r, n);
|
|
298
344
|
}
|
|
299
|
-
return
|
|
345
|
+
return B.sharedCache.get(r);
|
|
300
346
|
}
|
|
301
347
|
};
|
|
302
|
-
|
|
303
|
-
let
|
|
304
|
-
function
|
|
348
|
+
B.sharedCache = /* @__PURE__ */ new Map();
|
|
349
|
+
let Ne = B;
|
|
350
|
+
function jo(e) {
|
|
305
351
|
return {
|
|
306
352
|
...e,
|
|
307
353
|
form: {
|
|
@@ -312,15 +358,12 @@ function Oo(e) {
|
|
|
312
358
|
}
|
|
313
359
|
};
|
|
314
360
|
}
|
|
315
|
-
const
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
"FormDef"
|
|
321
|
-
), Sr = (e) => ({
|
|
361
|
+
const wt = oe({
|
|
362
|
+
states: y(fr(w())),
|
|
363
|
+
form: St(() => Ke)
|
|
364
|
+
}), Ot = (e) => ({
|
|
322
365
|
formName: "",
|
|
323
|
-
formDef:
|
|
366
|
+
formDef: wt.parse({
|
|
324
367
|
form: {
|
|
325
368
|
kind: "layout",
|
|
326
369
|
type: "flex",
|
|
@@ -341,13 +384,13 @@ const $r = oe(
|
|
|
341
384
|
formHealth: { status: "ok" },
|
|
342
385
|
touched: !1,
|
|
343
386
|
lang: e
|
|
344
|
-
}),
|
|
345
|
-
function
|
|
346
|
-
const
|
|
347
|
-
return ["Arab", "Hebr", "Thaa", "Syrc", "Tfng", "Adlm", "Rohg"].includes(
|
|
387
|
+
}), wr = (e) => !(typeof e != "object" || e === null || typeof e.key != "string");
|
|
388
|
+
function Wo(e) {
|
|
389
|
+
const t = new Intl.Locale(e).maximize().script;
|
|
390
|
+
return ["Arab", "Hebr", "Thaa", "Syrc", "Tfng", "Adlm", "Rohg"].includes(t || "") ? "rtl" : "ltr";
|
|
348
391
|
}
|
|
349
|
-
const
|
|
350
|
-
const
|
|
392
|
+
const Or = (e = navigator.language || "en-US") => {
|
|
393
|
+
const t = /* @__PURE__ */ new Set();
|
|
351
394
|
return {
|
|
352
395
|
get lang() {
|
|
353
396
|
return e;
|
|
@@ -356,772 +399,773 @@ const Et = (e = navigator.language || "en-US") => {
|
|
|
356
399
|
return n;
|
|
357
400
|
},
|
|
358
401
|
subscribe(n) {
|
|
359
|
-
return
|
|
360
|
-
|
|
402
|
+
return t.add(n), () => {
|
|
403
|
+
t.delete(n);
|
|
361
404
|
};
|
|
362
405
|
},
|
|
363
406
|
setLang(n) {
|
|
364
|
-
e = n,
|
|
407
|
+
e = n, t.forEach((o) => o(e));
|
|
365
408
|
}
|
|
366
409
|
};
|
|
367
|
-
},
|
|
410
|
+
}, Ir = (e) => {
|
|
368
411
|
throw new Error(`Unhandled case: ${JSON.stringify(e)}`);
|
|
369
412
|
};
|
|
370
|
-
function
|
|
371
|
-
return
|
|
413
|
+
function N(e, ...t) {
|
|
414
|
+
return t.reduce((r, n) => n(r), e);
|
|
372
415
|
}
|
|
373
|
-
function
|
|
374
|
-
const
|
|
375
|
-
if (!
|
|
416
|
+
function Cr(e, t) {
|
|
417
|
+
const r = t.payload.widget.uid;
|
|
418
|
+
if (!r)
|
|
376
419
|
throw new Error("addWidget: widget must have a uid");
|
|
377
|
-
const n =
|
|
420
|
+
const n = t.payload.widget, o = e.touched && I(n) ? { ...e.touchedControls, [n.path]: !0 } : e.touchedControls;
|
|
378
421
|
return {
|
|
379
422
|
...e,
|
|
380
423
|
touchedControls: o,
|
|
381
424
|
calculatedWidgets: {
|
|
382
425
|
...e.calculatedWidgets,
|
|
383
|
-
[
|
|
426
|
+
[r]: {
|
|
384
427
|
source: n,
|
|
385
428
|
current: {}
|
|
386
429
|
}
|
|
387
430
|
}
|
|
388
431
|
};
|
|
389
432
|
}
|
|
390
|
-
const
|
|
433
|
+
const q = {
|
|
391
434
|
calculateCurrentStateError: 10,
|
|
392
435
|
initializeParseError: 20,
|
|
393
436
|
initializeUidCollisionError: 21,
|
|
394
437
|
initializeUnknownError: 22,
|
|
438
|
+
initializeMalformedFormShapeError: 23,
|
|
395
439
|
widgetCouldNotBeLoaded: 30,
|
|
396
440
|
resolveStringInterpolationError: 40
|
|
397
|
-
},
|
|
441
|
+
}, ue = (e, t) => {
|
|
398
442
|
if (e === void 0)
|
|
399
443
|
throw new Error("obj is undefined");
|
|
400
|
-
return
|
|
401
|
-
},
|
|
444
|
+
return t.split(".").reduce((r, n) => r === void 0 || n === "" ? r : Array.isArray(r) ? r[parseInt(n, 10)] : r[n], e);
|
|
445
|
+
}, ze = (e, t, r) => {
|
|
402
446
|
if (e === null)
|
|
403
447
|
throw new Error("object is null");
|
|
404
448
|
if (e === void 0)
|
|
405
449
|
throw new Error("object is undefined");
|
|
406
|
-
if (
|
|
450
|
+
if (t === "")
|
|
407
451
|
throw new Error("path cannot be empty");
|
|
408
|
-
const n =
|
|
452
|
+
const n = t.split(".");
|
|
409
453
|
let o = e;
|
|
410
|
-
for (let
|
|
411
|
-
const
|
|
412
|
-
(o[
|
|
454
|
+
for (let i = 0; i < n.length - 1; i++) {
|
|
455
|
+
const d = n[i], c = n[i + 1];
|
|
456
|
+
(o[d] == null || typeof o[d] != "object") && (o[d] = kr(c) ? [] : {}), o = o[d];
|
|
413
457
|
}
|
|
414
|
-
const
|
|
415
|
-
return o[
|
|
416
|
-
},
|
|
417
|
-
if (
|
|
458
|
+
const s = n[n.length - 1];
|
|
459
|
+
return o[s] = r, e;
|
|
460
|
+
}, Dr = (e, t) => {
|
|
461
|
+
if (t === "")
|
|
418
462
|
return e;
|
|
419
|
-
const
|
|
420
|
-
for (let
|
|
421
|
-
const
|
|
422
|
-
if (
|
|
463
|
+
const r = t.split("."), n = [e];
|
|
464
|
+
for (let i = 0; i < r.length - 1; i++) {
|
|
465
|
+
const d = n[i];
|
|
466
|
+
if (d == null || typeof d != "object")
|
|
423
467
|
return e;
|
|
424
|
-
const c =
|
|
425
|
-
if (
|
|
468
|
+
const c = r[i], l = Array.isArray(d) ? d[parseInt(c, 10)] : d[c];
|
|
469
|
+
if (l == null || typeof l != "object")
|
|
426
470
|
return e;
|
|
427
|
-
n.push(
|
|
471
|
+
n.push(l);
|
|
428
472
|
}
|
|
429
|
-
const o = n[n.length - 1],
|
|
430
|
-
Array.isArray(o) ? o.splice(parseInt(
|
|
431
|
-
for (let
|
|
432
|
-
const
|
|
433
|
-
if (Array.isArray(
|
|
473
|
+
const o = n[n.length - 1], s = r[r.length - 1];
|
|
474
|
+
Array.isArray(o) ? o.splice(parseInt(s, 10), 1) : delete o[s];
|
|
475
|
+
for (let i = n.length - 1; i >= 1; i--) {
|
|
476
|
+
const d = n[i];
|
|
477
|
+
if (Array.isArray(d) || !Fr(d))
|
|
434
478
|
break;
|
|
435
|
-
const c = n[
|
|
479
|
+
const c = n[i - 1], l = r[i - 1];
|
|
436
480
|
if (Array.isArray(c))
|
|
437
481
|
break;
|
|
438
|
-
delete c[
|
|
482
|
+
delete c[l];
|
|
439
483
|
}
|
|
440
484
|
return e;
|
|
441
485
|
};
|
|
442
|
-
function
|
|
443
|
-
const
|
|
444
|
-
return Number.isInteger(
|
|
486
|
+
function kr(e) {
|
|
487
|
+
const t = Number(e);
|
|
488
|
+
return Number.isInteger(t) && t >= 0 && t.toString() === e;
|
|
445
489
|
}
|
|
446
|
-
function
|
|
490
|
+
function Fr(e) {
|
|
447
491
|
return e != null && typeof e == "object" && !Array.isArray(e) && Object.keys(e).length === 0;
|
|
448
492
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
493
|
+
const Oe = (e, t) => (delete e[t], e);
|
|
494
|
+
function _e(e) {
|
|
451
495
|
if (e === null || typeof e != "object")
|
|
452
496
|
return e;
|
|
453
497
|
if (Array.isArray(e))
|
|
454
|
-
return e.map((
|
|
455
|
-
const
|
|
456
|
-
for (const
|
|
457
|
-
r
|
|
458
|
-
return
|
|
498
|
+
return e.map((r) => _e(r));
|
|
499
|
+
const t = {};
|
|
500
|
+
for (const r of Object.keys(e))
|
|
501
|
+
t[r] = _e(e[r]);
|
|
502
|
+
return t;
|
|
459
503
|
}
|
|
460
504
|
function Xe(e) {
|
|
461
|
-
return e.flatMap((
|
|
462
|
-
|
|
463
|
-
...
|
|
505
|
+
return e.flatMap((t) => [
|
|
506
|
+
t,
|
|
507
|
+
...he(t) ? Xe(t.children) : []
|
|
464
508
|
]);
|
|
465
509
|
}
|
|
466
|
-
function
|
|
510
|
+
function be(e) {
|
|
467
511
|
return Object.entries(e.validations).reduce(
|
|
468
|
-
(
|
|
512
|
+
(r, [n, o]) => (o !== null && (r.$formIsInvalid = !0, ze(r.$errors, n, [...o])), r),
|
|
469
513
|
{ $formIsInvalid: !1, $errors: {} }
|
|
470
514
|
);
|
|
471
515
|
}
|
|
472
|
-
function
|
|
473
|
-
const
|
|
474
|
-
for (const [
|
|
516
|
+
function De(e) {
|
|
517
|
+
const t = _e(e.data);
|
|
518
|
+
for (const [r, n] of Object.entries(e.widgetFlags))
|
|
475
519
|
if (n.hidden === !0) {
|
|
476
|
-
const o = e.flatForm[
|
|
477
|
-
o &&
|
|
520
|
+
const o = e.flatForm[r];
|
|
521
|
+
o && I(o) && Dr(t, o.path);
|
|
478
522
|
}
|
|
479
|
-
return
|
|
523
|
+
return t;
|
|
480
524
|
}
|
|
481
525
|
const Je = 32;
|
|
482
|
-
let Le, h,
|
|
483
|
-
`), n =
|
|
484
|
-
throw SyntaxError(`${e} at ${
|
|
485
|
-
${
|
|
486
|
-
`, "" + o}${
|
|
487
|
-
},
|
|
488
|
-
for (;
|
|
489
|
-
return
|
|
490
|
-
},
|
|
491
|
-
let
|
|
492
|
-
for (
|
|
493
|
-
(n &&
|
|
494
|
-
return
|
|
495
|
-
}, H = (e,
|
|
496
|
-
for (Le = !1; (e =
|
|
497
|
-
|
|
526
|
+
let Le, h, g, A = (e) => (h = 0, g = e, A.newline = !1, e = S(), g[h] ? b() : e || ""), b = (e = "Unexpected token", t = h, r = g.slice(0, t).split(`
|
|
527
|
+
`), n = r.pop(), o = g.slice(Math.max(0, t - 40), t), s = "̭", i = (g[t] || " ") + s, d = g.slice(t + 1, t + 20)) => {
|
|
528
|
+
throw SyntaxError(`${e} at ${r.length + 1}:${n.length + 1}
|
|
529
|
+
${g[t - 41] !== `
|
|
530
|
+
`, "" + o}${i}${d}`);
|
|
531
|
+
}, It = (e, t = h) => (Array.isArray(e) && (e.loc = t), e), Z = (e, t = h, r) => {
|
|
532
|
+
for (; r = e(g.charCodeAt(h)); ) h += r;
|
|
533
|
+
return g.slice(t, h);
|
|
534
|
+
}, O = (e = 1) => g[h += e], Re = (e) => h = e, S = (e = 0, t) => {
|
|
535
|
+
let r, n, o, s, i;
|
|
536
|
+
for (t && A.asi && (A.newline = !1); (r = A.space()) && (i = A.newline, 1) && r !== t && (o = // ASI before [ on new line (access handler would consume it; lineBreak distinguishes real \n from synthetic } flag)
|
|
537
|
+
(n && r === 91 && Le && A.asi?.(n, e, S) || null) ?? ((s = P[r]) && s(n, e)) ?? (n && i && A.asi?.(n, e, S)) ?? (!n && Z(A.id))); ) n = o;
|
|
538
|
+
return t && (r == t ? (h++, t === 125 && A.asi && (A.newline = !0)) : b("Unclosed " + String.fromCharCode(t - (t > 42 ? 2 : 1)))), n;
|
|
539
|
+
}, H = (e, t = h) => {
|
|
540
|
+
for (Le = !1; (e = g.charCodeAt(h)) <= Je; )
|
|
541
|
+
A.asi && e === 10 && (A.newline = Le = !0), h++;
|
|
498
542
|
return e;
|
|
499
|
-
},
|
|
500
|
-
for (;
|
|
501
|
-
return
|
|
543
|
+
}, Tr = (e = h) => {
|
|
544
|
+
for (; g.charCodeAt(e) <= Je; ) e++;
|
|
545
|
+
return g.charCodeAt(e);
|
|
502
546
|
};
|
|
503
|
-
|
|
504
|
-
let
|
|
547
|
+
A.id = (e) => e >= 48 && e <= 57 || e >= 65 && e <= 90 || e >= 97 && e <= 122 || e == 36 || e == 95 || e >= 192 && e != 215 && e != 247;
|
|
548
|
+
let jr = (e, t = e.length) => g.substr(h, t) === e && !A.id(g.charCodeAt(h + t)), P = [], at = {}, W = (e, t = Je, r, n = e.charCodeAt(0), o = e.length, s = P[n], i = e.toUpperCase() !== e, d, c) => (t = at[e] = !s && at[e] || t, P[n] = (l, m, p, f = h) => (d = p, (p ? e == p : (o < 2 || e.charCodeAt(1) === g.charCodeAt(h + 1) && (o < 3 || g.substr(h, o) == e)) && (!i || !A.id(g.charCodeAt(h + o))) && (d = p = e)) && m < t && (h += o, (c = r(l)) ? It(c, f) : (h = f, d = 0, !i && !s && !l && b()), c) || s?.(l, m, d))), $ = (e, t, r = !1) => W(e, t, (n) => n && /* @__PURE__ */ ((o) => o && [e, n, o])(S(t - (r ? 0.5 : 0)))), G = (e, t, r) => W(e, t, (n) => !n && (n = S(t - 0.5)) && [e, n]), de = (e, t) => W(e, 200, (r) => !r && [, t]), Ct = (e, t, r) => W(
|
|
505
549
|
e,
|
|
506
|
-
|
|
507
|
-
(n, o) => (o = S(
|
|
508
|
-
), Qe = (e,
|
|
509
|
-
Object.defineProperty(
|
|
550
|
+
t,
|
|
551
|
+
(n, o) => (o = S(t - (r ? 0.5 : 0)), n?.[0] !== e && (n = [e, n || null]), o?.[0] === e ? n.push(...o.slice(1)) : n.push(o || null), n)
|
|
552
|
+
), Qe = (e, t) => W(e[0], t, (r) => !r && [e, S(0, e.charCodeAt(1)) || null]), Dt = (e, t) => W(e[0], t, (r) => r && [e, r, S(0, e.charCodeAt(1)) || null]), ce = (e, t, r, n = e.charCodeAt(0), o = e.length, s = P[n], i) => P[n] = (d, c, l, m = h) => !d && (l ? e == l : (o < 2 || g.substr(h, o) == e) && (l = e)) && c < t && !A.id(g.charCodeAt(h + o)) && (!A.prop || A.prop(h + o)) && (Re(h + o), (i = r()) ? It(i, m) : Re(m), i) || s?.(d, c, l);
|
|
553
|
+
Object.defineProperty(A, "space", {
|
|
510
554
|
configurable: !0,
|
|
511
555
|
enumerable: !0,
|
|
512
556
|
get: () => H,
|
|
513
557
|
set: (e) => H = e
|
|
514
558
|
});
|
|
515
|
-
const
|
|
559
|
+
const Ve = {}, a = (e, t, r = Ve[e]) => Ve[e] = (...n) => t(...n) || r?.(...n), u = (e) => Array.isArray(e) ? e[0] == null ? /* @__PURE__ */ ((t) => () => t)(e[1]) : (
|
|
516
560
|
// == catches both undefined and null
|
|
517
|
-
|
|
561
|
+
Ve[e[0]]?.(...e.slice(1)) ?? b(`Unknown operator: ${e[0]}`, e?.loc)
|
|
518
562
|
) : e === void 0 ? () => {
|
|
519
|
-
} : (
|
|
520
|
-
let
|
|
521
|
-
(
|
|
563
|
+
} : (t) => t?.[e], pe = 46, re = 48, me = 57, Wr = 69, Pr = 101, Nr = 43, _r = 45, fe = 95, kt = 110, Lr = 97, Rr = 102, Vr = 65, Ur = 70, Ft = (e) => e.indexOf("_") < 0 ? e : e.replaceAll("_", ""), qe = (e) => {
|
|
564
|
+
let t = Ft(Z(
|
|
565
|
+
(r) => (
|
|
522
566
|
// . is decimal only if NOT followed by another . (range operator)
|
|
523
|
-
|
|
567
|
+
r === pe && g.charCodeAt(h + 1) !== pe || r >= re && r <= me || r === fe || ((r === Wr || r === Pr) && ((r = g.charCodeAt(h + 1)) >= re && r <= me || r === Nr || r === _r) ? 2 : 0)
|
|
524
568
|
)
|
|
525
569
|
));
|
|
526
|
-
return
|
|
527
|
-
},
|
|
570
|
+
return g.charCodeAt(h) === kt ? (O(), [, BigInt(t)]) : (e = +t) != e ? b() : [, e];
|
|
571
|
+
}, Mr = {
|
|
528
572
|
2: (e) => e === 48 || e === 49 || e === fe,
|
|
529
573
|
8: (e) => e >= 48 && e <= 55 || e === fe,
|
|
530
|
-
16: (e) => e >=
|
|
574
|
+
16: (e) => e >= re && e <= me || e >= Lr && e <= Rr || e >= Vr && e <= Ur || e === fe
|
|
531
575
|
};
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
for (let e =
|
|
535
|
-
|
|
576
|
+
A.number = null;
|
|
577
|
+
P[pe] = (e) => !e && g.charCodeAt(h + 1) !== pe && qe();
|
|
578
|
+
for (let e = re; e <= me; e++) P[e] = (t) => t ? void 0 : qe();
|
|
579
|
+
P[re] = (e) => {
|
|
536
580
|
if (e) return;
|
|
537
|
-
const
|
|
538
|
-
if (
|
|
539
|
-
for (const [
|
|
540
|
-
if (
|
|
541
|
-
|
|
542
|
-
const o =
|
|
543
|
-
return
|
|
581
|
+
const t = A.number;
|
|
582
|
+
if (t) {
|
|
583
|
+
for (const [r, n] of Object.entries(t))
|
|
584
|
+
if (r[0] === "0" && g[h + 1]?.toLowerCase() === r[1]) {
|
|
585
|
+
O(2);
|
|
586
|
+
const o = Ft(Z(Mr[n]));
|
|
587
|
+
return g.charCodeAt(h) === kt ? (O(), [, BigInt("0" + r[1] + o)]) : [, parseInt(o, n)];
|
|
544
588
|
}
|
|
545
589
|
}
|
|
546
590
|
return qe();
|
|
547
591
|
};
|
|
548
|
-
const
|
|
549
|
-
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" },
|
|
550
|
-
if (!(
|
|
551
|
-
return
|
|
592
|
+
const Hr = 92, ft = 34, ht = 39, Gr = { n: `
|
|
593
|
+
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" }, Tt = (e) => (t, r, n = "") => {
|
|
594
|
+
if (!(t || !A.string?.[String.fromCharCode(e)]))
|
|
595
|
+
return O(), Z((o) => o - e && (o === Hr ? (n += Gr[g[h + 1]] || g[h + 1], 2) : (n += g[h], 1))), g[h] === String.fromCharCode(e) ? O() : b("Bad string"), [, n];
|
|
552
596
|
};
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const
|
|
557
|
-
"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map((e) =>
|
|
558
|
-
const
|
|
597
|
+
P[ft] = Tt(ft);
|
|
598
|
+
P[ht] = Tt(ht);
|
|
599
|
+
A.string = { '"': !0 };
|
|
600
|
+
const Br = 20;
|
|
601
|
+
"= += -= *= /= %= |= &= ^= >>= <<=".split(" ").map((e) => $(e, Br, !0));
|
|
602
|
+
const jt = (e, t, r, n) => typeof e == "string" ? (o) => t(o, e, o) : e[0] === "." ? (r = u(e[1]), n = e[2], (o) => t(r(o), n, o)) : e[0] === "[]" && e.length === 3 ? (r = u(e[1]), n = u(e[2]), (o) => t(r(o), n(o), o)) : e[0] === "()" && e.length === 2 ? jt(e[1], t) : (() => {
|
|
559
603
|
throw Error("Invalid assignment target");
|
|
560
|
-
})(),
|
|
561
|
-
"=": (e,
|
|
562
|
-
"+=": (e,
|
|
563
|
-
"-=": (e,
|
|
564
|
-
"*=": (e,
|
|
565
|
-
"/=": (e,
|
|
566
|
-
"%=": (e,
|
|
567
|
-
"|=": (e,
|
|
568
|
-
"&=": (e,
|
|
569
|
-
"^=": (e,
|
|
570
|
-
">>=": (e,
|
|
571
|
-
"<<=": (e,
|
|
604
|
+
})(), pt = {
|
|
605
|
+
"=": (e, t, r) => e[t] = r,
|
|
606
|
+
"+=": (e, t, r) => e[t] += r,
|
|
607
|
+
"-=": (e, t, r) => e[t] -= r,
|
|
608
|
+
"*=": (e, t, r) => e[t] *= r,
|
|
609
|
+
"/=": (e, t, r) => e[t] /= r,
|
|
610
|
+
"%=": (e, t, r) => e[t] %= r,
|
|
611
|
+
"|=": (e, t, r) => e[t] |= r,
|
|
612
|
+
"&=": (e, t, r) => e[t] &= r,
|
|
613
|
+
"^=": (e, t, r) => e[t] ^= r,
|
|
614
|
+
">>=": (e, t, r) => e[t] >>= r,
|
|
615
|
+
"<<=": (e, t, r) => e[t] <<= r
|
|
572
616
|
};
|
|
573
|
-
for (const e in
|
|
574
|
-
const
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
617
|
+
for (const e in pt) a(e, (t, r) => (r = u(r), jt(t, (n, o, s) => pt[e](n, o, r(s)))));
|
|
618
|
+
const Kr = 30, zr = 40, Xr = 140;
|
|
619
|
+
G("!", Xr);
|
|
620
|
+
$("||", Kr);
|
|
621
|
+
$("&&", zr);
|
|
622
|
+
a("!", (e) => (e = u(e), (t) => !e(t)));
|
|
623
|
+
a("||", (e, t) => (e = u(e), t = u(t), (r) => e(r) || t(r)));
|
|
624
|
+
a("&&", (e, t) => (e = u(e), t = u(t), (r) => e(r) && t(r)));
|
|
625
|
+
const br = 50, Jr = 60, Qr = 70, Wt = 100, qr = 140;
|
|
626
|
+
$("|", br);
|
|
627
|
+
$("&", Qr);
|
|
628
|
+
$("^", Jr);
|
|
629
|
+
$(">>", Wt);
|
|
630
|
+
$("<<", Wt);
|
|
631
|
+
G("~", qr);
|
|
632
|
+
a("~", (e) => (e = u(e), (t) => ~e(t)));
|
|
633
|
+
a("|", (e, t) => (e = u(e), t = u(t), (r) => e(r) | t(r)));
|
|
634
|
+
a("&", (e, t) => (e = u(e), t = u(t), (r) => e(r) & t(r)));
|
|
635
|
+
a("^", (e, t) => (e = u(e), t = u(t), (r) => e(r) ^ t(r)));
|
|
636
|
+
a(">>", (e, t) => (e = u(e), t = u(t), (r) => e(r) >> t(r)));
|
|
637
|
+
a("<<", (e, t) => (e = u(e), t = u(t), (r) => e(r) << t(r)));
|
|
594
638
|
const Ie = 90;
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
const
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
639
|
+
$("<", Ie);
|
|
640
|
+
$(">", Ie);
|
|
641
|
+
$("<=", Ie);
|
|
642
|
+
$(">=", Ie);
|
|
643
|
+
a(">", (e, t) => (e = u(e), t = u(t), (r) => e(r) > t(r)));
|
|
644
|
+
a("<", (e, t) => (e = u(e), t = u(t), (r) => e(r) < t(r)));
|
|
645
|
+
a(">=", (e, t) => (e = u(e), t = u(t), (r) => e(r) >= t(r)));
|
|
646
|
+
a("<=", (e, t) => (e = u(e), t = u(t), (r) => e(r) <= t(r)));
|
|
647
|
+
const Pt = 80;
|
|
648
|
+
$("==", Pt);
|
|
649
|
+
$("!=", Pt);
|
|
650
|
+
a("==", (e, t) => (e = u(e), t = u(t), (r) => e(r) == t(r)));
|
|
651
|
+
a("!=", (e, t) => (e = u(e), t = u(t), (r) => e(r) != t(r)));
|
|
652
|
+
const Nt = 110, xe = 120, _t = 140;
|
|
653
|
+
$("+", Nt);
|
|
654
|
+
$("-", Nt);
|
|
655
|
+
$("*", xe);
|
|
656
|
+
$("/", xe);
|
|
657
|
+
$("%", xe);
|
|
658
|
+
G("+", _t);
|
|
659
|
+
G("-", _t);
|
|
660
|
+
a("+", (e, t) => t !== void 0 ? (e = u(e), t = u(t), (r) => e(r) + t(r)) : (e = u(e), (r) => +e(r)));
|
|
661
|
+
a("-", (e, t) => t !== void 0 ? (e = u(e), t = u(t), (r) => e(r) - t(r)) : (e = u(e), (r) => -e(r)));
|
|
662
|
+
a("*", (e, t) => (e = u(e), t = u(t), (r) => e(r) * t(r)));
|
|
663
|
+
a("/", (e, t) => (e = u(e), t = u(t), (r) => e(r) / t(r)));
|
|
664
|
+
a("%", (e, t) => (e = u(e), t = u(t), (r) => e(r) % t(r)));
|
|
621
665
|
const ge = 150;
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
const Ze = (e,
|
|
666
|
+
W("++", ge, (e) => e ? ["++", e, null] : ["++", S(ge - 1)]);
|
|
667
|
+
W("--", ge, (e) => e ? ["--", e, null] : ["--", S(ge - 1)]);
|
|
668
|
+
const Ze = (e, t, r, n) => typeof e == "string" ? (o) => t(o, e) : e[0] === "." ? (r = u(e[1]), n = e[2], (o) => t(r(o), n)) : e[0] === "[]" && e.length === 3 ? (r = u(e[1]), n = u(e[2]), (o) => t(r(o), n(o))) : e[0] === "()" && e.length === 2 ? Ze(e[1], t) : (
|
|
625
669
|
// unwrap parens: (x)++
|
|
626
670
|
(() => {
|
|
627
671
|
throw Error("Invalid increment target");
|
|
628
672
|
})()
|
|
629
673
|
);
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
const
|
|
636
|
-
let
|
|
637
|
-
for (const n of e)
|
|
638
|
-
return
|
|
674
|
+
a("++", (e, t) => Ze(e, t === null ? (r, n) => r[n]++ : (r, n) => ++r[n]));
|
|
675
|
+
a("--", (e, t) => Ze(e, t === null ? (r, n) => r[n]-- : (r, n) => --r[n]));
|
|
676
|
+
const xr = 5, Zr = 10;
|
|
677
|
+
Ct(",", Zr);
|
|
678
|
+
Ct(";", xr, !0);
|
|
679
|
+
const Lt = (...e) => (e = e.map(u), (t) => {
|
|
680
|
+
let r;
|
|
681
|
+
for (const n of e) r = n(t);
|
|
682
|
+
return r;
|
|
639
683
|
});
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
const
|
|
643
|
-
Qe("()",
|
|
644
|
-
const M = (e) => e?.[0] === "_" && e[1] === "_" || e === "constructor" || e === "prototype",
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
const
|
|
684
|
+
a(",", Lt);
|
|
685
|
+
a(";", Lt);
|
|
686
|
+
const Yr = 170;
|
|
687
|
+
Qe("()", Yr);
|
|
688
|
+
const M = (e) => e?.[0] === "_" && e[1] === "_" || e === "constructor" || e === "prototype", Ye = 170;
|
|
689
|
+
Dt("[]", Ye);
|
|
690
|
+
$(".", Ye);
|
|
691
|
+
Dt("()", Ye);
|
|
692
|
+
const ye = (e) => {
|
|
649
693
|
throw Error(e);
|
|
650
694
|
};
|
|
651
|
-
|
|
652
|
-
}) :
|
|
653
|
-
const n = r
|
|
654
|
-
return M(n) ? void 0 : e(
|
|
695
|
+
a("[]", (e, t) => t === void 0 ? (e = e ? e[0] === "," ? e.slice(1) : [e] : [], e = e.map((r) => r == null ? (() => {
|
|
696
|
+
}) : r[0] === "..." ? (r = u(r[1]), (n) => r(n)) : (r = u(r), (n) => [r(n)])), (r) => e.flatMap((n) => n(r))) : (t == null && ye("Missing index"), e = u(e), t = u(t), (r) => {
|
|
697
|
+
const n = t(r);
|
|
698
|
+
return M(n) ? void 0 : e(r)[n];
|
|
655
699
|
}));
|
|
656
|
-
|
|
657
|
-
} : (
|
|
658
|
-
|
|
659
|
-
if (
|
|
660
|
-
const
|
|
661
|
-
t
|
|
662
|
-
const n =
|
|
663
|
-
return
|
|
700
|
+
a(".", (e, t) => (e = u(e), t = t[0] ? t : t[1], M(t) ? () => {
|
|
701
|
+
} : (r) => e(r)[t]));
|
|
702
|
+
a("()", (e, t) => {
|
|
703
|
+
if (t === void 0) return e == null ? ye("Empty ()") : u(e);
|
|
704
|
+
const r = (o) => o?.[0] === "," && o.slice(1).some((s) => s == null || r(s));
|
|
705
|
+
r(t) && ye("Empty argument");
|
|
706
|
+
const n = t ? t[0] === "," ? (t = t.slice(1).map(u), (o) => t.map((s) => s(o))) : (t = u(t), (o) => [t(o)]) : () => [];
|
|
707
|
+
return et(e, (o, s, i) => o[s](...n(i)));
|
|
664
708
|
});
|
|
665
|
-
const
|
|
666
|
-
const
|
|
667
|
-
return
|
|
668
|
-
}) : e[0] === "[]" && e.length === 3 ? (
|
|
669
|
-
const
|
|
670
|
-
return
|
|
671
|
-
}) : (e =
|
|
672
|
-
|
|
709
|
+
const J = (e) => typeof e == "string" || Array.isArray(e) && (e[0] === "." || e[0] === "?." || e[0] === "[]" && e.length === 3 || e[0] === "?.[]" || e[0] === "()" && e.length === 2 && J(e[1]) || e[0] === "{}"), et = (e, t, r, n) => e == null ? ye("Empty ()") : e[0] === "()" && e.length == 2 ? et(e[1], t) : typeof e == "string" ? (o) => t(o, e, o) : e[0] === "." ? (r = u(e[1]), n = e[2], (o) => t(r(o), n, o)) : e[0] === "?." ? (r = u(e[1]), n = e[2], (o) => {
|
|
710
|
+
const s = r(o);
|
|
711
|
+
return s == null ? void 0 : t(s, n, o);
|
|
712
|
+
}) : e[0] === "[]" && e.length === 3 ? (r = u(e[1]), n = u(e[2]), (o) => t(r(o), n(o), o)) : e[0] === "?.[]" ? (r = u(e[1]), n = u(e[2]), (o) => {
|
|
713
|
+
const s = r(o);
|
|
714
|
+
return s == null ? void 0 : t(s, n(o), o);
|
|
715
|
+
}) : (e = u(e), (o) => t([e(o)], 0, o)), Y = et, en = 32, tn = A.space;
|
|
716
|
+
A.comment ??= { "//": `
|
|
673
717
|
`, "/*": "*/" };
|
|
674
|
-
let
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
for (var e; e =
|
|
678
|
-
for (var
|
|
679
|
-
if (e ===
|
|
680
|
-
var n = h +
|
|
681
|
-
if (
|
|
682
|
-
`) for (;
|
|
718
|
+
let ke;
|
|
719
|
+
A.space = () => {
|
|
720
|
+
ke || (ke = Object.entries(A.comment).map(([o, s]) => [o, s, o.charCodeAt(0)]));
|
|
721
|
+
for (var e; e = tn(); ) {
|
|
722
|
+
for (var t = 0, r; r = ke[t++]; )
|
|
723
|
+
if (e === r[2] && g.substr(h, r[0].length) === r[0]) {
|
|
724
|
+
var n = h + r[0].length;
|
|
725
|
+
if (r[1] === `
|
|
726
|
+
`) for (; g.charCodeAt(n) >= en; ) n++;
|
|
683
727
|
else {
|
|
684
|
-
for (;
|
|
685
|
-
|
|
728
|
+
for (; g[n] && g.substr(n, r[1].length) !== r[1]; ) n++;
|
|
729
|
+
g[n] && (n += r[1].length);
|
|
686
730
|
}
|
|
687
|
-
|
|
731
|
+
Re(n), e = 0;
|
|
688
732
|
break;
|
|
689
733
|
}
|
|
690
734
|
if (e) return e;
|
|
691
735
|
}
|
|
692
736
|
return e;
|
|
693
737
|
};
|
|
694
|
-
const
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
const
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
const
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
const
|
|
738
|
+
const Rt = 80;
|
|
739
|
+
$("===", Rt);
|
|
740
|
+
$("!==", Rt);
|
|
741
|
+
a("===", (e, t) => (e = u(e), t = u(t), (r) => e(r) === t(r)));
|
|
742
|
+
a("!==", (e, t) => (e = u(e), t = u(t), (r) => e(r) !== t(r)));
|
|
743
|
+
const rn = 30;
|
|
744
|
+
$("??", rn);
|
|
745
|
+
a("??", (e, t) => (e = u(e), t = u(t), (r) => e(r) ?? t(r)));
|
|
746
|
+
const nn = 130, on = 20;
|
|
747
|
+
$("**", nn, !0);
|
|
748
|
+
$("**=", on, !0);
|
|
749
|
+
a("**", (e, t) => (e = u(e), t = u(t), (r) => e(r) ** t(r)));
|
|
750
|
+
const sn = (e) => {
|
|
707
751
|
throw Error(e);
|
|
708
752
|
};
|
|
709
|
-
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
const
|
|
753
|
+
a("**=", (e, t) => (J(e) || sn("Invalid assignment target"), t = u(t), Y(e, (r, n, o) => r[n] **= t(o))));
|
|
754
|
+
const Vt = 90;
|
|
755
|
+
$("in", Vt);
|
|
756
|
+
$("of", Vt);
|
|
757
|
+
a("in", (e, t) => (e = u(e), t = u(t), (r) => e(r) in t(r)));
|
|
758
|
+
const un = 20, dn = 100, cn = (e) => {
|
|
715
759
|
throw Error(e);
|
|
716
760
|
};
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
const
|
|
761
|
+
$(">>>", dn);
|
|
762
|
+
$(">>>=", un, !0);
|
|
763
|
+
a(">>>", (e, t) => (e = u(e), t = u(t), (r) => e(r) >>> t(r)));
|
|
764
|
+
a(">>>=", (e, t) => (J(e) || cn("Invalid assignment target"), t = u(t), Y(e, (r, n, o) => r[n] >>>= t(o))));
|
|
765
|
+
const tt = 5, ln = 10, an = 20, fn = (e) => e[0]?.[0] === "," ? e[0].slice(1) : e, Ae = (e, t, r) => {
|
|
722
766
|
if (typeof e == "string") {
|
|
723
|
-
|
|
767
|
+
r[e] = t;
|
|
724
768
|
return;
|
|
725
769
|
}
|
|
726
|
-
const [n, ...o] = e,
|
|
770
|
+
const [n, ...o] = e, s = fn(o);
|
|
727
771
|
if (n === "{}") {
|
|
728
|
-
const
|
|
729
|
-
for (const
|
|
730
|
-
if (Array.isArray(
|
|
772
|
+
const i = [];
|
|
773
|
+
for (const d of s) {
|
|
774
|
+
if (Array.isArray(d) && d[0] === "...") {
|
|
731
775
|
const f = {};
|
|
732
|
-
for (const
|
|
733
|
-
|
|
776
|
+
for (const D in t) i.includes(D) || (f[D] = t[D]);
|
|
777
|
+
r[d[1]] = f;
|
|
734
778
|
break;
|
|
735
779
|
}
|
|
736
|
-
let c,
|
|
737
|
-
typeof
|
|
738
|
-
let
|
|
739
|
-
|
|
780
|
+
let c, l, m;
|
|
781
|
+
typeof d == "string" ? c = l = d : d[0] === "=" ? (typeof d[1] == "string" ? c = l = d[1] : [, c, l] = d[1], m = d[2]) : [, c, l] = d, i.push(c);
|
|
782
|
+
let p = t[c];
|
|
783
|
+
p === void 0 && m && (p = u(m)(r)), Ae(l, p, r);
|
|
740
784
|
}
|
|
741
785
|
} else if (n === "[]") {
|
|
742
|
-
let
|
|
743
|
-
for (const
|
|
744
|
-
if (
|
|
745
|
-
|
|
786
|
+
let i = 0;
|
|
787
|
+
for (const d of s) {
|
|
788
|
+
if (d === null) {
|
|
789
|
+
i++;
|
|
746
790
|
continue;
|
|
747
791
|
}
|
|
748
|
-
if (Array.isArray(
|
|
749
|
-
|
|
792
|
+
if (Array.isArray(d) && d[0] === "...") {
|
|
793
|
+
r[d[1]] = t.slice(i);
|
|
750
794
|
break;
|
|
751
795
|
}
|
|
752
|
-
let c =
|
|
753
|
-
Array.isArray(
|
|
754
|
-
let
|
|
755
|
-
|
|
796
|
+
let c = d, l;
|
|
797
|
+
Array.isArray(d) && d[0] === "=" && ([, c, l] = d);
|
|
798
|
+
let m = t[i++];
|
|
799
|
+
m === void 0 && l && (m = u(l)(r)), Ae(c, m, r);
|
|
756
800
|
}
|
|
757
801
|
}
|
|
758
|
-
},
|
|
759
|
-
let
|
|
760
|
-
return
|
|
802
|
+
}, Ut = (e) => {
|
|
803
|
+
let t = S(ln - 1);
|
|
804
|
+
return t?.[0] === "in" || t?.[0] === "of" ? [t[0], [e, t[1]], t[2]] : t?.[0] === "," ? [e, ...t.slice(1)] : [e, t];
|
|
761
805
|
};
|
|
762
|
-
ce("let",
|
|
763
|
-
ce("const",
|
|
764
|
-
ce("var",
|
|
765
|
-
const
|
|
766
|
-
if (typeof
|
|
767
|
-
t
|
|
806
|
+
ce("let", tt + 1, () => Ut("let"));
|
|
807
|
+
ce("const", tt + 1, () => Ut("const"));
|
|
808
|
+
ce("var", tt, () => (H(), ["var", S(an)]));
|
|
809
|
+
const Mt = (...e) => (e = e.map((t) => {
|
|
810
|
+
if (typeof t == "string") return (r) => {
|
|
811
|
+
r[t] = void 0;
|
|
768
812
|
};
|
|
769
|
-
if (
|
|
770
|
-
const [,
|
|
771
|
-
return typeof
|
|
772
|
-
|
|
773
|
-
} : (
|
|
813
|
+
if (t[0] === "=") {
|
|
814
|
+
const [, r, n] = t, o = u(n);
|
|
815
|
+
return typeof r == "string" ? (s) => {
|
|
816
|
+
s[r] = o(s);
|
|
817
|
+
} : (s) => Ae(r, o(s), s);
|
|
774
818
|
}
|
|
775
|
-
return
|
|
776
|
-
}), (
|
|
777
|
-
for (const
|
|
819
|
+
return u(t);
|
|
820
|
+
}), (t) => {
|
|
821
|
+
for (const r of e) r(t);
|
|
778
822
|
});
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
823
|
+
a("let", Mt);
|
|
824
|
+
a("const", Mt);
|
|
825
|
+
a("var", (e) => typeof e == "string" ? (t) => {
|
|
826
|
+
t[e] = void 0;
|
|
783
827
|
} : () => {
|
|
784
828
|
});
|
|
785
|
-
const
|
|
829
|
+
const rt = 20, Ce = (e) => {
|
|
786
830
|
throw Error(e);
|
|
787
831
|
};
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
832
|
+
$("||=", rt, !0);
|
|
833
|
+
$("&&=", rt, !0);
|
|
834
|
+
$("??=", rt, !0);
|
|
835
|
+
a("=", (e, t) => {
|
|
792
836
|
if (Array.isArray(e) && (e[0] === "let" || e[0] === "const" || e[0] === "var")) {
|
|
793
|
-
const
|
|
794
|
-
return
|
|
795
|
-
n[
|
|
796
|
-
} : (n) =>
|
|
837
|
+
const r = e[1];
|
|
838
|
+
return t = u(t), typeof r == "string" ? (n) => {
|
|
839
|
+
n[r] = t(n);
|
|
840
|
+
} : (n) => Ae(r, t(n), n);
|
|
797
841
|
}
|
|
798
|
-
return
|
|
842
|
+
return J(e) || Ce("Invalid assignment target"), t = u(t), Y(e, (r, n, o) => r[n] = t(o));
|
|
799
843
|
});
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
844
|
+
a("||=", (e, t) => (J(e) || Ce("Invalid assignment target"), t = u(t), Y(e, (r, n, o) => r[n] ||= t(o))));
|
|
845
|
+
a("&&=", (e, t) => (J(e) || Ce("Invalid assignment target"), t = u(t), Y(e, (r, n, o) => r[n] &&= t(o))));
|
|
846
|
+
a("??=", (e, t) => (J(e) || Ce("Invalid assignment target"), t = u(t), Y(e, (r, n, o) => r[n] ??= t(o))));
|
|
847
|
+
de("true", !0);
|
|
848
|
+
de("false", !1);
|
|
849
|
+
de("null", null);
|
|
806
850
|
ce("undefined", 200, () => []);
|
|
807
|
-
|
|
808
|
-
|
|
851
|
+
de("NaN", NaN);
|
|
852
|
+
de("Infinity", 1 / 0);
|
|
809
853
|
const Fe = 20;
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
|
|
854
|
+
W("?", Fe, (e, t, r) => e && (t = S(Fe - 1)) && Z((n) => n === 58) && (r = S(Fe - 1), ["?", e, t, r]));
|
|
855
|
+
a("?", (e, t, r) => (e = u(e), t = u(t), r = u(r), (n) => e(n) ? t(n) : r(n)));
|
|
856
|
+
const hn = [], pn = 20;
|
|
857
|
+
$("=>", pn, !0);
|
|
858
|
+
a("=>", (e, t) => {
|
|
815
859
|
e = e?.[0] === "()" ? e[1] : e;
|
|
816
|
-
const
|
|
860
|
+
const r = e ? e[0] === "," ? e.slice(1) : [e] : [];
|
|
817
861
|
let n = -1, o = null;
|
|
818
|
-
const
|
|
819
|
-
Array.isArray(
|
|
820
|
-
const
|
|
821
|
-
return
|
|
822
|
-
const
|
|
823
|
-
|
|
824
|
-
const
|
|
825
|
-
get: (
|
|
826
|
-
set: (
|
|
827
|
-
has: (
|
|
862
|
+
const s = r[r.length - 1];
|
|
863
|
+
Array.isArray(s) && s[0] === "..." && (n = r.length - 1, o = s[1], r.length--);
|
|
864
|
+
const i = t?.[0] === "{}";
|
|
865
|
+
return t = u(i ? ["{", t[1]] : t), (d) => (...c) => {
|
|
866
|
+
const l = {};
|
|
867
|
+
r.forEach((p, f) => l[p] = c[f]), o && (l[o] = c.slice(n));
|
|
868
|
+
const m = new Proxy(l, {
|
|
869
|
+
get: (p, f) => f in p ? p[f] : d?.[f],
|
|
870
|
+
set: (p, f, D) => ((f in p ? p : d)[f] = D, !0),
|
|
871
|
+
has: (p, f) => f in p || (d ? f in d : !1)
|
|
828
872
|
});
|
|
829
873
|
try {
|
|
830
|
-
const
|
|
831
|
-
return
|
|
832
|
-
} catch (
|
|
833
|
-
if (
|
|
834
|
-
throw
|
|
874
|
+
const p = t(m);
|
|
875
|
+
return i ? void 0 : p;
|
|
876
|
+
} catch (p) {
|
|
877
|
+
if (p === hn) return p[0];
|
|
878
|
+
throw p;
|
|
835
879
|
}
|
|
836
880
|
};
|
|
837
881
|
});
|
|
838
|
-
const
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
const
|
|
842
|
-
|
|
882
|
+
const mn = 140;
|
|
883
|
+
G("...", mn);
|
|
884
|
+
a("...", (e) => (e = u(e), (t) => Object.entries(e(t))));
|
|
885
|
+
const mt = 170;
|
|
886
|
+
W("?.", mt, (e, t) => {
|
|
843
887
|
if (!e) return;
|
|
844
|
-
const
|
|
845
|
-
return
|
|
888
|
+
const r = H();
|
|
889
|
+
return r === 40 ? (O(), ["?.()", e, S(0, 41) || null]) : r === 91 ? (O(), ["?.[]", e, S(0, 93)]) : (t = S(mt), t ? ["?.", e, t] : void 0);
|
|
846
890
|
});
|
|
847
|
-
|
|
848
|
-
} : (
|
|
849
|
-
|
|
850
|
-
const n = r
|
|
851
|
-
return M(n) ? void 0 : e(
|
|
891
|
+
a("?.", (e, t) => (e = u(e), M(t) ? () => {
|
|
892
|
+
} : (r) => e(r)?.[t]));
|
|
893
|
+
a("?.[]", (e, t) => (e = u(e), t = u(t), (r) => {
|
|
894
|
+
const n = t(r);
|
|
895
|
+
return M(n) ? void 0 : e(r)?.[n];
|
|
852
896
|
}));
|
|
853
|
-
|
|
854
|
-
const
|
|
897
|
+
a("?.()", (e, t) => {
|
|
898
|
+
const r = t ? t[0] === "," ? (t = t.slice(1).map(u), (o) => t.map((s) => s(o))) : (t = u(t), (o) => [t(o)]) : () => [];
|
|
855
899
|
if (e[0] === "?.") {
|
|
856
|
-
const o =
|
|
857
|
-
return M(
|
|
858
|
-
} : (
|
|
900
|
+
const o = u(e[1]), s = e[2];
|
|
901
|
+
return M(s) ? () => {
|
|
902
|
+
} : (i) => o(i)?.[s]?.(...r(i));
|
|
859
903
|
}
|
|
860
904
|
if (e[0] === "?.[]") {
|
|
861
|
-
const o =
|
|
862
|
-
return (
|
|
863
|
-
const
|
|
864
|
-
return M(c) ? void 0 :
|
|
905
|
+
const o = u(e[1]), s = u(e[2]);
|
|
906
|
+
return (i) => {
|
|
907
|
+
const d = o(i), c = s(i);
|
|
908
|
+
return M(c) ? void 0 : d?.[c]?.(...r(i));
|
|
865
909
|
};
|
|
866
910
|
}
|
|
867
911
|
if (e[0] === ".") {
|
|
868
|
-
const o =
|
|
869
|
-
return M(
|
|
870
|
-
} : (
|
|
912
|
+
const o = u(e[1]), s = e[2];
|
|
913
|
+
return M(s) ? () => {
|
|
914
|
+
} : (i) => o(i)?.[s]?.(...r(i));
|
|
871
915
|
}
|
|
872
916
|
if (e[0] === "[]" && e.length === 3) {
|
|
873
|
-
const o =
|
|
874
|
-
return (
|
|
875
|
-
const
|
|
876
|
-
return M(c) ? void 0 :
|
|
917
|
+
const o = u(e[1]), s = u(e[2]);
|
|
918
|
+
return (i) => {
|
|
919
|
+
const d = o(i), c = s(i);
|
|
920
|
+
return M(c) ? void 0 : d?.[c]?.(...r(i));
|
|
877
921
|
};
|
|
878
922
|
}
|
|
879
|
-
const n =
|
|
880
|
-
return (o) => n(o)?.(...
|
|
923
|
+
const n = u(e);
|
|
924
|
+
return (o) => n(o)?.(...r(o));
|
|
881
925
|
});
|
|
882
926
|
const ne = 140;
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
927
|
+
G("typeof", ne);
|
|
928
|
+
G("void", ne);
|
|
929
|
+
G("delete", ne);
|
|
886
930
|
ce(
|
|
887
931
|
"new",
|
|
888
932
|
ne,
|
|
889
|
-
() =>
|
|
933
|
+
() => jr(".target") ? (O(7), ["new.target"]) : ["new", S(ne)]
|
|
890
934
|
);
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
935
|
+
a("typeof", (e) => (e = u(e), (t) => typeof e(t)));
|
|
936
|
+
a("void", (e) => (e = u(e), (t) => (e(t), void 0)));
|
|
937
|
+
a("delete", (e) => {
|
|
894
938
|
if (e[0] === ".") {
|
|
895
|
-
const
|
|
896
|
-
return (n) => delete
|
|
939
|
+
const t = u(e[1]), r = e[2];
|
|
940
|
+
return (n) => delete t(n)[r];
|
|
897
941
|
}
|
|
898
942
|
if (e[0] === "[]") {
|
|
899
|
-
const
|
|
900
|
-
return (n) => delete
|
|
943
|
+
const t = u(e[1]), r = u(e[2]);
|
|
944
|
+
return (n) => delete t(n)[r(n)];
|
|
901
945
|
}
|
|
902
946
|
return () => !0;
|
|
903
947
|
});
|
|
904
|
-
|
|
905
|
-
const
|
|
906
|
-
return (o) => new (
|
|
948
|
+
a("new", (e) => {
|
|
949
|
+
const t = u(e?.[0] === "()" ? e[1] : e), r = e?.[0] === "()" ? e[2] : null, n = r ? r[0] === "," ? /* @__PURE__ */ ((o) => (s) => o.map((i) => i(s)))(r.slice(1).map(u)) : /* @__PURE__ */ ((o) => (s) => [o(s)])(u(r)) : () => [];
|
|
950
|
+
return (o) => new (t(o))(...n(o));
|
|
907
951
|
});
|
|
908
|
-
const
|
|
909
|
-
if (
|
|
952
|
+
const nt = /* @__PURE__ */ Symbol("accessor"), ot = 20, gn = 40, Ht = 41, Gt = 123, Bt = 125, Kt = (e) => (t) => {
|
|
953
|
+
if (t) return;
|
|
910
954
|
H();
|
|
911
|
-
const
|
|
912
|
-
if (!
|
|
913
|
-
|
|
914
|
-
const n = S(0,
|
|
915
|
-
return H(),
|
|
955
|
+
const r = Z(A.id);
|
|
956
|
+
if (!r || (H(), g.charCodeAt(h) !== gn)) return !1;
|
|
957
|
+
O();
|
|
958
|
+
const n = S(0, Ht);
|
|
959
|
+
return H(), g.charCodeAt(h) !== Gt ? !1 : (O(), [e, r, n, S(0, Bt)]);
|
|
916
960
|
};
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
961
|
+
W("get", ot - 1, Kt("get"));
|
|
962
|
+
W("set", ot - 1, Kt("set"));
|
|
963
|
+
W("(", ot - 1, (e) => {
|
|
920
964
|
if (!e || typeof e != "string") return;
|
|
921
|
-
const
|
|
922
|
-
if (H(),
|
|
923
|
-
return
|
|
965
|
+
const t = S(0, Ht) || null;
|
|
966
|
+
if (H(), g.charCodeAt(h) === Gt)
|
|
967
|
+
return O(), [":", e, ["=>", ["()", t], S(0, Bt) || null]];
|
|
924
968
|
});
|
|
925
|
-
|
|
926
|
-
}, (
|
|
969
|
+
a("get", (e, t) => (t = t ? u(t) : () => {
|
|
970
|
+
}, (r) => [[nt, e, {
|
|
927
971
|
get: function() {
|
|
928
|
-
const n = Object.create(
|
|
929
|
-
return n.this = this,
|
|
972
|
+
const n = Object.create(r || {});
|
|
973
|
+
return n.this = this, t(n);
|
|
930
974
|
}
|
|
931
975
|
}]]));
|
|
932
|
-
|
|
933
|
-
}, (n) => [[
|
|
976
|
+
a("set", (e, t, r) => (r = r ? u(r) : () => {
|
|
977
|
+
}, (n) => [[nt, e, {
|
|
934
978
|
set: function(o) {
|
|
935
|
-
const
|
|
936
|
-
|
|
979
|
+
const s = Object.create(n || {});
|
|
980
|
+
s.this = this, s[t] = o, r(s);
|
|
937
981
|
}
|
|
938
982
|
}]]));
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
const
|
|
942
|
-
Qe("[]",
|
|
943
|
-
Qe("{}",
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
if (
|
|
947
|
-
if (!
|
|
983
|
+
const yn = 20, zt = 200;
|
|
984
|
+
A.prop = (e) => Tr(e) !== 58;
|
|
985
|
+
const An = (e) => e == null || typeof e == "string" || [":", ",", "...", "get", "set"].includes(e[0]);
|
|
986
|
+
Qe("[]", zt);
|
|
987
|
+
Qe("{}", zt);
|
|
988
|
+
$(":", yn - 1, !0);
|
|
989
|
+
a("{}", (e, t) => {
|
|
990
|
+
if (t !== void 0) return;
|
|
991
|
+
if (!An(e)) return u(["{", e]);
|
|
948
992
|
e = e ? e[0] !== "," ? [e] : e.slice(1) : [];
|
|
949
|
-
const
|
|
993
|
+
const r = e.map((n) => u(typeof n == "string" ? [":", n, n] : n));
|
|
950
994
|
return (n) => {
|
|
951
|
-
const o = {},
|
|
952
|
-
for (const
|
|
953
|
-
if (
|
|
954
|
-
const [,
|
|
955
|
-
|
|
956
|
-
} else o[
|
|
957
|
-
for (const
|
|
995
|
+
const o = {}, s = {};
|
|
996
|
+
for (const i of r.flatMap((d) => d(n)))
|
|
997
|
+
if (i[0] === nt) {
|
|
998
|
+
const [, d, c] = i;
|
|
999
|
+
s[d] = { ...s[d], ...c, configurable: !0, enumerable: !0 };
|
|
1000
|
+
} else o[i[0]] = i[1];
|
|
1001
|
+
for (const i in s) Object.defineProperty(o, i, s[i]);
|
|
958
1002
|
return o;
|
|
959
1003
|
};
|
|
960
1004
|
});
|
|
961
|
-
|
|
962
|
-
}, (
|
|
963
|
-
|
|
964
|
-
const
|
|
965
|
-
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" },
|
|
1005
|
+
a("{", (e) => (e = e ? u(e) : () => {
|
|
1006
|
+
}, (t) => e(Object.create(t))));
|
|
1007
|
+
a(":", (e, t) => (t = u(t), Array.isArray(e) ? (e = u(e), (r) => [[e(r), t(r)]]) : (r) => [[e, t(r)]]));
|
|
1008
|
+
const $n = 170, $e = 96, Sn = 36, En = 123, vn = 92, wn = { n: `
|
|
1009
|
+
`, r: "\r", t: " ", b: "\b", f: "\f", v: "\v" }, gt = () => {
|
|
966
1010
|
const e = [];
|
|
967
|
-
for (let
|
|
968
|
-
|
|
969
|
-
return
|
|
970
|
-
},
|
|
971
|
-
|
|
1011
|
+
for (let t = "", r; (r = g.charCodeAt(h)) !== $e; )
|
|
1012
|
+
r ? r === vn ? (O(), t += wn[g[h]] || g[h], O()) : r === Sn && g.charCodeAt(h + 1) === En ? (t && e.push([, t]), t = "", O(2), e.push(S(0, 125))) : (t += g[h], O(), r = g.charCodeAt(h), r === $e && t && e.push([, t])) : b("Unterminated template");
|
|
1013
|
+
return O(), e;
|
|
1014
|
+
}, On = P[$e];
|
|
1015
|
+
P[$e] = (e, t) => e && t < $n ? A.asi && A.newline ? void 0 : (O(), ["``", e, ...gt()]) : (
|
|
972
1016
|
// tagged
|
|
973
1017
|
e ? (
|
|
974
1018
|
// plain
|
|
975
|
-
|
|
976
|
-
) : (
|
|
1019
|
+
On?.(e, t)
|
|
1020
|
+
) : (O(), ((r) => r.length < 2 && r[0]?.[0] === void 0 ? r[0] || [, ""] : ["`", ...r])(gt()))
|
|
977
1021
|
);
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
e =
|
|
981
|
-
const
|
|
982
|
-
for (const
|
|
983
|
-
Array.isArray(
|
|
984
|
-
const o = Object.assign([...
|
|
985
|
-
return (
|
|
1022
|
+
a("`", (...e) => (e = e.map(u), (t) => e.map((r) => r(t)).join("")));
|
|
1023
|
+
a("``", (e, ...t) => {
|
|
1024
|
+
e = u(e);
|
|
1025
|
+
const r = [], n = [];
|
|
1026
|
+
for (const s of t)
|
|
1027
|
+
Array.isArray(s) && s[0] === void 0 ? r.push(s[1]) : n.push(u(s));
|
|
1028
|
+
const o = Object.assign([...r], { raw: r });
|
|
1029
|
+
return (s) => e(s)(o, ...n.map((i) => i(s)));
|
|
986
1030
|
});
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
const
|
|
990
|
-
log: (e,
|
|
1031
|
+
A.string["'"] = !0;
|
|
1032
|
+
A.number = { "0x": 16, "0b": 2, "0o": 8 };
|
|
1033
|
+
const In = {
|
|
1034
|
+
log: (e, t) => (t ? console.log(t, e) : console.log(e), e)
|
|
991
1035
|
};
|
|
992
|
-
function L(e,
|
|
993
|
-
const
|
|
994
|
-
return
|
|
995
|
-
$form:
|
|
996
|
-
$meta:
|
|
1036
|
+
function L(e, t, r, n, o) {
|
|
1037
|
+
const s = A(st(e));
|
|
1038
|
+
return u(s)({
|
|
1039
|
+
$form: t,
|
|
1040
|
+
$meta: r,
|
|
997
1041
|
$errors: n,
|
|
998
1042
|
$formIsInvalid: o,
|
|
999
|
-
$log:
|
|
1043
|
+
$log: In.log
|
|
1000
1044
|
}) === !0;
|
|
1001
1045
|
}
|
|
1002
|
-
function
|
|
1046
|
+
function st(e) {
|
|
1003
1047
|
return e.replace(/\?\.(\d+)/g, "?.[$1]").replace(/\.(\d+)/g, "[$1]");
|
|
1004
1048
|
}
|
|
1005
|
-
const
|
|
1006
|
-
let
|
|
1007
|
-
if (!
|
|
1049
|
+
const R = (e) => {
|
|
1050
|
+
let t = e.formDef.states;
|
|
1051
|
+
if (!t || Object.keys(t).length === 0 || e.formHealth.status === "errored")
|
|
1008
1052
|
return e;
|
|
1009
|
-
const { $formIsInvalid:
|
|
1010
|
-
|
|
1011
|
-
let o = [],
|
|
1053
|
+
const { $formIsInvalid: r, $errors: n } = be(e);
|
|
1054
|
+
t = Cn(t);
|
|
1055
|
+
let o = [], s = { status: "ok" };
|
|
1012
1056
|
try {
|
|
1013
|
-
o = Object.keys(
|
|
1014
|
-
const
|
|
1057
|
+
o = Object.keys(t).map((i) => {
|
|
1058
|
+
const d = t[i];
|
|
1015
1059
|
let c;
|
|
1016
1060
|
try {
|
|
1017
|
-
c = L(
|
|
1061
|
+
c = L(d, e.data, e.meta, n, r);
|
|
1018
1062
|
} catch {
|
|
1019
1063
|
c = !1;
|
|
1020
1064
|
}
|
|
1021
|
-
return c === !0 ?
|
|
1022
|
-
}).filter((
|
|
1023
|
-
} catch (
|
|
1024
|
-
const
|
|
1025
|
-
|
|
1065
|
+
return c === !0 ? i : void 0;
|
|
1066
|
+
}).filter((i) => i !== void 0);
|
|
1067
|
+
} catch (i) {
|
|
1068
|
+
const d = i, c = q.calculateCurrentStateError;
|
|
1069
|
+
s = {
|
|
1026
1070
|
status: "errored",
|
|
1027
|
-
message: `[${c}] ${
|
|
1071
|
+
message: `[${c}] ${d.message}`,
|
|
1028
1072
|
code: c
|
|
1029
1073
|
};
|
|
1030
1074
|
}
|
|
1031
|
-
return { ...e, currentStates: o, formHealth:
|
|
1075
|
+
return { ...e, currentStates: o, formHealth: s };
|
|
1032
1076
|
};
|
|
1033
|
-
function
|
|
1034
|
-
const
|
|
1035
|
-
function
|
|
1036
|
-
const o = n.split(":"),
|
|
1037
|
-
for (let
|
|
1038
|
-
|
|
1039
|
-
return
|
|
1077
|
+
function Cn(e) {
|
|
1078
|
+
const t = {};
|
|
1079
|
+
function r(n) {
|
|
1080
|
+
const o = n.split(":"), s = [];
|
|
1081
|
+
for (let i = 0; i < o.length; i++)
|
|
1082
|
+
s.push(o.slice(0, i + 1).join(":"));
|
|
1083
|
+
return s;
|
|
1040
1084
|
}
|
|
1041
1085
|
for (const [n, o] of Object.entries(e)) {
|
|
1042
|
-
const
|
|
1043
|
-
for (const
|
|
1044
|
-
e[
|
|
1045
|
-
|
|
1086
|
+
const s = r(n), i = [];
|
|
1087
|
+
for (const d of s)
|
|
1088
|
+
e[d] && i.push(`(${e[d]})`);
|
|
1089
|
+
t[n] = i.join(" && ");
|
|
1046
1090
|
}
|
|
1047
|
-
return
|
|
1091
|
+
return t;
|
|
1048
1092
|
}
|
|
1049
|
-
const
|
|
1050
|
-
function
|
|
1051
|
-
const
|
|
1093
|
+
const it = /* @__PURE__ */ Symbol("filterMap.skip");
|
|
1094
|
+
function Xt(e, t) {
|
|
1095
|
+
const r = [];
|
|
1052
1096
|
for (let n = 0; n < e.length; n++) {
|
|
1053
|
-
const o =
|
|
1054
|
-
o !==
|
|
1097
|
+
const o = t(e[n], n, e);
|
|
1098
|
+
o !== it && r.push(o);
|
|
1055
1099
|
}
|
|
1056
|
-
return
|
|
1100
|
+
return r;
|
|
1057
1101
|
}
|
|
1058
|
-
function
|
|
1102
|
+
function Po(e, t, r) {
|
|
1059
1103
|
for (let n = 0; n < e.length; n++)
|
|
1060
|
-
|
|
1104
|
+
t(e[n], n, e) && r(e[n], n, e);
|
|
1061
1105
|
}
|
|
1062
|
-
function
|
|
1106
|
+
function Dn(e, t, r, n) {
|
|
1063
1107
|
let o = n;
|
|
1064
|
-
for (let
|
|
1065
|
-
|
|
1108
|
+
for (let s = 0; s < e.length; s++)
|
|
1109
|
+
t(e[s], s, e) && (o = r(o, e[s], s, e));
|
|
1066
1110
|
return o;
|
|
1067
1111
|
}
|
|
1068
|
-
function
|
|
1069
|
-
if (e.length !==
|
|
1112
|
+
function kn(e, t, r) {
|
|
1113
|
+
if (e.length !== t.length)
|
|
1070
1114
|
return !1;
|
|
1071
1115
|
for (let n = 0; n < e.length; n++)
|
|
1072
|
-
if (!
|
|
1116
|
+
if (!r(e[n], t[n], n, e, t))
|
|
1073
1117
|
return !1;
|
|
1074
1118
|
return !0;
|
|
1075
1119
|
}
|
|
1076
|
-
function
|
|
1077
|
-
const
|
|
1078
|
-
return
|
|
1120
|
+
function Fn(e, t) {
|
|
1121
|
+
const r = bt(e.uid, t);
|
|
1122
|
+
return I(e) ? {
|
|
1079
1123
|
...e,
|
|
1080
|
-
uid:
|
|
1081
|
-
path:
|
|
1124
|
+
uid: r,
|
|
1125
|
+
path: Tn(e.path, t)
|
|
1082
1126
|
} : {
|
|
1083
1127
|
...e,
|
|
1084
|
-
uid:
|
|
1128
|
+
uid: r
|
|
1085
1129
|
};
|
|
1086
1130
|
}
|
|
1087
|
-
function
|
|
1088
|
-
if (
|
|
1131
|
+
function bt(e, t) {
|
|
1132
|
+
if (t.length === 0)
|
|
1089
1133
|
throw new Error("Repeater indexes cannot be an empty array");
|
|
1090
|
-
const
|
|
1091
|
-
return `${e}${
|
|
1134
|
+
const r = t.reduce((n, o) => `${n}[${o}]`, "");
|
|
1135
|
+
return `${e}${r}`;
|
|
1092
1136
|
}
|
|
1093
|
-
function
|
|
1094
|
-
if (
|
|
1137
|
+
function Tn(e, t) {
|
|
1138
|
+
if (t.length === 0)
|
|
1095
1139
|
throw new Error("Repeater indexes cannot be an empty array");
|
|
1096
|
-
const
|
|
1097
|
-
if (o !==
|
|
1140
|
+
const r = "items", n = e.split(`.${r}`), o = n.length - 1;
|
|
1141
|
+
if (o !== t.length)
|
|
1098
1142
|
throw new Error(
|
|
1099
|
-
`Path contains ${o} '${
|
|
1143
|
+
`Path contains ${o} '${r}' occurrences, but ${t.length} indexes were provided.`
|
|
1100
1144
|
);
|
|
1101
|
-
return n.reduce((
|
|
1145
|
+
return n.reduce((s, i, d) => d === 0 ? i : `${s}.${t[d - 1]}${i}`);
|
|
1102
1146
|
}
|
|
1103
|
-
function le(e,
|
|
1104
|
-
let
|
|
1147
|
+
function le(e, t) {
|
|
1148
|
+
let r = 0;
|
|
1105
1149
|
return e.replace(/\.items(\??)\./g, (n, o) => {
|
|
1106
|
-
const
|
|
1107
|
-
return
|
|
1150
|
+
const s = t[r++];
|
|
1151
|
+
return s === void 0 ? n : `.${s}${o}.`;
|
|
1108
1152
|
});
|
|
1109
1153
|
}
|
|
1110
|
-
const ae = (e,
|
|
1111
|
-
const { $formIsInvalid:
|
|
1154
|
+
const ae = (e, t) => (r) => e(r) ? t(r) : r, K = (e) => e !== void 0 && typeof e == "object" && e !== null && "when" in e, V = (e) => {
|
|
1155
|
+
const { $formIsInvalid: t, $errors: r } = be(e);
|
|
1112
1156
|
return {
|
|
1113
1157
|
...e,
|
|
1114
1158
|
widgetFlags: {
|
|
1115
|
-
...
|
|
1116
|
-
...Wn(e,
|
|
1159
|
+
...jn(e, r, t),
|
|
1160
|
+
...Wn(e, r, t)
|
|
1117
1161
|
}
|
|
1118
1162
|
};
|
|
1119
1163
|
};
|
|
1120
|
-
function
|
|
1121
|
-
return
|
|
1164
|
+
function jn(e, t, r) {
|
|
1165
|
+
return Xt(Object.values(e.flatForm), (n) => {
|
|
1122
1166
|
if (n.uid?.includes("["))
|
|
1123
|
-
return
|
|
1124
|
-
if (
|
|
1167
|
+
return it;
|
|
1168
|
+
if (ie(n)) {
|
|
1125
1169
|
const o = n({
|
|
1126
1170
|
$form: e.data,
|
|
1127
1171
|
errors: void 0,
|
|
@@ -1131,107 +1175,107 @@ function Tn(e, r, t) {
|
|
|
1131
1175
|
return o.uid = n.uid, o;
|
|
1132
1176
|
}
|
|
1133
1177
|
return n;
|
|
1134
|
-
}).filter((n) => !!(n.include && ("in" in n.include || "when" in n.include) || n.exclude && ("from" in n.exclude || "when" in n.exclude) || (
|
|
1178
|
+
}).filter((n) => !!(n.include && ("in" in n.include || "when" in n.include) || n.exclude && ("from" in n.exclude || "when" in n.exclude) || (I(n) || te(n)) && K(n.disabled) || I(n) && K(n.readonly))).reduce(
|
|
1135
1179
|
(n, o) => (n[o.uid] = n[o.uid] || {}, o.include && "in" in o.include ? n[o.uid].hidden = !o.include.in.some(
|
|
1136
|
-
(
|
|
1180
|
+
(s) => e.currentStates.includes(s)
|
|
1137
1181
|
) : o.include && "when" in o.include && (n[o.uid].hidden = !L(
|
|
1138
1182
|
o.include.when,
|
|
1139
1183
|
e.data,
|
|
1140
1184
|
e.meta,
|
|
1141
|
-
|
|
1142
|
-
|
|
1185
|
+
t,
|
|
1186
|
+
r
|
|
1143
1187
|
)), o.exclude && "from" in o.exclude ? n[o.uid].hidden = o.exclude.from.some(
|
|
1144
|
-
(
|
|
1188
|
+
(s) => e.currentStates.includes(s)
|
|
1145
1189
|
) : o.exclude && "when" in o.exclude && (n[o.uid].hidden = L(
|
|
1146
1190
|
o.exclude.when,
|
|
1147
1191
|
e.data,
|
|
1148
1192
|
e.meta,
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
)), (
|
|
1193
|
+
t,
|
|
1194
|
+
r
|
|
1195
|
+
)), (I(o) || te(o)) && K(o.disabled) && (n[o.uid].disabled = L(
|
|
1152
1196
|
o.disabled.when,
|
|
1153
1197
|
e.data,
|
|
1154
1198
|
e.meta,
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
)),
|
|
1199
|
+
t,
|
|
1200
|
+
r
|
|
1201
|
+
)), I(o) && K(o.readonly) && (n[o.uid].readonly = L(
|
|
1158
1202
|
o.readonly.when,
|
|
1159
1203
|
e.data,
|
|
1160
1204
|
e.meta,
|
|
1161
|
-
|
|
1162
|
-
|
|
1205
|
+
t,
|
|
1206
|
+
r
|
|
1163
1207
|
)), n),
|
|
1164
1208
|
{}
|
|
1165
1209
|
);
|
|
1166
1210
|
}
|
|
1167
|
-
function Wn(e,
|
|
1168
|
-
return
|
|
1211
|
+
function Wn(e, t, r) {
|
|
1212
|
+
return Dn(
|
|
1169
1213
|
Object.values(e.flatForm),
|
|
1170
|
-
(n) => !
|
|
1214
|
+
(n) => !ie(n) && n.type === "repeater",
|
|
1171
1215
|
(n, o) => ({
|
|
1172
1216
|
...n,
|
|
1173
|
-
...
|
|
1217
|
+
...Jt(e, o, [], t, r)
|
|
1174
1218
|
}),
|
|
1175
1219
|
{}
|
|
1176
1220
|
);
|
|
1177
1221
|
}
|
|
1178
|
-
function
|
|
1179
|
-
const
|
|
1180
|
-
if (!Array.isArray(
|
|
1222
|
+
function Jt(e, t, r, n, o) {
|
|
1223
|
+
const s = t.props.template, i = ue(e.data, t.path);
|
|
1224
|
+
if (!Array.isArray(i))
|
|
1181
1225
|
return {};
|
|
1182
|
-
const
|
|
1183
|
-
return
|
|
1184
|
-
const
|
|
1185
|
-
Xe([
|
|
1226
|
+
const d = {};
|
|
1227
|
+
return i.forEach((c, l) => {
|
|
1228
|
+
const m = [...r, l];
|
|
1229
|
+
Xe([s]).forEach((p) => {
|
|
1186
1230
|
let f;
|
|
1187
|
-
if (
|
|
1231
|
+
if (ie(p) ? (f = p({
|
|
1188
1232
|
$form: e.data,
|
|
1189
1233
|
errors: void 0,
|
|
1190
1234
|
touched: void 0,
|
|
1191
1235
|
translate: void 0
|
|
1192
|
-
}), f.uid =
|
|
1193
|
-
const
|
|
1236
|
+
}), f.uid = p.uid) : f = p, f.type === "repeater") {
|
|
1237
|
+
const ee = Fn(
|
|
1194
1238
|
f,
|
|
1195
|
-
|
|
1239
|
+
m
|
|
1196
1240
|
);
|
|
1197
1241
|
Object.assign(
|
|
1198
|
-
|
|
1199
|
-
|
|
1242
|
+
d,
|
|
1243
|
+
Jt(
|
|
1200
1244
|
e,
|
|
1201
|
-
|
|
1202
|
-
|
|
1245
|
+
ee,
|
|
1246
|
+
m,
|
|
1203
1247
|
n,
|
|
1204
1248
|
o
|
|
1205
1249
|
)
|
|
1206
1250
|
);
|
|
1207
1251
|
return;
|
|
1208
1252
|
}
|
|
1209
|
-
const
|
|
1210
|
-
|
|
1211
|
-
le(f.include.when,
|
|
1253
|
+
const D = bt(f.uid, m);
|
|
1254
|
+
d[D] = d[D] || {}, f.include && "in" in f.include ? d[D].hidden = !f.include.in.some((ee) => e.currentStates.includes(ee)) : f.include && "when" in f.include && (d[D].hidden = !L(
|
|
1255
|
+
le(f.include.when, m),
|
|
1212
1256
|
e.data,
|
|
1213
1257
|
e.meta,
|
|
1214
1258
|
n,
|
|
1215
1259
|
o
|
|
1216
|
-
)), f.exclude && "from" in f.exclude ?
|
|
1217
|
-
le(f.exclude.when,
|
|
1260
|
+
)), f.exclude && "from" in f.exclude ? d[D].hidden = f.exclude.from.some((ee) => e.currentStates.includes(ee)) : f.exclude && "when" in f.exclude && (d[D].hidden = L(
|
|
1261
|
+
le(f.exclude.when, m),
|
|
1218
1262
|
e.data,
|
|
1219
1263
|
e.meta,
|
|
1220
1264
|
n,
|
|
1221
1265
|
o
|
|
1222
|
-
)), (
|
|
1266
|
+
)), (I(f) || te(f)) && K(f.disabled) && (d[D].disabled = L(
|
|
1223
1267
|
le(
|
|
1224
1268
|
f.disabled.when,
|
|
1225
|
-
|
|
1269
|
+
m
|
|
1226
1270
|
),
|
|
1227
1271
|
e.data,
|
|
1228
1272
|
e.meta,
|
|
1229
1273
|
n,
|
|
1230
1274
|
o
|
|
1231
|
-
)),
|
|
1275
|
+
)), I(f) && K(f.readonly) && (d[D].readonly = L(
|
|
1232
1276
|
le(
|
|
1233
1277
|
f.readonly.when,
|
|
1234
|
-
|
|
1278
|
+
m
|
|
1235
1279
|
),
|
|
1236
1280
|
e.data,
|
|
1237
1281
|
e.meta,
|
|
@@ -1239,15 +1283,15 @@ function Kr(e, r, t, n, o) {
|
|
|
1239
1283
|
o
|
|
1240
1284
|
));
|
|
1241
1285
|
});
|
|
1242
|
-
}),
|
|
1286
|
+
}), d;
|
|
1243
1287
|
}
|
|
1244
|
-
const
|
|
1288
|
+
const _ = (e) => (t) => {
|
|
1245
1289
|
try {
|
|
1246
|
-
return { ...
|
|
1247
|
-
} catch (
|
|
1248
|
-
const n =
|
|
1290
|
+
return { ...t, calculatedWidgets: Pn(t, e) };
|
|
1291
|
+
} catch (r) {
|
|
1292
|
+
const n = r;
|
|
1249
1293
|
return {
|
|
1250
|
-
...
|
|
1294
|
+
...t,
|
|
1251
1295
|
formHealth: {
|
|
1252
1296
|
status: "errored",
|
|
1253
1297
|
message: `[${n.code}] ${n.message}`,
|
|
@@ -1256,165 +1300,165 @@ const N = (e) => (r) => {
|
|
|
1256
1300
|
};
|
|
1257
1301
|
}
|
|
1258
1302
|
};
|
|
1259
|
-
function
|
|
1260
|
-
const { $formIsInvalid:
|
|
1261
|
-
for (const
|
|
1262
|
-
if (e.widgetFlags[
|
|
1303
|
+
function Pn(e, t) {
|
|
1304
|
+
const { $formIsInvalid: r, $errors: n } = be(e), o = Zn(e, t, r, n), s = {};
|
|
1305
|
+
for (const i of Object.keys(e.calculatedWidgets)) {
|
|
1306
|
+
if (e.widgetFlags[i]?.hidden)
|
|
1263
1307
|
continue;
|
|
1264
|
-
const
|
|
1265
|
-
if (
|
|
1266
|
-
i
|
|
1308
|
+
const d = e.calculatedWidgets[i], c = d.source;
|
|
1309
|
+
if (ie(c)) {
|
|
1310
|
+
s[i] = Nn(i, c, e, t);
|
|
1267
1311
|
continue;
|
|
1268
1312
|
}
|
|
1269
|
-
i
|
|
1270
|
-
|
|
1313
|
+
s[i] = _n(
|
|
1314
|
+
d,
|
|
1271
1315
|
c,
|
|
1272
1316
|
e,
|
|
1273
1317
|
o
|
|
1274
1318
|
);
|
|
1275
1319
|
}
|
|
1276
|
-
return
|
|
1320
|
+
return s;
|
|
1277
1321
|
}
|
|
1278
|
-
function
|
|
1279
|
-
const o =
|
|
1280
|
-
$form:
|
|
1281
|
-
errors:
|
|
1282
|
-
touched:
|
|
1322
|
+
function Nn(e, t, r, n) {
|
|
1323
|
+
const o = t({
|
|
1324
|
+
$form: r.data,
|
|
1325
|
+
errors: t.path ? r.validations[t.path] : void 0,
|
|
1326
|
+
touched: t.path ? r.touchedControls[t.path] : void 0,
|
|
1283
1327
|
translate: n.translate
|
|
1284
1328
|
});
|
|
1285
|
-
return o.uid = e, { source:
|
|
1329
|
+
return o.uid = e, { source: t, current: o };
|
|
1286
1330
|
}
|
|
1287
|
-
function _n(e,
|
|
1288
|
-
const o = new
|
|
1289
|
-
return o.write("uid",
|
|
1331
|
+
function _n(e, t, r, n) {
|
|
1332
|
+
const o = new xn(t, e.current);
|
|
1333
|
+
return o.write("uid", t.uid), o.write("type", t.type), o.write("kind", t.kind), hr(t) ? Ln(o, n) : te(t) ? Rn(o, n) : I(t) ? Vn(o, n) : he(t) && Un(o, n), Mn(t, o, n, r), (te(t) || I(t)) && Hn(t, o, n), he(t) && Gn(t, o, r), o.changed ? { source: e.source, current: o.current } : e;
|
|
1290
1334
|
}
|
|
1291
|
-
function
|
|
1292
|
-
|
|
1335
|
+
function Ln(e, t) {
|
|
1336
|
+
E(e, t, "size"), E(e, t, "include"), E(e, t, "exclude");
|
|
1293
1337
|
}
|
|
1294
|
-
function
|
|
1295
|
-
|
|
1338
|
+
function Rn(e, t) {
|
|
1339
|
+
E(e, t, "size"), E(e, t, "include"), E(e, t, "exclude"), E(e, t, "label"), E(e, t, "disabled"), E(e, t, "actionType");
|
|
1296
1340
|
}
|
|
1297
|
-
function
|
|
1298
|
-
|
|
1341
|
+
function Vn(e, t) {
|
|
1342
|
+
E(e, t, "size"), E(e, t, "include"), E(e, t, "exclude"), E(e, t, "label"), E(e, t, "disabled"), E(e, t, "readonly"), E(e, t, "validator"), E(e, t, "path"), E(e, t, "defaultValue");
|
|
1299
1343
|
}
|
|
1300
|
-
function
|
|
1301
|
-
|
|
1344
|
+
function Un(e, t) {
|
|
1345
|
+
E(e, t, "size"), E(e, t, "include"), E(e, t, "exclude");
|
|
1302
1346
|
}
|
|
1303
|
-
function
|
|
1304
|
-
const o = n.widgetPropOverrides[e.uid] ?? {},
|
|
1305
|
-
for (const
|
|
1306
|
-
|
|
1347
|
+
function Mn(e, t, r, n) {
|
|
1348
|
+
const o = n.widgetPropOverrides[e.uid] ?? {}, s = { ...e.props ?? {}, ...o };
|
|
1349
|
+
for (const i of xt(Object.keys(s)))
|
|
1350
|
+
Bn(t, r, i);
|
|
1307
1351
|
}
|
|
1308
|
-
function
|
|
1352
|
+
function Hn(e, t, r) {
|
|
1309
1353
|
const n = e.on ?? {};
|
|
1310
|
-
for (const o of
|
|
1311
|
-
|
|
1354
|
+
for (const o of xt(Object.keys(n)))
|
|
1355
|
+
Kn(t, r, o);
|
|
1312
1356
|
}
|
|
1313
|
-
function
|
|
1314
|
-
const n =
|
|
1315
|
-
|
|
1316
|
-
const
|
|
1317
|
-
|
|
1357
|
+
function Gn(e, t, r) {
|
|
1358
|
+
const n = to(e.uid), o = eo(e.children, n, r.widgetFlags);
|
|
1359
|
+
t.current.children = o;
|
|
1360
|
+
const s = t.previous.children ?? [];
|
|
1361
|
+
s.length === o.length && o.every((d, c) => s[c] && s[c].uid === o[c].uid) || t.markChanged();
|
|
1318
1362
|
}
|
|
1319
|
-
function
|
|
1363
|
+
function E(e, t, r) {
|
|
1320
1364
|
const n = e.source;
|
|
1321
|
-
if (!
|
|
1365
|
+
if (!Yn(n, r))
|
|
1322
1366
|
return;
|
|
1323
|
-
const o =
|
|
1324
|
-
let
|
|
1325
|
-
switch (
|
|
1367
|
+
const o = dt(n, r, t.sortedStates);
|
|
1368
|
+
let s;
|
|
1369
|
+
switch (r) {
|
|
1326
1370
|
case "disabled":
|
|
1327
1371
|
case "readonly":
|
|
1328
|
-
|
|
1372
|
+
s = bn(o, t, e.source.uid, r);
|
|
1329
1373
|
break;
|
|
1330
1374
|
case "defaultValue":
|
|
1331
|
-
|
|
1375
|
+
s = o;
|
|
1332
1376
|
break;
|
|
1333
1377
|
default:
|
|
1334
|
-
|
|
1378
|
+
s = qt(o, t);
|
|
1335
1379
|
}
|
|
1336
|
-
e.write(
|
|
1380
|
+
e.write(r, s);
|
|
1337
1381
|
}
|
|
1338
|
-
function
|
|
1339
|
-
const n = e.source.props, o =
|
|
1340
|
-
let
|
|
1341
|
-
const
|
|
1342
|
-
|
|
1382
|
+
function Bn(e, t, r) {
|
|
1383
|
+
const n = e.source.props, o = dt(n, r, t.sortedStates);
|
|
1384
|
+
let s = qt(o, t);
|
|
1385
|
+
const i = t.widgetPropOverrides[e.source.uid]?.[r];
|
|
1386
|
+
i !== void 0 && (s = i), e.write(`props.${r}`, s);
|
|
1343
1387
|
}
|
|
1344
|
-
function
|
|
1345
|
-
const n = e.source.on, o =
|
|
1346
|
-
e.write(`on.${
|
|
1388
|
+
function Kn(e, t, r) {
|
|
1389
|
+
const n = e.source.on, o = dt(n, r, t.sortedStates);
|
|
1390
|
+
e.write(`on.${r}`, Jn(o, t));
|
|
1347
1391
|
}
|
|
1348
|
-
function
|
|
1349
|
-
return e({ $form:
|
|
1392
|
+
function ut(e, t) {
|
|
1393
|
+
return e({ $form: t.$form, translate: t.localization.translate });
|
|
1350
1394
|
}
|
|
1351
|
-
function
|
|
1352
|
-
return
|
|
1395
|
+
function zn(e, t) {
|
|
1396
|
+
return t.localization.translate(e.key, qn(e.params, t), e.default);
|
|
1353
1397
|
}
|
|
1354
|
-
const
|
|
1355
|
-
function
|
|
1356
|
-
return e.includes("{{") ? e.replace(
|
|
1357
|
-
const o =
|
|
1398
|
+
const Xn = /\{\{([^}]+)\}\}/g;
|
|
1399
|
+
function Qt(e, t) {
|
|
1400
|
+
return e.includes("{{") ? e.replace(Xn, (r, n) => {
|
|
1401
|
+
const o = st(n.trim());
|
|
1358
1402
|
try {
|
|
1359
|
-
const
|
|
1360
|
-
$form:
|
|
1361
|
-
$meta:
|
|
1362
|
-
$errors:
|
|
1363
|
-
$formIsInvalid:
|
|
1403
|
+
const s = u(A(o))({
|
|
1404
|
+
$form: t.$form,
|
|
1405
|
+
$meta: t.$meta,
|
|
1406
|
+
$errors: t.$errors,
|
|
1407
|
+
$formIsInvalid: t.$formIsInvalid
|
|
1364
1408
|
});
|
|
1365
|
-
return
|
|
1366
|
-
} catch (
|
|
1367
|
-
const
|
|
1368
|
-
throw new
|
|
1409
|
+
return s == null ? "" : String(s);
|
|
1410
|
+
} catch (s) {
|
|
1411
|
+
const i = s instanceof Error ? s.message : String(s);
|
|
1412
|
+
throw new Zt(`Failed to evaluate '{{${n.trim()}}}': ${i}`);
|
|
1369
1413
|
}
|
|
1370
1414
|
}) : e;
|
|
1371
1415
|
}
|
|
1372
|
-
function
|
|
1373
|
-
return typeof e == "function" ?
|
|
1416
|
+
function qt(e, t) {
|
|
1417
|
+
return typeof e == "function" ? ut(e, t) : wr(e) ? zn(e, t) : typeof e == "string" ? Qt(e, t) : e;
|
|
1374
1418
|
}
|
|
1375
|
-
function
|
|
1376
|
-
return typeof e == "function" ?
|
|
1419
|
+
function bn(e, t, r, n) {
|
|
1420
|
+
return typeof e == "function" ? ut(e, t) : K(e) ? t.widgetFlags[r]?.[n] : typeof e == "string" ? Qt(e, t) : e;
|
|
1377
1421
|
}
|
|
1378
|
-
function
|
|
1379
|
-
return typeof e == "function" ?
|
|
1422
|
+
function Jn(e, t) {
|
|
1423
|
+
return typeof e == "function" ? ut(e, t) : e;
|
|
1380
1424
|
}
|
|
1381
|
-
function
|
|
1425
|
+
function dt(e, t, r) {
|
|
1382
1426
|
if (e) {
|
|
1383
|
-
for (const n of
|
|
1384
|
-
const o = e[`${
|
|
1427
|
+
for (const n of r) {
|
|
1428
|
+
const o = e[`${t}.${n}`];
|
|
1385
1429
|
if (o !== void 0)
|
|
1386
1430
|
return o;
|
|
1387
1431
|
}
|
|
1388
|
-
return e[
|
|
1432
|
+
return e[t];
|
|
1389
1433
|
}
|
|
1390
1434
|
}
|
|
1391
|
-
function
|
|
1435
|
+
function Qn(e) {
|
|
1392
1436
|
return e.startsWith("$form") || e.startsWith("$meta") || e.startsWith("$errors") || e === "$formIsInvalid";
|
|
1393
1437
|
}
|
|
1394
|
-
function
|
|
1395
|
-
return e && Object.keys(e).reduce((
|
|
1438
|
+
function qn(e, t) {
|
|
1439
|
+
return e && Object.keys(e).reduce((r, n) => {
|
|
1396
1440
|
const o = String(e[n]);
|
|
1397
|
-
if (
|
|
1441
|
+
if (Qn(o))
|
|
1398
1442
|
try {
|
|
1399
|
-
const
|
|
1400
|
-
$form:
|
|
1401
|
-
$meta:
|
|
1402
|
-
$errors:
|
|
1403
|
-
$formIsInvalid:
|
|
1443
|
+
const s = u(A(st(o)))({
|
|
1444
|
+
$form: t.$form,
|
|
1445
|
+
$meta: t.$meta,
|
|
1446
|
+
$errors: t.$errors,
|
|
1447
|
+
$formIsInvalid: t.$formIsInvalid
|
|
1404
1448
|
});
|
|
1405
|
-
|
|
1406
|
-
} catch (
|
|
1407
|
-
const
|
|
1408
|
-
throw new
|
|
1449
|
+
r[n] = s ?? o;
|
|
1450
|
+
} catch (s) {
|
|
1451
|
+
const i = s instanceof Error ? s.message : String(s);
|
|
1452
|
+
throw new Zt(`Failed to evaluate i18n param '${o}': ${i}`);
|
|
1409
1453
|
}
|
|
1410
1454
|
else
|
|
1411
|
-
|
|
1412
|
-
return
|
|
1455
|
+
r[n] = o;
|
|
1456
|
+
return r;
|
|
1413
1457
|
}, {});
|
|
1414
1458
|
}
|
|
1415
|
-
class
|
|
1416
|
-
constructor(
|
|
1417
|
-
this._changed = !1, this.source =
|
|
1459
|
+
class xn {
|
|
1460
|
+
constructor(t, r) {
|
|
1461
|
+
this._changed = !1, this.source = t, this.previous = r, this.current = {};
|
|
1418
1462
|
}
|
|
1419
1463
|
get changed() {
|
|
1420
1464
|
return this._changed;
|
|
@@ -1422,333 +1466,365 @@ class qn {
|
|
|
1422
1466
|
markChanged() {
|
|
1423
1467
|
this._changed = !0;
|
|
1424
1468
|
}
|
|
1425
|
-
write(
|
|
1426
|
-
|
|
1469
|
+
write(t, r) {
|
|
1470
|
+
ze(this.current, t, r), ue(this.previous, t) !== r && (this._changed = !0);
|
|
1427
1471
|
}
|
|
1428
1472
|
}
|
|
1429
|
-
function
|
|
1473
|
+
function Zn(e, t, r, n) {
|
|
1430
1474
|
return {
|
|
1431
|
-
sortedStates: [...e.currentStates].sort((o,
|
|
1475
|
+
sortedStates: [...e.currentStates].sort((o, s) => s.length - o.length),
|
|
1432
1476
|
widgetPropOverrides: e.widgetPropOverrides,
|
|
1433
1477
|
widgetFlags: e.widgetFlags,
|
|
1434
1478
|
$form: e.data,
|
|
1435
1479
|
$meta: e.meta,
|
|
1436
|
-
$formIsInvalid:
|
|
1480
|
+
$formIsInvalid: r,
|
|
1437
1481
|
$errors: n,
|
|
1438
|
-
localization:
|
|
1482
|
+
localization: t
|
|
1439
1483
|
};
|
|
1440
1484
|
}
|
|
1441
|
-
function
|
|
1442
|
-
if (
|
|
1485
|
+
function Yn(e, t) {
|
|
1486
|
+
if (t in e)
|
|
1443
1487
|
return !0;
|
|
1444
|
-
const
|
|
1445
|
-
return Object.keys(e).some((n) => n.startsWith(
|
|
1488
|
+
const r = `${t}.`;
|
|
1489
|
+
return Object.keys(e).some((n) => n.startsWith(r));
|
|
1446
1490
|
}
|
|
1447
|
-
function
|
|
1448
|
-
return Array.from(new Set(e.map((
|
|
1491
|
+
function xt(e) {
|
|
1492
|
+
return Array.from(new Set(e.map((t) => t.split(".")[0])));
|
|
1449
1493
|
}
|
|
1450
|
-
function
|
|
1451
|
-
const n =
|
|
1494
|
+
function eo(e, t, r) {
|
|
1495
|
+
const n = t.map((o) => `[${o}]`).join("");
|
|
1452
1496
|
return e.filter((o) => {
|
|
1453
|
-
const
|
|
1454
|
-
return !
|
|
1497
|
+
const s = o.uid + n, i = r[s];
|
|
1498
|
+
return !i || i.hidden !== !0;
|
|
1455
1499
|
});
|
|
1456
1500
|
}
|
|
1457
|
-
const
|
|
1458
|
-
class
|
|
1501
|
+
const to = (e) => [...e.matchAll(/\[(\d+)\]/g)].map((t) => parseInt(t[1], 10));
|
|
1502
|
+
class Zt extends Error {
|
|
1459
1503
|
constructor() {
|
|
1460
|
-
super(...arguments), this.code =
|
|
1504
|
+
super(...arguments), this.code = q.resolveStringInterpolationError, this.name = "StringInterpolationError";
|
|
1461
1505
|
}
|
|
1462
1506
|
}
|
|
1463
|
-
const
|
|
1464
|
-
const
|
|
1465
|
-
...
|
|
1466
|
-
formName:
|
|
1507
|
+
const ro = ({ lang: e }, t) => {
|
|
1508
|
+
const r = {
|
|
1509
|
+
...Ot(e),
|
|
1510
|
+
formName: t.payload.formName
|
|
1467
1511
|
};
|
|
1468
|
-
let n =
|
|
1512
|
+
let n = t.payload.formDef, o = { status: "ok" };
|
|
1469
1513
|
if (typeof n == "string") {
|
|
1470
1514
|
try {
|
|
1471
1515
|
n = JSON.parse(n);
|
|
1472
|
-
} catch (
|
|
1473
|
-
const
|
|
1516
|
+
} catch (l) {
|
|
1517
|
+
const m = l, p = q.initializeParseError;
|
|
1474
1518
|
o = {
|
|
1475
1519
|
status: "errored",
|
|
1476
|
-
message: `[${
|
|
1477
|
-
code:
|
|
1520
|
+
message: `[${p}] ${m.message}`,
|
|
1521
|
+
code: p
|
|
1478
1522
|
};
|
|
1479
1523
|
}
|
|
1480
1524
|
if (o.status === "errored")
|
|
1481
|
-
return { ...
|
|
1525
|
+
return { ...r, formHealth: o };
|
|
1482
1526
|
}
|
|
1483
1527
|
if (Array.isArray(n.form)) {
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1528
|
+
const l = n, m = l.form;
|
|
1529
|
+
l.form = {
|
|
1486
1530
|
uid: "",
|
|
1487
1531
|
type: "flex",
|
|
1488
1532
|
kind: "layout",
|
|
1489
|
-
children:
|
|
1533
|
+
children: m
|
|
1490
1534
|
};
|
|
1491
1535
|
}
|
|
1492
|
-
const
|
|
1493
|
-
if (
|
|
1536
|
+
const s = wt.decode(n);
|
|
1537
|
+
if (s.isOk()) {
|
|
1494
1538
|
o = { status: "ok" };
|
|
1495
|
-
let
|
|
1539
|
+
let l = {};
|
|
1496
1540
|
try {
|
|
1497
|
-
|
|
1498
|
-
(
|
|
1499
|
-
const
|
|
1500
|
-
if (
|
|
1501
|
-
throw { existingWidget:
|
|
1502
|
-
return
|
|
1541
|
+
l = Xe([s.value.form]).reduce(
|
|
1542
|
+
(m, p) => {
|
|
1543
|
+
const f = p.uid;
|
|
1544
|
+
if (m[f])
|
|
1545
|
+
throw { existingWidget: m[f], newWidget: p };
|
|
1546
|
+
return m[f] = p, m;
|
|
1503
1547
|
},
|
|
1504
1548
|
{}
|
|
1505
1549
|
);
|
|
1506
|
-
} catch (
|
|
1507
|
-
|
|
1508
|
-
o = {
|
|
1509
|
-
status: "errored",
|
|
1510
|
-
message: `[${a}] ${ro(c.existingWidget, c.newWidget)}`,
|
|
1511
|
-
code: a
|
|
1512
|
-
}, u = {};
|
|
1550
|
+
} catch (m) {
|
|
1551
|
+
o = so(m.existingWidget, m.newWidget), l = {};
|
|
1513
1552
|
}
|
|
1514
|
-
return {
|
|
1515
|
-
...
|
|
1516
|
-
formDef:
|
|
1517
|
-
flatForm:
|
|
1553
|
+
return io(l, s.value.states), {
|
|
1554
|
+
...r,
|
|
1555
|
+
formDef: s.value,
|
|
1556
|
+
flatForm: l,
|
|
1518
1557
|
formHealth: o
|
|
1519
1558
|
};
|
|
1520
1559
|
}
|
|
1521
|
-
const
|
|
1560
|
+
const i = oo(n);
|
|
1561
|
+
if (i)
|
|
1562
|
+
return { ...r, formHealth: i };
|
|
1563
|
+
const d = q.initializeUnknownError, c = s.issues.map((l) => `${l.path.length > 0 ? $t(l.path) : "root"}: ${l.message}`).join("; ");
|
|
1522
1564
|
return {
|
|
1523
|
-
...
|
|
1565
|
+
...r,
|
|
1524
1566
|
formHealth: {
|
|
1525
1567
|
status: "errored",
|
|
1526
|
-
message: `[${
|
|
1527
|
-
code:
|
|
1568
|
+
message: `[${d}] ${c}`,
|
|
1569
|
+
code: d
|
|
1528
1570
|
}
|
|
1529
1571
|
};
|
|
1530
1572
|
};
|
|
1531
|
-
function
|
|
1532
|
-
|
|
1533
|
-
|
|
1573
|
+
function Yt(e, t) {
|
|
1574
|
+
return { status: "errored", code: e, message: `[${e}] ${t}` };
|
|
1575
|
+
}
|
|
1576
|
+
function no() {
|
|
1577
|
+
return "Malformed form definition. Pass it directly as formDef - `config={{ formDef: { states, form: [...] } }}`. Do NOT wrap it in an extra `{ form: ... }`.";
|
|
1578
|
+
}
|
|
1579
|
+
function oo(e) {
|
|
1580
|
+
if (!e || typeof e != "object" || Array.isArray(e))
|
|
1581
|
+
return null;
|
|
1582
|
+
const t = e.form;
|
|
1583
|
+
return t && typeof t == "object" && !Array.isArray(t) && !he(t) ? Yt(q.initializeMalformedFormShapeError, no()) : null;
|
|
1584
|
+
}
|
|
1585
|
+
function so(e, t) {
|
|
1586
|
+
const r = (o) => I(o) ? ` at "${o.path}"` : "", n = `Duplicate UID "${t.uid}": Assigned to widget "${e.type}"${r(e)} and "${t.type}"${r(t)}.`;
|
|
1587
|
+
return Yt(q.initializeUidCollisionError, n);
|
|
1588
|
+
}
|
|
1589
|
+
function io(e, t) {
|
|
1590
|
+
const r = new Set(Object.keys(t ?? {})), n = /* @__PURE__ */ new Map();
|
|
1591
|
+
for (const s of Object.values(e)) {
|
|
1592
|
+
const i = [], d = s.include;
|
|
1593
|
+
d && Array.isArray(d.in) && i.push(...d.in);
|
|
1594
|
+
const c = s.exclude;
|
|
1595
|
+
c && Array.isArray(c.from) && i.push(...c.from);
|
|
1596
|
+
for (const l of i) {
|
|
1597
|
+
if (r.has(l))
|
|
1598
|
+
continue;
|
|
1599
|
+
const m = n.get(l) ?? [];
|
|
1600
|
+
m.push(s.uid || "(unknown)"), n.set(l, m);
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
if (n.size === 0)
|
|
1604
|
+
return;
|
|
1605
|
+
const o = r.size ? [...r].join(", ") : "(none declared)";
|
|
1606
|
+
for (const [s, i] of n)
|
|
1607
|
+
console.error(
|
|
1608
|
+
`[GolemUI] include/exclude references undefined state "${s}" (on ${i.join(", ")}); these widgets will stay hidden. Declared states: ${o}. Fix: declare "${s}" in formConfig.states, or correct the name.`
|
|
1609
|
+
);
|
|
1534
1610
|
}
|
|
1535
|
-
function
|
|
1611
|
+
function uo(e, t) {
|
|
1536
1612
|
return {
|
|
1537
1613
|
...e,
|
|
1538
1614
|
injectedValidations: {
|
|
1539
1615
|
...e.injectedValidations,
|
|
1540
|
-
[
|
|
1616
|
+
[t.payload.path]: t.payload.issues
|
|
1541
1617
|
}
|
|
1542
1618
|
};
|
|
1543
1619
|
}
|
|
1544
|
-
const
|
|
1545
|
-
let
|
|
1546
|
-
if ("path" in
|
|
1547
|
-
if (
|
|
1548
|
-
({ source:
|
|
1549
|
-
), !
|
|
1550
|
-
return console.warn(`Input with path "${
|
|
1551
|
-
} else if (
|
|
1552
|
-
return console.warn(`Widget with uid "${
|
|
1553
|
-
const n =
|
|
1620
|
+
const co = (e, { payload: t }) => {
|
|
1621
|
+
let r;
|
|
1622
|
+
if ("path" in t) {
|
|
1623
|
+
if (r = Object.values(e.calculatedWidgets).find(
|
|
1624
|
+
({ source: s }) => I(s) && s.path === t.path
|
|
1625
|
+
), !r)
|
|
1626
|
+
return console.warn(`Input with path "${t.path}" not found`), e;
|
|
1627
|
+
} else if (r = e.calculatedWidgets[t.uid], !r)
|
|
1628
|
+
return console.warn(`Widget with uid "${t.uid}" not found`), e;
|
|
1629
|
+
const n = r.source.uid, o = e.widgetPropOverrides[n] || {};
|
|
1554
1630
|
return {
|
|
1555
1631
|
...e,
|
|
1556
1632
|
widgetPropOverrides: {
|
|
1557
1633
|
...e.widgetPropOverrides,
|
|
1558
|
-
[n]: { ...o, [
|
|
1634
|
+
[n]: { ...o, [t.prop]: t.value }
|
|
1559
1635
|
}
|
|
1560
1636
|
};
|
|
1561
1637
|
};
|
|
1562
|
-
function
|
|
1563
|
-
return
|
|
1638
|
+
function lo(e, t) {
|
|
1639
|
+
return N(
|
|
1564
1640
|
e,
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1641
|
+
ao(t),
|
|
1642
|
+
fo(t),
|
|
1643
|
+
ho(t),
|
|
1644
|
+
po(t)
|
|
1569
1645
|
);
|
|
1570
1646
|
}
|
|
1571
|
-
const
|
|
1572
|
-
...
|
|
1647
|
+
const ao = (e) => (t) => ({
|
|
1648
|
+
...t,
|
|
1573
1649
|
widgetFlags: {
|
|
1574
|
-
...
|
|
1650
|
+
...Oe(t.widgetFlags, e.payload.uid)
|
|
1575
1651
|
}
|
|
1576
|
-
}),
|
|
1577
|
-
...
|
|
1652
|
+
}), fo = (e) => (t) => ({
|
|
1653
|
+
...t,
|
|
1578
1654
|
// TODO: has this already been removed in calculate-widget-props??? Do we need this at all?
|
|
1579
1655
|
calculatedWidgets: {
|
|
1580
|
-
...
|
|
1656
|
+
...Oe(t.calculatedWidgets, e.payload.uid)
|
|
1581
1657
|
}
|
|
1582
|
-
}),
|
|
1583
|
-
...
|
|
1658
|
+
}), ho = (e) => (t) => ({
|
|
1659
|
+
...t,
|
|
1584
1660
|
widgetPropOverrides: {
|
|
1585
|
-
...
|
|
1661
|
+
...Oe(t.widgetPropOverrides, e.payload.uid)
|
|
1586
1662
|
}
|
|
1587
|
-
}),
|
|
1588
|
-
...
|
|
1589
|
-
touchedControls:
|
|
1590
|
-
const n =
|
|
1591
|
-
return n &&
|
|
1663
|
+
}), po = (e) => (t) => ({
|
|
1664
|
+
...t,
|
|
1665
|
+
touchedControls: N(t.touchedControls, (r) => {
|
|
1666
|
+
const n = t.flatForm[e.payload.uid];
|
|
1667
|
+
return n && I(n) ? Oe(r, n.path) : r;
|
|
1592
1668
|
})
|
|
1593
|
-
}),
|
|
1669
|
+
}), mo = (e, t) => ({
|
|
1594
1670
|
...e,
|
|
1595
|
-
data: { ...
|
|
1596
|
-
}),
|
|
1671
|
+
data: { ...t.payload.data }
|
|
1672
|
+
}), go = (e, t) => ({
|
|
1597
1673
|
...e,
|
|
1598
|
-
formHealth:
|
|
1599
|
-
}),
|
|
1674
|
+
formHealth: t.payload.formHealth
|
|
1675
|
+
}), yo = (e, t) => ({
|
|
1600
1676
|
...e,
|
|
1601
|
-
lang:
|
|
1602
|
-
}),
|
|
1677
|
+
lang: t.payload.lang
|
|
1678
|
+
}), Ao = (e, t) => ({
|
|
1603
1679
|
...e,
|
|
1604
|
-
meta: { ...
|
|
1605
|
-
}),
|
|
1606
|
-
const
|
|
1607
|
-
return
|
|
1680
|
+
meta: { ...t.payload.meta }
|
|
1681
|
+
}), $o = (e, t) => {
|
|
1682
|
+
const r = ue(e.data, t.payload.path);
|
|
1683
|
+
return t.type === "SET_WIDGET_DATA" || t.type === "SET_WIDGET_INITIAL_DATA" && r === void 0 ? {
|
|
1608
1684
|
...e,
|
|
1609
|
-
data: { ...
|
|
1685
|
+
data: { ...ze(e.data, t.payload.path, t.payload.data) }
|
|
1610
1686
|
} : e;
|
|
1611
|
-
}, Te = (e,
|
|
1612
|
-
const n =
|
|
1613
|
-
Object.values(
|
|
1614
|
-
({ current:
|
|
1615
|
-
), o =
|
|
1687
|
+
}, Te = (e, t) => (r) => {
|
|
1688
|
+
const n = Xt(
|
|
1689
|
+
Object.values(r.calculatedWidgets),
|
|
1690
|
+
({ current: s }) => I(s) ? s : it
|
|
1691
|
+
), o = r.validations;
|
|
1616
1692
|
return {
|
|
1617
|
-
...
|
|
1693
|
+
...r,
|
|
1618
1694
|
validations: n.reduce(
|
|
1619
|
-
(
|
|
1620
|
-
if (i
|
|
1621
|
-
const
|
|
1622
|
-
|
|
1695
|
+
(s, i) => {
|
|
1696
|
+
if (s[i.path] = null, i.validator) {
|
|
1697
|
+
const d = e(i.validator, t), c = ue(r.data, i.path), l = sr(
|
|
1698
|
+
d,
|
|
1623
1699
|
c
|
|
1624
1700
|
);
|
|
1625
|
-
i
|
|
1701
|
+
s[i.path] = ir(l) ? null : l.issues.map((m) => m.message);
|
|
1626
1702
|
}
|
|
1627
|
-
return Array.isArray(i
|
|
1628
|
-
i
|
|
1629
|
-
o[
|
|
1630
|
-
(
|
|
1631
|
-
) && (i
|
|
1703
|
+
return Array.isArray(s[i.path]) && Array.isArray(o[i.path]) && kn(
|
|
1704
|
+
s[i.path],
|
|
1705
|
+
o[i.path],
|
|
1706
|
+
(d, c) => d === c
|
|
1707
|
+
) && (s[i.path] = o[i.path]), s;
|
|
1632
1708
|
},
|
|
1633
1709
|
{}
|
|
1634
1710
|
)
|
|
1635
1711
|
};
|
|
1636
|
-
},
|
|
1712
|
+
}, So = ({
|
|
1637
1713
|
validators: e,
|
|
1638
|
-
validateOn:
|
|
1639
|
-
localization:
|
|
1714
|
+
validateOn: t,
|
|
1715
|
+
localization: r
|
|
1640
1716
|
}) => (n, o) => {
|
|
1641
1717
|
switch (o.type) {
|
|
1642
1718
|
case "INITIALIZE":
|
|
1643
|
-
return
|
|
1719
|
+
return ro(n, o);
|
|
1644
1720
|
case "SET_DATA":
|
|
1645
|
-
return
|
|
1646
|
-
|
|
1647
|
-
V,
|
|
1721
|
+
return N(
|
|
1722
|
+
mo(n, o),
|
|
1648
1723
|
R,
|
|
1649
|
-
|
|
1724
|
+
V,
|
|
1725
|
+
_(r)
|
|
1650
1726
|
);
|
|
1651
1727
|
case "SET_META":
|
|
1652
|
-
return
|
|
1653
|
-
|
|
1654
|
-
V,
|
|
1728
|
+
return N(
|
|
1729
|
+
Ao(n, o),
|
|
1655
1730
|
R,
|
|
1656
|
-
|
|
1731
|
+
V,
|
|
1732
|
+
_(r)
|
|
1657
1733
|
);
|
|
1658
1734
|
case "SET_LANGUAGE":
|
|
1659
|
-
return
|
|
1735
|
+
return N(yo(n, o), _(r));
|
|
1660
1736
|
case "ADD_WIDGET":
|
|
1661
|
-
return
|
|
1662
|
-
|
|
1663
|
-
ae(
|
|
1664
|
-
ae(
|
|
1665
|
-
ae(
|
|
1737
|
+
return N(
|
|
1738
|
+
Cr(n, o),
|
|
1739
|
+
ae(je, R),
|
|
1740
|
+
ae(je, V),
|
|
1741
|
+
ae(je, _(r))
|
|
1666
1742
|
);
|
|
1667
1743
|
case "REMOVE_WIDGET":
|
|
1668
|
-
return
|
|
1669
|
-
|
|
1670
|
-
V,
|
|
1744
|
+
return N(
|
|
1745
|
+
lo(n, o),
|
|
1671
1746
|
R,
|
|
1672
|
-
|
|
1747
|
+
V,
|
|
1748
|
+
_(r)
|
|
1673
1749
|
);
|
|
1674
1750
|
case "SET_WIDGET_INITIAL_DATA":
|
|
1675
1751
|
case "SET_WIDGET_DATA":
|
|
1676
|
-
return
|
|
1677
|
-
|
|
1678
|
-
V,
|
|
1752
|
+
return N(
|
|
1753
|
+
$o(n, o),
|
|
1679
1754
|
R,
|
|
1680
|
-
|
|
1755
|
+
V,
|
|
1756
|
+
_(r)
|
|
1681
1757
|
);
|
|
1682
1758
|
case "OVERRIDE_WIDGET_PROP":
|
|
1683
|
-
return
|
|
1684
|
-
|
|
1685
|
-
V,
|
|
1759
|
+
return N(
|
|
1760
|
+
co(n, o),
|
|
1686
1761
|
R,
|
|
1687
|
-
|
|
1762
|
+
V,
|
|
1763
|
+
_(r),
|
|
1688
1764
|
// Apply validation here because this action can be dispatched from the form's event handlers callback
|
|
1689
1765
|
// Apply only when the action is related to an input
|
|
1690
1766
|
ae(
|
|
1691
|
-
(
|
|
1692
|
-
let
|
|
1693
|
-
"path" in o.payload ? (
|
|
1694
|
-
const c =
|
|
1695
|
-
return
|
|
1767
|
+
(s) => {
|
|
1768
|
+
let i = !1, d = "";
|
|
1769
|
+
"path" in o.payload ? (i = !0, d = o.payload.path) : I(s.calculatedWidgets[o.payload.uid].current) && (i = !0, d = s.calculatedWidgets[o.payload.uid].current.path);
|
|
1770
|
+
const c = i && s.touchedControls[d];
|
|
1771
|
+
return s.touched && c;
|
|
1696
1772
|
},
|
|
1697
|
-
Te(e,
|
|
1773
|
+
Te(e, r)
|
|
1698
1774
|
)
|
|
1699
1775
|
);
|
|
1700
1776
|
case "SET_FORM_HEALTH":
|
|
1701
|
-
return
|
|
1777
|
+
return go(n, o);
|
|
1702
1778
|
case "VALIDATE_ALL":
|
|
1703
|
-
return
|
|
1779
|
+
return N(
|
|
1704
1780
|
{
|
|
1705
1781
|
...n,
|
|
1706
1782
|
touched: !0,
|
|
1707
1783
|
touchedControls: Object.keys(n.calculatedWidgets).reduce(
|
|
1708
|
-
(
|
|
1709
|
-
const
|
|
1710
|
-
return
|
|
1784
|
+
(s, i) => {
|
|
1785
|
+
const d = n.calculatedWidgets[i].source;
|
|
1786
|
+
return I(d) && (s[d.path] = !0), s;
|
|
1711
1787
|
},
|
|
1712
1788
|
{}
|
|
1713
1789
|
)
|
|
1714
1790
|
},
|
|
1715
|
-
Te(e,
|
|
1791
|
+
Te(e, r),
|
|
1716
1792
|
// This handles $errors and $formIsValid expressions variables
|
|
1717
|
-
V,
|
|
1718
1793
|
R,
|
|
1719
|
-
|
|
1720
|
-
|
|
1794
|
+
V,
|
|
1795
|
+
_(r),
|
|
1796
|
+
yt
|
|
1721
1797
|
);
|
|
1722
1798
|
case "ATTEMPT_VALIDATION": {
|
|
1723
|
-
const
|
|
1724
|
-
return
|
|
1799
|
+
const s = o.payload.reason, i = o.payload.path;
|
|
1800
|
+
return t === "eager" || s === t || t.includes(s) ? N(
|
|
1725
1801
|
{
|
|
1726
1802
|
...n,
|
|
1727
1803
|
touched: !0,
|
|
1728
|
-
touchedControls: { ...n.touchedControls, [
|
|
1804
|
+
touchedControls: { ...n.touchedControls, [i]: !0 }
|
|
1729
1805
|
},
|
|
1730
|
-
Te(e,
|
|
1806
|
+
Te(e, r),
|
|
1731
1807
|
// This handles $errors and $formIsValid expressions variables
|
|
1732
|
-
V,
|
|
1733
1808
|
R,
|
|
1734
|
-
|
|
1809
|
+
V,
|
|
1810
|
+
_(r),
|
|
1735
1811
|
// TODO: extract this into a separate function
|
|
1736
1812
|
// When the widget is a Widget Function, we propagate the validation result immediately
|
|
1737
1813
|
(c) => {
|
|
1738
|
-
const
|
|
1739
|
-
if (
|
|
1740
|
-
const f =
|
|
1814
|
+
const l = o.payload.uid, m = c.calculatedWidgets[l], p = m.source;
|
|
1815
|
+
if (ie(p)) {
|
|
1816
|
+
const f = p({
|
|
1741
1817
|
$form: c.data,
|
|
1742
|
-
errors: c.validations[
|
|
1818
|
+
errors: c.validations[i],
|
|
1743
1819
|
touched: !0,
|
|
1744
|
-
translate:
|
|
1820
|
+
translate: r.translate
|
|
1745
1821
|
});
|
|
1746
1822
|
return {
|
|
1747
1823
|
...c,
|
|
1748
1824
|
calculatedWidgets: {
|
|
1749
1825
|
...c.calculatedWidgets,
|
|
1750
|
-
[
|
|
1751
|
-
source:
|
|
1826
|
+
[l]: {
|
|
1827
|
+
source: m.source,
|
|
1752
1828
|
current: f
|
|
1753
1829
|
}
|
|
1754
1830
|
}
|
|
@@ -1756,59 +1832,59 @@ const io = (e) => (r) => ({
|
|
|
1756
1832
|
}
|
|
1757
1833
|
return c;
|
|
1758
1834
|
},
|
|
1759
|
-
|
|
1835
|
+
yt
|
|
1760
1836
|
) : n;
|
|
1761
1837
|
}
|
|
1762
1838
|
case "INJECT_VALIDATION_ISSUES":
|
|
1763
|
-
return
|
|
1839
|
+
return uo(n, o);
|
|
1764
1840
|
default:
|
|
1765
|
-
return
|
|
1841
|
+
return Ir(o);
|
|
1766
1842
|
}
|
|
1767
|
-
},
|
|
1768
|
-
function
|
|
1769
|
-
const
|
|
1770
|
-
if (
|
|
1843
|
+
}, je = (e) => e.formHealth.status === "ok";
|
|
1844
|
+
function yt(e) {
|
|
1845
|
+
const t = Object.keys(e.injectedValidations), r = Object.keys(e.validations);
|
|
1846
|
+
if (t.length === 0 && r.length === 0)
|
|
1771
1847
|
return { ...e, isFormValid: !0 };
|
|
1772
|
-
let n =
|
|
1848
|
+
let n = t.find(
|
|
1773
1849
|
(o) => e.injectedValidations[o] !== null && Array.isArray(e.injectedValidations[o])
|
|
1774
1850
|
);
|
|
1775
|
-
return n !== void 0 ? { ...e, isFormValid: !1 } : (n =
|
|
1851
|
+
return n !== void 0 ? { ...e, isFormValid: !1 } : (n = r.find(
|
|
1776
1852
|
(o) => e.validations[o] !== null && Array.isArray(e.validations[o])
|
|
1777
1853
|
), n !== void 0 ? { ...e, isFormValid: !1 } : { ...e, isFormValid: !0 });
|
|
1778
1854
|
}
|
|
1779
|
-
function
|
|
1780
|
-
const o = new
|
|
1781
|
-
function
|
|
1782
|
-
const f = o.getValue(),
|
|
1783
|
-
o.next(
|
|
1855
|
+
function Eo(e = [], t, r, n) {
|
|
1856
|
+
const o = new rr(Ot(n.lang)), s = o.asObservable().pipe(F()), i = So({ validators: t, validateOn: r, localization: n });
|
|
1857
|
+
function d(p) {
|
|
1858
|
+
const f = o.getValue(), D = i(f, p);
|
|
1859
|
+
o.next(D);
|
|
1784
1860
|
}
|
|
1785
|
-
let c =
|
|
1786
|
-
const
|
|
1861
|
+
let c = d;
|
|
1862
|
+
const l = {
|
|
1787
1863
|
getState: () => o.getValue(),
|
|
1788
|
-
dispatch: (
|
|
1864
|
+
dispatch: (p) => c(p)
|
|
1789
1865
|
// reference is updated later
|
|
1790
1866
|
};
|
|
1791
|
-
return c = e.map((
|
|
1792
|
-
state$:
|
|
1867
|
+
return c = e.map((p) => p(l)).reduceRight((p, f) => f(p), d), {
|
|
1868
|
+
state$: s,
|
|
1793
1869
|
dispatch: c,
|
|
1794
1870
|
getState: () => o.getValue()
|
|
1795
1871
|
};
|
|
1796
1872
|
}
|
|
1797
|
-
class
|
|
1873
|
+
class No {
|
|
1798
1874
|
constructor() {
|
|
1799
|
-
this.widgetRegistry = new
|
|
1875
|
+
this.widgetRegistry = new Ne(), this.store = {}, this.events$ = new ct(), this.submit$ = new ct(), this.uuid = crypto.randomUUID(), this.itemRenderers = {}, this.dependencies = {};
|
|
1800
1876
|
}
|
|
1801
|
-
initialize(
|
|
1802
|
-
this.localization =
|
|
1877
|
+
initialize(t, r = [], n, o, s, i = Or(), d) {
|
|
1878
|
+
this.localization = i, this.dependencies = d, this.widgetRegistry.setWidgetLoaders(t), this.itemRenderers = s, this.store = Eo(r, n, o, i);
|
|
1803
1879
|
}
|
|
1804
|
-
emitEvent(
|
|
1805
|
-
const
|
|
1806
|
-
if (
|
|
1807
|
-
|
|
1808
|
-
const
|
|
1809
|
-
this.attemptValidation(
|
|
1810
|
-
name:
|
|
1811
|
-
data:
|
|
1880
|
+
emitEvent(t, r, n) {
|
|
1881
|
+
const s = this.store.getState().currentStates.filter((i) => r.on?.[`${t}.${i}`] !== void 0);
|
|
1882
|
+
if (s.length > 0)
|
|
1883
|
+
s.forEach((i) => {
|
|
1884
|
+
const d = r.on?.[`${t}.${i}`];
|
|
1885
|
+
this.attemptValidation(t, r), d && this.events$.next({
|
|
1886
|
+
name: d,
|
|
1887
|
+
data: De(this.store.getState()),
|
|
1812
1888
|
detail: n ?? void 0,
|
|
1813
1889
|
callback: (c) => {
|
|
1814
1890
|
this.store.dispatch(c);
|
|
@@ -1816,13 +1892,13 @@ class To {
|
|
|
1816
1892
|
});
|
|
1817
1893
|
});
|
|
1818
1894
|
else {
|
|
1819
|
-
const
|
|
1820
|
-
this.attemptValidation(
|
|
1821
|
-
name:
|
|
1822
|
-
data:
|
|
1895
|
+
const i = r.on?.[t];
|
|
1896
|
+
this.attemptValidation(t, r), i && this.events$.next({
|
|
1897
|
+
name: i,
|
|
1898
|
+
data: De(this.store.getState()),
|
|
1823
1899
|
detail: n,
|
|
1824
|
-
callback: (
|
|
1825
|
-
this.store.dispatch(
|
|
1900
|
+
callback: (d) => {
|
|
1901
|
+
this.store.dispatch(d);
|
|
1826
1902
|
}
|
|
1827
1903
|
});
|
|
1828
1904
|
}
|
|
@@ -1831,127 +1907,127 @@ class To {
|
|
|
1831
1907
|
this.store.dispatch({
|
|
1832
1908
|
type: "VALIDATE_ALL"
|
|
1833
1909
|
}), this.store.getState().isFormValid && this.submit$.next({
|
|
1834
|
-
data:
|
|
1835
|
-
callback: (
|
|
1836
|
-
this.store.dispatch(
|
|
1910
|
+
data: De(this.store.getState()),
|
|
1911
|
+
callback: (t) => {
|
|
1912
|
+
this.store.dispatch(t);
|
|
1837
1913
|
}
|
|
1838
1914
|
});
|
|
1839
1915
|
}
|
|
1840
|
-
attemptValidation(
|
|
1841
|
-
|
|
1916
|
+
attemptValidation(t, r) {
|
|
1917
|
+
r.kind !== "layout" && (t === "change" ? this.store.dispatch({
|
|
1842
1918
|
type: "ATTEMPT_VALIDATION",
|
|
1843
1919
|
payload: {
|
|
1844
1920
|
reason: "change",
|
|
1845
|
-
path:
|
|
1846
|
-
uid:
|
|
1921
|
+
path: r.path,
|
|
1922
|
+
uid: r.uid
|
|
1847
1923
|
}
|
|
1848
|
-
}) :
|
|
1924
|
+
}) : t === "click" && r.kind === "action" && r.actionType === "submit" && this.store.dispatch({
|
|
1849
1925
|
type: "VALIDATE_ALL"
|
|
1850
1926
|
}));
|
|
1851
1927
|
}
|
|
1852
1928
|
}
|
|
1853
|
-
function
|
|
1854
|
-
return (
|
|
1929
|
+
function _o(e = "GolemUI Form Store") {
|
|
1930
|
+
return (t) => {
|
|
1855
1931
|
const n = (typeof window < "u" ? window.__REDUX_DEVTOOLS_EXTENSION__ : void 0)?.connect({ name: e });
|
|
1856
|
-
return n?.init(
|
|
1857
|
-
o(
|
|
1932
|
+
return n?.init(t.getState()), (o) => (s) => {
|
|
1933
|
+
o(s), n && n.send(s, t.getState());
|
|
1858
1934
|
};
|
|
1859
1935
|
};
|
|
1860
1936
|
}
|
|
1861
|
-
const
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
),
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
),
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
),
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
),
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
),
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1937
|
+
const vo = j(
|
|
1938
|
+
k((e) => e.data),
|
|
1939
|
+
F()
|
|
1940
|
+
), Lo = (e) => j(
|
|
1941
|
+
vo,
|
|
1942
|
+
k((t) => ue(t, e)),
|
|
1943
|
+
F()
|
|
1944
|
+
), wo = j(
|
|
1945
|
+
Se((e) => e.touched === !0),
|
|
1946
|
+
k((e) => e.validations),
|
|
1947
|
+
F()
|
|
1948
|
+
), Ro = (e) => j(
|
|
1949
|
+
wo,
|
|
1950
|
+
k((t) => t[e]),
|
|
1951
|
+
F()
|
|
1952
|
+
), Oo = j(
|
|
1953
|
+
Se((e) => e.touched === !0),
|
|
1954
|
+
k((e) => e.injectedValidations),
|
|
1955
|
+
F()
|
|
1956
|
+
), Vo = (e) => j(
|
|
1957
|
+
Oo,
|
|
1958
|
+
k((t) => t[e]),
|
|
1959
|
+
F(),
|
|
1884
1960
|
// we want to make sure combineLatest([validation$, injectedValidation$]) triggers
|
|
1885
|
-
|
|
1886
|
-
),
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
),
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
),
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
),
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1961
|
+
or(null)
|
|
1962
|
+
), Io = j(
|
|
1963
|
+
k((e) => e.lang),
|
|
1964
|
+
F()
|
|
1965
|
+
), er = j(
|
|
1966
|
+
k((e) => e.calculatedWidgets),
|
|
1967
|
+
F()
|
|
1968
|
+
), Uo = (e) => (t) => nr([t.pipe(Io), t.pipe(er)]).pipe(
|
|
1969
|
+
k(([r, n]) => ({ lang: r, widget: n[e] })),
|
|
1970
|
+
Se((r) => r.widget !== void 0),
|
|
1971
|
+
F((r, n) => r.lang === n.lang && r.widget === n.widget),
|
|
1972
|
+
k((r) => r.widget.current)
|
|
1973
|
+
), Mo = (e) => j(
|
|
1974
|
+
er,
|
|
1975
|
+
k((t) => t[e]),
|
|
1976
|
+
Se((t) => t !== void 0),
|
|
1977
|
+
k((t) => t.current.children),
|
|
1978
|
+
F()
|
|
1903
1979
|
);
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1980
|
+
j(
|
|
1981
|
+
k((e) => e.widgetFlags),
|
|
1982
|
+
F()
|
|
1907
1983
|
);
|
|
1908
|
-
const
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
),
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
),
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
),
|
|
1919
|
-
let
|
|
1920
|
-
function
|
|
1921
|
-
|
|
1922
|
-
}
|
|
1923
|
-
function
|
|
1924
|
-
return
|
|
1925
|
-
}
|
|
1926
|
-
function
|
|
1927
|
-
if (!
|
|
1984
|
+
const Co = j(
|
|
1985
|
+
k((e) => e.touchedControls),
|
|
1986
|
+
F()
|
|
1987
|
+
), Ho = (e) => j(
|
|
1988
|
+
Co,
|
|
1989
|
+
k((t) => t[e]),
|
|
1990
|
+
F()
|
|
1991
|
+
), Do = j(
|
|
1992
|
+
k((e) => e.formHealth),
|
|
1993
|
+
F((e, t) => e.status !== t.status ? !1 : e.status === "errored" && t.status === "errored" ? e.message === t.message && e.code === t.code : !0)
|
|
1994
|
+
), Go = (e) => e.pipe(Do);
|
|
1995
|
+
let tr = !1;
|
|
1996
|
+
function Bo() {
|
|
1997
|
+
tr = !0;
|
|
1998
|
+
}
|
|
1999
|
+
function ko() {
|
|
2000
|
+
return tr;
|
|
2001
|
+
}
|
|
2002
|
+
function Ko(e, t, r) {
|
|
2003
|
+
if (!ko())
|
|
1928
2004
|
return;
|
|
1929
|
-
const n = Object.keys(
|
|
2005
|
+
const n = Object.keys(t ?? {}).filter((o) => o in r);
|
|
1930
2006
|
if (n.length > 0)
|
|
1931
2007
|
throw new Error(
|
|
1932
2008
|
`[GolemUI] Widget "${e}": prop keys [${n.join(", ")}] collide with widget fields`
|
|
1933
2009
|
);
|
|
1934
2010
|
}
|
|
1935
2011
|
export {
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
2012
|
+
No as FormContext,
|
|
2013
|
+
Ko as assertNoPropCollisions,
|
|
2014
|
+
Mo as calculatedLayoutChildrenByUid$,
|
|
2015
|
+
Uo as calculatedWidgetsByUid$,
|
|
2016
|
+
_e as cloneObject,
|
|
2017
|
+
Lo as dataByPath$,
|
|
2018
|
+
jo as defineForm,
|
|
2019
|
+
_o as devToolsMiddleware,
|
|
2020
|
+
Bo as enableDevMode,
|
|
2021
|
+
q as errorCodes,
|
|
2022
|
+
Po as filterTap,
|
|
2023
|
+
Go as formHealth,
|
|
2024
|
+
Wo as getDirectionFromLanguage,
|
|
2025
|
+
Or as identityTranslator,
|
|
2026
|
+
Vo as injectedValidationByPath$,
|
|
2027
|
+
ir as isStandardValidateSuccess,
|
|
2028
|
+
Fn as makeRepeaterItemConfig,
|
|
2029
|
+
Et as shortUUID,
|
|
2030
|
+
sr as standardValidate,
|
|
2031
|
+
Ho as touchedControlsByPath$,
|
|
2032
|
+
Ro as validationByPath$
|
|
1957
2033
|
};
|