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