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