@dynamicforms/vue-forms 0.5.1 → 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 ft = Object.defineProperty, pt = Object.defineProperties;
2
- var bt = Object.getOwnPropertyDescriptors;
3
- var O = Object.getOwnPropertySymbols;
4
- var K = Object.prototype.hasOwnProperty, Z = Object.prototype.propertyIsEnumerable;
5
- var q = (i, s, t) => s in i ? ft(i, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : i[s] = t, _ = (i, s) => {
6
- for (var t in s || (s = {}))
7
- K.call(s, t) && q(i, t, s[t]);
8
- if (O)
9
- for (var t of O(s))
10
- Z.call(s, t) && q(i, t, s[t]);
11
- return i;
12
- }, R = (i, s) => pt(i, bt(s));
13
- var I = (i, s) => {
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
14
  var t = {};
15
- for (var e in i)
16
- K.call(i, e) && s.indexOf(e) < 0 && (t[e] = i[e]);
17
- if (i != null && O)
18
- for (var e of O(i))
19
- s.indexOf(e) < 0 && Z.call(i, e) && (t[e] = i[e]);
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
20
  return t;
21
21
  };
22
- var l = (i, s, t) => q(i, typeof s != "symbol" ? s + "" : s, t);
23
- import { isEqual as k, isBoolean as vt, isString as C, isEmpty as H, truncate as mt, isArray as nt, isObject as it } from "lodash-es";
24
- import { unref as g, computed as G, reactive as yt, defineComponent as xt, resolveComponent as tt, openBlock as Et, createBlock as _t, h as S } from "vue";
25
- var w = /* @__PURE__ */ ((i) => (i[i.SUPPRESS = 1] = "SUPPRESS", i[i.HIDDEN = 5] = "HIDDEN", i[i.INVISIBLE = 8] = "INVISIBLE", i[i.FULL = 10] = "FULL", i))(w || {});
26
- const et = 10;
27
- ((i) => {
28
- function s(n) {
29
- return n.toUpperCase() === "SUPPRESS" ? 1 : n.toUpperCase() === "HIDDEN" ? 5 : n.toUpperCase() === "INVISIBLE" ? 8 : et;
30
- }
31
- i.fromString = s;
32
- function t(n) {
33
- const r = typeof n == "number" ? n : i.fromString(n);
34
- return Object.values(i).includes(r) ? r : et;
35
- }
36
- i.fromAny = t;
37
- function e(n) {
38
- const r = typeof n == "number" ? n : i.fromString(n);
39
- return Object.values(i).includes(r);
40
- }
41
- i.isDefined = e;
42
- })(w || (w = {}));
43
- Object.freeze(w);
44
- const V = w;
45
- class b {
46
- constructor(s) {
47
- l(this, "executorFn");
48
- this.executorFn = 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
+ o(this, "executorFn");
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, t, ...e) {
57
- return this.executorFn(s, t, ...e);
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 rt = /* @__PURE__ */ Symbol("ValueChangedAction");
71
- class v 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 rt;
76
+ return lt;
77
77
  }
78
- execute(s, t, e, n) {
79
- return super.execute(s, t, e, n);
78
+ execute(i, t, e, s) {
79
+ return super.execute(i, t, e, s);
80
80
  }
81
81
  }
82
- class N extends String {
83
- constructor(t, e, n) {
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) {
84
96
  super(t);
85
- l(this, "plugins");
86
- l(this, "options");
87
- this.plugins = n, this.options = e;
97
+ o(this, "plugins");
98
+ o(this, "options");
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,11 +120,11 @@ class X {
108
120
  return "";
109
121
  }
110
122
  }
111
- class Ct extends X {
123
+ class Ft extends G {
112
124
  constructor(t, e = "") {
113
125
  super();
114
- l(this, "text");
115
- l(this, "classes");
126
+ o(this, "text");
127
+ o(this, "classes");
116
128
  this.text = t, this.classes = e;
117
129
  }
118
130
  get componentName() {
@@ -125,24 +137,24 @@ class Ct extends X {
125
137
  return this.classes;
126
138
  }
127
139
  }
128
- class p extends X {
140
+ class g extends G {
129
141
  constructor(t, e = "") {
130
142
  super();
131
- l(this, "classes");
132
- l(this, "text");
133
- l(this, "textType");
134
- this.classes = e, this.text = t, this.textType = G(() => this.getTextType);
143
+ o(this, "classes");
144
+ o(this, "text");
145
+ o(this, "textType");
146
+ this.classes = e, this.text = t, this.textType = xt(() => this.getTextType);
135
147
  }
136
148
  get resolvedText() {
137
- const t = g(this.text);
138
- return U(t) ? t() : t;
149
+ const t = h(this.text);
150
+ return k(t) ? t() : t;
139
151
  }
140
152
  get getTextType() {
141
153
  const t = this.resolvedText;
142
- return t ? t instanceof N ? "md" : W(t) ? "component" : "string" : "string";
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,7 +166,7 @@ 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": {
@@ -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,128 +193,163 @@ class p extends X {
181
193
  return this.classes;
182
194
  }
183
195
  }
184
- class Vt 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 At = /* @__PURE__ */ Symbol("Validator");
187
- class f extends v {
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
208
  constructor(t) {
193
- super((n, r, a, o) => {
194
- const c = t(a, o, n) || [], u = (h) => {
195
- var A;
196
- h == null || h.forEach(
197
- (x) => Object.defineProperty(x, "source", { value: this.source, enumerable: !1, configurable: !1 })
198
- );
199
- for (let x = n.errors.length - 1; x >= 0; x--) {
200
- const j = n.errors[x];
201
- if (j.source === this.source) {
202
- const P = (A = h == null ? void 0 : h.findIndex(($) => k($, j))) != null ? A : -1;
203
- P >= 0 ? h == null || h.splice(P, 1) : n.errors.splice(x, 1);
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.validating = ++n.validatingCount > 0, c.then((h) => u(h)).finally(() => {
209
- n.validatingCount = Math.max(0, n.validatingCount - 1), n.validating = n.validatingCount > 0;
210
- })) : u(c), r(n, a, o);
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);
211
233
  });
212
- l(this, "source");
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());
213
242
  this.source = Symbol(this.constructor.name);
214
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
+ }
215
260
  static get classIdentifier() {
216
- return At;
261
+ return Nt;
217
262
  }
218
263
  get eager() {
219
264
  return !0;
220
265
  }
221
266
  replacePlaceholdersFunction(t, e) {
222
267
  return () => {
223
- let n = g(t);
224
- for (; U(n); )
225
- n = g(this.replacePlaceholders(n(), e));
226
- return n;
268
+ let s = h(t);
269
+ for (; k(s); )
270
+ s = h(this.replacePlaceholders(s(), e));
271
+ return s;
227
272
  };
228
273
  }
229
274
  replacePlaceholders(t, e) {
230
- if (U(t)) return this.replacePlaceholdersFunction(t, e);
231
- if (W(t)) return t;
232
- let n = g(t);
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);
233
280
  return Object.keys(e).forEach((r) => {
234
- n = n.replaceAll(`{${r}}`, e[r]);
235
- }), t instanceof N ? new N(n.toString(), t.options, t.plugins) : n;
281
+ s = s.replaceAll(`{${r}}`, e[r]);
282
+ }), t instanceof O ? new O(s.toString(), t.options, t.plugins) : s;
236
283
  }
237
284
  }
238
- class T extends Map {
285
+ class L extends Map {
239
286
  constructor() {
240
287
  super(...arguments);
241
- l(this, "eagerActions", /* @__PURE__ */ new Set());
242
- l(this, "registeredActions", []);
288
+ o(this, "eagerActions", /* @__PURE__ */ new Set());
289
+ o(this, "registeredActions", []);
243
290
  }
244
291
  register(t) {
245
- if (!(t instanceof b)) throw new Error("Invalid action type");
292
+ if (!(t instanceof m)) throw new Error("Invalid action type");
246
293
  this.registeredActions.push(t);
247
- const e = t.classIdentifier, n = this.get(e) || (() => null);
248
- function r(a, ...o) {
249
- return t.execute(a, n, ...o);
294
+ const e = t.classIdentifier, s = this.get(e) || (() => null);
295
+ function r(a, ...l) {
296
+ return t.execute(a, s, ...l);
250
297
  }
251
298
  this.set(e, r), t.eager && this.eagerActions.add(t.classIdentifier);
252
299
  }
253
- trigger(t, e, ...n) {
300
+ trigger(t, e, ...s) {
254
301
  const r = t.classIdentifier;
255
- r === rt && this.triggerEager(e, ...n);
302
+ r === lt && this.triggerEager(e, ...s);
256
303
  const a = this.get(r);
257
304
  try {
258
- if (a) return a(e, ...n);
259
- } catch (o) {
260
- if (!(o instanceof Q)) throw o;
305
+ if (a) return a(e, ...s);
306
+ } catch (l) {
307
+ if (!(l instanceof W)) throw l;
261
308
  }
262
309
  return null;
263
310
  }
264
311
  triggerEager(t, ...e) {
265
- for (const n of this.eagerActions) {
266
- const r = this.get(n);
312
+ for (const s of this.eagerActions) {
313
+ const r = this.get(s);
267
314
  try {
268
315
  r && r(t, ...e);
269
316
  } catch (a) {
270
- if (!(a instanceof Q)) throw a;
317
+ if (!(a instanceof W)) throw a;
271
318
  }
272
319
  }
273
320
  }
274
321
  clone() {
275
- const t = new T();
322
+ const t = new L();
276
323
  return this.registeredActions.forEach((e) => t.register(e)), t;
277
324
  }
278
325
  cloneWithoutValidators() {
279
- const t = new T();
326
+ const t = new L();
280
327
  return this.registeredActions.forEach((e) => {
281
328
  e instanceof f ? e.unregister() : t.register(e);
282
329
  }), t;
283
330
  }
284
331
  }
285
- const It = /* @__PURE__ */ Symbol("ConditionalStatementAction");
286
- class B extends v {
332
+ const Ot = /* @__PURE__ */ Symbol("ConditionalStatementAction");
333
+ class M extends y {
287
334
  constructor(t, e) {
288
- const n = (r, a, o, c) => {
289
- const u = t.evaluate();
290
- if (u !== this.lastResult) {
291
- for (const h of this.boundFields)
292
- e(h, u, this.lastResult);
293
- this.lastResult = u;
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;
294
341
  }
295
- return a(r, o, c);
342
+ return a(r, l, u);
296
343
  };
297
- super(n);
298
- l(this, "lastResult");
344
+ super(s);
345
+ o(this, "lastResult");
299
346
  // boundField tracks the fields this action is bound to. so that it may perform the executorFn on them and not on the
300
347
  // ValueChangedAction fields that will call the actionExecutor
301
- l(this, "boundFields", /* @__PURE__ */ new Set());
302
- t.collectFields().forEach((r) => r.registerAction(new v(n)));
348
+ o(this, "boundFields", /* @__PURE__ */ new Set());
349
+ t.collectFields().forEach((r) => r.registerAction(new y(s)));
303
350
  }
304
351
  static get classIdentifier() {
305
- return It;
352
+ return Ot;
306
353
  }
307
354
  get eager() {
308
355
  return !0;
@@ -311,30 +358,30 @@ class B extends v {
311
358
  this.boundFields.add(t);
312
359
  }
313
360
  }
314
- class St extends B {
315
- constructor(s) {
316
- super(s, (t, e) => {
317
- t.visibility = e ? V.FULL : V.SUPPRESS;
361
+ class Lt extends M {
362
+ constructor(i) {
363
+ super(i, (t, e) => {
364
+ t.visibility = e ? S.FULL : S.SUPPRESS;
318
365
  });
319
366
  }
320
367
  }
321
- class Ft extends B {
322
- constructor(s) {
323
- super(s, (t, e) => {
368
+ class Rt extends M {
369
+ constructor(i) {
370
+ super(i, (t, e) => {
324
371
  t.enabled = e;
325
372
  });
326
373
  }
327
374
  }
328
- class wt extends B {
329
- constructor(s, t) {
330
- super(s, (e, n) => {
331
- n && (e.value = t);
375
+ class Bt extends M {
376
+ constructor(i, t) {
377
+ super(i, (e, s) => {
378
+ s && (e.value = t);
332
379
  });
333
380
  }
334
381
  }
335
- var L = /* @__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))(L || {});
336
- ((i) => {
337
- 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) {
338
385
  const a = r.toLowerCase();
339
386
  if (a === "not") return 0;
340
387
  if (a === "or") return 1;
@@ -354,119 +401,160 @@ var L = /* @__PURE__ */ ((i) => (i[i.NOT = 0] = "NOT", i[i.OR = 1] = "OR", i[i.A
354
401
  if (["not_includes", "not-includes", "not includes"].includes(a)) return -10;
355
402
  throw new Error(`Unrecognised operator ${a}`);
356
403
  }
357
- i.fromString = s;
404
+ n.fromString = i;
358
405
  function t(r) {
359
- const a = typeof r == "number" ? r : i.fromString(r);
360
- if (Object.values(i).includes(a)) return a;
406
+ const a = typeof r == "number" ? r : n.fromString(r);
407
+ if (Object.values(n).includes(a)) return a;
361
408
  throw new Error(`Unrecognised operator ${r}`);
362
409
  }
363
- i.fromAny = t;
410
+ n.fromAny = t;
364
411
  function e(r) {
365
- const a = typeof r == "number" ? r : i.fromString(r);
366
- return Object.values(i).includes(a);
412
+ const a = typeof r == "number" ? r : n.fromString(r);
413
+ return Object.values(n).includes(a);
367
414
  }
368
- i.isDefined = e;
369
- function n(r) {
415
+ n.isDefined = e;
416
+ function s(r) {
370
417
  return r >= 0;
371
418
  }
372
- i.isLogicOperator = n;
373
- })(L || (L = {}));
374
- Object.freeze(L);
375
- const d = L, Nt = /* @__PURE__ */ Symbol("EnabledChangingAction");
376
- class at extends b {
377
- constructor(s) {
378
- 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);
379
426
  }
380
427
  static get classIdentifier() {
381
- return Nt;
428
+ return Ut;
382
429
  }
383
- execute(s, t, e, n) {
384
- return super.execute(s, t, e, n);
430
+ execute(i, t, e, s) {
431
+ return super.execute(i, t, e, s);
385
432
  }
386
433
  }
387
- const Tt = /* @__PURE__ */ Symbol("EnabledChangedAction");
388
- class ot extends b {
389
- constructor(s) {
390
- super(s);
434
+ const kt = /* @__PURE__ */ Symbol("EnabledChangedAction");
435
+ class ct extends m {
436
+ constructor(i) {
437
+ super(i);
391
438
  }
392
439
  static get classIdentifier() {
393
- return Tt;
440
+ return kt;
394
441
  }
395
- execute(s, t, e, n) {
396
- return super.execute(s, t, e, n);
442
+ execute(i, t, e, s) {
443
+ return super.execute(i, t, e, s);
397
444
  }
398
445
  }
399
- const Lt = /* @__PURE__ */ Symbol("ValidChangedAction");
400
- class lt extends b {
401
- constructor(s) {
402
- super(s);
446
+ const Dt = /* @__PURE__ */ Symbol("ValidChangedAction");
447
+ class ht extends m {
448
+ constructor(i) {
449
+ super(i);
403
450
  }
404
451
  static get classIdentifier() {
405
- return Lt;
452
+ return Dt;
406
453
  }
407
- execute(s, t, e, n) {
408
- return super.execute(s, t, e, n);
454
+ execute(i, t, e, s) {
455
+ return super.execute(i, t, e, s);
409
456
  }
410
457
  }
411
- const jt = /* @__PURE__ */ Symbol("VisibilityChangingAction");
412
- class ct extends b {
413
- constructor(s) {
414
- super(s);
458
+ const Mt = /* @__PURE__ */ Symbol("VisibilityChangingAction");
459
+ class dt extends m {
460
+ constructor(i) {
461
+ super(i);
415
462
  }
416
463
  static get classIdentifier() {
417
- return jt;
464
+ return Mt;
418
465
  }
419
- execute(s, t, e, n) {
420
- return super.execute(s, t, e, n);
466
+ execute(i, t, e, s) {
467
+ return super.execute(i, t, e, s);
421
468
  }
422
469
  }
423
- const Pt = /* @__PURE__ */ Symbol("VisibilityChangedAction");
424
- class ut extends b {
425
- constructor(s) {
426
- super(s);
470
+ const $t = /* @__PURE__ */ Symbol("VisibilityChangedAction");
471
+ class gt extends m {
472
+ constructor(i) {
473
+ super(i);
427
474
  }
428
475
  static get classIdentifier() {
429
- return Pt;
476
+ return $t;
430
477
  }
431
- execute(s, t, e, n) {
432
- return super.execute(s, t, e, n);
478
+ execute(i, t, e, s) {
479
+ return super.execute(i, t, e, s);
433
480
  }
434
481
  }
435
- class y {
482
+ class V {
483
+ /**
484
+ * A field is a Vue reactive proxy from construction onwards: the base constructor returns the proxy, and a
485
+ * derived class's `this` is whatever super() returned, so every subclass constructor, field initializer and
486
+ * method sees the proxy. Consequence: plain `field.property = value` is tracked, with no wrapper in between.
487
+ */
436
488
  constructor() {
437
- l(this, "reactiveValue", G(() => this.value));
438
489
  // contains original field value as was provided at creation
439
- l(this, "validatingCount", 0);
440
- l(this, "validating", !1);
441
- l(this, "_valid", !0);
490
+ o(this, "validatingCount", 0);
491
+ o(this, "_valid", !0);
442
492
  // is current value valid as per FE and BE validators?
443
- l(this, "errors", []);
493
+ o(this, "errors", []);
444
494
  // when member of a Group, fieldName specifies the name of this field
445
- l(this, "actions", new T());
495
+ o(this, "actions", new L());
446
496
  // default property handlers
447
- l(this, "_visibility", V.FULL);
448
- l(this, "_enabled", !0);
497
+ o(this, "_visibility", S.FULL);
498
+ o(this, "_enabled", !0);
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);
518
+ }
519
+ /** true while at least one asynchronous validator is still running for this field */
520
+ get validating() {
521
+ return this.validatingCount > 0;
522
+ }
523
+ /** announces the start of one asynchronous validation run; validators pair it with endValidating */
524
+ beginValidating() {
525
+ this.validatingCount++;
526
+ }
527
+ /** announces the end of one asynchronous validation run */
528
+ endValidating() {
529
+ this.validatingCount = Math.max(0, this.validatingCount - 1);
449
530
  }
450
531
  get visibility() {
451
532
  return this._visibility;
452
533
  }
453
- set visibility(s) {
454
- const t = this._visibility, e = this.actions.trigger(ct, this, s, t);
455
- if (!V.isDefined(e != null ? e : s)) throw new Error("visibility must be a DisplayMode constant");
456
- this._visibility = V.fromAny(e != null ? e : s), this.actions.trigger(ut, this, this._visibility, t);
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);
457
538
  }
458
539
  get enabled() {
459
540
  return this._enabled;
460
541
  }
461
- set enabled(s) {
462
- const t = this._enabled, e = this.actions.trigger(at, this, s, t);
463
- if (!vt(e != null ? e : s)) throw new Error("Enabled value must be boolean");
464
- this._enabled = e != null ? e : s, this.actions.trigger(ot, this, this._enabled, t);
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);
465
546
  }
466
- validate(s = !1) {
467
- s && this.actions.triggerEager(this, this.value, this.value);
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());
551
+ }
552
+ validate(i = !1) {
553
+ var e;
554
+ if (this.suppressValidation) return;
555
+ i && this.actions.triggerEager(this, this.value, this.value);
468
556
  const t = this._valid;
469
- this._valid = this.valid, this._valid !== t && this.actions.trigger(lt, this, this.valid, t);
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());
470
558
  }
471
559
  get valid() {
472
560
  return this.errors.length === 0;
@@ -475,73 +563,94 @@ class y {
475
563
  return this.value;
476
564
  }
477
565
  get isChanged() {
478
- return !k(this.value, this.originalValue);
566
+ return !D(this.value, this.originalValue);
567
+ }
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
+ });
479
577
  }
480
- registerAction(s) {
481
- const t = s;
482
- return this.actions.register(t), t.boundToField(this), t.eager && this.actions.trigger(Object.getPrototypeOf(s).constructor, this, this.value, this.originalValue), this;
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;
483
580
  }
484
- triggerAction(s, ...t) {
485
- return this.actions.trigger(s, this, ...t);
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;
486
591
  }
487
592
  clearValidators() {
488
- this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this._valid = !0;
593
+ this._validationEpoch++, this.actions = this.actions.cloneWithoutValidators(), this.errors = [], this.validate();
489
594
  }
490
595
  }
491
- function Ot(i, s) {
492
- return i ? !s : s;
596
+ function qt(n, i) {
597
+ return n ? !i : i;
493
598
  }
494
- class F {
495
- constructor(s, t, e) {
496
- l(this, "operand1");
497
- l(this, "operator");
498
- l(this, "operand2");
499
- this.operand1 = s, this.operator = t, this.operand2 = e;
599
+ class N {
600
+ constructor(i, t, e) {
601
+ o(this, "operand1");
602
+ o(this, "operator");
603
+ o(this, "operand2");
604
+ this.operand1 = i, this.operator = t, this.operand2 = e;
500
605
  }
501
606
  get operand1Value() {
502
- return this.operand1 instanceof F ? this.operand1.evaluate() : this.operand1 instanceof y ? 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;
503
608
  }
504
609
  get operand2Value() {
505
- return this.operand2 instanceof F ? this.operand2.evaluate() : this.operand2 instanceof y ? 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;
506
611
  }
507
612
  evaluate() {
508
- var e, n, r, a;
509
- const s = this.operand1Value, t = this.operand2Value;
613
+ var e, s;
614
+ const i = this.operand1Value, t = this.operand2Value;
510
615
  switch (this.operator) {
511
616
  // logical operators
512
- case d.AND:
513
- return s && t;
514
- case d.OR:
515
- return s || t;
516
- case d.NAND:
517
- return !(s && t);
518
- case d.NOR:
519
- return !(s || t);
520
- case d.XOR:
521
- return Ot(s, t);
522
- case d.NOT:
523
- 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;
524
633
  // comparison operators
525
- case d.EQUALS:
526
- return s == t;
527
- case d.NOT_EQUALS:
528
- return s != t;
529
- case d.LT:
530
- return s < t;
531
- case d.LE:
532
- return s <= t;
533
- case d.GE:
534
- return s >= t;
535
- case d.GT:
536
- return s > t;
537
- case d.IN:
538
- return (n = (e = t == null ? void 0 : t.includes) == null ? void 0 : e.call(t, s)) != null ? n : !1;
539
- case d.NOT_IN:
540
- return !((a = (r = t == null ? void 0 : t.includes) == null ? void 0 : r.call(t, s)) == null || a);
541
- case d.INCLUDES:
542
- return C(s) && C(t) && s.indexOf(t) >= 0;
543
- case d.NOT_INCLUDES:
544
- return !(C(s) && C(t) && s.indexOf(t) >= 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);
545
654
  default:
546
655
  throw new Error(`Operator not implemented ${this.operator}`);
547
656
  }
@@ -551,82 +660,86 @@ class F {
551
660
  * @returns A set of all fields used in this statement
552
661
  */
553
662
  collectFields() {
554
- const s = /* @__PURE__ */ new Set();
663
+ const i = /* @__PURE__ */ new Set();
555
664
  function t(e) {
556
- e instanceof y ? s.add(e) : e instanceof F && e.collectFields().forEach((r) => s.add(r));
665
+ e instanceof V ? i.add(e) : e instanceof N && e.collectFields().forEach((r) => i.add(r));
557
666
  }
558
- return t(this.operand1), t(this.operand2), s;
667
+ return t(this.operand1), t(this.operand2), i;
559
668
  }
560
669
  }
561
- const Rt = /* @__PURE__ */ Symbol("ExecuteAction");
562
- class ht extends b {
563
- constructor(s) {
564
- super(s);
670
+ const Ht = /* @__PURE__ */ Symbol("ExecuteAction");
671
+ class ft extends m {
672
+ constructor(i) {
673
+ super(i);
565
674
  }
566
675
  static get classIdentifier() {
567
- return Rt;
676
+ return Ht;
568
677
  }
569
- execute(s, t, e) {
570
- return super.execute(s, t, e);
678
+ execute(i, t, e) {
679
+ return super.execute(i, t, e);
571
680
  }
572
681
  }
573
- const Ut = /* @__PURE__ */ Symbol("ListItemAddedAction");
574
- class z extends b {
575
- constructor(s) {
576
- super(s);
682
+ const Qt = /* @__PURE__ */ Symbol("ListItemAddedAction");
683
+ class z extends m {
684
+ constructor(i) {
685
+ super(i);
577
686
  }
578
687
  static get classIdentifier() {
579
- return Ut;
688
+ return Qt;
580
689
  }
581
- execute(s, t, e, n) {
582
- return super.execute(s, t, e, n);
690
+ execute(i, t, e, s) {
691
+ return super.execute(i, t, e, s);
583
692
  }
584
693
  }
585
- const kt = /* @__PURE__ */ Symbol("ListItemRemovedAction");
586
- class dt extends b {
587
- constructor(s) {
588
- super(s);
694
+ const Wt = /* @__PURE__ */ Symbol("ListItemRemovedAction");
695
+ class pt extends m {
696
+ constructor(i) {
697
+ super(i);
589
698
  }
590
699
  static get classIdentifier() {
591
- return kt;
700
+ return Wt;
592
701
  }
593
- execute(s, t, e, n) {
594
- return super.execute(s, t, e, n);
702
+ execute(i, t, e, s) {
703
+ return super.execute(i, t, e, s);
595
704
  }
596
705
  }
597
- const st = /* @__PURE__ */ Symbol("FieldConstructorGuard");
598
- class D extends y {
706
+ class $ extends V {
599
707
  constructor(t) {
600
708
  super();
601
- l(this, "_value");
602
- l(this, "_touched", !1);
603
- if (t !== st) {
604
- const e = this.constructor.name;
605
- throw new TypeError(`Don't use constructor to instantiate ${e}. Use ${e}.create<T>`);
606
- }
709
+ o(this, "_value");
710
+ o(this, "_touched", !1);
711
+ this.init(t);
607
712
  }
713
+ /**
714
+ * Applies the constructor parameters. It is a hook so that a subclass needing different parameter handling
715
+ * overrides one method instead of redeclaring the constructor - Action does exactly that.
716
+ *
717
+ * It is called from this constructor, so it runs before a subclass's own class field initializers, which
718
+ * only run once super() returns. An override must therefore work off its parameters alone: members the
719
+ * subclass initializes read as undefined inside it, and anything it writes to such a member is overwritten
720
+ * the moment the initializer runs.
721
+ */
608
722
  init(t) {
609
723
  if (t) {
610
- const e = t, { value: n, validators: r, actions: a } = e, o = I(e, ["value", "validators", "actions"]);
611
- [...r || [], ...a || []].forEach((c) => this.registerAction(c)), Object.assign(this, o), this._value = n != null ? n : this.originalValue, this.originalValue === void 0 && (this.originalValue = this._value);
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);
612
726
  }
613
727
  this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
614
728
  }
615
- /**
616
- * Creates a new reactive Field instance.
617
- * @param params Initial field parameters
618
- * @returns Reactive Field instance
619
- */
620
- static create(t) {
621
- const e = yt(new this(st));
622
- return e.init(t), e;
623
- }
624
729
  get value() {
625
730
  return this._value;
626
731
  }
627
732
  set value(t) {
628
733
  const e = this._value;
629
- !this.enabled || e === t || (this._value = t, this.actions.trigger(v, this, this._value, e), this.parent && this.parent.notifyValueChanged(), this.validate());
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
+ }
630
743
  }
631
744
  get touched() {
632
745
  return this._touched;
@@ -635,64 +748,59 @@ class D extends y {
635
748
  this._touched = t;
636
749
  }
637
750
  clone(t) {
638
- var n, r, a;
639
- const e = this.constructor.create(R(_({
640
- value: (n = t == null ? void 0 : t.value) != null ? n : this.value
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
641
755
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
642
756
  enabled: (r = t == null ? void 0 : t.enabled) != null ? r : this.enabled,
643
757
  visibility: (a = t == null ? void 0 : t.visibility) != null ? a : this.visibility
644
758
  }));
645
- return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
759
+ return s.actions = this.actions.clone(), s.actions.triggerEager(s, s.value, s.originalValue), s;
646
760
  }
647
761
  }
648
- const Bt = D.create({ value: "EmptyField" }).registerAction(
649
- new v(() => {
762
+ const zt = new $({ value: "EmptyField" }).registerAction(
763
+ new y(() => {
650
764
  console.warn("Working with EmptyField! This should not happen");
651
765
  })
652
766
  );
653
- function M(i, s) {
654
- 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;
655
769
  }
656
- class Dt extends D {
657
- constructor(s) {
658
- super(s), this._value = { label: void 0, icon: void 0 };
659
- }
660
- init(s) {
661
- if (s) {
662
- const t = s, { value: e, originalValue: n, validators: r, actions: a } = t, o = I(t, ["value", "originalValue", "validators", "actions"]);
663
- [...r || [], ...a || []].forEach((h) => this.registerAction(h)), Object.assign(this, o);
664
- const c = M(e, this._value), u = Object.freeze({ label: n == null ? void 0 : n.label, icon: n == null ? void 0 : n.icon });
665
- this._value = M(c, 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);
666
777
  }
667
778
  this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
668
779
  }
669
- static create(s) {
670
- return super.create(s);
671
- }
672
780
  get icon() {
673
781
  return this.value.icon;
674
782
  }
675
- set icon(s) {
676
- this.value.icon = s;
783
+ set icon(i) {
784
+ this.value.icon = i;
677
785
  }
678
786
  get label() {
679
787
  return this.value.label;
680
788
  }
681
- set label(s) {
682
- this.value.label = s;
789
+ set label(i) {
790
+ this.value.label = i;
683
791
  }
684
- execute(s) {
685
- this.actions.trigger(ht, this, s);
792
+ execute(i) {
793
+ this.actions.trigger(ft, this, i);
686
794
  }
687
795
  }
688
- const $t = /* @__PURE__ */ xt({
796
+ const Gt = /* @__PURE__ */ It({
689
797
  __name: "messages-widget",
690
798
  props: {
691
799
  message: {},
692
800
  classes: {}
693
801
  },
694
- setup(i) {
695
- const s = i, t = tt("vue-markdown"), e = /* @__PURE__ */ new Set([
802
+ setup(n) {
803
+ const i = n, t = st("vue-markdown"), e = /* @__PURE__ */ new Set([
696
804
  "div",
697
805
  "span",
698
806
  "p",
@@ -748,37 +856,37 @@ const $t = /* @__PURE__ */ xt({
748
856
  "dl",
749
857
  "dt",
750
858
  "dd"
751
- ]), n = () => {
752
- 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);
753
861
  const r = [];
754
- return s.message.forEach((a) => {
862
+ return i.message.forEach((a) => {
755
863
  switch (a.componentName) {
756
864
  case "template":
757
- r.push(S("div", { class: [s.classes, a.extraClasses] }, a.componentBody));
865
+ r.push(j("div", { class: [i.classes, a.extraClasses] }, a.componentBody));
758
866
  break;
759
867
  case "vue-markdown":
760
868
  if (typeof t == "string")
761
869
  console.warn(
762
870
  "You are using markdown for messages-widget, but you haven't registered a vue-markdown component"
763
- ), 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));
764
872
  else {
765
- const o = a.componentBindings;
873
+ const l = a.componentBindings;
766
874
  r.push(
767
- S(t, {
768
- class: [s.classes, a.extraClasses, "df-messages-widget-markdown"],
769
- source: o.source,
770
- options: o.options,
771
- plugins: o.plugins
875
+ j(t, {
876
+ class: [i.classes, a.extraClasses, "df-messages-widget-markdown"],
877
+ source: l.source,
878
+ options: l.options,
879
+ plugins: l.plugins
772
880
  })
773
881
  );
774
882
  }
775
883
  break;
776
884
  default:
777
885
  r.push(
778
- S(
779
- e.has(a.componentName.toLowerCase()) ? a.componentName : tt(a.componentName),
780
- _(_({
781
- 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]
782
890
  }, a.componentBindings), a.componentBody ? { innerHTML: a.componentBody } : {})
783
891
  )
784
892
  );
@@ -786,45 +894,38 @@ const $t = /* @__PURE__ */ xt({
786
894
  }
787
895
  }), r;
788
896
  };
789
- return (r, a) => (Et(), _t(n));
897
+ return (r, a) => (At(), St(s));
790
898
  }
791
899
  });
792
- class E extends y {
900
+ class C extends V {
793
901
  constructor(t, e) {
794
902
  super();
795
- l(this, "_fields");
796
- l(this, "_value", null);
797
- l(this, "reactiveValue", G(() => this.value));
798
- l(this, "suppressNotifyValueChanged", !1);
799
- if (!E.isValidFields(t)) throw new Error("Invalid fields object provided");
800
- if (this._fields = {}, Object.entries(t).forEach(([r, a]) => this.addField(r, a)), e) {
801
- const n = e, { value: r, validators: a, actions: o } = n, c = I(n, ["value", "validators", "actions"]);
802
- [...a || [], ...o || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), this.value = r != null ? r : this.originalValue;
903
+ o(this, "_fields");
904
+ o(this, "_value", null);
905
+ o(this, "suppressNotifyValueChanged", !1);
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);
803
910
  }
804
- 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();
805
912
  }
806
913
  addField(t, e) {
807
- if (this.fields[t] !== void 0)
914
+ if (Object.hasOwn(this._fields, t))
808
915
  throw new Error(`Field ${t} is already in this form`);
809
- 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, {
810
- get() {
811
- return e;
812
- },
813
- configurable: !1,
814
- enumerable: !0
815
- });
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 });
816
917
  }
817
918
  static isValidFields(t) {
818
- function e(n) {
819
- return n instanceof y;
919
+ function e(s) {
920
+ return s instanceof V;
820
921
  }
821
- return typeof t == "object" && t !== null && Object.entries(t).every(([, n]) => e(n));
922
+ return typeof t == "object" && t !== null && Object.entries(t).every(([, s]) => e(s));
822
923
  }
823
924
  static createFromFormData(t) {
824
- if (t instanceof y)
925
+ if (t instanceof V)
825
926
  throw new Error("data is already a Form structure, should be a simple object");
826
- return new E(
827
- t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, n]) => [e, D.create({ value: n })]))
927
+ return new C(
928
+ t == null ? {} : Object.fromEntries(Object.entries(t).map(([e, s]) => [e, new $({ value: s })]))
828
929
  );
829
930
  }
830
931
  field(t) {
@@ -835,22 +936,32 @@ class E extends y {
835
936
  return this._fields;
836
937
  }
837
938
  get value() {
838
- const t = {};
839
- return Object.entries(this._fields).forEach(([e, n]) => {
840
- const r = n.value;
841
- (n.enabled || n instanceof E && !H(r)) && (t[e] = r);
842
- }), H(t) ? null : t;
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);
843
944
  }
844
- set value(t) {
845
- 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;
846
955
  try {
847
- Object.entries(this._fields).forEach(([e, n]) => {
848
- (t == null || e in t) && (n.value = t == null ? null : t[e]);
956
+ Object.entries(this._fields).forEach(([r, a]) => {
957
+ (t == null || Object.hasOwn(t, r)) && (a.value = t == null ? null : t[r]);
849
958
  });
850
959
  } finally {
851
- this.suppressNotifyValueChanged = !1;
960
+ this.suppressNotifyValueChanged = e, this.suppressValidation = s;
852
961
  }
853
- this.notifyValueChanged(), this.validate();
962
+ }
963
+ set value(t) {
964
+ this.assignMembers(t), this.notifyValueChanged(), this.validate();
854
965
  }
855
966
  get touched() {
856
967
  return Object.values(this._fields).some((t) => t.touched);
@@ -861,67 +972,100 @@ class E extends y {
861
972
  });
862
973
  }
863
974
  get fullValue() {
864
- const t = {};
865
- return Object.entries(this._fields).forEach(([e, n]) => {
866
- t[e] = n.fullValue;
867
- }), t;
975
+ const t = /* @__PURE__ */ Object.create(null);
976
+ return Object.entries(this._fields).forEach(([e, s]) => {
977
+ t[e] = s.fullValue;
978
+ }), v({}, t);
868
979
  }
869
980
  notifyValueChanged() {
870
981
  if (this.suppressNotifyValueChanged) return;
871
982
  const t = this.value;
872
- if (!k(t, this._value)) {
983
+ if (!D(t, this._value)) {
873
984
  const e = this._value;
874
- this._value = t, this.actions.trigger(v, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
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
+ }
875
993
  }
876
994
  }
877
995
  get valid() {
878
996
  return super.valid && Object.values(this._fields).every((t) => t.valid);
879
997
  }
880
998
  validate(t = !1) {
881
- t && Object.values(this._fields).forEach((e) => e.validate(!0)), super.validate(t);
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);
882
1009
  }
883
1010
  clone(t) {
884
- var r, a, o;
885
- const e = {};
886
- Object.entries(this._fields).forEach(([c, u]) => {
887
- e[c] = u.clone();
1011
+ var r, a;
1012
+ const e = /* @__PURE__ */ Object.create(null);
1013
+ Object.entries(this._fields).forEach(([l, u]) => {
1014
+ e[l] = u.clone();
888
1015
  });
889
- const n = new E(e, R(_({
890
- value: (r = t == null ? void 0 : t.value) != null ? r : this.value
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
891
1019
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
892
- enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
893
- visibility: (o = t == null ? void 0 : t.visibility) != null ? o : this.visibility
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
894
1022
  }));
895
- 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;
896
1024
  }
897
1025
  }
898
- class Y extends y {
1026
+ class Y extends V {
899
1027
  constructor(t, e) {
900
1028
  super();
901
- l(this, "_value", null);
902
- l(this, "_itemTemplate");
903
- l(this, "_previousValue");
1029
+ o(this, "_value", null);
1030
+ o(this, "_itemTemplate");
1031
+ o(this, "_previousValue");
904
1032
  if (this._itemTemplate = t, e) {
905
- const n = e, { value: r, validators: a, actions: o } = n, c = I(n, ["value", "validators", "actions"]);
906
- [...a || [], ...o || []].forEach((u) => this.registerAction(u)), Object.assign(this, c), r && this.setValueInternal(r);
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);
907
1035
  }
908
1036
  this.originalValue === void 0 && (this.originalValue = this.value), this._previousValue = this.value, this.actions.triggerEager(this, this.value, this.originalValue), this.validate();
909
1037
  }
910
1038
  processSetValueItem(t) {
911
1039
  let e;
912
- return t instanceof E ? e = t : this._itemTemplate ? e = this._itemTemplate.clone({ value: t }) : e = E.createFromFormData(t), Object.defineProperty(e, "parent", { get: () => this, configurable: !1, enumerable: !1 }), 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;
1041
+ }
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);
913
1048
  }
914
1049
  setValueInternal(t) {
915
- Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
1050
+ t == null ? this._value = null : Array.isArray(t) && (this._value = t.map((e) => this.processSetValueItem(e)));
916
1051
  }
917
1052
  get value() {
918
1053
  var e;
919
- const t = (e = this._value) == null ? void 0 : e.map((n) => n.value);
920
- return H(t) ? null : t;
1054
+ const t = (e = this._value) == null ? void 0 : e.map((s) => s.value);
1055
+ return Q(t) ? null : t;
921
1056
  }
922
1057
  set value(t) {
923
- const e = this.value;
924
- this.setValueInternal(t), this.actions.trigger(v, this, this.value, e), this.parent && this.parent.notifyValueChanged(), this.validate();
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
1070
  get touched() {
927
1071
  var t;
@@ -929,283 +1073,286 @@ class Y extends y {
929
1073
  }
930
1074
  set touched(t) {
931
1075
  var e;
932
- (e = this._value) == null || e.forEach((n) => {
933
- n.touched = t;
1076
+ (e = this._value) == null || e.forEach((s) => {
1077
+ s.touched = t;
934
1078
  });
935
1079
  }
936
1080
  clone(t) {
937
- var n, r, a, o;
938
- const e = new Y((n = this._itemTemplate) == null ? void 0 : n.clone(), R(_({
939
- value: [...(r = t == null ? void 0 : t.value) != null ? r : this.value]
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 : []]
940
1085
  }, t && "originalValue" in t ? { originalValue: t.originalValue } : {}), {
941
1086
  enabled: (a = t == null ? void 0 : t.enabled) != null ? a : this.enabled,
942
- visibility: (o = t == null ? void 0 : t.visibility) != null ? o : this.visibility
1087
+ visibility: (l = t == null ? void 0 : t.visibility) != null ? l : this.visibility
943
1088
  }));
944
1089
  return e.actions = this.actions.clone(), e.actions.triggerEager(e, e.value, e.originalValue), e;
945
1090
  }
946
1091
  notifyValueChanged() {
947
1092
  const t = this.value;
948
- if (!k(t, this._previousValue)) {
1093
+ if (!D(t, this._previousValue)) {
949
1094
  const e = this._previousValue;
950
- this._previousValue = t, this.actions.trigger(v, this, t, e), this.parent && this.parent.notifyValueChanged(), this.validate();
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
+ }
951
1103
  }
952
1104
  }
953
1105
  get valid() {
954
1106
  var t, e;
955
- return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((n) => n.valid)) != null ? e : !0);
1107
+ return super.valid && ((e = (t = this._value) == null ? void 0 : t.every((s) => s.valid)) != null ? e : !0);
956
1108
  }
957
1109
  validate(t = !1) {
958
1110
  var e;
959
- t && ((e = this._value) == null || e.forEach((n) => n.validate(!0))), super.validate(t);
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);
960
1121
  }
961
1122
  get(t) {
962
1123
  return this._value != null ? this._value[t] : void 0;
963
1124
  }
964
1125
  push(t) {
965
- var e, n;
966
- return this.insert(t, (n = (e = this._value) == null ? void 0 : e.length) != null ? n : 0) + 1;
1126
+ var e, s;
1127
+ return this.insert(t, (s = (e = this._value) == null ? void 0 : e.length) != null ? s : 0) + 1;
967
1128
  }
968
1129
  pop() {
969
1130
  var t, e;
970
1131
  return this.remove(((e = (t = this._value) == null ? void 0 : t.length) != null ? e : 0) - 1);
971
1132
  }
972
1133
  remove(t) {
973
- var n;
1134
+ var s;
974
1135
  if (this._value == null || t < 0 || this._value.length <= t) return;
975
- let e = (n = this._value.splice(t, 1)) == null ? void 0 : n[0];
976
- return e && (e = e.clone(), this.actions.trigger(dt, this, e, t), this.notifyValueChanged()), e;
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;
977
1138
  }
978
1139
  insert(t, e) {
979
- for (this._value == null && (this._value = []); this._value.length < e; ) {
980
- const r = this.processSetValueItem(null), a = this._value.push(r);
981
- this.actions.trigger(z, this, r, a);
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);
982
1145
  }
983
- const n = this.processSetValueItem(t);
984
- return this._value.splice(e, 0, n), this.actions.trigger(z, this, n, e), this.notifyValueChanged(), e;
1146
+ const r = this.processSetValueItem(t);
1147
+ return this._value.splice(s, 0, r), this.actions.trigger(z, this, r, s), this.notifyValueChanged(), s;
985
1148
  }
986
1149
  clear() {
987
1150
  this._value = null, this.notifyValueChanged();
988
1151
  }
989
1152
  }
990
- const gt = { useMarkdownInValidators: !0 };
991
- function qt() {
992
- return gt;
993
- }
994
- function Mt(i) {
995
- Object.assign(gt, i);
996
- }
997
- const re = {
998
- install(i, s) {
999
- s && Mt(s);
1000
- }
1001
- };
1002
- function m(i) {
1003
- return qt().useMarkdownInValidators ? new N(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, `
1004
- `);
1005
- }
1006
- class Ht extends f {
1007
- constructor(t, e, n) {
1008
- let r = !1, a, o;
1009
- super((u, h, A) => (a = u, o = h, r || (r = !0, this.otherField.registerAction(
1010
- new v((x, j, P, $) => {
1011
- j(x, P, $), this.unregistered || this.execute(A, () => null, a, o);
1153
+ class Yt extends f {
1154
+ constructor(t, e, s) {
1155
+ let r = !1, 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);
1012
1159
  })
1013
- )), this.isValidComparison(g(u), g(this.otherField.value)) ? null : [
1014
- new p(
1015
- 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 })
1016
1163
  )
1017
1164
  ]));
1018
- l(this, "otherField");
1019
- l(this, "isValidComparison");
1020
- l(this, "unregistered", !1);
1165
+ o(this, "otherField");
1166
+ o(this, "isValidComparison");
1167
+ o(this, "unregistered", !1);
1021
1168
  this.otherField = t, this.isValidComparison = e;
1022
1169
  }
1023
1170
  unregister() {
1024
1171
  this.unregistered = !0;
1025
1172
  }
1026
1173
  }
1027
- class Qt extends f {
1028
- constructor(s, t) {
1029
- const e = t || m("Must be one of [**{allowedAsText}**]");
1030
- let n = s.join(", ");
1031
- n.length > 60 && (n = mt(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, {
1032
1179
  length: 40,
1033
1180
  separator: ", ",
1034
- omission: `... (${s.length} items total)`
1181
+ omission: `... (${i.length} items total)`
1035
1182
  }));
1036
- const r = (a, o, c) => s.includes(g(a)) ? null : [
1037
- new p(
1038
- this.replacePlaceholders(e, { newValue: a, oldValue: o, 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 })
1039
1186
  )
1040
1187
  ];
1041
1188
  super(r);
1042
1189
  }
1043
1190
  }
1044
- function zt(i) {
1045
- return i == null ? 0 : nt(i) || C(i) ? i.length : it(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;
1046
1193
  }
1047
- class Gt extends f {
1048
- constructor(s) {
1049
- const t = s || m("Please enter a value"), e = (n, r, a) => zt(g(n)) === 0 ? [new p(this.replacePlaceholders(t, { newValue: n, oldValue: r, field: a }))] : null;
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;
1050
1197
  super(e);
1051
1198
  }
1052
1199
  }
1053
- class Wt extends f {
1054
- constructor(s, t) {
1055
- const e = t || m("Value must be larger or equal to **{minValue}**"), n = (r, a, o) => r < s || r === void 0 ? [
1056
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, 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 }))
1057
1204
  ] : null;
1058
- super(n);
1205
+ super(s);
1059
1206
  }
1060
1207
  }
1061
- class Xt extends f {
1062
- constructor(s, t) {
1063
- const e = t || m("Value must be less than or equal to **{maxValue}**"), n = (r, a, o) => r > s || r === void 0 ? [
1064
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, 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 }))
1065
1212
  ] : null;
1066
- super(n);
1213
+ super(s);
1067
1214
  }
1068
1215
  }
1069
- class Yt extends f {
1070
- constructor(s, t, e) {
1071
- const n = e || m("Value must be between **{minValue}** and **{maxValue}**"), r = (a, o, c) => a < s || a > t || a === void 0 ? [
1072
- new p(
1073
- this.replacePlaceholders(n, { newValue: a, oldValue: o, field: c, minValue: s, maxValue: t })
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 })
1074
1221
  )
1075
1222
  ] : null;
1076
1223
  super(r);
1077
1224
  }
1078
1225
  }
1079
- function J(i) {
1080
- return i == null ? 0 : nt(i) || C(i) ? i.length : it(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;
1081
1228
  }
1082
- class Jt extends f {
1083
- constructor(s, t) {
1084
- const e = t || m("Length must be larger or equal to **{minLength}**"), n = (r, a, o) => J(r) < s ? [
1085
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, 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 }))
1086
1233
  ] : null;
1087
- super(n);
1234
+ super(s);
1088
1235
  }
1089
1236
  }
1090
- class Kt extends f {
1091
- constructor(s, t) {
1092
- const e = t || m("Length must be less than or equal to **{maxLength}**"), n = (r, a, o) => J(r) > s ? [
1093
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, 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 }))
1094
1241
  ] : null;
1095
- super(n);
1242
+ super(s);
1096
1243
  }
1097
1244
  }
1098
- class Zt extends f {
1099
- constructor(s, t, e) {
1100
- const n = e || m("Length must be between **{minLength}** and **{maxLength}**"), r = (a, o, c) => {
1101
- const u = J(a);
1102
- return u < s || u > t ? [
1103
- new p(
1104
- this.replacePlaceholders(n, { newValue: a, oldValue: o, field: c, minLength: s, maxLength: t })
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 })
1105
1252
  )
1106
1253
  ] : null;
1107
1254
  };
1108
1255
  super(r);
1109
1256
  }
1110
1257
  }
1111
- class te extends f {
1112
- constructor(s, t) {
1113
- const e = t || m('Value must match pattern "**{pattern}**"'), n = (r, a, o) => s.test(String(g(r))) ? null : [
1114
- new p(this.replacePlaceholders(e, { newValue: r, oldValue: a, field: o, 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 }))
1115
1262
  ];
1116
- super(n);
1263
+ super(s);
1117
1264
  }
1118
1265
  }
1119
- const ee = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1266
+ const le = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1120
1267
  __proto__: null,
1121
- CompareTo: Ht,
1122
- InAllowedValues: Qt,
1123
- LengthInRange: Zt,
1124
- MaxLength: Kt,
1125
- MaxValue: Xt,
1126
- MinLength: Jt,
1127
- MinValue: Wt,
1128
- Pattern: te,
1129
- Required: Gt,
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,
1130
1277
  Validator: f,
1131
- ValueInRange: Yt
1132
- }, Symbol.toStringTag, { value: "Module" })), ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1278
+ ValueInRange: ie
1279
+ }, Symbol.toStringTag, { value: "Module" })), de = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1133
1280
  __proto__: null,
1134
- AbortEventHandlingException: Q,
1135
- Action: Dt,
1136
- ActionsMap: T,
1137
- ConditionalEnabledAction: Ft,
1138
- ConditionalStatementAction: B,
1139
- ConditionalValueAction: wt,
1140
- ConditionalVisibilityAction: St,
1141
- DisplayMode: V,
1142
- EmptyField: Bt,
1143
- EnabledChangedAction: ot,
1144
- EnabledChangingAction: at,
1145
- ExecuteAction: ht,
1146
- Field: D,
1147
- FieldActionBase: b,
1148
- FieldBase: y,
1149
- Group: E,
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,
1150
1297
  List: Y,
1151
1298
  ListItemAddedAction: z,
1152
- ListItemRemovedAction: dt,
1153
- MdString: N,
1154
- MessagesWidget: $t,
1155
- Operator: d,
1156
- RenderableValue: Vt,
1157
- Statement: F,
1158
- ValidChangedAction: lt,
1159
- ValidationError: X,
1160
- ValidationErrorRenderContent: p,
1161
- ValidationErrorText: Ct,
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,
1162
1309
  Validator: f,
1163
- Validators: ee,
1164
- ValueChangedAction: v,
1165
- VisibilityChangedAction: ut,
1166
- VisibilityChangingAction: ct,
1167
- buildErrorMessage: m,
1168
- isCallableFunction: U,
1169
- isSimpleComponentDef: W
1310
+ Validators: le,
1311
+ ValueChangedAction: y,
1312
+ VisibilityChangedAction: gt,
1313
+ VisibilityChangingAction: dt,
1314
+ buildErrorMessage: b,
1315
+ isCallableFunction: k,
1316
+ isSimpleComponentDef: X
1170
1317
  }, Symbol.toStringTag, { value: "Module" }));
1171
1318
  export {
1172
- Q as AbortEventHandlingException,
1173
- Dt as Action,
1174
- T as ActionsMap,
1175
- Ft as ConditionalEnabledAction,
1176
- B as ConditionalStatementAction,
1177
- wt as ConditionalValueAction,
1178
- St as ConditionalVisibilityAction,
1179
- V as DisplayMode,
1180
- Bt as EmptyField,
1181
- ot as EnabledChangedAction,
1182
- at as EnabledChangingAction,
1183
- ht as ExecuteAction,
1184
- D as Field,
1185
- b as FieldActionBase,
1186
- y as FieldBase,
1187
- E as Group,
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,
1188
1335
  Y as List,
1189
1336
  z as ListItemAddedAction,
1190
- dt as ListItemRemovedAction,
1191
- N as MdString,
1192
- $t as MessagesWidget,
1193
- d as Operator,
1194
- Vt as RenderableValue,
1195
- F as Statement,
1196
- lt as ValidChangedAction,
1197
- X as ValidationError,
1198
- p as ValidationErrorRenderContent,
1199
- Ct 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,
1200
1347
  f as Validator,
1201
- ee as Validators,
1202
- v as ValueChangedAction,
1203
- ut as VisibilityChangedAction,
1204
- ct as VisibilityChangingAction,
1205
- m as buildErrorMessage,
1206
- ae as default,
1207
- re as forms,
1208
- U as isCallableFunction,
1209
- 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
1210
1357
  };
1211
1358
  //# sourceMappingURL=dynamicforms-vue-forms.js.map