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

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