@golemui/core 1.0.0-rc.1 → 1.0.0-rc.3

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