@dynamicforms/vue-forms 2.0.2 → 3.0.0-alpha.1

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.
@@ -1,79 +1,135 @@
1
- import { createTranslatable as e, interpolate as t } from "@dynamicforms/translatable";
2
- import { computed as n, createBlock as r, defineComponent as i, h as a, isRef as o, openBlock as s, reactive as c, ref as l, resolveComponent as u, toRef as d, unref as f, watch as p } from "vue";
3
- import { isArray as m, isEmpty as h, isEqual as g, isEqualWith as ee, isObject as te, isPlainObject as ne, isString as _, truncate as re } from "lodash-es";
1
+ import { c as e, f as t, h as n, i as r, l as i, m as a, p as o, s, u as c } from "./chunks/registry-_vVZW3p9.js";
2
+ import { computed as l, reactive as ee, ref as u, shallowRef as te, toRaw as d, unref as f, watch as p } from "vue";
3
+ import { isArray as ne, isEmpty as re, isEqual as m, isEqualWith as ie, isObject as ae, isPlainObject as oe, isString as h, truncate as se } from "lodash-es";
4
4
  //#region \0rolldown/runtime.js
5
- var ie = Object.defineProperty, ae = (e, t) => {
5
+ var ce = Object.defineProperty, le = (e, t) => {
6
6
  let n = {};
7
- for (var r in e) ie(n, r, {
7
+ for (var r in e) ce(n, r, {
8
8
  get: e[r],
9
9
  enumerable: !0
10
10
  });
11
- return t || ie(n, Symbol.toStringTag, { value: "Module" }), n;
12
- }, v = Object.freeze([
11
+ return t || ce(n, Symbol.toStringTag, { value: "Module" }), n;
12
+ }, g = Object.freeze([
13
13
  "editable",
14
14
  "readonly",
15
15
  "disabled",
16
16
  "disabled-null"
17
- ]), oe = "editable";
18
- function se(e) {
19
- return v.includes(e);
17
+ ]), ue = "editable";
18
+ function de(e) {
19
+ return g.includes(e);
20
20
  }
21
21
  //#endregion
22
22
  //#region src/visibility.ts
23
- var y = Object.freeze([
23
+ var _ = Object.freeze([
24
24
  "full",
25
25
  "invisible",
26
26
  "hidden",
27
27
  "suppress"
28
- ]), b = "full";
29
- function x(e) {
30
- return y.includes(e);
28
+ ]), fe = "full";
29
+ function pe(e) {
30
+ return _.includes(e);
31
31
  }
32
32
  //#endregion
33
- //#region src/actions/field-action-base.ts
34
- var S = class {
35
- static get classIdentifier() {
36
- throw Error("classIdentifier must be declared");
37
- }
38
- get classIdentifier() {
39
- return this.constructor.classIdentifier;
40
- }
41
- executorFn;
42
- states = /* @__PURE__ */ new WeakMap();
43
- constructor(e) {
44
- this.executorFn = e;
45
- }
46
- state(e, t) {
47
- return this.states.has(e) || this.states.set(e, t()), this.states.get(e);
48
- }
49
- execute(e, t, ...n) {
50
- return this.executorFn(e, t, ...n);
51
- }
52
- get eager() {
53
- return !1;
54
- }
55
- boundToBinding(e) {}
56
- unregisterFrom(e) {}
57
- }, C = class extends Error {}, w = Symbol("ValueChangedAction"), T = class extends S {
58
- constructor(e) {
59
- super(e);
33
+ //#region src/plugins/devtools/api.ts
34
+ var me = !0, he = !0, ge, _e = !1;
35
+ function ve(t) {
36
+ _e ? import("./chunks/plugin-uXEQYne6.js").then((e) => e.installFor(t)) : (_e = !0, import("./chunks/plugin-uXEQYne6.js").then((t) => {
37
+ t.install(), e().forEach(({ element: e }) => t.installFor(e));
38
+ }));
39
+ }
40
+ var ye = {
41
+ setup(e) {
42
+ n(e);
43
+ },
44
+ onElementCreated(e, t) {
45
+ t || (c(e, he), ve(e));
46
+ },
47
+ onElementAdopted(e) {
48
+ s(e);
49
+ },
50
+ onCommit() {
51
+ i();
60
52
  }
61
- static get classIdentifier() {
62
- return w;
53
+ };
54
+ function be() {
55
+ process.env.NODE_ENV !== "production" && me && !ge && (ge = Pe(ye));
56
+ }
57
+ function xe(e, t) {
58
+ process.env.NODE_ENV !== "production" && r(e, t);
59
+ }
60
+ function Se(e, t = !0) {
61
+ process.env.NODE_ENV !== "production" && o(e, t);
62
+ }
63
+ function Ce(e) {
64
+ process.env.NODE_ENV !== "production" && (e.location !== void 0 && (he = e.location), e.registration !== void 0 && a(e.registration), e.enabled !== void 0 && (me = e.enabled, me || (ge?.(), ge = void 0), t(me)));
65
+ }
66
+ //#endregion
67
+ //#region src/plugins.ts
68
+ var we = Symbol("Field.changeInPlace"), v = [], Te = [], Ee = [], De = [], Oe = [], ke = [], Ae = /* @__PURE__ */ new WeakSet(), je = 0, Me = {
69
+ changeInPlace(e, t, n, r) {
70
+ let i = e[we];
71
+ if (typeof i != "function") throw TypeError("changeInPlace: the element is not a Field");
72
+ i.call(e, t, n, r);
73
+ },
74
+ isInternal(e) {
75
+ return e.declaration !== e || Ae.has(e);
63
76
  }
64
- execute(e, t, n, r) {
65
- return super.execute(e, t, n, r);
77
+ };
78
+ function Ne() {
79
+ Te = v.filter((e) => e.onSetValue), Ee = v.filter((e) => e.onSetOriginalValue), De = v.filter((e) => e.onElementCreated), Oe = v.filter((e) => e.onElementAdopted), ke = v.filter((e) => e.onCommit);
80
+ }
81
+ function Pe(e) {
82
+ return v.push(e), Ne(), e.setup?.(Me), () => {
83
+ let t = v.indexOf(e);
84
+ t < 0 || (v.splice(t, 1), Ne());
85
+ };
86
+ }
87
+ function Fe(e, t) {
88
+ let n = t;
89
+ for (let t of Te) n = t.onSetValue(n, e);
90
+ return n;
91
+ }
92
+ function Ie(e, t) {
93
+ let n = t;
94
+ for (let t of Ee) n = t.onSetOriginalValue(n, e);
95
+ return n;
96
+ }
97
+ function Le(e) {
98
+ je++;
99
+ try {
100
+ return e();
101
+ } finally {
102
+ je--;
66
103
  }
67
- }, E = Symbol("Transaction.capture"), ce = Symbol("FieldBase.sentNowhere"), le = Symbol("Transaction.restore"), ue = Symbol("Transaction.announceValue"), de = Symbol("Transaction.settleValidity");
68
- function D(e) {
104
+ }
105
+ function Re(e) {
106
+ Ae.add(e);
107
+ }
108
+ function ze(e) {
109
+ process.env.NODE_ENV !== "production" && be();
110
+ let t = je > 0;
111
+ for (let n of De) n.onElementCreated(e, t);
112
+ }
113
+ function Be(e, t) {
114
+ Oe.length !== 0 && e.whenCommitted(() => {
115
+ for (let e of Oe) e.onElementAdopted(t);
116
+ });
117
+ }
118
+ function Ve() {
119
+ for (let e of ke) e.onCommit();
120
+ }
121
+ //#endregion
122
+ //#region src/transaction.ts
123
+ var y = Symbol("Transaction.capture"), He = Symbol("FieldBase.sentNowhere"), Ue = Symbol("Transaction.restore"), We = Symbol("Transaction.announceValue"), Ge = Symbol("Transaction.settleValidity"), Ke = Symbol("Transaction.announceFlags");
124
+ function b(e) {
69
125
  return e;
70
126
  }
71
- function fe(e) {
127
+ function qe(e) {
72
128
  let t = 0, n = e.parent;
73
129
  for (; n;) t++, n = n.parent;
74
130
  return t;
75
131
  }
76
- var pe = class {
132
+ var Je = class {
77
133
  participants = /* @__PURE__ */ new Map();
78
134
  undo = [];
79
135
  settled = [];
@@ -89,17 +145,21 @@ var pe = class {
89
145
  element: e,
90
146
  valueDirty: !1,
91
147
  forceValue: !1,
92
- validityDirty: !1
148
+ validityDirty: !1,
149
+ flagsDirty: !1
93
150
  }, this.participants.set(e, t)), t;
94
151
  }
95
152
  touch(e) {
96
153
  let t = this.participant(e);
97
- t.snapshot ||= D(e)[E]();
154
+ t.snapshot ||= b(e)[y]();
98
155
  }
99
156
  markValueChanged(e, t) {
100
157
  let n = this.participant(e);
101
158
  n.valueDirty = !0, t && (n.forceValue = !0), this.noteDepth(e);
102
159
  }
160
+ markFlagsDirty(e) {
161
+ this.participant(e).flagsDirty = !0, this.noteDepth(e);
162
+ }
103
163
  markValidityDirty(e) {
104
164
  this.participant(e).validityDirty = !0, this.noteDepth(e);
105
165
  }
@@ -117,25 +177,25 @@ var pe = class {
117
177
  this.settled.push(e);
118
178
  }
119
179
  noteDepth(e) {
120
- this.passDepth < 0 || fe(e) >= this.passDepth && (this.restartPass = !0);
180
+ this.passDepth < 0 || qe(e) >= this.passDepth && (this.restartPass = !0);
121
181
  }
122
182
  rollback() {
123
183
  this.unwound = !0, [...this.participants.values()].reverse().forEach((e) => {
124
- e.snapshot && D(e.element)[le](e.snapshot);
184
+ e.snapshot && b(e.element)[Ue](e.snapshot);
125
185
  }), this.participants.clear();
126
186
  for (let e = this.undo.length - 1; e >= 0; e--) this.undo[e]();
127
187
  this.undo.length = 0, this.settled.length = 0;
128
188
  }
129
189
  commit() {
130
- for (; !(!this.announceValues() && !this.settleValidity()););
190
+ for (; !(!this.announceFlags() && !this.announceValues() && !this.settleValidity()););
131
191
  for (let e = 0; e < this.settled.length; e++) this.settled[e]();
132
- this.settled.length = 0;
192
+ this.settled.length = 0, Ve();
133
193
  }
134
194
  buckets(e) {
135
195
  let t = [];
136
196
  return this.participants.forEach((n) => {
137
197
  if (!e(n)) return;
138
- let r = fe(n.element);
198
+ let r = qe(n.element);
139
199
  (t[r] ??= []).push(n);
140
200
  }), t;
141
201
  }
@@ -163,199 +223,263 @@ var pe = class {
163
223
  announceValues() {
164
224
  return this.pass((e) => e.valueDirty || e.structural !== void 0, (e) => {
165
225
  let { structural: t } = e, n = e.valueDirty, r = e.forceValue;
166
- e.structural = void 0, e.valueDirty = !1, e.forceValue = !1, D(e.element)[ue](this, n, r, t);
226
+ e.structural = void 0, e.valueDirty = !1, e.forceValue = !1, b(e.element)[We](this, n, r, t);
227
+ });
228
+ }
229
+ announceFlags() {
230
+ return this.pass((e) => e.flagsDirty, (e) => {
231
+ e.flagsDirty = !1, b(e.element)[Ke]();
167
232
  });
168
233
  }
169
234
  settleValidity() {
170
235
  return this.pass((e) => e.validityDirty, (e) => {
171
- e.validityDirty = !1, D(e.element)[de](this);
236
+ e.validityDirty = !1, b(e.element)[Ge](this);
172
237
  });
173
238
  }
174
- }, O, me;
175
- function he() {
176
- return O;
239
+ }, x, Ye;
240
+ function S() {
241
+ return x;
177
242
  }
178
- var ge = class {}, _e = class {
243
+ var Xe = class {}, Ze = class {
179
244
  open = !0;
245
+ rollbackRequested = !1;
180
246
  rollback() {
181
- throw this.open ? new ge() : TypeError("this transaction handle is spent: the transaction that handed it out has closed. A handle is only usable inside the call that received it.");
247
+ throw this.open ? (this.rollbackRequested = !0, new Xe()) : TypeError("this transaction handle is spent: the transaction that handed it out has closed. A handle is only usable inside the call that received it.");
182
248
  }
183
249
  close() {
184
250
  this.open = !1;
185
251
  }
186
252
  };
187
- function ve(e) {
253
+ function Qe(e) {
188
254
  if (e != null && typeof e.then == "function") throw TypeError("a transaction may not be asynchronous: the callback returned a thenable. Do the awaiting outside and open a transaction for each synchronous part.");
189
255
  }
190
- function k(e) {
191
- if (O) {
192
- let t = e(me);
193
- return ve(t), t;
256
+ function C(e) {
257
+ if (x) {
258
+ let t = e(Ye);
259
+ return Qe(t), t;
194
260
  }
195
- let t = new pe(), n = new _e();
196
- O = t, me = n;
261
+ let t = new Je(), n = new Ze();
262
+ x = t, Ye = n;
197
263
  try {
198
264
  let r = e(n);
199
- return ve(r), t.commit(), r;
265
+ if (Qe(r), n.rollbackRequested) throw new Xe();
266
+ return t.commit(), r;
200
267
  } catch (e) {
201
- if (t.rollback(), e instanceof ge) return;
268
+ if (t.rollback(), e instanceof Xe) return;
202
269
  throw e;
203
270
  } finally {
204
- O = void 0, me = void 0, n.close();
271
+ x = void 0, Ye = void 0, n.close();
205
272
  }
206
273
  }
207
- function A(e) {
208
- return O ? e(O) : k(() => e(O));
274
+ function w(e) {
275
+ return x ? e(x) : C(() => e(x));
209
276
  }
210
277
  //#endregion
211
- //#region src/config.ts
212
- var ye = { useMarkdownInValidators: !0 };
213
- function be() {
214
- return ye;
215
- }
216
- function xe(e) {
217
- Object.assign(ye, e);
218
- }
219
- var Se = { install(e, t) {
220
- t && xe(t);
221
- } }, j = class extends String {
222
- plugins;
223
- options;
224
- constructor(e, t, n) {
225
- super(e), this.plugins = n, this.options = t;
226
- }
227
- };
228
- function M(e) {
229
- let t = f(e);
230
- return typeof t == "object" && !!t && "componentName" in t;
231
- }
232
- function N(e) {
233
- return typeof f(e) == "function";
234
- }
235
- var P = class {
236
- code;
237
- statedOrigin;
238
- constructor(e, t) {
239
- this.code = e, this.statedOrigin = t;
278
+ //#region src/actions/field-action-base.ts
279
+ var $e = Symbol("FieldActionBase.outermost"), T = class {
280
+ static get classIdentifier() {
281
+ throw Error("classIdentifier must be declared");
240
282
  }
241
- get origin() {
242
- return this.statedOrigin === void 0 ? typeof this.source == "symbol" ? "validator" : "application" : this.statedOrigin;
283
+ get classIdentifier() {
284
+ return this.constructor.classIdentifier;
243
285
  }
244
- sameAs(e) {
245
- return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.statedOrigin === e.statedOrigin && this.componentName === e.componentName && g(this.componentBody, e.componentBody) && g(this.componentBindings, e.componentBindings) && g(this.extraClasses, e.extraClasses);
286
+ executorFn;
287
+ states = /* @__PURE__ */ new WeakMap();
288
+ constructor(e) {
289
+ this.executorFn = e;
246
290
  }
247
- get componentName() {
248
- return "Comment";
291
+ state(e, t) {
292
+ return this.states.has(e) || this.states.set(e, t()), this.states.get(e);
249
293
  }
250
- get componentBindings() {
251
- return {};
294
+ forgetState(e) {
295
+ if (!this.states.has(e)) return;
296
+ let t = this.states.get(e);
297
+ this.states.delete(e), S()?.whenRolledBack(() => this.states.set(e, t));
252
298
  }
253
- get componentBody() {
254
- return "";
299
+ execute(e, t, ...n) {
300
+ return this.executorFn(e, t, ...n);
255
301
  }
256
- get extraClasses() {
257
- return "";
302
+ get eager() {
303
+ return !1;
258
304
  }
259
- }, Ce = class extends P {
260
- text;
261
- classes;
262
- constructor(e, t = "", n, r) {
263
- super(n, r), this.text = e, this.classes = t;
305
+ boundToBinding(e) {}
306
+ unregisterFrom(e) {}
307
+ resetBinding(e) {}
308
+ }, E = class extends Error {}, D = Symbol("FieldBase.noErrorsBaseline"), et = Symbol("FieldBase.changedSinceErrors"), tt = Object.freeze({});
309
+ function nt() {
310
+ return {
311
+ originalValue: void 0,
312
+ announcedValue: void 0,
313
+ announcedContribution: void 0,
314
+ announcedAccess: void 0,
315
+ announcedVisibility: void 0,
316
+ validatedValue: void 0,
317
+ errors: [],
318
+ visibility: fe,
319
+ access: ue,
320
+ valueVersion: 0,
321
+ validatingCount: 0,
322
+ validatingChildren: 0,
323
+ parent: void 0,
324
+ fieldName: void 0,
325
+ validationEpoch: 0,
326
+ declaration: void 0,
327
+ extra: tt,
328
+ valid: !0,
329
+ invalidChildren: 0,
330
+ errorsBaseline: D
331
+ };
332
+ }
333
+ function rt() {
334
+ return {
335
+ ...nt(),
336
+ value: void 0,
337
+ touched: !1
338
+ };
339
+ }
340
+ function it() {
341
+ return {
342
+ ...nt(),
343
+ announcedValue: null,
344
+ cachedValue: null,
345
+ cachedValueVersion: -1
346
+ };
347
+ }
348
+ function at() {
349
+ return {
350
+ ...it(),
351
+ fieldNames: []
352
+ };
353
+ }
354
+ function ot() {
355
+ return {
356
+ ...it(),
357
+ rows: null,
358
+ rowsVersion: 0,
359
+ cachedItems: null,
360
+ cachedItemsVersion: -1
361
+ };
362
+ }
363
+ var st = Symbol("Action.executeHandlers"), ct = Symbol("List.reorderRows"), lt = Symbol("FieldBase.beginValidating"), ut = Symbol("FieldBase.validationEpoch"), dt = Symbol("FieldBase.errorPoliciesChanged"), ft = Symbol("FieldBase.removeErrorsOnSubmit"), pt = Object.freeze([
364
+ "change",
365
+ "edit",
366
+ "submit",
367
+ "never"
368
+ ]), mt = Symbol("ErrorPolicy"), ht = Object.freeze({
369
+ validEffect: !0,
370
+ removeOn: "never"
371
+ }), O = Object.freeze({ server: Object.freeze({
372
+ validEffect: !0,
373
+ removeOn: "edit"
374
+ }) }), gt = te(0), _t = 0;
375
+ function vt() {
376
+ return _t > 0;
377
+ }
378
+ function yt() {
379
+ gt.value;
380
+ }
381
+ var k = (e) => typeof e == "string" ? `'${e}'` : String(e);
382
+ function bt(e) {
383
+ if (typeof e != "object" || !e) throw TypeError(`${k(e)} is not an object of rules keyed by origin`);
384
+ Object.entries(e).forEach(([e, t]) => {
385
+ if (e === "validator") throw TypeError("'validator' has no rule: a validator replaces its own errors and they always count");
386
+ if (typeof t != "object" || !t) throw TypeError(`The rule for ${k(e)} is not an object of validEffect and removeOn`);
387
+ if (typeof t.validEffect != "boolean") throw TypeError(`validEffect for ${k(e)} is ${k(t.validEffect)}, not a boolean`);
388
+ if (!pt.includes(t.removeOn)) throw TypeError(`removeOn for ${k(e)} is ${k(t.removeOn)}, not one of ` + pt.map(k).join(", "));
389
+ if (t.validEffect && t.removeOn === "submit") throw TypeError(`The rule for ${k(e)} combines validEffect: true with removeOn: 'submit': an error that makes the target invalid refuses the submit that would remove it`);
390
+ });
391
+ }
392
+ function xt(e) {
393
+ let t = Object.create(null);
394
+ return Object.entries(e).forEach(([e, n]) => {
395
+ t[e] = Object.freeze({
396
+ validEffect: n.validEffect,
397
+ removeOn: n.removeOn
398
+ });
399
+ }), Object.freeze(t);
400
+ }
401
+ function St(e) {
402
+ bt(e);
403
+ let t = O;
404
+ return O = Object.freeze({
405
+ ...O,
406
+ ...xt(e)
407
+ }), gt.value++, () => {
408
+ O = t, gt.value++;
409
+ };
410
+ }
411
+ function Ct(e) {
412
+ return O[e] ?? ht;
413
+ }
414
+ var A = class extends T {
415
+ policies;
416
+ constructor(e) {
417
+ bt(e), super((e, t, ...n) => t(e, ...n)), this.policies = xt(e);
264
418
  }
265
- get componentName() {
266
- return "template";
419
+ static get classIdentifier() {
420
+ return mt;
267
421
  }
268
- get componentBody() {
269
- return this.text;
422
+ boundToBinding(e) {
423
+ _t++, this.rulesChanged(e);
270
424
  }
271
- get extraClasses() {
272
- return this.classes;
425
+ unregisterFrom(e) {
426
+ _t--, this.rulesChanged(e);
273
427
  }
274
- }, F = class extends P {
275
- classes;
276
- text;
277
- textType;
278
- constructor(e, t = "", r, i) {
279
- super(r, i), this.classes = t, this.text = e, this.textType = n(() => this.getTextType);
428
+ rulesChanged(e) {
429
+ gt.value++, w(() => e[dt]());
280
430
  }
281
- get resolvedText() {
282
- let e = f(this.text);
283
- return N(e) ? e() : e;
431
+ };
432
+ function wt(e, t) {
433
+ return e.policies[t];
434
+ }
435
+ function Tt(e, t) {
436
+ if (!(e instanceof A)) return;
437
+ let n = Object.keys(e.policies);
438
+ t.forEach((t) => {
439
+ if (t === e || !(t instanceof A)) return;
440
+ let r = n.find((e) => wt(t, e) !== void 0);
441
+ if (r !== void 0) throw TypeError(`An ErrorPolicy for ${k(r)} is already registered on this element`);
442
+ });
443
+ }
444
+ //#endregion
445
+ //#region src/actions/value-changed-action.ts
446
+ var Et = Symbol("ValueChangedAction"), j = class extends T {
447
+ constructor(e) {
448
+ super(e);
284
449
  }
285
- get getTextType() {
286
- let e = this.resolvedText;
287
- return e ? e instanceof j ? "md" : M(e) ? "component" : "string" : "string";
450
+ static get classIdentifier() {
451
+ return Et;
288
452
  }
289
- get componentName() {
290
- switch (f(this.textType)) {
291
- case "string": return "template";
292
- case "md": return "vue-markdown";
293
- case "component": return this.resolvedText.componentName;
294
- default: return "template";
295
- }
453
+ execute(e, t, n, r) {
454
+ return super.execute(e, t, n, r);
296
455
  }
297
- get componentBindings() {
298
- switch (f(this.textType)) {
299
- case "string": return {};
300
- case "md": {
301
- let e = this.resolvedText;
302
- return {
303
- source: e.toString(),
304
- options: e.options,
305
- plugins: e.plugins
306
- };
307
- }
308
- case "component": return this.resolvedText.componentProps || {};
309
- default: return {};
310
- }
456
+ }, Dt = class {
457
+ code;
458
+ params;
459
+ detail;
460
+ statedOrigin;
461
+ constructor(e, t, n, r) {
462
+ this.code = e, this.params = t, this.detail = n, this.statedOrigin = r;
311
463
  }
312
- get componentBody() {
313
- switch (f(this.textType)) {
314
- case "string": return this.resolvedText;
315
- case "component": return this.resolvedText.componentVHtml || "";
316
- default: return "";
317
- }
464
+ get origin() {
465
+ return this.statedOrigin === void 0 ? typeof this.source == "symbol" ? "validator" : "application" : this.statedOrigin;
318
466
  }
319
- get extraClasses() {
320
- return this.classes;
467
+ sameAs(e) {
468
+ return Object.getPrototypeOf(this) === Object.getPrototypeOf(e) && this.code === e.code && this.detail === e.detail && this.statedOrigin === e.statedOrigin && m(this.params, e.params);
321
469
  }
322
- }, we = class extends F {};
323
- //#endregion
324
- //#region src/validators/error-message-builder.ts
325
- function Te(e) {
326
- return be().useMarkdownInValidators ? new j(e) : e.replace(/[*_~`]/g, "").replace(/!\[(.*?)\]\(.*?\)/g, "$1").replace(/\[(.*?)\]\((.*?)\)/g, "$1").replace(/#+\s?/g, "").replace(/>\s?/g, "").replace(/(\*|-|\d+\.)\s+/g, "").replace(/`{3}[\s\S]*?`{3}/g, "").replace(/`([^`]+)`/g, "$1").replace(/\n{2,}/g, "\n");
327
- }
328
- function I(e) {
329
- return o(e) ? n(() => Te(e.value)) : Te(e);
330
- }
331
- //#endregion
332
- //#region src/validators/translations.ts
333
- var { strings: Ee, translateStrings: De } = e({
334
- Required: "Please enter a value",
335
- MinValue: "Value must be larger or equal to **{minValue}**",
336
- MaxValue: "Value must be less than or equal to **{maxValue}**",
337
- ValueInRange: "Value must be between **{minValue}** and **{maxValue}**",
338
- MinLength: "Length must be larger or equal to **{minLength}**",
339
- MaxLength: "Length must be less than or equal to **{maxLength}**",
340
- LengthInRange: "Length must be between **{minLength}** and **{maxLength}**",
341
- Pattern: "Value must match pattern \"**{pattern}**\"",
342
- InAllowedValues: "Must be one of [**{allowedAsText}**]",
343
- ValidationFailed: "Validation could not be completed"
344
- });
345
- function L(e) {
346
- return I(d(Ee, e));
470
+ }, Ot = Symbol("Validator");
471
+ function kt(e, t) {
472
+ return e.replace(/\{(\w+)\}/g, (e, n) => Object.hasOwn(t, n) ? String(t[n]) : e);
347
473
  }
348
- //#endregion
349
- //#region src/validators/validator.ts
350
- var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extends T {
474
+ var M = class extends j {
351
475
  source;
352
476
  constructor(e) {
353
477
  super((t, n, r, i) => {
354
- let a = this.bindingState(t), o = a.abandon, s = ++a.run, c = t.validationEpoch, l = he(), u = !1, d = () => !u && a.run === s && t.validationEpoch === c && !l?.rolledBack, f = new AbortController(), p = () => {
355
- d() || (u = !0, a.abandon === p && (a.abandon = void 0), f.abort());
478
+ let a = this.bindingState(t), o = a.abandon, s = ++a.run, c = t[ut], l = S(), ee = !1, u = () => !ee && a.run === s && t[ut] === c && !l?.rolledBack, te = new AbortController(), d = () => {
479
+ u() || (ee = !0, a.abandon === d && (a.abandon = void 0), te.abort());
356
480
  };
357
481
  o?.();
358
- let m = t[ce]() ? [] : e(r, i, t, f.signal) || [], h = (e) => k(() => {
482
+ let f = t[He]() ? [] : e(r, i, t, te.signal) || [], p = (e) => C(() => {
359
483
  let n = e?.map((e) => this.claim(e)) ?? [];
360
484
  for (let e = t.errors.length - 1; e >= 0; e--) {
361
485
  let r = t.errors[e];
@@ -366,13 +490,18 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
366
490
  }
367
491
  n.length > 0 && t.errors.push(...n), t.validate();
368
492
  });
369
- return m instanceof Promise ? (a.abandon = p, l?.whenRolledBack(p), t.beginValidating(), m.then((e) => {
370
- d() && h(e);
371
- }, (e) => {
372
- d() && (h([new F(ke(), "", "validation-failed")]), console.error("Validation failed", e));
373
- }).finally(() => {
374
- a.abandon === p && (a.abandon = void 0), t.endValidating();
375
- }).catch((e) => console.error("Validation failed", e))) : h(m), n(t, r, i);
493
+ if (f instanceof Promise) {
494
+ a.abandon = d, l?.whenRolledBack(d);
495
+ let e = t[lt]();
496
+ f.then((e) => {
497
+ u() && p(e);
498
+ }, (e) => {
499
+ u() && (p([new Dt("validation_failed", {}, "Validation could not be completed")]), console.error("Validation failed", e));
500
+ }).finally(() => {
501
+ a.abandon === d && (a.abandon = void 0), e();
502
+ }).catch((e) => console.error("Validation failed", e));
503
+ } else p(f);
504
+ return n(t, r, i);
376
505
  }), this.source = Symbol(this.constructor.name);
377
506
  }
378
507
  claim(e) {
@@ -391,13 +520,13 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
391
520
  });
392
521
  }
393
522
  static get classIdentifier() {
394
- return Oe;
523
+ return Ot;
395
524
  }
396
525
  get eager() {
397
526
  return !0;
398
527
  }
399
528
  unregisterFrom(e) {
400
- A((t) => {
529
+ w((t) => {
401
530
  t.whenCommitted(() => this.abandonRun(e));
402
531
  for (let t = e.errors.length - 1; t >= 0; t--) e.errors[t].source === this.source && e.errors.splice(t, 1);
403
532
  e.validate();
@@ -412,27 +541,22 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
412
541
  newBindingState() {
413
542
  return { run: 0 };
414
543
  }
415
- replacePlaceholdersFunction(e, t) {
416
- return () => {
417
- let n = f(e);
418
- for (; N(n);) n = f(this.replacePlaceholders(n(), t));
419
- return n;
420
- };
544
+ errorFor(e, t, n, r) {
545
+ return new Dt(e?.code ?? t, r, kt(e?.detail ?? n, r));
421
546
  }
422
- replacePlaceholders(e, n) {
423
- if (N(e)) return this.replacePlaceholdersFunction(e, n);
424
- if (M(e)) return e;
425
- if (o(e)) return this.replacePlaceholdersFunction(() => f(e), n);
426
- let r = f(e), i = t(r.toString(), n);
427
- return r instanceof j ? new j(i, r.options, r.plugins) : i;
428
- }
429
- }, Ae = class e {
547
+ }, At = class e {
430
548
  actions = [];
431
549
  register(e, t) {
432
- if (!(e instanceof S)) throw Error("Invalid action type");
550
+ if (!(e instanceof T)) throw Error("Invalid action type");
551
+ e.classIdentifier, Tt(e, this.actions);
433
552
  let n = t ? this.actions.indexOf(t) : -1;
434
553
  if (t && (t.classIdentifier !== e.classIdentifier || n < 0)) throw Error("Action to register before is not registered under the same identifier");
435
- n < 0 ? this.actions.push(e) : this.actions.splice(n, 0, e);
554
+ if (n >= 0) {
555
+ this.actions.splice(n, 0, e);
556
+ return;
557
+ }
558
+ let r = e[$e] ? -1 : this.actions.findIndex((t) => t[$e] && t.classIdentifier === e.classIdentifier);
559
+ r < 0 ? this.actions.push(e) : this.actions.splice(r, 0, e);
436
560
  }
437
561
  unregister(e) {
438
562
  return this.actions.includes(e) ? (this.actions = this.actions.filter((t) => t !== e), !0) : !1;
@@ -446,29 +570,46 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
446
570
  trigger(e, t, ...n) {
447
571
  return this.run(e.classIdentifier, !1, t, n);
448
572
  }
449
- triggerEager(t, ...n) {
450
- let r = this.actions;
451
- for (let i = r.length - 1; i >= 0; i--) {
452
- let a = r[i];
453
- if (a.eager && e.outermostEager(r, i)) try {
454
- let o = this.walk(r, i, a.classIdentifier, !0, t, n);
455
- e.isPromise(o) && o.then(void 0, (e) => {
456
- if (!(e instanceof C)) throw e;
457
- });
458
- } catch (e) {
459
- if (!(e instanceof C)) throw e;
573
+ triggerEager(e, ...t) {
574
+ let n = this.runEager((e) => !(e instanceof M), e, t) ? [e.contribution, ...t.slice(1)] : t;
575
+ this.runEager((e) => e instanceof M, e, n);
576
+ }
577
+ triggerEagerRules(e, ...t) {
578
+ this.runEager((e) => !(e instanceof M), e, t);
579
+ }
580
+ runEager(t, n, r) {
581
+ let i = !1, a = this.actions;
582
+ for (let o = a.length - 1; o >= 0; o--) {
583
+ let s = a[o];
584
+ if (!(!s.eager || !t(s)) && e.outermostEager(a, o)) {
585
+ i = !0;
586
+ try {
587
+ let t = this.walk(a, o, s.classIdentifier, !0, n, r);
588
+ e.isPromise(t) && t.then(void 0, (e) => {
589
+ if (!(e instanceof E)) throw e;
590
+ });
591
+ } catch (e) {
592
+ if (!(e instanceof E)) throw e;
593
+ }
460
594
  }
461
595
  }
596
+ return i;
462
597
  }
463
598
  triggerEagerFor(e, t, ...n) {
464
599
  return this.run(e, !0, t, n);
465
600
  }
601
+ ofClass(e) {
602
+ return this.actions.filter((t) => t.classIdentifier === e);
603
+ }
466
604
  get validators() {
467
- return this.actions.filter((e) => e instanceof R);
605
+ return this.actions.filter((e) => e instanceof M);
468
606
  }
469
607
  bindTo(e) {
470
608
  this.actions.forEach((t) => t.boundToBinding(e));
471
609
  }
610
+ resetBinding(e) {
611
+ this.actions.forEach((t) => t.resetBinding(e));
612
+ }
472
613
  static outermostEager(e, t) {
473
614
  let n = e[t].classIdentifier;
474
615
  for (let r = e.length - 1; r > t; r--) if (e[r].eager && e[r].classIdentifier === n) return !1;
@@ -479,7 +620,7 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
479
620
  }
480
621
  static answerAbort(t) {
481
622
  return e.isPromise(t) ? t.then(void 0, (e) => {
482
- if (e instanceof C) return e;
623
+ if (e instanceof E) return e;
483
624
  throw e;
484
625
  }) : t;
485
626
  }
@@ -488,7 +629,7 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
488
629
  try {
489
630
  return e.answerAbort(this.walk(a, a.length - 1, t, n, r, i));
490
631
  } catch (e) {
491
- if (e instanceof C) return e;
632
+ if (e instanceof E) return e;
492
633
  throw e;
493
634
  }
494
635
  }
@@ -499,41 +640,41 @@ var Oe = Symbol("Validator"), ke = () => L("ValidationFailed"), R = class extend
499
640
  }
500
641
  };
501
642
  //#endregion
502
- //#region src/binding/resolve.ts
503
- function z(e) {
643
+ //#region src/resolve.ts
644
+ function N(e) {
504
645
  let t = e;
505
646
  for (; t.fieldName !== void 0 && t.parent;) t = t.parent;
506
647
  return t;
507
648
  }
508
- function je(e, t) {
649
+ function jt(e, t) {
509
650
  let n = e;
510
- for (let e of Me(t)) if (n = n.field?.(e) ?? void 0, !n) return;
651
+ for (let e of Mt(t)) if (n = n.field?.(e) ?? void 0, !n) return;
511
652
  return n?.declaration === t ? n : void 0;
512
653
  }
513
- function Me(e) {
654
+ function Mt(e) {
514
655
  let t = [], n = e;
515
656
  for (; n.fieldName !== void 0 && n.parent;) t.unshift(n.fieldName), n = n.parent;
516
657
  return t;
517
658
  }
518
- function Ne(e, t) {
519
- let n = je(t, e);
659
+ function Nt(e, t) {
660
+ let n = jt(t, e);
520
661
  if (n) return n;
521
662
  let r = t.parent;
522
663
  for (; r;) {
523
- let t = je(z(r), e);
664
+ let t = jt(N(r), e);
524
665
  if (t) return t;
525
666
  r = r.parent;
526
667
  }
527
- return z(e) === z(t.declaration) ? void 0 : e;
668
+ return N(e) === N(t.declaration) ? void 0 : e;
528
669
  }
529
- function Pe(e, t) {
530
- let n = Ne(e, t);
670
+ function Pt(e, t) {
671
+ let n = Nt(e, t);
531
672
  if (!n) return [];
532
673
  if (n !== e) return [n];
533
674
  let r = t.bindingsOf(e);
534
675
  return r.length > 0 ? r : [e];
535
676
  }
536
- function Fe(e, t) {
677
+ function Ft(e, t) {
537
678
  let n = t.parent;
538
679
  for (; n;) {
539
680
  let t = n.field?.(e);
@@ -543,67 +684,79 @@ function Fe(e, t) {
543
684
  }
544
685
  //#endregion
545
686
  //#region src/actions/conditional/conditional-statement-action.ts
546
- var Ie = Symbol("ConditionalStatementAction"), B = class extends T {
687
+ var It = Symbol("ConditionalStatementAction"), P = class extends j {
547
688
  statement;
548
689
  conditionalExecutor;
549
690
  declarations = /* @__PURE__ */ new Set();
550
691
  registrations = /* @__PURE__ */ new WeakSet();
551
692
  constructor(e, t) {
552
- super((e, t, n, r) => (this.applyIn(z(e)) || e.markRecordIncomplete(), t(e, n, r))), this.statement = e, this.conditionalExecutor = t;
553
- let n = new T((e, t, ...n) => (this.applyFrom(e), t(e, ...n)));
554
- e.collectFields().forEach((e) => e.registerAction(n));
693
+ super((e, t, n, r) => (this.applyIn(N(e)) || e.markRecordIncomplete(), t(e, n, r))), this.statement = e, this.conditionalExecutor = t, this.relay = new j((e, t, ...n) => (this.applyFrom(e), t(e, ...n))), this.relay[$e] = !0, this.listen();
694
+ }
695
+ relay;
696
+ registered = 0;
697
+ listening = !1;
698
+ listen() {
699
+ this.listening || (this.listening = !0, this.statement.collectFields().forEach((e) => e.registerAction(this.relay)));
555
700
  }
556
701
  static get classIdentifier() {
557
- return Ie;
702
+ return It;
558
703
  }
559
704
  get eager() {
560
705
  return !0;
561
706
  }
562
707
  boundToBinding(e) {
563
- this.declarations.add(e.declaration), this.registrations.add(e);
708
+ this.declarations.add(e.declaration), this.registrations.has(e) || this.registered++, this.registrations.add(e), this.listen();
709
+ }
710
+ resetBinding(e) {
711
+ this.forgetState(e);
564
712
  }
565
713
  unregisterFrom(e) {
566
- this.registrations.delete(e);
714
+ this.registrations.delete(e) && this.registered--, this.registered === 0 && this.listening && (S()?.whenRolledBack(() => {
715
+ this.listening = !0;
716
+ }), this.listening = !1, this.statement.collectFields().forEach((e) => e.unregisterAction(this.relay)));
567
717
  }
568
718
  targetsIn(e) {
569
719
  let t = [];
570
- return this.declarations.forEach((n) => Pe(n, e).forEach((e) => {
720
+ return this.declarations.forEach((n) => Pt(n, e).forEach((e) => {
571
721
  this.registrations.has(e) && t.push(e);
572
722
  })), t;
573
723
  }
574
724
  applyIn(e) {
575
725
  let t = this.targetsIn(e);
576
726
  if (t.length === 0) return !1;
577
- let n = this.state(e, () => ({ lastResult: void 0 })), r = this.statement.evaluate(e);
578
- if (r === n.lastResult) return !0;
579
- let i = n.lastResult;
580
- return n.lastResult = r, t.forEach((e) => this.conditionalExecutor(e, r, i)), !0;
727
+ let n = this.statement.evaluate(e);
728
+ return t.forEach((e) => {
729
+ let t = this.state(e, () => ({ lastResult: void 0 }));
730
+ if (n === t.lastResult) return;
731
+ let r = t.lastResult;
732
+ t.lastResult = n, this.conditionalExecutor(e, n, r);
733
+ }), !0;
581
734
  }
582
735
  applyFrom(e) {
583
736
  let t = /* @__PURE__ */ new Set();
584
- this.targetsIn(z(e)).forEach((e) => t.add(z(e))), t.forEach((e) => this.applyIn(e));
737
+ this.targetsIn(N(e)).forEach((e) => t.add(N(e))), t.forEach((e) => this.applyIn(e));
585
738
  }
586
- }, Le = class extends B {
739
+ }, Lt = class extends P {
587
740
  constructor(e, t = "full", n = "suppress") {
588
741
  super(e, (e, r) => {
589
742
  e.visibility = r ? t : n;
590
743
  });
591
744
  }
592
- }, Re = class extends B {
745
+ }, Rt = class extends P {
593
746
  constructor(e, t = "editable", n = "disabled") {
594
747
  super(e, (e, r) => {
595
748
  e.access = r ? t : n;
596
749
  });
597
750
  }
598
- }, ze = class extends B {
751
+ }, zt = class extends P {
599
752
  constructor(e, t) {
600
753
  super(e, (e, n) => {
601
754
  n && (e.value = t);
602
755
  });
603
756
  }
604
- }, V = /* @__PURE__ */ function(e) {
757
+ }, F = /* @__PURE__ */ function(e) {
605
758
  return e[e.NOT = 0] = "NOT", e[e.OR = 1] = "OR", e[e.AND = 2] = "AND", e[e.XOR = 3] = "XOR", e[e.NAND = 4] = "NAND", e[e.NOR = 5] = "NOR", e[e.EQUALS = -1] = "EQUALS", e[e.NOT_EQUALS = -2] = "NOT_EQUALS", e[e.GT = -3] = "GT", e[e.LT = -4] = "LT", e[e.GE = -5] = "GE", e[e.LE = -6] = "LE", e[e.IN = -7] = "IN", e[e.NOT_IN = -8] = "NOT_IN", e[e.INCLUDES = -9] = "INCLUDES", e[e.NOT_INCLUDES = -10] = "NOT_INCLUDES", e;
606
- }(V || {});
759
+ }(F || {});
607
760
  (function(e) {
608
761
  function t(e) {
609
762
  let t = e.toLowerCase();
@@ -639,106 +792,119 @@ var Ie = Symbol("ConditionalStatementAction"), B = class extends T {
639
792
  }
640
793
  e.fromString = t;
641
794
  function n(e) {
642
- let t = typeof e == "number" ? e : V.fromString(e);
643
- if (Object.values(V).includes(t)) return t;
795
+ let t = typeof e == "number" ? e : F.fromString(e);
796
+ if (Object.values(F).includes(t)) return t;
644
797
  throw Error(`Unrecognised operator ${e}`);
645
798
  }
646
799
  e.fromAny = n;
647
800
  function r(e) {
648
- let t = typeof e == "number" ? e : V.fromString(e);
649
- return Object.values(V).includes(t);
801
+ if (typeof e == "number") return Object.values(F).includes(e);
802
+ try {
803
+ return Object.values(F).includes(F.fromString(e));
804
+ } catch {
805
+ return !1;
806
+ }
650
807
  }
651
808
  e.isDefined = r;
652
809
  function i(e) {
653
810
  return e >= 0;
654
811
  }
655
812
  e.isLogicOperator = i;
656
- })(V ||= {}), Object.freeze(V);
657
- var H = V, Be = Symbol("AccessChangingAction"), Ve = class extends S {
813
+ })(F ||= {}), Object.freeze(F);
814
+ var I = F, Bt = Symbol("AccessChangingAction"), Vt = class extends T {
658
815
  constructor(e) {
659
816
  super(e);
660
817
  }
661
818
  static get classIdentifier() {
662
- return Be;
819
+ return Bt;
663
820
  }
664
821
  execute(e, t, n, r) {
665
822
  return super.execute(e, t, n, r);
666
823
  }
667
- }, He = Symbol("AccessChangedAction"), Ue = class extends S {
824
+ }, Ht = Symbol("AccessChangedAction"), Ut = class extends T {
668
825
  constructor(e) {
669
826
  super(e);
670
827
  }
671
828
  static get classIdentifier() {
672
- return He;
829
+ return Ht;
673
830
  }
674
831
  execute(e, t, n, r) {
675
832
  return super.execute(e, t, n, r);
676
833
  }
677
- }, We = Symbol("ContributionChangedAction"), U = class extends S {
834
+ }, Wt = Symbol("ContributionChangedAction"), Gt = class extends T {
678
835
  constructor(e) {
679
836
  super(e);
680
837
  }
681
838
  static get classIdentifier() {
682
- return We;
839
+ return Wt;
683
840
  }
684
841
  execute(e, t, n, r) {
685
842
  return super.execute(e, t, n, r);
686
843
  }
687
- }, Ge = Symbol("EnabledChangingAction"), Ke = class extends S {
844
+ }, Kt = Symbol("EnabledChangingAction"), qt = class extends T {
688
845
  constructor(e) {
689
846
  super(e);
690
847
  }
691
848
  static get classIdentifier() {
692
- return Ge;
849
+ return Kt;
693
850
  }
694
851
  execute(e, t, n, r) {
695
852
  return super.execute(e, t, n, r);
696
853
  }
697
- }, qe = Symbol("EnabledChangedAction"), Je = class extends S {
854
+ }, Jt = Symbol("EnabledChangedAction"), Yt = class extends T {
698
855
  constructor(e) {
699
856
  super(e);
700
857
  }
701
858
  static get classIdentifier() {
702
- return qe;
859
+ return Jt;
703
860
  }
704
861
  execute(e, t, n, r) {
705
862
  return super.execute(e, t, n, r);
706
863
  }
707
- }, Ye = Symbol("ValidChangedAction"), Xe = class extends S {
864
+ }, Xt = Symbol("ValidChangedAction"), Zt = class extends T {
708
865
  constructor(e) {
709
866
  super(e);
710
867
  }
711
868
  static get classIdentifier() {
712
- return Ye;
869
+ return Xt;
713
870
  }
714
871
  execute(e, t, n, r) {
715
872
  return super.execute(e, t, n, r);
716
873
  }
717
- }, Ze = Symbol("VisibilityChangingAction"), Qe = class extends S {
874
+ }, Qt = Symbol("VisibilityChangingAction"), $t = class extends T {
718
875
  constructor(e) {
719
876
  super(e);
720
877
  }
721
878
  static get classIdentifier() {
722
- return Ze;
879
+ return Qt;
723
880
  }
724
881
  execute(e, t, n, r) {
725
882
  return super.execute(e, t, n, r);
726
883
  }
727
- }, $e = Symbol("VisibilityChangedAction"), et = class extends S {
884
+ }, en = Symbol("VisibilityChangedAction"), tn = class extends T {
728
885
  constructor(e) {
729
886
  super(e);
730
887
  }
731
888
  static get classIdentifier() {
732
- return $e;
889
+ return en;
733
890
  }
734
891
  execute(e, t, n, r) {
735
892
  return super.execute(e, t, n, r);
736
893
  }
737
- }, tt = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new Set(["validators", "actions"]), W = (e) => typeof e == "string" ? `'${e}'` : String(e), rt = (e) => e.map(W).join(", ");
738
- function it(e) {
739
- if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${rt(v)}`);
894
+ }, nn = /* @__PURE__ */ new WeakMap(), rn = /* @__PURE__ */ new Set(["validators", "actions"]);
895
+ function an(e, t) {
896
+ for (let n = Object.getPrototypeOf(e); n && n !== Object.prototype;) {
897
+ let e = Object.getOwnPropertyDescriptor(n, t);
898
+ if (e) return e.get !== void 0 || e.set !== void 0;
899
+ n = Object.getPrototypeOf(n);
900
+ }
901
+ return !1;
902
+ }
903
+ var L = (e) => typeof e == "string" ? `'${e}'` : String(e), on = (e) => e.map(L).join(", "), R = (e) => e.origin !== "validator", sn = (e) => e === "disabled" ? "omit" : e === "disabled-null" ? "null" : "value";
904
+ function cn(e) {
905
+ if (Object.hasOwn(e, "enabled")) throw TypeError(`enabled is read from access and cannot be assigned; state access instead: ${on(g)}`);
740
906
  }
741
- var at = 0, G = class {
907
+ var ln = 0, z = null, B = class {
742
908
  get __v_skip() {
743
909
  return !0;
744
910
  }
@@ -751,7 +917,7 @@ var at = 0, G = class {
751
917
  #e;
752
918
  #t;
753
919
  constructor(e) {
754
- this.#t = e, this.#e = c(e);
920
+ this.#t = e, this.#e = ee(e), ze(this);
755
921
  }
756
922
  get state() {
757
923
  return this.#e;
@@ -760,10 +926,12 @@ var at = 0, G = class {
760
926
  return this.#t;
761
927
  }
762
928
  rebind(e) {
763
- return A((t) => {
929
+ return w((t) => {
764
930
  t.touch(this);
765
931
  let n = t.willAnnounceValue(this), { announcedValue: r, announcedContribution: i, validatedValue: a } = this.#t;
766
- this.resetTo(this.declaration, e), n ? Object.assign(this.#t, {
932
+ this.asReset(() => {
933
+ this.resetTo(this.declaration, e), z?.push(this);
934
+ }), n ? Object.assign(this.#t, {
767
935
  announcedValue: r,
768
936
  announcedContribution: i,
769
937
  validatedValue: a
@@ -774,7 +942,7 @@ var at = 0, G = class {
774
942
  return this.#e.originalValue;
775
943
  }
776
944
  set originalValue(e) {
777
- this.touchState(), this.#e.originalValue = e;
945
+ this.touchState(), this.#e.originalValue = Ie(this, e);
778
946
  }
779
947
  get extra() {
780
948
  return this.#e.extra;
@@ -788,55 +956,117 @@ var at = 0, G = class {
788
956
  extendedOf(e) {
789
957
  let t = Object.create(null);
790
958
  return Object.entries(e).forEach(([e, n]) => {
791
- nt.has(e) || (!(e in this) || Object.hasOwn(Object.prototype, e)) && (t[e] = n);
959
+ rn.has(e) || an(this, e) || (t[e] = n);
792
960
  }), t;
793
961
  }
794
962
  assignParams(e) {
795
- it(e);
963
+ cn(e);
796
964
  let t = this.extendedOf(e);
797
965
  Object.entries(e).forEach(([e, n]) => {
798
- Object.hasOwn(t, e) || nt.has(e) || (this[e] = n);
799
- }), h(t) || this.setExtendedValues(t);
966
+ Object.hasOwn(t, e) || rn.has(e) || (this[e] = n);
967
+ }), re(t) || this.setExtendedValues(t);
800
968
  }
801
969
  touchState() {
802
- he()?.touch(this);
970
+ S()?.touch(this);
803
971
  }
804
- [E]() {
972
+ [y]() {
805
973
  return {
806
974
  ...this.#t,
807
975
  errors: [...this.#t.errors]
808
976
  };
809
977
  }
810
- [le](e) {
978
+ [Ue](e) {
811
979
  let t = this.#t.validatingCount, n = this.#t.validatingChildren;
812
980
  Object.assign(this.#e, e), this.#e.validatingCount = t, this.#e.validatingChildren = n;
813
981
  }
814
982
  get validating() {
815
983
  return this.#e.validatingCount > 0 || this.#e.validatingChildren > 0;
816
984
  }
817
- beginValidating() {
985
+ [lt]() {
818
986
  let e = !this.validating;
819
987
  this.#e.validatingCount++, e && this.container?.childValidatingChanged(!0);
820
- }
821
- endValidating() {
822
- this.#t.validatingCount !== 0 && (this.#e.validatingCount--, this.validating || this.container?.childValidatingChanged(!1));
988
+ let t = !1;
989
+ return () => {
990
+ t || (t = !0, this.#e.validatingCount--, this.validating || this.container?.childValidatingChanged(!1));
991
+ };
823
992
  }
824
993
  childValidatingChanged(e) {}
825
994
  get busy() {
826
995
  return !1;
827
996
  }
997
+ get pending() {
998
+ return this.validating || this.busy;
999
+ }
828
1000
  settled() {
829
- return !this.validating && !this.busy ? Promise.resolve() : new Promise((e) => {
830
- let t = p(() => this.validating || this.busy, (n) => {
1001
+ return this.pending ? new Promise((e) => {
1002
+ let t = p(() => this.pending, (n) => {
831
1003
  n || (t(), e());
832
1004
  }, { flush: "sync" });
833
- });
1005
+ }) : Promise.resolve();
834
1006
  }
835
1007
  get errors() {
836
- return this.touchState(), this.#e.errors;
1008
+ return this.touchState(), S() || this.noteErrorsBaseline(), this.#e.errors;
837
1009
  }
838
1010
  set errors(e) {
839
- this.touchState(), this.#e.errors = e;
1011
+ this.touchState(), this.#e.errors = e, this.#t.errorsBaseline = D, this.noteErrorsBaseline();
1012
+ }
1013
+ noteErrorsBaseline() {
1014
+ let e = this.#t;
1015
+ e.errorsBaseline !== D || !e.errors.some(R) || (e.errorsBaseline = d(this.value));
1016
+ }
1017
+ ruleOf(e) {
1018
+ for (let t of this.selfAndAbove()) {
1019
+ let n = t.boundActions;
1020
+ if (!n?.willTrigger(A.classIdentifier)) continue;
1021
+ let r = n.ofClass(A.classIdentifier);
1022
+ for (let t = r.length - 1; t >= 0; t--) {
1023
+ let n = wt(r[t], e);
1024
+ if (n) return n;
1025
+ }
1026
+ }
1027
+ return Ct(e);
1028
+ }
1029
+ selfAndAbove() {
1030
+ let e = [this];
1031
+ for (let t = this.parent; t; t = t.parent) e.push(t);
1032
+ return e;
1033
+ }
1034
+ ownErrorsValid(e) {
1035
+ return e.length === 0 || !e.some((e) => !R(e) || (yt(), this.ruleOf(e.origin).validEffect));
1036
+ }
1037
+ removeErrors(e) {
1038
+ let t = this.#e.errors, n = !1;
1039
+ for (let r = t.length - 1; r >= 0; r--) R(t[r]) && e(this.ruleOf(t[r].origin)) && (t.splice(r, 1), n = !0);
1040
+ return this.#t.errors.some(R) || (this.#t.errorsBaseline = D), n;
1041
+ }
1042
+ editConcluded() {
1043
+ let e = this.selfAndAbove().filter((e) => e.#t.errors.some((t) => R(t) && e.ruleOf(t.origin).removeOn === "edit"));
1044
+ e.length !== 0 && w((t) => {
1045
+ for (let n of e) {
1046
+ let e = n.#t, r = e.errorsBaseline;
1047
+ if (t.touch(n), r === D) {
1048
+ e.errorsBaseline = d(n.value);
1049
+ continue;
1050
+ }
1051
+ r !== et && m(n.value, r) || (n.removeErrors((e) => e.removeOn === "edit"), t.markValidityDirty(n));
1052
+ }
1053
+ });
1054
+ }
1055
+ [ft]() {
1056
+ w((e) => {
1057
+ let t = (n) => {
1058
+ n.#t.errors.some(R) && (e.touch(n), n.removeErrors((e) => e.removeOn === "submit") && e.markValidityDirty(n)), n.members.forEach(t);
1059
+ };
1060
+ t(this);
1061
+ });
1062
+ }
1063
+ [dt]() {
1064
+ w((e) => {
1065
+ let t = (n) => {
1066
+ n.#t.errors.some(R) && e.markValidityDirty(n), n.members.forEach(t);
1067
+ };
1068
+ t(this);
1069
+ });
840
1070
  }
841
1071
  get parent() {
842
1072
  return this.#e.parent;
@@ -860,18 +1090,18 @@ var at = 0, G = class {
860
1090
  return r(this), n;
861
1091
  }
862
1092
  markRecordIncomplete() {
863
- this._recordPending || (this._recordPending = !0, at++);
1093
+ this._recordPending || (this._recordPending = !0, ln++);
864
1094
  }
865
1095
  completeRecords(e = this) {
866
- at !== 0 && A(() => {
1096
+ ln !== 0 && w(() => {
867
1097
  let t = (e) => {
868
- e._recordPending && (e._recordPending = !1, at--, e.rerunEagerActions()), e.members.forEach(t);
1098
+ e._recordPending && (e._recordPending = !1, ln--, e.rerunEagerActions()), e.members.forEach(t);
869
1099
  };
870
1100
  t(e);
871
1101
  });
872
1102
  }
873
1103
  rerunEagerActions() {
874
- A((e) => {
1104
+ w((e) => {
875
1105
  this.boundActions?.triggerEager(this, this.contribution, this.contribution), e.markValidityDirty(this);
876
1106
  });
877
1107
  }
@@ -879,11 +1109,11 @@ var at = 0, G = class {
879
1109
  return this._actions;
880
1110
  }
881
1111
  noteBinding(e) {
882
- let t = tt.get(this);
883
- t || (t = /* @__PURE__ */ new Set(), tt.set(this, t)), t.add(new WeakRef(e));
1112
+ let t = nn.get(this);
1113
+ t || (t = /* @__PURE__ */ new Set(), nn.set(this, t)), t.add(new WeakRef(e));
884
1114
  }
885
1115
  get boundElements() {
886
- let e = this.declaration, t = tt.get(e), n = [e];
1116
+ let e = this.declaration, t = nn.get(e), n = [e];
887
1117
  return t && t.forEach((e) => {
888
1118
  let r = e.deref();
889
1119
  r ? n.push(r) : t.delete(e);
@@ -892,7 +1122,7 @@ var at = 0, G = class {
892
1122
  get actions() {
893
1123
  let e = this.declaration;
894
1124
  if (!e._actions) {
895
- let t = new Ae();
1125
+ let t = new At();
896
1126
  e.boundElements.forEach((e) => {
897
1127
  e._actions = t;
898
1128
  });
@@ -903,50 +1133,54 @@ var at = 0, G = class {
903
1133
  return this.#e.valueVersion;
904
1134
  }
905
1135
  bumpValueVersion() {
906
- A((e) => {
1136
+ w((e) => {
907
1137
  e.touch(this), this.#e.valueVersion++;
908
1138
  let t = this.parent;
909
1139
  for (; t;) e.touch(t), t.#e.valueVersion++, t = t.parent;
910
1140
  });
911
1141
  }
912
1142
  propagateValueChanged(e = !1) {
913
- A((t) => {
914
- t.markValueChanged(this, e), t.markValidityDirty(this), this.parent?.notifyValueChanged();
1143
+ w((t) => {
1144
+ t.markValueChanged(this, e), this.errorsAfterChange(t), t.markValidityDirty(this), this.parent?.notifyValueChanged();
915
1145
  });
916
1146
  }
1147
+ errorsAfterChange(e) {
1148
+ let t = this.#t;
1149
+ t.errors.some(R) && (e.touch(this), this.removeErrors((e) => e.removeOn === "change"), t.errorsBaseline === D && t.errors.some(R) && (t.errorsBaseline = et));
1150
+ }
917
1151
  constructed(e) {}
918
1152
  refreshPreviousValue() {
919
1153
  this.#t.announcedContribution = this.contribution;
920
1154
  }
921
1155
  get countedValid() {
922
- return this.#t.errors.length === 0 && this.#t.invalidChildren === 0;
1156
+ return this.ownErrorsValid(this.#t.errors) && this.#t.invalidChildren === 0;
923
1157
  }
924
1158
  takeChild(e, t) {
925
- A((n) => {
1159
+ w((n) => {
926
1160
  if (e.parent) throw TypeError("This element already belongs to a container - pass a bind() of it");
927
1161
  n.touch(e), e.#e.fieldName = t;
928
1162
  let r = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
929
- e.#e.parent = this, r && e.revalidateWhereChanged(r), this.adoptChild(e);
1163
+ e.#e.parent = this, r && e.revalidateWhereChanged(r), vt() && e[dt](), this.adoptChild(e), Be(n, e);
930
1164
  });
931
1165
  }
932
1166
  adoptChild(e) {
933
- A((t) => {
1167
+ w((t) => {
934
1168
  t.touch(this), !e.#t.valid && e.countsInContainer && this.#t.invalidChildren++, e.validating && this.childValidatingChanged(!0), t.whenRolledBack(() => {
935
1169
  e.validating && this.childValidatingChanged(!1);
936
1170
  }), t.markValidityDirty(this);
937
1171
  });
938
1172
  }
939
1173
  releaseChild(e) {
940
- A((t) => {
1174
+ w((t) => {
941
1175
  t.touch(this), t.touch(e), !e.#t.valid && e.countsInContainer && this.#t.invalidChildren--;
942
1176
  let n = this.effectiveAccess === "editable" ? void 0 : e.effectiveAccessFromHere();
943
1177
  e.validating && this.childValidatingChanged(!1), t.whenRolledBack(() => {
944
1178
  e.validating && this.childValidatingChanged(!0);
945
- }), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), t.markValidityDirty(this);
1179
+ }), e.#e.parent = void 0, e.#e.fieldName = void 0, n && e.revalidateWhereChanged(n), vt() && e[dt](), t.markValidityDirty(this);
946
1180
  });
947
1181
  }
948
1182
  resetTo(e, t) {
949
- A(() => {
1183
+ w(() => {
950
1184
  let n = t === void 0 ? e.value : t, r = this.errors.length > 0;
951
1185
  r && (this.errors = []), this.touched = !1;
952
1186
  let i = this.value !== n;
@@ -954,7 +1188,29 @@ var at = 0, G = class {
954
1188
  });
955
1189
  }
956
1190
  resetChild(e, t, n) {
957
- e.resetTo(t, n);
1191
+ e !== t && (e.access = t.access, e.visibility = t.visibility, e.boundActions?.resetBinding(e)), e.resetTo(t, n), z?.push(e);
1192
+ }
1193
+ asReset(e) {
1194
+ if (z) {
1195
+ e();
1196
+ return;
1197
+ }
1198
+ let t = [];
1199
+ z = t;
1200
+ try {
1201
+ e();
1202
+ } finally {
1203
+ z = null;
1204
+ }
1205
+ t.forEach((e) => e.boundActions?.triggerEagerRules(e, e.contribution, e.contribution)), t.forEach((e) => e.recordBaseline());
1206
+ }
1207
+ baselineMembers() {
1208
+ this.members.forEach((e) => {
1209
+ e.baselineMembers(), e.recordBaseline();
1210
+ });
1211
+ }
1212
+ recordBaseline() {
1213
+ this.originalValue = this.value;
958
1214
  }
959
1215
  childValidityChanged(e) {}
960
1216
  get visibility() {
@@ -962,12 +1218,12 @@ var at = 0, G = class {
962
1218
  }
963
1219
  set visibility(e) {
964
1220
  let t = this.#e.visibility;
965
- e !== t && A((n) => {
966
- let r = this.boundActions?.trigger(Qe, this, e, t);
967
- if (r instanceof C) return;
1221
+ e !== t && w((n) => {
1222
+ let r = this.boundActions?.trigger($t, this, e, t);
1223
+ if (r instanceof E) return;
968
1224
  let i = r ?? e;
969
- if (!x(i)) throw Error(`${W(i)} is not a visibility: ${rt(y)}`);
970
- n.touch(this), this.#e.visibility = i, this.boundActions?.trigger(et, this, i, t);
1225
+ if (!pe(i)) throw Error(`${L(i)} is not a visibility: ${on(_)}`);
1226
+ i !== t && (n.touch(this), this.#t.announcedVisibility === void 0 && (this.#t.announcedVisibility = t), this.#e.visibility = i, n.markFlagsDirty(this));
971
1227
  });
972
1228
  }
973
1229
  get access() {
@@ -975,29 +1231,29 @@ var at = 0, G = class {
975
1231
  }
976
1232
  set access(e) {
977
1233
  let t = this.#e.access;
978
- e !== t && A((n) => {
979
- let r = this.boundActions?.trigger(Ve, this, e, t);
980
- if (r instanceof C) return;
1234
+ e !== t && w((n) => {
1235
+ let r = this.boundActions?.trigger(Vt, this, e, t);
1236
+ if (r instanceof E) return;
981
1237
  let i = r ?? e;
982
- if (!se(i)) throw Error(`${W(i)} is not an access: ${rt(v)}`);
1238
+ if (!de(i)) throw Error(`${L(i)} is not an access: ${on(g)}`);
983
1239
  if (i === t) return;
984
1240
  let a = this.enabled, o = i === "editable";
985
1241
  if (o !== a) {
986
- let e = this.boundActions?.trigger(Ke, this, o, a);
987
- if (e instanceof C) return;
988
- if (e != null && typeof e != "boolean") throw Error(`${W(e)} is not what an EnabledChangingAction answers with: a boolean`);
1242
+ let e = this.boundActions?.trigger(qt, this, o, a);
1243
+ if (e instanceof E) return;
1244
+ if (e != null && typeof e != "boolean") throw Error(`${L(e)} is not what an EnabledChangingAction answers with: a boolean`);
989
1245
  if (e === a) return;
990
1246
  }
991
1247
  n.touch(this);
992
1248
  let s = this.contribution, c = this.countsInContainer, l = this.effectiveAccessBelow();
993
- this.#e.access = i, this.revalidateWhereChanged(l), this.composesValue || this.boundActions?.triggerEager(this, this.contribution, s), this.contributionChanged(n, c), this.boundActions?.trigger(Ue, this, i, t), this.enabled !== a && this.boundActions?.trigger(Je, this, this.enabled, a);
1249
+ this.#e.access = i, this.revalidateWhereChanged(l), !this.composesValue && sn(t) !== sn(i) && this.boundActions?.triggerEager(this, this.contribution, s), this.contributionChanged(n, c), this.#t.announcedAccess === void 0 && (this.#t.announcedAccess = t), n.markFlagsDirty(this);
994
1250
  });
995
1251
  }
996
1252
  get effectiveAccess() {
997
1253
  let e = this.access, t = this.parent?.effectiveAccess;
998
1254
  return t === "disabled" || t === "disabled-null" ? "disabled" : t === "readonly" && e === "editable" ? "readonly" : e;
999
1255
  }
1000
- [ce]() {
1256
+ [He]() {
1001
1257
  if (this.#t.access === "disabled") return !0;
1002
1258
  for (let e = this.#t.parent; e; e = e.#t.parent) if (e.#t.access === "disabled" || e.#t.access === "disabled-null") return !0;
1003
1259
  return !1;
@@ -1022,7 +1278,7 @@ var at = 0, G = class {
1022
1278
  }
1023
1279
  revalidateWhereChanged(e) {
1024
1280
  e.forEach((e, t) => {
1025
- t.effectiveAccess !== e && t.rerunEagerActions();
1281
+ sn(t.effectiveAccess) !== sn(e) && t.rerunEagerActions();
1026
1282
  });
1027
1283
  }
1028
1284
  serializesAs(e) {
@@ -1062,54 +1318,68 @@ var at = 0, G = class {
1062
1318
  childComposesValue(e) {
1063
1319
  return e.composesValue;
1064
1320
  }
1065
- [ue](e, t, n, r) {
1321
+ [We](e, t, n, r) {
1066
1322
  if (r?.forEach((e) => this.boundActions?.trigger(e.actionClass, this, e.item, e.index)), !t) return;
1067
- let i = this.boundActions, a = this.composesValue, o = (e, t) => a ? g(e, t) : e === t;
1323
+ let i = this.boundActions, a = this.composesValue, o = (e, t) => a ? m(e, t) : e === t;
1068
1324
  if (a && i?.hasEager) {
1069
1325
  let t = this.contribution, r = this.#t.validatedValue;
1070
- (n || !g(t, r)) && (e.touch(this), this.#t.validatedValue = t, i.triggerEager(this, t, r));
1326
+ (n || !m(t, r)) && (e.touch(this), this.#t.validatedValue = t, i.triggerEager(this, t, r));
1071
1327
  }
1072
- if (!a || i?.willTrigger(w)) {
1328
+ if (!a || i?.willTrigger(Et)) {
1073
1329
  let t = this.holding, r = this.#t.announcedValue;
1074
- (n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(T, this, t, r));
1330
+ (n || !o(t, r)) && (e.touch(this), this.#t.announcedValue = t, i?.trigger(j, this, t, r));
1075
1331
  }
1076
- if (i?.willTrigger(We)) {
1332
+ if (i?.willTrigger(Wt)) {
1077
1333
  let t = this.contribution, n = this.#t.announcedContribution;
1078
- o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(U, this, t, n));
1334
+ o(t, n) || (e.touch(this), this.#t.announcedContribution = t, i.trigger(Gt, this, t, n));
1079
1335
  }
1080
1336
  }
1081
1337
  recordAnnounced() {
1082
1338
  let e = this.boundActions;
1083
- (!this.composesValue || e?.willTrigger(w)) && (this.#t.announcedValue = this.holding), e?.willTrigger(We) && (this.#t.announcedContribution = this.contribution), this.composesValue && e?.hasEager && (this.#t.validatedValue = this.contribution);
1339
+ (!this.composesValue || e?.willTrigger(Et)) && (this.#t.announcedValue = this.holding), e?.willTrigger(Wt) && (this.#t.announcedContribution = this.contribution), this.composesValue && e?.hasEager && (this.#t.validatedValue = this.contribution), this.#t.errorsBaseline = D;
1340
+ }
1341
+ [Ke]() {
1342
+ let e = this.#t, t = e.announcedAccess;
1343
+ if (t !== void 0) {
1344
+ e.announcedAccess = void 0;
1345
+ let n = e.access;
1346
+ if (n !== t) {
1347
+ this.boundActions?.trigger(Ut, this, n, t);
1348
+ let e = n === "editable", r = t === "editable";
1349
+ e !== r && this.boundActions?.trigger(Yt, this, e, r);
1350
+ }
1351
+ }
1352
+ let n = e.announcedVisibility;
1353
+ n !== void 0 && (e.announcedVisibility = void 0, e.visibility !== n && this.boundActions?.trigger(tn, this, e.visibility, n));
1084
1354
  }
1085
- [de](e) {
1355
+ [Ge](e) {
1086
1356
  let t = this.#t.valid, n = this.countedValid;
1087
1357
  if (n === t) return;
1088
1358
  e.touch(this), this.#t.valid = n;
1089
1359
  let r = this.container;
1090
- r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(Xe, this, n, t);
1360
+ r && this.countsInContainer && (e.touch(r), r.childValidityChanged(n), e.markValidityDirty(r)), this.boundActions?.trigger(Zt, this, n, t);
1091
1361
  }
1092
1362
  validate(e = !1) {
1093
- A((t) => {
1363
+ w((t) => {
1094
1364
  e && this.boundActions?.triggerEager(this, this.contribution, this.contribution), t.markValidityDirty(this);
1095
1365
  });
1096
1366
  }
1097
1367
  get valid() {
1098
- return this.#e.errors.length === 0;
1368
+ return this.ownErrorsValid(this.#e.errors);
1099
1369
  }
1100
1370
  get fullValue() {
1101
1371
  return this.value;
1102
1372
  }
1103
1373
  get isChanged() {
1104
- return !g(this.value, this.originalValue);
1374
+ return !m(this.value, this.originalValue);
1105
1375
  }
1106
1376
  boundFrom(e, t, n, r) {
1107
- r && it(r), this.#t.declaration = e.declaration;
1377
+ r && cn(r), this.#t.declaration = e.declaration;
1108
1378
  let i = {
1109
1379
  ...e.extra,
1110
1380
  ...r && this.extendedOf(r)
1111
1381
  };
1112
- h(i) || this.setExtendedValues(i);
1382
+ re(i) || this.setExtendedValues(i);
1113
1383
  let a = this.declaration;
1114
1384
  a.noteBinding(this);
1115
1385
  let o = a._actions;
@@ -1121,21 +1391,21 @@ var at = 0, G = class {
1121
1391
  });
1122
1392
  }
1123
1393
  registerAction(e) {
1124
- return A((t) => {
1394
+ return w((t) => {
1125
1395
  t.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e), this.registered(t, e);
1126
1396
  }), this;
1127
1397
  }
1128
1398
  registerActionBefore(e, t) {
1129
- return A((n) => {
1399
+ return w((n) => {
1130
1400
  n.willAnnounceValue(this) || this.refreshPreviousValue(), this.actions.register(e, t), this.registered(n, e);
1131
1401
  }), this;
1132
1402
  }
1133
1403
  unregisterAction(e) {
1134
1404
  let t = !1;
1135
- return A((n) => {
1405
+ return w((n) => {
1136
1406
  let r = this.boundActions;
1137
1407
  if (!r || (t = r.unregister(e), !t)) return;
1138
- n.touch(this), e instanceof R && this.#e.validationEpoch++;
1408
+ n.touch(this), e instanceof M && this.#e.validationEpoch++;
1139
1409
  let i = this.boundElements;
1140
1410
  n.whenRolledBack(() => {
1141
1411
  r.register(e), i.forEach((t) => e.boundToBinding(t));
@@ -1154,11 +1424,11 @@ var at = 0, G = class {
1154
1424
  let n = this.boundActions;
1155
1425
  return n ? n.trigger(e, this, ...t) : null;
1156
1426
  }
1157
- get validationEpoch() {
1427
+ get [ut]() {
1158
1428
  return this.#e.validationEpoch;
1159
1429
  }
1160
1430
  clearValidators() {
1161
- A((e) => {
1431
+ w((e) => {
1162
1432
  e.touch(this), this.#e.validationEpoch++;
1163
1433
  let t = this.boundActions;
1164
1434
  if (t) {
@@ -1175,10 +1445,10 @@ var at = 0, G = class {
1175
1445
  };
1176
1446
  //#endregion
1177
1447
  //#region src/actions/conditional/statement.ts
1178
- function ot(e, t) {
1448
+ function un(e, t) {
1179
1449
  return e ? !t : t;
1180
1450
  }
1181
- var st = class e {
1451
+ var dn = class e {
1182
1452
  operand1;
1183
1453
  operator;
1184
1454
  operand2;
@@ -1187,12 +1457,12 @@ var st = class e {
1187
1457
  if (typeof e == "function") throw TypeError(`Statement operand ${t} is a function: an operand is a field, a nested statement or a literal, and a function is none of them. An accessor states the field it answers with: group.field('name').`);
1188
1458
  }
1189
1459
  constructor(t, n, r) {
1190
- e.validateOperand(t, 1), n !== H.NOT && e.validateOperand(r, 2), this.operand1 = t, this.operator = n, this.operand2 = r;
1460
+ e.validateOperand(t, 1), n !== I.NOT && e.validateOperand(r, 2), this.operand1 = t, this.operator = n, this.operand2 = r;
1191
1461
  }
1192
1462
  static valueOf(t, n) {
1193
1463
  if (t instanceof e) return t.evaluate(n);
1194
- if (t instanceof G) {
1195
- let e = n ? Ne(t, n) : t;
1464
+ if (t instanceof B) {
1465
+ let e = n ? Nt(t, n) : t;
1196
1466
  return e ? f(e.value) : void 0;
1197
1467
  }
1198
1468
  return t;
@@ -1206,117 +1476,139 @@ var st = class e {
1206
1476
  evaluate(t) {
1207
1477
  let n = e.valueOf(this.operand1, t), r = e.valueOf(this.operand2, t);
1208
1478
  switch (this.operator) {
1209
- case H.AND: return !!(n && r);
1210
- case H.OR: return !!(n || r);
1211
- case H.NAND: return !(n && r);
1212
- case H.NOR: return !(n || r);
1213
- case H.XOR: return ot(!!n, !!r);
1214
- case H.NOT: return !n;
1215
- case H.EQUALS: return n == r;
1216
- case H.NOT_EQUALS: return n != r;
1217
- case H.LT: return n < r;
1218
- case H.LE: return n <= r;
1219
- case H.GE: return n >= r;
1220
- case H.GT: return n > r;
1221
- case H.IN: return !!r?.includes?.(n);
1222
- case H.NOT_IN: return !r?.includes?.(n);
1223
- case H.INCLUDES: return _(n) && _(r) && n.indexOf(r) >= 0;
1224
- case H.NOT_INCLUDES: return !(_(n) && _(r) && n.indexOf(r) >= 0);
1479
+ case I.AND: return !!(n && r);
1480
+ case I.OR: return !!(n || r);
1481
+ case I.NAND: return !(n && r);
1482
+ case I.NOR: return !(n || r);
1483
+ case I.XOR: return un(!!n, !!r);
1484
+ case I.NOT: return !n;
1485
+ case I.EQUALS: return n == r;
1486
+ case I.NOT_EQUALS: return n != r;
1487
+ case I.LT: return n < r;
1488
+ case I.LE: return n <= r;
1489
+ case I.GE: return n >= r;
1490
+ case I.GT: return n > r;
1491
+ case I.IN: return !!r?.includes?.(n);
1492
+ case I.NOT_IN: return !r?.includes?.(n);
1493
+ case I.INCLUDES: return h(n) && h(r) && n.indexOf(r) >= 0;
1494
+ case I.NOT_INCLUDES: return !(h(n) && h(r) && n.indexOf(r) >= 0);
1225
1495
  default: throw Error(`Operator not implemented ${this.operator}`);
1226
1496
  }
1227
1497
  }
1228
1498
  collectFields() {
1229
1499
  let t = /* @__PURE__ */ new Set();
1230
1500
  function n(n) {
1231
- n instanceof G ? t.add(n) : n instanceof e && n.collectFields().forEach((e) => t.add(e));
1501
+ n instanceof B ? t.add(n) : n instanceof e && n.collectFields().forEach((e) => t.add(e));
1232
1502
  }
1233
1503
  return n(this.operand1), n(this.operand2), t;
1234
1504
  }
1235
- }, ct = Symbol("ExecuteAction"), lt = class extends S {
1505
+ }, fn = Symbol("ExecuteAction"), V = class extends T {
1236
1506
  constructor(e) {
1237
1507
  super(e);
1238
1508
  }
1239
1509
  static get classIdentifier() {
1240
- return ct;
1510
+ return fn;
1241
1511
  }
1242
1512
  execute(e, t, n) {
1243
1513
  return super.execute(e, t, n);
1244
1514
  }
1245
- }, ut = Symbol("ListItemAddedAction"), K = class extends S {
1515
+ canExecute(e) {
1516
+ return !0;
1517
+ }
1518
+ }, H = class extends V {
1519
+ targetFor(e) {
1520
+ let t = this.target;
1521
+ return typeof t == "function" ? t(e) ?? void 0 : t;
1522
+ }
1523
+ };
1524
+ function pn(e) {
1525
+ return e.validating ? new Promise((t) => {
1526
+ let n = p(() => e.validating, (e) => {
1527
+ e || (n(), t());
1528
+ }, { flush: "sync" });
1529
+ }) : Promise.resolve();
1530
+ }
1531
+ var U = class extends E {}, mn = class extends U {
1532
+ constructor(e) {
1533
+ super("the submit handler failed", { cause: e });
1534
+ }
1535
+ }, W = class extends U {
1536
+ reason;
1537
+ constructor(e) {
1538
+ super(e === "invalid" ? "the submitted element is invalid" : "a submit of this action is already running"), this.reason = e;
1539
+ }
1540
+ }, hn = class extends H {
1541
+ target;
1542
+ constructor(e, t, n = {}) {
1543
+ super(async (e, r, i) => {
1544
+ let a = this.state(e, () => ({ running: !1 }));
1545
+ if (a.running) throw new W("running");
1546
+ a.running = !0;
1547
+ try {
1548
+ let a = this.targetFor(e);
1549
+ if (!a) throw Error("SubmitAction: the target callback returned no element");
1550
+ if (await pn(a), !a.valid) throw new W("invalid");
1551
+ a[ft]();
1552
+ let o = a.value, s, c = n.lock !== !1 && a.access === "editable";
1553
+ c && (a.access = "readonly");
1554
+ let l = c && a.access === "readonly";
1555
+ try {
1556
+ try {
1557
+ s = await t(o, a);
1558
+ } catch (e) {
1559
+ throw new mn(e);
1560
+ }
1561
+ s !== void 0 && n.rebind !== !1 && a.rebind(s);
1562
+ } finally {
1563
+ l && a.access === "readonly" && (a.access = "editable");
1564
+ }
1565
+ return await r(e, i), {
1566
+ action: e,
1567
+ sent: o,
1568
+ received: s
1569
+ };
1570
+ } finally {
1571
+ a.running = !1;
1572
+ }
1573
+ }), this.target = e;
1574
+ }
1575
+ canExecute(e) {
1576
+ let t = this.targetFor(e);
1577
+ return t !== void 0 && t.valid && !t.pending;
1578
+ }
1579
+ }, gn = class extends H {
1580
+ target;
1581
+ constructor(e) {
1582
+ super((e, t, n) => {
1583
+ let r = this.targetFor(e);
1584
+ if (!r) throw Error("RejectAction: the target callback returned no element");
1585
+ return r.rebind(r.originalValue), t(e, n);
1586
+ }), this.target = e;
1587
+ }
1588
+ canExecute(e) {
1589
+ return this.targetFor(e) !== void 0;
1590
+ }
1591
+ }, _n = Symbol("ListItemAddedAction"), G = class extends T {
1246
1592
  constructor(e) {
1247
1593
  super(e);
1248
1594
  }
1249
1595
  static get classIdentifier() {
1250
- return ut;
1596
+ return _n;
1251
1597
  }
1252
1598
  execute(e, t, n, r) {
1253
1599
  return super.execute(e, t, n, r);
1254
1600
  }
1255
- }, dt = Symbol("ListItemRemovedAction"), ft = class extends S {
1601
+ }, vn = Symbol("ListItemRemovedAction"), K = class extends T {
1256
1602
  constructor(e) {
1257
1603
  super(e);
1258
1604
  }
1259
1605
  static get classIdentifier() {
1260
- return dt;
1606
+ return vn;
1261
1607
  }
1262
1608
  execute(e, t, n, r) {
1263
1609
  return super.execute(e, t, n, r);
1264
1610
  }
1265
- }, pt = Object.freeze({});
1266
- function mt() {
1267
- return {
1268
- originalValue: void 0,
1269
- announcedValue: void 0,
1270
- announcedContribution: void 0,
1271
- validatedValue: void 0,
1272
- errors: [],
1273
- visibility: b,
1274
- access: oe,
1275
- valueVersion: 0,
1276
- validatingCount: 0,
1277
- validatingChildren: 0,
1278
- parent: void 0,
1279
- fieldName: void 0,
1280
- validationEpoch: 0,
1281
- declaration: void 0,
1282
- extra: pt,
1283
- valid: !0,
1284
- invalidChildren: 0
1285
- };
1286
- }
1287
- function ht() {
1288
- return {
1289
- ...mt(),
1290
- value: void 0,
1291
- touched: !1
1292
- };
1293
- }
1294
- function gt() {
1295
- return {
1296
- ...mt(),
1297
- announcedValue: null,
1298
- cachedValue: null,
1299
- cachedValueVersion: -1
1300
- };
1301
- }
1302
- function _t() {
1303
- return {
1304
- ...gt(),
1305
- fieldNames: []
1306
- };
1307
- }
1308
- function vt() {
1309
- return {
1310
- ...gt(),
1311
- rows: null,
1312
- rowsVersion: 0,
1313
- cachedItems: null,
1314
- cachedItemsVersion: -1
1315
- };
1316
- }
1317
- //#endregion
1318
- //#region src/field.ts
1319
- var q = class extends G {
1611
+ }, q = class extends B {
1320
1612
  get [Symbol.toStringTag]() {
1321
1613
  return "Field";
1322
1614
  }
@@ -1330,13 +1622,13 @@ var q = class extends G {
1330
1622
  return this.state.value;
1331
1623
  }
1332
1624
  set _value(e) {
1333
- this.state.value = e;
1625
+ this.state.value = Fe(this, e);
1334
1626
  }
1335
1627
  constructor(e) {
1336
- super(ht()), this.init(e);
1628
+ super(rt()), this.init(e);
1337
1629
  }
1338
1630
  init(e) {
1339
- A(() => {
1631
+ w(() => {
1340
1632
  if (e) {
1341
1633
  let { value: t, validators: n, actions: r, ...i } = e;
1342
1634
  this.registerInitialActions([...n || [], ...r || []]), this.assignParams(i), this._value = t === void 0 ? this.originalValue : t;
@@ -1345,46 +1637,53 @@ var q = class extends G {
1345
1637
  });
1346
1638
  }
1347
1639
  get value() {
1348
- return this._value;
1640
+ return this.valueVersion, this._value;
1349
1641
  }
1350
1642
  set value(e) {
1351
1643
  let t = this._value;
1352
- t !== e && A((n) => {
1353
- n.touch(this), this._value = e, this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, e, t), this.propagateValueChanged();
1644
+ t === e || Number.isNaN(t) && Number.isNaN(e) || w((n) => {
1645
+ n.touch(this), this._value = e, this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, this._value, t), this.propagateValueChanged();
1646
+ });
1647
+ }
1648
+ [we](e, t, n) {
1649
+ w((r) => {
1650
+ r.touch(this);
1651
+ let i = this.raw;
1652
+ d(i.announcedValue) === d(i.value) && (i.announcedValue = n()), e(), r.whenRolledBack(t), this.bumpValueVersion(), this.serializesAs("value") === "value" && this.boundActions?.triggerEager(this, this._value, i.announcedValue), this.propagateValueChanged(!0);
1354
1653
  });
1355
1654
  }
1356
1655
  get touched() {
1357
1656
  return this.state.touched;
1358
1657
  }
1359
1658
  set touched(e) {
1360
- this.touchState(), this.state.touched = e;
1659
+ this.touchState(), this.state.touched = e, e && this.editConcluded();
1361
1660
  }
1362
1661
  bind(e, t) {
1363
- let n = this.constructor, r = new n({
1662
+ let n = this.constructor, r = Le(() => new n({
1364
1663
  value: e === void 0 ? this.value : e,
1365
1664
  ...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
1366
1665
  access: t?.access ?? this.access,
1367
1666
  visibility: t?.visibility ?? this.visibility
1368
- });
1667
+ }));
1369
1668
  return r.boundFrom(this, r.contribution, r.originalValue, t), r;
1370
1669
  }
1371
- }, yt = /* @__PURE__ */ new WeakMap();
1372
- function bt(e) {
1670
+ }, yn = /* @__PURE__ */ new WeakMap();
1671
+ function bn(e) {
1373
1672
  if (e != null) return Object.values(e).some((e) => e != null) ? e : void 0;
1374
1673
  }
1375
- var xt = class extends q {
1674
+ var xn = class extends q {
1376
1675
  get [Symbol.toStringTag]() {
1377
1676
  return "Action";
1378
1677
  }
1379
1678
  init(e) {
1380
- A(() => {
1679
+ w(() => {
1381
1680
  if (this._value = {
1382
1681
  label: void 0,
1383
1682
  icon: void 0
1384
1683
  }, e) {
1385
1684
  let { value: t, originalValue: n, validators: r, actions: i, ...a } = e;
1386
1685
  this.registerInitialActions([...r || [], ...i || []]), this.assignParams(a);
1387
- let o = bt(t), s = bt(n);
1686
+ let o = bn(t), s = bn(n);
1388
1687
  o ? this._value = o : s && (this._value = { ...s }), s && (this.originalValue = Object.freeze({ ...s }));
1389
1688
  }
1390
1689
  this.constructed(e), this.originalValue === void 0 && (this.originalValue = this._value), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
@@ -1406,9 +1705,27 @@ var xt = class extends q {
1406
1705
  set label(e) {
1407
1706
  this.value.label !== e && (this.value = this.valueWith("label", e));
1408
1707
  }
1708
+ get defaultConfirm() {
1709
+ return this.value.defaultConfirm ?? !1;
1710
+ }
1711
+ get defaultReject() {
1712
+ return this.value.defaultReject ?? !1;
1713
+ }
1714
+ serializesAs() {
1715
+ return "omit";
1716
+ }
1717
+ [He]() {
1718
+ return !0;
1719
+ }
1720
+ get executable() {
1721
+ return !this.effectiveEnabled || this.visibility !== "full" || this.busy ? !1 : this[st]().every((e) => e.canExecute(this));
1722
+ }
1723
+ [st]() {
1724
+ return this.boundActions?.ofClass(V.classIdentifier) ?? [];
1725
+ }
1409
1726
  get busyRuns() {
1410
- let e = yt.get(this);
1411
- return e || (e = l(0), yt.set(this, e)), e;
1727
+ let e = yn.get(this);
1728
+ return e || (e = u(0), yn.set(this, e)), e;
1412
1729
  }
1413
1730
  get busy() {
1414
1731
  return this.busyRuns.value > 0;
@@ -1417,53 +1734,12 @@ var xt = class extends q {
1417
1734
  let t = this.busyRuns;
1418
1735
  t.value++;
1419
1736
  try {
1420
- return await this.triggerAction(lt, e);
1737
+ return await this.triggerAction(V, e);
1421
1738
  } finally {
1422
1739
  t.value--;
1423
1740
  }
1424
1741
  }
1425
- }, St = /* @__PURE__ */ i({
1426
- __name: "messages-widget",
1427
- props: {
1428
- message: {},
1429
- classes: {}
1430
- },
1431
- setup(e) {
1432
- let t = e, n = u("vue-markdown"), i = /* @__PURE__ */ new Set(/* @__PURE__ */ "div.span.p.h1.h2.h3.h4.h5.h6.section.article.aside.nav.header.footer.main.figure.figcaption.blockquote.pre.code.em.strong.small.mark.del.ins.sub.sup.i.b.u.s.a.img.button.input.textarea.select.option.label.form.table.tr.td.th.thead.tbody.tfoot.ul.ol.li.dl.dt.dd".split(".")), o = () => {
1433
- if (typeof t.message == "string") return a("span", { class: t.classes }, t.message);
1434
- let e = [];
1435
- return t.message.forEach((r) => {
1436
- switch (r.componentName) {
1437
- case "template":
1438
- e.push(a("div", { class: [t.classes, r.extraClasses] }, r.componentBody));
1439
- break;
1440
- case "vue-markdown":
1441
- if (typeof n == "string") console.warn("You are using markdown for messages-widget, but you haven't registered a vue-markdown component"), e.push(a("div", { class: [t.classes, r.extraClasses] }, r.componentBindings.source));
1442
- else {
1443
- let i = r.componentBindings;
1444
- e.push(a(n, {
1445
- class: [
1446
- t.classes,
1447
- r.extraClasses,
1448
- "df-messages-widget-markdown"
1449
- ],
1450
- source: i.source,
1451
- options: i.options,
1452
- plugins: i.plugins
1453
- }));
1454
- }
1455
- break;
1456
- default: e.push(a(i.has(r.componentName.toLowerCase()) ? r.componentName : u(r.componentName), {
1457
- class: [t.classes, r.extraClasses],
1458
- ...r.componentBindings,
1459
- ...r.componentBody ? { innerHTML: r.componentBody } : {}
1460
- }));
1461
- }
1462
- }), e;
1463
- };
1464
- return (e, t) => (s(), r(o));
1465
- }
1466
- }), Ct = /* @__PURE__ */ new WeakMap(), wt = /* @__PURE__ */ new WeakMap(), J = class extends G {
1742
+ }, Sn = /* @__PURE__ */ new WeakMap(), Cn = /* @__PURE__ */ new WeakMap(), J = class e extends B {
1467
1743
  get [Symbol.toStringTag]() {
1468
1744
  return "Container";
1469
1745
  }
@@ -1471,7 +1747,7 @@ var xt = class extends q {
1471
1747
  return this.children.some((e) => e.touched);
1472
1748
  }
1473
1749
  set touched(e) {
1474
- A(() => {
1750
+ w(() => {
1475
1751
  this.members.forEach((t) => {
1476
1752
  t.touched = e;
1477
1753
  });
@@ -1484,13 +1760,45 @@ var xt = class extends q {
1484
1760
  return this.busyRead;
1485
1761
  }
1486
1762
  validate(e = !1) {
1487
- A(() => {
1763
+ w(() => {
1488
1764
  e && this.members.forEach((e) => e.validate(!0)), super.validate(e);
1489
1765
  });
1490
1766
  }
1491
1767
  notifyValueChanged() {
1492
1768
  this.propagateValueChanged();
1493
1769
  }
1770
+ confirm(e) {
1771
+ return this.command("confirm")?.execute(e);
1772
+ }
1773
+ reject(e) {
1774
+ return this.command("reject")?.execute(e);
1775
+ }
1776
+ serializesAs(e) {
1777
+ let t = this.children;
1778
+ return t.length > 0 && t.every((e) => this.childSerializesAs(e, "fullValue") === "omit") ? "omit" : super.serializesAs(e);
1779
+ }
1780
+ command(e) {
1781
+ let t = e === "confirm" ? hn : gn, n = e === "confirm" ? "defaultConfirm" : "defaultReject", r = this.actionsBelow().filter((e) => e.action.visibility === "full"), i = [
1782
+ r.filter(({ action: e }) => e[st]().some((n) => n instanceof t && n.targetFor(e) === this)),
1783
+ r.filter(({ action: e, depth: t }) => t === 0 && e[n]),
1784
+ r.filter(({ action: e, depth: t }) => t > 0 && e[n])
1785
+ ];
1786
+ for (let t of i) {
1787
+ if (t.length === 0) continue;
1788
+ if (t.length > 1) {
1789
+ console.warn(`${e}(): ${t.length} actions qualify, so none is executed`);
1790
+ return;
1791
+ }
1792
+ let { action: n } = t[0];
1793
+ return n.executable ? n : void 0;
1794
+ }
1795
+ }
1796
+ actionsBelow(t = 0) {
1797
+ return this.children.flatMap((n) => n instanceof xn ? [{
1798
+ action: n,
1799
+ depth: t
1800
+ }] : n instanceof e ? n.actionsBelow(t + 1) : []);
1801
+ }
1494
1802
  get composesValue() {
1495
1803
  return !0;
1496
1804
  }
@@ -1501,12 +1809,12 @@ var xt = class extends q {
1501
1809
  return this.fullValue;
1502
1810
  }
1503
1811
  get validRead() {
1504
- let e = Ct.get(this);
1505
- return e || (e = n(() => this.state.errors.length === 0 && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")), Ct.set(this, e)), e.value;
1812
+ let e = Sn.get(this);
1813
+ return e || (e = l(() => this.ownErrorsValid(this.state.errors) && this.children.every((e) => e.valid || this.childSerializesAs(e, "value") === "omit")), Sn.set(this, e)), e.value;
1506
1814
  }
1507
1815
  get busyRead() {
1508
- let e = wt.get(this);
1509
- return e || (e = n(() => this.children.some((e) => e.busy)), wt.set(this, e)), e.value;
1816
+ let e = Cn.get(this);
1817
+ return e || (e = l(() => this.children.some((e) => e.busy)), Cn.set(this, e)), e.value;
1510
1818
  }
1511
1819
  childValidatingChanged(e) {
1512
1820
  let t = this.validating;
@@ -1515,7 +1823,216 @@ var xt = class extends q {
1515
1823
  childValidityChanged(e) {
1516
1824
  this.raw.invalidChildren += e ? -1 : 1;
1517
1825
  }
1518
- }, Tt = /* @__PURE__ */ new WeakSet(), Et = Object.freeze({}), Dt = /* @__PURE__ */ new WeakMap(), Ot = (e) => ({
1826
+ }, wn = Object.freeze([]), Tn = class e extends J {
1827
+ get [Symbol.toStringTag]() {
1828
+ return "List";
1829
+ }
1830
+ get state() {
1831
+ return super.state;
1832
+ }
1833
+ get raw() {
1834
+ return super.raw;
1835
+ }
1836
+ _itemTemplate;
1837
+ constructor(t, n) {
1838
+ super(ot()), this._itemTemplate = t, t && Re(t), w(() => {
1839
+ if (n) {
1840
+ let { value: e, validators: t, actions: r, ...i } = n;
1841
+ this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.setValueInternal(this.originalValue) : this.setValueInternal(e);
1842
+ }
1843
+ this.constructed(n), this.originalValue === void 0 && (this.originalValue = e.baseline(this.value)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
1844
+ });
1845
+ }
1846
+ [y]() {
1847
+ let e = super[y]();
1848
+ return e.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, e;
1849
+ }
1850
+ static baseline(e) {
1851
+ return e == null ? e : [...e];
1852
+ }
1853
+ processSetValueItem(t) {
1854
+ let n;
1855
+ return n = t instanceof B ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
1856
+ }
1857
+ static elementFor(t) {
1858
+ return oe(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
1859
+ }
1860
+ createPaddingItem(t) {
1861
+ return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || oe(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
1862
+ }
1863
+ rowsChanged() {
1864
+ this.state.rowsVersion++;
1865
+ }
1866
+ static rowsDiffer(e, t) {
1867
+ let n = e ?? [], r = t ?? [];
1868
+ return n.length !== r.length || n.some((e, t) => e !== r[t]);
1869
+ }
1870
+ setValueInternal(t, n = !1) {
1871
+ if (t != null && !Array.isArray(t)) throw TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
1872
+ w((r) => this.asReset(() => {
1873
+ r.touch(this);
1874
+ let i = this.raw.rows, a = (e, t) => {
1875
+ n && r.recordStructural(this, {
1876
+ actionClass: K,
1877
+ item: e,
1878
+ index: t
1879
+ });
1880
+ }, o = (e, t) => {
1881
+ n && r.recordStructural(this, {
1882
+ actionClass: G,
1883
+ item: e,
1884
+ index: t
1885
+ });
1886
+ };
1887
+ if (t == null) {
1888
+ let e = this.raw.rows ?? [];
1889
+ for (let t = e.length - 1; t >= 0; t--) a(e[t], t);
1890
+ this.releaseRows(), this.raw.rows = null;
1891
+ } else {
1892
+ let e = this.raw.rows ?? [];
1893
+ for (let n = e.length - 1; n >= t.length; n--) a(e[n], n);
1894
+ let n = Array(t.length);
1895
+ for (let r = 0; r < t.length; r++) {
1896
+ let i = t[r], s = e[r], c = this._itemTemplate;
1897
+ s && c && !(i instanceof B) && s.declaration === c.declaration ? (this.resetChild(s, c, i), n[r] = s) : (s && (this.releaseChild(s), a(s, r)), n[r] = this.processSetValueItem(i), o(n[r], r));
1898
+ }
1899
+ for (let n = t.length; n < e.length; n++) this.releaseChild(e[n]);
1900
+ this.raw.rows = n;
1901
+ }
1902
+ e.rowsDiffer(i, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
1903
+ }));
1904
+ }
1905
+ get value() {
1906
+ let e = this.valueVersion;
1907
+ if (this.raw.cachedValueVersion === e) return this.raw.cachedValue;
1908
+ let t = [];
1909
+ (this.rows ?? []).forEach((e) => {
1910
+ switch (this.childSerializesAs(e, "value")) {
1911
+ case "value":
1912
+ t.push(e.value);
1913
+ break;
1914
+ case "null": t.push(null);
1915
+ }
1916
+ });
1917
+ let n = t.length ? Object.freeze(t) : wn;
1918
+ return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
1919
+ }
1920
+ set value(e) {
1921
+ w(() => {
1922
+ this.setValueInternal(e, !0), this.propagateValueChanged(!0);
1923
+ });
1924
+ }
1925
+ resetTo(e, t) {
1926
+ w((n) => {
1927
+ n.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(t === void 0 ? e.fullValue : t), this.recordBaseline(), super.validate(!0);
1928
+ });
1929
+ }
1930
+ recordBaseline() {
1931
+ this.recordAnnounced(), this.originalValue = e.baseline(this.value);
1932
+ }
1933
+ bind(e, t) {
1934
+ let n = this._itemTemplate?.bind(), r = this.constructor, i = Le(() => new r(n, {
1935
+ value: [...(e === void 0 ? this.fullValue : e) ?? []],
1936
+ ...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
1937
+ access: t?.access ?? this.access,
1938
+ visibility: t?.visibility ?? this.visibility
1939
+ }));
1940
+ if (i._itemTemplate !== n) throw TypeError(`${this.constructor.name}.bind() built a list that did not take the item template it was given, so the binding would carry the declaration's rows. A subclass whose constructor does not take (itemTemplate, params) has to override bind() and construct itself.`);
1941
+ return i.boundFrom(this, i.contribution, i.originalValue, t), i;
1942
+ }
1943
+ get rows() {
1944
+ return this.state.rowsVersion, this.raw.rows;
1945
+ }
1946
+ get members() {
1947
+ return this.raw.rows ?? [];
1948
+ }
1949
+ get children() {
1950
+ return this.rows ?? [];
1951
+ }
1952
+ get fullValue() {
1953
+ return (this.rows ?? []).filter((e) => this.childSerializesAs(e, "fullValue") !== "omit").map((e) => e.fullValue);
1954
+ }
1955
+ get length() {
1956
+ return this.rows?.length ?? 0;
1957
+ }
1958
+ get items() {
1959
+ let e = this.state.rowsVersion;
1960
+ return this.raw.cachedItemsVersion !== e && (this.raw.cachedItems = Object.freeze([...this.raw.rows ?? []]), this.raw.cachedItemsVersion = e), this.raw.cachedItems;
1961
+ }
1962
+ get(e) {
1963
+ return this.rows?.[e];
1964
+ }
1965
+ push(e) {
1966
+ return this.insert(e, this.raw.rows?.length ?? 0) + 1;
1967
+ }
1968
+ pop() {
1969
+ return this.remove((this.raw.rows?.length ?? 0) - 1);
1970
+ }
1971
+ remove(e) {
1972
+ let t;
1973
+ return w((n) => {
1974
+ let r = this.raw.rows;
1975
+ if (r == null || e < 0 || r.length <= e) return;
1976
+ n.touch(this);
1977
+ let i = r.splice(e, 1)?.[0];
1978
+ i && (this.releaseChild(i), this.rowsChanged(), this.bumpValueVersion(), t = i, n.recordStructural(this, {
1979
+ actionClass: K,
1980
+ item: t,
1981
+ index: e
1982
+ }), this.propagateValueChanged(!0));
1983
+ }), t;
1984
+ }
1985
+ insert(e, t) {
1986
+ let n = 0;
1987
+ return w((r) => {
1988
+ r.touch(this);
1989
+ let i = this.raw.rows ??= [];
1990
+ for (n = t < 0 ? Math.max(i.length + t, 0) : t; i.length < n;) {
1991
+ let t = this.createPaddingItem(e), n = i.push(t) - 1;
1992
+ this.bumpValueVersion(), r.recordStructural(this, {
1993
+ actionClass: G,
1994
+ item: t,
1995
+ index: n
1996
+ });
1997
+ }
1998
+ let a = this.processSetValueItem(e);
1999
+ i.splice(n, 0, a), r.recordStructural(this, {
2000
+ actionClass: G,
2001
+ item: a,
2002
+ index: n
2003
+ }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
2004
+ }), n;
2005
+ }
2006
+ releaseRows() {
2007
+ this.raw.rows?.forEach((e) => this.releaseChild(e));
2008
+ }
2009
+ [ct](e) {
2010
+ w((t) => {
2011
+ t.touch(this), this.raw.rows = [...e], this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
2012
+ });
2013
+ }
2014
+ clear() {
2015
+ w((e) => {
2016
+ let t = this.raw.rows ?? [], n = t.length > 0;
2017
+ e.touch(this);
2018
+ for (let n = t.length - 1; n >= 0; n--) e.recordStructural(this, {
2019
+ actionClass: K,
2020
+ item: t[n],
2021
+ index: n
2022
+ });
2023
+ this.releaseRows(), this.raw.rows = null, n && this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(n);
2024
+ });
2025
+ }
2026
+ rebind(e) {
2027
+ return super.rebind(e);
2028
+ }
2029
+ };
2030
+ //#endregion
2031
+ //#region src/group.ts
2032
+ function En(e) {
2033
+ return oe(e) ? Y.createFromFormData(e) : Array.isArray(e) ? new Tn(void 0, { value: e }) : new q({ value: e });
2034
+ }
2035
+ var Dn = /* @__PURE__ */ new WeakSet(), On = Object.freeze({}), kn = /* @__PURE__ */ new WeakMap(), An = (e) => ({
1519
2036
  get(t, n, r) {
1520
2037
  return e(), Reflect.get(t, n, r);
1521
2038
  },
@@ -1549,38 +2066,46 @@ var xt = class extends q {
1549
2066
  }
1550
2067
  _fields;
1551
2068
  constructor(t, n) {
1552
- if (super(_t()), !e.isValidFields(t)) throw Error("Invalid fields object provided");
1553
- this._fields = Object.create(null), A(() => {
1554
- Tt.add(this);
2069
+ if (super(at()), !e.isValidFields(t)) throw Error("Invalid fields object provided");
2070
+ this._fields = Object.create(null), w(() => {
2071
+ let r = !1, i = !1;
2072
+ Dn.add(this);
1555
2073
  try {
1556
2074
  if (Object.entries(t).forEach(([e, t]) => this.addField(e, t)), n) {
1557
- let { value: e, validators: t, actions: r, ...i } = n;
1558
- this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.assignMembers(this.originalValue) : this.assignMembers(e);
2075
+ let { value: e, validators: t, actions: a, ...o } = n;
2076
+ this.registerInitialActions([...t || [], ...a || []]), this.assignParams(o), e === void 0 ? this.originalValue !== void 0 && this.assignMembers(this.originalValue) : this.assignMembers(e), r = e !== void 0 || this.originalValue !== void 0, i = n.originalValue !== void 0 && e !== void 0;
1559
2077
  }
1560
2078
  } finally {
1561
- Tt.delete(this);
2079
+ Dn.delete(this);
1562
2080
  }
1563
2081
  this.completeRecords(), this.constructed(n);
1564
- let r = this.value;
1565
- this.originalValue === void 0 && (this.originalValue = e.baseline(r)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
2082
+ let a = this.value;
2083
+ this.originalValue === void 0 && (this.originalValue = e.baseline(a)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), r && (this.baselineMembers(), i && this.baselineMembersFrom(this.originalValue)), this.validate();
2084
+ });
2085
+ }
2086
+ baselineMembersFrom(t) {
2087
+ Object.entries(this._fields).forEach(([n, r]) => {
2088
+ if (this.childSerializesAs(r, "fullValue") === "omit" || t != null && !Object.hasOwn(t, n)) return;
2089
+ let i = t == null ? null : t[n];
2090
+ r instanceof e && r.baselineMembersFrom(i), r.originalValue = i;
1566
2091
  });
1567
2092
  }
1568
- [E]() {
1569
- let e = super[E]();
2093
+ [y]() {
2094
+ let e = super[y]();
1570
2095
  return e.fieldNames = [...this.raw.fieldNames], e;
1571
2096
  }
1572
2097
  static baseline(e) {
1573
2098
  return e == null ? e : { ...e };
1574
2099
  }
1575
2100
  addField(t, n) {
1576
- return A((r) => {
2101
+ return w((r) => {
1577
2102
  if (Object.hasOwn(this._fields, t)) throw Error(`Field ${t} is already in this form`);
1578
- this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t), Tt.has(this) || this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
2103
+ this.takeChild(n, t), r.touch(this), e.setEntry(this._fields, t, n), r.whenRolledBack(() => e.dropEntry(this._fields, t)), this.state.fieldNames.push(t), Dn.has(this) || this.completeRecords(n), this.bumpValueVersion(), this.notifyValueChanged();
1579
2104
  }), this;
1580
2105
  }
1581
2106
  removeField(t) {
1582
2107
  let n;
1583
- return A((r) => {
2108
+ return w((r) => {
1584
2109
  if (!Object.hasOwn(this._fields, t)) return;
1585
2110
  let i = this._fields[t];
1586
2111
  r.touch(this), this.releaseChild(i), e.dropEntry(this._fields, t), r.whenRolledBack(() => e.setEntry(this._fields, t, i)), this.state.fieldNames.splice(this.state.fieldNames.indexOf(t), 1), this.bumpValueVersion(), this.notifyValueChanged(), n = i;
@@ -1594,20 +2119,20 @@ var xt = class extends q {
1594
2119
  }
1595
2120
  static isValidFields(e) {
1596
2121
  function t(e) {
1597
- return e instanceof G;
2122
+ return e instanceof B;
1598
2123
  }
1599
2124
  return typeof e == "object" && !!e && Object.entries(e).every(([, e]) => t(e));
1600
2125
  }
1601
2126
  static createFromFormData(t) {
1602
- if (t instanceof G) throw Error("data is already a Form structure, should be a simple object");
1603
- return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, new q({ value: t })])));
2127
+ if (t instanceof B) throw Error("data is already a Form structure, should be a simple object");
2128
+ return new e(t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, t]) => [e, En(t)])));
1604
2129
  }
1605
2130
  field(e) {
1606
2131
  return this._fields[e] ?? null;
1607
2132
  }
1608
2133
  get fields() {
1609
- let e = Dt.get(this);
1610
- return e || (e = new Proxy(this._fields, Ot(() => this.state.fieldNames.length)), Dt.set(this, e)), e;
2134
+ let e = kn.get(this);
2135
+ return e || (e = new Proxy(this._fields, An(() => this.state.fieldNames.length)), kn.set(this, e)), e;
1611
2136
  }
1612
2137
  get members() {
1613
2138
  return this.raw.fieldNames.map((e) => this._fields[e]);
@@ -1627,34 +2152,37 @@ var xt = class extends q {
1627
2152
  case "null": t[e] = null;
1628
2153
  }
1629
2154
  });
1630
- let n = h(t) ? Et : Object.freeze({ ...t });
2155
+ let n = re(t) ? On : Object.freeze({ ...t });
1631
2156
  return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
1632
2157
  }
1633
2158
  assignMembers(e) {
1634
- A(() => {
2159
+ w(() => {
1635
2160
  Object.entries(this._fields).forEach(([t, n]) => {
1636
- (e == null || Object.hasOwn(e, t)) && (n.value = e == null ? null : e[t]);
2161
+ this.childSerializesAs(n, "fullValue") !== "omit" && (e == null || Object.hasOwn(e, t)) && (n.value = e == null ? null : e[t]);
1637
2162
  });
1638
2163
  });
1639
2164
  }
1640
2165
  set value(e) {
1641
- A((t) => {
2166
+ w((t) => {
1642
2167
  this.assignMembers(e), t.markValidityDirty(this);
1643
2168
  });
1644
2169
  }
1645
- resetTo(t, n) {
1646
- let r = t;
1647
- A((t) => {
1648
- t.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([e, t]) => {
1649
- let i;
1650
- n === null ? i = null : n !== void 0 && Object.hasOwn(n, e) && (i = n[e]), this.resetChild(t, r.field(e) ?? t, i);
1651
- }), this.recordAnnounced(), this.originalValue = e.baseline(this.value), super.validate(!0);
2170
+ resetTo(e, t) {
2171
+ let n = e;
2172
+ w((e) => {
2173
+ e.touch(this), this.errors.length && (this.errors = []), Object.entries(this._fields).forEach(([e, r]) => {
2174
+ let i = n.field(e) ?? r, a;
2175
+ this.childSerializesAs(r, "fullValue") === "omit" ? a = void 0 : t === null ? a = null : t !== void 0 && (a = Object.hasOwn(t, e) ? t[e] : i.originalValue), this.resetChild(r, i, a);
2176
+ }), this.recordBaseline(), super.validate(!0);
1652
2177
  });
1653
2178
  }
2179
+ recordBaseline() {
2180
+ this.recordAnnounced(), this.originalValue = e.baseline(this.value);
2181
+ }
1654
2182
  get fullValue() {
1655
2183
  let e = Object.create(null);
1656
2184
  return Object.entries(this._fields).forEach(([t, n]) => {
1657
- e[t] = n.fullValue;
2185
+ this.childSerializesAs(n, "fullValue") !== "omit" && (e[t] = n.fullValue);
1658
2186
  }), { ...e };
1659
2187
  }
1660
2188
  static assertTookFields(e, t, n) {
@@ -1666,13 +2194,20 @@ var xt = class extends q {
1666
2194
  Object.entries(this._fields).forEach(([e, t]) => {
1667
2195
  r[e] = t.bind();
1668
2196
  });
1669
- let i = this.constructor, a = new i(r, {
1670
- value: t === void 0 ? this.fullValue : t,
2197
+ let i = this.constructor, a = Le(() => new i(r, {
2198
+ value: t === void 0 ? this.fullValue : this.withBaselines(t),
1671
2199
  ...n && "originalValue" in n ? { originalValue: n.originalValue } : {},
1672
2200
  access: n?.access ?? this.access,
1673
2201
  visibility: n?.visibility ?? this.visibility
1674
- });
1675
- return e.assertTookFields(a, r, this.constructor.name), a.boundFrom(this, a.contribution, a.originalValue, n), a;
2202
+ }));
2203
+ return e.assertTookFields(a, r, this.constructor.name), a.boundFrom(this, a.contribution, a.originalValue, n), a.baselineMembers(), n?.originalValue !== void 0 && a.baselineMembersFrom(a.originalValue), a;
2204
+ }
2205
+ withBaselines(e) {
2206
+ if (e === null) return e;
2207
+ let t = { ...e };
2208
+ return Object.entries(this._fields).forEach(([e, n]) => {
2209
+ !Object.hasOwn(t, e) && this.childSerializesAs(n, "fullValue") !== "omit" && (t[e] = n.originalValue);
2210
+ }), t;
1676
2211
  }
1677
2212
  rebind(e) {
1678
2213
  return super.rebind(e);
@@ -1680,179 +2215,16 @@ var xt = class extends q {
1680
2215
  };
1681
2216
  //#endregion
1682
2217
  //#region src/is-equal.ts
1683
- function kt(e, t) {
1684
- let n = e instanceof G ? e.value : e, r = t instanceof G ? t.value : t;
1685
- return n === e && r === t ? void 0 : g(n, r);
2218
+ function jn(e, t) {
2219
+ let n = e instanceof B ? e.value : e, r = t instanceof B ? t.value : t;
2220
+ return n === e && r === t ? void 0 : m(n, r);
1686
2221
  }
1687
- function At(e, t) {
1688
- return e instanceof G && t instanceof G ? g(e.value, t.value) : ee(e, t, kt);
2222
+ function Mn(e, t) {
2223
+ return e instanceof B && t instanceof B ? m(e.value, t.value) : ie(e, t, jn);
1689
2224
  }
1690
2225
  //#endregion
1691
- //#region src/list.ts
1692
- var jt = Object.freeze([]), Mt = class e extends J {
1693
- get [Symbol.toStringTag]() {
1694
- return "List";
1695
- }
1696
- get state() {
1697
- return super.state;
1698
- }
1699
- get raw() {
1700
- return super.raw;
1701
- }
1702
- _itemTemplate;
1703
- constructor(t, n) {
1704
- super(vt()), this._itemTemplate = t, A(() => {
1705
- if (n) {
1706
- let { value: e, validators: t, actions: r, ...i } = n;
1707
- this.registerInitialActions([...t || [], ...r || []]), this.assignParams(i), e === void 0 ? this.originalValue !== void 0 && this.setValueInternal(this.originalValue) : this.setValueInternal(e);
1708
- }
1709
- this.constructed(n), this.originalValue === void 0 && (this.originalValue = e.baseline(this.value)), this.recordAnnounced(), this.boundActions?.triggerEager(this, this.contribution, this.originalValue), this.validate();
1710
- });
1711
- }
1712
- [E]() {
1713
- let e = super[E]();
1714
- return e.rows = this.raw.rows ? [...this.raw.rows] : this.raw.rows, e;
1715
- }
1716
- static baseline(e) {
1717
- return e == null ? e : [...e];
1718
- }
1719
- processSetValueItem(t) {
1720
- let n;
1721
- return n = t instanceof G ? t : this._itemTemplate ? this._itemTemplate.bind(t) : e.elementFor(t), this.takeChild(n), this.completeRecords(n), n;
1722
- }
1723
- static elementFor(t) {
1724
- return ne(t) ? Y.createFromFormData(t) : Array.isArray(t) ? new e(void 0, { value: t }) : new q({ value: t });
1725
- }
1726
- createPaddingItem(t) {
1727
- return this._itemTemplate ? this.processSetValueItem(this._itemTemplate.bind()) : t instanceof Y || ne(t) ? this.processSetValueItem({}) : t instanceof e || Array.isArray(t) ? this.processSetValueItem([]) : this.processSetValueItem(void 0);
1728
- }
1729
- rowsChanged() {
1730
- this.state.rowsVersion++;
1731
- }
1732
- static rowsDiffer(e, t) {
1733
- let n = e ?? [], r = t ?? [];
1734
- return n.length !== r.length || n.some((e, t) => e !== r[t]);
1735
- }
1736
- setValueInternal(t) {
1737
- if (t != null && !Array.isArray(t)) throw TypeError("Invalid value provided: a list takes an array of rows, or null to empty it");
1738
- A((n) => {
1739
- n.touch(this);
1740
- let r = this.raw.rows;
1741
- if (t == null) this.releaseRows(), this.state.rows = null;
1742
- else {
1743
- let e = this.state.rows ?? [], n = Array(t.length);
1744
- for (let r = 0; r < t.length; r++) {
1745
- let i = t[r], a = e[r];
1746
- a && this._itemTemplate && !(i instanceof G) ? (this.resetChild(a, this._itemTemplate, i), n[r] = a) : (a && this.releaseChild(a), n[r] = this.processSetValueItem(i));
1747
- }
1748
- for (let n = t.length; n < e.length; n++) this.releaseChild(e[n]);
1749
- this.state.rows = n;
1750
- }
1751
- e.rowsDiffer(r, this.raw.rows) && this.rowsChanged(), this.bumpValueVersion();
1752
- });
1753
- }
1754
- get value() {
1755
- let e = this.valueVersion;
1756
- if (this.raw.cachedValueVersion === e) return this.raw.cachedValue;
1757
- let t = [];
1758
- (this.state.rows ?? []).forEach((e) => {
1759
- switch (this.childSerializesAs(e, "value")) {
1760
- case "value":
1761
- t.push(e.value);
1762
- break;
1763
- case "null": t.push(null);
1764
- }
1765
- });
1766
- let n = t.length ? Object.freeze(t) : jt;
1767
- return this.raw.cachedValue = n, this.raw.cachedValueVersion = e, n;
1768
- }
1769
- set value(e) {
1770
- A(() => {
1771
- this.setValueInternal(e), this.propagateValueChanged(!0);
1772
- });
1773
- }
1774
- resetTo(t, n) {
1775
- A((r) => {
1776
- r.touch(this), this.errors.length && (this.errors = []), this.setValueInternal(n === void 0 ? t.fullValue : n), this.recordAnnounced(), this.originalValue = e.baseline(this.value), super.validate(!0);
1777
- });
1778
- }
1779
- bind(e, t) {
1780
- let n = this._itemTemplate?.bind(), r = this.constructor, i = new r(n, {
1781
- value: [...(e === void 0 ? this.fullValue : e) ?? []],
1782
- ...t && "originalValue" in t ? { originalValue: t.originalValue } : {},
1783
- access: t?.access ?? this.access,
1784
- visibility: t?.visibility ?? this.visibility
1785
- });
1786
- if (i._itemTemplate !== n) throw TypeError(`${this.constructor.name}.bind() built a list that did not take the item template it was given, so the binding would carry the declaration's rows. A subclass whose constructor does not take (itemTemplate, params) has to override bind() and construct itself.`);
1787
- return i.boundFrom(this, i.contribution, i.originalValue, t), i;
1788
- }
1789
- get members() {
1790
- return this.raw.rows ?? [];
1791
- }
1792
- get children() {
1793
- return this.state.rows ?? [];
1794
- }
1795
- get fullValue() {
1796
- return (this.state.rows ?? []).map((e) => e.fullValue);
1797
- }
1798
- get length() {
1799
- return this.state.rows?.length ?? 0;
1800
- }
1801
- get items() {
1802
- let e = this.state.rowsVersion;
1803
- return this.raw.cachedItemsVersion !== e && (this.raw.cachedItems = Object.freeze([...this.raw.rows ?? []]), this.raw.cachedItemsVersion = e), this.raw.cachedItems;
1804
- }
1805
- get(e) {
1806
- return this.state.rows == null ? void 0 : this.state.rows[e];
1807
- }
1808
- push(e) {
1809
- return this.insert(e, this.state.rows?.length ?? 0) + 1;
1810
- }
1811
- pop() {
1812
- return this.remove((this.state.rows?.length ?? 0) - 1);
1813
- }
1814
- remove(e) {
1815
- let t;
1816
- return A((n) => {
1817
- if (this.state.rows == null || e < 0 || this.state.rows.length <= e) return;
1818
- n.touch(this);
1819
- let r = this.state.rows.splice(e, 1)?.[0];
1820
- r && (this.releaseChild(r), this.rowsChanged(), this.bumpValueVersion(), t = r, n.recordStructural(this, {
1821
- actionClass: ft,
1822
- item: t,
1823
- index: e
1824
- }), this.propagateValueChanged(!0));
1825
- }), t;
1826
- }
1827
- insert(e, t) {
1828
- let n = 0;
1829
- return A((r) => {
1830
- for (r.touch(this), this.state.rows ?? (this.state.rows = []), n = t < 0 ? Math.max(this.state.rows.length + t, 0) : t; this.state.rows.length < n;) {
1831
- let t = this.createPaddingItem(e), n = this.state.rows.push(t) - 1;
1832
- this.bumpValueVersion(), r.recordStructural(this, {
1833
- actionClass: K,
1834
- item: t,
1835
- index: n
1836
- });
1837
- }
1838
- let i = this.processSetValueItem(e);
1839
- this.state.rows.splice(n, 0, i), r.recordStructural(this, {
1840
- actionClass: K,
1841
- item: i,
1842
- index: n
1843
- }), this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(!0);
1844
- }), n;
1845
- }
1846
- releaseRows() {
1847
- this.state.rows?.forEach((e) => this.releaseChild(e));
1848
- }
1849
- clear() {
1850
- A((e) => {
1851
- let t = (this.state.rows?.length ?? 0) > 0;
1852
- e.touch(this), this.releaseRows(), this.state.rows = null, t && this.rowsChanged(), this.bumpValueVersion(), this.propagateValueChanged(t);
1853
- });
1854
- }
1855
- }, Nt = class extends R {
2226
+ //#region src/validators/validator-compare-to.ts
2227
+ var Nn = class extends M {
1856
2228
  isValidComparison;
1857
2229
  otherField;
1858
2230
  registrations = /* @__PURE__ */ new WeakSet();
@@ -1862,23 +2234,25 @@ var jt = Object.freeze([]), Mt = class e extends J {
1862
2234
  super((e, t, r) => {
1863
2235
  this.comparisonState(r).oldValue = t;
1864
2236
  let i = this.resolve(r);
1865
- return i ? (this.listenOn(i), this.isValidComparison(f(e), f(i.value)) ? null : [new F(this.replacePlaceholders(n, {
2237
+ if (!i) return r.markRecordIncomplete(), null;
2238
+ this.listenOn(i);
2239
+ let a = f(i.value);
2240
+ return this.isValidComparison(f(e), a) ? null : [this.errorFor(n, "compare_to", "Value does not match the comparison with {otherValue}", {
1866
2241
  newValue: e,
1867
2242
  oldValue: t,
1868
- field: r,
1869
- otherField: i
1870
- }), "", "compare-to")]) : (r.markRecordIncomplete(), null);
2243
+ otherValue: a
2244
+ })];
1871
2245
  }), this.isValidComparison = t, this.otherField = e;
1872
2246
  }
1873
2247
  resolve(e) {
1874
2248
  let t = this.otherField;
1875
- return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ? Fe(t, e) : Ne(t, z(e));
2249
+ return typeof t == "function" ? t(e) ?? void 0 : typeof t == "string" ? Ft(t, e) : Nt(t, N(e));
1876
2250
  }
1877
2251
  listenOn(e) {
1878
- this.listening.has(e) || this.listening.has(e.declaration) || (this.listening.add(e), e.registerAction(new T((e, t, n, r) => {
2252
+ this.listening.has(e) || this.listening.has(e.declaration) || (this.listening.add(e), e.registerAction(new j((e, t, n, r) => {
1879
2253
  t(e, n, r);
1880
- let i = z(e);
1881
- this.declarations.forEach((e) => Pe(e, i).forEach((e) => {
2254
+ let i = N(e);
2255
+ this.declarations.forEach((e) => Pt(e, i).forEach((e) => {
1882
2256
  this.registrations.has(e) && this.execute(e, () => null, e.contribution, this.comparisonState(e).oldValue);
1883
2257
  }));
1884
2258
  })));
@@ -1898,145 +2272,159 @@ var jt = Object.freeze([]), Mt = class e extends J {
1898
2272
  unregisterFrom(e) {
1899
2273
  super.unregisterFrom(e), this.registrations.delete(e);
1900
2274
  }
1901
- }, Pt = class extends R {
2275
+ };
2276
+ //#endregion
2277
+ //#region src/validators/value-checks.ts
2278
+ function X(e) {
2279
+ if (e == null) return 0;
2280
+ if (ne(e) || h(e)) return e.length;
2281
+ if (e instanceof Map || e instanceof Set) return e.size;
2282
+ if (ae(e)) {
2283
+ let t = Object.getPrototypeOf(e);
2284
+ if (t === Object.prototype || t === null) return Object.keys(e).length;
2285
+ }
2286
+ return String(e).length;
2287
+ }
2288
+ function Z(e) {
2289
+ return X(e) === 0 && (e == null || h(e) || ne(e) || ae(e));
2290
+ }
2291
+ function Pn(e, t) {
2292
+ if (e instanceof Date && t instanceof Date) {
2293
+ let n = e.getTime() - t.getTime();
2294
+ return Number.isNaN(n) ? void 0 : n;
2295
+ }
2296
+ if (typeof e == "number" && typeof t == "number") return Number.isNaN(e) || Number.isNaN(t) ? void 0 : e - t;
2297
+ if (typeof e == "string" && typeof t == "string" || typeof e == "bigint" && typeof t == "bigint") return e < t ? -1 : +(e > t);
2298
+ }
2299
+ //#endregion
2300
+ //#region src/validators/validator-in-allowed-values.ts
2301
+ var Fn = class extends M {
1902
2302
  constructor(e, t) {
1903
- let n = t || L("InAllowedValues"), r = () => {
2303
+ let n = () => {
1904
2304
  let t = f(e);
1905
2305
  return typeof t == "function" ? t() : t;
1906
- }, i = (e) => {
2306
+ }, r = (e) => {
1907
2307
  let t = e.join(", ");
1908
- return t.length <= 60 ? t : re(t, {
2308
+ return t.length <= 60 ? t : se(t, {
1909
2309
  length: 40,
1910
2310
  separator: ", ",
1911
2311
  omission: `... (${e.length} items total)`
1912
2312
  });
1913
2313
  };
1914
- super((e, t, a) => {
1915
- let o = r();
1916
- return o.includes(f(e)) ? null : [new F(this.replacePlaceholders(n, {
2314
+ super((e, i) => {
2315
+ if (Z(f(e))) return null;
2316
+ let a = n();
2317
+ return a.includes(f(e)) ? null : [this.errorFor(t, "in_allowed_values", "Must be one of [{allowedAsText}]", {
1917
2318
  newValue: e,
1918
- oldValue: t,
1919
- field: a,
1920
- allowedValues: o,
1921
- allowedAsText: i(o)
1922
- }), "", "in-allowed-values")];
2319
+ oldValue: i,
2320
+ allowedValues: a,
2321
+ allowedAsText: r(a)
2322
+ })];
1923
2323
  });
1924
2324
  }
1925
- };
1926
- //#endregion
1927
- //#region src/validators/validator-required.ts
1928
- function Ft(e) {
1929
- return e == null ? 0 : m(e) || _(e) ? e.length : te(e) && Object.getPrototypeOf(e) === Object.prototype ? Object.keys(e).length : String(e).length;
1930
- }
1931
- function It(e) {
1932
- return typeof e == "object" && !!e && !o(e) && !(e instanceof String) && !("componentName" in e);
1933
- }
1934
- var Lt = class extends R {
1935
- constructor(e, t) {
1936
- let n = It(e) ? void 0 : e, r = (It(e) ? e : t)?.trim ?? !0, i = n || L("Required");
1937
- super((e, t, n) => {
1938
- let a = f(e);
1939
- return Ft(r && _(a) ? a.trim() : a) === 0 ? [new F(this.replacePlaceholders(i, {
1940
- newValue: e,
1941
- oldValue: t,
1942
- field: n
1943
- }), "", "required")] : null;
2325
+ }, In = class extends M {
2326
+ constructor(e) {
2327
+ let t = e?.trim ?? !0;
2328
+ super((n, r) => {
2329
+ let i = f(n);
2330
+ return X(t && h(i) ? i.trim() : i) === 0 ? [this.errorFor(e, "required", "Please enter a value", {
2331
+ newValue: n,
2332
+ oldValue: r
2333
+ })] : null;
1944
2334
  });
1945
2335
  }
1946
- }, Rt = class extends R {
2336
+ }, Ln = class extends M {
1947
2337
  constructor(e, t) {
1948
- let n = t || L("MinValue");
1949
- super((t, r, i) => t < e || t === void 0 ? [new F(this.replacePlaceholders(n, {
1950
- newValue: t,
1951
- oldValue: r,
1952
- field: i,
1953
- minValue: e
1954
- }), "", "min")] : null);
2338
+ super((n, r) => {
2339
+ if (Z(n)) return null;
2340
+ let i = Pn(n, e);
2341
+ return i === void 0 || i < 0 ? [this.errorFor(t, "min_value", "Value must be larger or equal to {minValue}", {
2342
+ newValue: n,
2343
+ oldValue: r,
2344
+ minValue: e
2345
+ })] : null;
2346
+ });
1955
2347
  }
1956
- }, zt = class extends R {
2348
+ }, Rn = class extends M {
1957
2349
  constructor(e, t) {
1958
- let n = t || L("MaxValue");
1959
- super((t, r, i) => t > e || t === void 0 ? [new F(this.replacePlaceholders(n, {
1960
- newValue: t,
1961
- oldValue: r,
1962
- field: i,
1963
- maxValue: e
1964
- }), "", "max")] : null);
2350
+ super((n, r) => {
2351
+ if (Z(n)) return null;
2352
+ let i = Pn(n, e);
2353
+ return i === void 0 || i > 0 ? [this.errorFor(t, "max_value", "Value must be less than or equal to {maxValue}", {
2354
+ newValue: n,
2355
+ oldValue: r,
2356
+ maxValue: e
2357
+ })] : null;
2358
+ });
1965
2359
  }
1966
- }, Bt = class extends R {
2360
+ }, zn = class extends M {
1967
2361
  constructor(e, t, n) {
1968
- let r = n || L("ValueInRange");
1969
- super((n, i, a) => n < e || n > t || n === void 0 ? [new F(this.replacePlaceholders(r, {
1970
- newValue: n,
1971
- oldValue: i,
1972
- field: a,
1973
- minValue: e,
1974
- maxValue: t
1975
- }), "", "range")] : null);
2362
+ super((r, i) => {
2363
+ if (Z(r)) return null;
2364
+ let a = Pn(r, e), o = Pn(r, t);
2365
+ return a === void 0 || o === void 0 || a < 0 || o > 0 ? [this.errorFor(n, "value_in_range", "Value must be between {minValue} and {maxValue}", {
2366
+ newValue: r,
2367
+ oldValue: i,
2368
+ minValue: e,
2369
+ maxValue: t
2370
+ })] : null;
2371
+ });
1976
2372
  }
1977
- };
1978
- //#endregion
1979
- //#region src/validators/validator-min-max-range-length.ts
1980
- function Vt(e) {
1981
- return e == null ? 0 : m(e) || _(e) ? e.length : te(e) && Object.getPrototypeOf(e) === Object.prototype ? Object.keys(e).length : String(e).length;
1982
- }
1983
- var Ht = class extends R {
2373
+ }, Bn = class extends M {
1984
2374
  constructor(e, t) {
1985
- let n = t || L("MinLength");
1986
- super((t, r, i) => Vt(t) < e ? [new F(this.replacePlaceholders(n, {
1987
- newValue: t,
2375
+ super((n, r) => Z(n) ? null : X(n) < e ? [this.errorFor(t, "min_length", "Length must be larger or equal to {minLength}", {
2376
+ newValue: n,
1988
2377
  oldValue: r,
1989
- field: i,
1990
2378
  minLength: e
1991
- }), "", "min-length")] : null);
2379
+ })] : null);
1992
2380
  }
1993
- }, Ut = class extends R {
2381
+ }, Vn = class extends M {
1994
2382
  constructor(e, t) {
1995
- let n = t || L("MaxLength");
1996
- super((t, r, i) => Vt(t) > e ? [new F(this.replacePlaceholders(n, {
1997
- newValue: t,
2383
+ super((n, r) => Z(n) ? null : X(n) > e ? [this.errorFor(t, "max_length", "Length must be less than or equal to {maxLength}", {
2384
+ newValue: n,
1998
2385
  oldValue: r,
1999
- field: i,
2000
2386
  maxLength: e
2001
- }), "", "max-length")] : null);
2387
+ })] : null);
2002
2388
  }
2003
- }, Wt = class extends R {
2389
+ }, Hn = class extends M {
2004
2390
  constructor(e, t, n) {
2005
- let r = n || L("LengthInRange");
2006
- super((n, i, a) => {
2007
- let o = Vt(n);
2008
- return o < e || o > t ? [new F(this.replacePlaceholders(r, {
2009
- newValue: n,
2391
+ super((r, i) => {
2392
+ if (Z(r)) return null;
2393
+ let a = X(r);
2394
+ return a < e || a > t ? [this.errorFor(n, "length_in_range", "Length must be between {minLength} and {maxLength}", {
2395
+ newValue: r,
2010
2396
  oldValue: i,
2011
- field: a,
2012
2397
  minLength: e,
2013
2398
  maxLength: t
2014
- }), "", "range-length")] : null;
2399
+ })] : null;
2015
2400
  });
2016
2401
  }
2017
- }, Gt = class extends R {
2402
+ }, Un = class extends M {
2018
2403
  constructor(e, t) {
2019
- let n = t || L("Pattern");
2020
- super((t, r, i) => e.test(String(f(t))) ? null : [new F(this.replacePlaceholders(n, {
2021
- newValue: t,
2022
- oldValue: r,
2023
- field: i,
2024
- pattern: e
2025
- }), "", "pattern")]);
2026
- }
2027
- }, Kt = /* @__PURE__ */ ae({
2028
- CompareTo: () => Nt,
2029
- InAllowedValues: () => Pt,
2030
- LengthInRange: () => Wt,
2031
- MaxLength: () => Ut,
2032
- MaxValue: () => zt,
2033
- MinLength: () => Ht,
2034
- MinValue: () => Rt,
2035
- Pattern: () => Gt,
2036
- Required: () => Lt,
2037
- Validator: () => R,
2038
- ValueInRange: () => Bt
2039
- }), qt = /* @__PURE__ */ new WeakMap(), Jt = /* @__PURE__ */ new WeakMap(), Yt = /* @__PURE__ */ new Set([
2404
+ let n = /[gy]/.test(e.flags) ? new RegExp(e.source, e.flags.replace(/[gy]/g, "")) : e;
2405
+ super((r, i) => {
2406
+ let a = f(r);
2407
+ return Z(a) || n.test(String(a)) ? null : [this.errorFor(t, "pattern", "Value must match pattern \"{pattern}\"", {
2408
+ newValue: r,
2409
+ oldValue: i,
2410
+ pattern: e
2411
+ })];
2412
+ });
2413
+ }
2414
+ }, Wn = /* @__PURE__ */ le({
2415
+ CompareTo: () => Nn,
2416
+ InAllowedValues: () => Fn,
2417
+ LengthInRange: () => Hn,
2418
+ MaxLength: () => Vn,
2419
+ MaxValue: () => Rn,
2420
+ MinLength: () => Bn,
2421
+ MinValue: () => Ln,
2422
+ Pattern: () => Un,
2423
+ Required: () => In,
2424
+ Validator: () => M,
2425
+ ValueInRange: () => zn,
2426
+ isEmptyValue: () => Z
2427
+ }), Gn = /* @__PURE__ */ new WeakMap(), Kn = /* @__PURE__ */ new WeakMap(), qn = /* @__PURE__ */ new Set([
2040
2428
  "push",
2041
2429
  "pop",
2042
2430
  "shift",
@@ -2047,19 +2435,19 @@ var Ht = class extends R {
2047
2435
  "fill",
2048
2436
  "copyWithin"
2049
2437
  ]);
2050
- function X(e) {
2438
+ function Jn(e) {
2051
2439
  return typeof e == "string" && /^(0|[1-9]\d*)$/.test(e);
2052
2440
  }
2053
- function Z(e) {
2054
- return typeof e == "object" && !!e && Jt.get(e) || e;
2055
- }
2056
2441
  function Q(e) {
2057
- return e instanceof J ? $(e) : e.value;
2442
+ return typeof e == "object" && !!e && Kn.get(e) || e;
2443
+ }
2444
+ function $(e) {
2445
+ return e instanceof J ? tr(e) : e.value;
2058
2446
  }
2059
- function Xt(e, t) {
2060
- e.value = Z(t) instanceof G ? Z(t).value : t;
2447
+ function Yn(e, t) {
2448
+ e.value = Q(t) instanceof B ? Q(t).value : t;
2061
2449
  }
2062
- function Zt(e) {
2450
+ function Xn(e) {
2063
2451
  return e === "__v_skip" ? {
2064
2452
  answered: !0,
2065
2453
  value: !0
@@ -2068,22 +2456,22 @@ function Zt(e) {
2068
2456
  value: void 0
2069
2457
  } : { answered: !1 };
2070
2458
  }
2071
- function Qt(e) {
2459
+ function Zn(e) {
2072
2460
  let t = (t) => typeof t == "string" && t !== "$" ? e.field(t) ?? void 0 : void 0, n = () => Object.keys(e.fields);
2073
2461
  return {
2074
2462
  get(n, r) {
2075
- let i = Zt(r);
2463
+ let i = Xn(r);
2076
2464
  if (i.answered) return i.value;
2077
2465
  if (r === "$") return e;
2078
2466
  if (r === Symbol.toStringTag) return "View";
2079
2467
  let a = t(r);
2080
- return a ? Q(a) : void 0;
2468
+ return a ? $(a) : void 0;
2081
2469
  },
2082
2470
  set(e, n, r) {
2083
2471
  if (n === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
2084
2472
  let i = t(n);
2085
- if (!i) throw TypeError(`${String(n)} is not a member of this group - use $addField() to add one`);
2086
- return Xt(i, r), !0;
2473
+ if (!i) throw TypeError(`${String(n)} is not a member of this group - use $.addField() to add one`);
2474
+ return Yn(i, r), !0;
2087
2475
  },
2088
2476
  has(e, t) {
2089
2477
  return t === "$" || typeof t == "string" && n().includes(t);
@@ -2093,64 +2481,56 @@ function Qt(e) {
2093
2481
  },
2094
2482
  getOwnPropertyDescriptor(t, r) {
2095
2483
  if (!(typeof r != "string" || !n().includes(r))) return {
2096
- value: Q(e.fields[r]),
2484
+ value: $(e.fields[r]),
2097
2485
  writable: !0,
2098
2486
  enumerable: !0,
2099
2487
  configurable: !0
2100
2488
  };
2101
2489
  },
2102
2490
  deleteProperty(e, t) {
2103
- throw TypeError(`${String(t)} cannot be deleted from a view - use $removeField() to take a member out`);
2491
+ throw TypeError(`${String(t)} cannot be deleted from a view - use $.removeField() to take a member out`);
2104
2492
  },
2105
2493
  defineProperty(e, t) {
2106
2494
  throw TypeError(`${String(t)} cannot be defined on a view`);
2107
2495
  }
2108
2496
  };
2109
2497
  }
2110
- function $t(e) {
2111
- let t = () => [...e.items], n = (n) => {
2112
- let r = t();
2113
- return n < r.length ? e.items.indexOf(r[n]) : e.length;
2114
- }, r = (e, t) => e < 0 ? Math.max(t + e, 0) : Math.min(e, t), i = (n) => k(() => {
2115
- let r = t(), i = e.items.map((e) => {
2116
- let t = r.indexOf(e);
2117
- return t === -1 ? e : n[t];
2118
- });
2119
- for (; e.length;) e.pop();
2120
- i.forEach((t) => e.push(t));
2498
+ function Qn(e) {
2499
+ let t = () => e.items, n = (t) => Math.min(t, e.length), r = (e, t) => e < 0 ? Math.max(t + e, 0) : Math.min(e, t), i = (t) => C(() => {
2500
+ e[ct](t);
2121
2501
  }), a = {
2122
- push: (...n) => (k(() => n.forEach((t) => e.push(Z(t)))), t().length),
2502
+ push: (...n) => (C(() => n.forEach((t) => e.push(Q(t)))), t().length),
2123
2503
  pop: () => {
2124
2504
  let n = t();
2125
2505
  if (!n.length) return;
2126
- let r = Q(n[n.length - 1]);
2506
+ let r = $(n[n.length - 1]);
2127
2507
  return e.remove(e.items.indexOf(n[n.length - 1])), r;
2128
2508
  },
2129
2509
  shift: () => {
2130
2510
  let n = t();
2131
2511
  if (!n.length) return;
2132
- let r = Q(n[0]);
2512
+ let r = $(n[0]);
2133
2513
  return e.remove(e.items.indexOf(n[0])), r;
2134
2514
  },
2135
- unshift: (...r) => (k(() => {
2515
+ unshift: (...r) => (C(() => {
2136
2516
  let t = n(0);
2137
- r.forEach((n, r) => e.insert(Z(n), t + r));
2517
+ r.forEach((n, r) => e.insert(Q(n), t + r));
2138
2518
  }), t().length),
2139
2519
  splice: (i, a, ...o) => {
2140
2520
  let s = [];
2141
- return k(() => {
2142
- let c = t(), l = r(Math.trunc(i) || 0, c.length), u = a === void 0 ? c.length - l : Math.max(0, Math.min(a, c.length - l));
2143
- c.slice(l, l + u).forEach((t) => {
2144
- s.push(Q(t)), e.remove(e.items.indexOf(t));
2521
+ return C(() => {
2522
+ let c = t(), l = r(Math.trunc(i) || 0, c.length), ee = a === void 0 ? c.length - l : Math.max(0, Math.min(a, c.length - l));
2523
+ c.slice(l, l + ee).forEach((t) => {
2524
+ s.push($(t)), e.remove(e.items.indexOf(t));
2145
2525
  });
2146
- let d = n(l);
2147
- o.forEach((t, n) => e.insert(Z(t), d + n));
2526
+ let u = n(l);
2527
+ o.forEach((t, n) => e.insert(Q(t), u + n));
2148
2528
  }), s;
2149
2529
  },
2150
2530
  sort: (e) => {
2151
2531
  let n = t().map((e) => ({
2152
2532
  row: e,
2153
- slot: Q(e)
2533
+ slot: $(e)
2154
2534
  })).sort((t, n) => {
2155
2535
  if (e) return e(t.slot, n.slot);
2156
2536
  let r = String(t.slot), i = String(n.slot);
@@ -2160,39 +2540,39 @@ function $t(e) {
2160
2540
  },
2161
2541
  reverse: () => (i([...t()].reverse()), o),
2162
2542
  fill: () => {
2163
- throw TypeError("fill() is not available on a list view - assign $value instead");
2543
+ throw TypeError("fill() is not available on a list view - assign $.value instead");
2164
2544
  },
2165
2545
  copyWithin: () => {
2166
- throw TypeError("copyWithin() is not available on a list view - assign $value instead");
2546
+ throw TypeError("copyWithin() is not available on a list view - assign $.value instead");
2167
2547
  }
2168
2548
  }, o;
2169
2549
  return o = new Proxy([], {
2170
2550
  get(n, r, i) {
2171
- let o = Zt(r);
2551
+ let o = Xn(r);
2172
2552
  if (o.answered) return o.value;
2173
2553
  if (r === "$") return e;
2174
2554
  if (r === "length") return t().length;
2175
- if (X(r)) {
2555
+ if (Jn(r)) {
2176
2556
  let e = t()[Number(r)];
2177
- return e ? Q(e) : void 0;
2557
+ return e ? $(e) : void 0;
2178
2558
  }
2179
- return typeof r == "string" && Yt.has(r) ? a[r] : Reflect.get(n, r, i);
2559
+ return typeof r == "string" && qn.has(r) ? a[r] : Reflect.get(n, r, i);
2180
2560
  },
2181
2561
  set(r, i, a) {
2182
2562
  if (i === "$") throw TypeError("$ is the element a view stands for, and cannot be replaced");
2183
2563
  if (i === "length") {
2184
2564
  let n = Number(a), r = t();
2185
2565
  if (n > r.length) throw TypeError("a list view grows by push(), not by its length");
2186
- return k(() => r.slice(n).forEach((t) => e.remove(e.items.indexOf(t)))), !0;
2566
+ return C(() => r.slice(n).forEach((t) => e.remove(e.items.indexOf(t)))), !0;
2187
2567
  }
2188
- if (X(i)) {
2568
+ if (Jn(i)) {
2189
2569
  let r = Number(i), o = t();
2190
- return r < o.length ? Xt(o[r], a) : e.insert(Z(a), n(o.length) + (r - o.length)), !0;
2570
+ return r < o.length ? Yn(o[r], a) : e.insert(Q(a), n(o.length) + (r - o.length)), !0;
2191
2571
  }
2192
2572
  throw TypeError(`${String(i)} cannot be set on a list view`);
2193
2573
  },
2194
2574
  has(e, n) {
2195
- return n === "$" || n === "length" ? !0 : X(n) ? Number(n) < t().length : Reflect.has(e, n);
2575
+ return n === "$" || n === "length" ? !0 : Jn(n) ? Number(n) < t().length : Reflect.has(e, n);
2196
2576
  },
2197
2577
  ownKeys() {
2198
2578
  return [...t().map((e, t) => String(t)), "length"];
@@ -2204,8 +2584,8 @@ function $t(e) {
2204
2584
  enumerable: !1,
2205
2585
  configurable: !1
2206
2586
  };
2207
- if (!(!X(n) || Number(n) >= t().length)) return {
2208
- value: Q(t()[Number(n)]),
2587
+ if (!(!Jn(n) || Number(n) >= t().length)) return {
2588
+ value: $(t()[Number(n)]),
2209
2589
  writable: !0,
2210
2590
  enumerable: !0,
2211
2591
  configurable: !0
@@ -2219,10 +2599,10 @@ function $t(e) {
2219
2599
  }
2220
2600
  }), o;
2221
2601
  }
2222
- function en(e) {
2602
+ function $n(e) {
2223
2603
  return {
2224
2604
  get(t, n) {
2225
- let r = Zt(n);
2605
+ let r = Xn(n);
2226
2606
  if (r.answered) return r.value;
2227
2607
  if (n === "$") return e;
2228
2608
  },
@@ -2237,72 +2617,74 @@ function en(e) {
2237
2617
  }
2238
2618
  };
2239
2619
  }
2240
- function tn(e) {
2620
+ function er(e) {
2241
2621
  Object.keys(e.fields).forEach((e) => {
2242
2622
  if (e === "$" || e === "then" || e.startsWith("__v_")) throw TypeError(`A view cannot hold a member named ${e}: $ is the element the view stands for, and then and __v_* are read by the language and by Vue`);
2243
2623
  });
2244
2624
  }
2245
- function $(e) {
2246
- if (Jt.has(e)) return e;
2247
- let t = qt.get(e);
2625
+ function tr(e) {
2626
+ if (Kn.has(e)) return e;
2627
+ let t = Gn.get(e);
2248
2628
  if (t) return t;
2249
2629
  let n;
2250
- return e instanceof Y ? (tn(e), n = new Proxy({}, Qt(e))) : n = e instanceof Mt ? $t(e) : new Proxy({}, en(e)), qt.set(e, n), Jt.set(n, e), n;
2630
+ return e instanceof Y ? (er(e), n = new Proxy({}, Zn(e))) : n = e instanceof Tn ? Qn(e) : new Proxy({}, $n(e)), Gn.set(e, n), Kn.set(n, e), n;
2251
2631
  }
2252
2632
  //#endregion
2253
2633
  //#region src/index.ts
2254
- var nn = /* @__PURE__ */ ae({
2255
- AbortEventHandlingException: () => C,
2256
- AccessChangedAction: () => Ue,
2257
- AccessChangingAction: () => Ve,
2258
- Action: () => xt,
2259
- ActionsMap: () => Ae,
2260
- ConditionalAccessAction: () => Re,
2261
- ConditionalStatementAction: () => B,
2262
- ConditionalValueAction: () => ze,
2263
- ConditionalVisibilityAction: () => Le,
2634
+ var nr = /* @__PURE__ */ le({
2635
+ AbortEventHandlingException: () => E,
2636
+ AccessChangedAction: () => Ut,
2637
+ AccessChangingAction: () => Vt,
2638
+ Action: () => xn,
2639
+ ActionsMap: () => At,
2640
+ CommandException: () => U,
2641
+ ConditionalAccessAction: () => Rt,
2642
+ ConditionalStatementAction: () => P,
2643
+ ConditionalValueAction: () => zt,
2644
+ ConditionalVisibilityAction: () => Lt,
2264
2645
  Container: () => J,
2265
- ContributionChangedAction: () => U,
2266
- EnabledChangedAction: () => Je,
2267
- EnabledChangingAction: () => Ke,
2268
- ExecuteAction: () => lt,
2646
+ ContributionChangedAction: () => Gt,
2647
+ EnabledChangedAction: () => Yt,
2648
+ EnabledChangingAction: () => qt,
2649
+ ErrorPolicy: () => A,
2650
+ ExecuteAction: () => V,
2269
2651
  Field: () => q,
2270
- FieldActionBase: () => S,
2271
- FieldBase: () => G,
2652
+ FieldActionBase: () => T,
2653
+ FieldBase: () => B,
2272
2654
  Group: () => Y,
2273
- List: () => Mt,
2274
- ListItemAddedAction: () => K,
2275
- ListItemRemovedAction: () => ft,
2276
- MdString: () => j,
2277
- MessagesWidget: () => St,
2278
- Operator: () => H,
2279
- RenderableValue: () => we,
2280
- Statement: () => st,
2281
- ValidChangedAction: () => Xe,
2282
- ValidationError: () => P,
2283
- ValidationErrorRenderContent: () => F,
2284
- ValidationErrorText: () => Ce,
2285
- Validators: () => Kt,
2286
- ValueChangedAction: () => T,
2287
- VisibilityChangedAction: () => et,
2288
- VisibilityChangingAction: () => Qe,
2289
- accessValues: () => v,
2290
- buildErrorMessage: () => I,
2291
- defaultAccess: () => oe,
2292
- defaultVisibility: () => b,
2293
- isAccess: () => se,
2294
- isCallableFunction: () => N,
2295
- isEqual: () => At,
2296
- isSimpleComponentDef: () => M,
2297
- isVisibility: () => x,
2298
- strings: () => Ee,
2299
- transaction: () => k,
2300
- translateStrings: () => De,
2301
- translatedMessage: () => L,
2302
- view: () => $,
2303
- visibilityValues: () => y
2655
+ List: () => Tn,
2656
+ ListItemAddedAction: () => G,
2657
+ ListItemRemovedAction: () => K,
2658
+ Operator: () => I,
2659
+ RejectAction: () => gn,
2660
+ Statement: () => dn,
2661
+ SubmitAction: () => hn,
2662
+ SubmitFailedException: () => mn,
2663
+ SubmitRefusedException: () => W,
2664
+ TargetedExecuteAction: () => H,
2665
+ ValidChangedAction: () => Zt,
2666
+ ValidationError: () => Dt,
2667
+ Validators: () => Wn,
2668
+ ValueChangedAction: () => j,
2669
+ VisibilityChangedAction: () => tn,
2670
+ VisibilityChangingAction: () => $t,
2671
+ accessValues: () => g,
2672
+ configureDevtools: () => Ce,
2673
+ defaultAccess: () => ue,
2674
+ defaultVisibility: () => fe,
2675
+ describeState: () => xe,
2676
+ errorRemovals: () => pt,
2677
+ hideState: () => Se,
2678
+ installPlugin: () => Pe,
2679
+ isAccess: () => de,
2680
+ isEqual: () => Mn,
2681
+ isVisibility: () => pe,
2682
+ setDefaultErrorPolicies: () => St,
2683
+ transaction: () => C,
2684
+ view: () => tr,
2685
+ visibilityValues: () => _
2304
2686
  });
2305
2687
  //#endregion
2306
- export { C as AbortEventHandlingException, Ue as AccessChangedAction, Ve as AccessChangingAction, xt as Action, Ae as ActionsMap, Re as ConditionalAccessAction, B as ConditionalStatementAction, ze as ConditionalValueAction, Le as ConditionalVisibilityAction, J as Container, U as ContributionChangedAction, Je as EnabledChangedAction, Ke as EnabledChangingAction, lt as ExecuteAction, q as Field, S as FieldActionBase, G as FieldBase, Y as Group, Mt as List, K as ListItemAddedAction, ft as ListItemRemovedAction, j as MdString, St as MessagesWidget, H as Operator, we as RenderableValue, st as Statement, Xe as ValidChangedAction, P as ValidationError, F as ValidationErrorRenderContent, Ce as ValidationErrorText, Kt as Validators, T as ValueChangedAction, et as VisibilityChangedAction, Qe as VisibilityChangingAction, v as accessValues, I as buildErrorMessage, nn as default, oe as defaultAccess, b as defaultVisibility, Se as forms, be as getConfig, se as isAccess, N as isCallableFunction, At as isEqual, M as isSimpleComponentDef, x as isVisibility, xe as setConfig, Ee as strings, k as transaction, De as translateStrings, L as translatedMessage, $ as view, y as visibilityValues };
2688
+ export { E as AbortEventHandlingException, Ut as AccessChangedAction, Vt as AccessChangingAction, xn as Action, At as ActionsMap, U as CommandException, Rt as ConditionalAccessAction, P as ConditionalStatementAction, zt as ConditionalValueAction, Lt as ConditionalVisibilityAction, J as Container, Gt as ContributionChangedAction, Yt as EnabledChangedAction, qt as EnabledChangingAction, A as ErrorPolicy, V as ExecuteAction, q as Field, T as FieldActionBase, B as FieldBase, Y as Group, Tn as List, G as ListItemAddedAction, K as ListItemRemovedAction, I as Operator, gn as RejectAction, dn as Statement, hn as SubmitAction, mn as SubmitFailedException, W as SubmitRefusedException, H as TargetedExecuteAction, Zt as ValidChangedAction, Dt as ValidationError, Wn as Validators, j as ValueChangedAction, tn as VisibilityChangedAction, $t as VisibilityChangingAction, g as accessValues, Ce as configureDevtools, nr as default, ue as defaultAccess, fe as defaultVisibility, xe as describeState, pt as errorRemovals, Se as hideState, Pe as installPlugin, de as isAccess, Mn as isEqual, pe as isVisibility, St as setDefaultErrorPolicies, C as transaction, tr as view, _ as visibilityValues };
2307
2689
 
2308
2690
  //# sourceMappingURL=dynamicforms-vue-forms.js.map