@phila/phila-ui-search 1.1.1 → 1.1.2

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.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { defineComponent as O, useAttrs as I, computed as o, toRef as P, ref as L, createElementBlock as p, openBlock as s, normalizeClass as w, createCommentVNode as y, createElementVNode as x, toDisplayString as m, createBlock as z, renderSlot as k, unref as l, withDirectives as q, mergeProps as b, vModelDynamic as E, createVNode as v, createTextVNode as N, withCtx as h, normalizeProps as C, guardReactiveProps as _, withKeys as K } from "vue";
2
- import { cn as V, Icon as R, BaseLink as M, ActionContent as B } from "@phila/phila-ui-core";
3
- import './index.css';var U = {
1
+ import { defineComponent as K, toRef as z, watch as w, h as De, useAttrs as Ee, computed as F, ref as D, createElementBlock as I, openBlock as A, normalizeClass as ve, createCommentVNode as N, createElementVNode as Y, toDisplayString as R, withModifiers as Ie, createBlock as U, renderSlot as j, unref as _, withDirectives as we, mergeProps as O, vModelDynamic as Te, createVNode as L, createTextVNode as q, isRef as Me, readonly as Re, onMounted as Pe, onUnmounted as Oe, withCtx as P, normalizeProps as W, guardReactiveProps as J, withKeys as Le } from "vue";
2
+ import { cn as H, Icon as le, BaseLink as Fe, ActionContent as Q } from "@phila/phila-ui-core";
3
+ import './index.css';var Ne = {
4
4
  prefix: "fas",
5
5
  iconName: "magnifying-glass",
6
6
  icon: [512, 512, [128269, "search"], "f002", "M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376C296.3 401.1 253.9 416 208 416 93.1 416 0 322.9 0 208S93.1 0 208 0 416 93.1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z"]
7
- }, G = U;
8
- const j = ["disabled"], F = /* @__PURE__ */ O({
7
+ }, Ue = Ne;
8
+ const ze = ["disabled"], je = /* @__PURE__ */ K({
9
9
  inheritAttrs: !1,
10
10
  __name: "PhlButton",
11
11
  props: {
@@ -26,25 +26,25 @@ const j = ["disabled"], F = /* @__PURE__ */ O({
26
26
  src: {},
27
27
  svgRaw: {}
28
28
  },
29
- setup(u) {
30
- const e = u, r = (a) => "href" in a && a.href !== void 0 || "to" in a && a.to !== void 0, t = o(() => V(
29
+ setup(r) {
30
+ const e = r, t = (u) => "href" in u && u.href !== void 0 || "to" in u && u.to !== void 0, s = F(() => H(
31
31
  "phila-button",
32
32
  `phila-button--${e.variant}`,
33
33
  e.size && `is-${e.size}`,
34
34
  e.iconOnly && "icon-button",
35
35
  e.iconOnly && e.variant === "standard" && "icon-button--standard",
36
36
  e.className
37
- )), c = o(() => r(e) ? "to" in e && e.to !== void 0 ? {
37
+ )), i = F(() => t(e) ? "to" in e && e.to !== void 0 ? {
38
38
  to: e.to,
39
39
  disabled: e.disabled,
40
- className: t.value
40
+ className: s.value
41
41
  } : {
42
42
  href: e.href,
43
43
  target: e.target,
44
44
  rel: e.rel,
45
45
  disabled: e.disabled,
46
- className: t.value
47
- } : {}), d = o(
46
+ className: s.value
47
+ } : {}), a = F(
48
48
  () => ({
49
49
  iconDefinition: e.iconDefinition,
50
50
  iconClass: e.iconClass,
@@ -55,51 +55,2579 @@ const j = ["disabled"], F = /* @__PURE__ */ O({
55
55
  size: e.size
56
56
  })
57
57
  );
58
- return (a, f) => r(e) ? (s(), z(l(M), b({ key: 0 }, { ...c.value, ...a.$attrs }, { role: "button" }), {
59
- default: h(() => [
60
- v(l(B), C(_(d.value)), {
61
- default: h(() => [
62
- k(a.$slots, "default", {}, () => [
63
- N(m(e.text), 1)
58
+ return (u, n) => t(e) ? (A(), U(_(Fe), O({ key: 0 }, { ...i.value, ...u.$attrs }, { role: "button" }), {
59
+ default: P(() => [
60
+ L(_(Q), W(J(a.value)), {
61
+ default: P(() => [
62
+ j(u.$slots, "default", {}, () => [
63
+ q(R(e.text), 1)
64
64
  ])
65
65
  ]),
66
66
  _: 3
67
67
  }, 16)
68
68
  ]),
69
69
  _: 3
70
- }, 16)) : (s(), p("button", b({
70
+ }, 16)) : (A(), I("button", O({
71
71
  key: 1,
72
72
  type: "button",
73
73
  disabled: e.disabled,
74
- class: t.value
75
- }, a.$attrs), [
76
- v(l(B), C(_(d.value)), {
77
- default: h(() => [
78
- k(a.$slots, "default", {}, () => [
79
- N(m(e.text), 1)
74
+ class: s.value
75
+ }, u.$attrs), [
76
+ L(_(Q), W(J(a.value)), {
77
+ default: P(() => [
78
+ j(u.$slots, "default", {}, () => [
79
+ q(R(e.text), 1)
80
80
  ])
81
81
  ]),
82
82
  _: 3
83
83
  }, 16)
84
- ], 16, j));
84
+ ], 16, ze));
85
85
  }
86
86
  });
87
- var H = {
87
+ var qe = {
88
88
  prefix: "fas",
89
89
  iconName: "circle-exclamation",
90
90
  icon: [512, 512, ["exclamation-circle"], "f06a", "M256 512a256 256 0 1 1 0-512 256 256 0 1 1 0 512zm0-192a32 32 0 1 0 0 64 32 32 0 1 0 0-64zm0-192c-18.2 0-32.7 15.5-31.4 33.7l7.4 104c.9 12.6 11.4 22.3 23.9 22.3 12.6 0 23-9.7 23.9-22.3l7.4-104c1.3-18.2-13.1-33.7-31.4-33.7z"]
91
- }, J = H, Q = {
91
+ }, He = qe, Ge = {
92
92
  prefix: "fas",
93
93
  iconName: "xmark",
94
94
  icon: [384, 512, [128473, 10005, 10006, 10060, 215, "close", "multiply", "remove", "times"], "f00d", "M55.1 73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L147.2 256 9.9 393.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192.5 301.3 329.9 438.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.8 256 375.1 118.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192.5 210.7 55.1 73.4z"]
95
- }, W = Q;
96
- const X = ["for"], Y = { class: "state-layer" }, Z = { class: "content" }, ee = { class: "input-text-container" }, te = ["id", "placeholder"], ae = {
95
+ }, Ke = Ge;
96
+ function T(r) {
97
+ return typeof r == "string" || r instanceof String;
98
+ }
99
+ function _e(r) {
100
+ var e;
101
+ return typeof r == "object" && r != null && (r == null || (e = r.constructor) == null ? void 0 : e.name) === "Object";
102
+ }
103
+ function Ae(r, e) {
104
+ return Array.isArray(e) ? Ae(r, (t, s) => e.includes(s)) : Object.entries(r).reduce((t, s) => {
105
+ let [i, a] = s;
106
+ return e(a, i) && (t[i] = a), t;
107
+ }, {});
108
+ }
109
+ const d = {
110
+ NONE: "NONE",
111
+ LEFT: "LEFT",
112
+ FORCE_LEFT: "FORCE_LEFT",
113
+ RIGHT: "RIGHT",
114
+ FORCE_RIGHT: "FORCE_RIGHT"
115
+ };
116
+ function $e(r) {
117
+ switch (r) {
118
+ case d.LEFT:
119
+ return d.FORCE_LEFT;
120
+ case d.RIGHT:
121
+ return d.FORCE_RIGHT;
122
+ default:
123
+ return r;
124
+ }
125
+ }
126
+ function oe(r) {
127
+ return r.replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1");
128
+ }
129
+ function ee(r, e) {
130
+ if (e === r) return !0;
131
+ const t = Array.isArray(e), s = Array.isArray(r);
132
+ let i;
133
+ if (t && s) {
134
+ if (e.length != r.length) return !1;
135
+ for (i = 0; i < e.length; i++) if (!ee(e[i], r[i])) return !1;
136
+ return !0;
137
+ }
138
+ if (t != s) return !1;
139
+ if (e && r && typeof e == "object" && typeof r == "object") {
140
+ const a = e instanceof Date, u = r instanceof Date;
141
+ if (a && u) return e.getTime() == r.getTime();
142
+ if (a != u) return !1;
143
+ const n = e instanceof RegExp, l = r instanceof RegExp;
144
+ if (n && l) return e.toString() == r.toString();
145
+ if (n != l) return !1;
146
+ const o = Object.keys(e);
147
+ for (i = 0; i < o.length; i++) if (!Object.prototype.hasOwnProperty.call(r, o[i])) return !1;
148
+ for (i = 0; i < o.length; i++) if (!ee(r[o[i]], e[o[i]])) return !1;
149
+ return !0;
150
+ } else if (e && r && typeof e == "function" && typeof r == "function")
151
+ return e.toString() === r.toString();
152
+ return !1;
153
+ }
154
+ class Ye {
155
+ /** Current input value */
156
+ /** Current cursor position */
157
+ /** Old input value */
158
+ /** Old selection */
159
+ constructor(e) {
160
+ for (Object.assign(this, e); this.value.slice(0, this.startChangePos) !== this.oldValue.slice(0, this.startChangePos); )
161
+ --this.oldSelection.start;
162
+ if (this.insertedCount)
163
+ for (; this.value.slice(this.cursorPos) !== this.oldValue.slice(this.oldSelection.end); )
164
+ this.value.length - this.cursorPos < this.oldValue.length - this.oldSelection.end ? ++this.oldSelection.end : ++this.cursorPos;
165
+ }
166
+ /** Start changing position */
167
+ get startChangePos() {
168
+ return Math.min(this.cursorPos, this.oldSelection.start);
169
+ }
170
+ /** Inserted symbols count */
171
+ get insertedCount() {
172
+ return this.cursorPos - this.startChangePos;
173
+ }
174
+ /** Inserted symbols */
175
+ get inserted() {
176
+ return this.value.substr(this.startChangePos, this.insertedCount);
177
+ }
178
+ /** Removed symbols count */
179
+ get removedCount() {
180
+ return Math.max(this.oldSelection.end - this.startChangePos || // for Delete
181
+ this.oldValue.length - this.value.length, 0);
182
+ }
183
+ /** Removed symbols */
184
+ get removed() {
185
+ return this.oldValue.substr(this.startChangePos, this.removedCount);
186
+ }
187
+ /** Unchanged head symbols */
188
+ get head() {
189
+ return this.value.substring(0, this.startChangePos);
190
+ }
191
+ /** Unchanged tail symbols */
192
+ get tail() {
193
+ return this.value.substring(this.startChangePos + this.insertedCount);
194
+ }
195
+ /** Remove direction */
196
+ get removeDirection() {
197
+ return !this.removedCount || this.insertedCount ? d.NONE : (this.oldSelection.end === this.cursorPos || this.oldSelection.start === this.cursorPos) && // if not range removed (event with backspace)
198
+ this.oldSelection.end === this.oldSelection.start ? d.RIGHT : d.LEFT;
199
+ }
200
+ }
201
+ function p(r, e) {
202
+ return new p.InputMask(r, e);
203
+ }
204
+ function xe(r) {
205
+ if (r == null) throw new Error("mask property should be defined");
206
+ return r instanceof RegExp ? p.MaskedRegExp : T(r) ? p.MaskedPattern : r === Date ? p.MaskedDate : r === Number ? p.MaskedNumber : Array.isArray(r) || r === Array ? p.MaskedDynamic : p.Masked && r.prototype instanceof p.Masked ? r : p.Masked && r instanceof p.Masked ? r.constructor : r instanceof Function ? p.MaskedFunction : p.Masked;
207
+ }
208
+ function G(r) {
209
+ if (!r) throw new Error("Options in not defined");
210
+ if (p.Masked) {
211
+ if (r.prototype instanceof p.Masked) return {
212
+ mask: r
213
+ };
214
+ const {
215
+ mask: e = void 0,
216
+ ...t
217
+ } = r instanceof p.Masked ? {
218
+ mask: r
219
+ } : _e(r) && r.mask instanceof p.Masked ? r : {};
220
+ if (e) {
221
+ const s = e.mask;
222
+ return {
223
+ ...Ae(e, (i, a) => !a.startsWith("_")),
224
+ mask: e.constructor,
225
+ _mask: s,
226
+ ...t
227
+ };
228
+ }
229
+ }
230
+ return _e(r) ? {
231
+ ...r
232
+ } : {
233
+ mask: r
234
+ };
235
+ }
236
+ function B(r) {
237
+ if (p.Masked && r instanceof p.Masked) return r;
238
+ const e = G(r), t = xe(e.mask);
239
+ 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.");
240
+ return e.mask === t && delete e.mask, e._mask && (e.mask = e._mask, delete e._mask), new t(e);
241
+ }
242
+ p.createMask = B;
243
+ class de {
244
+ /** */
245
+ /** */
246
+ /** */
247
+ /** Safely returns selection start */
248
+ get selectionStart() {
249
+ let e;
250
+ try {
251
+ e = this._unsafeSelectionStart;
252
+ } catch {
253
+ }
254
+ return e ?? this.value.length;
255
+ }
256
+ /** Safely returns selection end */
257
+ get selectionEnd() {
258
+ let e;
259
+ try {
260
+ e = this._unsafeSelectionEnd;
261
+ } catch {
262
+ }
263
+ return e ?? this.value.length;
264
+ }
265
+ /** Safely sets element selection */
266
+ select(e, t) {
267
+ if (!(e == null || t == null || e === this.selectionStart && t === this.selectionEnd))
268
+ try {
269
+ this._unsafeSelect(e, t);
270
+ } catch {
271
+ }
272
+ }
273
+ /** */
274
+ get isActive() {
275
+ return !1;
276
+ }
277
+ /** */
278
+ /** */
279
+ /** */
280
+ }
281
+ p.MaskElement = de;
282
+ const Ce = 90, Xe = 89;
283
+ class se extends de {
284
+ /** HTMLElement to use mask on */
285
+ constructor(e) {
286
+ 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);
287
+ }
288
+ get rootElement() {
289
+ var e, t, s;
290
+ return (e = (t = (s = this.input).getRootNode) == null ? void 0 : t.call(s)) != null ? e : document;
291
+ }
292
+ /** Is element in focus */
293
+ get isActive() {
294
+ return this.input === this.rootElement.activeElement;
295
+ }
296
+ /** Binds HTMLElement events to mask internal events */
297
+ bindEvents(e) {
298
+ 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;
299
+ }
300
+ _onKeydown(e) {
301
+ if (this._handlers.redo && (e.keyCode === Ce && e.shiftKey && (e.metaKey || e.ctrlKey) || e.keyCode === Xe && e.ctrlKey))
302
+ return e.preventDefault(), this._handlers.redo(e);
303
+ if (this._handlers.undo && e.keyCode === Ce && (e.metaKey || e.ctrlKey))
304
+ return e.preventDefault(), this._handlers.undo(e);
305
+ e.isComposing || this._handlers.selectionChange(e);
306
+ }
307
+ _onBeforeinput(e) {
308
+ if (e.inputType === "historyUndo" && this._handlers.undo)
309
+ return e.preventDefault(), this._handlers.undo(e);
310
+ if (e.inputType === "historyRedo" && this._handlers.redo)
311
+ return e.preventDefault(), this._handlers.redo(e);
312
+ }
313
+ _onCompositionEnd(e) {
314
+ this._handlers.input(e);
315
+ }
316
+ _onInput(e) {
317
+ e.isComposing || this._handlers.input(e);
318
+ }
319
+ /** Unbinds HTMLElement events to mask internal events */
320
+ unbindEvents() {
321
+ 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 = {};
322
+ }
323
+ }
324
+ p.HTMLMaskElement = se;
325
+ class Ze extends se {
326
+ /** InputElement to use mask on */
327
+ constructor(e) {
328
+ super(e), this.input = e;
329
+ }
330
+ /** Returns InputElement selection start */
331
+ get _unsafeSelectionStart() {
332
+ return this.input.selectionStart != null ? this.input.selectionStart : this.value.length;
333
+ }
334
+ /** Returns InputElement selection end */
335
+ get _unsafeSelectionEnd() {
336
+ return this.input.selectionEnd;
337
+ }
338
+ /** Sets InputElement selection */
339
+ _unsafeSelect(e, t) {
340
+ this.input.setSelectionRange(e, t);
341
+ }
342
+ get value() {
343
+ return this.input.value;
344
+ }
345
+ set value(e) {
346
+ this.input.value = e;
347
+ }
348
+ }
349
+ p.HTMLMaskElement = se;
350
+ class be extends se {
351
+ /** Returns HTMLElement selection start */
352
+ get _unsafeSelectionStart() {
353
+ const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
354
+ return i == null || s == null || s < i ? s : i;
355
+ }
356
+ /** Returns HTMLElement selection end */
357
+ get _unsafeSelectionEnd() {
358
+ const e = this.rootElement, t = e.getSelection && e.getSelection(), s = t && t.anchorOffset, i = t && t.focusOffset;
359
+ return i == null || s == null || s > i ? s : i;
360
+ }
361
+ /** Sets HTMLElement selection */
362
+ _unsafeSelect(e, t) {
363
+ if (!this.rootElement.createRange) return;
364
+ const s = this.rootElement.createRange();
365
+ s.setStart(this.input.firstChild || this.input, e), s.setEnd(this.input.lastChild || this.input, t);
366
+ const i = this.rootElement, a = i.getSelection && i.getSelection();
367
+ a && (a.removeAllRanges(), a.addRange(s));
368
+ }
369
+ /** HTMLElement value */
370
+ get value() {
371
+ return this.input.textContent || "";
372
+ }
373
+ set value(e) {
374
+ this.input.textContent = e;
375
+ }
376
+ }
377
+ p.HTMLContenteditableMaskElement = be;
378
+ class ie {
379
+ constructor() {
380
+ this.states = [], this.currentIndex = 0;
381
+ }
382
+ get currentState() {
383
+ return this.states[this.currentIndex];
384
+ }
385
+ get isEmpty() {
386
+ return this.states.length === 0;
387
+ }
388
+ push(e) {
389
+ this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(e), this.states.length > ie.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
390
+ }
391
+ go(e) {
392
+ return this.currentIndex = Math.min(Math.max(this.currentIndex + e, 0), this.states.length - 1), this.currentState;
393
+ }
394
+ undo() {
395
+ return this.go(-1);
396
+ }
397
+ redo() {
398
+ return this.go(1);
399
+ }
400
+ clear() {
401
+ this.states.length = 0, this.currentIndex = 0;
402
+ }
403
+ }
404
+ ie.MAX_LENGTH = 100;
405
+ class We {
406
+ /**
407
+ View element
408
+ */
409
+ /** Internal {@link Masked} model */
410
+ constructor(e, t) {
411
+ this.el = e instanceof de ? e : e.isContentEditable && e.tagName !== "INPUT" && e.tagName !== "TEXTAREA" ? new be(e) : new Ze(e), this.masked = B(t), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new ie(), 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();
412
+ }
413
+ maskEquals(e) {
414
+ var t;
415
+ return e == null || ((t = this.masked) == null ? void 0 : t.maskEquals(e));
416
+ }
417
+ /** Masked */
418
+ get mask() {
419
+ return this.masked.mask;
420
+ }
421
+ set mask(e) {
422
+ if (this.maskEquals(e)) return;
423
+ if (!(e instanceof p.Masked) && this.masked.constructor === xe(e)) {
424
+ this.masked.updateOptions({
425
+ mask: e
426
+ });
427
+ return;
428
+ }
429
+ const t = e instanceof p.Masked ? e : B({
430
+ mask: e
431
+ });
432
+ t.unmaskedValue = this.masked.unmaskedValue, this.masked = t;
433
+ }
434
+ /** Raw value */
435
+ get value() {
436
+ return this._value;
437
+ }
438
+ set value(e) {
439
+ this.value !== e && (this.masked.value = e, this.updateControl("auto"));
440
+ }
441
+ /** Unmasked value */
442
+ get unmaskedValue() {
443
+ return this._unmaskedValue;
444
+ }
445
+ set unmaskedValue(e) {
446
+ this.unmaskedValue !== e && (this.masked.unmaskedValue = e, this.updateControl("auto"));
447
+ }
448
+ /** Raw input value */
449
+ get rawInputValue() {
450
+ return this._rawInputValue;
451
+ }
452
+ set rawInputValue(e) {
453
+ this.rawInputValue !== e && (this.masked.rawInputValue = e, this.updateControl(), this.alignCursor());
454
+ }
455
+ /** Typed unmasked value */
456
+ get typedValue() {
457
+ return this.masked.typedValue;
458
+ }
459
+ set typedValue(e) {
460
+ this.masked.typedValueEquals(e) || (this.masked.typedValue = e, this.updateControl("auto"));
461
+ }
462
+ /** Display value */
463
+ get displayValue() {
464
+ return this.masked.displayValue;
465
+ }
466
+ /** Starts listening to element events */
467
+ _bindEvents() {
468
+ this.el.bindEvents({
469
+ selectionChange: this._saveSelection,
470
+ input: this._onInput,
471
+ drop: this._onDrop,
472
+ click: this._onClick,
473
+ focus: this._onFocus,
474
+ commit: this._onChange,
475
+ undo: this._onUndo,
476
+ redo: this._onRedo
477
+ });
478
+ }
479
+ /** Stops listening to element events */
480
+ _unbindEvents() {
481
+ this.el && this.el.unbindEvents();
482
+ }
483
+ /** Fires custom event */
484
+ _fireEvent(e, t) {
485
+ const s = this._listeners[e];
486
+ s && s.forEach((i) => i(t));
487
+ }
488
+ /** Current selection start */
489
+ get selectionStart() {
490
+ return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;
491
+ }
492
+ /** Current cursor position */
493
+ get cursorPos() {
494
+ return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
495
+ }
496
+ set cursorPos(e) {
497
+ !this.el || !this.el.isActive || (this.el.select(e, e), this._saveSelection());
498
+ }
499
+ /** Stores current selection */
500
+ _saveSelection() {
501
+ this.displayValue, this.el.value, this._selection = {
502
+ start: this.selectionStart,
503
+ end: this.cursorPos
504
+ };
505
+ }
506
+ /** Syncronizes model value from view */
507
+ updateValue() {
508
+ this.masked.value = this.el.value, this._value = this.masked.value, this._unmaskedValue = this.masked.unmaskedValue, this._rawInputValue = this.masked.rawInputValue;
509
+ }
510
+ /** Syncronizes view from model value, fires change events */
511
+ updateControl(e) {
512
+ const t = this.masked.unmaskedValue, s = this.masked.value, i = this.masked.rawInputValue, a = this.displayValue, u = this.unmaskedValue !== t || this.value !== s || this._rawInputValue !== i;
513
+ this._unmaskedValue = t, this._value = s, this._rawInputValue = i, this.el.value !== a && (this.el.value = a), e === "auto" ? this.alignCursor() : e != null && (this.cursorPos = e), u && this._fireChangeEvents(), !this._historyChanging && (u || this.history.isEmpty) && this.history.push({
514
+ unmaskedValue: t,
515
+ selection: {
516
+ start: this.selectionStart,
517
+ end: this.cursorPos
518
+ }
519
+ });
520
+ }
521
+ /** Updates options with deep equal check, recreates {@link Masked} model if mask type changes */
522
+ updateOptions(e) {
523
+ const {
524
+ mask: t,
525
+ ...s
526
+ } = e, i = !this.maskEquals(t), a = this.masked.optionsIsChanged(s);
527
+ i && (this.mask = t), a && this.masked.updateOptions(s), (i || a) && this.updateControl();
528
+ }
529
+ /** Updates cursor */
530
+ updateCursor(e) {
531
+ e != null && (this.cursorPos = e, this._delayUpdateCursor(e));
532
+ }
533
+ /** Delays cursor update to support mobile browsers */
534
+ _delayUpdateCursor(e) {
535
+ this._abortUpdateCursor(), this._changingCursorPos = e, this._cursorChanging = setTimeout(() => {
536
+ this.el && (this.cursorPos = this._changingCursorPos, this._abortUpdateCursor());
537
+ }, 10);
538
+ }
539
+ /** Fires custom events */
540
+ _fireChangeEvents() {
541
+ this._fireEvent("accept", this._inputEvent), this.masked.isComplete && this._fireEvent("complete", this._inputEvent);
542
+ }
543
+ /** Aborts delayed cursor update */
544
+ _abortUpdateCursor() {
545
+ this._cursorChanging && (clearTimeout(this._cursorChanging), delete this._cursorChanging);
546
+ }
547
+ /** Aligns cursor to nearest available position */
548
+ alignCursor() {
549
+ this.cursorPos = this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos, d.LEFT));
550
+ }
551
+ /** Aligns cursor only if selection is empty */
552
+ alignCursorFriendly() {
553
+ this.selectionStart === this.cursorPos && this.alignCursor();
554
+ }
555
+ /** Adds listener on custom event */
556
+ on(e, t) {
557
+ return this._listeners[e] || (this._listeners[e] = []), this._listeners[e].push(t), this;
558
+ }
559
+ /** Removes custom event listener */
560
+ off(e, t) {
561
+ if (!this._listeners[e]) return this;
562
+ if (!t)
563
+ return delete this._listeners[e], this;
564
+ const s = this._listeners[e].indexOf(t);
565
+ return s >= 0 && this._listeners[e].splice(s, 1), this;
566
+ }
567
+ /** Handles view input event */
568
+ _onInput(e) {
569
+ this._inputEvent = e, this._abortUpdateCursor();
570
+ const t = new Ye({
571
+ // new state
572
+ value: this.el.value,
573
+ cursorPos: this.cursorPos,
574
+ // old state
575
+ oldValue: this.displayValue,
576
+ oldSelection: this._selection
577
+ }), s = this.masked.rawInputValue, i = this.masked.splice(t.startChangePos, t.removed.length, t.inserted, t.removeDirection, {
578
+ input: !0,
579
+ raw: !0
580
+ }).offset, a = s === this.masked.rawInputValue ? t.removeDirection : d.NONE;
581
+ let u = this.masked.nearestInputPos(t.startChangePos + i, a);
582
+ a !== d.NONE && (u = this.masked.nearestInputPos(u, d.NONE)), this.updateControl(u), delete this._inputEvent;
583
+ }
584
+ /** Handles view change event and commits model value */
585
+ _onChange() {
586
+ this.displayValue !== this.el.value && this.updateValue(), this.masked.doCommit(), this.updateControl(), this._saveSelection();
587
+ }
588
+ /** Handles view drop event, prevents by default */
589
+ _onDrop(e) {
590
+ e.preventDefault(), e.stopPropagation();
591
+ }
592
+ /** Restore last selection on focus */
593
+ _onFocus(e) {
594
+ this.alignCursorFriendly();
595
+ }
596
+ /** Restore last selection on focus */
597
+ _onClick(e) {
598
+ this.alignCursorFriendly();
599
+ }
600
+ _onUndo() {
601
+ this._applyHistoryState(this.history.undo());
602
+ }
603
+ _onRedo() {
604
+ this._applyHistoryState(this.history.redo());
605
+ }
606
+ _applyHistoryState(e) {
607
+ e && (this._historyChanging = !0, this.unmaskedValue = e.unmaskedValue, this.el.select(e.selection.start, e.selection.end), this._saveSelection(), this._historyChanging = !1);
608
+ }
609
+ /** Unbind view events and removes element reference */
610
+ destroy() {
611
+ this._unbindEvents(), this._listeners.length = 0, delete this.el;
612
+ }
613
+ }
614
+ p.InputMask = We;
615
+ class c {
616
+ /** Inserted symbols */
617
+ /** Additional offset if any changes occurred before tail */
618
+ /** Raw inserted is used by dynamic mask */
619
+ /** Can skip chars */
620
+ static normalize(e) {
621
+ return Array.isArray(e) ? e : [e, new c()];
622
+ }
623
+ constructor(e) {
624
+ Object.assign(this, {
625
+ inserted: "",
626
+ rawInserted: "",
627
+ tailShift: 0,
628
+ skip: !1
629
+ }, e);
630
+ }
631
+ /** Aggregate changes */
632
+ aggregate(e) {
633
+ return this.inserted += e.inserted, this.rawInserted += e.rawInserted, this.tailShift += e.tailShift, this.skip = this.skip || e.skip, this;
634
+ }
635
+ /** Total offset considering all changes */
636
+ get offset() {
637
+ return this.tailShift + this.inserted.length;
638
+ }
639
+ get consumed() {
640
+ return !!this.rawInserted || this.skip;
641
+ }
642
+ equals(e) {
643
+ return this.inserted === e.inserted && this.tailShift === e.tailShift && this.rawInserted === e.rawInserted && this.skip === e.skip;
644
+ }
645
+ }
646
+ p.ChangeDetails = c;
647
+ class S {
648
+ /** Tail value as string */
649
+ /** Tail start position */
650
+ /** Start position */
651
+ constructor(e, t, s) {
652
+ e === void 0 && (e = ""), t === void 0 && (t = 0), this.value = e, this.from = t, this.stop = s;
653
+ }
654
+ toString() {
655
+ return this.value;
656
+ }
657
+ extend(e) {
658
+ this.value += String(e);
659
+ }
660
+ appendTo(e) {
661
+ return e.append(this.toString(), {
662
+ tail: !0
663
+ }).aggregate(e._appendPlaceholder());
664
+ }
665
+ get state() {
666
+ return {
667
+ value: this.value,
668
+ from: this.from,
669
+ stop: this.stop
670
+ };
671
+ }
672
+ set state(e) {
673
+ Object.assign(this, e);
674
+ }
675
+ unshift(e) {
676
+ if (!this.value.length || e != null && this.from >= e) return "";
677
+ const t = this.value[0];
678
+ return this.value = this.value.slice(1), t;
679
+ }
680
+ shift() {
681
+ if (!this.value.length) return "";
682
+ const e = this.value[this.value.length - 1];
683
+ return this.value = this.value.slice(0, -1), e;
684
+ }
685
+ }
686
+ let y = class X {
687
+ /** */
688
+ /** */
689
+ /** Transforms value before mask processing */
690
+ /** Transforms each char before mask processing */
691
+ /** Validates if value is acceptable */
692
+ /** Does additional processing at the end of editing */
693
+ /** Format typed value to string */
694
+ /** Parse string to get typed value */
695
+ /** Enable characters overwriting */
696
+ /** */
697
+ /** */
698
+ /** */
699
+ /** */
700
+ constructor(e) {
701
+ this._value = "", this._update({
702
+ ...X.DEFAULTS,
703
+ ...e
704
+ }), this._initialized = !0;
705
+ }
706
+ /** Sets and applies new options */
707
+ updateOptions(e) {
708
+ this.optionsIsChanged(e) && this.withValueRefresh(this._update.bind(this, e));
709
+ }
710
+ /** Sets new options */
711
+ _update(e) {
712
+ Object.assign(this, e);
713
+ }
714
+ /** Mask state */
715
+ get state() {
716
+ return {
717
+ _value: this.value,
718
+ _rawInputValue: this.rawInputValue
719
+ };
720
+ }
721
+ set state(e) {
722
+ this._value = e._value;
723
+ }
724
+ /** Resets value */
725
+ reset() {
726
+ this._value = "";
727
+ }
728
+ get value() {
729
+ return this._value;
730
+ }
731
+ set value(e) {
732
+ this.resolve(e, {
733
+ input: !0
734
+ });
735
+ }
736
+ /** Resolve new value */
737
+ resolve(e, t) {
738
+ t === void 0 && (t = {
739
+ input: !0
740
+ }), this.reset(), this.append(e, t, ""), this.doCommit();
741
+ }
742
+ get unmaskedValue() {
743
+ return this.value;
744
+ }
745
+ set unmaskedValue(e) {
746
+ this.resolve(e, {});
747
+ }
748
+ get typedValue() {
749
+ return this.parse ? this.parse(this.value, this) : this.unmaskedValue;
750
+ }
751
+ set typedValue(e) {
752
+ this.format ? this.value = this.format(e, this) : this.unmaskedValue = String(e);
753
+ }
754
+ /** Value that includes raw user input */
755
+ get rawInputValue() {
756
+ return this.extractInput(0, this.displayValue.length, {
757
+ raw: !0
758
+ });
759
+ }
760
+ set rawInputValue(e) {
761
+ this.resolve(e, {
762
+ raw: !0
763
+ });
764
+ }
765
+ get displayValue() {
766
+ return this.value;
767
+ }
768
+ get isComplete() {
769
+ return !0;
770
+ }
771
+ get isFilled() {
772
+ return this.isComplete;
773
+ }
774
+ /** Finds nearest input position in direction */
775
+ nearestInputPos(e, t) {
776
+ return e;
777
+ }
778
+ totalInputPositions(e, t) {
779
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), Math.min(this.displayValue.length, t - e);
780
+ }
781
+ /** Extracts value in range considering flags */
782
+ extractInput(e, t, s) {
783
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), this.displayValue.slice(e, t);
784
+ }
785
+ /** Extracts tail in range */
786
+ extractTail(e, t) {
787
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new S(this.extractInput(e, t), e);
788
+ }
789
+ /** Appends tail */
790
+ appendTail(e) {
791
+ return T(e) && (e = new S(String(e))), e.appendTo(this);
792
+ }
793
+ /** Appends char */
794
+ _appendCharRaw(e, t) {
795
+ return e ? (this._value += e, new c({
796
+ inserted: e,
797
+ rawInserted: e
798
+ })) : new c();
799
+ }
800
+ /** Appends char */
801
+ _appendChar(e, t, s) {
802
+ t === void 0 && (t = {});
803
+ const i = this.state;
804
+ let a;
805
+ if ([e, a] = this.doPrepareChar(e, t), e && (a = a.aggregate(this._appendCharRaw(e, t)), !a.rawInserted && this.autofix === "pad")) {
806
+ const u = this.state;
807
+ this.state = i;
808
+ let n = this.pad(t);
809
+ const l = this._appendCharRaw(e, t);
810
+ n = n.aggregate(l), l.rawInserted || n.equals(a) ? a = n : this.state = u;
811
+ }
812
+ if (a.inserted) {
813
+ let u, n = this.doValidate(t) !== !1;
814
+ if (n && s != null) {
815
+ const l = this.state;
816
+ if (this.overwrite === !0) {
817
+ u = s.state;
818
+ for (let h = 0; h < a.rawInserted.length; ++h)
819
+ s.unshift(this.displayValue.length - a.tailShift);
820
+ }
821
+ let o = this.appendTail(s);
822
+ if (n = o.rawInserted.length === s.toString().length, !(n && o.inserted) && this.overwrite === "shift") {
823
+ this.state = l, u = s.state;
824
+ for (let h = 0; h < a.rawInserted.length; ++h)
825
+ s.shift();
826
+ o = this.appendTail(s), n = o.rawInserted.length === s.toString().length;
827
+ }
828
+ n && o.inserted && (this.state = l);
829
+ }
830
+ n || (a = new c(), this.state = i, s && u && (s.state = u));
831
+ }
832
+ return a;
833
+ }
834
+ /** Appends optional placeholder at the end */
835
+ _appendPlaceholder() {
836
+ return new c();
837
+ }
838
+ /** Appends optional eager placeholder at the end */
839
+ _appendEager() {
840
+ return new c();
841
+ }
842
+ /** Appends symbols considering flags */
843
+ append(e, t, s) {
844
+ if (!T(e)) throw new Error("value should be string");
845
+ const i = T(s) ? new S(String(s)) : s;
846
+ t != null && t.tail && (t._beforeTailState = this.state);
847
+ let a;
848
+ [e, a] = this.doPrepare(e, t);
849
+ for (let u = 0; u < e.length; ++u) {
850
+ const n = this._appendChar(e[u], t, i);
851
+ if (!n.rawInserted && !this.doSkipInvalid(e[u], t, i)) break;
852
+ a.aggregate(n);
853
+ }
854
+ return (this.eager === !0 || this.eager === "append") && t != null && t.input && e && a.aggregate(this._appendEager()), i != null && (a.tailShift += this.appendTail(i).tailShift), a;
855
+ }
856
+ remove(e, t) {
857
+ 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 c();
858
+ }
859
+ /** Calls function and reapplies current value */
860
+ withValueRefresh(e) {
861
+ if (this._refreshing || !this._initialized) return e();
862
+ this._refreshing = !0;
863
+ const t = this.rawInputValue, s = this.value, i = e();
864
+ return this.rawInputValue = t, this.value && this.value !== s && s.indexOf(this.value) === 0 && (this.append(s.slice(this.displayValue.length), {}, ""), this.doCommit()), delete this._refreshing, i;
865
+ }
866
+ runIsolated(e) {
867
+ if (this._isolated || !this._initialized) return e(this);
868
+ this._isolated = !0;
869
+ const t = this.state, s = e(this);
870
+ return this.state = t, delete this._isolated, s;
871
+ }
872
+ doSkipInvalid(e, t, s) {
873
+ return !!this.skipInvalid;
874
+ }
875
+ /** Prepares string before mask processing */
876
+ doPrepare(e, t) {
877
+ return t === void 0 && (t = {}), c.normalize(this.prepare ? this.prepare(e, this, t) : e);
878
+ }
879
+ /** Prepares each char before mask processing */
880
+ doPrepareChar(e, t) {
881
+ return t === void 0 && (t = {}), c.normalize(this.prepareChar ? this.prepareChar(e, this, t) : e);
882
+ }
883
+ /** Validates if value is acceptable */
884
+ doValidate(e) {
885
+ return (!this.validate || this.validate(this.value, this, e)) && (!this.parent || this.parent.doValidate(e));
886
+ }
887
+ /** Does additional processing at the end of editing */
888
+ doCommit() {
889
+ this.commit && this.commit(this.value, this);
890
+ }
891
+ splice(e, t, s, i, a) {
892
+ s === void 0 && (s = ""), i === void 0 && (i = d.NONE), a === void 0 && (a = {
893
+ input: !0
894
+ });
895
+ const u = e + t, n = this.extractTail(u), l = this.eager === !0 || this.eager === "remove";
896
+ let o;
897
+ l && (i = $e(i), o = this.extractInput(0, u, {
898
+ raw: !0
899
+ }));
900
+ let h = e;
901
+ const m = new c();
902
+ if (i !== d.NONE && (h = this.nearestInputPos(e, t > 1 && e !== 0 && !l ? d.NONE : i), m.tailShift = h - e), m.aggregate(this.remove(h)), l && i !== d.NONE && o === this.rawInputValue)
903
+ if (i === d.FORCE_LEFT) {
904
+ let k;
905
+ for (; o === this.rawInputValue && (k = this.displayValue.length); )
906
+ m.aggregate(new c({
907
+ tailShift: -1
908
+ })).aggregate(this.remove(k - 1));
909
+ } else i === d.FORCE_RIGHT && n.unshift();
910
+ return m.aggregate(this.append(s, a, n));
911
+ }
912
+ maskEquals(e) {
913
+ return this.mask === e;
914
+ }
915
+ optionsIsChanged(e) {
916
+ return !ee(this, e);
917
+ }
918
+ typedValueEquals(e) {
919
+ const t = this.typedValue;
920
+ return e === t || X.EMPTY_VALUES.includes(e) && X.EMPTY_VALUES.includes(t) || (this.format ? this.format(e, this) === this.format(this.typedValue, this) : !1);
921
+ }
922
+ pad(e) {
923
+ return new c();
924
+ }
925
+ };
926
+ y.DEFAULTS = {
927
+ skipInvalid: !0
928
+ };
929
+ y.EMPTY_VALUES = [void 0, null, ""];
930
+ p.Masked = y;
931
+ class M {
932
+ /** */
933
+ constructor(e, t) {
934
+ e === void 0 && (e = []), t === void 0 && (t = 0), this.chunks = e, this.from = t;
935
+ }
936
+ toString() {
937
+ return this.chunks.map(String).join("");
938
+ }
939
+ extend(e) {
940
+ if (!String(e)) return;
941
+ e = T(e) ? new S(String(e)) : e;
942
+ const t = this.chunks[this.chunks.length - 1], s = t && // if stops are same or tail has no stop
943
+ (t.stop === e.stop || e.stop == null) && // if tail chunk goes just after last chunk
944
+ e.from === t.from + t.toString().length;
945
+ if (e instanceof S)
946
+ s ? t.extend(e.toString()) : this.chunks.push(e);
947
+ else if (e instanceof M) {
948
+ if (e.stop == null) {
949
+ let i;
950
+ for (; e.chunks.length && e.chunks[0].stop == null; )
951
+ i = e.chunks.shift(), i.from += e.from, this.extend(i);
952
+ }
953
+ e.toString() && (e.stop = e.blockIndex, this.chunks.push(e));
954
+ }
955
+ }
956
+ appendTo(e) {
957
+ if (!(e instanceof p.MaskedPattern))
958
+ return new S(this.toString()).appendTo(e);
959
+ const t = new c();
960
+ for (let s = 0; s < this.chunks.length; ++s) {
961
+ const i = this.chunks[s], a = e._mapPosToBlock(e.displayValue.length), u = i.stop;
962
+ let n;
963
+ if (u != null && // if block not found or stop is behind lastBlock
964
+ (!a || a.index <= u) && ((i instanceof M || // for continuous block also check if stop is exist
965
+ e._stops.indexOf(u) >= 0) && t.aggregate(e._appendPlaceholder(u)), n = i instanceof M && e._blocks[u]), n) {
966
+ const l = n.appendTail(i);
967
+ t.aggregate(l);
968
+ const o = i.toString().slice(l.rawInserted.length);
969
+ o && t.aggregate(e.append(o, {
970
+ tail: !0
971
+ }));
972
+ } else
973
+ t.aggregate(e.append(i.toString(), {
974
+ tail: !0
975
+ }));
976
+ }
977
+ return t;
978
+ }
979
+ get state() {
980
+ return {
981
+ chunks: this.chunks.map((e) => e.state),
982
+ from: this.from,
983
+ stop: this.stop,
984
+ blockIndex: this.blockIndex
985
+ };
986
+ }
987
+ set state(e) {
988
+ const {
989
+ chunks: t,
990
+ ...s
991
+ } = e;
992
+ Object.assign(this, s), this.chunks = t.map((i) => {
993
+ const a = "chunks" in i ? new M() : new S();
994
+ return a.state = i, a;
995
+ });
996
+ }
997
+ unshift(e) {
998
+ if (!this.chunks.length || e != null && this.from >= e) return "";
999
+ const t = e != null ? e - this.from : e;
1000
+ let s = 0;
1001
+ for (; s < this.chunks.length; ) {
1002
+ const i = this.chunks[s], a = i.unshift(t);
1003
+ if (i.toString()) {
1004
+ if (!a) break;
1005
+ ++s;
1006
+ } else
1007
+ this.chunks.splice(s, 1);
1008
+ if (a) return a;
1009
+ }
1010
+ return "";
1011
+ }
1012
+ shift() {
1013
+ if (!this.chunks.length) return "";
1014
+ let e = this.chunks.length - 1;
1015
+ for (; 0 <= e; ) {
1016
+ const t = this.chunks[e], s = t.shift();
1017
+ if (t.toString()) {
1018
+ if (!s) break;
1019
+ --e;
1020
+ } else
1021
+ this.chunks.splice(e, 1);
1022
+ if (s) return s;
1023
+ }
1024
+ return "";
1025
+ }
1026
+ }
1027
+ class Je {
1028
+ constructor(e, t) {
1029
+ this.masked = e, this._log = [];
1030
+ const {
1031
+ offset: s,
1032
+ index: i
1033
+ } = e._mapPosToBlock(t) || (t < 0 ? (
1034
+ // first
1035
+ {
1036
+ index: 0,
1037
+ offset: 0
1038
+ }
1039
+ ) : (
1040
+ // last
1041
+ {
1042
+ index: this.masked._blocks.length,
1043
+ offset: 0
1044
+ }
1045
+ ));
1046
+ this.offset = s, this.index = i, this.ok = !1;
1047
+ }
1048
+ get block() {
1049
+ return this.masked._blocks[this.index];
1050
+ }
1051
+ get pos() {
1052
+ return this.masked._blockStartPos(this.index) + this.offset;
1053
+ }
1054
+ get state() {
1055
+ return {
1056
+ index: this.index,
1057
+ offset: this.offset,
1058
+ ok: this.ok
1059
+ };
1060
+ }
1061
+ set state(e) {
1062
+ Object.assign(this, e);
1063
+ }
1064
+ pushState() {
1065
+ this._log.push(this.state);
1066
+ }
1067
+ popState() {
1068
+ const e = this._log.pop();
1069
+ return e && (this.state = e), e;
1070
+ }
1071
+ bindBlock() {
1072
+ this.block || (this.index < 0 && (this.index = 0, this.offset = 0), this.index >= this.masked._blocks.length && (this.index = this.masked._blocks.length - 1, this.offset = this.block.displayValue.length));
1073
+ }
1074
+ _pushLeft(e) {
1075
+ for (this.pushState(), this.bindBlock(); 0 <= this.index; --this.index, this.offset = ((t = this.block) == null ? void 0 : t.displayValue.length) || 0) {
1076
+ var t;
1077
+ if (e()) return this.ok = !0;
1078
+ }
1079
+ return this.ok = !1;
1080
+ }
1081
+ _pushRight(e) {
1082
+ for (this.pushState(), this.bindBlock(); this.index < this.masked._blocks.length; ++this.index, this.offset = 0)
1083
+ if (e()) return this.ok = !0;
1084
+ return this.ok = !1;
1085
+ }
1086
+ pushLeftBeforeFilled() {
1087
+ return this._pushLeft(() => {
1088
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, d.FORCE_LEFT), this.offset !== 0))
1089
+ return !0;
1090
+ });
1091
+ }
1092
+ pushLeftBeforeInput() {
1093
+ return this._pushLeft(() => {
1094
+ if (!this.block.isFixed)
1095
+ return this.offset = this.block.nearestInputPos(this.offset, d.LEFT), !0;
1096
+ });
1097
+ }
1098
+ pushLeftBeforeRequired() {
1099
+ return this._pushLeft(() => {
1100
+ if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1101
+ return this.offset = this.block.nearestInputPos(this.offset, d.LEFT), !0;
1102
+ });
1103
+ }
1104
+ pushRightBeforeFilled() {
1105
+ return this._pushRight(() => {
1106
+ if (!(this.block.isFixed || !this.block.value) && (this.offset = this.block.nearestInputPos(this.offset, d.FORCE_RIGHT), this.offset !== this.block.value.length))
1107
+ return !0;
1108
+ });
1109
+ }
1110
+ pushRightBeforeInput() {
1111
+ return this._pushRight(() => {
1112
+ if (!this.block.isFixed)
1113
+ return this.offset = this.block.nearestInputPos(this.offset, d.NONE), !0;
1114
+ });
1115
+ }
1116
+ pushRightBeforeRequired() {
1117
+ return this._pushRight(() => {
1118
+ if (!(this.block.isFixed || this.block.isOptional && !this.block.value))
1119
+ return this.offset = this.block.nearestInputPos(this.offset, d.NONE), !0;
1120
+ });
1121
+ }
1122
+ }
1123
+ class ye {
1124
+ /** */
1125
+ /** */
1126
+ /** */
1127
+ /** */
1128
+ /** */
1129
+ /** */
1130
+ constructor(e) {
1131
+ Object.assign(this, e), this._value = "", this.isFixed = !0;
1132
+ }
1133
+ get value() {
1134
+ return this._value;
1135
+ }
1136
+ get unmaskedValue() {
1137
+ return this.isUnmasking ? this.value : "";
1138
+ }
1139
+ get rawInputValue() {
1140
+ return this._isRawInput ? this.value : "";
1141
+ }
1142
+ get displayValue() {
1143
+ return this.value;
1144
+ }
1145
+ reset() {
1146
+ this._isRawInput = !1, this._value = "";
1147
+ }
1148
+ remove(e, t) {
1149
+ 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 c();
1150
+ }
1151
+ nearestInputPos(e, t) {
1152
+ t === void 0 && (t = d.NONE);
1153
+ const s = 0, i = this._value.length;
1154
+ switch (t) {
1155
+ case d.LEFT:
1156
+ case d.FORCE_LEFT:
1157
+ return s;
1158
+ case d.NONE:
1159
+ case d.RIGHT:
1160
+ case d.FORCE_RIGHT:
1161
+ default:
1162
+ return i;
1163
+ }
1164
+ }
1165
+ totalInputPositions(e, t) {
1166
+ return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), this._isRawInput ? t - e : 0;
1167
+ }
1168
+ extractInput(e, t, s) {
1169
+ return e === void 0 && (e = 0), t === void 0 && (t = this._value.length), s === void 0 && (s = {}), s.raw && this._isRawInput && this._value.slice(e, t) || "";
1170
+ }
1171
+ get isComplete() {
1172
+ return !0;
1173
+ }
1174
+ get isFilled() {
1175
+ return !!this._value;
1176
+ }
1177
+ _appendChar(e, t) {
1178
+ if (t === void 0 && (t = {}), this.isFilled) return new c();
1179
+ const s = this.eager === !0 || this.eager === "append", i = this.char === e && (this.isUnmasking || t.input || t.raw) && (!t.raw || !s) && !t.tail, a = new c({
1180
+ inserted: this.char,
1181
+ rawInserted: i ? this.char : ""
1182
+ });
1183
+ return this._value = this.char, this._isRawInput = i && (t.raw || t.input), a;
1184
+ }
1185
+ _appendEager() {
1186
+ return this._appendChar(this.char, {
1187
+ tail: !0
1188
+ });
1189
+ }
1190
+ _appendPlaceholder() {
1191
+ const e = new c();
1192
+ return this.isFilled || (this._value = e.inserted = this.char), e;
1193
+ }
1194
+ extractTail() {
1195
+ return new S("");
1196
+ }
1197
+ appendTail(e) {
1198
+ return T(e) && (e = new S(String(e))), e.appendTo(this);
1199
+ }
1200
+ append(e, t, s) {
1201
+ const i = this._appendChar(e[0], t);
1202
+ return s != null && (i.tailShift += this.appendTail(s).tailShift), i;
1203
+ }
1204
+ doCommit() {
1205
+ }
1206
+ get state() {
1207
+ return {
1208
+ _value: this._value,
1209
+ _rawInputValue: this.rawInputValue
1210
+ };
1211
+ }
1212
+ set state(e) {
1213
+ this._value = e._value, this._isRawInput = !!e._rawInputValue;
1214
+ }
1215
+ pad(e) {
1216
+ return this._appendPlaceholder();
1217
+ }
1218
+ }
1219
+ class te {
1220
+ /** */
1221
+ /** */
1222
+ /** */
1223
+ /** */
1224
+ /** */
1225
+ /** */
1226
+ /** */
1227
+ /** */
1228
+ constructor(e) {
1229
+ const {
1230
+ parent: t,
1231
+ isOptional: s,
1232
+ placeholderChar: i,
1233
+ displayChar: a,
1234
+ lazy: u,
1235
+ eager: n,
1236
+ ...l
1237
+ } = e;
1238
+ this.masked = B(l), Object.assign(this, {
1239
+ parent: t,
1240
+ isOptional: s,
1241
+ placeholderChar: i,
1242
+ displayChar: a,
1243
+ lazy: u,
1244
+ eager: n
1245
+ });
1246
+ }
1247
+ reset() {
1248
+ this.isFilled = !1, this.masked.reset();
1249
+ }
1250
+ remove(e, t) {
1251
+ 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 c();
1252
+ }
1253
+ get value() {
1254
+ return this.masked.value || (this.isFilled && !this.isOptional ? this.placeholderChar : "");
1255
+ }
1256
+ get unmaskedValue() {
1257
+ return this.masked.unmaskedValue;
1258
+ }
1259
+ get rawInputValue() {
1260
+ return this.masked.rawInputValue;
1261
+ }
1262
+ get displayValue() {
1263
+ return this.masked.value && this.displayChar || this.value;
1264
+ }
1265
+ get isComplete() {
1266
+ return !!this.masked.value || this.isOptional;
1267
+ }
1268
+ _appendChar(e, t) {
1269
+ if (t === void 0 && (t = {}), this.isFilled) return new c();
1270
+ const s = this.masked.state;
1271
+ let i = this.masked._appendChar(e, this.currentMaskFlags(t));
1272
+ return i.inserted && this.doValidate(t) === !1 && (i = new c(), this.masked.state = s), !i.inserted && !this.isOptional && !this.lazy && !t.input && (i.inserted = this.placeholderChar), i.skip = !i.inserted && !this.isOptional, this.isFilled = !!i.inserted, i;
1273
+ }
1274
+ append(e, t, s) {
1275
+ return this.masked.append(e, this.currentMaskFlags(t), s);
1276
+ }
1277
+ _appendPlaceholder() {
1278
+ return this.isFilled || this.isOptional ? new c() : (this.isFilled = !0, new c({
1279
+ inserted: this.placeholderChar
1280
+ }));
1281
+ }
1282
+ _appendEager() {
1283
+ return new c();
1284
+ }
1285
+ extractTail(e, t) {
1286
+ return this.masked.extractTail(e, t);
1287
+ }
1288
+ appendTail(e) {
1289
+ return this.masked.appendTail(e);
1290
+ }
1291
+ extractInput(e, t, s) {
1292
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.masked.extractInput(e, t, s);
1293
+ }
1294
+ nearestInputPos(e, t) {
1295
+ t === void 0 && (t = d.NONE);
1296
+ const s = 0, i = this.value.length, a = Math.min(Math.max(e, s), i);
1297
+ switch (t) {
1298
+ case d.LEFT:
1299
+ case d.FORCE_LEFT:
1300
+ return this.isComplete ? a : s;
1301
+ case d.RIGHT:
1302
+ case d.FORCE_RIGHT:
1303
+ return this.isComplete ? a : i;
1304
+ case d.NONE:
1305
+ default:
1306
+ return a;
1307
+ }
1308
+ }
1309
+ totalInputPositions(e, t) {
1310
+ return e === void 0 && (e = 0), t === void 0 && (t = this.value.length), this.value.slice(e, t).length;
1311
+ }
1312
+ doValidate(e) {
1313
+ return this.masked.doValidate(this.currentMaskFlags(e)) && (!this.parent || this.parent.doValidate(this.currentMaskFlags(e)));
1314
+ }
1315
+ doCommit() {
1316
+ this.masked.doCommit();
1317
+ }
1318
+ get state() {
1319
+ return {
1320
+ _value: this.value,
1321
+ _rawInputValue: this.rawInputValue,
1322
+ masked: this.masked.state,
1323
+ isFilled: this.isFilled
1324
+ };
1325
+ }
1326
+ set state(e) {
1327
+ this.masked.state = e.masked, this.isFilled = e.isFilled;
1328
+ }
1329
+ currentMaskFlags(e) {
1330
+ var t;
1331
+ return {
1332
+ ...e,
1333
+ _beforeTailState: (e == null || (t = e._beforeTailState) == null ? void 0 : t.masked) || e?._beforeTailState
1334
+ };
1335
+ }
1336
+ pad(e) {
1337
+ return new c();
1338
+ }
1339
+ }
1340
+ te.DEFAULT_DEFINITIONS = {
1341
+ 0: /\d/,
1342
+ 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]/,
1343
+ // http://stackoverflow.com/a/22075070
1344
+ "*": /./
1345
+ };
1346
+ class Qe extends y {
1347
+ /** */
1348
+ /** Enable characters overwriting */
1349
+ /** */
1350
+ /** */
1351
+ /** */
1352
+ updateOptions(e) {
1353
+ super.updateOptions(e);
1354
+ }
1355
+ _update(e) {
1356
+ const t = e.mask;
1357
+ t && (e.validate = (s) => s.search(t) >= 0), super._update(e);
1358
+ }
1359
+ }
1360
+ p.MaskedRegExp = Qe;
1361
+ class C extends y {
1362
+ /** */
1363
+ /** */
1364
+ /** Single char for empty input */
1365
+ /** Single char for filled input */
1366
+ /** Show placeholder only when needed */
1367
+ /** Enable characters overwriting */
1368
+ /** */
1369
+ /** */
1370
+ /** */
1371
+ constructor(e) {
1372
+ super({
1373
+ ...C.DEFAULTS,
1374
+ ...e,
1375
+ definitions: Object.assign({}, te.DEFAULT_DEFINITIONS, e?.definitions)
1376
+ });
1377
+ }
1378
+ updateOptions(e) {
1379
+ super.updateOptions(e);
1380
+ }
1381
+ _update(e) {
1382
+ e.definitions = Object.assign({}, this.definitions, e.definitions), super._update(e), this._rebuildMask();
1383
+ }
1384
+ _rebuildMask() {
1385
+ const e = this.definitions;
1386
+ this._blocks = [], this.exposeBlock = void 0, this._stops = [], this._maskedBlocks = {};
1387
+ const t = this.mask;
1388
+ if (!t || !e) return;
1389
+ let s = !1, i = !1;
1390
+ for (let a = 0; a < t.length; ++a) {
1391
+ if (this.blocks) {
1392
+ const o = t.slice(a), h = Object.keys(this.blocks).filter((k) => o.indexOf(k) === 0);
1393
+ h.sort((k, g) => g.length - k.length);
1394
+ const m = h[0];
1395
+ if (m) {
1396
+ const {
1397
+ expose: k,
1398
+ repeat: g,
1399
+ ...f
1400
+ } = G(this.blocks[m]), E = {
1401
+ lazy: this.lazy,
1402
+ eager: this.eager,
1403
+ placeholderChar: this.placeholderChar,
1404
+ displayChar: this.displayChar,
1405
+ overwrite: this.overwrite,
1406
+ autofix: this.autofix,
1407
+ ...f,
1408
+ repeat: g,
1409
+ parent: this
1410
+ }, b = g != null ? new p.RepeatBlock(
1411
+ E
1412
+ /* TODO */
1413
+ ) : B(E);
1414
+ b && (this._blocks.push(b), k && (this.exposeBlock = b), this._maskedBlocks[m] || (this._maskedBlocks[m] = []), this._maskedBlocks[m].push(this._blocks.length - 1)), a += m.length - 1;
1415
+ continue;
1416
+ }
1417
+ }
1418
+ let u = t[a], n = u in e;
1419
+ if (u === C.STOP_CHAR) {
1420
+ this._stops.push(this._blocks.length);
1421
+ continue;
1422
+ }
1423
+ if (u === "{" || u === "}") {
1424
+ s = !s;
1425
+ continue;
1426
+ }
1427
+ if (u === "[" || u === "]") {
1428
+ i = !i;
1429
+ continue;
1430
+ }
1431
+ if (u === C.ESCAPE_CHAR) {
1432
+ if (++a, u = t[a], !u) break;
1433
+ n = !1;
1434
+ }
1435
+ const l = n ? new te({
1436
+ isOptional: i,
1437
+ lazy: this.lazy,
1438
+ eager: this.eager,
1439
+ placeholderChar: this.placeholderChar,
1440
+ displayChar: this.displayChar,
1441
+ ...G(e[u]),
1442
+ parent: this
1443
+ }) : new ye({
1444
+ char: u,
1445
+ eager: this.eager,
1446
+ isUnmasking: s
1447
+ });
1448
+ this._blocks.push(l);
1449
+ }
1450
+ }
1451
+ get state() {
1452
+ return {
1453
+ ...super.state,
1454
+ _blocks: this._blocks.map((e) => e.state)
1455
+ };
1456
+ }
1457
+ set state(e) {
1458
+ if (!e) {
1459
+ this.reset();
1460
+ return;
1461
+ }
1462
+ const {
1463
+ _blocks: t,
1464
+ ...s
1465
+ } = e;
1466
+ this._blocks.forEach((i, a) => i.state = t[a]), super.state = s;
1467
+ }
1468
+ reset() {
1469
+ super.reset(), this._blocks.forEach((e) => e.reset());
1470
+ }
1471
+ get isComplete() {
1472
+ return this.exposeBlock ? this.exposeBlock.isComplete : this._blocks.every((e) => e.isComplete);
1473
+ }
1474
+ get isFilled() {
1475
+ return this._blocks.every((e) => e.isFilled);
1476
+ }
1477
+ get isFixed() {
1478
+ return this._blocks.every((e) => e.isFixed);
1479
+ }
1480
+ get isOptional() {
1481
+ return this._blocks.every((e) => e.isOptional);
1482
+ }
1483
+ doCommit() {
1484
+ this._blocks.forEach((e) => e.doCommit()), super.doCommit();
1485
+ }
1486
+ get unmaskedValue() {
1487
+ return this.exposeBlock ? this.exposeBlock.unmaskedValue : this._blocks.reduce((e, t) => e += t.unmaskedValue, "");
1488
+ }
1489
+ set unmaskedValue(e) {
1490
+ if (this.exposeBlock) {
1491
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1492
+ this.exposeBlock.unmaskedValue = e, this.appendTail(t), this.doCommit();
1493
+ } else super.unmaskedValue = e;
1494
+ }
1495
+ get value() {
1496
+ return this.exposeBlock ? this.exposeBlock.value : (
1497
+ // TODO return _value when not in change?
1498
+ this._blocks.reduce((e, t) => e += t.value, "")
1499
+ );
1500
+ }
1501
+ set value(e) {
1502
+ if (this.exposeBlock) {
1503
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1504
+ this.exposeBlock.value = e, this.appendTail(t), this.doCommit();
1505
+ } else super.value = e;
1506
+ }
1507
+ get typedValue() {
1508
+ return this.exposeBlock ? this.exposeBlock.typedValue : super.typedValue;
1509
+ }
1510
+ set typedValue(e) {
1511
+ if (this.exposeBlock) {
1512
+ const t = this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock)) + this.exposeBlock.displayValue.length);
1513
+ this.exposeBlock.typedValue = e, this.appendTail(t), this.doCommit();
1514
+ } else super.typedValue = e;
1515
+ }
1516
+ get displayValue() {
1517
+ return this._blocks.reduce((e, t) => e += t.displayValue, "");
1518
+ }
1519
+ appendTail(e) {
1520
+ return super.appendTail(e).aggregate(this._appendPlaceholder());
1521
+ }
1522
+ _appendEager() {
1523
+ var e;
1524
+ const t = new c();
1525
+ let s = (e = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : e.index;
1526
+ if (s == null) return t;
1527
+ this._blocks[s].isFilled && ++s;
1528
+ for (let i = s; i < this._blocks.length; ++i) {
1529
+ const a = this._blocks[i]._appendEager();
1530
+ if (!a.inserted) break;
1531
+ t.aggregate(a);
1532
+ }
1533
+ return t;
1534
+ }
1535
+ _appendCharRaw(e, t) {
1536
+ t === void 0 && (t = {});
1537
+ const s = this._mapPosToBlock(this.displayValue.length), i = new c();
1538
+ if (!s) return i;
1539
+ for (let u = s.index, n; n = this._blocks[u]; ++u) {
1540
+ var a;
1541
+ const l = n._appendChar(e, {
1542
+ ...t,
1543
+ _beforeTailState: (a = t._beforeTailState) == null || (a = a._blocks) == null ? void 0 : a[u]
1544
+ });
1545
+ if (i.aggregate(l), l.consumed) break;
1546
+ }
1547
+ return i;
1548
+ }
1549
+ extractTail(e, t) {
1550
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1551
+ const s = new M();
1552
+ return e === t || this._forEachBlocksInRange(e, t, (i, a, u, n) => {
1553
+ const l = i.extractTail(u, n);
1554
+ l.stop = this._findStopBefore(a), l.from = this._blockStartPos(a), l instanceof M && (l.blockIndex = a), s.extend(l);
1555
+ }), s;
1556
+ }
1557
+ extractInput(e, t, s) {
1558
+ if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), s === void 0 && (s = {}), e === t) return "";
1559
+ let i = "";
1560
+ return this._forEachBlocksInRange(e, t, (a, u, n, l) => {
1561
+ i += a.extractInput(n, l, s);
1562
+ }), i;
1563
+ }
1564
+ _findStopBefore(e) {
1565
+ let t;
1566
+ for (let s = 0; s < this._stops.length; ++s) {
1567
+ const i = this._stops[s];
1568
+ if (i <= e) t = i;
1569
+ else break;
1570
+ }
1571
+ return t;
1572
+ }
1573
+ /** Appends placeholder depending on laziness */
1574
+ _appendPlaceholder(e) {
1575
+ const t = new c();
1576
+ if (this.lazy && e == null) return t;
1577
+ const s = this._mapPosToBlock(this.displayValue.length);
1578
+ if (!s) return t;
1579
+ const i = s.index, a = e ?? this._blocks.length;
1580
+ return this._blocks.slice(i, a).forEach((u) => {
1581
+ if (!u.lazy || e != null) {
1582
+ var n;
1583
+ t.aggregate(u._appendPlaceholder((n = u._blocks) == null ? void 0 : n.length));
1584
+ }
1585
+ }), t;
1586
+ }
1587
+ /** Finds block in pos */
1588
+ _mapPosToBlock(e) {
1589
+ let t = "";
1590
+ for (let s = 0; s < this._blocks.length; ++s) {
1591
+ const i = this._blocks[s], a = t.length;
1592
+ if (t += i.displayValue, e <= t.length)
1593
+ return {
1594
+ index: s,
1595
+ offset: e - a
1596
+ };
1597
+ }
1598
+ }
1599
+ _blockStartPos(e) {
1600
+ return this._blocks.slice(0, e).reduce((t, s) => t += s.displayValue.length, 0);
1601
+ }
1602
+ _forEachBlocksInRange(e, t, s) {
1603
+ t === void 0 && (t = this.displayValue.length);
1604
+ const i = this._mapPosToBlock(e);
1605
+ if (i) {
1606
+ const a = this._mapPosToBlock(t), u = a && i.index === a.index, n = i.offset, l = a && u ? a.offset : this._blocks[i.index].displayValue.length;
1607
+ if (s(this._blocks[i.index], i.index, n, l), a && !u) {
1608
+ for (let o = i.index + 1; o < a.index; ++o)
1609
+ s(this._blocks[o], o, 0, this._blocks[o].displayValue.length);
1610
+ s(this._blocks[a.index], a.index, 0, a.offset);
1611
+ }
1612
+ }
1613
+ }
1614
+ remove(e, t) {
1615
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1616
+ const s = super.remove(e, t);
1617
+ return this._forEachBlocksInRange(e, t, (i, a, u, n) => {
1618
+ s.aggregate(i.remove(u, n));
1619
+ }), s;
1620
+ }
1621
+ nearestInputPos(e, t) {
1622
+ if (t === void 0 && (t = d.NONE), !this._blocks.length) return 0;
1623
+ const s = new Je(this, e);
1624
+ if (t === d.NONE)
1625
+ return s.pushRightBeforeInput() || (s.popState(), s.pushLeftBeforeInput()) ? s.pos : this.displayValue.length;
1626
+ if (t === d.LEFT || t === d.FORCE_LEFT) {
1627
+ if (t === d.LEFT) {
1628
+ if (s.pushRightBeforeFilled(), s.ok && s.pos === e) return e;
1629
+ s.popState();
1630
+ }
1631
+ if (s.pushLeftBeforeInput(), s.pushLeftBeforeRequired(), s.pushLeftBeforeFilled(), t === d.LEFT) {
1632
+ if (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.ok && s.pos <= e || (s.popState(), s.ok && s.pos <= e)) return s.pos;
1633
+ s.popState();
1634
+ }
1635
+ return s.ok ? s.pos : t === d.FORCE_LEFT ? 0 : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : 0);
1636
+ }
1637
+ return t === d.RIGHT || t === d.FORCE_RIGHT ? (s.pushRightBeforeInput(), s.pushRightBeforeRequired(), s.pushRightBeforeFilled() ? s.pos : t === d.FORCE_RIGHT ? this.displayValue.length : (s.popState(), s.ok || (s.popState(), s.ok) ? s.pos : this.nearestInputPos(e, d.LEFT))) : e;
1638
+ }
1639
+ totalInputPositions(e, t) {
1640
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
1641
+ let s = 0;
1642
+ return this._forEachBlocksInRange(e, t, (i, a, u, n) => {
1643
+ s += i.totalInputPositions(u, n);
1644
+ }), s;
1645
+ }
1646
+ /** Get block by name */
1647
+ maskedBlock(e) {
1648
+ return this.maskedBlocks(e)[0];
1649
+ }
1650
+ /** Get all blocks by name */
1651
+ maskedBlocks(e) {
1652
+ const t = this._maskedBlocks[e];
1653
+ return t ? t.map((s) => this._blocks[s]) : [];
1654
+ }
1655
+ pad(e) {
1656
+ const t = new c();
1657
+ return this._forEachBlocksInRange(0, this.displayValue.length, (s) => t.aggregate(s.pad(e))), t;
1658
+ }
1659
+ }
1660
+ C.DEFAULTS = {
1661
+ ...y.DEFAULTS,
1662
+ lazy: !0,
1663
+ placeholderChar: "_"
1664
+ };
1665
+ C.STOP_CHAR = "`";
1666
+ C.ESCAPE_CHAR = "\\";
1667
+ C.InputDefinition = te;
1668
+ C.FixedDefinition = ye;
1669
+ p.MaskedPattern = C;
1670
+ class Z extends C {
1671
+ /**
1672
+ Optionally sets max length of pattern.
1673
+ Used when pattern length is longer then `to` param length. Pads zeros at start in this case.
1674
+ */
1675
+ /** Min bound */
1676
+ /** Max bound */
1677
+ get _matchFrom() {
1678
+ return this.maxLength - String(this.from).length;
1679
+ }
1680
+ constructor(e) {
1681
+ super(e);
1682
+ }
1683
+ updateOptions(e) {
1684
+ super.updateOptions(e);
1685
+ }
1686
+ _update(e) {
1687
+ const {
1688
+ to: t = this.to || 0,
1689
+ from: s = this.from || 0,
1690
+ maxLength: i = this.maxLength || 0,
1691
+ autofix: a = this.autofix,
1692
+ ...u
1693
+ } = e;
1694
+ this.to = t, this.from = s, this.maxLength = Math.max(String(t).length, i), this.autofix = a;
1695
+ const n = String(this.from).padStart(this.maxLength, "0"), l = String(this.to).padStart(this.maxLength, "0");
1696
+ let o = 0;
1697
+ for (; o < l.length && l[o] === n[o]; ) ++o;
1698
+ u.mask = l.slice(0, o).replace(/0/g, "\\0") + "0".repeat(this.maxLength - o), super._update(u);
1699
+ }
1700
+ get isComplete() {
1701
+ return super.isComplete && !!this.value;
1702
+ }
1703
+ boundaries(e) {
1704
+ let t = "", s = "";
1705
+ const [, i, a] = e.match(/^(\D*)(\d*)(\D*)/) || [];
1706
+ return a && (t = "0".repeat(i.length) + a, s = "9".repeat(i.length) + a), t = t.padEnd(this.maxLength, "0"), s = s.padEnd(this.maxLength, "9"), [t, s];
1707
+ }
1708
+ doPrepareChar(e, t) {
1709
+ t === void 0 && (t = {});
1710
+ let s;
1711
+ return [e, s] = super.doPrepareChar(e.replace(/\D/g, ""), t), e || (s.skip = !this.isComplete), [e, s];
1712
+ }
1713
+ _appendCharRaw(e, t) {
1714
+ if (t === void 0 && (t = {}), !this.autofix || this.value.length + 1 > this.maxLength) return super._appendCharRaw(e, t);
1715
+ const s = String(this.from).padStart(this.maxLength, "0"), i = String(this.to).padStart(this.maxLength, "0"), [a, u] = this.boundaries(this.value + e);
1716
+ return Number(u) < this.from ? super._appendCharRaw(s[this.value.length], t) : Number(a) > this.to ? !t.tail && this.autofix === "pad" && this.value.length + 1 < this.maxLength ? super._appendCharRaw(s[this.value.length], t).aggregate(this._appendCharRaw(e, t)) : super._appendCharRaw(i[this.value.length], t) : super._appendCharRaw(e, t);
1717
+ }
1718
+ doValidate(e) {
1719
+ const t = this.value;
1720
+ if (t.search(/[^0]/) === -1 && t.length <= this._matchFrom) return !0;
1721
+ const [s, i] = this.boundaries(t);
1722
+ return this.from <= Number(i) && Number(s) <= this.to && super.doValidate(e);
1723
+ }
1724
+ pad(e) {
1725
+ const t = new c();
1726
+ if (this.value.length === this.maxLength) return t;
1727
+ const s = this.value, i = this.maxLength - this.value.length;
1728
+ if (i) {
1729
+ this.reset();
1730
+ for (let a = 0; a < i; ++a)
1731
+ t.aggregate(super._appendCharRaw("0", e));
1732
+ s.split("").forEach((a) => this._appendCharRaw(a));
1733
+ }
1734
+ return t;
1735
+ }
1736
+ }
1737
+ p.MaskedRange = Z;
1738
+ const et = "d{.}`m{.}`Y";
1739
+ class V extends C {
1740
+ static extractPatternOptions(e) {
1741
+ const {
1742
+ mask: t,
1743
+ pattern: s,
1744
+ ...i
1745
+ } = e;
1746
+ return {
1747
+ ...i,
1748
+ mask: T(t) ? t : s
1749
+ };
1750
+ }
1751
+ /** Pattern mask for date according to {@link MaskedDate#format} */
1752
+ /** Start date */
1753
+ /** End date */
1754
+ /** Format typed value to string */
1755
+ /** Parse string to get typed value */
1756
+ constructor(e) {
1757
+ super(V.extractPatternOptions({
1758
+ ...V.DEFAULTS,
1759
+ ...e
1760
+ }));
1761
+ }
1762
+ updateOptions(e) {
1763
+ super.updateOptions(e);
1764
+ }
1765
+ _update(e) {
1766
+ const {
1767
+ mask: t,
1768
+ pattern: s,
1769
+ blocks: i,
1770
+ ...a
1771
+ } = {
1772
+ ...V.DEFAULTS,
1773
+ ...e
1774
+ }, u = Object.assign({}, V.GET_DEFAULT_BLOCKS());
1775
+ e.min && (u.Y.from = e.min.getFullYear()), e.max && (u.Y.to = e.max.getFullYear()), e.min && e.max && u.Y.from === u.Y.to && (u.m.from = e.min.getMonth() + 1, u.m.to = e.max.getMonth() + 1, u.m.from === u.m.to && (u.d.from = e.min.getDate(), u.d.to = e.max.getDate())), Object.assign(u, this.blocks, i), super._update({
1776
+ ...a,
1777
+ mask: T(t) ? t : s,
1778
+ blocks: u
1779
+ });
1780
+ }
1781
+ doValidate(e) {
1782
+ const t = this.date;
1783
+ return super.doValidate(e) && (!this.isComplete || this.isDateExist(this.value) && t != null && (this.min == null || this.min <= t) && (this.max == null || t <= this.max));
1784
+ }
1785
+ /** Checks if date is exists */
1786
+ isDateExist(e) {
1787
+ return this.format(this.parse(e, this), this).indexOf(e) >= 0;
1788
+ }
1789
+ /** Parsed Date */
1790
+ get date() {
1791
+ return this.typedValue;
1792
+ }
1793
+ set date(e) {
1794
+ this.typedValue = e;
1795
+ }
1796
+ get typedValue() {
1797
+ return this.isComplete ? super.typedValue : null;
1798
+ }
1799
+ set typedValue(e) {
1800
+ super.typedValue = e;
1801
+ }
1802
+ maskEquals(e) {
1803
+ return e === Date || super.maskEquals(e);
1804
+ }
1805
+ optionsIsChanged(e) {
1806
+ return super.optionsIsChanged(V.extractPatternOptions(e));
1807
+ }
1808
+ }
1809
+ V.GET_DEFAULT_BLOCKS = () => ({
1810
+ d: {
1811
+ mask: Z,
1812
+ from: 1,
1813
+ to: 31,
1814
+ maxLength: 2
1815
+ },
1816
+ m: {
1817
+ mask: Z,
1818
+ from: 1,
1819
+ to: 12,
1820
+ maxLength: 2
1821
+ },
1822
+ Y: {
1823
+ mask: Z,
1824
+ from: 1900,
1825
+ to: 9999
1826
+ }
1827
+ });
1828
+ V.DEFAULTS = {
1829
+ ...C.DEFAULTS,
1830
+ mask: Date,
1831
+ pattern: et,
1832
+ format: (r, e) => {
1833
+ if (!r) return "";
1834
+ const t = String(r.getDate()).padStart(2, "0"), s = String(r.getMonth() + 1).padStart(2, "0"), i = r.getFullYear();
1835
+ return [t, s, i].join(".");
1836
+ },
1837
+ parse: (r, e) => {
1838
+ const [t, s, i] = r.split(".").map(Number);
1839
+ return new Date(i, s - 1, t);
1840
+ }
1841
+ };
1842
+ p.MaskedDate = V;
1843
+ class ae extends y {
1844
+ constructor(e) {
1845
+ super({
1846
+ ...ae.DEFAULTS,
1847
+ ...e
1848
+ }), this.currentMask = void 0;
1849
+ }
1850
+ updateOptions(e) {
1851
+ super.updateOptions(e);
1852
+ }
1853
+ _update(e) {
1854
+ super._update(e), "mask" in e && (this.exposeMask = void 0, this.compiledMasks = Array.isArray(e.mask) ? e.mask.map((t) => {
1855
+ const {
1856
+ expose: s,
1857
+ ...i
1858
+ } = G(t), a = B({
1859
+ overwrite: this._overwrite,
1860
+ eager: this._eager,
1861
+ skipInvalid: this._skipInvalid,
1862
+ ...i
1863
+ });
1864
+ return s && (this.exposeMask = a), a;
1865
+ }) : []);
1866
+ }
1867
+ _appendCharRaw(e, t) {
1868
+ t === void 0 && (t = {});
1869
+ const s = this._applyDispatch(e, t);
1870
+ return this.currentMask && s.aggregate(this.currentMask._appendChar(e, this.currentMaskFlags(t))), s;
1871
+ }
1872
+ _applyDispatch(e, t, s) {
1873
+ e === void 0 && (e = ""), t === void 0 && (t = {}), s === void 0 && (s = "");
1874
+ const i = t.tail && t._beforeTailState != null ? t._beforeTailState._value : this.value, a = this.rawInputValue, u = t.tail && t._beforeTailState != null ? t._beforeTailState._rawInputValue : a, n = a.slice(u.length), l = this.currentMask, o = new c(), h = l?.state;
1875
+ return this.currentMask = this.doDispatch(e, {
1876
+ ...t
1877
+ }, s), this.currentMask && (this.currentMask !== l ? (this.currentMask.reset(), u && (this.currentMask.append(u, {
1878
+ raw: !0
1879
+ }), o.tailShift = this.currentMask.value.length - i.length), n && (o.tailShift += this.currentMask.append(n, {
1880
+ raw: !0,
1881
+ tail: !0
1882
+ }).tailShift)) : h && (this.currentMask.state = h)), o;
1883
+ }
1884
+ _appendPlaceholder() {
1885
+ const e = this._applyDispatch();
1886
+ return this.currentMask && e.aggregate(this.currentMask._appendPlaceholder()), e;
1887
+ }
1888
+ _appendEager() {
1889
+ const e = this._applyDispatch();
1890
+ return this.currentMask && e.aggregate(this.currentMask._appendEager()), e;
1891
+ }
1892
+ appendTail(e) {
1893
+ const t = new c();
1894
+ return e && t.aggregate(this._applyDispatch("", {}, e)), t.aggregate(this.currentMask ? this.currentMask.appendTail(e) : super.appendTail(e));
1895
+ }
1896
+ currentMaskFlags(e) {
1897
+ var t, s;
1898
+ return {
1899
+ ...e,
1900
+ _beforeTailState: ((t = e._beforeTailState) == null ? void 0 : t.currentMaskRef) === this.currentMask && ((s = e._beforeTailState) == null ? void 0 : s.currentMask) || e._beforeTailState
1901
+ };
1902
+ }
1903
+ doDispatch(e, t, s) {
1904
+ return t === void 0 && (t = {}), s === void 0 && (s = ""), this.dispatch(e, this, t, s);
1905
+ }
1906
+ doValidate(e) {
1907
+ return super.doValidate(e) && (!this.currentMask || this.currentMask.doValidate(this.currentMaskFlags(e)));
1908
+ }
1909
+ doPrepare(e, t) {
1910
+ t === void 0 && (t = {});
1911
+ let [s, i] = super.doPrepare(e, t);
1912
+ if (this.currentMask) {
1913
+ let a;
1914
+ [s, a] = super.doPrepare(s, this.currentMaskFlags(t)), i = i.aggregate(a);
1915
+ }
1916
+ return [s, i];
1917
+ }
1918
+ doPrepareChar(e, t) {
1919
+ t === void 0 && (t = {});
1920
+ let [s, i] = super.doPrepareChar(e, t);
1921
+ if (this.currentMask) {
1922
+ let a;
1923
+ [s, a] = super.doPrepareChar(s, this.currentMaskFlags(t)), i = i.aggregate(a);
1924
+ }
1925
+ return [s, i];
1926
+ }
1927
+ reset() {
1928
+ var e;
1929
+ (e = this.currentMask) == null || e.reset(), this.compiledMasks.forEach((t) => t.reset());
1930
+ }
1931
+ get value() {
1932
+ return this.exposeMask ? this.exposeMask.value : this.currentMask ? this.currentMask.value : "";
1933
+ }
1934
+ set value(e) {
1935
+ this.exposeMask ? (this.exposeMask.value = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.value = e;
1936
+ }
1937
+ get unmaskedValue() {
1938
+ return this.exposeMask ? this.exposeMask.unmaskedValue : this.currentMask ? this.currentMask.unmaskedValue : "";
1939
+ }
1940
+ set unmaskedValue(e) {
1941
+ this.exposeMask ? (this.exposeMask.unmaskedValue = e, this.currentMask = this.exposeMask, this._applyDispatch()) : super.unmaskedValue = e;
1942
+ }
1943
+ get typedValue() {
1944
+ return this.exposeMask ? this.exposeMask.typedValue : this.currentMask ? this.currentMask.typedValue : "";
1945
+ }
1946
+ set typedValue(e) {
1947
+ if (this.exposeMask) {
1948
+ this.exposeMask.typedValue = e, this.currentMask = this.exposeMask, this._applyDispatch();
1949
+ return;
1950
+ }
1951
+ let t = String(e);
1952
+ this.currentMask && (this.currentMask.typedValue = e, t = this.currentMask.unmaskedValue), this.unmaskedValue = t;
1953
+ }
1954
+ get displayValue() {
1955
+ return this.currentMask ? this.currentMask.displayValue : "";
1956
+ }
1957
+ get isComplete() {
1958
+ var e;
1959
+ return !!((e = this.currentMask) != null && e.isComplete);
1960
+ }
1961
+ get isFilled() {
1962
+ var e;
1963
+ return !!((e = this.currentMask) != null && e.isFilled);
1964
+ }
1965
+ remove(e, t) {
1966
+ const s = new c();
1967
+ return this.currentMask && s.aggregate(this.currentMask.remove(e, t)).aggregate(this._applyDispatch()), s;
1968
+ }
1969
+ get state() {
1970
+ var e;
1971
+ return {
1972
+ ...super.state,
1973
+ _rawInputValue: this.rawInputValue,
1974
+ compiledMasks: this.compiledMasks.map((t) => t.state),
1975
+ currentMaskRef: this.currentMask,
1976
+ currentMask: (e = this.currentMask) == null ? void 0 : e.state
1977
+ };
1978
+ }
1979
+ set state(e) {
1980
+ const {
1981
+ compiledMasks: t,
1982
+ currentMaskRef: s,
1983
+ currentMask: i,
1984
+ ...a
1985
+ } = e;
1986
+ t && this.compiledMasks.forEach((u, n) => u.state = t[n]), s != null && (this.currentMask = s, this.currentMask.state = i), super.state = a;
1987
+ }
1988
+ extractInput(e, t, s) {
1989
+ return this.currentMask ? this.currentMask.extractInput(e, t, s) : "";
1990
+ }
1991
+ extractTail(e, t) {
1992
+ return this.currentMask ? this.currentMask.extractTail(e, t) : super.extractTail(e, t);
1993
+ }
1994
+ doCommit() {
1995
+ this.currentMask && this.currentMask.doCommit(), super.doCommit();
1996
+ }
1997
+ nearestInputPos(e, t) {
1998
+ return this.currentMask ? this.currentMask.nearestInputPos(e, t) : super.nearestInputPos(e, t);
1999
+ }
2000
+ get overwrite() {
2001
+ return this.currentMask ? this.currentMask.overwrite : this._overwrite;
2002
+ }
2003
+ set overwrite(e) {
2004
+ this._overwrite = e;
2005
+ }
2006
+ get eager() {
2007
+ return this.currentMask ? this.currentMask.eager : this._eager;
2008
+ }
2009
+ set eager(e) {
2010
+ this._eager = e;
2011
+ }
2012
+ get skipInvalid() {
2013
+ return this.currentMask ? this.currentMask.skipInvalid : this._skipInvalid;
2014
+ }
2015
+ set skipInvalid(e) {
2016
+ this._skipInvalid = e;
2017
+ }
2018
+ get autofix() {
2019
+ return this.currentMask ? this.currentMask.autofix : this._autofix;
2020
+ }
2021
+ set autofix(e) {
2022
+ this._autofix = e;
2023
+ }
2024
+ maskEquals(e) {
2025
+ return Array.isArray(e) ? this.compiledMasks.every((t, s) => {
2026
+ if (!e[s]) return;
2027
+ const {
2028
+ mask: i,
2029
+ ...a
2030
+ } = e[s];
2031
+ return ee(t, a) && t.maskEquals(i);
2032
+ }) : super.maskEquals(e);
2033
+ }
2034
+ typedValueEquals(e) {
2035
+ var t;
2036
+ return !!((t = this.currentMask) != null && t.typedValueEquals(e));
2037
+ }
2038
+ }
2039
+ ae.DEFAULTS = {
2040
+ ...y.DEFAULTS,
2041
+ dispatch: (r, e, t, s) => {
2042
+ if (!e.compiledMasks.length) return;
2043
+ const i = e.rawInputValue, a = e.compiledMasks.map((u, n) => {
2044
+ const l = e.currentMask === u, o = l ? u.displayValue.length : u.nearestInputPos(u.displayValue.length, d.FORCE_LEFT);
2045
+ return u.rawInputValue !== i ? (u.reset(), u.append(i, {
2046
+ raw: !0
2047
+ })) : l || u.remove(o), u.append(r, e.currentMaskFlags(t)), u.appendTail(s), {
2048
+ index: n,
2049
+ weight: u.rawInputValue.length,
2050
+ totalInputPositions: u.totalInputPositions(0, Math.max(o, u.nearestInputPos(u.displayValue.length, d.FORCE_LEFT)))
2051
+ };
2052
+ });
2053
+ return a.sort((u, n) => n.weight - u.weight || n.totalInputPositions - u.totalInputPositions), e.compiledMasks[a[0].index];
2054
+ }
2055
+ };
2056
+ p.MaskedDynamic = ae;
2057
+ class ue extends C {
2058
+ constructor(e) {
2059
+ super({
2060
+ ...ue.DEFAULTS,
2061
+ ...e
2062
+ });
2063
+ }
2064
+ updateOptions(e) {
2065
+ super.updateOptions(e);
2066
+ }
2067
+ _update(e) {
2068
+ const {
2069
+ enum: t,
2070
+ ...s
2071
+ } = e;
2072
+ if (t) {
2073
+ const i = t.map((n) => n.length), a = Math.min(...i), u = Math.max(...i) - a;
2074
+ s.mask = "*".repeat(a), u && (s.mask += "[" + "*".repeat(u) + "]"), this.enum = t;
2075
+ }
2076
+ super._update(s);
2077
+ }
2078
+ _appendCharRaw(e, t) {
2079
+ t === void 0 && (t = {});
2080
+ const s = Math.min(this.nearestInputPos(0, d.FORCE_RIGHT), this.value.length), i = this.enum.filter((a) => this.matchValue(a, this.unmaskedValue + e, s));
2081
+ if (i.length) {
2082
+ i.length === 1 && this._forEachBlocksInRange(0, this.value.length, (u, n) => {
2083
+ const l = i[0][n];
2084
+ n >= this.value.length || l === u.value || (u.reset(), u._appendChar(l, t));
2085
+ });
2086
+ const a = super._appendCharRaw(i[0][this.value.length], t);
2087
+ return i.length === 1 && i[0].slice(this.unmaskedValue.length).split("").forEach((u) => a.aggregate(super._appendCharRaw(u))), a;
2088
+ }
2089
+ return new c({
2090
+ skip: !this.isComplete
2091
+ });
2092
+ }
2093
+ extractTail(e, t) {
2094
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), new S("", e);
2095
+ }
2096
+ remove(e, t) {
2097
+ if (e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), e === t) return new c();
2098
+ const s = Math.min(super.nearestInputPos(0, d.FORCE_RIGHT), this.value.length);
2099
+ let i;
2100
+ for (i = e; i >= 0 && !(this.enum.filter((u) => this.matchValue(u, this.value.slice(s, i), s)).length > 1); --i)
2101
+ ;
2102
+ const a = super.remove(i, t);
2103
+ return a.tailShift += i - e, a;
2104
+ }
2105
+ get isComplete() {
2106
+ return this.enum.indexOf(this.value) >= 0;
2107
+ }
2108
+ }
2109
+ ue.DEFAULTS = {
2110
+ ...C.DEFAULTS,
2111
+ matchValue: (r, e, t) => r.indexOf(e, t) === t
2112
+ };
2113
+ p.MaskedEnum = ue;
2114
+ class tt extends y {
2115
+ /** */
2116
+ /** Enable characters overwriting */
2117
+ /** */
2118
+ /** */
2119
+ /** */
2120
+ updateOptions(e) {
2121
+ super.updateOptions(e);
2122
+ }
2123
+ _update(e) {
2124
+ super._update({
2125
+ ...e,
2126
+ validate: e.mask
2127
+ });
2128
+ }
2129
+ }
2130
+ p.MaskedFunction = tt;
2131
+ var Se;
2132
+ class x extends y {
2133
+ /** Single char */
2134
+ /** Single char */
2135
+ /** Array of single chars */
2136
+ /** */
2137
+ /** */
2138
+ /** Digits after point */
2139
+ /** Flag to remove leading and trailing zeros in the end of editing */
2140
+ /** Flag to pad trailing zeros after point in the end of editing */
2141
+ /** Enable characters overwriting */
2142
+ /** */
2143
+ /** */
2144
+ /** */
2145
+ /** Format typed value to string */
2146
+ /** Parse string to get typed value */
2147
+ constructor(e) {
2148
+ super({
2149
+ ...x.DEFAULTS,
2150
+ ...e
2151
+ });
2152
+ }
2153
+ updateOptions(e) {
2154
+ super.updateOptions(e);
2155
+ }
2156
+ _update(e) {
2157
+ super._update(e), this._updateRegExps();
2158
+ }
2159
+ _updateRegExps() {
2160
+ const e = "^" + (this.allowNegative ? "[+|\\-]?" : ""), t = "\\d*", s = (this.scale ? "(" + oe(this.radix) + "\\d{0," + this.scale + "})?" : "") + "$";
2161
+ this._numberRegExp = new RegExp(e + t + s), this._mapToRadixRegExp = new RegExp("[" + this.mapToRadix.map(oe).join("") + "]", "g"), this._thousandsSeparatorRegExp = new RegExp(oe(this.thousandsSeparator), "g");
2162
+ }
2163
+ _removeThousandsSeparators(e) {
2164
+ return e.replace(this._thousandsSeparatorRegExp, "");
2165
+ }
2166
+ _insertThousandsSeparators(e) {
2167
+ const t = e.split(this.radix);
2168
+ return t[0] = t[0].replace(/\B(?=(\d{3})+(?!\d))/g, this.thousandsSeparator), t.join(this.radix);
2169
+ }
2170
+ doPrepareChar(e, t) {
2171
+ t === void 0 && (t = {});
2172
+ const [s, i] = super.doPrepareChar(this._removeThousandsSeparators(this.scale && this.mapToRadix.length && /*
2173
+ radix should be mapped when
2174
+ 1) input is done from keyboard = flags.input && flags.raw
2175
+ 2) unmasked value is set = !flags.input && !flags.raw
2176
+ and should not be mapped when
2177
+ 1) value is set = flags.input && !flags.raw
2178
+ 2) raw value is set = !flags.input && flags.raw
2179
+ */
2180
+ (t.input && t.raw || !t.input && !t.raw) ? e.replace(this._mapToRadixRegExp, this.radix) : e), t);
2181
+ return e && !s && (i.skip = !0), s && !this.allowPositive && !this.value && s !== "-" && i.aggregate(this._appendChar("-")), [s, i];
2182
+ }
2183
+ _separatorsCount(e, t) {
2184
+ t === void 0 && (t = !1);
2185
+ let s = 0;
2186
+ for (let i = 0; i < e; ++i)
2187
+ this._value.indexOf(this.thousandsSeparator, i) === i && (++s, t && (e += this.thousandsSeparator.length));
2188
+ return s;
2189
+ }
2190
+ _separatorsCountFromSlice(e) {
2191
+ return e === void 0 && (e = this._value), this._separatorsCount(this._removeThousandsSeparators(e).length, !0);
2192
+ }
2193
+ extractInput(e, t, s) {
2194
+ return e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t), this._removeThousandsSeparators(super.extractInput(e, t, s));
2195
+ }
2196
+ _appendCharRaw(e, t) {
2197
+ t === void 0 && (t = {});
2198
+ const s = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, i = this._separatorsCountFromSlice(s);
2199
+ this._value = this._removeThousandsSeparators(this.value);
2200
+ const a = this._value;
2201
+ this._value += e;
2202
+ const u = this.number;
2203
+ let n = !isNaN(u), l = !1;
2204
+ if (n) {
2205
+ let k;
2206
+ this.min != null && this.min < 0 && this.number < this.min && (k = this.min), this.max != null && this.max > 0 && this.number > this.max && (k = this.max), k != null && (this.autofix ? (this._value = this.format(k, this).replace(x.UNMASKED_RADIX, this.radix), l || (l = a === this._value && !t.tail)) : n = !1), n && (n = !!this._value.match(this._numberRegExp));
2207
+ }
2208
+ let o;
2209
+ n ? o = new c({
2210
+ inserted: this._value.slice(a.length),
2211
+ rawInserted: l ? "" : e,
2212
+ skip: l
2213
+ }) : (this._value = a, o = new c()), this._value = this._insertThousandsSeparators(this._value);
2214
+ const h = t.tail && t._beforeTailState ? t._beforeTailState._value : this._value, m = this._separatorsCountFromSlice(h);
2215
+ return o.tailShift += (m - i) * this.thousandsSeparator.length, o;
2216
+ }
2217
+ _findSeparatorAround(e) {
2218
+ if (this.thousandsSeparator) {
2219
+ const t = e - this.thousandsSeparator.length + 1, s = this.value.indexOf(this.thousandsSeparator, t);
2220
+ if (s <= e) return s;
2221
+ }
2222
+ return -1;
2223
+ }
2224
+ _adjustRangeWithSeparators(e, t) {
2225
+ const s = this._findSeparatorAround(e);
2226
+ s >= 0 && (e = s);
2227
+ const i = this._findSeparatorAround(t);
2228
+ return i >= 0 && (t = i + this.thousandsSeparator.length), [e, t];
2229
+ }
2230
+ remove(e, t) {
2231
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length), [e, t] = this._adjustRangeWithSeparators(e, t);
2232
+ const s = this.value.slice(0, e), i = this.value.slice(t), a = this._separatorsCount(s.length);
2233
+ this._value = this._insertThousandsSeparators(this._removeThousandsSeparators(s + i));
2234
+ const u = this._separatorsCountFromSlice(s);
2235
+ return new c({
2236
+ tailShift: (u - a) * this.thousandsSeparator.length
2237
+ });
2238
+ }
2239
+ nearestInputPos(e, t) {
2240
+ if (!this.thousandsSeparator) return e;
2241
+ switch (t) {
2242
+ case d.NONE:
2243
+ case d.LEFT:
2244
+ case d.FORCE_LEFT: {
2245
+ const s = this._findSeparatorAround(e - 1);
2246
+ if (s >= 0) {
2247
+ const i = s + this.thousandsSeparator.length;
2248
+ if (e < i || this.value.length <= i || t === d.FORCE_LEFT)
2249
+ return s;
2250
+ }
2251
+ break;
2252
+ }
2253
+ case d.RIGHT:
2254
+ case d.FORCE_RIGHT: {
2255
+ const s = this._findSeparatorAround(e);
2256
+ if (s >= 0)
2257
+ return s + this.thousandsSeparator.length;
2258
+ }
2259
+ }
2260
+ return e;
2261
+ }
2262
+ doCommit() {
2263
+ if (this.value) {
2264
+ const e = this.number;
2265
+ let t = e;
2266
+ this.min != null && (t = Math.max(t, this.min)), this.max != null && (t = Math.min(t, this.max)), t !== e && (this.unmaskedValue = this.format(t, this));
2267
+ let s = this.value;
2268
+ this.normalizeZeros && (s = this._normalizeZeros(s)), this.padFractionalZeros && this.scale > 0 && (s = this._padFractionalZeros(s)), this._value = s;
2269
+ }
2270
+ super.doCommit();
2271
+ }
2272
+ _normalizeZeros(e) {
2273
+ const t = this._removeThousandsSeparators(e).split(this.radix);
2274
+ return t[0] = t[0].replace(/^(\D*)(0*)(\d*)/, (s, i, a, u) => i + u), e.length && !/\d$/.test(t[0]) && (t[0] = t[0] + "0"), t.length > 1 && (t[1] = t[1].replace(/0*$/, ""), t[1].length || (t.length = 1)), this._insertThousandsSeparators(t.join(this.radix));
2275
+ }
2276
+ _padFractionalZeros(e) {
2277
+ if (!e) return e;
2278
+ const t = e.split(this.radix);
2279
+ return t.length < 2 && t.push(""), t[1] = t[1].padEnd(this.scale, "0"), t.join(this.radix);
2280
+ }
2281
+ doSkipInvalid(e, t, s) {
2282
+ t === void 0 && (t = {});
2283
+ const i = this.scale === 0 && e !== this.thousandsSeparator && (e === this.radix || e === x.UNMASKED_RADIX || this.mapToRadix.includes(e));
2284
+ return super.doSkipInvalid(e, t, s) && !i;
2285
+ }
2286
+ get unmaskedValue() {
2287
+ return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, x.UNMASKED_RADIX);
2288
+ }
2289
+ set unmaskedValue(e) {
2290
+ super.unmaskedValue = e;
2291
+ }
2292
+ get typedValue() {
2293
+ return this.parse(this.unmaskedValue, this);
2294
+ }
2295
+ set typedValue(e) {
2296
+ this.rawInputValue = this.format(e, this).replace(x.UNMASKED_RADIX, this.radix);
2297
+ }
2298
+ /** Parsed Number */
2299
+ get number() {
2300
+ return this.typedValue;
2301
+ }
2302
+ set number(e) {
2303
+ this.typedValue = e;
2304
+ }
2305
+ get allowNegative() {
2306
+ return this.min != null && this.min < 0 || this.max != null && this.max < 0;
2307
+ }
2308
+ get allowPositive() {
2309
+ return this.min != null && this.min > 0 || this.max != null && this.max > 0;
2310
+ }
2311
+ typedValueEquals(e) {
2312
+ return (super.typedValueEquals(e) || x.EMPTY_VALUES.includes(e) && x.EMPTY_VALUES.includes(this.typedValue)) && !(e === 0 && this.value === "");
2313
+ }
2314
+ }
2315
+ Se = x;
2316
+ x.UNMASKED_RADIX = ".";
2317
+ x.EMPTY_VALUES = [...y.EMPTY_VALUES, 0];
2318
+ x.DEFAULTS = {
2319
+ ...y.DEFAULTS,
2320
+ mask: Number,
2321
+ radix: ",",
2322
+ thousandsSeparator: "",
2323
+ mapToRadix: [Se.UNMASKED_RADIX],
2324
+ min: Number.MIN_SAFE_INTEGER,
2325
+ max: Number.MAX_SAFE_INTEGER,
2326
+ scale: 2,
2327
+ normalizeZeros: !0,
2328
+ padFractionalZeros: !1,
2329
+ parse: Number,
2330
+ format: (r) => r.toLocaleString("en-US", {
2331
+ useGrouping: !1,
2332
+ maximumFractionDigits: 20
2333
+ })
2334
+ };
2335
+ p.MaskedNumber = x;
2336
+ const he = {
2337
+ MASKED: "value",
2338
+ UNMASKED: "unmaskedValue",
2339
+ TYPED: "typedValue"
2340
+ };
2341
+ function Ve(r, e, t) {
2342
+ e === void 0 && (e = he.MASKED), t === void 0 && (t = he.MASKED);
2343
+ const s = B(r);
2344
+ return (i) => s.runIsolated((a) => (a[e] = i, a[t]));
2345
+ }
2346
+ function st(r, e, t, s) {
2347
+ return Ve(e, t, s)(r);
2348
+ }
2349
+ p.PIPE_TYPE = he;
2350
+ p.createPipe = Ve;
2351
+ p.pipe = st;
2352
+ class it extends C {
2353
+ get repeatFrom() {
2354
+ var e;
2355
+ return (e = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? e : 0;
2356
+ }
2357
+ get repeatTo() {
2358
+ var e;
2359
+ return (e = Array.isArray(this.repeat) ? this.repeat[1] : this.repeat) != null ? e : 1 / 0;
2360
+ }
2361
+ constructor(e) {
2362
+ super(e);
2363
+ }
2364
+ updateOptions(e) {
2365
+ super.updateOptions(e);
2366
+ }
2367
+ _update(e) {
2368
+ var t, s, i;
2369
+ const {
2370
+ repeat: a,
2371
+ ...u
2372
+ } = G(e);
2373
+ this._blockOpts = Object.assign({}, this._blockOpts, u);
2374
+ const n = B(this._blockOpts);
2375
+ this.repeat = (t = (s = a ?? n.repeat) != null ? s : this.repeat) != null ? t : 1 / 0, super._update({
2376
+ mask: "m".repeat(Math.max(this.repeatTo === 1 / 0 && ((i = this._blocks) == null ? void 0 : i.length) || 0, this.repeatFrom)),
2377
+ blocks: {
2378
+ m: n
2379
+ },
2380
+ eager: n.eager,
2381
+ overwrite: n.overwrite,
2382
+ skipInvalid: n.skipInvalid,
2383
+ lazy: n.lazy,
2384
+ placeholderChar: n.placeholderChar,
2385
+ displayChar: n.displayChar
2386
+ });
2387
+ }
2388
+ _allocateBlock(e) {
2389
+ if (e < this._blocks.length) return this._blocks[e];
2390
+ if (this.repeatTo === 1 / 0 || this._blocks.length < this.repeatTo)
2391
+ return this._blocks.push(B(this._blockOpts)), this.mask += "m", this._blocks[this._blocks.length - 1];
2392
+ }
2393
+ _appendCharRaw(e, t) {
2394
+ t === void 0 && (t = {});
2395
+ const s = new c();
2396
+ for (
2397
+ let l = (i = (a = this._mapPosToBlock(this.displayValue.length)) == null ? void 0 : a.index) != null ? i : Math.max(this._blocks.length - 1, 0), o, h;
2398
+ // try to get a block or
2399
+ // try to allocate a new block if not allocated already
2400
+ o = (u = this._blocks[l]) != null ? u : h = !h && this._allocateBlock(l);
2401
+ ++l
2402
+ ) {
2403
+ var i, a, u, n;
2404
+ const m = o._appendChar(e, {
2405
+ ...t,
2406
+ _beforeTailState: (n = t._beforeTailState) == null || (n = n._blocks) == null ? void 0 : n[l]
2407
+ });
2408
+ if (m.skip && h) {
2409
+ this._blocks.pop(), this.mask = this.mask.slice(1);
2410
+ break;
2411
+ }
2412
+ if (s.aggregate(m), m.consumed) break;
2413
+ }
2414
+ return s;
2415
+ }
2416
+ _trimEmptyTail(e, t) {
2417
+ var s, i;
2418
+ e === void 0 && (e = 0);
2419
+ const a = Math.max(((s = this._mapPosToBlock(e)) == null ? void 0 : s.index) || 0, this.repeatFrom, 0);
2420
+ let u;
2421
+ t != null && (u = (i = this._mapPosToBlock(t)) == null ? void 0 : i.index), u == null && (u = this._blocks.length - 1);
2422
+ let n = 0;
2423
+ for (let l = u; a <= l && !this._blocks[l].unmaskedValue; --l, ++n)
2424
+ ;
2425
+ n && (this._blocks.splice(u - n + 1, n), this.mask = this.mask.slice(n));
2426
+ }
2427
+ reset() {
2428
+ super.reset(), this._trimEmptyTail();
2429
+ }
2430
+ remove(e, t) {
2431
+ e === void 0 && (e = 0), t === void 0 && (t = this.displayValue.length);
2432
+ const s = super.remove(e, t);
2433
+ return this._trimEmptyTail(e, t), s;
2434
+ }
2435
+ totalInputPositions(e, t) {
2436
+ return e === void 0 && (e = 0), t == null && this.repeatTo === 1 / 0 ? 1 / 0 : super.totalInputPositions(e, t);
2437
+ }
2438
+ get state() {
2439
+ return super.state;
2440
+ }
2441
+ set state(e) {
2442
+ this._blocks.length = e._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = e;
2443
+ }
2444
+ }
2445
+ p.RepeatBlock = it;
2446
+ try {
2447
+ globalThis.IMask = p;
2448
+ } catch {
2449
+ }
2450
+ var at = {
2451
+ // common
2452
+ mask: void 0,
2453
+ prepare: Function,
2454
+ prepareChar: Function,
2455
+ validate: Function,
2456
+ commit: Function,
2457
+ overwrite: {
2458
+ type: Boolean,
2459
+ required: !1,
2460
+ default: void 0
2461
+ },
2462
+ eager: {
2463
+ required: !1,
2464
+ default: void 0,
2465
+ validator: (r) => ["append", "remove"].includes(r) || typeof r == "boolean"
2466
+ },
2467
+ skipInvalid: {
2468
+ type: Boolean,
2469
+ required: !1,
2470
+ default: void 0
2471
+ },
2472
+ // pattern
2473
+ placeholderChar: String,
2474
+ displayChar: String,
2475
+ lazy: {
2476
+ type: Boolean,
2477
+ required: !1,
2478
+ default: void 0
2479
+ },
2480
+ definitions: Object,
2481
+ blocks: Object,
2482
+ // enum
2483
+ enum: Array,
2484
+ // range
2485
+ maxLength: Number,
2486
+ from: Number,
2487
+ to: Number,
2488
+ // date
2489
+ pattern: String,
2490
+ format: Function,
2491
+ parse: Function,
2492
+ autofix: {
2493
+ required: !1,
2494
+ default: void 0,
2495
+ validator: (r) => r === "pad" || typeof r == "boolean"
2496
+ },
2497
+ // number
2498
+ radix: String,
2499
+ thousandsSeparator: String,
2500
+ mapToRadix: Array,
2501
+ scale: Number,
2502
+ normalizeZeros: {
2503
+ type: Boolean,
2504
+ required: !1,
2505
+ default: void 0
2506
+ },
2507
+ padFractionalZeros: {
2508
+ type: Boolean,
2509
+ required: !1,
2510
+ default: void 0
2511
+ },
2512
+ min: [Number, Date],
2513
+ max: [Number, Date],
2514
+ // dynamic
2515
+ dispatch: Function
2516
+ };
2517
+ function ut(r, e) {
2518
+ let {
2519
+ emit: t,
2520
+ onAccept: s,
2521
+ onComplete: i,
2522
+ defaultValue: a,
2523
+ defaultUnmaskedValue: u,
2524
+ defaultTypedValue: n
2525
+ } = e === void 0 ? {} : e;
2526
+ const l = Me(r) ? r : D(r), o = D(), h = D(), m = D(""), k = D(""), g = D();
2527
+ let f, E = m.value, b = k.value, re = g.value;
2528
+ function pe() {
2529
+ re = g.value = h.value.typedValue, b = k.value = h.value.unmaskedValue, E = m.value = h.value.value;
2530
+ }
2531
+ function $(v) {
2532
+ pe(), t && (t("accept", m.value, v), t("accept:masked", m.value, v), t("accept:typed", g.value, v), t("accept:unmasked", k.value, v)), s?.(v);
2533
+ }
2534
+ function Be(v) {
2535
+ t && (t("complete", h.value.value, v), t("complete:masked", h.value.value, v), t("complete:typed", h.value.typedValue, v), t("complete:unmasked", h.value.unmaskedValue, v)), i?.(v);
2536
+ }
2537
+ const ce = () => {
2538
+ !h.value || k.value === void 0 || (b !== k.value && (h.value.unmaskedValue = k.value, h.value.unmaskedValue !== k.value && $()), b = void 0);
2539
+ };
2540
+ w(k, ce);
2541
+ const me = () => {
2542
+ !h.value || m.value === void 0 || (E !== m.value && (h.value.value = m.value, h.value.value !== m.value && $()), E = void 0);
2543
+ };
2544
+ w(m, me);
2545
+ const ge = () => {
2546
+ !h.value || g.value === void 0 || (re !== g.value && (h.value.typedValue = g.value, h.value.masked.typedValueEquals(g.value) || $()), re = void 0);
2547
+ };
2548
+ w(g, ge);
2549
+ function fe() {
2550
+ f = o.value;
2551
+ const v = l.value;
2552
+ !f || !(v != null && v.mask) || (h.value = p(f, v), a !== void 0 && (m.value = a), u !== void 0 && (k.value = u), n !== void 0 && (g.value = n), ce(), me(), ge(), pe(), h.value.on("accept", $).on("complete", Be));
2553
+ }
2554
+ function ke() {
2555
+ var v;
2556
+ (v = h.value) == null || v.destroy(), h.value = void 0;
2557
+ }
2558
+ return Pe(fe), Oe(ke), w([o, l], () => {
2559
+ const v = o.value, ne = l.value;
2560
+ (!(ne != null && ne.mask) || v !== f) && ke(), v && (h.value ? h.value.updateOptions(ne) : fe());
2561
+ }), {
2562
+ el: o,
2563
+ mask: Re(h),
2564
+ masked: m,
2565
+ unmasked: k,
2566
+ typed: g
2567
+ };
2568
+ }
2569
+ function rt(r, e) {
2570
+ return r = {
2571
+ ...r
2572
+ }, Object.keys(r).forEach((t) => {
2573
+ (r[t] === void 0 || e.includes(t)) && delete r[t];
2574
+ }), r;
2575
+ }
2576
+ const nt = ["typed", "unmasked", "value", "modelValue"];
2577
+ var lt = K({
2578
+ name: "imask-input",
2579
+ inheritAttrs: !1,
2580
+ props: {
2581
+ // plugin
2582
+ modelValue: String,
2583
+ value: String,
2584
+ unmasked: String,
2585
+ typed: {
2586
+ validator: () => !0
2587
+ },
2588
+ ...at
2589
+ },
2590
+ emits: ["update:modelValue", "update:masked", "update:value", "update:unmasked", "update:typed", "accept", "accept:value", "accept:masked", "accept:unmasked", "accept:typed", "complete", "complete:value", "complete:masked", "complete:unmasked", "complete:typed"],
2591
+ setup(r, e) {
2592
+ let {
2593
+ attrs: t,
2594
+ emit: s
2595
+ } = e;
2596
+ const {
2597
+ el: i,
2598
+ mask: a,
2599
+ masked: u,
2600
+ unmasked: n,
2601
+ typed: l
2602
+ } = ut(rt(r, nt), {
2603
+ emit: s,
2604
+ onAccept: (g) => {
2605
+ const f = u.value;
2606
+ s("accept:value", f, g), s("update:value", f, g), s("update:masked", f, g), s("update:modelValue", f, g), s("update:unmasked", n.value, g), s("update:typed", l.value, g);
2607
+ },
2608
+ onComplete: (g) => {
2609
+ s("complete:value", u.value, g);
2610
+ }
2611
+ }), o = z(r, "value"), h = z(r, "modelValue"), m = z(r, "unmasked"), k = z(r, "typed");
2612
+ return u.value = h.value || o.value || "", n.value = m.value || "", l.value = k.value, w(o, (g) => u.value = g), w(h, (g) => u.value = g), w(m, (g) => n.value = g), w(k, (g) => l.value = g), () => {
2613
+ const g = {
2614
+ ...t,
2615
+ value: r.value != null ? r.value : r.modelValue != null ? r.modelValue : a.value ? a.value.displayValue : "",
2616
+ ref: i
2617
+ };
2618
+ return r.mask || (g.onInput = (f) => {
2619
+ s("update:modelValue", f.target.value), s("update:value", f.target.value);
2620
+ }), De("input", g);
2621
+ };
2622
+ }
2623
+ }), ot = lt;
2624
+ const ht = ["for"], dt = { class: "state-layer" }, pt = { class: "content" }, ct = { class: "input-text-container" }, mt = ["id", "placeholder", "aria-label"], gt = {
97
2625
  key: 1,
98
2626
  class: "has-text-body-small phila-supporting-text"
99
- }, le = {
2627
+ }, ft = {
100
2628
  key: 2,
101
2629
  class: "has-text-body-small phila-error-text"
102
- }, ie = /* @__PURE__ */ O({
2630
+ }, kt = /* @__PURE__ */ K({
103
2631
  inheritAttrs: !1,
104
2632
  __name: "TextField",
105
2633
  props: {
@@ -107,6 +2635,7 @@ const X = ["for"], Y = { class: "state-layer" }, Z = { class: "content" }, ee =
107
2635
  className: { default: "" },
108
2636
  label: { default: "" },
109
2637
  id: { default: `phila-text-field-${Math.random().toString(36).substring(2, 9)}` },
2638
+ imaskProps: { default: void 0 },
110
2639
  supportingText: { default: "" },
111
2640
  placeholder: { default: "" },
112
2641
  leadingIcon: { default: "" },
@@ -115,86 +2644,95 @@ const X = ["for"], Y = { class: "state-layer" }, Z = { class: "content" }, ee =
115
2644
  return [];
116
2645
  } }
117
2646
  },
118
- emits: ["update:modelValue"],
119
- setup(u, { emit: e }) {
120
- const r = I(), t = u, c = o(() => typeof t.error == "string" ? t.error : t.error[0]), d = P(t, "id"), a = e, f = L(""), n = o({
121
- get: () => t.modelValue !== void 0 ? t.modelValue : f.value,
122
- set: (i) => {
123
- a("update:modelValue", i), f.value = i;
2647
+ emits: ["update:modelValue", "complete"],
2648
+ setup(r, { emit: e }) {
2649
+ const t = Ee(), s = r, i = F(() => typeof s.error == "string" ? s.error : s.error[0]), a = z(s, "id"), u = e, n = D(""), l = F({
2650
+ get: () => s.modelValue !== void 0 ? s.modelValue : n.value,
2651
+ set: (f) => {
2652
+ u("update:modelValue", f), n.value = f;
124
2653
  }
125
- }), g = o(() => {
126
- const i = ["default-class"];
127
- return r.disabled != null && i.push("phila-input--disabled"), c.value && i.push("phila-input--error"), r.required != null && i.push("phila-input--required"), V(...i);
128
- }), T = o(() => {
129
- const i = [];
130
- return n.value !== "" && i.push("phila-text-field--filled"), t.className && i.push(t.className), V(...i);
131
- }), D = L(null), A = (i) => {
132
- i.target.closest("button") || D.value?.focus();
2654
+ }), o = F(() => {
2655
+ const f = ["default-class"];
2656
+ return t.disabled != null && f.push("phila-input--disabled"), i.value && f.push("phila-input--error"), t.required != null && f.push("phila-input--required"), H(...f);
2657
+ }), h = F(() => {
2658
+ const f = [];
2659
+ return l.value !== "" && f.push("phila-text-field--filled"), s.className && f.push(s.className), H(...f);
2660
+ }), m = F(() => {
2661
+ if (!(s.label || t["aria-label"]))
2662
+ return s.placeholder || void 0;
2663
+ }), k = D(null), g = (f) => {
2664
+ f.target.closest("button") || k.value?.focus();
133
2665
  };
134
- return (i, $) => (s(), p("div", {
135
- class: w(["phila-input", g.value])
2666
+ return (f, E) => (A(), I("div", {
2667
+ class: ve(["phila-input", o.value])
136
2668
  }, [
137
- t.label ? (s(), p("label", {
2669
+ s.label ? (A(), I("label", {
138
2670
  key: 0,
139
- for: d.value,
2671
+ for: a.value,
140
2672
  class: "has-text-label-small phila-label"
141
- }, m(t.label), 9, X)) : y("", !0),
142
- x("div", {
143
- class: w(["phila-text-field", T.value]),
144
- onClick: A
2673
+ }, R(s.label), 9, ht)) : N("", !0),
2674
+ Y("div", {
2675
+ class: ve(["phila-text-field", h.value]),
2676
+ onClick: Ie(g, ["prevent"])
145
2677
  }, [
146
- x("div", Y, [
147
- t.leadingIcon ? (s(), z(l(R), {
2678
+ Y("div", dt, [
2679
+ s.leadingIcon ? (A(), U(_(le), {
148
2680
  key: 0,
149
- "icon-class": t.leadingIcon,
2681
+ "icon-class": s.leadingIcon,
150
2682
  inline: "",
151
2683
  decorative: ""
152
- }, null, 8, ["icon-class"])) : y("", !0),
153
- x("div", Z, [
154
- x("div", ee, [
155
- q(x("input", b({
156
- id: d.value,
157
- ref_key: "inputRef",
158
- ref: D,
159
- "onUpdate:modelValue": $[0] || ($[0] = (S) => n.value = S),
2684
+ }, null, 8, ["icon-class"])) : N("", !0),
2685
+ Y("div", pt, [
2686
+ Y("div", ct, [
2687
+ s.imaskProps?.mask ? (A(), U(_(ot), O({ key: 0 }, { ..._(t), ...s.imaskProps }, {
2688
+ id: a.value,
2689
+ modelValue: l.value,
2690
+ "onUpdate:modelValue": E[0] || (E[0] = (b) => l.value = b),
2691
+ class: "phila-text-field-input has-text-body-default",
2692
+ placeholder: s.placeholder,
2693
+ onComplete: E[1] || (E[1] = () => u("complete", n.value))
2694
+ }), null, 16, ["id", "modelValue", "placeholder"])) : we((A(), I("input", O({ key: 1 }, _(t), {
2695
+ id: a.value,
2696
+ "onUpdate:modelValue": E[2] || (E[2] = (b) => l.value = b),
160
2697
  class: "phila-text-field-input has-text-body-default",
161
- placeholder: t.placeholder
162
- }, l(r)), null, 16, te), [
163
- [E, n.value]
2698
+ placeholder: s.placeholder,
2699
+ "aria-label": m.value
2700
+ }), null, 16, mt)), [
2701
+ [Te, l.value]
164
2702
  ])
165
2703
  ])
166
2704
  ]),
167
- n.value != "" ? (s(), z(l(F), {
2705
+ l.value != "" ? (A(), U(_(je), {
168
2706
  key: 1,
169
2707
  variant: "standard",
170
2708
  size: "small",
171
2709
  "icon-only": "",
172
- "icon-definition": l(W),
173
- onClick: $[1] || ($[1] = (S) => n.value = "")
174
- }, null, 8, ["icon-definition"])) : y("", !0),
175
- t.trailingIcon ? (s(), z(l(R), {
2710
+ "icon-definition": _(Ke),
2711
+ onClick: E[3] || (E[3] = (b) => l.value = "")
2712
+ }, null, 8, ["icon-definition"])) : N("", !0),
2713
+ s.trailingIcon ? (A(), U(_(le), {
176
2714
  key: 2,
177
2715
  size: "small",
178
- "icon-class": t.trailingIcon,
2716
+ "icon-class": s.trailingIcon,
179
2717
  inline: "",
180
2718
  decorative: ""
181
- }, null, 8, ["icon-class"])) : y("", !0),
182
- k(i.$slots, "trailing-action")
2719
+ }, null, 8, ["icon-class"])) : N("", !0),
2720
+ j(f.$slots, "trailing-action")
183
2721
  ])
184
2722
  ], 2),
185
- t.supportingText ? (s(), p("div", ae, m(t.supportingText), 1)) : y("", !0),
186
- c.value ? (s(), p("div", le, [
187
- v(l(R), {
188
- "icon-definition": l(J),
2723
+ s.supportingText ? (A(), I("div", gt, R(s.supportingText), 1)) : N("", !0),
2724
+ i.value ? (A(), I("div", ft, [
2725
+ L(_(le), {
2726
+ "icon-definition": _(He),
189
2727
  size: "small",
190
2728
  inline: "",
191
2729
  decorative: ""
192
2730
  }, null, 8, ["icon-definition"]),
193
- N(" " + m(c.value), 1)
194
- ])) : y("", !0)
2731
+ q(" " + R(i.value), 1)
2732
+ ])) : N("", !0)
195
2733
  ], 2));
196
2734
  }
197
- }), ne = ["disabled"], se = /* @__PURE__ */ O({
2735
+ }), vt = ["disabled"], _t = /* @__PURE__ */ K({
198
2736
  inheritAttrs: !1,
199
2737
  __name: "PhlButton",
200
2738
  props: {
@@ -215,25 +2753,25 @@ const X = ["for"], Y = { class: "state-layer" }, Z = { class: "content" }, ee =
215
2753
  src: {},
216
2754
  svgRaw: {}
217
2755
  },
218
- setup(u) {
219
- const e = u, r = (a) => "href" in a && a.href !== void 0 || "to" in a && a.to !== void 0, t = o(() => V(
2756
+ setup(r) {
2757
+ const e = r, t = (u) => "href" in u && u.href !== void 0 || "to" in u && u.to !== void 0, s = F(() => H(
220
2758
  "phila-button",
221
2759
  `phila-button--${e.variant}`,
222
2760
  e.size && `is-${e.size}`,
223
2761
  e.iconOnly && "icon-button",
224
2762
  e.iconOnly && e.variant === "standard" && "icon-button--standard",
225
2763
  e.className
226
- )), c = o(() => r(e) ? "to" in e && e.to !== void 0 ? {
2764
+ )), i = F(() => t(e) ? "to" in e && e.to !== void 0 ? {
227
2765
  to: e.to,
228
2766
  disabled: e.disabled,
229
- className: t.value
2767
+ className: s.value
230
2768
  } : {
231
2769
  href: e.href,
232
2770
  target: e.target,
233
2771
  rel: e.rel,
234
2772
  disabled: e.disabled,
235
- className: t.value
236
- } : {}), d = o(
2773
+ className: s.value
2774
+ } : {}), a = F(
237
2775
  () => ({
238
2776
  iconDefinition: e.iconDefinition,
239
2777
  iconClass: e.iconClass,
@@ -244,35 +2782,35 @@ const X = ["for"], Y = { class: "state-layer" }, Z = { class: "content" }, ee =
244
2782
  size: e.size
245
2783
  })
246
2784
  );
247
- return (a, f) => r(e) ? (s(), z(l(M), b({ key: 0 }, { ...c.value, ...a.$attrs }, { role: "button" }), {
248
- default: h(() => [
249
- v(l(B), C(_(d.value)), {
250
- default: h(() => [
251
- k(a.$slots, "default", {}, () => [
252
- N(m(e.text), 1)
2785
+ return (u, n) => t(e) ? (A(), U(_(Fe), O({ key: 0 }, { ...i.value, ...u.$attrs }, { role: "button" }), {
2786
+ default: P(() => [
2787
+ L(_(Q), W(J(a.value)), {
2788
+ default: P(() => [
2789
+ j(u.$slots, "default", {}, () => [
2790
+ q(R(e.text), 1)
253
2791
  ])
254
2792
  ]),
255
2793
  _: 3
256
2794
  }, 16)
257
2795
  ]),
258
2796
  _: 3
259
- }, 16)) : (s(), p("button", b({
2797
+ }, 16)) : (A(), I("button", O({
260
2798
  key: 1,
261
2799
  type: "button",
262
2800
  disabled: e.disabled,
263
- class: t.value
264
- }, a.$attrs), [
265
- v(l(B), C(_(d.value)), {
266
- default: h(() => [
267
- k(a.$slots, "default", {}, () => [
268
- N(m(e.text), 1)
2801
+ class: s.value
2802
+ }, u.$attrs), [
2803
+ L(_(Q), W(J(a.value)), {
2804
+ default: P(() => [
2805
+ j(u.$slots, "default", {}, () => [
2806
+ q(R(e.text), 1)
269
2807
  ])
270
2808
  ]),
271
2809
  _: 3
272
2810
  }, 16)
273
- ], 16, ne));
2811
+ ], 16, vt));
274
2812
  }
275
- }), ce = /* @__PURE__ */ O({
2813
+ }), Ft = /* @__PURE__ */ K({
276
2814
  inheritAttrs: !1,
277
2815
  __name: "Search",
278
2816
  props: {
@@ -281,37 +2819,38 @@ const X = ["for"], Y = { class: "state-layer" }, Z = { class: "content" }, ee =
281
2819
  className: {}
282
2820
  },
283
2821
  emits: ["update:modelValue", "search"],
284
- setup(u, { emit: e }) {
285
- const r = I(), t = u, c = e, d = o({
286
- get: () => t.modelValue,
287
- set: (f) => c("update:modelValue", f)
288
- }), a = o(() => V("default-class", t.className));
289
- return (f, n) => (s(), p("div", b({
290
- class: ["search", a.value]
291
- }, l(r)), [
292
- v(l(ie), {
293
- modelValue: d.value,
294
- "onUpdate:modelValue": n[1] || (n[1] = (g) => d.value = g),
2822
+ setup(r, { emit: e }) {
2823
+ const t = Ee(), s = r, i = e, a = F({
2824
+ get: () => s.modelValue,
2825
+ set: (o) => i("update:modelValue", o)
2826
+ }), u = F(() => t["aria-label"]), n = F(() => Object.fromEntries(Object.entries(t).filter(([o]) => o !== "aria-label"))), l = F(() => H("default-class", s.className));
2827
+ return (o, h) => (A(), I("div", O({
2828
+ class: ["search", l.value]
2829
+ }, n.value), [
2830
+ L(_(kt), {
2831
+ modelValue: a.value,
2832
+ "onUpdate:modelValue": h[1] || (h[1] = (m) => a.value = m),
295
2833
  "class-name": "phila-text-field--search",
296
- placeholder: u.placeholder,
297
- onKeydown: n[2] || (n[2] = K((g) => c("search"), ["enter"]))
2834
+ placeholder: r.placeholder,
2835
+ "aria-label": u.value,
2836
+ onKeydown: h[2] || (h[2] = Le((m) => i("search"), ["enter"]))
298
2837
  }, {
299
- "trailing-action": h(() => [
300
- v(l(se), {
2838
+ "trailing-action": P(() => [
2839
+ L(_(_t), {
301
2840
  variant: "standard",
302
2841
  size: "small",
303
2842
  "icon-only": "",
304
- "icon-definition": l(G),
2843
+ "icon-definition": _(Ue),
305
2844
  "aria-label": "Search",
306
2845
  "class-name": "phila-button--search",
307
- onClick: n[0] || (n[0] = (g) => c("search"))
2846
+ onClick: h[0] || (h[0] = (m) => i("search"))
308
2847
  }, null, 8, ["icon-definition"])
309
2848
  ]),
310
2849
  _: 1
311
- }, 8, ["modelValue", "placeholder"])
2850
+ }, 8, ["modelValue", "placeholder", "aria-label"])
312
2851
  ], 16));
313
2852
  }
314
2853
  });
315
2854
  export {
316
- ce as Search
2855
+ Ft as Search
317
2856
  };