@prolibu-suite/cobalt-form-vue 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,77 +1,74 @@
1
1
  import { createForm as ht, normalizeForValidation as ct } from "@prolibu-suite/cobalt-form-core";
2
- import { createForm as $s } from "@prolibu-suite/cobalt-form-core";
3
- import { shallowRef as Re, watch as J, toValue as pt, onBeforeUnmount as Ue, computed as c, defineComponent as T, openBlock as w, createBlock as R, unref as O, withCtx as Ie, createElementBlock as j, renderSlot as he, createCommentVNode as ue, normalizeClass as ft, createTextVNode as mt, toDisplayString as _e, createElementVNode as ce, ref as H, onMounted as Se, withModifiers as Pe, createVNode as me, defineAsyncComponent as gt, resolveDynamicComponent as vt, provide as se, reactive as Oe, normalizeStyle as Be, Fragment as je, renderList as He, mergeProps as Ge, nextTick as kt, inject as le } from "vue";
4
- import { CoSwitch as Ct, CoColorPicker as yt, CoDatePicker as bt, CoFileField as At, CoIcon as Ft, CoJsonField as Et, CoTagsField as xt, CoNumberField as _t, CoPhoneField as St, CoRefField as Bt, CoRichTextEditor as Mt, CoSelect as wt, CoInput as Ke, CoTextarea as It, CoButton as Vt, CoAccordion as Dt } from "@prolibu-suite/cobalt-vue";
5
- function Ts(i) {
6
- const e = Re(null), t = Re({
2
+ import { createForm as zs } from "@prolibu-suite/cobalt-form-core";
3
+ import { shallowRef as ge, watch as J, toValue as xe, onBeforeUnmount as Le, computed as p, defineComponent as R, openBlock as I, createBlock as T, unref as B, withCtx as _e, createElementBlock as P, renderSlot as se, createCommentVNode as te, normalizeClass as pt, createTextVNode as ft, toDisplayString as Fe, createElementVNode as ie, ref as j, onMounted as Se, withModifiers as Ne, createVNode as ae, defineAsyncComponent as mt, resolveDynamicComponent as vt, reactive as qe, provide as K, normalizeStyle as be, Fragment as Ue, renderList as $e, mergeProps as ze, nextTick as gt, inject as W } from "vue";
4
+ import { CoSwitch as kt, CoColorPicker as yt, CoDatePicker as Ct, CoFileField as Ft, CoIcon as bt, CoJsonField as At, CoTagsField as Et, CoNumberField as xt, CoPhoneField as _t, CoRefField as St, CoRichTextEditor as Bt, CoSelect as Mt, CoInput as Pe, CoTextarea as wt, CoButton as It, CoAccordion as Vt } from "@prolibu-suite/cobalt-vue";
5
+ function Os(i) {
6
+ const e = ge(null), t = ge({
7
7
  values: {},
8
8
  errors: {},
9
9
  touched: {},
10
10
  isValid: !0,
11
11
  isDirty: !1,
12
12
  isSubmitting: !1
13
- });
14
- let s = null;
15
- function r(n) {
16
- s == null || s();
17
- const a = ht(n);
18
- e.value = a, t.value = a.state, s = a.subscribe((l) => {
19
- t.value = l;
13
+ }), s = ge([]);
14
+ let r = null;
15
+ function n(a) {
16
+ r == null || r();
17
+ const l = ht(a);
18
+ e.value = l, t.value = l.state, s.value = l.fields, r = l.subscribe((u) => {
19
+ t.value = u, s.value = l.fields;
20
20
  });
21
21
  }
22
22
  return J(
23
- () => pt(i),
24
- (n) => r(n),
23
+ () => xe(i),
24
+ (a) => n(a),
25
25
  { immediate: !0, deep: !1 }
26
- ), Ue(() => {
27
- s == null || s(), s = null;
26
+ ), Le(() => {
27
+ r == null || r(), r = null;
28
28
  }), {
29
29
  controller: e,
30
- values: c(() => t.value.values),
31
- errors: c(() => t.value.errors),
32
- touched: c(() => t.value.touched),
33
- isValid: c(() => t.value.isValid),
34
- isDirty: c(() => t.value.isDirty),
35
- isSubmitting: c(() => t.value.isSubmitting),
36
- fields: c(() => {
37
- var n;
38
- return ((n = e.value) == null ? void 0 : n.fields) ?? [];
39
- }),
40
- setValue: (n, a) => {
41
- var l;
42
- return (l = e.value) == null ? void 0 : l.setValue(n, a);
30
+ values: p(() => t.value.values),
31
+ errors: p(() => t.value.errors),
32
+ touched: p(() => t.value.touched),
33
+ isValid: p(() => t.value.isValid),
34
+ isDirty: p(() => t.value.isDirty),
35
+ isSubmitting: p(() => t.value.isSubmitting),
36
+ fields: p(() => s.value),
37
+ setValue: (a, l) => {
38
+ var u;
39
+ return (u = e.value) == null ? void 0 : u.setValue(a, l);
43
40
  },
44
- setValues: (n) => {
45
- var a;
46
- return (a = e.value) == null ? void 0 : a.setValues(n);
41
+ setValues: (a) => {
42
+ var l;
43
+ return (l = e.value) == null ? void 0 : l.setValues(a);
47
44
  },
48
- touch: (n) => {
49
- var a;
50
- return (a = e.value) == null ? void 0 : a.touch(n);
45
+ touch: (a) => {
46
+ var l;
47
+ return (l = e.value) == null ? void 0 : l.touch(a);
51
48
  },
52
49
  touchAll: () => {
53
- var n;
54
- return (n = e.value) == null ? void 0 : n.touchAll();
55
- },
56
- setSchema: (n) => {
57
50
  var a;
58
- return (a = e.value) == null ? void 0 : a.setSchema(n);
51
+ return (a = e.value) == null ? void 0 : a.touchAll();
52
+ },
53
+ setSchema: (a) => {
54
+ var l;
55
+ return (l = e.value) == null ? void 0 : l.setSchema(a);
59
56
  },
60
57
  validate: () => {
61
- var n;
62
- return ((n = e.value) == null ? void 0 : n.validate()) ?? !0;
58
+ var a;
59
+ return ((a = e.value) == null ? void 0 : a.validate()) ?? !0;
63
60
  },
64
61
  submit: () => {
65
- var n;
66
- return ((n = e.value) == null ? void 0 : n.submit()) ?? Promise.resolve({ values: {}, isValid: !0, errors: {} });
67
- },
68
- reset: (n) => {
69
62
  var a;
70
- return (a = e.value) == null ? void 0 : a.reset(n);
63
+ return ((a = e.value) == null ? void 0 : a.submit()) ?? Promise.resolve({ values: {}, isValid: !0, errors: {} });
64
+ },
65
+ reset: (a) => {
66
+ var l;
67
+ return (l = e.value) == null ? void 0 : l.reset(a);
71
68
  }
72
69
  };
73
70
  }
74
- const Tt = /* @__PURE__ */ T({
71
+ const Dt = /* @__PURE__ */ R({
75
72
  __name: "FieldBoolean",
76
73
  props: {
77
74
  field: {},
@@ -81,8 +78,8 @@ const Tt = /* @__PURE__ */ T({
81
78
  },
82
79
  emits: ["update:value"],
83
80
  setup(i, { emit: e }) {
84
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText);
85
- return (a, l) => (w(), R(O(Ct), {
81
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText);
82
+ return (a, l) => (I(), T(B(kt), {
86
83
  label: i.field.label,
87
84
  required: i.field.required,
88
85
  disabled: i.disabled,
@@ -92,7 +89,7 @@ const Tt = /* @__PURE__ */ T({
92
89
  onCoChange: l[0] || (l[0] = (u) => s("update:value", u.detail))
93
90
  }, null, 8, ["label", "required", "disabled", "status", "helper-text", "checked"]));
94
91
  }
95
- }), Rt = /* @__PURE__ */ T({
92
+ }), Rt = /* @__PURE__ */ R({
96
93
  __name: "FieldColor",
97
94
  props: {
98
95
  field: {},
@@ -159,17 +156,17 @@ const Tt = /* @__PURE__ */ T({
159
156
  { key: "violet", value: "#5F4BD7" },
160
157
  { key: "burgundy", value: "#811137" },
161
158
  { key: "olive", value: "#AAB43C" }
162
- ], a = c(() => t.errors.length > 0 ? "error" : "default"), l = c(() => t.errors[0] || t.field.helperText), u = c(() => {
163
- var E;
164
- const o = (E = t.field.originalAttrs) == null ? void 0 : E.presets;
159
+ ], a = p(() => t.errors.length > 0 ? "error" : "default"), l = p(() => t.errors[0] || t.field.helperText), u = p(() => {
160
+ var x;
161
+ const o = (x = t.field.originalAttrs) == null ? void 0 : x.presets;
165
162
  if (Array.isArray(o) && o.length) return JSON.stringify(o);
166
- const v = (t.locale || "en").split("-")[0].toLowerCase(), p = r[v] || r.en, m = n.map((b) => ({
167
- name: p[b.key] || b.key,
168
- value: b.value
163
+ const v = (t.locale || "en").split("-")[0].toLowerCase(), f = r[v] || r.en, m = n.map((g) => ({
164
+ name: f[g.key] || g.key,
165
+ value: g.value
169
166
  }));
170
167
  return JSON.stringify(m);
171
168
  });
172
- return (o, v) => (w(), R(O(yt), {
169
+ return (o, v) => (I(), T(B(yt), {
173
170
  label: i.field.label,
174
171
  placeholder: i.field.placeholder,
175
172
  required: i.field.required,
@@ -178,10 +175,10 @@ const Tt = /* @__PURE__ */ T({
178
175
  "helper-text": l.value,
179
176
  presets: u.value,
180
177
  value: String(i.value ?? ""),
181
- onCoChange: v[0] || (v[0] = (p) => s("update:value", p.detail))
178
+ onCoChange: v[0] || (v[0] = (f) => s("update:value", f.detail))
182
179
  }, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "presets", "value"]));
183
180
  }
184
- }), Ot = /* @__PURE__ */ T({
181
+ }), Tt = /* @__PURE__ */ R({
185
182
  __name: "FieldDatePicker",
186
183
  props: {
187
184
  field: {},
@@ -192,15 +189,15 @@ const Tt = /* @__PURE__ */ T({
192
189
  },
193
190
  emits: ["update:value", "blur"],
194
191
  setup(i, { emit: e }) {
195
- const t = i, s = e, r = c(() => {
196
- const p = t.value;
197
- return typeof p != "string" || p === "" ? null : p.length >= 10 ? p.slice(0, 10) : p;
198
- }), n = c(() => t.field.originalAttrs.min), a = c(() => t.field.originalAttrs.max), l = c(() => t.field.originalAttrs.disabledDates), u = c(() => t.field.originalAttrs.disabledDaysOfWeek), o = c(
192
+ const t = i, s = e, r = p(() => {
193
+ const f = t.value;
194
+ return typeof f != "string" || f === "" ? null : f.length >= 10 ? f.slice(0, 10) : f;
195
+ }), n = p(() => t.field.originalAttrs.min), a = p(() => t.field.originalAttrs.max), l = p(() => t.field.originalAttrs.disabledDates), u = p(() => t.field.originalAttrs.disabledDaysOfWeek), o = p(
199
196
  () => t.locale || t.field.originalAttrs.locale || "es-CO"
200
- ), v = c(
197
+ ), v = p(
201
198
  () => t.field.originalAttrs.displayFormat || "d MMM yyyy"
202
199
  );
203
- return (p, m) => (w(), R(O(bt), {
200
+ return (f, m) => (I(), T(B(Ct), {
204
201
  label: i.field.label,
205
202
  placeholder: i.field.placeholder,
206
203
  required: i.field.required,
@@ -216,15 +213,15 @@ const Tt = /* @__PURE__ */ T({
216
213
  "disabled-days-of-week": u.value,
217
214
  locale: o.value,
218
215
  "display-format": v.value,
219
- onCoChange: m[0] || (m[0] = (E) => s("update:value", E.detail)),
220
- onCoBlur: m[1] || (m[1] = (E) => s("blur"))
216
+ onCoChange: m[0] || (m[0] = (x) => s("update:value", x.detail)),
217
+ onCoBlur: m[1] || (m[1] = (x) => s("blur"))
221
218
  }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "invalid", "error-message", "helper-text", "value", "min", "max", "disabled-dates", "disabled-days-of-week", "locale", "display-format"]));
222
219
  }
223
- }), Lt = {
220
+ }), Ot = {
224
221
  key: 0,
225
222
  slot: "actions",
226
223
  style: { display: "contents" }
227
- }, Nt = /* @__PURE__ */ T({
224
+ }, Lt = /* @__PURE__ */ R({
228
225
  __name: "FieldFile",
229
226
  props: {
230
227
  field: {},
@@ -236,48 +233,48 @@ const Tt = /* @__PURE__ */ T({
236
233
  },
237
234
  emits: ["update:value", "upload", "remove-file", "reorder", "copy-url"],
238
235
  setup(i, { emit: e }) {
239
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(() => {
240
- var E;
236
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(() => {
237
+ var x;
241
238
  const m = t.field.originalAttrs;
242
- return !!m.multiple || Array.isArray(m.type) || ((E = m.type) == null ? void 0 : E[0]) === "array";
243
- }), l = c(() => {
239
+ return !!m.multiple || Array.isArray(m.type) || ((x = m.type) == null ? void 0 : x[0]) === "array";
240
+ }), l = p(() => {
244
241
  const m = t.field.originalAttrs.ext;
245
242
  if (Array.isArray(m)) return m.join(",");
246
243
  if (typeof m == "string") return m;
247
- }), u = c(() => {
244
+ }), u = p(() => {
248
245
  const m = t.field.originalAttrs.maxElements;
249
246
  return typeof m == "number" ? m : 100;
250
- }), o = c(() => {
247
+ }), o = p(() => {
251
248
  const m = t.field.originalAttrs.maxBytes;
252
249
  return typeof m == "number" ? m : void 0;
253
250
  });
254
251
  function v(m) {
255
- const E = (S) => {
256
- if (!S) return null;
257
- if (typeof S == "string") return { id: S, name: S, status: "done" };
258
- if (typeof S == "object") {
259
- const M = S._id || S.id;
260
- return M ? {
261
- id: M,
262
- name: S.fileName || S.name || S.originalName || M,
263
- size: S.size,
264
- url: S.url,
265
- thumbnail: S.thumbnail,
266
- fileCode: S.fileCode,
252
+ const x = (h) => {
253
+ if (!h) return null;
254
+ if (typeof h == "string") return { id: h, name: h, status: "done" };
255
+ if (typeof h == "object") {
256
+ const k = h._id || h.id;
257
+ return k ? {
258
+ id: k,
259
+ name: h.fileName || h.name || h.originalName || k,
260
+ size: h.size,
261
+ url: h.url,
262
+ thumbnail: h.thumbnail,
263
+ fileCode: h.fileCode,
267
264
  status: "done"
268
265
  } : null;
269
266
  }
270
267
  return null;
271
268
  };
272
269
  if (m == null || m === "") return [];
273
- if (Array.isArray(m)) return m.map(E).filter((S) => !!S);
274
- const b = E(m);
275
- return b ? [b] : [];
270
+ if (Array.isArray(m)) return m.map(x).filter((h) => !!h);
271
+ const g = x(m);
272
+ return g ? [g] : [];
276
273
  }
277
- const p = c(
274
+ const f = p(
278
275
  () => JSON.stringify(t.fileState ?? v(t.value))
279
276
  );
280
- return (m, E) => (w(), R(O(At), {
277
+ return (m, x) => (I(), T(B(Ft), {
281
278
  label: i.field.label,
282
279
  required: i.field.required,
283
280
  disabled: i.disabled,
@@ -288,62 +285,62 @@ const Tt = /* @__PURE__ */ T({
288
285
  status: r.value,
289
286
  "helper-text": n.value,
290
287
  locale: i.locale,
291
- files: p.value,
292
- onCoFilesSelected: E[0] || (E[0] = (b) => s("upload", b.detail)),
293
- onCoRemove: E[1] || (E[1] = (b) => s("remove-file", b.detail)),
294
- onCoClear: E[2] || (E[2] = (b) => s("update:value", a.value ? [] : null)),
295
- onCoReorder: E[3] || (E[3] = (b) => s("reorder", b.detail)),
296
- onCoCopy: E[4] || (E[4] = (b) => s("copy-url", b.detail))
288
+ files: f.value,
289
+ onCoFilesSelected: x[0] || (x[0] = (g) => s("upload", g.detail)),
290
+ onCoRemove: x[1] || (x[1] = (g) => s("remove-file", g.detail)),
291
+ onCoClear: x[2] || (x[2] = (g) => s("update:value", a.value ? [] : null)),
292
+ onCoReorder: x[3] || (x[3] = (g) => s("reorder", g.detail)),
293
+ onCoCopy: x[4] || (x[4] = (g) => s("copy-url", g.detail))
297
294
  }, {
298
- default: Ie(() => [
299
- m.$slots.actions ? (w(), j("div", Lt, [
300
- he(m.$slots, "actions")
301
- ])) : ue("", !0)
295
+ default: _e(() => [
296
+ m.$slots.actions ? (I(), P("div", Ot, [
297
+ se(m.$slots, "actions")
298
+ ])) : te("", !0)
302
299
  ]),
303
300
  _: 3
304
301
  }, 8, ["label", "required", "disabled", "multiple", "accept", "max-files", "max-bytes", "status", "helper-text", "locale", "files"]));
305
302
  }
306
303
  });
307
- function Q(i) {
304
+ function X(i) {
308
305
  return typeof i == "string" || i instanceof String;
309
306
  }
310
- function Le(i) {
307
+ function Ve(i) {
311
308
  var e;
312
309
  return typeof i == "object" && i != null && (i == null || (e = i.constructor) == null ? void 0 : e.name) === "Object";
313
310
  }
314
- function Je(i, e) {
315
- return Array.isArray(e) ? Je(i, (t, s) => e.includes(s)) : Object.entries(i).reduce((t, s) => {
311
+ function je(i, e) {
312
+ return Array.isArray(e) ? je(i, (t, s) => e.includes(s)) : Object.entries(i).reduce((t, s) => {
316
313
  let [r, n] = s;
317
314
  return e(n, r) && (t[r] = n), t;
318
315
  }, {});
319
316
  }
320
- const y = {
317
+ const b = {
321
318
  NONE: "NONE",
322
319
  LEFT: "LEFT",
323
320
  FORCE_LEFT: "FORCE_LEFT",
324
321
  RIGHT: "RIGHT",
325
322
  FORCE_RIGHT: "FORCE_RIGHT"
326
323
  };
327
- function qt(i) {
324
+ function Nt(i) {
328
325
  switch (i) {
329
- case y.LEFT:
330
- return y.FORCE_LEFT;
331
- case y.RIGHT:
332
- return y.FORCE_RIGHT;
326
+ case b.LEFT:
327
+ return b.FORCE_LEFT;
328
+ case b.RIGHT:
329
+ return b.FORCE_RIGHT;
333
330
  default:
334
331
  return i;
335
332
  }
336
333
  }
337
- function Fe(i) {
334
+ function ke(i) {
338
335
  return i.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
339
336
  }
340
- function ge(i, e) {
337
+ function le(i, e) {
341
338
  if (e === i) return !0;
342
339
  const t = Array.isArray(e), s = Array.isArray(i);
343
340
  let r;
344
341
  if (t && s) {
345
342
  if (e.length != i.length) return !1;
346
- for (r = 0; r < e.length; r++) if (!ge(e[r], i[r])) return !1;
343
+ for (r = 0; r < e.length; r++) if (!le(e[r], i[r])) return !1;
347
344
  return !0;
348
345
  }
349
346
  if (t != s) return !1;
@@ -356,13 +353,13 @@ function ge(i, e) {
356
353
  if (l != u) return !1;
357
354
  const o = Object.keys(e);
358
355
  for (r = 0; r < o.length; r++) if (!Object.prototype.hasOwnProperty.call(i, o[r])) return !1;
359
- for (r = 0; r < o.length; r++) if (!ge(i[o[r]], e[o[r]])) return !1;
356
+ for (r = 0; r < o.length; r++) if (!le(i[o[r]], e[o[r]])) return !1;
360
357
  return !0;
361
358
  } else if (e && i && typeof e == "function" && typeof i == "function")
362
359
  return e.toString() === i.toString();
363
360
  return !1;
364
361
  }
365
- class $t {
362
+ class qt {
366
363
  /** Current input value */
367
364
  /** Current cursor position */
368
365
  /** Old input value */
@@ -405,53 +402,53 @@ class $t {
405
402
  }
406
403
  /** Remove direction */
407
404
  get removeDirection() {
408
- return !this.removedCount || this.insertedCount ? y.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
409
- this.oldSelection.end === this.oldSelection.start ? y.RIGHT : y.LEFT;
405
+ return !this.removedCount || this.insertedCount ? b.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
406
+ this.oldSelection.end === this.oldSelection.start ? b.RIGHT : b.LEFT;
410
407
  }
411
408
  }
412
- function F(i, e) {
413
- return new F.InputMask(i, e);
409
+ function _(i, e) {
410
+ return new _.InputMask(i, e);
414
411
  }
415
- function Ye(i) {
412
+ function He(i) {
416
413
  if (i == null) throw new Error("mask property should be defined");
417
- return i instanceof RegExp ? F.MaskedRegExp : Q(i) ? F.MaskedPattern : i === Date ? F.MaskedDate : i === Number ? F.MaskedNumber : Array.isArray(i) || i === Array ? F.MaskedDynamic : F.Masked && i.prototype instanceof F.Masked ? i : F.Masked && i instanceof F.Masked ? i.constructor : i instanceof Function ? F.MaskedFunction : (console.warn("Mask not found for mask", i), F.Masked);
414
+ return i instanceof RegExp ? _.MaskedRegExp : X(i) ? _.MaskedPattern : i === Date ? _.MaskedDate : i === Number ? _.MaskedNumber : Array.isArray(i) || i === Array ? _.MaskedDynamic : _.Masked && i.prototype instanceof _.Masked ? i : _.Masked && i instanceof _.Masked ? i.constructor : i instanceof Function ? _.MaskedFunction : (console.warn("Mask not found for mask", i), _.Masked);
418
415
  }
419
- function pe(i) {
416
+ function re(i) {
420
417
  if (!i) throw new Error("Options in not defined");
421
- if (F.Masked) {
422
- if (i.prototype instanceof F.Masked) return {
418
+ if (_.Masked) {
419
+ if (i.prototype instanceof _.Masked) return {
423
420
  mask: i
424
421
  };
425
422
  const {
426
423
  mask: e = void 0,
427
424
  ...t
428
- } = i instanceof F.Masked ? {
425
+ } = i instanceof _.Masked ? {
429
426
  mask: i
430
- } : Le(i) && i.mask instanceof F.Masked ? i : {};
427
+ } : Ve(i) && i.mask instanceof _.Masked ? i : {};
431
428
  if (e) {
432
429
  const s = e.mask;
433
430
  return {
434
- ...Je(e, (r, n) => !n.startsWith("_")),
431
+ ...je(e, (r, n) => !n.startsWith("_")),
435
432
  mask: e.constructor,
436
433
  _mask: s,
437
434
  ...t
438
435
  };
439
436
  }
440
437
  }
441
- return Le(i) ? {
438
+ return Ve(i) ? {
442
439
  ...i
443
440
  } : {
444
441
  mask: i
445
442
  };
446
443
  }
447
444
  function Y(i) {
448
- if (F.Masked && i instanceof F.Masked) return i;
449
- const e = pe(i), t = Ye(e.mask);
445
+ if (_.Masked && i instanceof _.Masked) return i;
446
+ const e = re(i), t = He(e.mask);
450
447
  if (!t) throw new Error("Masked class is not found for provided mask " + e.mask + ", appropriate module needs to be imported manually before creating mask.");
451
448
  return e.mask === t && delete e.mask, e._mask && (e.mask = e._mask, delete e._mask), new t(e);
452
449
  }
453
- F.createMask = Y;
454
- class Ve {
450
+ _.createMask = Y;
451
+ class Be {
455
452
  /** */
456
453
  /** */
457
454
  /** */
@@ -489,9 +486,9 @@ class Ve {
489
486
  /** */
490
487
  /** */
491
488
  }
492
- F.MaskElement = Ve;
493
- const Ne = 90, zt = 89;
494
- class ke extends Ve {
489
+ _.MaskElement = Be;
490
+ const De = 90, Ut = 89;
491
+ class oe extends Be {
495
492
  /** HTMLElement to use mask on */
496
493
  constructor(e) {
497
494
  super(), this.input = e, this._onKeydown = this._onKeydown.bind(this), this._onInput = this._onInput.bind(this), this._onBeforeinput = this._onBeforeinput.bind(this), this._onCompositionEnd = this._onCompositionEnd.bind(this);
@@ -509,9 +506,9 @@ class ke extends Ve {
509
506
  this.input.addEventListener("keydown", this._onKeydown), this.input.addEventListener("input", this._onInput), this.input.addEventListener("beforeinput", this._onBeforeinput), this.input.addEventListener("compositionend", this._onCompositionEnd), this.input.addEventListener("drop", e.drop), this.input.addEventListener("click", e.click), this.input.addEventListener("focus", e.focus), this.input.addEventListener("blur", e.commit), this._handlers = e;
510
507
  }
511
508
  _onKeydown(e) {
512
- if (this._handlers.redo && (e.keyCode === Ne && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === zt && e.ctrlKey))
509
+ if (this._handlers.redo && (e.keyCode === De && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === Ut && e.ctrlKey))
513
510
  return e.preventDefault(), this._handlers.redo(e);
514
- if (this._handlers.undo && e.keyCode === Ne && (e.metaKey || e.ctrlKey))
511
+ if (this._handlers.undo && e.keyCode === De && (e.metaKey || e.ctrlKey))
515
512
  return e.preventDefault(), this._handlers.undo(e);
516
513
  e.isComposing || this._handlers.selectionChange(e);
517
514
  }
@@ -532,8 +529,8 @@ class ke extends Ve {
532
529
  this.input.removeEventListener("keydown", this._onKeydown), this.input.removeEventListener("input", this._onInput), this.input.removeEventListener("beforeinput", this._onBeforeinput), this.input.removeEventListener("compositionend", this._onCompositionEnd), this.input.removeEventListener("drop", this._handlers.drop), this.input.removeEventListener("click", this._handlers.click), this.input.removeEventListener("focus", this._handlers.focus), this.input.removeEventListener("blur", this._handlers.commit), this._handlers = {};
533
530
  }
534
531
  }
535
- F.HTMLMaskElement = ke;
536
- class Ut extends ke {
532
+ _.HTMLMaskElement = oe;
533
+ class $t extends oe {
537
534
  /** InputElement to use mask on */
538
535
  constructor(e) {
539
536
  super(e), this.input = e;
@@ -557,8 +554,8 @@ class Ut extends ke {
557
554
  this.input.value = e;
558
555
  }
559
556
  }
560
- F.HTMLMaskElement = ke;
561
- class We extends ke {
557
+ _.HTMLMaskElement = oe;
558
+ class Ke extends oe {
562
559
  /** Returns HTMLElement selection start */
563
560
  get _unsafeSelectionStart() {
564
561
  const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, r = t && t.focusOffset;
@@ -585,8 +582,8 @@ class We extends ke {
585
582
  this.input.textContent = e;
586
583
  }
587
584
  }
588
- F.HTMLContenteditableMaskElement = We;
589
- class Ce {
585
+ _.HTMLContenteditableMaskElement = Ke;
586
+ class de {
590
587
  constructor() {
591
588
  this.states = [], this.currentIndex = 0;
592
589
  }
@@ -597,7 +594,7 @@ class Ce {
597
594
  return this.states.length === 0;
598
595
  }
599
596
  push(e) {
600
- this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(e), this.states.length > Ce.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
597
+ this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(e), this.states.length > de.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
601
598
  }
602
599
  go(e) {
603
600
  return this.currentIndex = Math.min(Math.max(this.currentIndex + e, 0), this.states.length - 1), this.currentState;
@@ -612,14 +609,14 @@ class Ce {
612
609
  this.states.length = 0, this.currentIndex = 0;
613
610
  }
614
611
  }
615
- Ce.MAX_LENGTH = 100;
616
- class Pt {
612
+ de.MAX_LENGTH = 100;
613
+ class zt {
617
614
  /**
618
615
  View element
619
616
  */
620
617
  /** Internal {@link Masked} model */
621
618
  constructor(e, t) {
622
- this.el = e instanceof Ve ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new We(e) : new Ut(e), this.masked = Y(t), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new Ce(), this._saveSelection = this._saveSelection.bind(this), this._onInput = this._onInput.bind(this), this._onChange = this._onChange.bind(this), this._onDrop = this._onDrop.bind(this), this._onFocus = this._onFocus.bind(this), this._onClick = this._onClick.bind(this), this._onUndo = this._onUndo.bind(this), this._onRedo = this._onRedo.bind(this), this.alignCursor = this.alignCursor.bind(this), this.alignCursorFriendly = this.alignCursorFriendly.bind(this), this._bindEvents(), this.updateValue(), this._onChange();
619
+ this.el = e instanceof Be ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new Ke(e) : new $t(e), this.masked = Y(t), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new de(), this._saveSelection = this._saveSelection.bind(this), this._onInput = this._onInput.bind(this), this._onChange = this._onChange.bind(this), this._onDrop = this._onDrop.bind(this), this._onFocus = this._onFocus.bind(this), this._onClick = this._onClick.bind(this), this._onUndo = this._onUndo.bind(this), this._onRedo = this._onRedo.bind(this), this.alignCursor = this.alignCursor.bind(this), this.alignCursorFriendly = this.alignCursorFriendly.bind(this), this._bindEvents(), this.updateValue(), this._onChange();
623
620
  }
624
621
  maskEquals(e) {
625
622
  var t;
@@ -631,13 +628,13 @@ class Pt {
631
628
  }
632
629
  set mask(e) {
633
630
  if (this.maskEquals(e)) return;
634
- if (!(e instanceof F.Masked) && this.masked.constructor === Ye(e)) {
631
+ if (!(e instanceof _.Masked) && this.masked.constructor === He(e)) {
635
632
  this.masked.updateOptions({
636
633
  mask: e
637
634
  });
638
635
  return;
639
636
  }
640
- const t = e instanceof F.Masked ? e : Y({
637
+ const t = e instanceof _.Masked ? e : Y({
641
638
  mask: e
642
639
  });
643
640
  t.unmaskedValue = this.masked.unmaskedValue, this.masked = t;
@@ -757,7 +754,7 @@ class Pt {
757
754
  }
758
755
  /** Aligns cursor to nearest available position */
759
756
  alignCursor() {
760
- this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, y.LEFT));
757
+ this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, b.LEFT));
761
758
  }
762
759
  /** Aligns cursor only if selection is empty */
763
760
  alignCursorFriendly() {
@@ -778,7 +775,7 @@ class Pt {
778
775
  /** Handles view input event */
779
776
  _onInput(e) {
780
777
  this._inputEvent = e, this._abortUpdateCursor();
781
- const t = new $t({
778
+ const t = new qt({
782
779
  // new state
783
780
  value: this.el.value,
784
781
  cursorPos: this.cursorPos,
@@ -788,9 +785,9 @@ class Pt {
788
785
  }), s = this.masked.rawInputValue, r = this.masked.splice(t.startChangePos, t.removed.length, t.inserted, t.removeDirection, {
789
786
  input: !0,
790
787
  raw: !0
791
- }).offset, n = s === this.masked.rawInputValue ? t.removeDirection : y.NONE;
788
+ }).offset, n = s === this.masked.rawInputValue ? t.removeDirection : b.NONE;
792
789
  let a = this.masked.nearestInputPos(t.startChangePos + r, n);
793
- n !== y.NONE && (a = this.masked.nearestInputPos(a, y.NONE)), this.updateControl(a), delete this._inputEvent;
790
+ n !== b.NONE && (a = this.masked.nearestInputPos(a, b.NONE)), this.updateControl(a), delete this._inputEvent;
794
791
  }
795
792
  /** Handles view change event and commits model value */
796
793
  _onChange() {
@@ -822,14 +819,14 @@ class Pt {
822
819
  this._unbindEvents(), this._listeners.length = 0, delete this.el;
823
820
  }
824
821
  }
825
- F.InputMask = Pt;
826
- class x {
822
+ _.InputMask = zt;
823
+ class S {
827
824
  /** Inserted symbols */
828
825
  /** Additional offset if any changes occurred before tail */
829
826
  /** Raw inserted is used by dynamic mask */
830
827
  /** Can skip chars */
831
828
  static normalize(e) {
832
- return Array.isArray(e) ? e : [e, new x()];
829
+ return Array.isArray(e) ? e : [e, new S()];
833
830
  }
834
831
  constructor(e) {
835
832
  Object.assign(this, {
@@ -854,8 +851,8 @@ class x {
854
851
  return this.inserted === e.inserted && this.tailShift === e.tailShift && this.rawInserted === e.rawInserted && this.skip === e.skip;
855
852
  }
856
853
  }
857
- F.ChangeDetails = x;
858
- class G {
854
+ _.ChangeDetails = S;
855
+ class H {
859
856
  /** Tail value as string */
860
857
  /** Tail start position */
861
858
  /** Start position */
@@ -995,18 +992,18 @@ class L {
995
992
  }
996
993
  /** Extracts tail in range */
997
994
  extractTail(e, t) {
998
- return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new G(this.extractInput(e, t), e);
995
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new H(this.extractInput(e, t), e);
999
996
  }
1000
997
  /** Appends tail */
1001
998
  appendTail(e) {
1002
- return Q(e) && (e = new G(String(e))), e.appendTo(this);
999
+ return X(e) && (e = new H(String(e))), e.appendTo(this);
1003
1000
  }
1004
1001
  /** Appends char */
1005
1002
  _appendCharRaw(e, t) {
1006
- return e ? (this._value += e, new x({
1003
+ return e ? (this._value += e, new S({
1007
1004
  inserted: e,
1008
1005
  rawInserted: e
1009
- })) : new x();
1006
+ })) : new S();
1010
1007
  }
1011
1008
  /** Appends char */
1012
1009
  _appendChar(e, t, s) {
@@ -1038,22 +1035,22 @@ class L {
1038
1035
  }
1039
1036
  l && o.inserted && (this.state = u);
1040
1037
  }
1041
- l || (n = new x(), this.state = r, s && a && (s.state = a));
1038
+ l || (n = new S(), this.state = r, s && a && (s.state = a));
1042
1039
  }
1043
1040
  return n;
1044
1041
  }
1045
1042
  /** Appends optional placeholder at the end */
1046
1043
  _appendPlaceholder() {
1047
- return new x();
1044
+ return new S();
1048
1045
  }
1049
1046
  /** Appends optional eager placeholder at the end */
1050
1047
  _appendEager() {
1051
- return new x();
1048
+ return new S();
1052
1049
  }
1053
1050
  /** Appends symbols considering flags */
1054
1051
  append(e, t, s) {
1055
- if (!Q(e)) throw new Error("value should be string");
1056
- const r = Q(s) ? new G(String(s)) : s;
1052
+ if (!X(e)) throw new Error("value should be string");
1053
+ const r = X(s) ? new H(String(s)) : s;
1057
1054
  t != null && t.tail && (t._beforeTailState = this.state);
1058
1055
  let n;
1059
1056
  [e, n] = this.doPrepare(e, t);
@@ -1065,7 +1062,7 @@ class L {
1065
1062
  return (this.eager === !0 || this.eager === "append") && t != null && t.input && e && n.aggregate(this._appendEager()), r != null && (n.tailShift += this.appendTail(r).tailShift), n;
1066
1063
  }
1067
1064
  remove(e, t) {
1068
- return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this._value = this.displayValue.slice(0, e) + this.displayValue.slice(t), new x();
1065
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this._value = this.displayValue.slice(0, e) + this.displayValue.slice(t), new S();
1069
1066
  }
1070
1067
  /** Calls function and reapplies current value */
1071
1068
  withValueRefresh(e) {
@@ -1085,11 +1082,11 @@ class L {
1085
1082
  }
1086
1083
  /** Prepares string before mask processing */
1087
1084
  doPrepare(e, t) {
1088
- return t === void 0 && (t = {}), x.normalize(this.prepare ? this.prepare(e, this, t) : e);
1085
+ return t === void 0 && (t = {}), S.normalize(this.prepare ? this.prepare(e, this, t) : e);
1089
1086
  }
1090
1087
  /** Prepares each char before mask processing */
1091
1088
  doPrepareChar(e, t) {
1092
- return t === void 0 && (t = {}), x.normalize(this.prepareChar ? this.prepareChar(e, this, t) : e);
1089
+ return t === void 0 && (t = {}), S.normalize(this.prepareChar ? this.prepareChar(e, this, t) : e);
1093
1090
  }
1094
1091
  /** Validates if value is acceptable */
1095
1092
  doValidate(e) {
@@ -1100,46 +1097,46 @@ class L {
1100
1097
  this.commit && this.commit(this.value, this);
1101
1098
  }
1102
1099
  splice(e, t, s, r, n) {
1103
- s === void 0 && (s = ""), r === void 0 && (r = y.NONE), n === void 0 && (n = {
1100
+ s === void 0 && (s = ""), r === void 0 && (r = b.NONE), n === void 0 && (n = {
1104
1101
  input: !0
1105
1102
  });
1106
1103
  const a = e + t, l = this.extractTail(a), u = this.eager === !0 || this.eager === "remove";
1107
1104
  let o;
1108
- u && (r = qt(r), o = this.extractInput(0, a, {
1105
+ u && (r = Nt(r), o = this.extractInput(0, a, {
1109
1106
  raw: !0
1110
1107
  }));
1111
1108
  let v = e;
1112
- const p = new x();
1113
- if (r !== y.NONE && (v = this.nearestInputPos(e, t > 1 && e !== 0 && !u ? y.NONE : r), p.tailShift = v - e), p.aggregate(this.remove(v)), u && r !== y.NONE && o === this.rawInputValue)
1114
- if (r === y.FORCE_LEFT) {
1109
+ const f = new S();
1110
+ if (r !== b.NONE && (v = this.nearestInputPos(e, t > 1 && e !== 0 && !u ? b.NONE : r), f.tailShift = v - e), f.aggregate(this.remove(v)), u && r !== b.NONE && o === this.rawInputValue)
1111
+ if (r === b.FORCE_LEFT) {
1115
1112
  let m;
1116
1113
  for (; o === this.rawInputValue && (m = this.displayValue.length); )
1117
- p.aggregate(new x({
1114
+ f.aggregate(new S({
1118
1115
  tailShift: -1
1119
1116
  })).aggregate(this.remove(m - 1));
1120
- } else r === y.FORCE_RIGHT && l.unshift();
1121
- return p.aggregate(this.append(s, n, l));
1117
+ } else r === b.FORCE_RIGHT && l.unshift();
1118
+ return f.aggregate(this.append(s, n, l));
1122
1119
  }
1123
1120
  maskEquals(e) {
1124
1121
  return this.mask === e;
1125
1122
  }
1126
1123
  optionsIsChanged(e) {
1127
- return !ge(this, e);
1124
+ return !le(this, e);
1128
1125
  }
1129
1126
  typedValueEquals(e) {
1130
1127
  const t = this.typedValue;
1131
1128
  return e === t || L.EMPTY_VALUES.includes(e) && L.EMPTY_VALUES.includes(t) || (this.format ? this.format(e, this) === this.format(this.typedValue, this) : !1);
1132
1129
  }
1133
1130
  pad(e) {
1134
- return new x();
1131
+ return new S();
1135
1132
  }
1136
1133
  }
1137
1134
  L.DEFAULTS = {
1138
1135
  skipInvalid: !0
1139
1136
  };
1140
1137
  L.EMPTY_VALUES = [void 0, null, ""];
1141
- F.Masked = L;
1142
- class ie {
1138
+ _.Masked = L;
1139
+ class Q {
1143
1140
  /** */
1144
1141
  constructor(e, t) {
1145
1142
  e === void 0 && (e = []), t === void 0 && (t = 0), this.chunks = e, this.from = t;
@@ -1149,13 +1146,13 @@ class ie {
1149
1146
  }
1150
1147
  extend(e) {
1151
1148
  if (!String(e)) return;
1152
- e = Q(e) ? new G(String(e)) : e;
1149
+ e = X(e) ? new H(String(e)) : e;
1153
1150
  const t = this.chunks[this.chunks.length - 1], s = t && // if stops are same or tail has no stop
1154
1151
  (t.stop === e.stop || e.stop == null) && // if tail chunk goes just after last chunk
1155
1152
  e.from === t.from + t.toString().length;
1156
- if (e instanceof G)
1153
+ if (e instanceof H)
1157
1154
  s ? t.extend(e.toString()) : this.chunks.push(e);
1158
- else if (e instanceof ie) {
1155
+ else if (e instanceof Q) {
1159
1156
  if (e.stop == null) {
1160
1157
  let r;
1161
1158
  for (; e.chunks.length && e.chunks[0].stop == null; )
@@ -1165,15 +1162,15 @@ class ie {
1165
1162
  }
1166
1163
  }
1167
1164
  appendTo(e) {
1168
- if (!(e instanceof F.MaskedPattern))
1169
- return new G(this.toString()).appendTo(e);
1170
- const t = new x();
1165
+ if (!(e instanceof _.MaskedPattern))
1166
+ return new H(this.toString()).appendTo(e);
1167
+ const t = new S();
1171
1168
  for (let s = 0; s < this.chunks.length; ++s) {
1172
1169
  const r = this.chunks[s], n = e._mapPosToBlock(e.displayValue.length), a = r.stop;
1173
1170
  let l;
1174
1171
  if (a != null && // if block not found or stop is behind lastBlock
1175
- (!n || n.index <= a) && ((r instanceof ie || // for continuous block also check if stop is exist
1176
- e._stops.indexOf(a) >= 0) && t.aggregate(e._appendPlaceholder(a)), l = r instanceof ie && e._blocks[a]), l) {
1172
+ (!n || n.index <= a) && ((r instanceof Q || // for continuous block also check if stop is exist
1173
+ e._stops.indexOf(a) >= 0) && t.aggregate(e._appendPlaceholder(a)), l = r instanceof Q && e._blocks[a]), l) {
1177
1174
  const u = l.appendTail(r);
1178
1175
  t.aggregate(u);
1179
1176
  const o = r.toString().slice(u.rawInserted.length);
@@ -1201,7 +1198,7 @@ class ie {
1201
1198
  ...s
1202
1199
  } = e;
1203
1200
  Object.assign(this, s), this.chunks = t.map((r) => {
1204
- const n = "chunks" in r ? new ie() : new G();
1201
+ const n = "chunks" in r ? new Q() : new H();
1205
1202
  return n.state = r, n;
1206
1203
  });
1207
1204
  }
@@ -1235,7 +1232,7 @@ class ie {
1235
1232
  return "";
1236
1233
  }
1237
1234
  }
1238
- class jt {
1235
+ class Pt {
1239
1236
  constructor(e, t) {
1240
1237
  this.masked = e, this._log = [];
1241
1238
  const {
@@ -1296,42 +1293,42 @@ class jt {
1296
1293
  }
1297
1294
  pushLeftBeforeFilled() {
1298
1295
  return this._pushLeft(() => {
1299
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, y.FORCE_LEFT), this.offset !== 0))
1296
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, b.FORCE_LEFT), this.offset !== 0))
1300
1297
  return !0;
1301
1298
  });
1302
1299
  }
1303
1300
  pushLeftBeforeInput() {
1304
1301
  return this._pushLeft(() => {
1305
1302
  if (!this.block.isFixed)
1306
- return this.offset = this.block.nearestInputPos(this.offset, y.LEFT), !0;
1303
+ return this.offset = this.block.nearestInputPos(this.offset, b.LEFT), !0;
1307
1304
  });
1308
1305
  }
1309
1306
  pushLeftBeforeRequired() {
1310
1307
  return this._pushLeft(() => {
1311
1308
  if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1312
- return this.offset = this.block.nearestInputPos(this.offset, y.LEFT), !0;
1309
+ return this.offset = this.block.nearestInputPos(this.offset, b.LEFT), !0;
1313
1310
  });
1314
1311
  }
1315
1312
  pushRightBeforeFilled() {
1316
1313
  return this._pushRight(() => {
1317
- if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, y.FORCE_RIGHT), this.offset !== this.block.value.length))
1314
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, b.FORCE_RIGHT), this.offset !== this.block.value.length))
1318
1315
  return !0;
1319
1316
  });
1320
1317
  }
1321
1318
  pushRightBeforeInput() {
1322
1319
  return this._pushRight(() => {
1323
1320
  if (!this.block.isFixed)
1324
- return this.offset = this.block.nearestInputPos(this.offset, y.NONE), !0;
1321
+ return this.offset = this.block.nearestInputPos(this.offset, b.NONE), !0;
1325
1322
  });
1326
1323
  }
1327
1324
  pushRightBeforeRequired() {
1328
1325
  return this._pushRight(() => {
1329
1326
  if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1330
- return this.offset = this.block.nearestInputPos(this.offset, y.NONE), !0;
1327
+ return this.offset = this.block.nearestInputPos(this.offset, b.NONE), !0;
1331
1328
  });
1332
1329
  }
1333
1330
  }
1334
- class Ze {
1331
+ class Ge {
1335
1332
  /** */
1336
1333
  /** */
1337
1334
  /** */
@@ -1357,18 +1354,18 @@ class Ze {
1357
1354
  this._isRawInput = !1, this._value = "";
1358
1355
  }
1359
1356
  remove(e, t) {
1360
- return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._value = this._value.slice(0, e) + this._value.slice(t), this._value || (this._isRawInput = !1), new x();
1357
+ return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._value = this._value.slice(0, e) + this._value.slice(t), this._value || (this._isRawInput = !1), new S();
1361
1358
  }
1362
1359
  nearestInputPos(e, t) {
1363
- t === void 0 && (t = y.NONE);
1360
+ t === void 0 && (t = b.NONE);
1364
1361
  const s = 0, r = this._value.length;
1365
1362
  switch (t) {
1366
- case y.LEFT:
1367
- case y.FORCE_LEFT:
1363
+ case b.LEFT:
1364
+ case b.FORCE_LEFT:
1368
1365
  return s;
1369
- case y.NONE:
1370
- case y.RIGHT:
1371
- case y.FORCE_RIGHT:
1366
+ case b.NONE:
1367
+ case b.RIGHT:
1368
+ case b.FORCE_RIGHT:
1372
1369
  default:
1373
1370
  return r;
1374
1371
  }
@@ -1386,8 +1383,8 @@ class Ze {
1386
1383
  return !!this._value;
1387
1384
  }
1388
1385
  _appendChar(e, t) {
1389
- if (t === void 0 && (t = {}), this.isFilled) return new x();
1390
- const s = this.eager === !0 || this.eager === "append", n = this.char === e && (this.isUnmasking || t.input || t.raw) && (!t.raw || !s) && !t.tail, a = new x({
1386
+ if (t === void 0 && (t = {}), this.isFilled) return new S();
1387
+ const s = this.eager === !0 || this.eager === "append", n = this.char === e && (this.isUnmasking || t.input || t.raw) && (!t.raw || !s) && !t.tail, a = new S({
1391
1388
  inserted: this.char,
1392
1389
  rawInserted: n ? this.char : ""
1393
1390
  });
@@ -1399,14 +1396,14 @@ class Ze {
1399
1396
  });
1400
1397
  }
1401
1398
  _appendPlaceholder() {
1402
- const e = new x();
1399
+ const e = new S();
1403
1400
  return this.isFilled || (this._value = e.inserted = this.char), e;
1404
1401
  }
1405
1402
  extractTail() {
1406
- return new G("");
1403
+ return new H("");
1407
1404
  }
1408
1405
  appendTail(e) {
1409
- return Q(e) && (e = new G(String(e))), e.appendTo(this);
1406
+ return X(e) && (e = new H(String(e))), e.appendTo(this);
1410
1407
  }
1411
1408
  append(e, t, s) {
1412
1409
  const r = this._appendChar(e[0], t);
@@ -1427,7 +1424,7 @@ class Ze {
1427
1424
  return this._appendPlaceholder();
1428
1425
  }
1429
1426
  }
1430
- class ve {
1427
+ class ue {
1431
1428
  /** */
1432
1429
  /** */
1433
1430
  /** */
@@ -1459,7 +1456,7 @@ class ve {
1459
1456
  this.isFilled = !1, this.masked.reset();
1460
1457
  }
1461
1458
  remove(e, t) {
1462
- return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), e === 0 && t >= 1 ? (this.isFilled = !1, this.masked.remove(e, t)) : new x();
1459
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), e === 0 && t >= 1 ? (this.isFilled = !1, this.masked.remove(e, t)) : new S();
1463
1460
  }
1464
1461
  get value() {
1465
1462
  return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
@@ -1477,21 +1474,21 @@ class ve {
1477
1474
  return !!this.masked.value || this.isOptional;
1478
1475
  }
1479
1476
  _appendChar(e, t) {
1480
- if (t === void 0 && (t = {}), this.isFilled) return new x();
1477
+ if (t === void 0 && (t = {}), this.isFilled) return new S();
1481
1478
  const s = this.masked.state;
1482
1479
  let r = this.masked._appendChar(e, this.currentMaskFlags(t));
1483
- return r.inserted && this.doValidate(t) === !1 && (r = new x(), this.masked.state = s), !r.inserted && !this.isOptional && !this.lazy && !t.input && (r.inserted = this.placeholderChar), r.skip = !r.inserted && !this.isOptional, this.isFilled = !!r.inserted, r;
1480
+ return r.inserted && this.doValidate(t) === !1 && (r = new S(), this.masked.state = s), !r.inserted && !this.isOptional && !this.lazy && !t.input && (r.inserted = this.placeholderChar), r.skip = !r.inserted && !this.isOptional, this.isFilled = !!r.inserted, r;
1484
1481
  }
1485
1482
  append(e, t, s) {
1486
1483
  return this.masked.append(e, this.currentMaskFlags(t), s);
1487
1484
  }
1488
1485
  _appendPlaceholder() {
1489
- return this.isFilled || this.isOptional ? new x() : (this.isFilled = !0, new x({
1486
+ return this.isFilled || this.isOptional ? new S() : (this.isFilled = !0, new S({
1490
1487
  inserted: this.placeholderChar
1491
1488
  }));
1492
1489
  }
1493
1490
  _appendEager() {
1494
- return new x();
1491
+ return new S();
1495
1492
  }
1496
1493
  extractTail(e, t) {
1497
1494
  return this.masked.extractTail(e, t);
@@ -1503,16 +1500,16 @@ class ve {
1503
1500
  return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.masked.extractInput(e, t, s);
1504
1501
  }
1505
1502
  nearestInputPos(e, t) {
1506
- t === void 0 && (t = y.NONE);
1503
+ t === void 0 && (t = b.NONE);
1507
1504
  const s = 0, r = this.value.length, n = Math.min(Math.max(e, s), r);
1508
1505
  switch (t) {
1509
- case y.LEFT:
1510
- case y.FORCE_LEFT:
1506
+ case b.LEFT:
1507
+ case b.FORCE_LEFT:
1511
1508
  return this.isComplete ? n : s;
1512
- case y.RIGHT:
1513
- case y.FORCE_RIGHT:
1509
+ case b.RIGHT:
1510
+ case b.FORCE_RIGHT:
1514
1511
  return this.isComplete ? n : r;
1515
- case y.NONE:
1512
+ case b.NONE:
1516
1513
  default:
1517
1514
  return n;
1518
1515
  }
@@ -1545,16 +1542,16 @@ class ve {
1545
1542
  };
1546
1543
  }
1547
1544
  pad(e) {
1548
- return new x();
1545
+ return new S();
1549
1546
  }
1550
1547
  }
1551
- ve.DEFAULT_DEFINITIONS = {
1548
+ ue.DEFAULT_DEFINITIONS = {
1552
1549
  0: /\d/,
1553
1550
  a: /[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
1554
1551
  // http://stackoverflow.com/a/22075070
1555
1552
  "*": /./
1556
1553
  };
1557
- class Ht extends L {
1554
+ class jt extends L {
1558
1555
  /** */
1559
1556
  /** Enable characters overwriting */
1560
1557
  /** */
@@ -1568,7 +1565,7 @@ class Ht extends L {
1568
1565
  t && (e.validate = (s) => s.search(t) >= 0), super._update(e);
1569
1566
  }
1570
1567
  }
1571
- F.MaskedRegExp = Ht;
1568
+ _.MaskedRegExp = jt;
1572
1569
  class N extends L {
1573
1570
  /** */
1574
1571
  /** */
@@ -1583,7 +1580,7 @@ class N extends L {
1583
1580
  super({
1584
1581
  ...N.DEFAULTS,
1585
1582
  ...e,
1586
- definitions: Object.assign({}, ve.DEFAULT_DEFINITIONS, e == null ? void 0 : e.definitions)
1583
+ definitions: Object.assign({}, ue.DEFAULT_DEFINITIONS, e == null ? void 0 : e.definitions)
1587
1584
  });
1588
1585
  }
1589
1586
  updateOptions(e) {
@@ -1601,28 +1598,28 @@ class N extends L {
1601
1598
  for (let n = 0; n < t.length; ++n) {
1602
1599
  if (this.blocks) {
1603
1600
  const o = t.slice(n), v = Object.keys(this.blocks).filter((m) => o.indexOf(m) === 0);
1604
- v.sort((m, E) => E.length - m.length);
1605
- const p = v[0];
1606
- if (p) {
1601
+ v.sort((m, x) => x.length - m.length);
1602
+ const f = v[0];
1603
+ if (f) {
1607
1604
  const {
1608
1605
  expose: m,
1609
- repeat: E,
1610
- ...b
1611
- } = pe(this.blocks[p]), S = {
1606
+ repeat: x,
1607
+ ...g
1608
+ } = re(this.blocks[f]), h = {
1612
1609
  lazy: this.lazy,
1613
1610
  eager: this.eager,
1614
1611
  placeholderChar: this.placeholderChar,
1615
1612
  displayChar: this.displayChar,
1616
1613
  overwrite: this.overwrite,
1617
1614
  autofix: this.autofix,
1618
- ...b,
1619
- repeat: E,
1615
+ ...g,
1616
+ repeat: x,
1620
1617
  parent: this
1621
- }, M = E != null ? new F.RepeatBlock(
1622
- S
1618
+ }, k = x != null ? new _.RepeatBlock(
1619
+ h
1623
1620
  /* TODO */
1624
- ) : Y(S);
1625
- M && (this._blocks.push(M), m && (this.exposeBlock = M), this._maskedBlocks[p] || (this._maskedBlocks[p] = []), this._maskedBlocks[p].push(this._blocks.length - 1)), n += p.length - 1;
1621
+ ) : Y(h);
1622
+ k && (this._blocks.push(k), m && (this.exposeBlock = k), this._maskedBlocks[f] || (this._maskedBlocks[f] = []), this._maskedBlocks[f].push(this._blocks.length - 1)), n += f.length - 1;
1626
1623
  continue;
1627
1624
  }
1628
1625
  }
@@ -1643,15 +1640,15 @@ class N extends L {
1643
1640
  if (++n, a = t[n], !a) break;
1644
1641
  l = !1;
1645
1642
  }
1646
- const u = l ? new ve({
1643
+ const u = l ? new ue({
1647
1644
  isOptional: r,
1648
1645
  lazy: this.lazy,
1649
1646
  eager: this.eager,
1650
1647
  placeholderChar: this.placeholderChar,
1651
1648
  displayChar: this.displayChar,
1652
- ...pe(e[a]),
1649
+ ...re(e[a]),
1653
1650
  parent: this
1654
- }) : new Ze({
1651
+ }) : new Ge({
1655
1652
  char: a,
1656
1653
  eager: this.eager,
1657
1654
  isUnmasking: s
@@ -1732,7 +1729,7 @@ class N extends L {
1732
1729
  }
1733
1730
  _appendEager() {
1734
1731
  var e;
1735
- const t = new x();
1732
+ const t = new S();
1736
1733
  let s = (e = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : e.index;
1737
1734
  if (s == null) return t;
1738
1735
  this._blocks[s].isFilled && ++s;
@@ -1745,7 +1742,7 @@ class N extends L {
1745
1742
  }
1746
1743
  _appendCharRaw(e, t) {
1747
1744
  t === void 0 && (t = {});
1748
- const s = this._mapPosToBlock(this.displayValue.length), r = new x();
1745
+ const s = this._mapPosToBlock(this.displayValue.length), r = new S();
1749
1746
  if (!s) return r;
1750
1747
  for (let a = s.index, l; l = this._blocks[a]; ++a) {
1751
1748
  var n;
@@ -1759,10 +1756,10 @@ class N extends L {
1759
1756
  }
1760
1757
  extractTail(e, t) {
1761
1758
  e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1762
- const s = new ie();
1759
+ const s = new Q();
1763
1760
  return e === t || this._forEachBlocksInRange(e, t, (r, n, a, l) => {
1764
1761
  const u = r.extractTail(a, l);
1765
- u.stop = this._findStopBefore(n), u.from = this._blockStartPos(n), u instanceof ie && (u.blockIndex = n), s.extend(u);
1762
+ u.stop = this._findStopBefore(n), u.from = this._blockStartPos(n), u instanceof Q && (u.blockIndex = n), s.extend(u);
1766
1763
  }), s;
1767
1764
  }
1768
1765
  extractInput(e, t, s) {
@@ -1783,7 +1780,7 @@ class N extends L {
1783
1780
  }
1784
1781
  /** Appends placeholder depending on laziness */
1785
1782
  _appendPlaceholder(e) {
1786
- const t = new x();
1783
+ const t = new S();
1787
1784
  if (this.lazy && e == null) return t;
1788
1785
  const s = this._mapPosToBlock(this.displayValue.length);
1789
1786
  if (!s) return t;
@@ -1830,22 +1827,22 @@ class N extends L {
1830
1827
  }), s;
1831
1828
  }
1832
1829
  nearestInputPos(e, t) {
1833
- if (t === void 0 && (t = y.NONE), !this._blocks.length) return 0;
1834
- const s = new jt(this, e);
1835
- if (t === y.NONE)
1830
+ if (t === void 0 && (t = b.NONE), !this._blocks.length) return 0;
1831
+ const s = new Pt(this, e);
1832
+ if (t === b.NONE)
1836
1833
  return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
1837
- if (t === y.LEFT || t === y.FORCE_LEFT) {
1838
- if (t === y.LEFT) {
1834
+ if (t === b.LEFT || t === b.FORCE_LEFT) {
1835
+ if (t === b.LEFT) {
1839
1836
  if (s.pushRightBeforeFilled(), s.ok && s.pos === e) return e;
1840
1837
  s.popState();
1841
1838
  }
1842
- if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t === y.LEFT) {
1839
+ if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t === b.LEFT) {
1843
1840
  if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= e || (s.popState(), s.ok && s.pos <= e)) return s.pos;
1844
1841
  s.popState();
1845
1842
  }
1846
- return s.ok ? s.pos : t === y.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
1843
+ return s.ok ? s.pos : t === b.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
1847
1844
  }
1848
- return t === y.RIGHT || t === y.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : t === y.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(e, y.LEFT))) : e;
1845
+ return t === b.RIGHT || t === b.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : t === b.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(e, b.LEFT))) : e;
1849
1846
  }
1850
1847
  totalInputPositions(e, t) {
1851
1848
  e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
@@ -1864,7 +1861,7 @@ class N extends L {
1864
1861
  return t ? t.map((s) => this._blocks[s]) : [];
1865
1862
  }
1866
1863
  pad(e) {
1867
- const t = new x();
1864
+ const t = new S();
1868
1865
  return this._forEachBlocksInRange(0, this.displayValue.length, (s) => t.aggregate(s.pad(e))), t;
1869
1866
  }
1870
1867
  }
@@ -1875,10 +1872,10 @@ N.DEFAULTS = {
1875
1872
  };
1876
1873
  N.STOP_CHAR = "`";
1877
1874
  N.ESCAPE_CHAR = "\\";
1878
- N.InputDefinition = ve;
1879
- N.FixedDefinition = Ze;
1880
- F.MaskedPattern = N;
1881
- class fe extends N {
1875
+ N.InputDefinition = ue;
1876
+ N.FixedDefinition = Ge;
1877
+ _.MaskedPattern = N;
1878
+ class ne extends N {
1882
1879
  /**
1883
1880
  Optionally sets max length of pattern.
1884
1881
  Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
@@ -1933,7 +1930,7 @@ class fe extends N {
1933
1930
  return this.from <= Number(n) && Number(r) <= this.to && super.doValidate(e);
1934
1931
  }
1935
1932
  pad(e) {
1936
- const t = new x();
1933
+ const t = new S();
1937
1934
  if (this.value.length === this.maxLength) return t;
1938
1935
  const s = this.value, r = this.maxLength - this.value.length;
1939
1936
  if (r) {
@@ -1945,9 +1942,9 @@ class fe extends N {
1945
1942
  return t;
1946
1943
  }
1947
1944
  }
1948
- F.MaskedRange = fe;
1949
- const Gt = "d{.}`m{.}`Y";
1950
- class K extends N {
1945
+ _.MaskedRange = ne;
1946
+ const Ht = "d{.}`m{.}`Y";
1947
+ class G extends N {
1951
1948
  static extractPatternOptions(e) {
1952
1949
  const {
1953
1950
  mask: t,
@@ -1956,7 +1953,7 @@ class K extends N {
1956
1953
  } = e;
1957
1954
  return {
1958
1955
  ...r,
1959
- mask: Q(t) ? t : s
1956
+ mask: X(t) ? t : s
1960
1957
  };
1961
1958
  }
1962
1959
  /** Pattern mask for date according to {@link MaskedDate#format} */
@@ -1965,8 +1962,8 @@ class K extends N {
1965
1962
  /** Format typed value to string */
1966
1963
  /** Parse string to get typed value */
1967
1964
  constructor(e) {
1968
- super(K.extractPatternOptions({
1969
- ...K.DEFAULTS,
1965
+ super(G.extractPatternOptions({
1966
+ ...G.DEFAULTS,
1970
1967
  ...e
1971
1968
  }));
1972
1969
  }
@@ -1980,12 +1977,12 @@ class K extends N {
1980
1977
  blocks: r,
1981
1978
  ...n
1982
1979
  } = {
1983
- ...K.DEFAULTS,
1980
+ ...G.DEFAULTS,
1984
1981
  ...e
1985
- }, a = Object.assign({}, K.GET_DEFAULT_BLOCKS());
1982
+ }, a = Object.assign({}, G.GET_DEFAULT_BLOCKS());
1986
1983
  e.min && (a.Y.from = e.min.getFullYear()), e.max && (a.Y.to = e.max.getFullYear()), e.min && e.max && a.Y.from === a.Y.to && (a.m.from = e.min.getMonth() + 1, a.m.to = e.max.getMonth() + 1, a.m.from === a.m.to && (a.d.from = e.min.getDate(), a.d.to = e.max.getDate())), Object.assign(a, this.blocks, r), super._update({
1987
1984
  ...n,
1988
- mask: Q(t) ? t : s,
1985
+ mask: X(t) ? t : s,
1989
1986
  blocks: a
1990
1987
  });
1991
1988
  }
@@ -2014,32 +2011,32 @@ class K extends N {
2014
2011
  return e === Date || super.maskEquals(e);
2015
2012
  }
2016
2013
  optionsIsChanged(e) {
2017
- return super.optionsIsChanged(K.extractPatternOptions(e));
2014
+ return super.optionsIsChanged(G.extractPatternOptions(e));
2018
2015
  }
2019
2016
  }
2020
- K.GET_DEFAULT_BLOCKS = () => ({
2017
+ G.GET_DEFAULT_BLOCKS = () => ({
2021
2018
  d: {
2022
- mask: fe,
2019
+ mask: ne,
2023
2020
  from: 1,
2024
2021
  to: 31,
2025
2022
  maxLength: 2
2026
2023
  },
2027
2024
  m: {
2028
- mask: fe,
2025
+ mask: ne,
2029
2026
  from: 1,
2030
2027
  to: 12,
2031
2028
  maxLength: 2
2032
2029
  },
2033
2030
  Y: {
2034
- mask: fe,
2031
+ mask: ne,
2035
2032
  from: 1900,
2036
2033
  to: 9999
2037
2034
  }
2038
2035
  });
2039
- K.DEFAULTS = {
2036
+ G.DEFAULTS = {
2040
2037
  ...N.DEFAULTS,
2041
2038
  mask: Date,
2042
- pattern: Gt,
2039
+ pattern: Ht,
2043
2040
  format: (i, e) => {
2044
2041
  if (!i) return "";
2045
2042
  const t = String(i.getDate()).padStart(2, "0"), s = String(i.getMonth() + 1).padStart(2, "0"), r = i.getFullYear();
@@ -2050,11 +2047,11 @@ K.DEFAULTS = {
2050
2047
  return new Date(r, s - 1, t);
2051
2048
  }
2052
2049
  };
2053
- F.MaskedDate = K;
2054
- class ye extends L {
2050
+ _.MaskedDate = G;
2051
+ class he extends L {
2055
2052
  constructor(e) {
2056
2053
  super({
2057
- ...ye.DEFAULTS,
2054
+ ...he.DEFAULTS,
2058
2055
  ...e
2059
2056
  }), this.currentMask = void 0;
2060
2057
  }
@@ -2066,7 +2063,7 @@ class ye extends L {
2066
2063
  const {
2067
2064
  expose: s,
2068
2065
  ...r
2069
- } = pe(t), n = Y({
2066
+ } = re(t), n = Y({
2070
2067
  overwrite: this._overwrite,
2071
2068
  eager: this._eager,
2072
2069
  skipInvalid: this._skipInvalid,
@@ -2082,7 +2079,7 @@ class ye extends L {
2082
2079
  }
2083
2080
  _applyDispatch(e, t, s) {
2084
2081
  e === void 0 && (e = ""), t === void 0 && (t = {}), s === void 0 && (s = "");
2085
- const r = t.tail && t._beforeTailState != null ? t._beforeTailState._value : this.value, n = this.rawInputValue, a = t.tail && t._beforeTailState != null ? t._beforeTailState._rawInputValue : n, l = n.slice(a.length), u = this.currentMask, o = new x(), v = u == null ? void 0 : u.state;
2082
+ const r = t.tail && t._beforeTailState != null ? t._beforeTailState._value : this.value, n = this.rawInputValue, a = t.tail && t._beforeTailState != null ? t._beforeTailState._rawInputValue : n, l = n.slice(a.length), u = this.currentMask, o = new S(), v = u == null ? void 0 : u.state;
2086
2083
  return this.currentMask = this.doDispatch(e, {
2087
2084
  ...t
2088
2085
  }, s), this.currentMask && (this.currentMask !== u ? (this.currentMask.reset(), a && (this.currentMask.append(a, {
@@ -2101,7 +2098,7 @@ class ye extends L {
2101
2098
  return this.currentMask && e.aggregate(this.currentMask._appendEager()), e;
2102
2099
  }
2103
2100
  appendTail(e) {
2104
- const t = new x();
2101
+ const t = new S();
2105
2102
  return e && t.aggregate(this._applyDispatch("", {}, e)), t.aggregate(this.currentMask ? this.currentMask.appendTail(e) : super.appendTail(e));
2106
2103
  }
2107
2104
  currentMaskFlags(e) {
@@ -2174,7 +2171,7 @@ class ye extends L {
2174
2171
  return !!((e = this.currentMask) != null && e.isFilled);
2175
2172
  }
2176
2173
  remove(e, t) {
2177
- const s = new x();
2174
+ const s = new S();
2178
2175
  return this.currentMask && s.aggregate(this.currentMask.remove(e, t)).aggregate(this._applyDispatch()), s;
2179
2176
  }
2180
2177
  get state() {
@@ -2239,7 +2236,7 @@ class ye extends L {
2239
2236
  mask: r,
2240
2237
  ...n
2241
2238
  } = e[s];
2242
- return ge(t, n) && t.maskEquals(r);
2239
+ return le(t, n) && t.maskEquals(r);
2243
2240
  }) : super.maskEquals(e);
2244
2241
  }
2245
2242
  typedValueEquals(e) {
@@ -2247,28 +2244,28 @@ class ye extends L {
2247
2244
  return !!((t = this.currentMask) != null && t.typedValueEquals(e));
2248
2245
  }
2249
2246
  }
2250
- ye.DEFAULTS = {
2247
+ he.DEFAULTS = {
2251
2248
  ...L.DEFAULTS,
2252
2249
  dispatch: (i, e, t, s) => {
2253
2250
  if (!e.compiledMasks.length) return;
2254
2251
  const r = e.rawInputValue, n = e.compiledMasks.map((a, l) => {
2255
- const u = e.currentMask === a, o = u ? a.displayValue.length : a.nearestInputPos(a.displayValue.length, y.FORCE_LEFT);
2252
+ const u = e.currentMask === a, o = u ? a.displayValue.length : a.nearestInputPos(a.displayValue.length, b.FORCE_LEFT);
2256
2253
  return a.rawInputValue !== r ? (a.reset(), a.append(r, {
2257
2254
  raw: !0
2258
2255
  })) : u || a.remove(o), a.append(i, e.currentMaskFlags(t)), a.appendTail(s), {
2259
2256
  index: l,
2260
2257
  weight: a.rawInputValue.length,
2261
- totalInputPositions: a.totalInputPositions(0, Math.max(o, a.nearestInputPos(a.displayValue.length, y.FORCE_LEFT)))
2258
+ totalInputPositions: a.totalInputPositions(0, Math.max(o, a.nearestInputPos(a.displayValue.length, b.FORCE_LEFT)))
2262
2259
  };
2263
2260
  });
2264
2261
  return n.sort((a, l) => l.weight - a.weight || l.totalInputPositions - a.totalInputPositions), e.compiledMasks[n[0].index];
2265
2262
  }
2266
2263
  };
2267
- F.MaskedDynamic = ye;
2268
- class be extends N {
2264
+ _.MaskedDynamic = he;
2265
+ class ce extends N {
2269
2266
  constructor(e) {
2270
2267
  super({
2271
- ...be.DEFAULTS,
2268
+ ...ce.DEFAULTS,
2272
2269
  ...e
2273
2270
  });
2274
2271
  }
@@ -2288,7 +2285,7 @@ class be extends N {
2288
2285
  }
2289
2286
  _appendCharRaw(e, t) {
2290
2287
  t === void 0 && (t = {});
2291
- const s = Math.min(this.nearestInputPos(0, y.FORCE_RIGHT), this.value.length), r = this.enum.filter((n) => this.matchValue(n, this.unmaskedValue + e, s));
2288
+ const s = Math.min(this.nearestInputPos(0, b.FORCE_RIGHT), this.value.length), r = this.enum.filter((n) => this.matchValue(n, this.unmaskedValue + e, s));
2292
2289
  if (r.length) {
2293
2290
  r.length === 1 && this._forEachBlocksInRange(0, this.value.length, (a, l) => {
2294
2291
  const u = r[0][l];
@@ -2297,16 +2294,16 @@ class be extends N {
2297
2294
  const n = super._appendCharRaw(r[0][this.value.length], t);
2298
2295
  return r.length === 1 && r[0].slice(this.unmaskedValue.length).split("").forEach((a) => n.aggregate(super._appendCharRaw(a))), n;
2299
2296
  }
2300
- return new x({
2297
+ return new S({
2301
2298
  skip: !this.isComplete
2302
2299
  });
2303
2300
  }
2304
2301
  extractTail(e, t) {
2305
- return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new G("", e);
2302
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new H("", e);
2306
2303
  }
2307
2304
  remove(e, t) {
2308
- if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), e === t) return new x();
2309
- const s = Math.min(super.nearestInputPos(0, y.FORCE_RIGHT), this.value.length);
2305
+ if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), e === t) return new S();
2306
+ const s = Math.min(super.nearestInputPos(0, b.FORCE_RIGHT), this.value.length);
2310
2307
  let r;
2311
2308
  for (r = e; r >= 0 && !(this.enum.filter((l) => this.matchValue(l, this.value.slice(s, r), s)).length > 1); --r)
2312
2309
  ;
@@ -2317,11 +2314,11 @@ class be extends N {
2317
2314
  return this.enum.indexOf(this.value) >= 0;
2318
2315
  }
2319
2316
  }
2320
- be.DEFAULTS = {
2317
+ ce.DEFAULTS = {
2321
2318
  ...N.DEFAULTS,
2322
2319
  matchValue: (i, e, t) => i.indexOf(e, t) === t
2323
2320
  };
2324
- F.MaskedEnum = be;
2321
+ _.MaskedEnum = ce;
2325
2322
  class Kt extends L {
2326
2323
  /** */
2327
2324
  /** Enable characters overwriting */
@@ -2338,8 +2335,8 @@ class Kt extends L {
2338
2335
  });
2339
2336
  }
2340
2337
  }
2341
- F.MaskedFunction = Kt;
2342
- var Xe;
2338
+ _.MaskedFunction = Kt;
2339
+ var Je;
2343
2340
  class $ extends L {
2344
2341
  /** Single char */
2345
2342
  /** Single char */
@@ -2368,8 +2365,8 @@ class $ extends L {
2368
2365
  super._update(e), this._updateRegExps();
2369
2366
  }
2370
2367
  _updateRegExps() {
2371
- const e = "^" + (this.allowNegative ? "[+|\\-]?" : ""), t = "\\d*", s = (this.scale ? "(" + Fe(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
2372
- this._numberRegExp = new RegExp(e + t + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(Fe).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(Fe(this.thousandsSeparator), "g");
2368
+ const e = "^" + (this.allowNegative ? "[+|\\-]?" : ""), t = "\\d*", s = (this.scale ? "(" + ke(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
2369
+ this._numberRegExp = new RegExp(e + t + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(ke).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(ke(this.thousandsSeparator), "g");
2373
2370
  }
2374
2371
  _removeThousandsSeparators(e) {
2375
2372
  return e.replace(this._thousandsSeparatorRegExp, "");
@@ -2417,13 +2414,13 @@ class $ extends L {
2417
2414
  this.min != null && this.min < 0 && this.number < this.min && (m = this.min), this.max != null && this.max > 0 && this.number > this.max && (m = this.max), m != null && (this.autofix ? (this._value = this.format(m, this).replace($.UNMASKED_RADIX, this.radix), u || (u = n === this._value && !t.tail)) : l = !1), l && (l = !!this._value.match(this._numberRegExp));
2418
2415
  }
2419
2416
  let o;
2420
- l ? o = new x({
2417
+ l ? o = new S({
2421
2418
  inserted: this._value.slice(n.length),
2422
2419
  rawInserted: u ? "" : e,
2423
2420
  skip: u
2424
- }) : (this._value = n, o = new x()), this._value = this._insertThousandsSeparators(this._value);
2425
- const v = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, p = this._separatorsCountFromSlice(v);
2426
- return o.tailShift += (p - r) * this.thousandsSeparator.length, o;
2421
+ }) : (this._value = n, o = new S()), this._value = this._insertThousandsSeparators(this._value);
2422
+ const v = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, f = this._separatorsCountFromSlice(v);
2423
+ return o.tailShift += (f - r) * this.thousandsSeparator.length, o;
2427
2424
  }
2428
2425
  _findSeparatorAround(e) {
2429
2426
  if (this.thousandsSeparator) {
@@ -2443,26 +2440,26 @@ class $ extends L {
2443
2440
  const s = this.value.slice(0, e), r = this.value.slice(t), n = this._separatorsCount(s.length);
2444
2441
  this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + r));
2445
2442
  const a = this._separatorsCountFromSlice(s);
2446
- return new x({
2443
+ return new S({
2447
2444
  tailShift: (a - n) * this.thousandsSeparator.length
2448
2445
  });
2449
2446
  }
2450
2447
  nearestInputPos(e, t) {
2451
2448
  if (!this.thousandsSeparator) return e;
2452
2449
  switch (t) {
2453
- case y.NONE:
2454
- case y.LEFT:
2455
- case y.FORCE_LEFT: {
2450
+ case b.NONE:
2451
+ case b.LEFT:
2452
+ case b.FORCE_LEFT: {
2456
2453
  const s = this._findSeparatorAround(e - 1);
2457
2454
  if (s >= 0) {
2458
2455
  const r = s + this.thousandsSeparator.length;
2459
- if (e < r || this.value.length <= r || t === y.FORCE_LEFT)
2456
+ if (e < r || this.value.length <= r || t === b.FORCE_LEFT)
2460
2457
  return s;
2461
2458
  }
2462
2459
  break;
2463
2460
  }
2464
- case y.RIGHT:
2465
- case y.FORCE_RIGHT: {
2461
+ case b.RIGHT:
2462
+ case b.FORCE_RIGHT: {
2466
2463
  const s = this._findSeparatorAround(e);
2467
2464
  if (s >= 0)
2468
2465
  return s + this.thousandsSeparator.length;
@@ -2523,7 +2520,7 @@ class $ extends L {
2523
2520
  return (super.typedValueEquals(e) || $.EMPTY_VALUES.includes(e) && $.EMPTY_VALUES.includes(this.typedValue)) && !(e === 0 && this.value === "");
2524
2521
  }
2525
2522
  }
2526
- Xe = $;
2523
+ Je = $;
2527
2524
  $.UNMASKED_RADIX = ".";
2528
2525
  $.EMPTY_VALUES = [...L.EMPTY_VALUES, 0];
2529
2526
  $.DEFAULTS = {
@@ -2531,7 +2528,7 @@ $.DEFAULTS = {
2531
2528
  mask: Number,
2532
2529
  radix: ",",
2533
2530
  thousandsSeparator: "",
2534
- mapToRadix: [Xe.UNMASKED_RADIX],
2531
+ mapToRadix: [Je.UNMASKED_RADIX],
2535
2532
  min: Number.MIN_SAFE_INTEGER,
2536
2533
  max: Number.MAX_SAFE_INTEGER,
2537
2534
  scale: 2,
@@ -2543,24 +2540,24 @@ $.DEFAULTS = {
2543
2540
  maximumFractionDigits: 20
2544
2541
  })
2545
2542
  };
2546
- F.MaskedNumber = $;
2547
- const Me = {
2543
+ _.MaskedNumber = $;
2544
+ const Ae = {
2548
2545
  MASKED: "value",
2549
2546
  UNMASKED: "unmaskedValue",
2550
2547
  TYPED: "typedValue"
2551
2548
  };
2552
- function Qe(i, e, t) {
2553
- e === void 0 && (e = Me.MASKED), t === void 0 && (t = Me.MASKED);
2549
+ function Ye(i, e, t) {
2550
+ e === void 0 && (e = Ae.MASKED), t === void 0 && (t = Ae.MASKED);
2554
2551
  const s = Y(i);
2555
2552
  return (r) => s.runIsolated((n) => (n[e] = r, n[t]));
2556
2553
  }
2557
- function Jt(i, e, t, s) {
2558
- return Qe(e, t, s)(i);
2554
+ function Gt(i, e, t, s) {
2555
+ return Ye(e, t, s)(i);
2559
2556
  }
2560
- F.PIPE_TYPE = Me;
2561
- F.createPipe = Qe;
2562
- F.pipe = Jt;
2563
- class Yt extends N {
2557
+ _.PIPE_TYPE = Ae;
2558
+ _.createPipe = Ye;
2559
+ _.pipe = Gt;
2560
+ class Jt extends N {
2564
2561
  get repeatFrom() {
2565
2562
  var e;
2566
2563
  return (e = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? e : 0;
@@ -2580,7 +2577,7 @@ class Yt extends N {
2580
2577
  const {
2581
2578
  repeat: n,
2582
2579
  ...a
2583
- } = pe(e);
2580
+ } = re(e);
2584
2581
  this._blockOpts = Object.assign({}, this._blockOpts, a);
2585
2582
  const l = Y(this._blockOpts);
2586
2583
  this.repeat = (t = (s = n ?? l.repeat) != null ? s : this.repeat) != null ? t : 1 / 0, super._update({
@@ -2603,7 +2600,7 @@ class Yt extends N {
2603
2600
  }
2604
2601
  _appendCharRaw(e, t) {
2605
2602
  t === void 0 && (t = {});
2606
- const s = new x();
2603
+ const s = new S();
2607
2604
  for (
2608
2605
  let u = (r = (n = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : n.index) != null ? r : Math.max(this._blocks.length - 1, 0), o, v;
2609
2606
  // try to get a block or
@@ -2612,15 +2609,15 @@ class Yt extends N {
2612
2609
  ++u
2613
2610
  ) {
2614
2611
  var r, n, a, l;
2615
- const p = o._appendChar(e, {
2612
+ const f = o._appendChar(e, {
2616
2613
  ...t,
2617
2614
  _beforeTailState: (l = t._beforeTailState) == null || (l = l._blocks) == null ? void 0 : l[u]
2618
2615
  });
2619
- if (p.skip && v) {
2616
+ if (f.skip && v) {
2620
2617
  this._blocks.pop(), this.mask = this.mask.slice(1);
2621
2618
  break;
2622
2619
  }
2623
- if (s.aggregate(p), p.consumed) break;
2620
+ if (s.aggregate(f), f.consumed) break;
2624
2621
  }
2625
2622
  return s;
2626
2623
  }
@@ -2653,38 +2650,38 @@ class Yt extends N {
2653
2650
  this._blocks.length = e._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = e;
2654
2651
  }
2655
2652
  }
2656
- F.RepeatBlock = Yt;
2653
+ _.RepeatBlock = Jt;
2657
2654
  try {
2658
- globalThis.IMask = F;
2655
+ globalThis.IMask = _;
2659
2656
  } catch {
2660
2657
  }
2661
- const X = {
2658
+ const Z = {
2662
2659
  lazy: !0,
2663
2660
  placeholderChar: "_",
2664
2661
  rawMode: "unmasked",
2665
2662
  normalize: "none"
2666
2663
  };
2667
- function Wt(i) {
2664
+ function Yt(i) {
2668
2665
  return i === "unmasked" || i === "masked" || i === "typed";
2669
2666
  }
2670
- function Zt(i) {
2667
+ function Wt(i) {
2671
2668
  return i === "digits" || i === "e164" || i === "none";
2672
2669
  }
2673
- function et(i) {
2670
+ function We(i) {
2674
2671
  const e = i.match(/\+\{(\d+)\}/);
2675
2672
  return (e == null ? void 0 : e[1]) ?? null;
2676
2673
  }
2677
- function Xt(i) {
2674
+ function Zt(i) {
2678
2675
  const e = i.trim();
2679
2676
  if (!e) return null;
2680
- const t = X.lazy, s = X.placeholderChar, r = X.rawMode, n = X.normalize;
2677
+ const t = Z.lazy, s = Z.placeholderChar, r = Z.rawMode, n = Z.normalize;
2681
2678
  return {
2682
2679
  pattern: e,
2683
2680
  lazy: t,
2684
2681
  placeholderChar: s,
2685
2682
  rawMode: r,
2686
2683
  normalize: n,
2687
- countryCode: et(e),
2684
+ countryCode: We(e),
2688
2685
  imaskOptions: {
2689
2686
  mask: e,
2690
2687
  lazy: t,
@@ -2693,17 +2690,17 @@ function Xt(i) {
2693
2690
  cacheKey: JSON.stringify({ pattern: e, lazy: t, placeholderChar: s, rawMode: r, normalize: n })
2694
2691
  };
2695
2692
  }
2696
- function Qt(i) {
2693
+ function Xt(i) {
2697
2694
  const e = typeof i.pattern == "string" ? i.pattern.trim() : "";
2698
2695
  if (!e) return null;
2699
- const t = typeof i.lazy == "boolean" ? i.lazy : X.lazy, s = typeof i.placeholderChar == "string" && i.placeholderChar.length > 0 ? i.placeholderChar : X.placeholderChar, r = Wt(i.rawMode) ? i.rawMode : X.rawMode, n = Zt(i.normalize) ? i.normalize : X.normalize;
2696
+ const t = typeof i.lazy == "boolean" ? i.lazy : Z.lazy, s = typeof i.placeholderChar == "string" && i.placeholderChar.length > 0 ? i.placeholderChar : Z.placeholderChar, r = Yt(i.rawMode) ? i.rawMode : Z.rawMode, n = Wt(i.normalize) ? i.normalize : Z.normalize;
2700
2697
  return {
2701
2698
  pattern: e,
2702
2699
  lazy: t,
2703
2700
  placeholderChar: s,
2704
2701
  rawMode: r,
2705
2702
  normalize: n,
2706
- countryCode: et(e),
2703
+ countryCode: We(e),
2707
2704
  imaskOptions: {
2708
2705
  mask: e,
2709
2706
  lazy: t,
@@ -2712,17 +2709,17 @@ function Qt(i) {
2712
2709
  cacheKey: JSON.stringify({ pattern: e, lazy: t, placeholderChar: s, rawMode: r, normalize: n })
2713
2710
  };
2714
2711
  }
2715
- function es(i) {
2716
- return typeof i == "string" ? Xt(i) : i && typeof i == "object" ? Qt(i) : null;
2712
+ function Qt(i) {
2713
+ return typeof i == "string" ? Zt(i) : i && typeof i == "object" ? Xt(i) : null;
2717
2714
  }
2718
- const ts = ["for"], ss = {
2715
+ const es = ["for"], ts = {
2719
2716
  key: 0,
2720
2717
  class: "co-field-shell__required",
2721
2718
  "aria-hidden": "true"
2722
- }, is = { class: "co-field-shell__control" }, rs = {
2719
+ }, ss = { class: "co-field-shell__control" }, is = {
2723
2720
  key: 1,
2724
2721
  class: "co-field-shell__message"
2725
- }, ns = /* @__PURE__ */ T({
2722
+ }, rs = /* @__PURE__ */ R({
2726
2723
  __name: "CoFieldShell",
2727
2724
  props: {
2728
2725
  label: {},
@@ -2735,15 +2732,15 @@ const ts = ["for"], ss = {
2735
2732
  size: {}
2736
2733
  },
2737
2734
  setup(i) {
2738
- const e = i, t = c(() => {
2735
+ const e = i, t = p(() => {
2739
2736
  var n;
2740
2737
  return (((n = e.errors) == null ? void 0 : n.length) ?? 0) > 0;
2741
- }), s = c(() => {
2738
+ }), s = p(() => {
2742
2739
  var n;
2743
2740
  return ((n = e.errors) == null ? void 0 : n[0]) || e.helperText || "";
2744
- }), r = c(() => e.size ?? "md");
2745
- return (n, a) => (w(), j("div", {
2746
- class: ft([
2741
+ }), r = p(() => e.size ?? "md");
2742
+ return (n, a) => (I(), P("div", {
2743
+ class: pt([
2747
2744
  "co-field-shell",
2748
2745
  `co-field-shell--${r.value}`,
2749
2746
  {
@@ -2753,26 +2750,26 @@ const ts = ["for"], ss = {
2753
2750
  }
2754
2751
  ])
2755
2752
  }, [
2756
- i.label ? (w(), j("label", {
2753
+ i.label ? (I(), P("label", {
2757
2754
  key: 0,
2758
2755
  for: i.inputId,
2759
2756
  class: "co-field-shell__label"
2760
2757
  }, [
2761
- mt(_e(i.label) + " ", 1),
2762
- i.required ? (w(), j("span", ss, "*")) : ue("", !0)
2763
- ], 8, ts)) : ue("", !0),
2764
- ce("div", is, [
2765
- he(n.$slots, "default", {}, void 0, !0)
2758
+ ft(Fe(i.label) + " ", 1),
2759
+ i.required ? (I(), P("span", ts, "*")) : te("", !0)
2760
+ ], 8, es)) : te("", !0),
2761
+ ie("div", ss, [
2762
+ se(n.$slots, "default", {}, void 0, !0)
2766
2763
  ]),
2767
- s.value ? (w(), j("p", rs, _e(s.value), 1)) : ue("", !0)
2764
+ s.value ? (I(), P("p", is, Fe(s.value), 1)) : te("", !0)
2768
2765
  ], 2));
2769
2766
  }
2770
- }), De = (i, e) => {
2767
+ }), Me = (i, e) => {
2771
2768
  const t = i.__vccOpts || i;
2772
2769
  for (const [s, r] of e)
2773
2770
  t[s] = r;
2774
2771
  return t;
2775
- }, as = /* @__PURE__ */ De(ns, [["__scopeId", "data-v-9aa9efaf"]]), ls = ["id", "type", "placeholder", "disabled"], us = /* @__PURE__ */ T({
2772
+ }, ns = /* @__PURE__ */ Me(rs, [["__scopeId", "data-v-9aa9efaf"]]), as = ["id", "type", "placeholder", "disabled"], ls = /* @__PURE__ */ R({
2776
2773
  __name: "FieldMasked",
2777
2774
  props: {
2778
2775
  field: {},
@@ -2782,123 +2779,123 @@ const ts = ["for"], ss = {
2782
2779
  },
2783
2780
  emits: ["update:value", "blur", "mask:accept"],
2784
2781
  setup(i, { emit: e }) {
2785
- const t = i, s = e, r = H(null), n = H(!1), a = c(() => `co-masked-${t.field.name}`), l = c(() => !!t.disabled || !!t.field.disabled), u = c(() => t.value !== null && t.value !== void 0 && `${t.value}`.length > 0), o = c(() => !t.field.required && u.value && !l.value), v = c(() => {
2786
- var B;
2787
- const C = (B = t.field.originalAttrs) == null ? void 0 : B.size;
2788
- return C === "sm" || C === "lg" ? C : "md";
2789
- }), p = c(() => {
2790
- const C = t.field.originalAttrs ?? {}, B = C.format || C.uiCom;
2791
- return B === "email" || t.field.name === "email" ? "email" : B === "tel" || B === "phone" ? "tel" : B === "url" ? "url" : "text";
2792
- }), m = c(() => {
2793
- var C;
2794
- return es((C = t.field.originalAttrs) == null ? void 0 : C.mask);
2795
- }), E = c(() => {
2796
- var C;
2797
- return ((C = m.value) == null ? void 0 : C.cacheKey) ?? "no-mask-config";
2782
+ const t = i, s = e, r = j(null), n = j(!1), a = p(() => `co-masked-${t.field.name}`), l = p(() => !!t.disabled || !!t.field.disabled), u = p(() => t.value !== null && t.value !== void 0 && `${t.value}`.length > 0), o = p(() => !t.field.required && u.value && !l.value), v = p(() => {
2783
+ var E;
2784
+ const F = (E = t.field.originalAttrs) == null ? void 0 : E.size;
2785
+ return F === "sm" || F === "lg" ? F : "md";
2786
+ }), f = p(() => {
2787
+ const F = t.field.originalAttrs ?? {}, E = F.format || F.uiCom;
2788
+ return E === "email" || t.field.name === "email" ? "email" : E === "tel" || E === "phone" ? "tel" : E === "url" ? "url" : "text";
2789
+ }), m = p(() => {
2790
+ var F;
2791
+ return Qt((F = t.field.originalAttrs) == null ? void 0 : F.mask);
2792
+ }), x = p(() => {
2793
+ var F;
2794
+ return ((F = m.value) == null ? void 0 : F.cacheKey) ?? "no-mask-config";
2798
2795
  });
2799
- let b = null, S = !1;
2800
- function M(C) {
2801
- return C.replace(/\D/g, "");
2796
+ let g = null, h = !1;
2797
+ function k(F) {
2798
+ return F.replace(/\D/g, "");
2802
2799
  }
2803
- function W(C, B, U) {
2804
- const q = C.length > 0, te = B.trim().length > 0, P = U != null && `${U}`.length > 0;
2805
- return q || te || P;
2800
+ function y(F, E, U) {
2801
+ const q = F.length > 0, V = E.trim().length > 0, w = U != null && `${U}`.length > 0;
2802
+ return q || V || w;
2806
2803
  }
2807
- function re(C, B, U) {
2804
+ function c(F, E, U) {
2808
2805
  const q = m.value;
2809
- if (!q) return C || null;
2810
- if (!W(C, B, U)) return null;
2811
- let P;
2812
- if (q.rawMode === "masked" ? P = B : q.rawMode === "typed" ? P = U : P = C, P === "" || P === null || P === void 0) return null;
2813
- if (q.normalize === "none") return P;
2814
- const Ae = q.rawMode === "masked" ? B : C || `${P}`, d = M(Ae);
2815
- if (!d) return null;
2816
- if (q.normalize === "digits") return d;
2817
- const g = q.countryCode;
2818
- return g ? d.startsWith(g) ? `+${d}` : `+${g}${d}` : `+${d}`;
2819
- }
2820
- function Z(C) {
2821
- if (b) {
2822
- S = !0;
2806
+ if (!q) return F || null;
2807
+ if (!y(F, E, U)) return null;
2808
+ let w;
2809
+ if (q.rawMode === "masked" ? w = E : q.rawMode === "typed" ? w = U : w = F, w === "" || w === null || w === void 0) return null;
2810
+ if (q.normalize === "none") return w;
2811
+ const dt = q.rawMode === "masked" ? E : F || `${w}`, ee = k(dt);
2812
+ if (!ee) return null;
2813
+ if (q.normalize === "digits") return ee;
2814
+ const ve = q.countryCode;
2815
+ return ve ? ee.startsWith(ve) ? `+${ee}` : `+${ve}${ee}` : `+${ee}`;
2816
+ }
2817
+ function C(F) {
2818
+ if (g) {
2819
+ h = !0;
2823
2820
  try {
2824
- if (C == null) {
2825
- b.value = "";
2821
+ if (F == null) {
2822
+ g.value = "";
2826
2823
  return;
2827
2824
  }
2828
- const B = m.value;
2829
- if (!B) {
2830
- b.value = String(C);
2825
+ const E = m.value;
2826
+ if (!E) {
2827
+ g.value = String(F);
2831
2828
  return;
2832
2829
  }
2833
- if (B.rawMode === "masked") {
2834
- b.value = String(C);
2830
+ if (E.rawMode === "masked") {
2831
+ g.value = String(F);
2835
2832
  return;
2836
2833
  }
2837
- if (B.rawMode === "typed") {
2834
+ if (E.rawMode === "typed") {
2838
2835
  try {
2839
- b.typedValue = C;
2836
+ g.typedValue = F;
2840
2837
  } catch {
2841
- b.value = String(C);
2838
+ g.value = String(F);
2842
2839
  }
2843
2840
  return;
2844
2841
  }
2845
- const U = B.normalize === "none" ? String(C) : M(String(C));
2846
- b.unmaskedValue = U;
2842
+ const U = E.normalize === "none" ? String(F) : k(String(F));
2843
+ g.unmaskedValue = U;
2847
2844
  } finally {
2848
- S = !1;
2845
+ h = !1;
2849
2846
  }
2850
2847
  }
2851
2848
  }
2852
- function ee() {
2853
- var te;
2854
- if (!b || S) return;
2855
- const C = `${b.unmaskedValue ?? ""}`, B = `${b.value ?? ""}`, U = b.typedValue, q = !!((te = b.masked) != null && te.isComplete);
2856
- s("mask:accept", { rawValue: C, maskedValue: B, isComplete: q }), s("update:value", re(C, B, U));
2849
+ function d() {
2850
+ var V;
2851
+ if (!g || h) return;
2852
+ const F = `${g.unmaskedValue ?? ""}`, E = `${g.value ?? ""}`, U = g.typedValue, q = !!((V = g.masked) != null && V.isComplete);
2853
+ s("mask:accept", { rawValue: F, maskedValue: E, isComplete: q }), s("update:value", c(F, E, U));
2857
2854
  }
2858
- function z() {
2859
- !r.value || !m.value || (b = F(r.value, m.value.imaskOptions), b.on("accept", ee), Z(t.value));
2855
+ function A() {
2856
+ !r.value || !m.value || (g = _(r.value, m.value.imaskOptions), g.on("accept", d), C(t.value));
2860
2857
  }
2861
- function ne() {
2862
- b && (b.off("accept", ee), b.destroy(), b = null);
2858
+ function D() {
2859
+ g && (g.off("accept", d), g.destroy(), g = null);
2863
2860
  }
2864
- function oe() {
2865
- ne(), z();
2861
+ function z() {
2862
+ D(), A();
2866
2863
  }
2867
- function de(C) {
2868
- if (b) return;
2869
- const B = C.target.value;
2870
- s("update:value", B.trim() ? B : null);
2864
+ function pe(F) {
2865
+ if (g) return;
2866
+ const E = F.target.value;
2867
+ s("update:value", E.trim() ? E : null);
2871
2868
  }
2872
- function I() {
2873
- var C;
2874
- if (b) {
2875
- S = !0;
2869
+ function fe() {
2870
+ var F;
2871
+ if (g) {
2872
+ h = !0;
2876
2873
  try {
2877
- b.value = "";
2874
+ g.value = "";
2878
2875
  } finally {
2879
- S = !1;
2876
+ h = !1;
2880
2877
  }
2881
2878
  } else r.value && (r.value.value = "");
2882
- s("update:value", null), (C = r.value) == null || C.focus();
2879
+ s("update:value", null), (F = r.value) == null || F.focus();
2883
2880
  }
2884
- function A() {
2881
+ function me() {
2885
2882
  n.value = !0;
2886
2883
  }
2887
- function D() {
2884
+ function M() {
2888
2885
  n.value = !1, s("blur");
2889
2886
  }
2890
2887
  return J(
2891
2888
  () => t.value,
2892
- (C) => {
2893
- Z(C);
2889
+ (F) => {
2890
+ C(F);
2894
2891
  }
2895
- ), J(E, () => {
2896
- oe();
2892
+ ), J(x, () => {
2893
+ z();
2897
2894
  }), Se(() => {
2898
- z(), !b && r.value && (r.value.value = t.value == null ? "" : String(t.value));
2899
- }), Ue(() => {
2900
- ne();
2901
- }), (C, B) => (w(), R(as, {
2895
+ A(), !g && r.value && (r.value.value = t.value == null ? "" : String(t.value));
2896
+ }), Le(() => {
2897
+ D();
2898
+ }), (F, E) => (I(), T(ns, {
2902
2899
  label: i.field.label,
2903
2900
  "input-id": a.value,
2904
2901
  required: i.field.required,
@@ -2908,40 +2905,40 @@ const ts = ["for"], ss = {
2908
2905
  errors: i.errors,
2909
2906
  size: v.value
2910
2907
  }, {
2911
- default: Ie(() => [
2912
- ce("input", {
2908
+ default: _e(() => [
2909
+ ie("input", {
2913
2910
  id: a.value,
2914
2911
  ref_key: "inputRef",
2915
2912
  ref: r,
2916
2913
  class: "co-field-shell__input",
2917
- type: p.value,
2914
+ type: f.value,
2918
2915
  placeholder: i.field.placeholder,
2919
2916
  disabled: l.value,
2920
- onInput: de,
2921
- onFocus: A,
2922
- onBlur: D
2923
- }, null, 40, ls),
2924
- o.value ? (w(), j("button", {
2917
+ onInput: pe,
2918
+ onFocus: me,
2919
+ onBlur: M
2920
+ }, null, 40, as),
2921
+ o.value ? (I(), P("button", {
2925
2922
  key: 0,
2926
2923
  class: "co-masked__clear",
2927
2924
  type: "button",
2928
2925
  tabindex: "-1",
2929
2926
  "aria-label": "Clear",
2930
- onMousedown: B[0] || (B[0] = Pe(() => {
2927
+ onMousedown: E[0] || (E[0] = Ne(() => {
2931
2928
  }, ["prevent"])),
2932
- onClick: I
2929
+ onClick: fe
2933
2930
  }, [
2934
- me(O(Ft), {
2931
+ ae(B(bt), {
2935
2932
  name: "x-circle",
2936
2933
  size: 16,
2937
2934
  weight: "fill"
2938
2935
  })
2939
- ], 32)) : ue("", !0)
2936
+ ], 32)) : te("", !0)
2940
2937
  ]),
2941
2938
  _: 1
2942
2939
  }, 8, ["label", "input-id", "required", "disabled", "focused", "helper-text", "errors", "size"]));
2943
2940
  }
2944
- }), os = /* @__PURE__ */ De(us, [["__scopeId", "data-v-6a147f90"]]), ds = /* @__PURE__ */ T({
2941
+ }), us = /* @__PURE__ */ Me(ls, [["__scopeId", "data-v-6a147f90"]]), os = /* @__PURE__ */ R({
2945
2942
  __name: "FieldMixed",
2946
2943
  props: {
2947
2944
  field: {},
@@ -2952,7 +2949,7 @@ const ts = ["for"], ss = {
2952
2949
  },
2953
2950
  emits: ["update:value", "blur"],
2954
2951
  setup(i, { emit: e }) {
2955
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText);
2952
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText);
2956
2953
  function a(o) {
2957
2954
  if (o == null) return "";
2958
2955
  if (typeof o == "string") {
@@ -2979,8 +2976,8 @@ const ts = ["for"], ss = {
2979
2976
  return o;
2980
2977
  }
2981
2978
  }
2982
- const u = c(() => a(t.value));
2983
- return (o, v) => (w(), R(O(Et), {
2979
+ const u = p(() => a(t.value));
2980
+ return (o, v) => (I(), T(B(At), {
2984
2981
  label: i.field.label,
2985
2982
  placeholder: i.field.placeholder || "{ }",
2986
2983
  required: i.field.required,
@@ -2988,11 +2985,11 @@ const ts = ["for"], ss = {
2988
2985
  status: r.value,
2989
2986
  "helper-text": n.value,
2990
2987
  value: u.value,
2991
- onCoChange: v[0] || (v[0] = (p) => s("update:value", l(p.detail))),
2992
- onCoBlur: v[1] || (v[1] = (p) => s("blur"))
2988
+ onCoChange: v[0] || (v[0] = (f) => s("update:value", l(f.detail))),
2989
+ onCoBlur: v[1] || (v[1] = (f) => s("blur"))
2993
2990
  }, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "value"]));
2994
2991
  }
2995
- }), hs = /* @__PURE__ */ T({
2992
+ }), ds = /* @__PURE__ */ R({
2996
2993
  __name: "FieldMultiple",
2997
2994
  props: {
2998
2995
  field: {},
@@ -3003,14 +3000,14 @@ const ts = ["for"], ss = {
3003
3000
  },
3004
3001
  emits: ["update:value", "blur"],
3005
3002
  setup(i, { emit: e }) {
3006
- const t = i, s = e, r = c(() => {
3003
+ const t = i, s = e, r = p(() => {
3007
3004
  const a = t.value;
3008
3005
  return Array.isArray(a) ? JSON.stringify(a.map((l) => String(l))) : a == null || a === "" ? "[]" : JSON.stringify([String(a)]);
3009
- }), n = c(() => {
3006
+ }), n = p(() => {
3010
3007
  const a = t.field.originalAttrs.maxElements;
3011
3008
  return typeof a == "number" ? a : void 0;
3012
3009
  });
3013
- return (a, l) => (w(), R(O(xt), {
3010
+ return (a, l) => (I(), T(B(Et), {
3014
3011
  label: i.field.label,
3015
3012
  placeholder: i.field.placeholder,
3016
3013
  required: i.field.required,
@@ -3025,7 +3022,7 @@ const ts = ["for"], ss = {
3025
3022
  onCoBlur: l[1] || (l[1] = (u) => s("blur"))
3026
3023
  }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "invalid", "error-message", "helper-text", "max-tags", "value"]));
3027
3024
  }
3028
- }), Ee = /* @__PURE__ */ T({
3025
+ }), ye = /* @__PURE__ */ R({
3029
3026
  __name: "FieldNumber",
3030
3027
  props: {
3031
3028
  field: {},
@@ -3035,8 +3032,11 @@ const ts = ["for"], ss = {
3035
3032
  },
3036
3033
  emits: ["update:value", "blur"],
3037
3034
  setup(i, { emit: e }) {
3038
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(() => t.field.originalAttrs.min), l = c(() => t.field.originalAttrs.max), u = c(() => typeof t.value == "number" ? t.value : null);
3039
- return (o, v) => (w(), R(O(_t), {
3035
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(() => t.field.originalAttrs.min), l = p(() => t.field.originalAttrs.max), u = p(() => {
3036
+ const v = String(t.field.originalAttrs.format || "").toLowerCase();
3037
+ return v === "rate" || v === "percent" ? v : void 0;
3038
+ }), o = p(() => typeof t.value == "number" ? t.value : null);
3039
+ return (v, f) => (I(), T(B(xt), {
3040
3040
  label: i.field.label,
3041
3041
  placeholder: i.field.placeholder,
3042
3042
  required: i.field.required,
@@ -3046,12 +3046,13 @@ const ts = ["for"], ss = {
3046
3046
  "helper-text": n.value,
3047
3047
  min: a.value,
3048
3048
  max: l.value,
3049
- value: u.value,
3050
- onCoChange: v[0] || (v[0] = (p) => s("update:value", p.detail)),
3051
- onBlur: v[1] || (v[1] = (p) => s("blur"))
3052
- }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "status", "helper-text", "min", "max", "value"]));
3049
+ format: u.value,
3050
+ value: o.value,
3051
+ onCoChange: f[0] || (f[0] = (m) => s("update:value", m.detail)),
3052
+ onBlur: f[1] || (f[1] = (m) => s("blur"))
3053
+ }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "status", "helper-text", "min", "max", "format", "value"]));
3053
3054
  }
3054
- }), cs = /* @__PURE__ */ T({
3055
+ }), hs = /* @__PURE__ */ R({
3055
3056
  __name: "FieldPhone",
3056
3057
  props: {
3057
3058
  field: {},
@@ -3061,8 +3062,8 @@ const ts = ["for"], ss = {
3061
3062
  },
3062
3063
  emits: ["update:value", "blur"],
3063
3064
  setup(i, { emit: e }) {
3064
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(() => t.field.originalAttrs.defaultCountry || "CO");
3065
- return (l, u) => (w(), R(O(St), {
3065
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(() => t.field.originalAttrs.defaultCountry || "CO");
3066
+ return (l, u) => (I(), T(B(_t), {
3066
3067
  label: i.field.label,
3067
3068
  placeholder: i.field.placeholder,
3068
3069
  required: i.field.required,
@@ -3074,7 +3075,7 @@ const ts = ["for"], ss = {
3074
3075
  onCoChange: u[0] || (u[0] = (o) => s("update:value", o.detail))
3075
3076
  }, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "default-country", "value"]));
3076
3077
  }
3077
- }), ps = /* @__PURE__ */ T({
3078
+ }), cs = /* @__PURE__ */ R({
3078
3079
  __name: "FieldRef",
3079
3080
  props: {
3080
3081
  field: {},
@@ -3085,30 +3086,30 @@ const ts = ["for"], ss = {
3085
3086
  },
3086
3087
  emits: ["update:value", "search", "load-more", "open"],
3087
3088
  setup(i, { emit: e }) {
3088
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(
3089
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(
3089
3090
  () => !!t.field.originalAttrs.multiple || t.field.originalAttrs.type === "array"
3090
- ), l = c(() => {
3091
- const p = t.value;
3092
- if (p == null) return "";
3093
- if (Array.isArray(p)) {
3094
- const m = p.map((E) => typeof E == "string" ? E : (E == null ? void 0 : E._id) || "");
3091
+ ), l = p(() => {
3092
+ const f = t.value;
3093
+ if (f == null) return "";
3094
+ if (Array.isArray(f)) {
3095
+ const m = f.map((x) => typeof x == "string" ? x : (x == null ? void 0 : x._id) || "");
3095
3096
  return JSON.stringify(m);
3096
3097
  }
3097
- return typeof p == "string" ? a.value ? JSON.stringify([p]) : p : typeof p == "object" && p._id ? a.value ? JSON.stringify([p._id]) : String(p._id) : "";
3098
- }), u = c(() => {
3099
- var p;
3100
- return JSON.stringify(((p = t.refState) == null ? void 0 : p.options) || []);
3101
- }), o = c(() => {
3102
- var p;
3103
- return JSON.stringify(((p = t.refState) == null ? void 0 : p.selectedDisplay) || []);
3098
+ return typeof f == "string" ? a.value ? JSON.stringify([f]) : f : typeof f == "object" && f._id ? a.value ? JSON.stringify([f._id]) : String(f._id) : "";
3099
+ }), u = p(() => {
3100
+ var f;
3101
+ return JSON.stringify(((f = t.refState) == null ? void 0 : f.options) || []);
3102
+ }), o = p(() => {
3103
+ var f;
3104
+ return JSON.stringify(((f = t.refState) == null ? void 0 : f.selectedDisplay) || []);
3104
3105
  });
3105
- function v(p) {
3106
- const m = p.detail ?? {};
3106
+ function v(f) {
3107
+ const m = f.detail ?? {};
3107
3108
  s("update:value", m.value);
3108
3109
  }
3109
- return (p, m) => {
3110
- var E, b;
3111
- return w(), R(O(Bt), {
3110
+ return (f, m) => {
3111
+ var x, g;
3112
+ return I(), T(B(St), {
3112
3113
  label: i.field.label,
3113
3114
  placeholder: i.field.placeholder,
3114
3115
  required: i.field.required,
@@ -3121,17 +3122,17 @@ const ts = ["for"], ss = {
3121
3122
  value: l.value,
3122
3123
  options: u.value,
3123
3124
  "selected-display": o.value,
3124
- loading: ((E = i.refState) == null ? void 0 : E.loading) || !1,
3125
- total: ((b = i.refState) == null ? void 0 : b.total) || 0,
3126
- onCoOpen: m[0] || (m[0] = (S) => s("open")),
3127
- onCoSearch: m[1] || (m[1] = (S) => s("search", S.detail)),
3128
- onCoLoadMore: m[2] || (m[2] = (S) => s("load-more")),
3125
+ loading: ((x = i.refState) == null ? void 0 : x.loading) || !1,
3126
+ total: ((g = i.refState) == null ? void 0 : g.total) || 0,
3127
+ onCoOpen: m[0] || (m[0] = (h) => s("open")),
3128
+ onCoSearch: m[1] || (m[1] = (h) => s("search", h.detail)),
3129
+ onCoLoadMore: m[2] || (m[2] = (h) => s("load-more")),
3129
3130
  onCoChange: v,
3130
- onCoClear: m[3] || (m[3] = (S) => s("update:value", a.value ? [] : null))
3131
+ onCoClear: m[3] || (m[3] = (h) => s("update:value", a.value ? [] : null))
3131
3132
  }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "multiple", "status", "helper-text", "model", "value", "options", "selected-display", "loading", "total"]);
3132
3133
  };
3133
3134
  }
3134
- }), fs = /* @__PURE__ */ T({
3135
+ }), ps = /* @__PURE__ */ R({
3135
3136
  __name: "FieldRichText",
3136
3137
  props: {
3137
3138
  field: {},
@@ -3141,23 +3142,23 @@ const ts = ["for"], ss = {
3141
3142
  },
3142
3143
  emits: ["update:value", "blur"],
3143
3144
  setup(i, { emit: e }) {
3144
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(() => {
3145
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(() => {
3145
3146
  var v;
3146
3147
  return ((v = t.field.originalAttrs) == null ? void 0 : v.preset) || "task";
3147
- }), l = H(null), u = H(t.value == null ? "" : String(t.value));
3148
+ }), l = j(null), u = j(t.value == null ? "" : String(t.value));
3148
3149
  J(
3149
3150
  () => t.value,
3150
3151
  (v) => {
3151
- const p = v == null ? "" : String(v);
3152
- p !== l.value && (u.value = p);
3152
+ const f = v == null ? "" : String(v);
3153
+ f !== l.value && (u.value = f);
3153
3154
  }
3154
3155
  );
3155
3156
  function o(v) {
3156
3157
  var m;
3157
- const p = ((m = v.detail) == null ? void 0 : m.html) ?? "";
3158
- l.value = p, s("update:value", p);
3158
+ const f = ((m = v.detail) == null ? void 0 : m.html) ?? "";
3159
+ l.value = f, s("update:value", f);
3159
3160
  }
3160
- return (v, p) => (w(), R(O(Mt), {
3161
+ return (v, f) => (I(), T(B(Bt), {
3161
3162
  label: i.field.label,
3162
3163
  placeholder: i.field.placeholder,
3163
3164
  required: i.field.required,
@@ -3167,10 +3168,10 @@ const ts = ["for"], ss = {
3167
3168
  preset: a.value,
3168
3169
  value: u.value,
3169
3170
  onCoInput: o,
3170
- onCoBlur: p[0] || (p[0] = (m) => s("blur"))
3171
+ onCoBlur: f[0] || (f[0] = (m) => s("blur"))
3171
3172
  }, null, 8, ["label", "placeholder", "required", "disabled", "status", "helper-text", "preset", "value"]));
3172
3173
  }
3173
- }), xe = /* @__PURE__ */ T({
3174
+ }), Ce = /* @__PURE__ */ R({
3174
3175
  __name: "FieldSelect",
3175
3176
  props: {
3176
3177
  field: {},
@@ -3180,11 +3181,11 @@ const ts = ["for"], ss = {
3180
3181
  },
3181
3182
  emits: ["update:value", "blur"],
3182
3183
  setup(i, { emit: e }) {
3183
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(() => {
3184
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(() => {
3184
3185
  const l = t.field.originalAttrs.enum;
3185
3186
  return Array.isArray(l) ? JSON.stringify(l.map((u) => ({ label: String(u), value: String(u) }))) : "[]";
3186
3187
  });
3187
- return (l, u) => (w(), R(O(wt), {
3188
+ return (l, u) => (I(), T(B(Mt), {
3188
3189
  label: i.field.label,
3189
3190
  placeholder: i.field.placeholder,
3190
3191
  required: i.field.required,
@@ -3198,7 +3199,7 @@ const ts = ["for"], ss = {
3198
3199
  onBlur: u[1] || (u[1] = (o) => s("blur"))
3199
3200
  }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "status", "helper-text", "options", "value"]));
3200
3201
  }
3201
- }), ms = /* @__PURE__ */ T({
3202
+ }), fs = /* @__PURE__ */ R({
3202
3203
  __name: "FieldText",
3203
3204
  props: {
3204
3205
  field: {},
@@ -3208,11 +3209,11 @@ const ts = ["for"], ss = {
3208
3209
  },
3209
3210
  emits: ["update:value", "blur"],
3210
3211
  setup(i, { emit: e }) {
3211
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(() => {
3212
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(() => {
3212
3213
  const l = t.field.originalAttrs, u = l.format || l.uiCom;
3213
3214
  return u === "email" || t.field.name === "email" ? "email" : u === "password" || u === "Password" ? "password" : u === "tel" || u === "phone" ? "tel" : u === "url" ? "url" : "text";
3214
3215
  });
3215
- return (l, u) => (w(), R(O(Ke), {
3216
+ return (l, u) => (I(), T(B(Pe), {
3216
3217
  label: i.field.label,
3217
3218
  placeholder: i.field.placeholder,
3218
3219
  required: i.field.required,
@@ -3226,7 +3227,7 @@ const ts = ["for"], ss = {
3226
3227
  onBlur: u[1] || (u[1] = (o) => s("blur"))
3227
3228
  }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "status", "helper-text", "type", "value"]));
3228
3229
  }
3229
- }), gs = /* @__PURE__ */ T({
3230
+ }), ms = /* @__PURE__ */ R({
3230
3231
  __name: "FieldTextArea",
3231
3232
  props: {
3232
3233
  field: {},
@@ -3236,16 +3237,16 @@ const ts = ["for"], ss = {
3236
3237
  },
3237
3238
  emits: ["update:value", "blur"],
3238
3239
  setup(i, { emit: e }) {
3239
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText), a = c(() => {
3240
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText), a = p(() => {
3240
3241
  var u;
3241
3242
  return ((u = t.field.originalAttrs) == null ? void 0 : u.rows) ?? 4;
3242
- }), l = c(
3243
+ }), l = p(
3243
3244
  () => {
3244
3245
  var u, o;
3245
3246
  return ((u = t.field.originalAttrs) == null ? void 0 : u.maxLength) ?? ((o = t.field.ajvProperty) == null ? void 0 : o.maxLength) ?? void 0;
3246
3247
  }
3247
3248
  );
3248
- return (u, o) => (w(), R(O(It), {
3249
+ return (u, o) => (I(), T(B(wt), {
3249
3250
  label: i.field.label,
3250
3251
  placeholder: i.field.placeholder,
3251
3252
  required: i.field.required,
@@ -3260,7 +3261,7 @@ const ts = ["for"], ss = {
3260
3261
  onCoBlur: o[1] || (o[1] = (v) => s("blur"))
3261
3262
  }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "status", "helper-text", "rows", "max-length", "value"]));
3262
3263
  }
3263
- }), tt = /* @__PURE__ */ T({
3264
+ }), Ze = /* @__PURE__ */ R({
3264
3265
  __name: "CoFieldRenderer",
3265
3266
  props: {
3266
3267
  field: {},
@@ -3274,42 +3275,42 @@ const ts = ["for"], ss = {
3274
3275
  },
3275
3276
  emits: ["update:value", "blur", "mask:accept", "search", "load-more", "open", "upload", "remove-file", "reorder", "add-files", "copy-url"],
3276
3277
  setup(i, { emit: e }) {
3277
- const t = gt(() => import("./FieldObject-Cxd3I0Jv.js")), s = {
3278
- text: ms,
3279
- masked: os,
3280
- phone: cs,
3281
- textarea: gs,
3282
- html: fs,
3283
- number: Ee,
3278
+ const t = mt(() => import("./FieldObject-Cxd3I0Jv.js")), s = {
3279
+ text: fs,
3280
+ masked: us,
3281
+ phone: hs,
3282
+ textarea: ms,
3283
+ html: ps,
3284
+ number: ye,
3284
3285
  // Default date renderer is the Cobalt date picker (manual input + calendar).
3285
3286
  // The native `<input type="date">` wrapper (FieldDate) stays exported for
3286
3287
  // apps that opt back in via the `fieldComponents` prop.
3287
- date: Ot,
3288
- boolean: Tt,
3289
- select: xe,
3290
- radio: xe,
3291
- checkbox: xe,
3292
- ref: ps,
3293
- rating: Ee,
3294
- slider: Ee,
3288
+ date: Tt,
3289
+ boolean: Dt,
3290
+ select: Ce,
3291
+ radio: Ce,
3292
+ checkbox: Ce,
3293
+ ref: cs,
3294
+ rating: ye,
3295
+ slider: ye,
3295
3296
  color: Rt,
3296
3297
  section: null,
3297
- file: Nt,
3298
+ file: Lt,
3298
3299
  array: null,
3299
3300
  object: t,
3300
- tags: hs,
3301
- mixed: ds,
3301
+ tags: ds,
3302
+ mixed: os,
3302
3303
  "fill-blank": null,
3303
3304
  ordering: null,
3304
3305
  matching: null,
3305
3306
  "image-choice": null,
3306
3307
  custom: null
3307
- }, r = i, n = e, a = c(() => {
3308
+ }, r = i, n = e, a = p(() => {
3308
3309
  var u, o;
3309
3310
  const l = r.field.originalAttrs.uiCom;
3310
3311
  return l && ((u = r.fieldComponents) != null && u[l]) ? r.fieldComponents[l] : (o = r.fieldComponents) != null && o[r.field.kind] ? r.fieldComponents[r.field.kind] : s[r.field.kind] ?? null;
3311
3312
  });
3312
- return (l, u) => (w(), R(vt(a.value), {
3313
+ return (l, u) => (I(), T(vt(a.value), {
3313
3314
  field: i.field,
3314
3315
  value: i.value,
3315
3316
  errors: i.errors,
@@ -3331,11 +3332,273 @@ const ts = ["for"], ss = {
3331
3332
  "onMask:accept": u[10] || (u[10] = (o) => n("mask:accept", o))
3332
3333
  }, null, 40, ["field", "value", "errors", "disabled", "ref-state", "file-state", "locale", "field-components"]));
3333
3334
  }
3334
- }), qe = {
3335
+ });
3336
+ function O(i) {
3337
+ return i.path ?? i.name;
3338
+ }
3339
+ function we(i, e) {
3340
+ var t;
3341
+ for (const s of i)
3342
+ e(s), (t = s.children) != null && t.length && we(s.children, e);
3343
+ }
3344
+ function Xe(i, e) {
3345
+ return e.split(".").reduce((t, s) => t == null ? void 0 : t[s], i);
3346
+ }
3347
+ function vs(i, e, t) {
3348
+ const s = e.split(".");
3349
+ if (s.length === 1)
3350
+ return i.setValue(e, t), { name: e, value: t };
3351
+ const r = s[0], n = Qe(i.values.value[r], s.slice(1), t);
3352
+ return i.setValue(r, n), { name: r, value: n };
3353
+ }
3354
+ function Qe(i, e, t) {
3355
+ const s = i && typeof i == "object" && !Array.isArray(i) ? i : {}, [r, ...n] = e;
3356
+ return { ...s, [r]: n.length ? Qe(s[r], n, t) : t };
3357
+ }
3358
+ const Re = 20;
3359
+ function gs(i) {
3360
+ const e = () => xe(i.form), t = qe({}), s = /* @__PURE__ */ new Map();
3361
+ function r() {
3362
+ return {
3363
+ options: [],
3364
+ selectedDisplay: [],
3365
+ loading: !1,
3366
+ total: 0,
3367
+ hasMore: !1,
3368
+ page: 1,
3369
+ query: ""
3370
+ };
3371
+ }
3372
+ function n(g, h) {
3373
+ const k = g.originalAttrs.displayName || "name", y = [], c = [], C = (d) => {
3374
+ d && (typeof d == "string" ? y.push(d) : typeof d == "object" && d._id && (y.push(d._id), c.push({
3375
+ value: d._id,
3376
+ label: String(d[k] ?? d.name ?? d._id),
3377
+ meta: d
3378
+ })));
3379
+ };
3380
+ return Array.isArray(h) ? h.forEach(C) : C(h), { ids: y, display: c };
3381
+ }
3382
+ async function a(g, h) {
3383
+ const k = i.refResolver();
3384
+ if (!k) return;
3385
+ const y = O(g), c = t[y] || r();
3386
+ c.loading = !0, t[y] = { ...c };
3387
+ try {
3388
+ const C = await k({
3389
+ model: g.originalAttrs.ref,
3390
+ pageSize: Re,
3391
+ ...h
3392
+ }), d = t[y], A = (h.page ?? 1) > 1;
3393
+ t[y] = {
3394
+ ...d,
3395
+ options: A ? [...d.options, ...C.options] : C.options,
3396
+ total: C.total ?? C.options.length,
3397
+ hasMore: C.hasMore ?? (h.page ?? 1) * Re < (C.total ?? C.options.length),
3398
+ page: h.page ?? 1,
3399
+ query: h.query ?? d.query,
3400
+ loading: !1
3401
+ };
3402
+ } catch (C) {
3403
+ console.error("[CoFormRenderer] refResolver failed:", C), t[y] = { ...t[y], loading: !1 };
3404
+ }
3405
+ }
3406
+ async function l(g, h) {
3407
+ const k = i.refResolver();
3408
+ if (!k) return;
3409
+ const y = O(g), c = t[y] || r();
3410
+ c.loading = !0, t[y] = { ...c };
3411
+ try {
3412
+ const C = await k({ model: g.originalAttrs.ref, ids: h }), d = t[y], A = new Set(d.selectedDisplay.map((z) => z.value)), D = [...d.selectedDisplay];
3413
+ for (const z of C.options)
3414
+ A.has(z.value) || D.push(z);
3415
+ t[y] = { ...d, selectedDisplay: D, loading: !1 };
3416
+ } catch (C) {
3417
+ console.error("[CoFormRenderer] hydrateRef failed:", C), t[y] = { ...t[y], loading: !1 };
3418
+ }
3419
+ }
3420
+ function u() {
3421
+ s.clear(), we(e().fields.value, (g) => {
3422
+ if (g.kind !== "ref") return;
3423
+ const h = O(g);
3424
+ s.set(h, g);
3425
+ const { ids: k, display: y } = n(g, Xe(e().values.value, h));
3426
+ t[h] = { ...r(), selectedDisplay: y };
3427
+ const c = k.filter((C) => !y.some((d) => d.value === C));
3428
+ c.length > 0 && l(g, c);
3429
+ });
3430
+ }
3431
+ Se(u), J(() => e().fields.value, u, { flush: "post" });
3432
+ function o(g) {
3433
+ const h = t[O(g)];
3434
+ h && h.options.length === 0 && !h.loading && a(g, { query: "", page: 1 });
3435
+ }
3436
+ function v(g, h) {
3437
+ a(g, { query: h, page: 1 });
3438
+ }
3439
+ function f(g) {
3440
+ const h = t[O(g)];
3441
+ !h || h.loading || !h.hasMore || a(g, { query: h.query, page: h.page + 1 });
3442
+ }
3443
+ function m(g) {
3444
+ return t[g];
3445
+ }
3446
+ function x(g) {
3447
+ const h = s.get(g);
3448
+ return {
3449
+ search: (k) => h && v(h, k),
3450
+ loadMore: () => h && f(h),
3451
+ open: () => h && o(h)
3452
+ };
3453
+ }
3454
+ return { refStates: t, stateFor: m, handlersFor: x, onRefOpen: o, onRefSearch: v, onRefLoadMore: f };
3455
+ }
3456
+ function ks(i) {
3457
+ const e = () => xe(i.form), t = qe({}), s = /* @__PURE__ */ new Map();
3458
+ function r(h) {
3459
+ var y;
3460
+ const k = h.originalAttrs;
3461
+ return !!k.multiple || Array.isArray(k.type) || ((y = k.type) == null ? void 0 : y[0]) === "array";
3462
+ }
3463
+ function n(h) {
3464
+ const k = (c) => {
3465
+ if (!c) return null;
3466
+ if (typeof c == "string") return { id: c, name: c, status: "done" };
3467
+ if (typeof c == "object") {
3468
+ const C = c._id || c.id;
3469
+ return C ? {
3470
+ id: C,
3471
+ name: c.fileName || c.name || c.originalName || C,
3472
+ size: c.size,
3473
+ url: c.url,
3474
+ thumbnail: c.thumbnail,
3475
+ fileCode: c.fileCode,
3476
+ status: "done"
3477
+ } : null;
3478
+ }
3479
+ return null;
3480
+ };
3481
+ if (h == null || h === "") return [];
3482
+ if (Array.isArray(h)) return h.map(k).filter((c) => !!c);
3483
+ const y = k(h);
3484
+ return y ? [y] : [];
3485
+ }
3486
+ function a() {
3487
+ s.clear(), we(e().fields.value, (h) => {
3488
+ if (h.kind !== "file") return;
3489
+ const k = O(h);
3490
+ s.set(k, h), t[k] = n(Xe(e().values.value, k));
3491
+ });
3492
+ }
3493
+ Se(a), J(() => e().fields.value, a, { flush: "post" });
3494
+ function l(h) {
3495
+ var C;
3496
+ const k = O(h), y = (t[k] || []).filter((d) => d.status === "done" && d.id), c = r(h) ? y.map((d) => d.id) : ((C = y[0]) == null ? void 0 : C.id) ?? null;
3497
+ i.onChange(vs(e(), k, c));
3498
+ }
3499
+ function u(h, k) {
3500
+ if (!i.uploadResolver()) {
3501
+ console.warn("[CoFormRenderer] file upload requires an `uploadResolver` prop.");
3502
+ return;
3503
+ }
3504
+ const y = O(h);
3505
+ t[y] || (t[y] = []), r(h) || (t[y] = []), k.files.forEach((c, C) => {
3506
+ const d = k.tempIds[C];
3507
+ t[y] = [
3508
+ ...t[y],
3509
+ { tempId: d, name: c.name, size: c.size, status: "uploading", progress: 0 }
3510
+ ], o(h, c, d);
3511
+ });
3512
+ }
3513
+ async function o(h, k, y) {
3514
+ const c = O(h), C = (d) => {
3515
+ t[c] = (t[c] || []).map((A) => A.tempId === y ? d(A) : A);
3516
+ };
3517
+ try {
3518
+ const d = await i.uploadResolver()({
3519
+ field: c,
3520
+ file: k,
3521
+ multiple: r(h),
3522
+ originalAttrs: h.originalAttrs,
3523
+ onProgress: (A) => C((D) => ({ ...D, progress: A }))
3524
+ });
3525
+ C((A) => ({
3526
+ ...A,
3527
+ id: d.id,
3528
+ name: d.name ?? A.name,
3529
+ url: d.url,
3530
+ thumbnail: d.thumbnail,
3531
+ fileCode: d.fileCode,
3532
+ progress: 100,
3533
+ status: "done"
3534
+ })), l(h);
3535
+ } catch (d) {
3536
+ console.error("[CoFormRenderer] uploadResolver failed:", d), C((A) => ({ ...A, status: "error", error: (d == null ? void 0 : d.message) || "Upload failed" }));
3537
+ }
3538
+ }
3539
+ function v(h, k) {
3540
+ const y = O(h), c = (t[y] || []).find(
3541
+ (d) => d.id === k || d.tempId === k
3542
+ );
3543
+ t[y] = (t[y] || []).filter(
3544
+ (d) => d.id !== k && d.tempId !== k
3545
+ ), l(h);
3546
+ const C = i.removeResolver();
3547
+ C && (c == null ? void 0 : c.status) === "done" && c.id && C({
3548
+ field: y,
3549
+ id: c.id,
3550
+ fileCode: c.fileCode,
3551
+ originalAttrs: h.originalAttrs
3552
+ }).catch((d) => console.error("[CoFormRenderer] removeResolver failed:", d));
3553
+ }
3554
+ function f(h, k) {
3555
+ const y = t[O(h)] || [], c = (d) => d.id || d.tempId || `${d.name}:${d.size ?? ""}`, C = new Map(k.map((d, A) => [d, A]));
3556
+ t[O(h)] = [...y].sort((d, A) => {
3557
+ const D = C.has(c(d)) ? C.get(c(d)) : k.length + y.indexOf(d), z = C.has(c(A)) ? C.get(c(A)) : k.length + y.indexOf(A);
3558
+ return D - z;
3559
+ }), l(h);
3560
+ }
3561
+ function m(h, k) {
3562
+ if (!(k != null && k.length)) return;
3563
+ const y = O(h), c = k.filter((d) => d && d.id).map((d) => ({
3564
+ id: d.id,
3565
+ name: d.name || d.id,
3566
+ size: d.size,
3567
+ url: d.url,
3568
+ thumbnail: d.thumbnail,
3569
+ fileCode: d.fileCode,
3570
+ status: "done"
3571
+ }));
3572
+ if (!c.length) return;
3573
+ const C = t[y] || [];
3574
+ if (!r(h))
3575
+ t[y] = [c[0]];
3576
+ else {
3577
+ const d = new Set(C.map((A) => A.id).filter(Boolean));
3578
+ t[y] = [...C, ...c.filter((A) => !d.has(A.id))];
3579
+ }
3580
+ l(h);
3581
+ }
3582
+ function x(h) {
3583
+ return t[h];
3584
+ }
3585
+ function g(h) {
3586
+ const k = s.get(h);
3587
+ return {
3588
+ upload: (y) => k && u(k, y),
3589
+ removeFile: (y) => k && v(k, y),
3590
+ reorder: (y) => k && f(k, y),
3591
+ addFiles: (y) => k && m(k, y),
3592
+ copyUrl: (y) => i.onCopyUrl({ field: h, ...y })
3593
+ };
3594
+ }
3595
+ return { fileStates: t, stateFor: x, handlersFor: g, onFileUpload: u, onFileRemove: v, onFileReorder: f, onFileAddRefs: m };
3596
+ }
3597
+ const Te = {
3335
3598
  sm: "var(--co-spacing-sm, 8px)",
3336
3599
  md: "var(--co-spacing-md, 12px)",
3337
3600
  lg: "var(--co-spacing-lg, 16px)"
3338
- }, vs = "15rem", ks = /* @__PURE__ */ new Set([
3601
+ }, ys = "15rem", Cs = /* @__PURE__ */ new Set([
3339
3602
  "TextArea",
3340
3603
  "HtmlEditor",
3341
3604
  "CodeEditor",
@@ -3344,29 +3607,29 @@ const ts = ["for"], ss = {
3344
3607
  "objectEditor",
3345
3608
  "langEditor"
3346
3609
  ]);
3347
- function st(i) {
3610
+ function et(i) {
3348
3611
  var t;
3349
3612
  if (i.fullWidth) return !0;
3350
3613
  const e = (t = i.originalAttrs) == null ? void 0 : t.uiCom;
3351
- return typeof e == "string" && ks.has(e);
3614
+ return typeof e == "string" && Cs.has(e);
3352
3615
  }
3353
- function it(i, e) {
3616
+ function tt(i, e) {
3354
3617
  const t = Math.max(1, Math.floor(i));
3355
3618
  return {
3356
3619
  display: "grid",
3357
- gap: qe[e] ?? qe.lg,
3358
- "grid-template-columns": t <= 1 ? "1fr" : `repeat(auto-fit, minmax(min(100%, ${vs}), 1fr))`
3620
+ gap: Te[e] ?? Te.lg,
3621
+ "grid-template-columns": t <= 1 ? "1fr" : `repeat(auto-fit, minmax(min(100%, ${ys}), 1fr))`
3359
3622
  };
3360
3623
  }
3361
- function Cs(i, e) {
3624
+ function Fs(i, e) {
3362
3625
  return !i.colSpan || i.colSpan < 1 ? 1 : Math.min(Math.floor(i.colSpan), Math.max(1, e));
3363
3626
  }
3364
- function rt(i, e, t) {
3627
+ function st(i, e, t) {
3365
3628
  if (t) return { style: { "grid-column": "1 / -1" } };
3366
- const s = Cs(i, e);
3629
+ const s = Fs(i, e);
3367
3630
  return s <= 1 ? {} : { style: { "grid-column": `span ${s}` } };
3368
3631
  }
3369
- const $e = Symbol("co-form-depth"), nt = Symbol("co-form-expand-all"), we = Symbol("co-form-columns"), at = Symbol("co-form-errors"), lt = Symbol("co-form-touched"), ut = Symbol("co-form-touch"), ys = ["data-has-error"], bs = { class: "co-form-footer" }, ze = 20, As = /* @__PURE__ */ T({
3632
+ const Oe = Symbol("co-form-depth"), it = Symbol("co-form-expand-all"), Ee = Symbol("co-form-columns"), rt = Symbol("co-form-errors"), nt = Symbol("co-form-touched"), at = Symbol("co-form-touch"), lt = Symbol("co-form-ref-fields"), ut = Symbol("co-form-file-fields"), bs = ["data-has-error"], As = { class: "co-form-footer" }, Es = /* @__PURE__ */ R({
3370
3633
  __name: "CoFormRenderer",
3371
3634
  props: {
3372
3635
  form: {},
@@ -3384,297 +3647,106 @@ const $e = Symbol("co-form-depth"), nt = Symbol("co-form-expand-all"), we = Symb
3384
3647
  },
3385
3648
  emits: ["submit", "invalid", "change", "copy-url"],
3386
3649
  setup(i, { expose: e, emit: t }) {
3387
- const s = i, r = t, n = c(() => s.layout ?? "grid");
3388
- se(nt, c(() => !!s.expandAll));
3389
- const a = c(() => {
3390
- const d = new Set(s.excludeFields ?? []);
3391
- return s.form.fields.value.filter((g) => !g.hidden && !d.has(g.name));
3392
- }), l = c(() => n.value === "stack" ? 1 : s.columns ?? 2), u = c(() => s.gap ?? "lg");
3393
- se(we, l), se(at, c(() => s.form.errors.value)), se(lt, c(() => s.form.touched.value)), se(ut, (d) => s.form.touch(d));
3394
- const o = c(() => it(l.value, u.value));
3395
- function v(d) {
3396
- return rt(d, l.value, st(d));
3397
- }
3398
- function p(d) {
3399
- const g = d.path ?? d.name;
3400
- return s.form.touched.value[g] ? s.form.errors.value[g] || [] : [];
3401
- }
3402
- const m = H(null);
3403
- function E() {
3404
- var h, k;
3405
- const d = (h = m.value) == null ? void 0 : h.querySelector("[data-has-error]");
3406
- if (!d) return;
3407
- d.scrollIntoView({ behavior: "smooth", block: "center" });
3408
- const f = Array.from(d.querySelectorAll("*")).find(
3409
- (_) => _.tagName.startsWith("CO-")
3410
- ) ?? d.querySelector("input, textarea, select, button, [tabindex]");
3411
- (k = f == null ? void 0 : f.focus) == null || k.call(f, { preventScroll: !0 });
3412
- }
3413
- e({ scrollToFirstError: E });
3414
- function b(d, g) {
3415
- s.form.setValue(d, g), r("change", { name: d, value: g });
3416
- }
3417
- async function S() {
3418
- const d = await s.form.submit();
3419
- if (!d.isValid) {
3420
- s.form.touchAll(), r("invalid", d.errors), kt(E);
3421
- return;
3422
- }
3423
- const g = s.form.fields.value.reduce((f, h) => (f[h.name] = h.ajvProperty, f), {});
3424
- r("submit", { values: ct(d.values, g) });
3425
- }
3426
- const M = Oe({});
3427
- function W() {
3428
- return {
3429
- options: [],
3430
- selectedDisplay: [],
3431
- loading: !1,
3432
- total: 0,
3433
- hasMore: !1,
3434
- page: 1,
3435
- query: ""
3436
- };
3437
- }
3438
- function re(d, g) {
3439
- const f = d.originalAttrs.displayName || "name", h = [], k = [], _ = (V) => {
3440
- V && (typeof V == "string" ? h.push(V) : typeof V == "object" && V._id && (h.push(V._id), k.push({
3441
- value: V._id,
3442
- label: String(V[f] ?? V.name ?? V._id),
3443
- meta: V
3444
- })));
3445
- };
3446
- return Array.isArray(g) ? g.forEach(_) : _(g), { ids: h, display: k };
3447
- }
3448
- async function Z(d, g) {
3449
- if (!s.refResolver) return;
3450
- const f = M[d.name] || W();
3451
- f.loading = !0, M[d.name] = { ...f };
3452
- try {
3453
- const h = await s.refResolver({
3454
- model: d.originalAttrs.ref,
3455
- pageSize: ze,
3456
- ...g
3457
- }), k = M[d.name], _ = (g.page ?? 1) > 1;
3458
- M[d.name] = {
3459
- ...k,
3460
- options: _ ? [...k.options, ...h.options] : h.options,
3461
- total: h.total ?? h.options.length,
3462
- hasMore: h.hasMore ?? (g.page ?? 1) * ze < (h.total ?? h.options.length),
3463
- page: g.page ?? 1,
3464
- query: g.query ?? k.query,
3465
- loading: !1
3466
- };
3467
- } catch (h) {
3468
- console.error("[CoFormRenderer] refResolver failed:", h), M[d.name] = { ...M[d.name], loading: !1 };
3469
- }
3470
- }
3471
- async function ee(d, g) {
3472
- if (!s.refResolver) return;
3473
- const f = M[d.name] || W();
3474
- f.loading = !0, M[d.name] = { ...f };
3475
- try {
3476
- const h = await s.refResolver({ model: d.originalAttrs.ref, ids: g }), k = M[d.name], _ = new Set(k.selectedDisplay.map((ae) => ae.value)), V = [...k.selectedDisplay];
3477
- for (const ae of h.options)
3478
- _.has(ae.value) || V.push(ae);
3479
- M[d.name] = { ...k, selectedDisplay: V, loading: !1 };
3480
- } catch (h) {
3481
- console.error("[CoFormRenderer] hydrateRef failed:", h), M[d.name] = { ...M[d.name], loading: !1 };
3482
- }
3483
- }
3484
- function z() {
3485
- for (const d of s.form.fields.value) {
3486
- if (d.kind !== "ref") continue;
3487
- const { ids: g, display: f } = re(d, s.form.values.value[d.name]);
3488
- M[d.name] = { ...W(), selectedDisplay: f };
3489
- const h = g.filter((k) => !f.some((_) => _.value === k));
3490
- h.length > 0 && ee(d, h);
3491
- }
3492
- }
3493
- Se(z), J(() => s.form.fields.value, z, { flush: "post" });
3494
- function ne(d) {
3495
- const g = M[d.name];
3496
- g && g.options.length === 0 && !g.loading && Z(d, { query: "", page: 1 });
3497
- }
3498
- function oe(d, g) {
3499
- Z(d, { query: g, page: 1 });
3500
- }
3501
- function de(d) {
3502
- const g = M[d.name];
3503
- !g || g.loading || !g.hasMore || Z(d, { query: g.query, page: g.page + 1 });
3504
- }
3505
- const I = Oe({});
3506
- function A(d) {
3507
- var f;
3508
- const g = d.originalAttrs;
3509
- return !!g.multiple || Array.isArray(g.type) || ((f = g.type) == null ? void 0 : f[0]) === "array";
3510
- }
3511
- function D(d) {
3512
- const g = (h) => {
3513
- if (!h) return null;
3514
- if (typeof h == "string") return { id: h, name: h, status: "done" };
3515
- if (typeof h == "object") {
3516
- const k = h._id || h.id;
3517
- return k ? {
3518
- id: k,
3519
- name: h.fileName || h.name || h.originalName || k,
3520
- size: h.size,
3521
- url: h.url,
3522
- thumbnail: h.thumbnail,
3523
- fileCode: h.fileCode,
3524
- status: "done"
3525
- } : null;
3526
- }
3527
- return null;
3528
- };
3529
- if (d == null || d === "") return [];
3530
- if (Array.isArray(d)) return d.map(g).filter((h) => !!h);
3531
- const f = g(d);
3532
- return f ? [f] : [];
3533
- }
3534
- function C() {
3535
- for (const d of s.form.fields.value)
3536
- d.kind === "file" && (I[d.name] = D(s.form.values.value[d.name]));
3537
- }
3538
- Se(C), J(() => s.form.fields.value, C, { flush: "post" });
3539
- function B(d) {
3540
- var h;
3541
- const g = (I[d.name] || []).filter((k) => k.status === "done" && k.id), f = A(d) ? g.map((k) => k.id) : ((h = g[0]) == null ? void 0 : h.id) ?? null;
3542
- s.form.setValue(d.name, f), r("change", { name: d.name, value: f });
3543
- }
3544
- async function U(d, g) {
3545
- if (!s.uploadResolver) {
3546
- console.warn("[CoFormRenderer] file upload requires an `uploadResolver` prop.");
3650
+ const s = i, r = t, n = p(() => s.layout ?? "grid");
3651
+ K(it, p(() => !!s.expandAll));
3652
+ const a = p(() => {
3653
+ const c = new Set(s.excludeFields ?? []);
3654
+ return s.form.fields.value.filter((C) => !C.hidden && !c.has(C.name));
3655
+ }), l = p(() => n.value === "stack" ? 1 : s.columns ?? 2), u = p(() => s.gap ?? "lg");
3656
+ K(Ee, l), K(rt, p(() => s.form.errors.value)), K(nt, p(() => s.form.touched.value)), K(at, (c) => s.form.touch(c));
3657
+ const o = p(() => tt(l.value, u.value)), v = gs({
3658
+ form: () => s.form,
3659
+ refResolver: () => s.refResolver
3660
+ }), f = ks({
3661
+ form: () => s.form,
3662
+ uploadResolver: () => s.uploadResolver,
3663
+ removeResolver: () => s.removeResolver,
3664
+ onChange: (c) => r("change", c),
3665
+ onCopyUrl: (c) => r("copy-url", c)
3666
+ });
3667
+ K(lt, { stateFor: v.stateFor, handlersFor: v.handlersFor }), K(ut, { stateFor: f.stateFor, handlersFor: f.handlersFor });
3668
+ function m(c) {
3669
+ return st(c, l.value, et(c));
3670
+ }
3671
+ function x(c) {
3672
+ const C = O(c);
3673
+ return s.form.touched.value[C] ? s.form.errors.value[C] || [] : [];
3674
+ }
3675
+ const g = j(null);
3676
+ function h() {
3677
+ var A, D;
3678
+ const c = (A = g.value) == null ? void 0 : A.querySelector("[data-has-error]");
3679
+ if (!c) return;
3680
+ c.scrollIntoView({ behavior: "smooth", block: "center" });
3681
+ const d = Array.from(c.querySelectorAll("*")).find(
3682
+ (z) => z.tagName.startsWith("CO-")
3683
+ ) ?? c.querySelector("input, textarea, select, button, [tabindex]");
3684
+ (D = d == null ? void 0 : d.focus) == null || D.call(d, { preventScroll: !0 });
3685
+ }
3686
+ e({ scrollToFirstError: h });
3687
+ function k(c, C) {
3688
+ s.form.setValue(c, C), r("change", { name: c, value: C });
3689
+ }
3690
+ async function y() {
3691
+ const c = await s.form.submit();
3692
+ if (!c.isValid) {
3693
+ s.form.touchAll(), r("invalid", c.errors), gt(h);
3547
3694
  return;
3548
3695
  }
3549
- const f = A(d);
3550
- I[d.name] || (I[d.name] = []), f || (I[d.name] = []), g.files.forEach((h, k) => {
3551
- const _ = g.tempIds[k];
3552
- I[d.name] = [
3553
- ...I[d.name],
3554
- { tempId: _, name: h.name, size: h.size, status: "uploading", progress: 0 }
3555
- ], q(d, h, _);
3556
- });
3557
- }
3558
- async function q(d, g, f) {
3559
- const h = (k) => {
3560
- I[d.name] = (I[d.name] || []).map(
3561
- (_) => _.tempId === f ? k(_) : _
3562
- );
3563
- };
3564
- try {
3565
- const k = await s.uploadResolver({
3566
- field: d.name,
3567
- file: g,
3568
- multiple: A(d),
3569
- originalAttrs: d.originalAttrs,
3570
- onProgress: (_) => h((V) => ({ ...V, progress: _ }))
3571
- });
3572
- h((_) => ({
3573
- ..._,
3574
- id: k.id,
3575
- name: k.name ?? _.name,
3576
- url: k.url,
3577
- thumbnail: k.thumbnail,
3578
- fileCode: k.fileCode,
3579
- progress: 100,
3580
- status: "done"
3581
- })), B(d);
3582
- } catch (k) {
3583
- console.error("[CoFormRenderer] uploadResolver failed:", k), h((_) => ({ ..._, status: "error", error: (k == null ? void 0 : k.message) || "Upload failed" }));
3584
- }
3585
- }
3586
- function te(d, g) {
3587
- const f = (I[d.name] || []).find(
3588
- (h) => h.id === g || h.tempId === g
3589
- );
3590
- I[d.name] = (I[d.name] || []).filter(
3591
- (h) => h.id !== g && h.tempId !== g
3592
- ), B(d), s.removeResolver && (f == null ? void 0 : f.status) === "done" && f.id && s.removeResolver({
3593
- field: d.name,
3594
- id: f.id,
3595
- fileCode: f.fileCode,
3596
- originalAttrs: d.originalAttrs
3597
- }).catch((h) => console.error("[CoFormRenderer] removeResolver failed:", h));
3598
- }
3599
- function P(d, g) {
3600
- const f = I[d.name] || [], h = (_) => _.id || _.tempId || `${_.name}:${_.size ?? ""}`, k = new Map(g.map((_, V) => [_, V]));
3601
- I[d.name] = [...f].sort((_, V) => {
3602
- const ae = k.has(h(_)) ? k.get(h(_)) : g.length + f.indexOf(_), dt = k.has(h(V)) ? k.get(h(V)) : g.length + f.indexOf(V);
3603
- return ae - dt;
3604
- }), B(d);
3605
- }
3606
- function Ae(d, g) {
3607
- if (!(g != null && g.length)) return;
3608
- const f = g.filter((k) => k && k.id).map((k) => ({
3609
- id: k.id,
3610
- name: k.name || k.id,
3611
- size: k.size,
3612
- url: k.url,
3613
- thumbnail: k.thumbnail,
3614
- fileCode: k.fileCode,
3615
- status: "done"
3616
- }));
3617
- if (!f.length) return;
3618
- const h = I[d.name] || [];
3619
- if (!A(d))
3620
- I[d.name] = [f[0]];
3621
- else {
3622
- const k = new Set(h.map((_) => _.id).filter(Boolean));
3623
- I[d.name] = [...h, ...f.filter((_) => !k.has(_.id))];
3624
- }
3625
- B(d);
3696
+ const C = s.form.fields.value.reduce((d, A) => (d[A.name] = A.ajvProperty, d), {});
3697
+ r("submit", { values: ct(c.values, C) });
3626
3698
  }
3627
- return (d, g) => (w(), j("form", {
3699
+ return (c, C) => (I(), P("form", {
3628
3700
  ref_key: "formEl",
3629
- ref: m,
3630
- onSubmit: Pe(S, ["prevent"])
3701
+ ref: g,
3702
+ onSubmit: Ne(y, ["prevent"])
3631
3703
  }, [
3632
- he(d.$slots, "header", { form: i.form }, void 0, !0),
3633
- ce("div", {
3704
+ se(c.$slots, "header", { form: i.form }, void 0, !0),
3705
+ ie("div", {
3634
3706
  class: "co-form-grid",
3635
- style: Be(o.value)
3707
+ style: be(o.value)
3636
3708
  }, [
3637
- (w(!0), j(je, null, He(a.value, (f) => (w(), j("div", Ge({
3638
- key: f.name,
3709
+ (I(!0), P(Ue, null, $e(a.value, (d) => (I(), P("div", ze({
3710
+ key: d.name,
3639
3711
  class: "co-form-field",
3640
- "data-has-error": p(f).length > 0 || void 0
3641
- }, { ref_for: !0 }, v(f)), [
3642
- he(d.$slots, `field:${f.name}`, {
3643
- field: f,
3644
- value: i.form.values.value[f.name],
3645
- errors: p(f),
3646
- setValue: (h) => i.form.setValue(f.name, h),
3647
- touch: () => i.form.touch(f.name)
3712
+ "data-has-error": x(d).length > 0 || void 0
3713
+ }, { ref_for: !0 }, m(d)), [
3714
+ se(c.$slots, `field:${d.name}`, {
3715
+ field: d,
3716
+ value: i.form.values.value[d.name],
3717
+ errors: x(d),
3718
+ setValue: (A) => i.form.setValue(d.name, A),
3719
+ touch: () => i.form.touch(d.name)
3648
3720
  }, () => [
3649
- me(tt, {
3650
- field: f,
3651
- value: i.form.values.value[f.name],
3652
- errors: p(f),
3653
- disabled: i.disabled || f.disabled,
3654
- "ref-state": M[f.name],
3655
- "file-state": I[f.name],
3721
+ ae(Ze, {
3722
+ field: d,
3723
+ value: i.form.values.value[d.name],
3724
+ errors: x(d),
3725
+ disabled: i.disabled || d.disabled,
3726
+ "ref-state": B(v).refStates[B(O)(d)],
3727
+ "file-state": B(f).fileStates[B(O)(d)],
3656
3728
  locale: i.locale,
3657
3729
  "field-components": i.fieldComponents,
3658
- "onUpdate:value": (h) => b(f.name, h),
3659
- onBlur: (h) => i.form.touch(f.name),
3660
- onSearch: (h) => oe(f, h),
3661
- onLoadMore: (h) => de(f),
3662
- onOpen: (h) => ne(f),
3663
- onUpload: (h) => U(f, h),
3664
- onRemoveFile: (h) => te(f, h),
3665
- onReorder: (h) => P(f, h),
3666
- onAddFiles: (h) => Ae(f, h),
3667
- onCopyUrl: (h) => r("copy-url", { field: f.name, ...h })
3730
+ "onUpdate:value": (A) => k(d.name, A),
3731
+ onBlur: (A) => i.form.touch(d.name),
3732
+ onSearch: (A) => B(v).onRefSearch(d, A),
3733
+ onLoadMore: (A) => B(v).onRefLoadMore(d),
3734
+ onOpen: (A) => B(v).onRefOpen(d),
3735
+ onUpload: (A) => B(f).onFileUpload(d, A),
3736
+ onRemoveFile: (A) => B(f).onFileRemove(d, A),
3737
+ onReorder: (A) => B(f).onFileReorder(d, A),
3738
+ onAddFiles: (A) => B(f).onFileAddRefs(d, A),
3739
+ onCopyUrl: (A) => r("copy-url", { field: d.name, ...A })
3668
3740
  }, null, 8, ["field", "value", "errors", "disabled", "ref-state", "file-state", "locale", "field-components", "onUpdate:value", "onBlur", "onSearch", "onLoadMore", "onOpen", "onUpload", "onRemoveFile", "onReorder", "onAddFiles", "onCopyUrl"])
3669
3741
  ], !0)
3670
- ], 16, ys))), 128))
3742
+ ], 16, bs))), 128))
3671
3743
  ], 4),
3672
- ce("div", bs, [
3673
- he(d.$slots, "footer", {
3744
+ ie("div", As, [
3745
+ se(c.$slots, "footer", {
3674
3746
  form: i.form,
3675
- submit: S
3747
+ submit: y
3676
3748
  }, () => [
3677
- me(O(Vt), {
3749
+ ae(B(It), {
3678
3750
  type: "submit",
3679
3751
  label: "Enviar",
3680
3752
  variant: "primary"
@@ -3683,7 +3755,7 @@ const $e = Symbol("co-form-depth"), nt = Symbol("co-form-expand-all"), we = Symb
3683
3755
  ])
3684
3756
  ], 544));
3685
3757
  }
3686
- }), Rs = /* @__PURE__ */ De(As, [["__scopeId", "data-v-15ca81e7"]]), Os = /* @__PURE__ */ T({
3758
+ }), Ls = /* @__PURE__ */ Me(Es, [["__scopeId", "data-v-c59f7d9a"]]), Ns = /* @__PURE__ */ R({
3687
3759
  __name: "FieldDate",
3688
3760
  props: {
3689
3761
  field: {},
@@ -3693,8 +3765,8 @@ const $e = Symbol("co-form-depth"), nt = Symbol("co-form-expand-all"), we = Symb
3693
3765
  },
3694
3766
  emits: ["update:value", "blur"],
3695
3767
  setup(i, { emit: e }) {
3696
- const t = i, s = e, r = c(() => t.errors.length > 0 ? "error" : "default"), n = c(() => t.errors[0] || t.field.helperText);
3697
- return (a, l) => (w(), R(O(Ke), {
3768
+ const t = i, s = e, r = p(() => t.errors.length > 0 ? "error" : "default"), n = p(() => t.errors[0] || t.field.helperText);
3769
+ return (a, l) => (I(), T(B(Pe), {
3698
3770
  label: i.field.label,
3699
3771
  placeholder: i.field.placeholder,
3700
3772
  required: i.field.required,
@@ -3708,30 +3780,30 @@ const $e = Symbol("co-form-depth"), nt = Symbol("co-form-expand-all"), we = Symb
3708
3780
  onBlur: l[1] || (l[1] = (u) => s("blur"))
3709
3781
  }, null, 8, ["label", "placeholder", "required", "disabled", "clearable", "status", "helper-text", "value"]));
3710
3782
  }
3711
- }), Fs = 3;
3712
- function Te(i) {
3783
+ }), xs = 3;
3784
+ function Ie(i) {
3713
3785
  return i == null || i === "" ? !0 : Array.isArray(i) ? i.length === 0 : typeof i == "object" ? Object.keys(i).length === 0 : !1;
3714
3786
  }
3715
3787
  function ot(i, e) {
3716
3788
  return i == null ? void 0 : i[e.name];
3717
3789
  }
3718
- function Es(i, e) {
3719
- return i.some((t) => !Te(ot(e, t)));
3790
+ function _s(i, e) {
3791
+ return i.some((t) => !Ie(ot(e, t)));
3720
3792
  }
3721
- function xs(i, e) {
3722
- return i.some((t) => t.required && Te(ot(e, t)));
3793
+ function Ss(i, e) {
3794
+ return i.some((t) => t.required && Ie(ot(e, t)));
3723
3795
  }
3724
- function _s({
3796
+ function Bs({
3725
3797
  children: i,
3726
3798
  objectValue: e,
3727
3799
  errors: t,
3728
3800
  originalAttrs: s
3729
3801
  }) {
3730
- return t && t.length > 0 || (s == null ? void 0 : s.expanded) === !0 ? !0 : (s == null ? void 0 : s.collapsed) === !0 ? !1 : !!(xs(i, e) || !Es(i, e));
3802
+ return t && t.length > 0 || (s == null ? void 0 : s.expanded) === !0 ? !0 : (s == null ? void 0 : s.collapsed) === !0 ? !1 : !!(Ss(i, e) || !_s(i, e));
3731
3803
  }
3732
- function Ss(i, e) {
3804
+ function Ms(i, e) {
3733
3805
  var t, s, r;
3734
- if (Te(e)) return null;
3806
+ if (Ie(e)) return null;
3735
3807
  switch (i.kind) {
3736
3808
  case "select":
3737
3809
  case "radio":
@@ -3759,17 +3831,17 @@ function Ss(i, e) {
3759
3831
  return typeof e == "object" ? null : String(e);
3760
3832
  }
3761
3833
  }
3762
- function Bs(i, e, t) {
3834
+ function ws(i, e, t) {
3763
3835
  const s = [];
3764
3836
  for (const a of i) {
3765
- const l = Ss(a, e == null ? void 0 : e[a.name]);
3837
+ const l = Ms(a, e == null ? void 0 : e[a.name]);
3766
3838
  l != null && l !== "" && s.push(l);
3767
3839
  }
3768
3840
  if (s.length === 0) return "";
3769
- const r = s.slice(0, Fs), n = s.length - r.length;
3841
+ const r = s.slice(0, xs), n = s.length - r.length;
3770
3842
  return n > 0 ? `${r.join(" · ")} +${n}` : r.join(" · ");
3771
3843
  }
3772
- const Ms = ["data-has-error"], ws = {
3844
+ const Is = ["data-has-error"], Vs = {
3773
3845
  key: 0,
3774
3846
  style: {
3775
3847
  marginTop: "var(--co-spacing-sm, 8px)",
@@ -3777,7 +3849,7 @@ const Ms = ["data-has-error"], ws = {
3777
3849
  fontSize: "var(--co-font-size-14, 14px)",
3778
3850
  fontFamily: "var(--co-font-family-primary)"
3779
3851
  }
3780
- }, Ls = /* @__PURE__ */ T({
3852
+ }, qs = /* @__PURE__ */ R({
3781
3853
  __name: "FieldObject",
3782
3854
  props: {
3783
3855
  field: {},
@@ -3789,150 +3861,189 @@ const Ms = ["data-has-error"], ws = {
3789
3861
  },
3790
3862
  emits: ["update:value"],
3791
3863
  setup(i, { emit: e }) {
3792
- const t = i, s = e, r = c(() => t.field.children ?? []), n = r.value.filter((A) => A.kind === "ref" || A.kind === "file");
3793
- n.length > 0 && console.warn(
3794
- `[FieldObject] ${n.map((A) => `"${A.path ?? A.name}" (${A.kind})`).join(", ")} nested inside an object field: ref/file resolvers do not reach nested fields yet.`
3795
- );
3796
- const a = le($e, 0);
3797
- se($e, a + 1);
3798
- const l = c(
3799
- () => a > 0 ? {
3864
+ const t = i, s = e, r = p(() => t.field.children ?? []), n = W(lt, null), a = W(ut, null), l = W(Oe, 0);
3865
+ K(Oe, l + 1);
3866
+ const u = p(
3867
+ () => l > 0 ? {
3800
3868
  paddingLeft: "var(--co-spacing-lg, 16px)",
3801
3869
  borderLeft: "1px solid var(--co-semantic-border-subtle, rgba(31, 28, 27, 0.08))"
3802
3870
  } : {}
3803
- ), u = c(
3871
+ ), o = p(
3804
3872
  () => t.value && typeof t.value == "object" && !Array.isArray(t.value) ? t.value : {}
3805
- ), o = le(we, H(2)), v = c(() => {
3806
- var D;
3807
- const A = Number((D = t.field.originalAttrs) == null ? void 0 : D.columns);
3808
- return Number.isFinite(A) && A >= 1 ? Math.floor(A) : o.value;
3873
+ ), v = W(Ee, j(2)), f = p(() => {
3874
+ var F;
3875
+ const M = Number((F = t.field.originalAttrs) == null ? void 0 : F.columns);
3876
+ return Number.isFinite(M) && M >= 1 ? Math.floor(M) : v.value;
3809
3877
  });
3810
- se(we, v);
3811
- const p = c(() => {
3812
- var D;
3813
- const A = (D = t.field.originalAttrs) == null ? void 0 : D.gap;
3814
- return A === "sm" || A === "md" || A === "lg" ? A : "lg";
3815
- }), m = c(() => it(v.value, p.value));
3816
- function E(A) {
3817
- return rt(A, v.value, st(A));
3818
- }
3819
- const b = le(at, H({})), S = le(lt, H({})), M = le(ut, () => {
3878
+ K(Ee, f);
3879
+ const m = p(() => {
3880
+ var F;
3881
+ const M = (F = t.field.originalAttrs) == null ? void 0 : F.gap;
3882
+ return M === "sm" || M === "md" || M === "lg" ? M : "lg";
3883
+ }), x = p(() => tt(f.value, m.value));
3884
+ function g(M) {
3885
+ return st(M, f.value, et(M));
3886
+ }
3887
+ const h = W(rt, j({})), k = W(nt, j({})), y = W(at, () => {
3820
3888
  });
3821
- function W(A) {
3822
- return A.path ?? A.name;
3889
+ function c(M) {
3890
+ return M.path ?? M.name;
3823
3891
  }
3824
- function re(A) {
3825
- const D = W(A);
3826
- return S.value[D] ? b.value[D] || [] : [];
3892
+ function C(M) {
3893
+ const F = c(M);
3894
+ return k.value[F] ? h.value[F] || [] : [];
3827
3895
  }
3828
- function Z(A) {
3829
- M(W(A));
3896
+ function d(M) {
3897
+ y(c(M));
3830
3898
  }
3831
- const ee = le(nt, H(!1)), z = H(
3832
- ee.value || _s({
3899
+ const A = W(it, j(!1)), D = j(
3900
+ A.value || Bs({
3833
3901
  children: r.value,
3834
- objectValue: u.value,
3902
+ objectValue: o.value,
3835
3903
  errors: t.errors,
3836
3904
  originalAttrs: t.field.originalAttrs
3837
3905
  })
3838
3906
  );
3839
3907
  J(
3840
3908
  () => t.errors,
3841
- (A) => {
3842
- A && A.length > 0 && (z.value = !0);
3909
+ (M) => {
3910
+ M && M.length > 0 && (D.value = !0);
3843
3911
  }
3844
3912
  );
3845
- const ne = c(() => `${t.field.path ?? t.field.name}.`), oe = c(
3846
- () => Object.keys(b.value).some(
3847
- (A) => {
3848
- var D;
3849
- return A.startsWith(ne.value) && S.value[A] && (((D = b.value[A]) == null ? void 0 : D.length) ?? 0) > 0;
3913
+ const z = p(() => `${t.field.path ?? t.field.name}.`), pe = p(
3914
+ () => Object.keys(h.value).some(
3915
+ (M) => {
3916
+ var F;
3917
+ return M.startsWith(z.value) && k.value[M] && (((F = h.value[M]) == null ? void 0 : F.length) ?? 0) > 0;
3850
3918
  }
3851
3919
  )
3852
3920
  );
3853
- J(oe, (A) => {
3854
- A && (z.value = !0);
3855
- }), J(ee, (A) => {
3856
- A && (z.value = !0);
3921
+ J(pe, (M) => {
3922
+ M && (D.value = !0);
3923
+ }), J(A, (M) => {
3924
+ M && (D.value = !0);
3857
3925
  });
3858
- const de = c(
3859
- () => Bs(r.value, u.value, t.locale)
3926
+ const fe = p(
3927
+ () => ws(r.value, o.value, t.locale)
3860
3928
  );
3861
- function I(A, D) {
3862
- s("update:value", { ...u.value, [A]: D });
3929
+ function me(M, F) {
3930
+ s("update:value", { ...o.value, [M]: F });
3863
3931
  }
3864
- return (A, D) => (w(), R(O(Dt), {
3932
+ return (M, F) => (I(), T(B(Vt), {
3865
3933
  class: "co-fieldset",
3866
3934
  heading: i.field.label,
3867
- subheading: z.value ? "" : de.value,
3868
- open: z.value,
3869
- style: Be(l.value),
3870
- onCoToggle: D[0] || (D[0] = (C) => z.value = C.detail)
3935
+ subheading: D.value ? "" : fe.value,
3936
+ open: D.value,
3937
+ style: be(u.value),
3938
+ onCoToggle: F[0] || (F[0] = (E) => D.value = E.detail)
3871
3939
  }, {
3872
- default: Ie(() => [
3873
- ce("div", {
3940
+ default: _e(() => [
3941
+ ie("div", {
3874
3942
  class: "co-form-grid",
3875
- style: Be(m.value)
3943
+ style: be(x.value)
3876
3944
  }, [
3877
- (w(!0), j(je, null, He(r.value, (C) => (w(), j("div", Ge({
3878
- key: C.name,
3879
- class: "co-form-field",
3880
- "data-has-error": re(C).length > 0 || void 0
3881
- }, { ref_for: !0 }, E(C)), [
3882
- me(tt, {
3883
- field: C,
3884
- value: u.value[C.name],
3885
- errors: re(C),
3886
- disabled: i.disabled || C.disabled,
3887
- locale: i.locale,
3888
- "field-components": i.fieldComponents,
3889
- "onUpdate:value": (B) => I(C.name, B),
3890
- onBlur: (B) => Z(C)
3891
- }, null, 8, ["field", "value", "errors", "disabled", "locale", "field-components", "onUpdate:value", "onBlur"])
3892
- ], 16, Ms))), 128))
3945
+ (I(!0), P(Ue, null, $e(r.value, (E) => {
3946
+ var U, q;
3947
+ return I(), P("div", ze({
3948
+ key: E.name,
3949
+ class: "co-form-field",
3950
+ "data-has-error": C(E).length > 0 || void 0
3951
+ }, { ref_for: !0 }, g(E)), [
3952
+ ae(Ze, {
3953
+ field: E,
3954
+ value: o.value[E.name],
3955
+ errors: C(E),
3956
+ disabled: i.disabled || E.disabled,
3957
+ "ref-state": (U = B(n)) == null ? void 0 : U.stateFor(c(E)),
3958
+ "file-state": (q = B(a)) == null ? void 0 : q.stateFor(c(E)),
3959
+ locale: i.locale,
3960
+ "field-components": i.fieldComponents,
3961
+ "onUpdate:value": (V) => me(E.name, V),
3962
+ onBlur: (V) => d(E),
3963
+ onSearch: (V) => {
3964
+ var w;
3965
+ return (w = B(n)) == null ? void 0 : w.handlersFor(c(E)).search(V);
3966
+ },
3967
+ onLoadMore: (V) => {
3968
+ var w;
3969
+ return (w = B(n)) == null ? void 0 : w.handlersFor(c(E)).loadMore();
3970
+ },
3971
+ onOpen: (V) => {
3972
+ var w;
3973
+ return (w = B(n)) == null ? void 0 : w.handlersFor(c(E)).open();
3974
+ },
3975
+ onUpload: (V) => {
3976
+ var w;
3977
+ return (w = B(a)) == null ? void 0 : w.handlersFor(c(E)).upload(V);
3978
+ },
3979
+ onRemoveFile: (V) => {
3980
+ var w;
3981
+ return (w = B(a)) == null ? void 0 : w.handlersFor(c(E)).removeFile(V);
3982
+ },
3983
+ onReorder: (V) => {
3984
+ var w;
3985
+ return (w = B(a)) == null ? void 0 : w.handlersFor(c(E)).reorder(V);
3986
+ },
3987
+ onAddFiles: (V) => {
3988
+ var w;
3989
+ return (w = B(a)) == null ? void 0 : w.handlersFor(c(E)).addFiles(V);
3990
+ },
3991
+ onCopyUrl: (V) => {
3992
+ var w;
3993
+ return (w = B(a)) == null ? void 0 : w.handlersFor(c(E)).copyUrl(V);
3994
+ }
3995
+ }, null, 8, ["field", "value", "errors", "disabled", "ref-state", "file-state", "locale", "field-components", "onUpdate:value", "onBlur", "onSearch", "onLoadMore", "onOpen", "onUpload", "onRemoveFile", "onReorder", "onAddFiles", "onCopyUrl"])
3996
+ ], 16, Is);
3997
+ }), 128))
3893
3998
  ], 4),
3894
- i.errors.length ? (w(), j("div", ws, _e(i.errors[0]), 1)) : ue("", !0)
3999
+ i.errors.length ? (I(), P("div", Vs, Fe(i.errors[0]), 1)) : te("", !0)
3895
4000
  ]),
3896
4001
  _: 1
3897
4002
  }, 8, ["heading", "subheading", "open", "style"]));
3898
4003
  }
3899
4004
  });
3900
4005
  export {
3901
- tt as CoFieldRenderer,
3902
- Rs as CoFormRenderer,
3903
- X as DEFAULT_MASK_CONFIG,
3904
- we as FORM_COLUMNS,
3905
- $e as FORM_DEPTH,
3906
- at as FORM_ERRORS,
3907
- nt as FORM_EXPAND_ALL,
3908
- ut as FORM_TOUCH,
3909
- lt as FORM_TOUCHED,
3910
- ks as FULL_WIDTH_UICOMS,
3911
- Tt as FieldBoolean,
4006
+ Ze as CoFieldRenderer,
4007
+ Ls as CoFormRenderer,
4008
+ Z as DEFAULT_MASK_CONFIG,
4009
+ Ee as FORM_COLUMNS,
4010
+ Oe as FORM_DEPTH,
4011
+ rt as FORM_ERRORS,
4012
+ it as FORM_EXPAND_ALL,
4013
+ ut as FORM_FILE_FIELDS,
4014
+ lt as FORM_REF_FIELDS,
4015
+ at as FORM_TOUCH,
4016
+ nt as FORM_TOUCHED,
4017
+ Cs as FULL_WIDTH_UICOMS,
4018
+ Dt as FieldBoolean,
3912
4019
  Rt as FieldColor,
3913
- Os as FieldDate,
3914
- Ot as FieldDatePicker,
3915
- Nt as FieldFile,
3916
- os as FieldMasked,
3917
- ds as FieldMixed,
3918
- hs as FieldMultiple,
3919
- Ee as FieldNumber,
3920
- Ls as FieldObject,
3921
- cs as FieldPhone,
3922
- ps as FieldRef,
3923
- xe as FieldSelect,
3924
- ms as FieldText,
3925
- gs as FieldTextArea,
3926
- rt as cellBindings,
3927
- Cs as cellSpan,
3928
- _s as computeInitialOpen,
3929
- $s as createForm,
3930
- Bs as formatSectionPreview,
3931
- it as gridRootStyle,
3932
- Es as hasAnyValue,
3933
- xs as hasEmptyRequiredChild,
3934
- Te as isEmptyValue,
3935
- st as isFullWidthField,
3936
- es as normalizeMaskConfig,
3937
- Ts as useForm
4020
+ Ns as FieldDate,
4021
+ Tt as FieldDatePicker,
4022
+ Lt as FieldFile,
4023
+ us as FieldMasked,
4024
+ os as FieldMixed,
4025
+ ds as FieldMultiple,
4026
+ ye as FieldNumber,
4027
+ qs as FieldObject,
4028
+ hs as FieldPhone,
4029
+ cs as FieldRef,
4030
+ Ce as FieldSelect,
4031
+ fs as FieldText,
4032
+ ms as FieldTextArea,
4033
+ st as cellBindings,
4034
+ Fs as cellSpan,
4035
+ Bs as computeInitialOpen,
4036
+ zs as createForm,
4037
+ O as fieldKey,
4038
+ ws as formatSectionPreview,
4039
+ Xe as getValueAtPath,
4040
+ tt as gridRootStyle,
4041
+ _s as hasAnyValue,
4042
+ Ss as hasEmptyRequiredChild,
4043
+ Ie as isEmptyValue,
4044
+ et as isFullWidthField,
4045
+ Qt as normalizeMaskConfig,
4046
+ vs as setValueAtPath,
4047
+ Os as useForm,
4048
+ we as walkFields
3938
4049
  };