@dynamicforms/vue-forms 0.6.0 → 0.6.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,51 +1,51 @@
1
- var de = Object.defineProperty, ge = Object.defineProperties;
2
- var fe = Object.getOwnPropertyDescriptors;
3
- var P = Object.getOwnPropertySymbols;
4
- var J = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
5
- var q = (i, s, e) => s in i ? de(i, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[s] = e, y = (i, s) => {
6
- for (var e in s || (s = {}))
7
- J.call(s, e) && q(i, e, s[e]);
8
- if (P)
9
- for (var e of P(s))
10
- K.call(s, e) && q(i, e, s[e]);
11
- return i;
12
- }, R = (i, s) => ge(i, fe(s));
13
- var I = (i, s) => {
14
- var e = {};
15
- for (var t in i)
16
- J.call(i, t) && s.indexOf(t) < 0 && (e[t] = i[t]);
17
- if (i != null && P)
18
- for (var t of P(i))
19
- s.indexOf(t) < 0 && K.call(i, t) && (e[t] = i[t]);
20
- return e;
1
+ var bt = Object.defineProperty, vt = Object.defineProperties;
2
+ var yt = Object.getOwnPropertyDescriptors;
3
+ var U = Object.getOwnPropertySymbols;
4
+ var et = Object.prototype.hasOwnProperty, it = Object.prototype.propertyIsEnumerable;
5
+ var q = (n, i, t) => i in n ? bt(n, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[i] = t, v = (n, i) => {
6
+ for (var t in i || (i = {}))
7
+ et.call(i, t) && q(n, t, i[t]);
8
+ if (U)
9
+ for (var t of U(i))
10
+ it.call(i, t) && q(n, t, i[t]);
11
+ return n;
12
+ }, w = (n, i) => vt(n, yt(i));
13
+ var F = (n, i) => {
14
+ var t = {};
15
+ for (var e in n)
16
+ et.call(n, e) && i.indexOf(e) < 0 && (t[e] = n[e]);
17
+ if (n != null && U)
18
+ for (var e of U(n))
19
+ i.indexOf(e) < 0 && it.call(n, e) && (t[e] = n[e]);
20
+ return t;
21
21
  };
22
- var o = (i, s, e) => q(i, typeof s != "symbol" ? s + "" : s, e);
23
- import { isEqual as k, isBoolean as pe, isString as V, isEmpty as H, truncate as be, isArray as te, isObject as se } from "lodash-es";
24
- import { unref as g, computed as me, reactive as ve, defineComponent as ye, resolveComponent as Z, openBlock as xe, createBlock as Ee, h as S } from "vue";
25
- var F = /* @__PURE__ */ ((i) => (i[i.SUPPRESS = 1] = "SUPPRESS", i[i.HIDDEN = 5] = "HIDDEN", i[i.INVISIBLE = 8] = "INVISIBLE", i[i.FULL = 10] = "FULL", i))(F || {});
26
- const ee = 10;
27
- ((i) => {
28
- function s(n) {
29
- return n.toUpperCase() === "SUPPRESS" ? 1 : n.toUpperCase() === "HIDDEN" ? 5 : n.toUpperCase() === "INVISIBLE" ? 8 : ee;
30
- }
31
- i.fromString = s;
32
- function e(n) {
33
- const r = typeof n == "number" ? n : i.fromString(n);
34
- return Object.values(i).includes(r) ? r : ee;
35
- }
36
- i.fromAny = e;
37
- function t(n) {
38
- const r = typeof n == "number" ? n : i.fromString(n);
39
- return Object.values(i).includes(r);
40
- }
41
- i.isDefined = t;
42
- })(F || (F = {}));
43
- Object.freeze(F);
44
- const C = F;
45
- class b {
46
- constructor(s) {
22
+ var o = (n, i, t) => q(n, typeof i != "symbol" ? i + "" : i, t);
23
+ import { isEqual as D, isBoolean as Vt, isString as A, isEmpty as Q, truncate as Ct, isArray as rt, isObject as at } from "lodash-es";
24
+ import { unref as h, computed as xt, isRef as _t, reactive as Et, defineComponent as It, resolveComponent as st, openBlock as At, createBlock as St, h as j } from "vue";
25
+ var T = /* @__PURE__ */ ((n) => (n[n.SUPPRESS = 1] = "SUPPRESS", n[n.HIDDEN = 5] = "HIDDEN", n[n.INVISIBLE = 8] = "INVISIBLE", n[n.FULL = 10] = "FULL", n))(T || {});
26
+ const nt = 10;
27
+ ((n) => {
28
+ function i(s) {
29
+ return s.toUpperCase() === "SUPPRESS" ? 1 : s.toUpperCase() === "HIDDEN" ? 5 : s.toUpperCase() === "INVISIBLE" ? 8 : nt;
30
+ }
31
+ n.fromString = i;
32
+ function t(s) {
33
+ const r = typeof s == "number" ? s : n.fromString(s);
34
+ return Object.values(n).includes(r) ? r : nt;
35
+ }
36
+ n.fromAny = t;
37
+ function e(s) {
38
+ const r = typeof s == "number" ? s : n.fromString(s);
39
+ return Object.values(n).includes(r);
40
+ }
41
+ n.isDefined = e;
42
+ })(T || (T = {}));
43
+ Object.freeze(T);
44
+ const S = T;
45
+ class m {
46
+ constructor(i) {
47
47
  o(this, "executorFn");
48
- this.executorFn = s;
48
+ this.executorFn = i;
49
49
  }
50
50
  static get classIdentifier() {
51
51
  throw new Error("classIdentifier must be declared");
@@ -53,48 +53,60 @@ class b {
53
53
  get classIdentifier() {
54
54
  return this.constructor.classIdentifier;
55
55
  }
56
- execute(s, e, ...t) {
57
- return this.executorFn(s, e, ...t);
56
+ execute(i, t, ...e) {
57
+ return this.executorFn(i, t, ...e);
58
58
  }
59
59
  get eager() {
60
60
  return !1;
61
61
  }
62
62
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
63
- boundToField(s) {
63
+ boundToField(i) {
64
64
  }
65
65
  unregister() {
66
66
  }
67
67
  }
68
- class Q extends Error {
68
+ class W extends Error {
69
69
  }
70
- const ne = /* @__PURE__ */ Symbol("ValueChangedAction");
71
- class m extends b {
72
- constructor(s) {
73
- super(s);
70
+ const lt = /* @__PURE__ */ Symbol("ValueChangedAction");
71
+ class y extends m {
72
+ constructor(i) {
73
+ super(i);
74
74
  }
75
75
  static get classIdentifier() {
76
- return ne;
76
+ return lt;
77
77
  }
78
- execute(s, e, t, n) {
79
- return super.execute(s, e, t, n);
78
+ execute(i, t, e, s) {
79
+ return super.execute(i, t, e, s);
80
80
  }
81
81
  }
82
- class j extends String {
83
- constructor(e, t, n) {
84
- super(e);
82
+ const ot = { useMarkdownInValidators: !0 };
83
+ function Pt() {
84
+ return ot;
85
+ }
86
+ function wt(n) {
87
+ Object.assign(ot, n);
88
+ }
89
+ const he = {
90
+ install(n, i) {
91
+ i && wt(i);
92
+ }
93
+ };
94
+ class O extends String {
95
+ constructor(t, e, s) {
96
+ super(t);
85
97
  o(this, "plugins");
86
98
  o(this, "options");
87
- this.plugins = n, this.options = t;
99
+ this.plugins = s, this.options = e;
88
100
  }
89
101
  }
90
- function W(i) {
91
- const s = g(i);
92
- return typeof s == "object" && "componentName" in s;
102
+ function X(n) {
103
+ const i = h(n);
104
+ return typeof i == "object" && "componentName" in i;
93
105
  }
94
- function U(i) {
95
- return typeof g(i) == "function";
106
+ function k(n) {
107
+ return typeof h(n) == "function";
96
108
  }
97
- class X {
109
+ class G {
98
110
  get componentName() {
99
111
  return "Comment";
100
112
  }
@@ -108,12 +120,12 @@ class X {
108
120
  return "";
109
121
  }
110
122
  }
111
- class _e extends X {
112
- constructor(e, t = "") {
123
+ class Ft extends G {
124
+ constructor(t, e = "") {
113
125
  super();
114
126
  o(this, "text");
115
127
  o(this, "classes");
116
- this.text = e, this.classes = t;
128
+ this.text = t, this.classes = e;
117
129
  }
118
130
  get componentName() {
119
131
  return "template";
@@ -125,24 +137,24 @@ class _e extends X {
125
137
  return this.classes;
126
138
  }
127
139
  }
128
- class p extends X {
129
- constructor(e, t = "") {
140
+ class g extends G {
141
+ constructor(t, e = "") {
130
142
  super();
131
143
  o(this, "classes");
132
144
  o(this, "text");
133
145
  o(this, "textType");
134
- this.classes = t, this.text = e, this.textType = me(() => this.getTextType);
146
+ this.classes = e, this.text = t, this.textType = xt(() => this.getTextType);
135
147
  }
136
148
  get resolvedText() {
137
- const e = g(this.text);
138
- return U(e) ? e() : e;
149
+ const t = h(this.text);
150
+ return k(t) ? t() : t;
139
151
  }
140
152
  get getTextType() {
141
- const e = this.resolvedText;
142
- return e ? e instanceof j ? "md" : W(e) ? "component" : "string" : "string";
153
+ const t = this.resolvedText;
154
+ return t ? t instanceof O ? "md" : X(t) ? "component" : "string" : "string";
143
155
  }
144
156
  get componentName() {
145
- switch (g(this.textType)) {
157
+ switch (h(this.textType)) {
146
158
  case "string":
147
159
  return "template";
148
160
  case "md":
@@ -154,12 +166,12 @@ class p extends X {
154
166
  }
155
167
  }
156
168
  get componentBindings() {
157
- switch (g(this.textType)) {
169
+ switch (h(this.textType)) {
158
170
  case "string":
159
171
  return {};
160
172
  case "md": {
161
- const e = this.resolvedText;
162
- return { source: e.toString(), options: e.options, plugins: e.plugins };
173
+ const t = this.resolvedText;
174
+ return { source: t.toString(), options: t.options, plugins: t.plugins };
163
175
  }
164
176
  case "component":
165
177
  return this.resolvedText.componentProps || {};
@@ -168,7 +180,7 @@ class p extends X {
168
180
  }
169
181
  }
170
182
  get componentBody() {
171
- switch (g(this.textType)) {
183
+ switch (h(this.textType)) {
172
184
  case "string":
173
185
  return this.resolvedText;
174
186
  case "component":
@@ -181,158 +193,195 @@ class p extends X {
181
193
  return this.classes;
182
194
  }
183
195
  }
184
- class Ve extends p {
196
+ class jt extends g {
197
+ }
198
+ function b(n) {
199
+ return Pt().useMarkdownInValidators ? new O(n) : n.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, `
200
+ `);
185
201
  }
186
- const Ce = /* @__PURE__ */ Symbol("Validator");
187
- class f extends m {
202
+ const Nt = /* @__PURE__ */ Symbol("Validator"), Tt = () => b("Validation could not be completed");
203
+ class f extends y {
188
204
  /**
189
205
  * Creates a new validator
190
206
  * @param validationFn Function that validates the field value and returns errors or null
191
207
  */
192
- constructor(e) {
193
- super((n, r, a, l) => {
194
- const c = e(a, l, n) || [], u = (h) => {
195
- var A;
196
- h == null || h.forEach(
197
- (E) => Object.defineProperty(E, "source", { value: this.source, enumerable: !1, configurable: !1 })
198
- );
199
- for (let E = n.errors.length - 1; E >= 0; E--) {
200
- const L = n.errors[E];
201
- if (L.source === this.source) {
202
- const O = (A = h == null ? void 0 : h.findIndex(($) => k($, L))) != null ? A : -1;
203
- O >= 0 ? h == null || h.splice(O, 1) : n.errors.splice(E, 1);
208
+ constructor(t) {
209
+ super((s, r, a, l) => {
210
+ var B;
211
+ const u = ((B = this.runs.get(s)) != null ? B : 0) + 1;
212
+ this.runs.set(s, u);
213
+ const d = s.validationEpoch, x = () => this.runs.get(s) === u && s.validationEpoch === d, _ = t(a, l, s) || [], P = (p) => {
214
+ var K;
215
+ const E = (K = p == null ? void 0 : p.map((I) => this.claim(I))) != null ? K : [];
216
+ for (let I = s.errors.length - 1; I >= 0; I--) {
217
+ const Z = s.errors[I];
218
+ if (Z.source === this.source) {
219
+ const tt = E.findIndex((mt) => D(mt, Z));
220
+ tt >= 0 ? E.splice(tt, 1) : s.errors.splice(I, 1);
204
221
  }
205
222
  }
206
- h && h.length > 0 && n.errors.push(...h), n.validate();
223
+ E.length > 0 && s.errors.push(...E), s.validate();
207
224
  };
208
- return c instanceof Promise ? (n.beginValidating(), c.then((h) => u(h)).finally(() => n.endValidating())) : u(c), r(n, a, l);
225
+ return _ instanceof Promise ? (s.beginValidating(), _.then(
226
+ (p) => {
227
+ x() && P(p);
228
+ },
229
+ (p) => {
230
+ x() && (P([new g(Tt())]), console.error("Validation failed", p));
231
+ }
232
+ ).finally(() => s.endValidating()).catch((p) => console.error("Validation failed", p))) : P(_), r(s, a, l);
209
233
  });
210
234
  o(this, "source");
235
+ /**
236
+ * Sequence number of the newest run of this validator, per field. Every execution takes the next number, and a
237
+ * result is applied only while its number is still the newest one, so a slow run cannot overwrite the verdict of
238
+ * a faster one that started after it. The key is the field because one validator instance may be registered on
239
+ * several fields, each with a sequence of its own.
240
+ */
241
+ o(this, "runs", /* @__PURE__ */ new WeakMap());
211
242
  this.source = Symbol(this.constructor.name);
212
243
  }
244
+ /**
245
+ * Returns the error instance this validator owns and may later withdraw: the argument itself when it carries no
246
+ * ownership stamp or already carries this validator's, a copy of it when it belongs to another validator. The
247
+ * stamp is not configurable, so an instance one validator owns can never be reassigned to another; the copy is
248
+ * what makes an error instance shareable between validators, and it keeps the prototype and every own property,
249
+ * including the non-enumerable ones, so it renders exactly like the instance it was made from.
250
+ */
251
+ claim(t) {
252
+ const e = t.source;
253
+ if (e === this.source) return t;
254
+ const s = { value: this.source, enumerable: !1, configurable: !1 };
255
+ if (e === void 0)
256
+ return Object.defineProperty(t, "source", s), t;
257
+ const r = Object.getOwnPropertyDescriptors(t);
258
+ return Object.create(Object.getPrototypeOf(t), w(v({}, r), { source: s }));
259
+ }
213
260
  static get classIdentifier() {
214
- return Ce;
261
+ return Nt;
215
262
  }
216
263
  get eager() {
217
264
  return !0;
218
265
  }
219
- replacePlaceholdersFunction(e, t) {
266
+ replacePlaceholdersFunction(t, e) {
220
267
  return () => {
221
- let n = g(e);
222
- for (; U(n); )
223
- n = g(this.replacePlaceholders(n(), t));
224
- return n;
268
+ let s = h(t);
269
+ for (; k(s); )
270
+ s = h(this.replacePlaceholders(s(), e));
271
+ return s;
225
272
  };
226
273
  }
227
- replacePlaceholders(e, t) {
228
- if (U(e)) return this.replacePlaceholdersFunction(e, t);
229
- if (W(e)) return e;
230
- let n = g(e);
231
- return Object.keys(t).forEach((r) => {
232
- n = n.replaceAll(`{${r}}`, t[r]);
233
- }), e instanceof j ? new j(n.toString(), e.options, e.plugins) : n;
274
+ replacePlaceholders(t, e) {
275
+ if (k(t)) return this.replacePlaceholdersFunction(t, e);
276
+ if (X(t)) return t;
277
+ if (_t(t))
278
+ return this.replacePlaceholdersFunction(() => h(t), e);
279
+ let s = h(t);
280
+ return Object.keys(e).forEach((r) => {
281
+ s = s.replaceAll(`{${r}}`, e[r]);
282
+ }), t instanceof O ? new O(s.toString(), t.options, t.plugins) : s;
234
283
  }
235
284
  }
236
- class N extends Map {
285
+ class L extends Map {
237
286
  constructor() {
238
287
  super(...arguments);
239
288
  o(this, "eagerActions", /* @__PURE__ */ new Set());
240
289
  o(this, "registeredActions", []);
241
290
  }
242
- register(e) {
243
- if (!(e instanceof b)) throw new Error("Invalid action type");
244
- this.registeredActions.push(e);
245
- const t = e.classIdentifier, n = this.get(t) || (() => null);
291
+ register(t) {
292
+ if (!(t instanceof m)) throw new Error("Invalid action type");
293
+ this.registeredActions.push(t);
294
+ const e = t.classIdentifier, s = this.get(e) || (() => null);
246
295
  function r(a, ...l) {
247
- return e.execute(a, n, ...l);
296
+ return t.execute(a, s, ...l);
248
297
  }
249
- this.set(t, r), e.eager && this.eagerActions.add(e.classIdentifier);
298
+ this.set(e, r), t.eager && this.eagerActions.add(t.classIdentifier);
250
299
  }
251
- trigger(e, t, ...n) {
252
- const r = e.classIdentifier;
253
- r === ne && this.triggerEager(t, ...n);
300
+ trigger(t, e, ...s) {
301
+ const r = t.classIdentifier;
302
+ r === lt && this.triggerEager(e, ...s);
254
303
  const a = this.get(r);
255
304
  try {
256
- if (a) return a(t, ...n);
305
+ if (a) return a(e, ...s);
257
306
  } catch (l) {
258
- if (!(l instanceof Q)) throw l;
307
+ if (!(l instanceof W)) throw l;
259
308
  }
260
309
  return null;
261
310
  }
262
- triggerEager(e, ...t) {
263
- for (const n of this.eagerActions) {
264
- const r = this.get(n);
311
+ triggerEager(t, ...e) {
312
+ for (const s of this.eagerActions) {
313
+ const r = this.get(s);
265
314
  try {
266
- r && r(e, ...t);
315
+ r && r(t, ...e);
267
316
  } catch (a) {
268
- if (!(a instanceof Q)) throw a;
317
+ if (!(a instanceof W)) throw a;
269
318
  }
270
319
  }
271
320
  }
272
321
  clone() {
273
- const e = new N();
274
- return this.registeredActions.forEach((t) => e.register(t)), e;
322
+ const t = new L();
323
+ return this.registeredActions.forEach((e) => t.register(e)), t;
275
324
  }
276
325
  cloneWithoutValidators() {
277
- const e = new N();
278
- return this.registeredActions.forEach((t) => {
279
- t instanceof f ? t.unregister() : e.register(t);
280
- }), e;
326
+ const t = new L();
327
+ return this.registeredActions.forEach((e) => {
328
+ e instanceof f ? e.unregister() : t.register(e);
329
+ }), t;
281
330
  }
282
331
  }
283
- const Ae = /* @__PURE__ */ Symbol("ConditionalStatementAction");
284
- class B extends m {
285
- constructor(e, t) {
286
- const n = (r, a, l, c) => {
287
- const u = e.evaluate();
288
- if (u !== this.lastResult) {
289
- for (const h of this.boundFields)
290
- t(h, u, this.lastResult);
291
- this.lastResult = u;
332
+ const Ot = /* @__PURE__ */ Symbol("ConditionalStatementAction");
333
+ class M extends y {
334
+ constructor(t, e) {
335
+ const s = (r, a, l, u) => {
336
+ const d = t.evaluate();
337
+ if (d !== this.lastResult) {
338
+ for (const x of this.boundFields)
339
+ e(x, d, this.lastResult);
340
+ this.lastResult = d;
292
341
  }
293
- return a(r, l, c);
342
+ return a(r, l, u);
294
343
  };
295
- super(n);
344
+ super(s);
296
345
  o(this, "lastResult");
297
346
  // boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the
298
347
  // ValueChangedAction fields that will call the actionExecutor
299
348
  o(this, "boundFields", /* @__PURE__ */ new Set());
300
- e.collectFields().forEach((r) => r.registerAction(new m(n)));
349
+ t.collectFields().forEach((r) => r.registerAction(new y(s)));
301
350
  }
302
351
  static get classIdentifier() {
303
- return Ae;
352
+ return Ot;
304
353
  }
305
354
  get eager() {
306
355
  return !0;
307
356
  }
308
- boundToField(e) {
309
- this.boundFields.add(e);
357
+ boundToField(t) {
358
+ this.boundFields.add(t);
310
359
  }
311
360
  }
312
- class Ie extends B {
313
- constructor(s) {
314
- super(s, (e, t) => {
315
- e.visibility = t ? C.FULL : C.SUPPRESS;
361
+ class Lt extends M {
362
+ constructor(i) {
363
+ super(i, (t, e) => {
364
+ t.visibility = e ? S.FULL : S.SUPPRESS;
316
365
  });
317
366
  }
318
367
  }
319
- class Se extends B {
320
- constructor(s) {
321
- super(s, (e, t) => {
322
- e.enabled = t;
368
+ class Rt extends M {
369
+ constructor(i) {
370
+ super(i, (t, e) => {
371
+ t.enabled = e;
323
372
  });
324
373
  }
325
374
  }
326
- class we extends B {
327
- constructor(s, e) {
328
- super(s, (t, n) => {
329
- n && (t.value = e);
375
+ class Bt extends M {
376
+ constructor(i, t) {
377
+ super(i, (e, s) => {
378
+ s && (e.value = t);
330
379
  });
331
380
  }
332
381
  }
333
- var T = /* @__PURE__ */ ((i) => (i[i.NOT = 0] = "NOT", i[i.OR = 1] = "OR", i[i.AND = 2] = "AND", i[i.XOR = 3] = "XOR", i[i.NAND = 4] = "NAND", i[i.NOR = 5] = "NOR", i[i.EQUALS = -1] = "EQUALS", i[i.NOT_EQUALS = -2] = "NOT_EQUALS", i[i.GT = -3] = "GT", i[i.LT = -4] = "LT", i[i.GE = -5] = "GE", i[i.LE = -6] = "LE", i[i.IN = -7] = "IN", i[i.NOT_IN = -8] = "NOT_IN", i[i.INCLUDES = -9] = "INCLUDES", i[i.NOT_INCLUDES = -10] = "NOT_INCLUDES", i))(T || {});
334
- ((i) => {
335
- function s(r) {
382
+ var R = /* @__PURE__ */ ((n) => (n[n.NOT = 0] = "NOT", n[n.OR = 1] = "OR", n[n.AND = 2] = "AND", n[n.XOR = 3] = "XOR", n[n.NAND = 4] = "NAND", n[n.NOR = 5] = "NOR", n[n.EQUALS = -1] = "EQUALS", n[n.NOT_EQUALS = -2] = "NOT_EQUALS", n[n.GT = -3] = "GT", n[n.LT = -4] = "LT", n[n.GE = -5] = "GE", n[n.LE = -6] = "LE", n[n.IN = -7] = "IN", n[n.NOT_IN = -8] = "NOT_IN", n[n.INCLUDES = -9] = "INCLUDES", n[n.NOT_INCLUDES = -10] = "NOT_INCLUDES", n))(R || {});
383
+ ((n) => {
384
+ function i(r) {
336
385
  const a = r.toLowerCase();
337
386
  if (a === "not") return 0;
338
387
  if (a === "or") return 1;
@@ -352,85 +401,85 @@ var T = /* @__PURE__ */ ((i) => (i[i.NOT = 0] = "NOT", i[i.OR = 1] = "OR", i[i.A
352
401
  if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
353
402
  throw new Error(`Unrecognised operator ${a}`);
354
403
  }
355
- i.fromString = s;
356
- function e(r) {
357
- const a = typeof r == "number" ? r : i.fromString(r);
358
- if (Object.values(i).includes(a)) return a;
404
+ n.fromString = i;
405
+ function t(r) {
406
+ const a = typeof r == "number" ? r : n.fromString(r);
407
+ if (Object.values(n).includes(a)) return a;
359
408
  throw new Error(`Unrecognised operator ${r}`);
360
409
  }
361
- i.fromAny = e;
362
- function t(r) {
363
- const a = typeof r == "number" ? r : i.fromString(r);
364
- return Object.values(i).includes(a);
410
+ n.fromAny = t;
411
+ function e(r) {
412
+ const a = typeof r == "number" ? r : n.fromString(r);
413
+ return Object.values(n).includes(a);
365
414
  }
366
- i.isDefined = t;
367
- function n(r) {
415
+ n.isDefined = e;
416
+ function s(r) {
368
417
  return r >= 0;
369
418
  }
370
- i.isLogicOperator = n;
371
- })(T || (T = {}));
372
- Object.freeze(T);
373
- const d = T, Fe = /* @__PURE__ */ Symbol("EnabledChangingAction");
374
- class ie extends b {
375
- constructor(s) {
376
- super(s);
419
+ n.isLogicOperator = s;
420
+ })(R || (R = {}));
421
+ Object.freeze(R);
422
+ const c = R, Ut = /* @__PURE__ */ Symbol("EnabledChangingAction");
423
+ class ut extends m {
424
+ constructor(i) {
425
+ super(i);
377
426
  }
378
427
  static get classIdentifier() {
379
- return Fe;
428
+ return Ut;
380
429
  }
381
- execute(s, e, t, n) {
382
- return super.execute(s, e, t, n);
430
+ execute(i, t, e, s) {
431
+ return super.execute(i, t, e, s);
383
432
  }
384
433
  }
385
- const je = /* @__PURE__ */ Symbol("EnabledChangedAction");
386
- class re extends b {
387
- constructor(s) {
388
- super(s);
434
+ const kt = /* @__PURE__ */ Symbol("EnabledChangedAction");
435
+ class ct extends m {
436
+ constructor(i) {
437
+ super(i);
389
438
  }
390
439
  static get classIdentifier() {
391
- return je;
440
+ return kt;
392
441
  }
393
- execute(s, e, t, n) {
394
- return super.execute(s, e, t, n);
442
+ execute(i, t, e, s) {
443
+ return super.execute(i, t, e, s);
395
444
  }
396
445
  }
397
- const Ne = /* @__PURE__ */ Symbol("ValidChangedAction");
398
- class ae extends b {
399
- constructor(s) {
400
- super(s);
446
+ const Dt = /* @__PURE__ */ Symbol("ValidChangedAction");
447
+ class ht extends m {
448
+ constructor(i) {
449
+ super(i);
401
450
  }
402
451
  static get classIdentifier() {
403
- return Ne;
452
+ return Dt;
404
453
  }
405
- execute(s, e, t, n) {
406
- return super.execute(s, e, t, n);
454
+ execute(i, t, e, s) {
455
+ return super.execute(i, t, e, s);
407
456
  }
408
457
  }
409
- const Te = /* @__PURE__ */ Symbol("VisibilityChangingAction");
410
- class le extends b {
411
- constructor(s) {
412
- super(s);
458
+ const Mt = /* @__PURE__ */ Symbol("VisibilityChangingAction");
459
+ class dt extends m {
460
+ constructor(i) {
461
+ super(i);
413
462
  }
414
463
  static get classIdentifier() {
415
- return Te;
464
+ return Mt;
416
465
  }
417
- execute(s, e, t, n) {
418
- return super.execute(s, e, t, n);
466
+ execute(i, t, e, s) {
467
+ return super.execute(i, t, e, s);
419
468
  }
420
469
  }
421
- const Le = /* @__PURE__ */ Symbol("VisibilityChangedAction");
422
- class oe extends b {
423
- constructor(s) {
424
- super(s);
470
+ const $t = /* @__PURE__ */ Symbol("VisibilityChangedAction");
471
+ class gt extends m {
472
+ constructor(i) {
473
+ super(i);
425
474
  }
426
475
  static get classIdentifier() {
427
- return Le;
476
+ return $t;
428
477
  }
429
- execute(s, e, t, n) {
430
- return super.execute(s, e, t, n);
478
+ execute(i, t, e, s) {
479
+ return super.execute(i, t, e, s);
431
480
  }
432
481
  }
433
- class x {
482
+ class V {
434
483
  /**
435
484
  * A field is a Vue reactive proxy from construction onwards: the base constructor returns the proxy, and a
436
485
  * derived class's `this` is whatever super() returned, so every subclass constructor, field initializer and
@@ -443,11 +492,29 @@ class x {
443
492
  // is current value valid as per FE and BE validators?
444
493
  o(this, "errors", []);
445
494
  // when member of a Group, fieldName specifies the name of this field
446
- o(this, "actions", new N());
495
+ o(this, "actions", new L());
447
496
  // default property handlers
448
- o(this, "_visibility", C.FULL);
497
+ o(this, "_visibility", S.FULL);
449
498
  o(this, "_enabled", !0);
450
- return ve(this);
499
+ /**
500
+ * While true, validate() on this field does nothing at all: it neither recomputes _valid nor emits
501
+ * ValidChangedAction, and nothing climbs to the parent. A container that walks its members one by one - assigning
502
+ * them a value, or revalidating them - sets it for the duration of the walk, so a member's upward climb cannot
503
+ * announce the verdict of a half-applied value or of a half-revalidated set, and clears it in a finally block
504
+ * followed by its own validate(). That call recomputes over the finished state and emits the net transition, so
505
+ * the deferral cannot swallow a real change.
506
+ */
507
+ o(this, "suppressValidation", !1);
508
+ /**
509
+ * While true, a validity change is still recomputed and still announced on this field, but it is not passed up to
510
+ * the parent: the climb is only remembered and carried out by flushParentValidityClimb(). A setter that notifies
511
+ * the parent of the new value itself holds it over the notifying region, so the parent forms its verdict once,
512
+ * over the finished value, instead of once over the value being replaced and once over the value replacing it.
513
+ */
514
+ o(this, "suppressParentValidityClimb", !1);
515
+ o(this, "parentValidityClimbPending", !1);
516
+ o(this, "_validationEpoch", 0);
517
+ return Et(this);
451
518
  }
452
519
  /** true while at least one asynchronous validator is still running for this field */
453
520
  get validating() {
@@ -464,23 +531,30 @@ class x {
464
531
  get visibility() {
465
532
  return this._visibility;
466
533
  }
467
- set visibility(s) {
468
- const e = this._visibility, t = this.actions.trigger(le, this, s, e);
469
- if (!C.isDefined(t != null ? t : s)) throw new Error("visibility must be a DisplayMode constant");
470
- this._visibility = C.fromAny(t != null ? t : s), this.actions.trigger(oe, this, this._visibility, e);
534
+ set visibility(i) {
535
+ const t = this._visibility, e = this.actions.trigger(dt, this, i, t);
536
+ if (!S.isDefined(e != null ? e : i)) throw new Error("visibility must be a DisplayMode constant");
537
+ this._visibility = S.fromAny(e != null ? e : i), this.actions.trigger(gt, this, this._visibility, t);
471
538
  }
472
539
  get enabled() {
473
540
  return this._enabled;
474
541
  }
475
- set enabled(s) {
476
- const e = this._enabled, t = this.actions.trigger(ie, this, s, e);
477
- if (!pe(t != null ? t : s)) throw new Error("Enabled value must be boolean");
478
- this._enabled = t != null ? t : s, this.actions.trigger(re, this, this._enabled, e);
542
+ set enabled(i) {
543
+ const t = this._enabled, e = this.actions.trigger(ut, this, i, t);
544
+ if (!Vt(e != null ? e : i)) throw new Error("Enabled value must be boolean");
545
+ this._enabled = e != null ? e : i, this.actions.trigger(ct, this, this._enabled, t);
546
+ }
547
+ /** Carries out the climb that a validity change made while suppressParentValidityClimb was held, if there was one. */
548
+ flushParentValidityClimb() {
549
+ var i;
550
+ this.parentValidityClimbPending && (this.parentValidityClimbPending = !1, (i = this.parent) == null || i.validate());
479
551
  }
480
- validate(s = !1) {
481
- s && this.actions.triggerEager(this, this.value, this.value);
482
- const e = this._valid;
483
- this._valid = this.valid, this._valid !== e && this.actions.trigger(ae, this, this.valid, e);
552
+ validate(i = !1) {
553
+ var e;
554
+ if (this.suppressValidation) return;
555
+ i && this.actions.triggerEager(this, this.value, this.value);
556
+ const t = this._valid;
557
+ this._valid = this.valid, this._valid !== t && (this.actions.trigger(ht, this, this.valid, t), this.suppressParentValidityClimb ? this.parentValidityClimbPending = !0 : (e = this.parent) == null || e.validate());
484
558
  }
485
559
  get valid() {
486
560
  return this.errors.length === 0;
@@ -489,72 +563,94 @@ class x {
489
563
  return this.value;
490
564
  }
491
565
  get isChanged() {
492
- return !k(this.value, this.originalValue);
566
+ return !D(this.value, this.originalValue);
493
567
  }
494
- registerAction(s) {
495
- return this.actions.register(s), s.boundToField(this), s.eager && this.actions.trigger(Object.getPrototypeOf(s).constructor, this, this.value, this.originalValue), this;
568
+ /**
569
+ * Registers the actions a constructor received in its parameters: registration without the eager trigger,
570
+ * because a constructor ends with a single this.actions.triggerEager(...) over the finished value, and an
571
+ * eager action registered here would otherwise also run once per registration, over a half-built field.
572
+ */
573
+ registerInitialActions(i) {
574
+ i.forEach((t) => {
575
+ this.actions.register(t), t.boundToField(this);
576
+ });
496
577
  }
497
- triggerAction(s, ...e) {
498
- return this.actions.trigger(s, this, ...e);
578
+ registerAction(i) {
579
+ return this.actions.register(i), i.boundToField(this), i.eager && this.actions.trigger(Object.getPrototypeOf(i).constructor, this, this.value, this.originalValue), this;
580
+ }
581
+ triggerAction(i, ...t) {
582
+ return this.actions.trigger(i, this, ...t);
583
+ }
584
+ /**
585
+ * Generation counter of the validators attached to this field. A Validator reads it when a run starts and drops
586
+ * a result whose epoch no longer matches, so a validation still in flight when clearValidators() is called
587
+ * cannot push an error onto a field that no longer has the validator that produced it.
588
+ */
589
+ get validationEpoch() {
590
+ return this._validationEpoch;
499
591
  }
500
592
  clearValidators() {
501
- this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this._valid = !0;
593
+ this._validationEpoch++, this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this.validate();
502
594
  }
503
595
  }
504
- function Oe(i, s) {
505
- return i ? !s : s;
596
+ function qt(n, i) {
597
+ return n ? !i : i;
506
598
  }
507
- class w {
508
- constructor(s, e, t) {
599
+ class N {
600
+ constructor(i, t, e) {
509
601
  o(this, "operand1");
510
602
  o(this, "operator");
511
603
  o(this, "operand2");
512
- this.operand1 = s, this.operator = e, this.operand2 = t;
604
+ this.operand1 = i, this.operator = t, this.operand2 = e;
513
605
  }
514
606
  get operand1Value() {
515
- return this.operand1 instanceof w ? this.operand1.evaluate() : this.operand1 instanceof x ? g(this.operand1.value) : this.operand1;
607
+ return this.operand1 instanceof N ? this.operand1.evaluate() : this.operand1 instanceof V ? h(this.operand1.value) : this.operand1;
516
608
  }
517
609
  get operand2Value() {
518
- return this.operand2 instanceof w ? this.operand2.evaluate() : this.operand2 instanceof x ? g(this.operand2.value) : this.operand2;
610
+ return this.operand2 instanceof N ? this.operand2.evaluate() : this.operand2 instanceof V ? h(this.operand2.value) : this.operand2;
519
611
  }
520
612
  evaluate() {
521
- var t, n, r, a;
522
- const s = this.operand1Value, e = this.operand2Value;
613
+ var e, s;
614
+ const i = this.operand1Value, t = this.operand2Value;
523
615
  switch (this.operator) {
524
616
  // logical operators
525
- case d.AND:
526
- return s && e;
527
- case d.OR:
528
- return s || e;
529
- case d.NAND:
530
- return !(s && e);
531
- case d.NOR:
532
- return !(s || e);
533
- case d.XOR:
534
- return Oe(s, e);
535
- case d.NOT:
536
- return !s;
617
+ // `&&` and `||` evaluate to one of their operands, and the operands are of any type. Without the
618
+ // coercion evaluate() would hand out the operand itself, so `0` or `''` would reach callers that the
619
+ // signature promises a boolean, and consumers comparing results with !== would see a change where the
620
+ // logical value stayed the same.
621
+ case c.AND:
622
+ return !!(i && t);
623
+ case c.OR:
624
+ return !!(i || t);
625
+ case c.NAND:
626
+ return !(i && t);
627
+ case c.NOR:
628
+ return !(i || t);
629
+ case c.XOR:
630
+ return qt(!!i, !!t);
631
+ case c.NOT:
632
+ return !i;
537
633
  // comparison operators
538
- case d.EQUALS:
539
- return s == e;
540
- case d.NOT_EQUALS:
541
- return s != e;
542
- case d.LT:
543
- return s < e;
544
- case d.LE:
545
- return s <= e;
546
- case d.GE:
547
- return s >= e;
548
- case d.GT:
549
- return s > e;
550
- case d.IN:
551
- return (n = (t = e == null ? void 0 : e.includes) == null ? void 0 : t.call(e, s)) != null ? n : !1;
552
- case d.NOT_IN:
553
- return !((a = (r = e == null ? void 0 : e.includes) == null ? void 0 : r.call(e, s)) == null || a);
554
- case d.INCLUDES:
555
- return V(s) && V(e) && s.indexOf(e) >= 0;
556
- case d.NOT_INCLUDES:
557
- return !(V(s) && V(e) && s.indexOf(e) >= 0);
634
+ case c.EQUALS:
635
+ return i == t;
636
+ case c.NOT_EQUALS:
637
+ return i != t;
638
+ case c.LT:
639
+ return i < t;
640
+ case c.LE:
641
+ return i <= t;
642
+ case c.GE:
643
+ return i >= t;
644
+ case c.GT:
645
+ return i > t;
646
+ case c.IN:
647
+ return !!((e = t == null ? void 0 : t.includes) != null && e.call(t, i));
648
+ case c.NOT_IN:
649
+ return !((s = t == null ? void 0 : t.includes) != null && s.call(t, i));
650
+ case c.INCLUDES:
651
+ return A(i) && A(t) && i.indexOf(t) >= 0;
652
+ case c.NOT_INCLUDES:
653
+ return !(A(i) && A(t) && i.indexOf(t) >= 0);
558
654
  default:
559
655
  throw new Error(`Operator not implemented ${this.operator}`);
560
656
  }
@@ -564,55 +660,55 @@ class w {
564
660
  * @returns A set of all fields used in this statement
565
661
  */
566
662
  collectFields() {
567
- const s = /* @__PURE__ */ new Set();
568
- function e(t) {
569
- t instanceof x ? s.add(t) : t instanceof w && t.collectFields().forEach((r) => s.add(r));
663
+ const i = /* @__PURE__ */ new Set();
664
+ function t(e) {
665
+ e instanceof V ? i.add(e) : e instanceof N && e.collectFields().forEach((r) => i.add(r));
570
666
  }
571
- return e(this.operand1), e(this.operand2), s;
667
+ return t(this.operand1), t(this.operand2), i;
572
668
  }
573
669
  }
574
- const Pe = /* @__PURE__ */ Symbol("ExecuteAction");
575
- class ce extends b {
576
- constructor(s) {
577
- super(s);
670
+ const Ht = /* @__PURE__ */ Symbol("ExecuteAction");
671
+ class ft extends m {
672
+ constructor(i) {
673
+ super(i);
578
674
  }
579
675
  static get classIdentifier() {
580
- return Pe;
676
+ return Ht;
581
677
  }
582
- execute(s, e, t) {
583
- return super.execute(s, e, t);
678
+ execute(i, t, e) {
679
+ return super.execute(i, t, e);
584
680
  }
585
681
  }
586
- const Re = /* @__PURE__ */ Symbol("ListItemAddedAction");
587
- class z extends b {
588
- constructor(s) {
589
- super(s);
682
+ const Qt = /* @__PURE__ */ Symbol("ListItemAddedAction");
683
+ class z extends m {
684
+ constructor(i) {
685
+ super(i);
590
686
  }
591
687
  static get classIdentifier() {
592
- return Re;
688
+ return Qt;
593
689
  }
594
- execute(s, e, t, n) {
595
- return super.execute(s, e, t, n);
690
+ execute(i, t, e, s) {
691
+ return super.execute(i, t, e, s);
596
692
  }
597
693
  }
598
- const Ue = /* @__PURE__ */ Symbol("ListItemRemovedAction");
599
- class ue extends b {
600
- constructor(s) {
601
- super(s);
694
+ const Wt = /* @__PURE__ */ Symbol("ListItemRemovedAction");
695
+ class pt extends m {
696
+ constructor(i) {
697
+ super(i);
602
698
  }
603
699
  static get classIdentifier() {
604
- return Ue;
700
+ return Wt;
605
701
  }
606
- execute(s, e, t, n) {
607
- return super.execute(s, e, t, n);
702
+ execute(i, t, e, s) {
703
+ return super.execute(i, t, e, s);
608
704
  }
609
705
  }
610
- class D extends x {
611
- constructor(e) {
706
+ class $ extends V {
707
+ constructor(t) {
612
708
  super();
613
709
  o(this, "_value");
614
710
  o(this, "_touched", !1);
615
- this.init(e);
711
+ this.init(t);
616
712
  }
617
713
  /**
618
714
  * Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
@@ -623,79 +719,88 @@ class D extends x {
623
719
  * subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten
624
720
  * the moment the initializer runs.
625
721
  */
626
- init(e) {
627
- if (e) {
628
- const t = e, { value: n, validators: r, actions: a } = t, l = I(t, ["value", "validators", "actions"]);
629
- [...r || [], ...a || []].forEach((c) => this.registerAction(c)), Object.assign(this, l), this._value = n != null ? n : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
722
+ init(t) {
723
+ if (t) {
724
+ const e = t, { value: s, validators: r, actions: a } = e, l = F(e, ["value", "validators", "actions"]);
725
+ this.registerInitialActions([...r || [], ...a || []]), Object.assign(this, l), this._value = s !== void 0 ? s : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
630
726
  }
631
727
  this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
632
728
  }
633
729
  get value() {
634
730
  return this._value;
635
731
  }
636
- set value(e) {
637
- const t = this._value;
638
- !this.enabled || t === e || (this._value = e, this.actions.trigger(m, this, this._value, t), this.parent && this.parent.notifyValueChanged(), this.validate());
732
+ set value(t) {
733
+ const e = this._value;
734
+ if (!this.enabled || e === t) return;
735
+ this._value = t;
736
+ const s = this.suppressParentValidityClimb;
737
+ this.suppressParentValidityClimb = !0;
738
+ try {
739
+ this.actions.trigger(y, this, this._value, e), this.parent && this.parent.notifyValueChanged();
740
+ } finally {
741
+ this.suppressParentValidityClimb = s, this.validate(), this.flushParentValidityClimb();
742
+ }
639
743
  }
640
744
  get touched() {
641
745
  return this._touched;
642
746
  }
643
- set touched(e) {
644
- this._touched = e;
645
- }
646
- clone(e) {
647
- var r, a, l;
648
- const t = this.constructor, n = new t(R(y({
649
- value: (r = e == null ? void 0 : e.value) != null ? r : this.value
650
- }, e && "originalValue" in e ? { originalValue: e.originalValue } : {}), {
651
- enabled: (a = e == null ? void 0 : e.enabled) != null ? a : this.enabled,
652
- visibility: (l = e == null ? void 0 : e.visibility) != null ? l : this.visibility
747
+ set touched(t) {
748
+ this._touched = t;
749
+ }
750
+ clone(t) {
751
+ var r, a;
752
+ const e = this.constructor, s = new e(w(v({
753
+ // an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears
754
+ value: (t == null ? void 0 : t.value) !== void 0 ? t.value : this.value
755
+ }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
756
+ enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
757
+ visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
653
758
  }));
654
- return n.actions = this.actions.clone(), n.actions.triggerEager(n, n.value, n.originalValue), n;
759
+ return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
655
760
  }
656
761
  }
657
- const ke = new D({ value: "EmptyField" }).registerAction(
658
- new m(() => {
762
+ const zt = new $({ value: "EmptyField" }).registerAction(
763
+ new y(() => {
659
764
  console.warn("Working with EmptyField! This should not happen");
660
765
  })
661
766
  );
662
- function M(i, s) {
663
- return (i == null ? void 0 : i.label) == null && (i == null ? void 0 : i.icon) == null ? s : i;
767
+ function H(n, i) {
768
+ return (n == null ? void 0 : n.label) == null && (n == null ? void 0 : n.icon) == null ? i : n;
664
769
  }
665
- class Be extends D {
666
- init(s) {
667
- if (this._value = { label: void 0, icon: void 0 }, s) {
668
- const e = s, { value: t, originalValue: n, validators: r, actions: a } = e, l = I(e, ["value", "originalValue", "validators", "actions"]);
669
- [...r || [], ...a || []].forEach((h) => this.registerAction(h)), Object.assign(this, l);
670
- const c = M(t, this._value), u = Object.freeze({ label: n == null ? void 0 : n.label, icon: n == null ? void 0 : n.icon });
671
- this._value = M(c, y({}, u)), this.originalValue = M(u, c);
770
+ class Xt extends $ {
771
+ init(i) {
772
+ if (this._value = { label: void 0, icon: void 0 }, i) {
773
+ const t = i, { value: e, originalValue: s, validators: r, actions: a } = t, l = F(t, ["value", "originalValue", "validators", "actions"]);
774
+ this.registerInitialActions([...r || [], ...a || []]), Object.assign(this, l);
775
+ const u = H(e, this._value), d = Object.freeze({ label: s == null ? void 0 : s.label, icon: s == null ? void 0 : s.icon });
776
+ this._value = H(u, v({}, d)), this.originalValue = H(d, u);
672
777
  }
673
778
  this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
674
779
  }
675
780
  get icon() {
676
781
  return this.value.icon;
677
782
  }
678
- set icon(s) {
679
- this.value.icon = s;
783
+ set icon(i) {
784
+ this.value.icon = i;
680
785
  }
681
786
  get label() {
682
787
  return this.value.label;
683
788
  }
684
- set label(s) {
685
- this.value.label = s;
789
+ set label(i) {
790
+ this.value.label = i;
686
791
  }
687
- execute(s) {
688
- this.actions.trigger(ce, this, s);
792
+ execute(i) {
793
+ this.actions.trigger(ft, this, i);
689
794
  }
690
795
  }
691
- const De = /* @__PURE__ */ ye({
796
+ const Gt = /* @__PURE__ */ It({
692
797
  __name: "messages-widget",
693
798
  props: {
694
799
  message: {},
695
800
  classes: {}
696
801
  },
697
- setup(i) {
698
- const s = i, e = Z("vue-markdown"), t = /* @__PURE__ */ new Set([
802
+ setup(n) {
803
+ const i = n, t = st("vue-markdown"), e = /* @__PURE__ */ new Set([
699
804
  "div",
700
805
  "span",
701
806
  "p",
@@ -751,24 +856,24 @@ const De = /* @__PURE__ */ ye({
751
856
  "dl",
752
857
  "dt",
753
858
  "dd"
754
- ]), n = () => {
755
- if (typeof s.message == "string") return S("span", { class: s.classes }, s.message);
859
+ ]), s = () => {
860
+ if (typeof i.message == "string") return j("span", { class: i.classes }, i.message);
756
861
  const r = [];
757
- return s.message.forEach((a) => {
862
+ return i.message.forEach((a) => {
758
863
  switch (a.componentName) {
759
864
  case "template":
760
- r.push(S("div", { class: [s.classes, a.extraClasses] }, a.componentBody));
865
+ r.push(j("div", { class: [i.classes, a.extraClasses] }, a.componentBody));
761
866
  break;
762
867
  case "vue-markdown":
763
- if (typeof e == "string")
868
+ if (typeof t == "string")
764
869
  console.warn(
765
870
  "You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
766
- ), r.push(S("div", { class: [s.classes, a.extraClasses] }, a.componentBindings.source));
871
+ ), r.push(j("div", { class: [i.classes, a.extraClasses] }, a.componentBindings.source));
767
872
  else {
768
873
  const l = a.componentBindings;
769
874
  r.push(
770
- S(e, {
771
- class: [s.classes, a.extraClasses, "df-messages-widget-markdown"],
875
+ j(t, {
876
+ class: [i.classes, a.extraClasses, "df-messages-widget-markdown"],
772
877
  source: l.source,
773
878
  options: l.options,
774
879
  plugins: l.plugins
@@ -778,10 +883,10 @@ const De = /* @__PURE__ */ ye({
778
883
  break;
779
884
  default:
780
885
  r.push(
781
- S(
782
- t.has(a.componentName.toLowerCase()) ? a.componentName : Z(a.componentName),
783
- y(y({
784
- class: [s.classes, a.extraClasses]
886
+ j(
887
+ e.has(a.componentName.toLowerCase()) ? a.componentName : st(a.componentName),
888
+ v(v({
889
+ class: [i.classes, a.extraClasses]
785
890
  }, a.componentBindings), a.componentBody ? { innerHTML: a.componentBody } : {})
786
891
  )
787
892
  );
@@ -789,419 +894,465 @@ const De = /* @__PURE__ */ ye({
789
894
  }
790
895
  }), r;
791
896
  };
792
- return (r, a) => (xe(), Ee(n));
897
+ return (r, a) => (At(), St(s));
793
898
  }
794
899
  });
795
- class _ extends x {
796
- constructor(e, t) {
900
+ class C extends V {
901
+ constructor(t, e) {
797
902
  super();
798
903
  o(this, "_fields");
799
904
  o(this, "_value", null);
800
905
  o(this, "suppressNotifyValueChanged", !1);
801
- if (!_.isValidFields(e)) throw new Error("Invalid fields object provided");
802
- if (this._fields = /* @__PURE__ */ Object.create(null), Object.entries(e).forEach(([r, a]) => this.addField(r, a)), t) {
803
- const n = t, { value: r, validators: a, actions: l } = n, c = I(n, ["value", "validators", "actions"]);
804
- [...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
906
+ if (!C.isValidFields(t)) throw new Error("Invalid fields object provided");
907
+ if (this._fields = /* @__PURE__ */ Object.create(null), Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
908
+ const s = e, { value: r, validators: a, actions: l } = s, u = F(s, ["value", "validators", "actions"]);
909
+ this.registerInitialActions([...a || [], ...l || []]), Object.assign(this, u), r !== void 0 ? this.assignMembers(r) : this.originalValue !== void 0 && this.assignMembers(this.originalValue);
805
910
  }
806
- this.originalValue === void 0 && (this.originalValue = this.value), this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
911
+ this.originalValue === void 0 && (this.originalValue = this.value), this._value = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
807
912
  }
808
- addField(e, t) {
809
- if (Object.hasOwn(this._fields, e))
810
- throw new Error(`Field ${e} is already in this form`);
811
- Object.defineProperty(t, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(t, "fieldName", { get: () => e, configurable: !1, enumerable: !1 }), Object.defineProperty(this._fields, e, { get: () => t, configurable: !1, enumerable: !0 });
913
+ addField(t, e) {
914
+ if (Object.hasOwn(this._fields, t))
915
+ throw new Error(`Field ${t} is already in this form`);
916
+ Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), Object.defineProperty(e, "fieldName", { get: () => t, configurable: !1, enumerable: !1 }), Object.defineProperty(this._fields, t, { get: () => e, configurable: !1, enumerable: !0 });
812
917
  }
813
- static isValidFields(e) {
814
- function t(n) {
815
- return n instanceof x;
918
+ static isValidFields(t) {
919
+ function e(s) {
920
+ return s instanceof V;
816
921
  }
817
- return typeof e == "object" && e !== null && Object.entries(e).every(([, n]) => t(n));
922
+ return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
818
923
  }
819
- static createFromFormData(e) {
820
- if (e instanceof x)
924
+ static createFromFormData(t) {
925
+ if (t instanceof V)
821
926
  throw new Error("data is already a Form structure, should be a simple object");
822
- return new _(
823
- e == null ? {} : Object.fromEntries(Object.entries(e).map(([t, n]) => [t, new D({ value: n })]))
927
+ return new C(
928
+ t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new $({ value: s })]))
824
929
  );
825
930
  }
826
- field(e) {
827
- var t;
828
- return (t = this._fields[e]) != null ? t : null;
931
+ field(t) {
932
+ var e;
933
+ return (e = this._fields[t]) != null ? e : null;
829
934
  }
830
935
  get fields() {
831
936
  return this._fields;
832
937
  }
833
938
  get value() {
834
- const e = /* @__PURE__ */ Object.create(null);
835
- return Object.entries(this._fields).forEach(([t, n]) => {
836
- const r = n.value;
837
- (n.enabled || n instanceof _ && !H(r)) && (e[t] = r);
838
- }), H(e) ? null : y({}, e);
939
+ const t = /* @__PURE__ */ Object.create(null);
940
+ return Object.entries(this._fields).forEach(([e, s]) => {
941
+ const r = s.value;
942
+ (s.enabled || s instanceof C && !Q(r)) && (t[e] = r);
943
+ }), Q(t) ? null : v({}, t);
839
944
  }
840
- set value(e) {
841
- this.suppressNotifyValueChanged = !0;
945
+ /**
946
+ * Writes the members that the given value carries, without letting any single member announce the state in
947
+ * between: the group's own value notification and its own validation are both held back for the duration, so
948
+ * neither a ValueChangedAction nor a ValidChangedAction reports a verdict over a half-applied value. The
949
+ * caller decides what to announce once the whole value is in place. Both flags are restored to what they were,
950
+ * so a caller that is itself holding the group back stays in charge.
951
+ */
952
+ assignMembers(t) {
953
+ const e = this.suppressNotifyValueChanged, s = this.suppressValidation;
954
+ this.suppressNotifyValueChanged = !0, this.suppressValidation = !0;
842
955
  try {
843
- Object.entries(this._fields).forEach(([t, n]) => {
844
- (e == null || Object.hasOwn(e, t)) && (n.value = e == null ? null : e[t]);
956
+ Object.entries(this._fields).forEach(([r, a]) => {
957
+ (t == null || Object.hasOwn(t, r)) && (a.value = t == null ? null : t[r]);
845
958
  });
846
959
  } finally {
847
- this.suppressNotifyValueChanged = !1;
960
+ this.suppressNotifyValueChanged = e, this.suppressValidation = s;
848
961
  }
849
- this.notifyValueChanged(), this.validate();
962
+ }
963
+ set value(t) {
964
+ this.assignMembers(t), this.notifyValueChanged(), this.validate();
850
965
  }
851
966
  get touched() {
852
- return Object.values(this._fields).some((e) => e.touched);
967
+ return Object.values(this._fields).some((t) => t.touched);
853
968
  }
854
- set touched(e) {
855
- Object.values(this._fields).forEach((t) => {
856
- t.touched = e;
969
+ set touched(t) {
970
+ Object.values(this._fields).forEach((e) => {
971
+ e.touched = t;
857
972
  });
858
973
  }
859
974
  get fullValue() {
860
- const e = /* @__PURE__ */ Object.create(null);
861
- return Object.entries(this._fields).forEach(([t, n]) => {
862
- e[t] = n.fullValue;
863
- }), y({}, e);
975
+ const t = /* @__PURE__ */ Object.create(null);
976
+ return Object.entries(this._fields).forEach(([e, s]) => {
977
+ t[e] = s.fullValue;
978
+ }), v({}, t);
864
979
  }
865
980
  notifyValueChanged() {
866
981
  if (this.suppressNotifyValueChanged) return;
867
- const e = this.value;
868
- if (!k(e, this._value)) {
869
- const t = this._value;
870
- this._value = e, this.actions.trigger(m, this, e, t), this.parent && this.parent.notifyValueChanged(), this.validate();
982
+ const t = this.value;
983
+ if (!D(t, this._value)) {
984
+ const e = this._value;
985
+ this._value = t;
986
+ const s = this.suppressParentValidityClimb;
987
+ this.suppressParentValidityClimb = !0;
988
+ try {
989
+ this.actions.trigger(y, this, t, e), this.parent && this.parent.notifyValueChanged();
990
+ } finally {
991
+ this.suppressParentValidityClimb = s, this.validate(), this.flushParentValidityClimb();
992
+ }
871
993
  }
872
994
  }
873
995
  get valid() {
874
- return super.valid && Object.values(this._fields).every((e) => e.valid);
996
+ return super.valid && Object.values(this._fields).every((t) => t.valid);
875
997
  }
876
- validate(e = !1) {
877
- e && Object.values(this._fields).forEach((t) => t.validate(!0)), super.validate(e);
998
+ validate(t = !1) {
999
+ if (t) {
1000
+ const e = this.suppressValidation;
1001
+ this.suppressValidation = !0;
1002
+ try {
1003
+ Object.values(this._fields).forEach((s) => s.validate(!0));
1004
+ } finally {
1005
+ this.suppressValidation = e;
1006
+ }
1007
+ }
1008
+ super.validate(t);
878
1009
  }
879
- clone(e) {
880
- var r, a, l;
881
- const t = /* @__PURE__ */ Object.create(null);
882
- Object.entries(this._fields).forEach(([c, u]) => {
883
- t[c] = u.clone();
1010
+ clone(t) {
1011
+ var r, a;
1012
+ const e = /* @__PURE__ */ Object.create(null);
1013
+ Object.entries(this._fields).forEach(([l, u]) => {
1014
+ e[l] = u.clone();
884
1015
  });
885
- const n = new _(t, R(y({
886
- value: (r = e == null ? void 0 : e.value) != null ? r : this.value
887
- }, e && "originalValue" in e ? { originalValue: e.originalValue } : {}), {
888
- enabled: (a = e == null ? void 0 : e.enabled) != null ? a : this.enabled,
889
- visibility: (l = e == null ? void 0 : e.visibility) != null ? l : this.visibility
1016
+ const s = new C(e, w(v({
1017
+ // an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears
1018
+ value: (t == null ? void 0 : t.value) !== void 0 ? t.value : this.value
1019
+ }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
1020
+ enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
1021
+ visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
890
1022
  }));
891
- return n.actions = this.actions.clone(), n.actions.triggerEager(n, n.value, n.originalValue), n;
1023
+ return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
892
1024
  }
893
1025
  }
894
- class G extends x {
895
- constructor(e, t) {
1026
+ class Y extends V {
1027
+ constructor(t, e) {
896
1028
  super();
897
1029
  o(this, "_value", null);
898
1030
  o(this, "_itemTemplate");
899
1031
  o(this, "_previousValue");
900
- if (this._itemTemplate = e, t) {
901
- const n = t, { value: r, validators: a, actions: l } = n, c = I(n, ["value", "validators", "actions"]);
902
- [...a || [], ...l || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), r && this.setValueInternal(r);
1032
+ if (this._itemTemplate = t, e) {
1033
+ const s = e, { value: r, validators: a, actions: l } = s, u = F(s, ["value", "validators", "actions"]);
1034
+ this.registerInitialActions([...a || [], ...l || []]), Object.assign(this, u), r != null && this.setValueInternal(r);
903
1035
  }
904
1036
  this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
905
1037
  }
906
- processSetValueItem(e) {
907
- let t;
908
- return e instanceof _ ? t = e : this._itemTemplate ? t = this._itemTemplate.clone({ value: e }) : t = _.createFromFormData(e), Object.defineProperty(t, "parent", { get: () => this, configurable: !1, enumerable: !1 }), t;
909
- }
910
- setValueInternal(e) {
911
- Array.isArray(e) && (this._value = e.map((t) => this.processSetValueItem(t)));
1038
+ processSetValueItem(t) {
1039
+ let e;
1040
+ return t instanceof C ? e = t : this._itemTemplate ? e = this._itemTemplate.clone({ value: t }) : e = C.createFromFormData(t), Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), e;
912
1041
  }
913
- get value() {
914
- var t;
915
- const e = (t = this._value) == null ? void 0 : t.map((n) => n.value);
916
- return H(e) ? null : e;
1042
+ /**
1043
+ * Builds the item that fills a gap left by an insert beyond the end of the list: a copy of the item template with
1044
+ * the template's own values, or an empty group when the list has no template.
1045
+ */
1046
+ createPaddingItem() {
1047
+ return this.processSetValueItem(this._itemTemplate ? this._itemTemplate.clone() : null);
917
1048
  }
918
- set value(e) {
919
- const t = this.value;
920
- this.setValueInternal(e), this.actions.trigger(m, this, this.value, t), this.parent && this.parent.notifyValueChanged(), this.validate();
1049
+ setValueInternal(t) {
1050
+ t == null ? this._value = null : Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
921
1051
  }
922
- get touched() {
1052
+ get value() {
923
1053
  var e;
924
- return ((e = this._value) == null ? void 0 : e.some((t) => t.touched)) || !1;
1054
+ const t = (e = this._value) == null ? void 0 : e.map((s) => s.value);
1055
+ return Q(t) ? null : t;
1056
+ }
1057
+ set value(t) {
1058
+ const e = this._previousValue;
1059
+ this.setValueInternal(t);
1060
+ const s = this.value;
1061
+ this._previousValue = s;
1062
+ const r = this.suppressParentValidityClimb;
1063
+ this.suppressParentValidityClimb = !0;
1064
+ try {
1065
+ this.actions.trigger(y, this, s, e), this.parent && this.parent.notifyValueChanged();
1066
+ } finally {
1067
+ this.suppressParentValidityClimb = r, this.validate(), this.flushParentValidityClimb();
1068
+ }
925
1069
  }
926
- set touched(e) {
1070
+ get touched() {
927
1071
  var t;
928
- (t = this._value) == null || t.forEach((n) => {
929
- n.touched = e;
1072
+ return ((t = this._value) == null ? void 0 : t.some((e) => e.touched)) || !1;
1073
+ }
1074
+ set touched(t) {
1075
+ var e;
1076
+ (e = this._value) == null || e.forEach((s) => {
1077
+ s.touched = t;
930
1078
  });
931
1079
  }
932
- clone(e) {
933
- var n, r, a, l, c;
934
- const t = new G((n = this._itemTemplate) == null ? void 0 : n.clone(), R(y({
935
- value: [...(a = (r = e == null ? void 0 : e.value) != null ? r : this.value) != null ? a : []]
936
- }, e && "originalValue" in e ? { originalValue: e.originalValue } : {}), {
937
- enabled: (l = e == null ? void 0 : e.enabled) != null ? l : this.enabled,
938
- visibility: (c = e == null ? void 0 : e.visibility) != null ? c : this.visibility
1080
+ clone(t) {
1081
+ var s, r, a, l;
1082
+ const e = new Y((s = this._itemTemplate) == null ? void 0 : s.clone(), w(v({
1083
+ // an override value is one the caller supplied, and undefined is not one; an explicit null is, and clears
1084
+ value: [...(r = (t == null ? void 0 : t.value) !== void 0 ? t.value : this.value) != null ? r : []]
1085
+ }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
1086
+ enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
1087
+ visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
939
1088
  }));
940
- return t.actions = this.actions.clone(), t.actions.triggerEager(t, t.value, t.originalValue), t;
1089
+ return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
941
1090
  }
942
1091
  notifyValueChanged() {
943
- const e = this.value;
944
- if (!k(e, this._previousValue)) {
945
- const t = this._previousValue;
946
- this._previousValue = e, this.actions.trigger(m, this, e, t), this.parent && this.parent.notifyValueChanged(), this.validate();
1092
+ const t = this.value;
1093
+ if (!D(t, this._previousValue)) {
1094
+ const e = this._previousValue;
1095
+ this._previousValue = t;
1096
+ const s = this.suppressParentValidityClimb;
1097
+ this.suppressParentValidityClimb = !0;
1098
+ try {
1099
+ this.actions.trigger(y, this, t, e), this.parent && this.parent.notifyValueChanged();
1100
+ } finally {
1101
+ this.suppressParentValidityClimb = s, this.validate(), this.flushParentValidityClimb();
1102
+ }
947
1103
  }
948
1104
  }
949
1105
  get valid() {
950
- var e, t;
951
- return super.valid && ((t = (e = this._value) == null ? void 0 : e.every((n) => n.valid)) != null ? t : !0);
1106
+ var t, e;
1107
+ return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((s) => s.valid)) != null ? e : !0);
952
1108
  }
953
- validate(e = !1) {
954
- var t;
955
- e && ((t = this._value) == null || t.forEach((n) => n.validate(!0))), super.validate(e);
1109
+ validate(t = !1) {
1110
+ var e;
1111
+ if (t) {
1112
+ const s = this.suppressValidation;
1113
+ this.suppressValidation = !0;
1114
+ try {
1115
+ (e = this._value) == null || e.forEach((r) => r.validate(!0));
1116
+ } finally {
1117
+ this.suppressValidation = s;
1118
+ }
1119
+ }
1120
+ super.validate(t);
956
1121
  }
957
- get(e) {
958
- return this._value != null ? this._value[e] : void 0;
1122
+ get(t) {
1123
+ return this._value != null ? this._value[t] : void 0;
959
1124
  }
960
- push(e) {
961
- var t, n;
962
- return this.insert(e, (n = (t = this._value) == null ? void 0 : t.length) != null ? n : 0) + 1;
1125
+ push(t) {
1126
+ var e, s;
1127
+ return this.insert(t, (s = (e = this._value) == null ? void 0 : e.length) != null ? s : 0) + 1;
963
1128
  }
964
1129
  pop() {
965
- var e, t;
966
- return this.remove(((t = (e = this._value) == null ? void 0 : e.length) != null ? t : 0) - 1);
967
- }
968
- remove(e) {
969
- var n;
970
- if (this._value == null || e < 0 || this._value.length <= e) return;
971
- let t = (n = this._value.splice(e, 1)) == null ? void 0 : n[0];
972
- return t && (t = t.clone(), this.actions.trigger(ue, this, t, e), this.notifyValueChanged()), t;
973
- }
974
- insert(e, t) {
975
- for (this._value == null && (this._value = []); this._value.length < t; ) {
976
- const r = this.processSetValueItem(null), a = this._value.push(r);
977
- this.actions.trigger(z, this, r, a);
1130
+ var t, e;
1131
+ return this.remove(((e = (t = this._value) == null ? void 0 : t.length) != null ? e : 0) - 1);
1132
+ }
1133
+ remove(t) {
1134
+ var s;
1135
+ if (this._value == null || t < 0 || this._value.length <= t) return;
1136
+ let e = (s = this._value.splice(t, 1)) == null ? void 0 : s[0];
1137
+ return e && (e = e.clone(), this.actions.trigger(pt, this, e, t), this.notifyValueChanged()), e;
1138
+ }
1139
+ insert(t, e) {
1140
+ this._value == null && (this._value = []);
1141
+ const s = e < 0 ? Math.max(this._value.length + e, 0) : e;
1142
+ for (; this._value.length < s; ) {
1143
+ const a = this.createPaddingItem(), l = this._value.push(a) - 1;
1144
+ this.actions.trigger(z, this, a, l);
978
1145
  }
979
- const n = this.processSetValueItem(e);
980
- return this._value.splice(t, 0, n), this.actions.trigger(z, this, n, t), this.notifyValueChanged(), t;
1146
+ const r = this.processSetValueItem(t);
1147
+ return this._value.splice(s, 0, r), this.actions.trigger(z, this, r, s), this.notifyValueChanged(), s;
981
1148
  }
982
1149
  clear() {
983
1150
  this._value = null, this.notifyValueChanged();
984
1151
  }
985
1152
  }
986
- const he = { useMarkdownInValidators: !0 };
987
- function $e() {
988
- return he;
989
- }
990
- function qe(i) {
991
- Object.assign(he, i);
992
- }
993
- const it = {
994
- install(i, s) {
995
- s && qe(s);
996
- }
997
- };
998
- function v(i) {
999
- return $e().useMarkdownInValidators ? new j(i) : i.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, `
1000
- `);
1001
- }
1002
- class Me extends f {
1003
- constructor(e, t, n) {
1153
+ class Yt extends f {
1154
+ constructor(t, e, s) {
1004
1155
  let r = !1, a, l;
1005
- super((u, h, A) => (a = u, l = h, r || (r = !0, this.otherField.registerAction(
1006
- new m((E, L, O, $) => {
1007
- L(E, O, $), this.unregistered || this.execute(A, () => null, a, l);
1156
+ super((d, x, _) => (a = d, l = x, r || (r = !0, this.otherField.registerAction(
1157
+ new y((P, B, p, E) => {
1158
+ B(P, p, E), this.unregistered || this.execute(_, () => null, a, l);
1008
1159
  })
1009
- )), this.isValidComparison(g(u), g(this.otherField.value)) ? null : [
1010
- new p(
1011
- this.replacePlaceholders(n, { newValue: u, oldValue: h, field: A, otherField: this.otherField })
1160
+ )), this.isValidComparison(h(d), h(this.otherField.value)) ? null : [
1161
+ new g(
1162
+ this.replacePlaceholders(s, { newValue: d, oldValue: x, field: _, otherField: this.otherField })
1012
1163
  )
1013
1164
  ]));
1014
1165
  o(this, "otherField");
1015
1166
  o(this, "isValidComparison");
1016
1167
  o(this, "unregistered", !1);
1017
- this.otherField = e, this.isValidComparison = t;
1168
+ this.otherField = t, this.isValidComparison = e;
1018
1169
  }
1019
1170
  unregister() {
1020
1171
  this.unregistered = !0;
1021
1172
  }
1022
1173
  }
1023
- class He extends f {
1024
- constructor(s, e) {
1025
- const t = e || v("Must be one of [**{allowedAsText}**]");
1026
- let n = s.join(", ");
1027
- n.length > 60 && (n = be(n, {
1174
+ class Jt extends f {
1175
+ constructor(i, t) {
1176
+ const e = t || b("Must be one of [**{allowedAsText}**]");
1177
+ let s = i.join(", ");
1178
+ s.length > 60 && (s = Ct(s, {
1028
1179
  length: 40,
1029
1180
  separator: ", ",
1030
- omission: `... (${s.length} items total)`
1181
+ omission: `... (${i.length} items total)`
1031
1182
  }));
1032
- const r = (a, l, c) => s.includes(g(a)) ? null : [
1033
- new p(
1034
- this.replacePlaceholders(t, { newValue: a, oldValue: l, field: c, allowedValues: s, allowedAsText: n })
1183
+ const r = (a, l, u) => i.includes(h(a)) ? null : [
1184
+ new g(
1185
+ this.replacePlaceholders(e, { newValue: a, oldValue: l, field: u, allowedValues: i, allowedAsText: s })
1035
1186
  )
1036
1187
  ];
1037
1188
  super(r);
1038
1189
  }
1039
1190
  }
1040
- function Qe(i) {
1041
- return i == null ? 0 : te(i) || V(i) ? i.length : se(i) && Object.getPrototypeOf(i) === Object.prototype ? Object.keys(i).length : String(i).length;
1191
+ function Kt(n) {
1192
+ return n == null ? 0 : rt(n) || A(n) ? n.length : at(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
1042
1193
  }
1043
- class ze extends f {
1044
- constructor(s) {
1045
- const e = s || v("Please enter a value"), t = (n, r, a) => Qe(g(n)) === 0 ? [new p(this.replacePlaceholders(e, { newValue: n, oldValue: r, field: a }))] : null;
1046
- super(t);
1194
+ class Zt extends f {
1195
+ constructor(i) {
1196
+ const t = i || b("Please enter a value"), e = (s, r, a) => Kt(h(s)) === 0 ? [new g(this.replacePlaceholders(t, { newValue: s, oldValue: r, field: a }))] : null;
1197
+ super(e);
1047
1198
  }
1048
1199
  }
1049
- class We extends f {
1050
- constructor(s, e) {
1051
- const t = e || v("Value must be larger or equal to **{minValue}**"), n = (r, a, l) => r < s || r === void 0 ? [
1052
- new p(this.replacePlaceholders(t, { newValue: r, oldValue: a, field: l, minValue: s }))
1200
+ class te extends f {
1201
+ constructor(i, t) {
1202
+ const e = t || b("Value must be larger or equal to **{minValue}**"), s = (r, a, l) => r < i || r === void 0 ? [
1203
+ new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minValue: i }))
1053
1204
  ] : null;
1054
- super(n);
1205
+ super(s);
1055
1206
  }
1056
1207
  }
1057
- class Xe extends f {
1058
- constructor(s, e) {
1059
- const t = e || v("Value must be less than or equal to **{maxValue}**"), n = (r, a, l) => r > s || r === void 0 ? [
1060
- new p(this.replacePlaceholders(t, { newValue: r, oldValue: a, field: l, maxValue: s }))
1208
+ class ee extends f {
1209
+ constructor(i, t) {
1210
+ const e = t || b("Value must be less than or equal to **{maxValue}**"), s = (r, a, l) => r > i || r === void 0 ? [
1211
+ new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxValue: i }))
1061
1212
  ] : null;
1062
- super(n);
1213
+ super(s);
1063
1214
  }
1064
1215
  }
1065
- class Ge extends f {
1066
- constructor(s, e, t) {
1067
- const n = t || v("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, c) => a < s || a > e || a === void 0 ? [
1068
- new p(
1069
- this.replacePlaceholders(n, { newValue: a, oldValue: l, field: c, minValue: s, maxValue: e })
1216
+ class ie extends f {
1217
+ constructor(i, t, e) {
1218
+ const s = e || b("Value must be between **{minValue}** and **{maxValue}**"), r = (a, l, u) => a < i || a > t || a === void 0 ? [
1219
+ new g(
1220
+ this.replacePlaceholders(s, { newValue: a, oldValue: l, field: u, minValue: i, maxValue: t })
1070
1221
  )
1071
1222
  ] : null;
1072
1223
  super(r);
1073
1224
  }
1074
1225
  }
1075
- function Y(i) {
1076
- return i == null ? 0 : te(i) || V(i) ? i.length : se(i) && Object.getPrototypeOf(i) === Object.prototype ? Object.keys(i).length : String(i).length;
1226
+ function J(n) {
1227
+ return n == null ? 0 : rt(n) || A(n) ? n.length : at(n) && Object.getPrototypeOf(n) === Object.prototype ? Object.keys(n).length : String(n).length;
1077
1228
  }
1078
- class Ye extends f {
1079
- constructor(s, e) {
1080
- const t = e || v("Length must be larger or equal to **{minLength}**"), n = (r, a, l) => Y(r) < s ? [
1081
- new p(this.replacePlaceholders(t, { newValue: r, oldValue: a, field: l, minLength: s }))
1229
+ class se extends f {
1230
+ constructor(i, t) {
1231
+ const e = t || b("Length must be larger or equal to **{minLength}**"), s = (r, a, l) => J(r) < i ? [
1232
+ new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, minLength: i }))
1082
1233
  ] : null;
1083
- super(n);
1234
+ super(s);
1084
1235
  }
1085
1236
  }
1086
- class Je extends f {
1087
- constructor(s, e) {
1088
- const t = e || v("Length must be less than or equal to **{maxLength}**"), n = (r, a, l) => Y(r) > s ? [
1089
- new p(this.replacePlaceholders(t, { newValue: r, oldValue: a, field: l, maxLength: s }))
1237
+ class ne extends f {
1238
+ constructor(i, t) {
1239
+ const e = t || b("Length must be less than or equal to **{maxLength}**"), s = (r, a, l) => J(r) > i ? [
1240
+ new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, maxLength: i }))
1090
1241
  ] : null;
1091
- super(n);
1242
+ super(s);
1092
1243
  }
1093
1244
  }
1094
- class Ke extends f {
1095
- constructor(s, e, t) {
1096
- const n = t || v("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, c) => {
1097
- const u = Y(a);
1098
- return u < s || u > e ? [
1099
- new p(
1100
- this.replacePlaceholders(n, { newValue: a, oldValue: l, field: c, minLength: s, maxLength: e })
1245
+ class re extends f {
1246
+ constructor(i, t, e) {
1247
+ const s = e || b("Length must be between **{minLength}** and **{maxLength}**"), r = (a, l, u) => {
1248
+ const d = J(a);
1249
+ return d < i || d > t ? [
1250
+ new g(
1251
+ this.replacePlaceholders(s, { newValue: a, oldValue: l, field: u, minLength: i, maxLength: t })
1101
1252
  )
1102
1253
  ] : null;
1103
1254
  };
1104
1255
  super(r);
1105
1256
  }
1106
1257
  }
1107
- class Ze extends f {
1108
- constructor(s, e) {
1109
- const t = e || v('Value must match pattern "**{pattern}**"'), n = (r, a, l) => s.test(String(g(r))) ? null : [
1110
- new p(this.replacePlaceholders(t, { newValue: r, oldValue: a, field: l, pattern: s }))
1258
+ class ae extends f {
1259
+ constructor(i, t) {
1260
+ const e = t || b('Value must match pattern "**{pattern}**"'), s = (r, a, l) => i.test(String(h(r))) ? null : [
1261
+ new g(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: l, pattern: i }))
1111
1262
  ];
1112
- super(n);
1263
+ super(s);
1113
1264
  }
1114
1265
  }
1115
- const et = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1266
+ const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1116
1267
  __proto__: null,
1117
- CompareTo: Me,
1118
- InAllowedValues: He,
1119
- LengthInRange: Ke,
1120
- MaxLength: Je,
1121
- MaxValue: Xe,
1122
- MinLength: Ye,
1123
- MinValue: We,
1124
- Pattern: Ze,
1125
- Required: ze,
1268
+ CompareTo: Yt,
1269
+ InAllowedValues: Jt,
1270
+ LengthInRange: re,
1271
+ MaxLength: ne,
1272
+ MaxValue: ee,
1273
+ MinLength: se,
1274
+ MinValue: te,
1275
+ Pattern: ae,
1276
+ Required: Zt,
1126
1277
  Validator: f,
1127
- ValueInRange: Ge
1128
- }, Symbol.toStringTag, { value: "Module" })), rt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1278
+ ValueInRange: ie
1279
+ }, Symbol.toStringTag, { value: "Module" })), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1129
1280
  __proto__: null,
1130
- AbortEventHandlingException: Q,
1131
- Action: Be,
1132
- ActionsMap: N,
1133
- ConditionalEnabledAction: Se,
1134
- ConditionalStatementAction: B,
1135
- ConditionalValueAction: we,
1136
- ConditionalVisibilityAction: Ie,
1137
- DisplayMode: C,
1138
- EmptyField: ke,
1139
- EnabledChangedAction: re,
1140
- EnabledChangingAction: ie,
1141
- ExecuteAction: ce,
1142
- Field: D,
1143
- FieldActionBase: b,
1144
- FieldBase: x,
1145
- Group: _,
1146
- List: G,
1281
+ AbortEventHandlingException: W,
1282
+ Action: Xt,
1283
+ ActionsMap: L,
1284
+ ConditionalEnabledAction: Rt,
1285
+ ConditionalStatementAction: M,
1286
+ ConditionalValueAction: Bt,
1287
+ ConditionalVisibilityAction: Lt,
1288
+ DisplayMode: S,
1289
+ EmptyField: zt,
1290
+ EnabledChangedAction: ct,
1291
+ EnabledChangingAction: ut,
1292
+ ExecuteAction: ft,
1293
+ Field: $,
1294
+ FieldActionBase: m,
1295
+ FieldBase: V,
1296
+ Group: C,
1297
+ List: Y,
1147
1298
  ListItemAddedAction: z,
1148
- ListItemRemovedAction: ue,
1149
- MdString: j,
1150
- MessagesWidget: De,
1151
- Operator: d,
1152
- RenderableValue: Ve,
1153
- Statement: w,
1154
- ValidChangedAction: ae,
1155
- ValidationError: X,
1156
- ValidationErrorRenderContent: p,
1157
- ValidationErrorText: _e,
1299
+ ListItemRemovedAction: pt,
1300
+ MdString: O,
1301
+ MessagesWidget: Gt,
1302
+ Operator: c,
1303
+ RenderableValue: jt,
1304
+ Statement: N,
1305
+ ValidChangedAction: ht,
1306
+ ValidationError: G,
1307
+ ValidationErrorRenderContent: g,
1308
+ ValidationErrorText: Ft,
1158
1309
  Validator: f,
1159
- Validators: et,
1160
- ValueChangedAction: m,
1161
- VisibilityChangedAction: oe,
1162
- VisibilityChangingAction: le,
1163
- buildErrorMessage: v,
1164
- isCallableFunction: U,
1165
- isSimpleComponentDef: W
1310
+ Validators: le,
1311
+ ValueChangedAction: y,
1312
+ VisibilityChangedAction: gt,
1313
+ VisibilityChangingAction: dt,
1314
+ buildErrorMessage: b,
1315
+ isCallableFunction: k,
1316
+ isSimpleComponentDef: X
1166
1317
  }, Symbol.toStringTag, { value: "Module" }));
1167
1318
  export {
1168
- Q as AbortEventHandlingException,
1169
- Be as Action,
1170
- N as ActionsMap,
1171
- Se as ConditionalEnabledAction,
1172
- B as ConditionalStatementAction,
1173
- we as ConditionalValueAction,
1174
- Ie as ConditionalVisibilityAction,
1175
- C as DisplayMode,
1176
- ke as EmptyField,
1177
- re as EnabledChangedAction,
1178
- ie as EnabledChangingAction,
1179
- ce as ExecuteAction,
1180
- D as Field,
1181
- b as FieldActionBase,
1182
- x as FieldBase,
1183
- _ as Group,
1184
- G as List,
1319
+ W as AbortEventHandlingException,
1320
+ Xt as Action,
1321
+ L as ActionsMap,
1322
+ Rt as ConditionalEnabledAction,
1323
+ M as ConditionalStatementAction,
1324
+ Bt as ConditionalValueAction,
1325
+ Lt as ConditionalVisibilityAction,
1326
+ S as DisplayMode,
1327
+ zt as EmptyField,
1328
+ ct as EnabledChangedAction,
1329
+ ut as EnabledChangingAction,
1330
+ ft as ExecuteAction,
1331
+ $ as Field,
1332
+ m as FieldActionBase,
1333
+ V as FieldBase,
1334
+ C as Group,
1335
+ Y as List,
1185
1336
  z as ListItemAddedAction,
1186
- ue as ListItemRemovedAction,
1187
- j as MdString,
1188
- De as MessagesWidget,
1189
- d as Operator,
1190
- Ve as RenderableValue,
1191
- w as Statement,
1192
- ae as ValidChangedAction,
1193
- X as ValidationError,
1194
- p as ValidationErrorRenderContent,
1195
- _e as ValidationErrorText,
1337
+ pt as ListItemRemovedAction,
1338
+ O as MdString,
1339
+ Gt as MessagesWidget,
1340
+ c as Operator,
1341
+ jt as RenderableValue,
1342
+ N as Statement,
1343
+ ht as ValidChangedAction,
1344
+ G as ValidationError,
1345
+ g as ValidationErrorRenderContent,
1346
+ Ft as ValidationErrorText,
1196
1347
  f as Validator,
1197
- et as Validators,
1198
- m as ValueChangedAction,
1199
- oe as VisibilityChangedAction,
1200
- le as VisibilityChangingAction,
1201
- v as buildErrorMessage,
1202
- rt as default,
1203
- it as forms,
1204
- U as isCallableFunction,
1205
- W as isSimpleComponentDef
1348
+ le as Validators,
1349
+ y as ValueChangedAction,
1350
+ gt as VisibilityChangedAction,
1351
+ dt as VisibilityChangingAction,
1352
+ b as buildErrorMessage,
1353
+ de as default,
1354
+ he as forms,
1355
+ k as isCallableFunction,
1356
+ X as isSimpleComponentDef
1206
1357
  };
1207
1358
  //# sourceMappingURL=dynamicforms-vue-forms.js.map