@golemui/core 0.14.0 → 0.15.0

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