@phila/phila-ui-core 1.0.12 → 1.0.15
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/phila-ui-core.js +39 -38
- package/dist/phila-ui-core.umd.cjs +1 -1
- package/package.json +2 -2
package/dist/phila-ui-core.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { reactive as ut, computed as M, watch as A, onMounted as nt, ref as
|
|
1
|
+
import { reactive as ut, computed as M, watch as A, onMounted as nt, ref as V, onBeforeMount as ft, isRef as kt, onUnmounted as mt, readonly as gt, defineComponent as _t, toRef as R, h as vt } from "vue";
|
|
2
2
|
const D = ut({
|
|
3
3
|
isMobile: !1,
|
|
4
4
|
isTablet: !1,
|
|
@@ -63,7 +63,7 @@ const D = ut({
|
|
|
63
63
|
__proto__: null,
|
|
64
64
|
useTextboxComposable: yt
|
|
65
65
|
}, Symbol.toStringTag, { value: "Module" })), Bt = (u, t) => {
|
|
66
|
-
const e =
|
|
66
|
+
const e = V(""), s = ut({
|
|
67
67
|
mask: "",
|
|
68
68
|
lazy: !1
|
|
69
69
|
});
|
|
@@ -93,7 +93,7 @@ const D = ut({
|
|
|
93
93
|
(o = l.target.maskRef) != null && o._unmaskedValue || (s.lazy = !0);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
|
-
},
|
|
96
|
+
}, Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
97
97
|
__proto__: null,
|
|
98
98
|
useMaskedInputComposable: Bt
|
|
99
99
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
@@ -117,7 +117,7 @@ const h = {
|
|
|
117
117
|
RIGHT: "RIGHT",
|
|
118
118
|
FORCE_RIGHT: "FORCE_RIGHT"
|
|
119
119
|
};
|
|
120
|
-
function
|
|
120
|
+
function bt(u) {
|
|
121
121
|
switch (u) {
|
|
122
122
|
case h.LEFT:
|
|
123
123
|
return h.FORCE_LEFT;
|
|
@@ -398,7 +398,7 @@ class ot extends U {
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
p.HTMLContenteditableMaskElement = ot;
|
|
401
|
-
class
|
|
401
|
+
class P {
|
|
402
402
|
constructor() {
|
|
403
403
|
this.states = [], this.currentIndex = 0;
|
|
404
404
|
}
|
|
@@ -409,7 +409,7 @@ class j {
|
|
|
409
409
|
return this.states.length === 0;
|
|
410
410
|
}
|
|
411
411
|
push(t) {
|
|
412
|
-
this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(t), this.states.length >
|
|
412
|
+
this.currentIndex < this.states.length - 1 && (this.states.length = this.currentIndex + 1), this.states.push(t), this.states.length > P.MAX_LENGTH && this.states.shift(), this.currentIndex = this.states.length - 1;
|
|
413
413
|
}
|
|
414
414
|
go(t) {
|
|
415
415
|
return this.currentIndex = Math.min(Math.max(this.currentIndex + t, 0), this.states.length - 1), this.currentState;
|
|
@@ -424,14 +424,14 @@ class j {
|
|
|
424
424
|
this.states.length = 0, this.currentIndex = 0;
|
|
425
425
|
}
|
|
426
426
|
}
|
|
427
|
-
|
|
427
|
+
P.MAX_LENGTH = 100;
|
|
428
428
|
class wt {
|
|
429
429
|
/**
|
|
430
430
|
View element
|
|
431
431
|
*/
|
|
432
432
|
/** Internal {@link Masked} model */
|
|
433
433
|
constructor(t, e) {
|
|
434
|
-
this.el = t instanceof Y ? t : t.isContentEditable && t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" ? new ot(t) : new Mt(t), this.masked = y(e), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new
|
|
434
|
+
this.el = t instanceof Y ? t : t.isContentEditable && t.tagName !== "INPUT" && t.tagName !== "TEXTAREA" ? new ot(t) : new Mt(t), this.masked = y(e), this._listeners = {}, this._value = "", this._unmaskedValue = "", this._rawInputValue = "", this.history = new P(), 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();
|
|
435
435
|
}
|
|
436
436
|
maskEquals(t) {
|
|
437
437
|
var e;
|
|
@@ -925,7 +925,7 @@ class _ {
|
|
|
925
925
|
});
|
|
926
926
|
const n = t + e, r = this.extractTail(n), l = this.eager === !0 || this.eager === "remove";
|
|
927
927
|
let o;
|
|
928
|
-
l && (i =
|
|
928
|
+
l && (i = bt(i), o = this.extractInput(0, n, {
|
|
929
929
|
raw: !0
|
|
930
930
|
}));
|
|
931
931
|
let d = t;
|
|
@@ -960,7 +960,7 @@ _.DEFAULTS = {
|
|
|
960
960
|
};
|
|
961
961
|
_.EMPTY_VALUES = [void 0, null, ""];
|
|
962
962
|
p.Masked = _;
|
|
963
|
-
class
|
|
963
|
+
class b {
|
|
964
964
|
/** */
|
|
965
965
|
constructor(t, e) {
|
|
966
966
|
t === void 0 && (t = []), e === void 0 && (e = 0), this.chunks = t, this.from = e;
|
|
@@ -977,7 +977,7 @@ class V {
|
|
|
977
977
|
t.from === e.from + e.toString().length;
|
|
978
978
|
if (t instanceof F)
|
|
979
979
|
s ? e.extend(t.toString()) : this.chunks.push(t);
|
|
980
|
-
else if (t instanceof
|
|
980
|
+
else if (t instanceof b) {
|
|
981
981
|
if (t.stop == null) {
|
|
982
982
|
let i;
|
|
983
983
|
for (; t.chunks.length && t.chunks[0].stop == null; )
|
|
@@ -994,8 +994,8 @@ class V {
|
|
|
994
994
|
const i = this.chunks[s], a = t._mapPosToBlock(t.displayValue.length), n = i.stop;
|
|
995
995
|
let r;
|
|
996
996
|
if (n != null && // if block not found or stop is behind lastBlock
|
|
997
|
-
(!a || a.index <= n) && ((i instanceof
|
|
998
|
-
t._stops.indexOf(n) >= 0) && e.aggregate(t._appendPlaceholder(n)), r = i instanceof
|
|
997
|
+
(!a || a.index <= n) && ((i instanceof b || // for continuous block also check if stop is exist
|
|
998
|
+
t._stops.indexOf(n) >= 0) && e.aggregate(t._appendPlaceholder(n)), r = i instanceof b && t._blocks[n]), r) {
|
|
999
999
|
const l = r.appendTail(i);
|
|
1000
1000
|
e.aggregate(l);
|
|
1001
1001
|
const o = i.toString().slice(l.rawInserted.length);
|
|
@@ -1023,7 +1023,7 @@ class V {
|
|
|
1023
1023
|
...s
|
|
1024
1024
|
} = t;
|
|
1025
1025
|
Object.assign(this, s), this.chunks = e.map((i) => {
|
|
1026
|
-
const a = "chunks" in i ? new
|
|
1026
|
+
const a = "chunks" in i ? new b() : new F();
|
|
1027
1027
|
return a.state = i, a;
|
|
1028
1028
|
});
|
|
1029
1029
|
}
|
|
@@ -1600,10 +1600,10 @@ class v extends _ {
|
|
|
1600
1600
|
}
|
|
1601
1601
|
extractTail(t, e) {
|
|
1602
1602
|
t === void 0 && (t = 0), e === void 0 && (e = this.displayValue.length);
|
|
1603
|
-
const s = new
|
|
1603
|
+
const s = new b();
|
|
1604
1604
|
return t === e || this._forEachBlocksInRange(t, e, (i, a, n, r) => {
|
|
1605
1605
|
const l = i.extractTail(n, r);
|
|
1606
|
-
l.stop = this._findStopBefore(a), l.from = this._blockStartPos(a), l instanceof
|
|
1606
|
+
l.stop = this._findStopBefore(a), l.from = this._blockStartPos(a), l instanceof b && (l.blockIndex = a), s.extend(l);
|
|
1607
1607
|
}), s;
|
|
1608
1608
|
}
|
|
1609
1609
|
extractInput(t, e, s) {
|
|
@@ -1799,6 +1799,7 @@ class O extends v {
|
|
|
1799
1799
|
}
|
|
1800
1800
|
}
|
|
1801
1801
|
p.MaskedRange = O;
|
|
1802
|
+
const Ot = "d{.}`m{.}`Y";
|
|
1802
1803
|
class x extends v {
|
|
1803
1804
|
static extractPatternOptions(t) {
|
|
1804
1805
|
const {
|
|
@@ -1891,7 +1892,7 @@ x.GET_DEFAULT_BLOCKS = () => ({
|
|
|
1891
1892
|
x.DEFAULTS = {
|
|
1892
1893
|
...v.DEFAULTS,
|
|
1893
1894
|
mask: Date,
|
|
1894
|
-
pattern:
|
|
1895
|
+
pattern: Ot,
|
|
1895
1896
|
format: (u, t) => {
|
|
1896
1897
|
if (!u)
|
|
1897
1898
|
return "";
|
|
@@ -1904,10 +1905,10 @@ x.DEFAULTS = {
|
|
|
1904
1905
|
}
|
|
1905
1906
|
};
|
|
1906
1907
|
p.MaskedDate = x;
|
|
1907
|
-
class
|
|
1908
|
+
class j extends _ {
|
|
1908
1909
|
constructor(t) {
|
|
1909
1910
|
super({
|
|
1910
|
-
...
|
|
1911
|
+
...j.DEFAULTS,
|
|
1911
1912
|
...t
|
|
1912
1913
|
}), this.currentMask = void 0;
|
|
1913
1914
|
}
|
|
@@ -2101,7 +2102,7 @@ class P extends _ {
|
|
|
2101
2102
|
return !!((e = this.currentMask) != null && e.typedValueEquals(t));
|
|
2102
2103
|
}
|
|
2103
2104
|
}
|
|
2104
|
-
|
|
2105
|
+
j.DEFAULTS = {
|
|
2105
2106
|
..._.DEFAULTS,
|
|
2106
2107
|
dispatch: (u, t, e, s) => {
|
|
2107
2108
|
if (!t.compiledMasks.length)
|
|
@@ -2119,7 +2120,7 @@ P.DEFAULTS = {
|
|
|
2119
2120
|
return a.sort((n, r) => r.weight - n.weight || r.totalInputPositions - n.totalInputPositions), t.compiledMasks[a[0].index];
|
|
2120
2121
|
}
|
|
2121
2122
|
};
|
|
2122
|
-
p.MaskedDynamic =
|
|
2123
|
+
p.MaskedDynamic = j;
|
|
2123
2124
|
class H extends v {
|
|
2124
2125
|
constructor(t) {
|
|
2125
2126
|
super({
|
|
@@ -2178,7 +2179,7 @@ H.DEFAULTS = {
|
|
|
2178
2179
|
matchValue: (u, t, e) => u.indexOf(t, e) === e
|
|
2179
2180
|
};
|
|
2180
2181
|
p.MaskedEnum = H;
|
|
2181
|
-
class
|
|
2182
|
+
class Lt extends _ {
|
|
2182
2183
|
/** */
|
|
2183
2184
|
/** Enable characters overwriting */
|
|
2184
2185
|
/** */
|
|
@@ -2194,7 +2195,7 @@ class Ot extends _ {
|
|
|
2194
2195
|
});
|
|
2195
2196
|
}
|
|
2196
2197
|
}
|
|
2197
|
-
p.MaskedFunction =
|
|
2198
|
+
p.MaskedFunction = Lt;
|
|
2198
2199
|
var dt;
|
|
2199
2200
|
class C extends _ {
|
|
2200
2201
|
/** Single char */
|
|
@@ -2413,13 +2414,13 @@ function pt(u, t, e) {
|
|
|
2413
2414
|
const s = y(u);
|
|
2414
2415
|
return (i) => s.runIsolated((a) => (a[t] = i, a[e]));
|
|
2415
2416
|
}
|
|
2416
|
-
function
|
|
2417
|
+
function Nt(u, t, e, s) {
|
|
2417
2418
|
return pt(t, e, s)(u);
|
|
2418
2419
|
}
|
|
2419
2420
|
p.PIPE_TYPE = K;
|
|
2420
2421
|
p.createPipe = pt;
|
|
2421
|
-
p.pipe =
|
|
2422
|
-
class
|
|
2422
|
+
p.pipe = Nt;
|
|
2423
|
+
class Ut extends v {
|
|
2423
2424
|
get repeatFrom() {
|
|
2424
2425
|
var t;
|
|
2425
2426
|
return (t = Array.isArray(this.repeat) ? this.repeat[0] : this.repeat === 1 / 0 ? 0 : this.repeat) != null ? t : 0;
|
|
@@ -2514,12 +2515,12 @@ class Nt extends v {
|
|
|
2514
2515
|
this._blocks.length = t._blocks.length, this.mask = this.mask.slice(0, this._blocks.length), super.state = t;
|
|
2515
2516
|
}
|
|
2516
2517
|
}
|
|
2517
|
-
p.RepeatBlock =
|
|
2518
|
+
p.RepeatBlock = Ut;
|
|
2518
2519
|
try {
|
|
2519
2520
|
globalThis.IMask = p;
|
|
2520
2521
|
} catch {
|
|
2521
2522
|
}
|
|
2522
|
-
var
|
|
2523
|
+
var Pt = {
|
|
2523
2524
|
// common
|
|
2524
2525
|
mask: void 0,
|
|
2525
2526
|
prepare: Function,
|
|
@@ -2595,7 +2596,7 @@ function jt(u, t) {
|
|
|
2595
2596
|
defaultUnmaskedValue: n,
|
|
2596
2597
|
defaultTypedValue: r
|
|
2597
2598
|
} = t === void 0 ? {} : t;
|
|
2598
|
-
const l = kt(u) ? u :
|
|
2599
|
+
const l = kt(u) ? u : V(u), o = V(), d = V(), f = V(""), m = V(""), k = V();
|
|
2599
2600
|
let E, I = f.value, B = m.value, z = k.value;
|
|
2600
2601
|
function $() {
|
|
2601
2602
|
z = k.value = d.value.typedValue, B = m.value = d.value.unmaskedValue, I = f.value = d.value.value;
|
|
@@ -2638,14 +2639,14 @@ function jt(u, t) {
|
|
|
2638
2639
|
typed: k
|
|
2639
2640
|
};
|
|
2640
2641
|
}
|
|
2641
|
-
function
|
|
2642
|
+
function Ht(u, t) {
|
|
2642
2643
|
return u = {
|
|
2643
2644
|
...u
|
|
2644
2645
|
}, Object.keys(u).forEach((e) => {
|
|
2645
2646
|
(u[e] === void 0 || t.includes(e)) && delete u[e];
|
|
2646
2647
|
}), u;
|
|
2647
2648
|
}
|
|
2648
|
-
const
|
|
2649
|
+
const zt = ["typed", "unmasked", "value", "modelValue"];
|
|
2649
2650
|
_t({
|
|
2650
2651
|
name: "imask-input",
|
|
2651
2652
|
inheritAttrs: !1,
|
|
@@ -2657,7 +2658,7 @@ _t({
|
|
|
2657
2658
|
typed: {
|
|
2658
2659
|
validator: () => !0
|
|
2659
2660
|
},
|
|
2660
|
-
...
|
|
2661
|
+
...Pt
|
|
2661
2662
|
},
|
|
2662
2663
|
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"],
|
|
2663
2664
|
setup(u, t) {
|
|
@@ -2671,7 +2672,7 @@ _t({
|
|
|
2671
2672
|
masked: n,
|
|
2672
2673
|
unmasked: r,
|
|
2673
2674
|
typed: l
|
|
2674
|
-
} = jt(
|
|
2675
|
+
} = jt(Ht(u, zt), {
|
|
2675
2676
|
emit: s,
|
|
2676
2677
|
onAccept: (k) => {
|
|
2677
2678
|
const E = n.value;
|
|
@@ -2693,7 +2694,7 @@ _t({
|
|
|
2693
2694
|
};
|
|
2694
2695
|
}
|
|
2695
2696
|
});
|
|
2696
|
-
var
|
|
2697
|
+
var qt = {
|
|
2697
2698
|
name: "imask",
|
|
2698
2699
|
beforeMount: (u, t) => {
|
|
2699
2700
|
let {
|
|
@@ -2721,20 +2722,20 @@ function it(u, t) {
|
|
|
2721
2722
|
function at(u) {
|
|
2722
2723
|
u.maskRef && (u.maskRef.destroy(), delete u.maskRef);
|
|
2723
2724
|
}
|
|
2724
|
-
const
|
|
2725
|
+
const Kt = {
|
|
2725
2726
|
formHelpers: {
|
|
2726
2727
|
...At,
|
|
2727
2728
|
useInput: xt,
|
|
2728
2729
|
useTextbox: St,
|
|
2729
|
-
useMaskedInput:
|
|
2730
|
+
useMaskedInput: Vt
|
|
2730
2731
|
},
|
|
2731
2732
|
install: (u) => {
|
|
2732
|
-
u.directive("imask",
|
|
2733
|
+
u.directive("imask", qt), u.provide("responsiveHelpers", {
|
|
2733
2734
|
responsiveState: D,
|
|
2734
2735
|
updateResponsiveState: Et
|
|
2735
2736
|
});
|
|
2736
2737
|
}
|
|
2737
2738
|
};
|
|
2738
2739
|
export {
|
|
2739
|
-
|
|
2740
|
+
Kt as default
|
|
2740
2741
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(B,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(B=typeof globalThis<"u"?globalThis:B||self,c(B.Core={},B.Vue))})(this,function(B,c){"use strict";const D=c.reactive({isMobile:!1,isTablet:!1,isDesktop:!1,isWideScreen:!1}),ot=u=>{D.isMobile=u.matchMedia("(max-width: 767px)").matches,D.isTablet=u.matchMedia("(min-width: 768px) and (max-width: 1023px)").matches,D.isDesktop=u.matchMedia("(min-width: 1024px)").matches,D.isWideScreen=u.matchMedia("(min-width: 1152px)").matches},ht=Object.freeze(Object.defineProperty({__proto__:null,randomID:()=>Math.random().toString(36).substring(2,9)},Symbol.toStringTag,{value:"Module"})),dt=Object.freeze(Object.defineProperty({__proto__:null,useInputComposable:(u,t)=>{const e=c.computed(()=>t.errors instanceof Array?t.errors[0]:t.errors),s=()=>{var l;e.value&&((l=u==null?void 0:u.parent)==null||l.emit("hasError",{[t.id]:e.value!=""}))},i=c.computed(()=>{const l=[],o={};let d="";const k=t.options;return Object.keys(t.options).forEach(g=>{k&&(Array.isArray(k[g])?(d="array",l.push(k[g])):(d="object",Object.assign(o,k[g])))}),d==="array"?l:o}),a=l=>typeof l=="object"?l[t.textKey]:l,n=(l,o)=>{const{optgroup:d,valueKey:k}=t;let{options:g}=t;return d&&(g=i.value),Array.isArray(g)?typeof l=="object"?l[k]:l:o},r=c.computed(()=>{const l=[];return u!=null&&u.attrs.required&&l.push("is-required"),e.value&&l.push("has-error"),u!=null&&u.props.innerLabel&&l.push("inner-label"),u!=null&&u.props.forceInputBoxSize&&l.push("input-width"),l.join(" ")});return c.watch(e,()=>{s()}),c.onMounted(()=>{s()}),{error:e,classes:r,hasError:s,optionText:a,optionValue:n}}},Symbol.toStringTag,{value:"Module"})),pt=Object.freeze(Object.defineProperty({__proto__:null,useTextboxComposable:(u,t)=>{const e=c.computed(()=>{const a=[];return t.isLoading&&a.push("is-loading"),t.icon&&a.push("has-icons-right"),a.join(" ")}),s=c.computed(()=>{let a=t.placeholder;return!a&&(t.innerLabel==!0||t.innerLabel==null)&&(a="Insert placeholder here"),a});return{inputModifierClasses:e,defaultPlaceholder:s,onInput:a=>{u("update:modelValue",a.target.value),u("input",a)}}}},Symbol.toStringTag,{value:"Module"})),ct=Object.freeze(Object.defineProperty({__proto__:null,useMaskedInputComposable:(u,t)=>{const e=c.ref(""),s=c.reactive({mask:"",lazy:!1});return c.watch(()=>u==null?void 0:u.props.modelValue,l=>{e.value=l}),c.onBeforeMount(()=>{e.value=u==null?void 0:u.props.modelValue}),{localValue:e,mask:s,acceptEvent:l=>{const o=l.detail;t("update:modelValue",o._value),t("input",o._value),t("unmasked-input",o._unmaskedValue)},completeEvent:l=>{const o=l.detail;t("update:modelValue",o._value),t("complete",o._value)},onFocus:()=>{e.value||(s.lazy=!1)},onBlur:l=>{var o;(o=l.target.maskRef)!=null&&o._unmaskedValue||(s.lazy=!0)}}}},Symbol.toStringTag,{value:"Module"}));function S(u){return typeof u=="string"||u instanceof String}function K(u){var t;return typeof u=="object"&&u!=null&&(u==null||(t=u.constructor)==null?void 0:t.name)==="Object"}function Y(u,t){return Array.isArray(t)?Y(u,(e,s)=>t.includes(s)):Object.entries(u).reduce((e,s)=>{let[i,a]=s;return t(a,i)&&(e[i]=a),e},{})}const h={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function ft(u){switch(u){case h.LEFT:return h.FORCE_LEFT;case h.RIGHT:return h.FORCE_RIGHT;default:return u}}function P(u){return u.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function w(u,t){if(t===u)return!0;const e=Array.isArray(t),s=Array.isArray(u);let i;if(e&&s){if(t.length!=u.length)return!1;for(i=0;i<t.length;i++)if(!w(t[i],u[i]))return!1;return!0}if(e!=s)return!1;if(t&&u&&typeof t=="object"&&typeof u=="object"){const a=t instanceof Date,n=u instanceof Date;if(a&&n)return t.getTime()==u.getTime();if(a!=n)return!1;const r=t instanceof RegExp,l=u instanceof RegExp;if(r&&l)return t.toString()==u.toString();if(r!=l)return!1;const o=Object.keys(t);for(i=0;i<o.length;i++)if(!Object.prototype.hasOwnProperty.call(u,o[i]))return!1;for(i=0;i<o.length;i++)if(!w(u[o[i]],t[o[i]]))return!1;return!0}else if(t&&u&&typeof t=="function"&&typeof u=="function")return t.toString()===u.toString();return!1}class kt{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?h.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?h.RIGHT:h.LEFT}}function p(u,t){return new p.InputMask(u,t)}function $(u){if(u==null)throw new Error("mask property should be defined");return u instanceof RegExp?p.MaskedRegExp:S(u)?p.MaskedPattern:u===Date?p.MaskedDate:u===Number?p.MaskedNumber:Array.isArray(u)||u===Array?p.MaskedDynamic:p.Masked&&u.prototype instanceof p.Masked?u:p.Masked&&u instanceof p.Masked?u.constructor:u instanceof Function?p.MaskedFunction:(console.warn("Mask not found for mask",u),p.Masked)}function M(u){if(!u)throw new Error("Options in not defined");if(p.Masked){if(u.prototype instanceof p.Masked)return{mask:u};const{mask:t=void 0,...e}=u instanceof p.Masked?{mask:u}:K(u)&&u.mask instanceof p.Masked?u:{};if(t){const s=t.mask;return{...Y(t,(i,a)=>!a.startsWith("_")),mask:t.constructor,_mask:s,...e}}}return K(u)?{...u}:{mask:u}}function x(u){if(p.Masked&&u instanceof p.Masked)return u;const t=M(u),e=$(t.mask);if(!e)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===e&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new e(t)}p.createMask=x;class H{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,e){if(!(t==null||e==null||t===this.selectionStart&&e===this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}p.MaskElement=H;const Z=90,mt=89;class T extends H{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,s;return(t=(e=(s=this.input).getRootNode)==null?void 0:e.call(s))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){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",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Z&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===mt&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Z&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){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={}}}p.HTMLMaskElement=T;class gt extends T{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}p.HTMLMaskElement=T;class X extends T{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return i==null||s==null||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return i==null||s==null||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}p.HTMLContenteditableMaskElement=X;class R{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>R.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}R.MAX_LENGTH=100;class _t{constructor(t,e){this.el=t instanceof H?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new X(t):new gt(t),this.masked=x(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new R,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._onChange()}maskEquals(t){var e;return t==null||((e=this.masked)==null?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof p.Masked)&&this.masked.constructor===$(t)){this.masked.updateOptions({mask:t});return}const e=t instanceof p.Masked?t:x({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach(i=>i(e))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,n=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),n&&this._fireChangeEvents(),!this._historyChanging&&(n||this.history.isEmpty)&&this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,h.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new kt({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,a=s===this.masked.rawInputValue?e.removeDirection:h.NONE;let n=this.masked.nearestInputPos(e.startChangePos+i,a);a!==h.NONE&&(n=this.masked.nearestInputPos(n,h.NONE)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}p.InputMask=_t;class f{static normalize(t){return Array.isArray(t)?t:[t,new f]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}p.ChangeDetails=f;class F{constructor(t,e,s){t===void 0&&(t=""),e===void 0&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class v{constructor(t){this._value="",this._update({...v.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){e===void 0&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),new F(this.extractInput(t,e),t)}appendTail(t){return S(t)&&(t=new F(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new f({inserted:t,rawInserted:t})):new f}_appendChar(t,e,s){e===void 0&&(e={});const i=this.state;let a;if([t,a]=this.doPrepareChar(t,e),t&&(a=a.aggregate(this._appendCharRaw(t,e)),!a.rawInserted&&this.autofix==="pad")){const n=this.state;this.state=i;let r=this.pad(e);const l=this._appendCharRaw(t,e);r=r.aggregate(l),l.rawInserted||r.equals(a)?a=r:this.state=n}if(a.inserted){let n,r=this.doValidate(e)!==!1;if(r&&s!=null){const l=this.state;if(this.overwrite===!0){n=s.state;for(let d=0;d<a.rawInserted.length;++d)s.unshift(this.displayValue.length-a.tailShift)}let o=this.appendTail(s);if(r=o.rawInserted.length===s.toString().length,!(r&&o.inserted)&&this.overwrite==="shift"){this.state=l,n=s.state;for(let d=0;d<a.rawInserted.length;++d)s.shift();o=this.appendTail(s),r=o.rawInserted.length===s.toString().length}r&&o.inserted&&(this.state=l)}r||(a=new f,this.state=i,s&&n&&(s.state=n))}return a}_appendPlaceholder(){return new f}_appendEager(){return new f}append(t,e,s){if(!S(t))throw new Error("value should be string");const i=S(s)?new F(String(s)):s;e!=null&&e.tail&&(e._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,e);for(let n=0;n<t.length;++n){const r=this._appendChar(t[n],e,i);if(!r.rawInserted&&!this.doSkipInvalid(t[n],e,i))break;a.aggregate(r)}return(this.eager===!0||this.eager==="append")&&e!=null&&e.input&&t&&a.aggregate(this._appendEager()),i!=null&&(a.tailShift+=this.appendTail(i).tailShift),a}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new f}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&s.indexOf(this.value)===0&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return!!this.skipInvalid}doPrepare(t,e){return e===void 0&&(e={}),f.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return e===void 0&&(e={}),f.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,a){s===void 0&&(s=""),i===void 0&&(i=h.NONE),a===void 0&&(a={input:!0});const n=t+e,r=this.extractTail(n),l=this.eager===!0||this.eager==="remove";let o;l&&(i=ft(i),o=this.extractInput(0,n,{raw:!0}));let d=t;const k=new f;if(i!==h.NONE&&(d=this.nearestInputPos(t,e>1&&t!==0&&!l?h.NONE:i),k.tailShift=d-t),k.aggregate(this.remove(d)),l&&i!==h.NONE&&o===this.rawInputValue)if(i===h.FORCE_LEFT){let g;for(;o===this.rawInputValue&&(g=this.displayValue.length);)k.aggregate(new f({tailShift:-1})).aggregate(this.remove(g-1))}else i===h.FORCE_RIGHT&&r.unshift();return k.aggregate(this.append(s,a,r))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!w(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||v.EMPTY_VALUES.includes(t)&&v.EMPTY_VALUES.includes(e)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new f}}v.DEFAULTS={skipInvalid:!0},v.EMPTY_VALUES=[void 0,null,""],p.Masked=v;class b{constructor(t,e){t===void 0&&(t=[]),e===void 0&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=S(t)?new F(String(t)):t;const e=this.chunks[this.chunks.length-1],s=e&&(e.stop===t.stop||t.stop==null)&&t.from===e.from+e.toString().length;if(t instanceof F)s?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof b){if(t.stop==null){let i;for(;t.chunks.length&&t.chunks[0].stop==null;)i=t.chunks.shift(),i.from+=t.from,this.extend(i)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof p.MaskedPattern))return new F(this.toString()).appendTo(t);const e=new f;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=t._mapPosToBlock(t.displayValue.length),n=i.stop;let r;if(n!=null&&(!a||a.index<=n)&&((i instanceof b||t._stops.indexOf(n)>=0)&&e.aggregate(t._appendPlaceholder(n)),r=i instanceof b&&t._blocks[n]),r){const l=r.appendTail(i);e.aggregate(l);const o=i.toString().slice(l.rawInserted.length);o&&e.aggregate(t.append(o,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map(i=>{const a="chunks"in i?new b:new F;return a.state=i,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const e=t!=null?t-this.from:t;let s=0;for(;s<this.chunks.length;){const i=this.chunks[s],a=i.unshift(e);if(i.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class vt{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){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))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((e=this.block)==null?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,h.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,h.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h.NONE),!0})}}class W{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new f}nearestInputPos(t,e){e===void 0&&(e=h.NONE);const s=0,i=this._value.length;switch(e){case h.LEFT:case h.FORCE_LEFT:return s;case h.NONE:case h.RIGHT:case h.FORCE_RIGHT:default:return i}}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),s===void 0&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,e){if(e===void 0&&(e={}),this.isFilled)return new f;const s=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,n=new f({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(e.raw||e.input),n}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new f;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new F("")}appendTail(t){return S(t)&&(t=new F(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return s!=null&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class O{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r,...l}=t;this.masked=x(l),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),t===0&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new f}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,e){if(e===void 0&&(e={}),this.isFilled)return new f;const s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&this.doValidate(e)===!1&&(i=new f,this.masked.state=s),!i.inserted&&!this.isOptional&&!this.lazy&&!e.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new f:(this.isFilled=!0,new f({inserted:this.placeholderChar}))}_appendEager(){return new f}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){e===void 0&&(e=h.NONE);const s=0,i=this.value.length,a=Math.min(Math.max(t,s),i);switch(e){case h.LEFT:case h.FORCE_LEFT:return this.isComplete?a:s;case h.RIGHT:case h.FORCE_RIGHT:return this.isComplete?a:i;case h.NONE:default:return a}}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(t==null||(e=t._beforeTailState)==null?void 0:e.masked)||(t==null?void 0:t._beforeTailState)}}pad(t){return new f}}O.DEFAULT_DEFINITIONS={0:/\d/,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]/,"*":/./};class Et extends v{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=s=>s.search(e)>=0),super._update(t)}}p.MaskedRegExp=Et;class E extends v{constructor(t){super({...E.DEFAULTS,...t,definitions:Object.assign({},O.DEFAULT_DEFINITIONS,t==null?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let a=0;a<e.length;++a){if(this.blocks){const o=e.slice(a),d=Object.keys(this.blocks).filter(g=>o.indexOf(g)===0);d.sort((g,m)=>m.length-g.length);const k=d[0];if(k){const{expose:g,repeat:m,...C}=M(this.blocks[k]),I={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...C,repeat:m,parent:this},V=m!=null?new p.RepeatBlock(I):x(I);V&&(this._blocks.push(V),g&&(this.exposeBlock=V),this._maskedBlocks[k]||(this._maskedBlocks[k]=[]),this._maskedBlocks[k].push(this._blocks.length-1)),a+=k.length-1;continue}}let n=e[a],r=n in t;if(n===E.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(n==="{"||n==="}"){s=!s;continue}if(n==="["||n==="]"){i=!i;continue}if(n===E.ESCAPE_CHAR){if(++a,n=e[a],!n)break;r=!1}const l=r?new O({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...M(t[n]),parent:this}):new W({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(l)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:e,...s}=t;this._blocks.forEach((i,a)=>i.state=e[a]),super.state=s}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,e)=>t+=e.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,e)=>t+=e.value,"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,e)=>t+=e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new f;let s=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(s==null)return e;this._blocks[s].isFilled&&++s;for(let i=s;i<this._blocks.length;++i){const a=this._blocks[i]._appendEager();if(!a.inserted)break;e.aggregate(a)}return e}_appendCharRaw(t,e){e===void 0&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new f;if(!s)return i;for(let n=s.index,r;r=this._blocks[n];++n){var a;const l=r._appendChar(t,{...e,_beforeTailState:(a=e._beforeTailState)==null||(a=a._blocks)==null?void 0:a[n]});if(i.aggregate(l),l.consumed)break}return i}extractTail(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=new b;return t===e||this._forEachBlocksInRange(t,e,(i,a,n,r)=>{const l=i.extractTail(n,r);l.stop=this._findStopBefore(a),l.from=this._blockStartPos(a),l instanceof b&&(l.blockIndex=a),s.extend(l)}),s}extractInput(t,e,s){if(t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),s===void 0&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,(a,n,r,l)=>{i+=a.extractInput(r,l,s)}),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(i<=t)e=i;else break}return e}_appendPlaceholder(t){const e=new f;if(this.lazy&&t==null)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,a=t??this._blocks.length;return this._blocks.slice(i,a).forEach(n=>{if(!n.lazy||t!=null){var r;e.aggregate(n._appendPlaceholder((r=n._blocks)==null?void 0:r.length))}}),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((e,s)=>e+=s.displayValue.length,0)}_forEachBlocksInRange(t,e,s){e===void 0&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const a=this._mapPosToBlock(e),n=a&&i.index===a.index,r=i.offset,l=a&&n?a.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,r,l),a&&!n){for(let o=i.index+1;o<a.index;++o)s(this._blocks[o],o,0,this._blocks[o].displayValue.length);s(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,(i,a,n,r)=>{s.aggregate(i.remove(n,r))}),s}nearestInputPos(t,e){if(e===void 0&&(e=h.NONE),!this._blocks.length)return 0;const s=new vt(this,t);if(e===h.NONE)return s.pushRightBeforeInput()||(s.popState(),s.pushLeftBeforeInput())?s.pos:this.displayValue.length;if(e===h.LEFT||e===h.FORCE_LEFT){if(e===h.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===h.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t||(s.popState(),s.ok&&s.pos<=t))return s.pos;s.popState()}return s.ok?s.pos:e===h.FORCE_LEFT?0:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:0)}return e===h.RIGHT||e===h.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===h.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:this.nearestInputPos(t,h.LEFT))):t}totalInputPositions(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,(i,a,n,r)=>{s+=i.totalInputPositions(n,r)}),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(s=>this._blocks[s]):[]}pad(t){const e=new f;return this._forEachBlocksInRange(0,this.displayValue.length,s=>e.aggregate(s.pad(t))),e}}E.DEFAULTS={...v.DEFAULTS,lazy:!0,placeholderChar:"_"},E.STOP_CHAR="`",E.ESCAPE_CHAR="\\",E.InputDefinition=O,E.FixedDefinition=W,p.MaskedPattern=E;class L extends E{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...n}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;const r=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0");let o=0;for(;o<l.length&&l[o]===r[o];)++o;n.mask=l.slice(0,o).replace(/0/g,"\\0")+"0".repeat(this.maxLength-o),super._update(n)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let e="",s="";const[,i,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(i.length)+a,s="9".repeat(i.length)+a),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){e===void 0&&(e={});let s;return[t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(s.skip=!this.isComplete),[t,s]}_appendCharRaw(t,e){if(e===void 0&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,n]=this.boundaries(this.value+t);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(e.search(/[^0]/)===-1&&e.length<=this._matchFrom)return!0;const[i,a]=this.boundaries(e);return this.from<=Number(a)&&Number(i)<=this.to&&super.doValidate(t)}pad(t){const e=new f;if(this.value.length===this.maxLength)return e;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let a=0;a<i;++a)e.aggregate(super._appendCharRaw("0",t));s.split("").forEach(a=>this._appendCharRaw(a))}return e}}p.MaskedRange=L;class y extends E{static extractPatternOptions(t){const{mask:e,pattern:s,...i}=t;return{...i,mask:S(e)?e:s}}constructor(t){super(y.extractPatternOptions({...y.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:e,pattern:s,blocks:i,...a}={...y.DEFAULTS,...t},n=Object.assign({},y.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,i),super._update({...a,mask:S(e)?e:s,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&e!=null&&(this.min==null||this.min<=e)&&(this.max==null||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(y.extractPatternOptions(t))}}y.GET_DEFAULT_BLOCKS=()=>({d:{mask:L,from:1,to:31,maxLength:2},m:{mask:L,from:1,to:12,maxLength:2},Y:{mask:L,from:1900,to:9999}}),y.DEFAULTS={...E.DEFAULTS,mask:Date,pattern:"d{.}`m{.}`Y",format:(u,t)=>{if(!u)return"";const e=String(u.getDate()).padStart(2,"0"),s=String(u.getMonth()+1).padStart(2,"0"),i=u.getFullYear();return[e,s,i].join(".")},parse:(u,t)=>{const[e,s,i]=u.split(".").map(Number);return new Date(i,s-1,e)}},p.MaskedDate=y;class N extends v{constructor(t){super({...N.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(e=>{const{expose:s,...i}=M(e),a=x({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return s&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,e){e===void 0&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){t===void 0&&(t=""),e===void 0&&(e={}),s===void 0&&(s="");const i=e.tail&&e._beforeTailState!=null?e._beforeTailState._value:this.value,a=this.rawInputValue,n=e.tail&&e._beforeTailState!=null?e._beforeTailState._rawInputValue:a,r=a.slice(n.length),l=this.currentMask,o=new f,d=l==null?void 0:l.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==l?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),o.tailShift=this.currentMask.value.length-i.length),r&&(o.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):d&&(this.currentMask.state=d)),o}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new f;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:((e=t._beforeTailState)==null?void 0:e.currentMaskRef)===this.currentMask&&((s=t._beforeTailState)==null?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return e===void 0&&(e={}),s===void 0&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){e===void 0&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let a;[s,a]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(a)}return[s,i]}doPrepareChar(t,e){e===void 0&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let a;[s,a]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(a)}return[s,i]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(e=>e.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,e){const s=new f;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(e=>e.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...a}=t;e&&this.compiledMasks.forEach((n,r)=>n.state=e[r]),s!=null&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((e,s)=>{if(!t[s])return;const{mask:i,...a}=t[s];return w(e,a)&&e.maskEquals(i)}):super.maskEquals(t)}typedValueEquals(t){var e;return!!((e=this.currentMask)!=null&&e.typedValueEquals(t))}}N.DEFAULTS={...v.DEFAULTS,dispatch:(u,t,e,s)=>{if(!t.compiledMasks.length)return;const i=t.rawInputValue,a=t.compiledMasks.map((n,r)=>{const l=t.currentMask===n,o=l?n.displayValue.length:n.nearestInputPos(n.displayValue.length,h.FORCE_LEFT);return n.rawInputValue!==i?(n.reset(),n.append(i,{raw:!0})):l||n.remove(o),n.append(u,t.currentMaskFlags(e)),n.appendTail(s),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,h.FORCE_LEFT)))}});return a.sort((n,r)=>r.weight-n.weight||r.totalInputPositions-n.totalInputPositions),t.compiledMasks[a[0].index]}},p.MaskedDynamic=N;class U extends E{constructor(t){super({...U.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const i=e.map(r=>r.length),a=Math.min(...i),n=Math.max(...i)-a;s.mask="*".repeat(a),n&&(s.mask+="["+"*".repeat(n)+"]"),this.enum=e}super._update(s)}_appendCharRaw(t,e){e===void 0&&(e={});const s=Math.min(this.nearestInputPos(0,h.FORCE_RIGHT),this.value.length),i=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,s));if(i.length){i.length===1&&this._forEachBlocksInRange(0,this.value.length,(n,r)=>{const l=i[0][r];r>=this.value.length||l===n.value||(n.reset(),n._appendChar(l,e))});const a=super._appendCharRaw(i[0][this.value.length],e);return i.length===1&&i[0].slice(this.unmaskedValue.length).split("").forEach(n=>a.aggregate(super._appendCharRaw(n))),a}return new f({skip:!this.isComplete})}extractTail(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),new F("",t)}remove(t,e){if(t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),t===e)return new f;const s=Math.min(super.nearestInputPos(0,h.FORCE_RIGHT),this.value.length);let i;for(i=t;i>=0&&!(this.enum.filter(r=>this.matchValue(r,this.value.slice(s,i),s)).length>1);--i);const a=super.remove(i,e);return a.tailShift+=i-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}U.DEFAULTS={...E.DEFAULTS,matchValue:(u,t,e)=>u.indexOf(t,e)===e},p.MaskedEnum=U;class Ct extends v{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}p.MaskedFunction=Ct;var J;class A extends v{constructor(t){super({...A.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e="\\d*",s=(this.scale?"("+P(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+e+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(P).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(P(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){e===void 0&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),s&&!this.allowPositive&&!this.value&&s!=="-"&&i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){e===void 0&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){e===void 0&&(e={});const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const n=this.number;let r=!isNaN(n),l=!1;if(r){let g;this.min!=null&&this.min<0&&this.number<this.min&&(g=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(g=this.max),g!=null&&(this.autofix?(this._value=this.format(g,this).replace(A.UNMASKED_RADIX,this.radix),l||(l=a===this._value&&!e.tail)):r=!1),r&&(r=!!this._value.match(this._numberRegExp))}let o;r?o=new f({inserted:this._value.slice(a.length),rawInserted:l?"":t,skip:l}):(this._value=a,o=new f),this._value=this._insertThousandsSeparators(this._value);const d=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,k=this._separatorsCountFromSlice(d);return o.tailShift+=(k-i)*this.thousandsSeparator.length,o}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const n=this._separatorsCountFromSlice(s);return new f({tailShift:(n-a)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case h.NONE:case h.LEFT:case h.FORCE_LEFT:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===h.FORCE_LEFT)return s}break}case h.RIGHT:case h.FORCE_RIGHT:{const s=this._findSeparatorAround(t);if(s>=0)return s+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;this.min!=null&&(e=Math.max(e,this.min)),this.max!=null&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(s,i,a,n)=>i+n),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){e===void 0&&(e={});const i=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===A.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,A.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(A.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||A.EMPTY_VALUES.includes(t)&&A.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}J=A,A.UNMASKED_RADIX=".",A.EMPTY_VALUES=[...v.EMPTY_VALUES,0],A.DEFAULTS={...v.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[J.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:u=>u.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},p.MaskedNumber=A;const q={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Q(u,t,e){t===void 0&&(t=q.MASKED),e===void 0&&(e=q.MASKED);const s=x(u);return i=>s.runIsolated(a=>(a[t]=i,a[e]))}function At(u,t,e,s){return Q(t,e,s)(u)}p.PIPE_TYPE=q,p.createPipe=Q,p.pipe=At;class Ft extends E{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,s,i;const{repeat:a,...n}=M(t);this._blockOpts=Object.assign({},this._blockOpts,n);const r=x(this._blockOpts);this.repeat=(e=(s=a??r.repeat)!=null?s:this.repeat)!=null?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((i=this._blocks)==null?void 0:i.length)||0,this.repeatFrom)),blocks:{m:r},eager:r.eager,overwrite:r.overwrite,skipInvalid:r.skipInvalid,lazy:r.lazy,placeholderChar:r.placeholderChar,displayChar:r.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(x(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,e){e===void 0&&(e={});const s=new f;for(let l=(i=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?i:Math.max(this._blocks.length-1,0),o,d;o=(n=this._blocks[l])!=null?n:d=!d&&this._allocateBlock(l);++l){var i,a,n,r;const k=o._appendChar(t,{...e,_beforeTailState:(r=e._beforeTailState)==null||(r=r._blocks)==null?void 0:r[l]});if(k.skip&&d){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(k),k.consumed)break}return s}_trimEmptyTail(t,e){var s,i;t===void 0&&(t=0);const a=Math.max(((s=this._mapPosToBlock(t))==null?void 0:s.index)||0,this.repeatFrom,0);let n;e!=null&&(n=(i=this._mapPosToBlock(e))==null?void 0:i.index),n==null&&(n=this._blocks.length-1);let r=0;for(let l=n;a<=l&&!this._blocks[l].unmaskedValue;--l,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=super.remove(t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return t===void 0&&(t=0),e==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}p.RepeatBlock=Ft;try{globalThis.IMask=p}catch{}var xt={mask:void 0,prepare:Function,prepareChar:Function,validate:Function,commit:Function,overwrite:{type:Boolean,required:!1,default:void 0},eager:{required:!1,default:void 0,validator:u=>["append","remove"].includes(u)||typeof u=="boolean"},skipInvalid:{type:Boolean,required:!1,default:void 0},placeholderChar:String,displayChar:String,lazy:{type:Boolean,required:!1,default:void 0},definitions:Object,blocks:Object,enum:Array,maxLength:Number,from:Number,to:Number,pattern:String,format:Function,parse:Function,autofix:{required:!1,default:void 0,validator:u=>u==="pad"||typeof u=="boolean"},radix:String,thousandsSeparator:String,mapToRadix:Array,scale:Number,normalizeZeros:{type:Boolean,required:!1,default:void 0},padFractionalZeros:{type:Boolean,required:!1,default:void 0},min:[Number,Date],max:[Number,Date],dispatch:Function};function yt(u,t){let{emit:e,onAccept:s,onComplete:i,defaultValue:a,defaultUnmaskedValue:n,defaultTypedValue:r}=t===void 0?{}:t;const l=c.isRef(u)?u:c.ref(u),o=c.ref(),d=c.ref(),k=c.ref(""),g=c.ref(""),m=c.ref();let C,I=k.value,V=g.value,z=m.value;function it(){z=m.value=d.value.typedValue,V=g.value=d.value.unmaskedValue,I=k.value=d.value.value}function j(_){it(),e&&(e("accept",k.value,_),e("accept:masked",k.value,_),e("accept:typed",m.value,_),e("accept:unmasked",g.value,_)),s==null||s(_)}function It(_){e&&(e("complete",d.value.value,_),e("complete:masked",d.value.value,_),e("complete:typed",d.value.typedValue,_),e("complete:unmasked",d.value.unmaskedValue,_)),i==null||i(_)}const at=()=>{!d.value||g.value===void 0||(V!==g.value&&(d.value.unmaskedValue=g.value,d.value.unmaskedValue!==g.value&&j()),V=void 0)};c.watch(g,at);const ut=()=>{!d.value||k.value===void 0||(I!==k.value&&(d.value.value=k.value,d.value.value!==k.value&&j()),I=void 0)};c.watch(k,ut);const nt=()=>{!d.value||m.value===void 0||(z!==m.value&&(d.value.typedValue=m.value,d.value.masked.typedValueEquals(m.value)||j()),z=void 0)};c.watch(m,nt);function rt(){C=o.value;const _=l.value;!C||!(_!=null&&_.mask)||(d.value=p(C,_),a!==void 0&&(k.value=a),n!==void 0&&(g.value=n),r!==void 0&&(m.value=r),at(),ut(),nt(),it(),d.value.on("accept",j).on("complete",It))}function lt(){var _;(_=d.value)==null||_.destroy(),d.value=void 0}return c.onMounted(rt),c.onUnmounted(lt),c.watch([o,l],()=>{const _=o.value,G=l.value;(!(G!=null&&G.mask)||_!==C)&<(),_&&(d.value?d.value.updateOptions(G):rt())}),{el:o,mask:c.readonly(d),masked:k,unmasked:g,typed:m}}function St(u,t){return u={...u},Object.keys(u).forEach(e=>{(u[e]===void 0||t.includes(e))&&delete u[e]}),u}const Bt=["typed","unmasked","value","modelValue"];c.defineComponent({name:"imask-input",inheritAttrs:!1,props:{modelValue:String,value:String,unmasked:String,typed:{validator:()=>!0},...xt},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"],setup(u,t){let{attrs:e,emit:s}=t;const{el:i,mask:a,masked:n,unmasked:r,typed:l}=yt(St(u,Bt),{emit:s,onAccept:m=>{const C=n.value;s("accept:value",C,m),s("update:value",C,m),s("update:masked",C,m),s("update:modelValue",C,m),s("update:unmasked",r.value,m),s("update:typed",l.value,m)},onComplete:m=>{s("complete:value",n.value,m)}}),o=c.toRef(u,"value"),d=c.toRef(u,"modelValue"),k=c.toRef(u,"unmasked"),g=c.toRef(u,"typed");return n.value=d.value||o.value||"",r.value=k.value||"",l.value=g.value,c.watch(o,m=>n.value=m),c.watch(d,m=>n.value=m),c.watch(k,m=>r.value=m),c.watch(g,m=>l.value=m),()=>{const m={...e,value:u.value!=null?u.value:u.modelValue!=null?u.modelValue:a.value?a.value.displayValue:"",ref:i};return u.mask||(m.onInput=C=>{s("update:modelValue",C.target.value),s("update:value",C.target.value)}),c.h("input",m)}}});var bt={name:"imask",beforeMount:(u,t)=>{let{value:e}=t;e&&et(u,e)},updated:(u,t)=>{let{value:e}=t;e?u.maskRef?(u.maskRef.updateOptions(e),u.value!==u.maskRef.value&&u.maskRef._onChange()):et(u,e):st(u)},unmounted:u=>{st(u)}};function tt(u,t,e){const s=document.createEvent("CustomEvent");s.initCustomEvent(t,!0,!0,e),u.dispatchEvent(s)}function et(u,t){u.maskRef=p(u,t).on("accept",()=>tt(u,"accept",u.maskRef)).on("complete",()=>tt(u,"complete",u.maskRef))}function st(u){u.maskRef&&(u.maskRef.destroy(),delete u.maskRef)}const Vt={formHelpers:{...ht,useInput:dt,useTextbox:pt,useMaskedInput:ct},install:u=>{u.directive("imask",bt),u.provide("responsiveHelpers",{responsiveState:D,updateResponsiveState:ot})}};B.default=Vt,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(B,c){typeof exports=="object"&&typeof module<"u"?c(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],c):(B=typeof globalThis<"u"?globalThis:B||self,c(B.Core={},B.Vue))})(this,function(B,c){"use strict";const D=c.reactive({isMobile:!1,isTablet:!1,isDesktop:!1,isWideScreen:!1}),ot=u=>{D.isMobile=u.matchMedia("(max-width: 767px)").matches,D.isTablet=u.matchMedia("(min-width: 768px) and (max-width: 1023px)").matches,D.isDesktop=u.matchMedia("(min-width: 1024px)").matches,D.isWideScreen=u.matchMedia("(min-width: 1152px)").matches},ht=Object.freeze(Object.defineProperty({__proto__:null,randomID:()=>Math.random().toString(36).substring(2,9)},Symbol.toStringTag,{value:"Module"})),dt=Object.freeze(Object.defineProperty({__proto__:null,useInputComposable:(u,t)=>{const e=c.computed(()=>t.errors instanceof Array?t.errors[0]:t.errors),s=()=>{var l;e.value&&((l=u==null?void 0:u.parent)==null||l.emit("hasError",{[t.id]:e.value!=""}))},i=c.computed(()=>{const l=[],o={};let d="";const k=t.options;return Object.keys(t.options).forEach(g=>{k&&(Array.isArray(k[g])?(d="array",l.push(k[g])):(d="object",Object.assign(o,k[g])))}),d==="array"?l:o}),a=l=>typeof l=="object"?l[t.textKey]:l,n=(l,o)=>{const{optgroup:d,valueKey:k}=t;let{options:g}=t;return d&&(g=i.value),Array.isArray(g)?typeof l=="object"?l[k]:l:o},r=c.computed(()=>{const l=[];return u!=null&&u.attrs.required&&l.push("is-required"),e.value&&l.push("has-error"),u!=null&&u.props.innerLabel&&l.push("inner-label"),u!=null&&u.props.forceInputBoxSize&&l.push("input-width"),l.join(" ")});return c.watch(e,()=>{s()}),c.onMounted(()=>{s()}),{error:e,classes:r,hasError:s,optionText:a,optionValue:n}}},Symbol.toStringTag,{value:"Module"})),pt=Object.freeze(Object.defineProperty({__proto__:null,useTextboxComposable:(u,t)=>{const e=c.computed(()=>{const a=[];return t.isLoading&&a.push("is-loading"),t.icon&&a.push("has-icons-right"),a.join(" ")}),s=c.computed(()=>{let a=t.placeholder;return!a&&(t.innerLabel==!0||t.innerLabel==null)&&(a="Insert placeholder here"),a});return{inputModifierClasses:e,defaultPlaceholder:s,onInput:a=>{u("update:modelValue",a.target.value),u("input",a)}}}},Symbol.toStringTag,{value:"Module"})),ct=Object.freeze(Object.defineProperty({__proto__:null,useMaskedInputComposable:(u,t)=>{const e=c.ref(""),s=c.reactive({mask:"",lazy:!1});return c.watch(()=>u==null?void 0:u.props.modelValue,l=>{e.value=l}),c.onBeforeMount(()=>{e.value=u==null?void 0:u.props.modelValue}),{localValue:e,mask:s,acceptEvent:l=>{const o=l.detail;t("update:modelValue",o._value),t("input",o._value),t("unmasked-input",o._unmaskedValue)},completeEvent:l=>{const o=l.detail;t("update:modelValue",o._value),t("complete",o._value)},onFocus:()=>{e.value||(s.lazy=!1)},onBlur:l=>{var o;(o=l.target.maskRef)!=null&&o._unmaskedValue||(s.lazy=!0)}}}},Symbol.toStringTag,{value:"Module"}));function S(u){return typeof u=="string"||u instanceof String}function K(u){var t;return typeof u=="object"&&u!=null&&(u==null||(t=u.constructor)==null?void 0:t.name)==="Object"}function Y(u,t){return Array.isArray(t)?Y(u,(e,s)=>t.includes(s)):Object.entries(u).reduce((e,s)=>{let[i,a]=s;return t(a,i)&&(e[i]=a),e},{})}const h={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function ft(u){switch(u){case h.LEFT:return h.FORCE_LEFT;case h.RIGHT:return h.FORCE_RIGHT;default:return u}}function P(u){return u.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function w(u,t){if(t===u)return!0;const e=Array.isArray(t),s=Array.isArray(u);let i;if(e&&s){if(t.length!=u.length)return!1;for(i=0;i<t.length;i++)if(!w(t[i],u[i]))return!1;return!0}if(e!=s)return!1;if(t&&u&&typeof t=="object"&&typeof u=="object"){const a=t instanceof Date,n=u instanceof Date;if(a&&n)return t.getTime()==u.getTime();if(a!=n)return!1;const r=t instanceof RegExp,l=u instanceof RegExp;if(r&&l)return t.toString()==u.toString();if(r!=l)return!1;const o=Object.keys(t);for(i=0;i<o.length;i++)if(!Object.prototype.hasOwnProperty.call(u,o[i]))return!1;for(i=0;i<o.length;i++)if(!w(u[o[i]],t[o[i]]))return!1;return!0}else if(t&&u&&typeof t=="function"&&typeof u=="function")return t.toString()===u.toString();return!1}class kt{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?h.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?h.RIGHT:h.LEFT}}function p(u,t){return new p.InputMask(u,t)}function $(u){if(u==null)throw new Error("mask property should be defined");return u instanceof RegExp?p.MaskedRegExp:S(u)?p.MaskedPattern:u===Date?p.MaskedDate:u===Number?p.MaskedNumber:Array.isArray(u)||u===Array?p.MaskedDynamic:p.Masked&&u.prototype instanceof p.Masked?u:p.Masked&&u instanceof p.Masked?u.constructor:u instanceof Function?p.MaskedFunction:(console.warn("Mask not found for mask",u),p.Masked)}function M(u){if(!u)throw new Error("Options in not defined");if(p.Masked){if(u.prototype instanceof p.Masked)return{mask:u};const{mask:t=void 0,...e}=u instanceof p.Masked?{mask:u}:K(u)&&u.mask instanceof p.Masked?u:{};if(t){const s=t.mask;return{...Y(t,(i,a)=>!a.startsWith("_")),mask:t.constructor,_mask:s,...e}}}return K(u)?{...u}:{mask:u}}function x(u){if(p.Masked&&u instanceof p.Masked)return u;const t=M(u),e=$(t.mask);if(!e)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===e&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new e(t)}p.createMask=x;class H{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,e){if(!(t==null||e==null||t===this.selectionStart&&e===this.selectionEnd))try{this._unsafeSelect(t,e)}catch{}}get isActive(){return!1}}p.MaskElement=H;const Z=90,mt=89;class T extends H{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,e,s;return(t=(e=(s=this.input).getRootNode)==null?void 0:e.call(s))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){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",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Z&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===mt&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Z&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){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={}}}p.HTMLMaskElement=T;class gt extends T{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}}p.HTMLMaskElement=T;class X extends T{get _unsafeSelectionStart(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return i==null||s==null||s<i?s:i}get _unsafeSelectionEnd(){const t=this.rootElement,e=t.getSelection&&t.getSelection(),s=e&&e.anchorOffset,i=e&&e.focusOffset;return i==null||s==null||s>i?s:i}_unsafeSelect(t,e){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,t),s.setEnd(this.input.lastChild||this.input,e);const i=this.rootElement,a=i.getSelection&&i.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}p.HTMLContenteditableMaskElement=X;class R{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>R.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}R.MAX_LENGTH=100;class _t{constructor(t,e){this.el=t instanceof H?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new X(t):new gt(t),this.masked=x(e),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new R,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()}maskEquals(t){var e;return t==null||((e=this.masked)==null?void 0:e.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof p.Masked)&&this.masked.constructor===$(t)){this.masked.updateOptions({mask:t});return}const e=t instanceof p.Masked?t:x({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,e){const s=this._listeners[t];s&&s.forEach(i=>i(e))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const e=this.masked.unmaskedValue,s=this.masked.value,i=this.masked.rawInputValue,a=this.displayValue,n=this.unmaskedValue!==e||this.value!==s||this._rawInputValue!==i;this._unmaskedValue=e,this._value=s,this._rawInputValue=i,this.el.value!==a&&(this.el.value=a),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),n&&this._fireChangeEvents(),!this._historyChanging&&(n||this.history.isEmpty)&&this.history.push({unmaskedValue:e,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:e,...s}=t,i=!this.maskEquals(e),a=this.masked.optionsIsChanged(s);i&&(this.mask=e),a&&this.masked.updateOptions(s),(i||a)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,h.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const e=new kt({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,i=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection,{input:!0,raw:!0}).offset,a=s===this.masked.rawInputValue?e.removeDirection:h.NONE;let n=this.masked.nearestInputPos(e.startChangePos+i,a);a!==h.NONE&&(n=this.masked.nearestInputPos(n,h.NONE)),this.updateControl(n),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}p.InputMask=_t;class f{static normalize(t){return Array.isArray(t)?t:[t,new f]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}p.ChangeDetails=f;class F{constructor(t,e,s){t===void 0&&(t=""),e===void 0&&(e=0),this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const e=this.value[0];return this.value=this.value.slice(1),e}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class v{constructor(t){this._value="",this._update({...v.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,e){e===void 0&&(e={input:!0}),this.reset(),this.append(t,e,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,e){return t}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),Math.min(this.displayValue.length,e-t)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),this.displayValue.slice(t,e)}extractTail(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),new F(this.extractInput(t,e),t)}appendTail(t){return S(t)&&(t=new F(String(t))),t.appendTo(this)}_appendCharRaw(t,e){return t?(this._value+=t,new f({inserted:t,rawInserted:t})):new f}_appendChar(t,e,s){e===void 0&&(e={});const i=this.state;let a;if([t,a]=this.doPrepareChar(t,e),t&&(a=a.aggregate(this._appendCharRaw(t,e)),!a.rawInserted&&this.autofix==="pad")){const n=this.state;this.state=i;let r=this.pad(e);const l=this._appendCharRaw(t,e);r=r.aggregate(l),l.rawInserted||r.equals(a)?a=r:this.state=n}if(a.inserted){let n,r=this.doValidate(e)!==!1;if(r&&s!=null){const l=this.state;if(this.overwrite===!0){n=s.state;for(let d=0;d<a.rawInserted.length;++d)s.unshift(this.displayValue.length-a.tailShift)}let o=this.appendTail(s);if(r=o.rawInserted.length===s.toString().length,!(r&&o.inserted)&&this.overwrite==="shift"){this.state=l,n=s.state;for(let d=0;d<a.rawInserted.length;++d)s.shift();o=this.appendTail(s),r=o.rawInserted.length===s.toString().length}r&&o.inserted&&(this.state=l)}r||(a=new f,this.state=i,s&&n&&(s.state=n))}return a}_appendPlaceholder(){return new f}_appendEager(){return new f}append(t,e,s){if(!S(t))throw new Error("value should be string");const i=S(s)?new F(String(s)):s;e!=null&&e.tail&&(e._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,e);for(let n=0;n<t.length;++n){const r=this._appendChar(t[n],e,i);if(!r.rawInserted&&!this.doSkipInvalid(t[n],e,i))break;a.aggregate(r)}return(this.eager===!0||this.eager==="append")&&e!=null&&e.input&&t&&a.aggregate(this._appendEager()),i!=null&&(a.tailShift+=this.appendTail(i).tailShift),a}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(e),new f}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const e=this.rawInputValue,s=this.value,i=t();return this.rawInputValue=e,this.value&&this.value!==s&&s.indexOf(this.value)===0&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,i}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const e=this.state,s=t(this);return this.state=e,delete this._isolated,s}doSkipInvalid(t,e,s){return!!this.skipInvalid}doPrepare(t,e){return e===void 0&&(e={}),f.normalize(this.prepare?this.prepare(t,this,e):t)}doPrepareChar(t,e){return e===void 0&&(e={}),f.normalize(this.prepareChar?this.prepareChar(t,this,e):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,i,a){s===void 0&&(s=""),i===void 0&&(i=h.NONE),a===void 0&&(a={input:!0});const n=t+e,r=this.extractTail(n),l=this.eager===!0||this.eager==="remove";let o;l&&(i=ft(i),o=this.extractInput(0,n,{raw:!0}));let d=t;const k=new f;if(i!==h.NONE&&(d=this.nearestInputPos(t,e>1&&t!==0&&!l?h.NONE:i),k.tailShift=d-t),k.aggregate(this.remove(d)),l&&i!==h.NONE&&o===this.rawInputValue)if(i===h.FORCE_LEFT){let g;for(;o===this.rawInputValue&&(g=this.displayValue.length);)k.aggregate(new f({tailShift:-1})).aggregate(this.remove(g-1))}else i===h.FORCE_RIGHT&&r.unshift();return k.aggregate(this.append(s,a,r))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!w(this,t)}typedValueEquals(t){const e=this.typedValue;return t===e||v.EMPTY_VALUES.includes(t)&&v.EMPTY_VALUES.includes(e)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new f}}v.DEFAULTS={skipInvalid:!0},v.EMPTY_VALUES=[void 0,null,""],p.Masked=v;class b{constructor(t,e){t===void 0&&(t=[]),e===void 0&&(e=0),this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=S(t)?new F(String(t)):t;const e=this.chunks[this.chunks.length-1],s=e&&(e.stop===t.stop||t.stop==null)&&t.from===e.from+e.toString().length;if(t instanceof F)s?e.extend(t.toString()):this.chunks.push(t);else if(t instanceof b){if(t.stop==null){let i;for(;t.chunks.length&&t.chunks[0].stop==null;)i=t.chunks.shift(),i.from+=t.from,this.extend(i)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof p.MaskedPattern))return new F(this.toString()).appendTo(t);const e=new f;for(let s=0;s<this.chunks.length;++s){const i=this.chunks[s],a=t._mapPosToBlock(t.displayValue.length),n=i.stop;let r;if(n!=null&&(!a||a.index<=n)&&((i instanceof b||t._stops.indexOf(n)>=0)&&e.aggregate(t._appendPlaceholder(n)),r=i instanceof b&&t._blocks[n]),r){const l=r.appendTail(i);e.aggregate(l);const o=i.toString().slice(l.rawInserted.length);o&&e.aggregate(t.append(o,{tail:!0}))}else e.aggregate(t.append(i.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e,...s}=t;Object.assign(this,s),this.chunks=e.map(i=>{const a="chunks"in i?new b:new F;return a.state=i,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const e=t!=null?t-this.from:t;let s=0;for(;s<this.chunks.length;){const i=this.chunks[s],a=i.unshift(e);if(i.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const e=this.chunks[t],s=e.shift();if(e.toString()){if(!s)break;--t}else this.chunks.splice(t,1);if(s)return s}return""}}class vt{constructor(t,e){this.masked=t,this._log=[];const{offset:s,index:i}=t._mapPosToBlock(e)||(e<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=i,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){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))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((e=this.block)==null?void 0:e.displayValue.length)||0){var e;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,h.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,h.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,h.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,h.NONE),!0})}}class W{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new f}nearestInputPos(t,e){e===void 0&&(e=h.NONE);const s=0,i=this._value.length;switch(e){case h.LEFT:case h.FORCE_LEFT:return s;case h.NONE:case h.RIGHT:case h.FORCE_RIGHT:default:return i}}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),this._isRawInput?e-t:0}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this._value.length),s===void 0&&(s={}),s.raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,e){if(e===void 0&&(e={}),this.isFilled)return new f;const s=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||e.input||e.raw)&&(!e.raw||!s)&&!e.tail,n=new f({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(e.raw||e.input),n}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new f;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new F("")}appendTail(t){return S(t)&&(t=new F(String(t))),t.appendTo(this)}append(t,e,s){const i=this._appendChar(t[0],e);return s!=null&&(i.tailShift+=this.appendTail(s).tailShift),i}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class O{constructor(t){const{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r,...l}=t;this.masked=x(l),Object.assign(this,{parent:e,isOptional:s,placeholderChar:i,displayChar:a,lazy:n,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),t===0&&e>=1?(this.isFilled=!1,this.masked.remove(t,e)):new f}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,e){if(e===void 0&&(e={}),this.isFilled)return new f;const s=this.masked.state;let i=this.masked._appendChar(t,this.currentMaskFlags(e));return i.inserted&&this.doValidate(e)===!1&&(i=new f,this.masked.state=s),!i.inserted&&!this.isOptional&&!this.lazy&&!e.input&&(i.inserted=this.placeholderChar),i.skip=!i.inserted&&!this.isOptional,this.isFilled=!!i.inserted,i}append(t,e,s){return this.masked.append(t,this.currentMaskFlags(e),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new f:(this.isFilled=!0,new f({inserted:this.placeholderChar}))}_appendEager(){return new f}extractTail(t,e){return this.masked.extractTail(t,e)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),this.masked.extractInput(t,e,s)}nearestInputPos(t,e){e===void 0&&(e=h.NONE);const s=0,i=this.value.length,a=Math.min(Math.max(t,s),i);switch(e){case h.LEFT:case h.FORCE_LEFT:return this.isComplete?a:s;case h.RIGHT:case h.FORCE_RIGHT:return this.isComplete?a:i;case h.NONE:default:return a}}totalInputPositions(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.value.length),this.value.slice(t,e).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var e;return{...t,_beforeTailState:(t==null||(e=t._beforeTailState)==null?void 0:e.masked)||(t==null?void 0:t._beforeTailState)}}pad(t){return new f}}O.DEFAULT_DEFINITIONS={0:/\d/,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]/,"*":/./};class Et extends v{updateOptions(t){super.updateOptions(t)}_update(t){const e=t.mask;e&&(t.validate=s=>s.search(e)>=0),super._update(t)}}p.MaskedRegExp=Et;class E extends v{constructor(t){super({...E.DEFAULTS,...t,definitions:Object.assign({},O.DEFAULT_DEFINITIONS,t==null?void 0:t.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const e=this.mask;if(!e||!t)return;let s=!1,i=!1;for(let a=0;a<e.length;++a){if(this.blocks){const o=e.slice(a),d=Object.keys(this.blocks).filter(g=>o.indexOf(g)===0);d.sort((g,m)=>m.length-g.length);const k=d[0];if(k){const{expose:g,repeat:m,...C}=M(this.blocks[k]),I={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...C,repeat:m,parent:this},V=m!=null?new p.RepeatBlock(I):x(I);V&&(this._blocks.push(V),g&&(this.exposeBlock=V),this._maskedBlocks[k]||(this._maskedBlocks[k]=[]),this._maskedBlocks[k].push(this._blocks.length-1)),a+=k.length-1;continue}}let n=e[a],r=n in t;if(n===E.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(n==="{"||n==="}"){s=!s;continue}if(n==="["||n==="]"){i=!i;continue}if(n===E.ESCAPE_CHAR){if(++a,n=e[a],!n)break;r=!1}const l=r?new O({isOptional:i,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...M(t[n]),parent:this}):new W({char:n,eager:this.eager,isUnmasking:s});this._blocks.push(l)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:e,...s}=t;this._blocks.forEach((i,a)=>i.state=e[a]),super.state=s}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,e)=>t+=e.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(e),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,e)=>t+=e.value,"")}set value(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(e),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const e=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(e),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,e)=>t+=e.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const e=new f;let s=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(s==null)return e;this._blocks[s].isFilled&&++s;for(let i=s;i<this._blocks.length;++i){const a=this._blocks[i]._appendEager();if(!a.inserted)break;e.aggregate(a)}return e}_appendCharRaw(t,e){e===void 0&&(e={});const s=this._mapPosToBlock(this.displayValue.length),i=new f;if(!s)return i;for(let n=s.index,r;r=this._blocks[n];++n){var a;const l=r._appendChar(t,{...e,_beforeTailState:(a=e._beforeTailState)==null||(a=a._blocks)==null?void 0:a[n]});if(i.aggregate(l),l.consumed)break}return i}extractTail(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=new b;return t===e||this._forEachBlocksInRange(t,e,(i,a,n,r)=>{const l=i.extractTail(n,r);l.stop=this._findStopBefore(a),l.from=this._blockStartPos(a),l instanceof b&&(l.blockIndex=a),s.extend(l)}),s}extractInput(t,e,s){if(t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),s===void 0&&(s={}),t===e)return"";let i="";return this._forEachBlocksInRange(t,e,(a,n,r,l)=>{i+=a.extractInput(r,l,s)}),i}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const i=this._stops[s];if(i<=t)e=i;else break}return e}_appendPlaceholder(t){const e=new f;if(this.lazy&&t==null)return e;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return e;const i=s.index,a=t??this._blocks.length;return this._blocks.slice(i,a).forEach(n=>{if(!n.lazy||t!=null){var r;e.aggregate(n._appendPlaceholder((r=n._blocks)==null?void 0:r.length))}}),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const i=this._blocks[s],a=e.length;if(e+=i.displayValue,t<=e.length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((e,s)=>e+=s.displayValue.length,0)}_forEachBlocksInRange(t,e,s){e===void 0&&(e=this.displayValue.length);const i=this._mapPosToBlock(t);if(i){const a=this._mapPosToBlock(e),n=a&&i.index===a.index,r=i.offset,l=a&&n?a.offset:this._blocks[i.index].displayValue.length;if(s(this._blocks[i.index],i.index,r,l),a&&!n){for(let o=i.index+1;o<a.index;++o)s(this._blocks[o],o,0,this._blocks[o].displayValue.length);s(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,(i,a,n,r)=>{s.aggregate(i.remove(n,r))}),s}nearestInputPos(t,e){if(e===void 0&&(e=h.NONE),!this._blocks.length)return 0;const s=new vt(this,t);if(e===h.NONE)return s.pushRightBeforeInput()||(s.popState(),s.pushLeftBeforeInput())?s.pos:this.displayValue.length;if(e===h.LEFT||e===h.FORCE_LEFT){if(e===h.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===t)return t;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),e===h.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=t||(s.popState(),s.ok&&s.pos<=t))return s.pos;s.popState()}return s.ok?s.pos:e===h.FORCE_LEFT?0:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:0)}return e===h.RIGHT||e===h.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:e===h.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:this.nearestInputPos(t,h.LEFT))):t}totalInputPositions(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);let s=0;return this._forEachBlocksInRange(t,e,(i,a,n,r)=>{s+=i.totalInputPositions(n,r)}),s}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(s=>this._blocks[s]):[]}pad(t){const e=new f;return this._forEachBlocksInRange(0,this.displayValue.length,s=>e.aggregate(s.pad(t))),e}}E.DEFAULTS={...v.DEFAULTS,lazy:!0,placeholderChar:"_"},E.STOP_CHAR="`",E.ESCAPE_CHAR="\\",E.InputDefinition=O,E.FixedDefinition=W,p.MaskedPattern=E;class L extends E{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:e=this.to||0,from:s=this.from||0,maxLength:i=this.maxLength||0,autofix:a=this.autofix,...n}=t;this.to=e,this.from=s,this.maxLength=Math.max(String(e).length,i),this.autofix=a;const r=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0");let o=0;for(;o<l.length&&l[o]===r[o];)++o;n.mask=l.slice(0,o).replace(/0/g,"\\0")+"0".repeat(this.maxLength-o),super._update(n)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let e="",s="";const[,i,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(i.length)+a,s="9".repeat(i.length)+a),e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[e,s]}doPrepareChar(t,e){e===void 0&&(e={});let s;return[t,s]=super.doPrepareChar(t.replace(/\D/g,""),e),t||(s.skip=!this.isComplete),[t,s]}_appendCharRaw(t,e){if(e===void 0&&(e={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,e);const s=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),[a,n]=this.boundaries(this.value+t);return Number(n)<this.from?super._appendCharRaw(s[this.value.length],e):Number(a)>this.to?!e.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],e).aggregate(this._appendCharRaw(t,e)):super._appendCharRaw(i[this.value.length],e):super._appendCharRaw(t,e)}doValidate(t){const e=this.value;if(e.search(/[^0]/)===-1&&e.length<=this._matchFrom)return!0;const[i,a]=this.boundaries(e);return this.from<=Number(a)&&Number(i)<=this.to&&super.doValidate(t)}pad(t){const e=new f;if(this.value.length===this.maxLength)return e;const s=this.value,i=this.maxLength-this.value.length;if(i){this.reset();for(let a=0;a<i;++a)e.aggregate(super._appendCharRaw("0",t));s.split("").forEach(a=>this._appendCharRaw(a))}return e}}p.MaskedRange=L;const Ct="d{.}`m{.}`Y";class y extends E{static extractPatternOptions(t){const{mask:e,pattern:s,...i}=t;return{...i,mask:S(e)?e:s}}constructor(t){super(y.extractPatternOptions({...y.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:e,pattern:s,blocks:i,...a}={...y.DEFAULTS,...t},n=Object.assign({},y.GET_DEFAULT_BLOCKS());t.min&&(n.Y.from=t.min.getFullYear()),t.max&&(n.Y.to=t.max.getFullYear()),t.min&&t.max&&n.Y.from===n.Y.to&&(n.m.from=t.min.getMonth()+1,n.m.to=t.max.getMonth()+1,n.m.from===n.m.to&&(n.d.from=t.min.getDate(),n.d.to=t.max.getDate())),Object.assign(n,this.blocks,i),super._update({...a,mask:S(e)?e:s,blocks:n})}doValidate(t){const e=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&e!=null&&(this.min==null||this.min<=e)&&(this.max==null||e<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(y.extractPatternOptions(t))}}y.GET_DEFAULT_BLOCKS=()=>({d:{mask:L,from:1,to:31,maxLength:2},m:{mask:L,from:1,to:12,maxLength:2},Y:{mask:L,from:1900,to:9999}}),y.DEFAULTS={...E.DEFAULTS,mask:Date,pattern:Ct,format:(u,t)=>{if(!u)return"";const e=String(u.getDate()).padStart(2,"0"),s=String(u.getMonth()+1).padStart(2,"0"),i=u.getFullYear();return[e,s,i].join(".")},parse:(u,t)=>{const[e,s,i]=u.split(".").map(Number);return new Date(i,s-1,e)}},p.MaskedDate=y;class N extends v{constructor(t){super({...N.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(e=>{const{expose:s,...i}=M(e),a=x({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...i});return s&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,e){e===void 0&&(e={});const s=this._applyDispatch(t,e);return this.currentMask&&s.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(e))),s}_applyDispatch(t,e,s){t===void 0&&(t=""),e===void 0&&(e={}),s===void 0&&(s="");const i=e.tail&&e._beforeTailState!=null?e._beforeTailState._value:this.value,a=this.rawInputValue,n=e.tail&&e._beforeTailState!=null?e._beforeTailState._rawInputValue:a,r=a.slice(n.length),l=this.currentMask,o=new f,d=l==null?void 0:l.state;return this.currentMask=this.doDispatch(t,{...e},s),this.currentMask&&(this.currentMask!==l?(this.currentMask.reset(),n&&(this.currentMask.append(n,{raw:!0}),o.tailShift=this.currentMask.value.length-i.length),r&&(o.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):d&&(this.currentMask.state=d)),o}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const e=new f;return t&&e.aggregate(this._applyDispatch("",{},t)),e.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var e,s;return{...t,_beforeTailState:((e=t._beforeTailState)==null?void 0:e.currentMaskRef)===this.currentMask&&((s=t._beforeTailState)==null?void 0:s.currentMask)||t._beforeTailState}}doDispatch(t,e,s){return e===void 0&&(e={}),s===void 0&&(s=""),this.dispatch(t,this,e,s)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,e){e===void 0&&(e={});let[s,i]=super.doPrepare(t,e);if(this.currentMask){let a;[s,a]=super.doPrepare(s,this.currentMaskFlags(e)),i=i.aggregate(a)}return[s,i]}doPrepareChar(t,e){e===void 0&&(e={});let[s,i]=super.doPrepareChar(t,e);if(this.currentMask){let a;[s,a]=super.doPrepareChar(s,this.currentMaskFlags(e)),i=i.aggregate(a)}return[s,i]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(e=>e.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,e){const s=new f;return this.currentMask&&s.aggregate(this.currentMask.remove(t,e)).aggregate(this._applyDispatch()),s}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(e=>e.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:i,...a}=t;e&&this.compiledMasks.forEach((n,r)=>n.state=e[r]),s!=null&&(this.currentMask=s,this.currentMask.state=i),super.state=a}extractInput(t,e,s){return this.currentMask?this.currentMask.extractInput(t,e,s):""}extractTail(t,e){return this.currentMask?this.currentMask.extractTail(t,e):super.extractTail(t,e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,e){return this.currentMask?this.currentMask.nearestInputPos(t,e):super.nearestInputPos(t,e)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((e,s)=>{if(!t[s])return;const{mask:i,...a}=t[s];return w(e,a)&&e.maskEquals(i)}):super.maskEquals(t)}typedValueEquals(t){var e;return!!((e=this.currentMask)!=null&&e.typedValueEquals(t))}}N.DEFAULTS={...v.DEFAULTS,dispatch:(u,t,e,s)=>{if(!t.compiledMasks.length)return;const i=t.rawInputValue,a=t.compiledMasks.map((n,r)=>{const l=t.currentMask===n,o=l?n.displayValue.length:n.nearestInputPos(n.displayValue.length,h.FORCE_LEFT);return n.rawInputValue!==i?(n.reset(),n.append(i,{raw:!0})):l||n.remove(o),n.append(u,t.currentMaskFlags(e)),n.appendTail(s),{index:r,weight:n.rawInputValue.length,totalInputPositions:n.totalInputPositions(0,Math.max(o,n.nearestInputPos(n.displayValue.length,h.FORCE_LEFT)))}});return a.sort((n,r)=>r.weight-n.weight||r.totalInputPositions-n.totalInputPositions),t.compiledMasks[a[0].index]}},p.MaskedDynamic=N;class U extends E{constructor(t){super({...U.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:e,...s}=t;if(e){const i=e.map(r=>r.length),a=Math.min(...i),n=Math.max(...i)-a;s.mask="*".repeat(a),n&&(s.mask+="["+"*".repeat(n)+"]"),this.enum=e}super._update(s)}_appendCharRaw(t,e){e===void 0&&(e={});const s=Math.min(this.nearestInputPos(0,h.FORCE_RIGHT),this.value.length),i=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,s));if(i.length){i.length===1&&this._forEachBlocksInRange(0,this.value.length,(n,r)=>{const l=i[0][r];r>=this.value.length||l===n.value||(n.reset(),n._appendChar(l,e))});const a=super._appendCharRaw(i[0][this.value.length],e);return i.length===1&&i[0].slice(this.unmaskedValue.length).split("").forEach(n=>a.aggregate(super._appendCharRaw(n))),a}return new f({skip:!this.isComplete})}extractTail(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),new F("",t)}remove(t,e){if(t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),t===e)return new f;const s=Math.min(super.nearestInputPos(0,h.FORCE_RIGHT),this.value.length);let i;for(i=t;i>=0&&!(this.enum.filter(r=>this.matchValue(r,this.value.slice(s,i),s)).length>1);--i);const a=super.remove(i,e);return a.tailShift+=i-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}U.DEFAULTS={...E.DEFAULTS,matchValue:(u,t,e)=>u.indexOf(t,e)===e},p.MaskedEnum=U;class At extends v{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}p.MaskedFunction=At;var J;class A extends v{constructor(t){super({...A.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),e="\\d*",s=(this.scale?"("+P(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+e+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(P).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(P(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepareChar(t,e){e===void 0&&(e={});const[s,i]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(e.input&&e.raw||!e.input&&!e.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),e);return t&&!s&&(i.skip=!0),s&&!this.allowPositive&&!this.value&&s!=="-"&&i.aggregate(this._appendChar("-")),[s,i]}_separatorsCount(t,e){e===void 0&&(e=!1);let s=0;for(let i=0;i<t;++i)this._value.indexOf(this.thousandsSeparator,i)===i&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,e,s){return t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t,e){e===void 0&&(e={});const s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const n=this.number;let r=!isNaN(n),l=!1;if(r){let g;this.min!=null&&this.min<0&&this.number<this.min&&(g=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(g=this.max),g!=null&&(this.autofix?(this._value=this.format(g,this).replace(A.UNMASKED_RADIX,this.radix),l||(l=a===this._value&&!e.tail)):r=!1),r&&(r=!!this._value.match(this._numberRegExp))}let o;r?o=new f({inserted:this._value.slice(a.length),rawInserted:l?"":t,skip:l}):(this._value=a,o=new f),this._value=this._insertThousandsSeparators(this._value);const d=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,k=this._separatorsCountFromSlice(d);return o.tailShift+=(k-i)*this.thousandsSeparator.length,o}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const i=this._findSeparatorAround(e);return i>=0&&(e=i+this.thousandsSeparator.length),[t,e]}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length),[t,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+i));const n=this._separatorsCountFromSlice(s);return new f({tailShift:(n-a)*this.thousandsSeparator.length})}nearestInputPos(t,e){if(!this.thousandsSeparator)return t;switch(e){case h.NONE:case h.LEFT:case h.FORCE_LEFT:{const s=this._findSeparatorAround(t-1);if(s>=0){const i=s+this.thousandsSeparator.length;if(t<i||this.value.length<=i||e===h.FORCE_LEFT)return s}break}case h.RIGHT:case h.FORCE_RIGHT:{const s=this._findSeparatorAround(t);if(s>=0)return s+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let e=t;this.min!=null&&(e=Math.max(e,this.min)),this.max!=null&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=this.format(e,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(s,i,a,n)=>i+n),t.length&&!/\d$/.test(e[0])&&(e[0]=e[0]+"0"),e.length>1&&(e[1]=e[1].replace(/0*$/,""),e[1].length||(e.length=1)),this._insertThousandsSeparators(e.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}doSkipInvalid(t,e,s){e===void 0&&(e={});const i=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===A.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,e,s)&&!i}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,A.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(A.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||A.EMPTY_VALUES.includes(t)&&A.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}J=A,A.UNMASKED_RADIX=".",A.EMPTY_VALUES=[...v.EMPTY_VALUES,0],A.DEFAULTS={...v.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[J.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:u=>u.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},p.MaskedNumber=A;const q={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Q(u,t,e){t===void 0&&(t=q.MASKED),e===void 0&&(e=q.MASKED);const s=x(u);return i=>s.runIsolated(a=>(a[t]=i,a[e]))}function Ft(u,t,e,s){return Q(t,e,s)(u)}p.PIPE_TYPE=q,p.createPipe=Q,p.pipe=Ft;class xt extends E{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var e,s,i;const{repeat:a,...n}=M(t);this._blockOpts=Object.assign({},this._blockOpts,n);const r=x(this._blockOpts);this.repeat=(e=(s=a??r.repeat)!=null?s:this.repeat)!=null?e:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((i=this._blocks)==null?void 0:i.length)||0,this.repeatFrom)),blocks:{m:r},eager:r.eager,overwrite:r.overwrite,skipInvalid:r.skipInvalid,lazy:r.lazy,placeholderChar:r.placeholderChar,displayChar:r.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(x(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,e){e===void 0&&(e={});const s=new f;for(let l=(i=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?i:Math.max(this._blocks.length-1,0),o,d;o=(n=this._blocks[l])!=null?n:d=!d&&this._allocateBlock(l);++l){var i,a,n,r;const k=o._appendChar(t,{...e,_beforeTailState:(r=e._beforeTailState)==null||(r=r._blocks)==null?void 0:r[l]});if(k.skip&&d){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(k),k.consumed)break}return s}_trimEmptyTail(t,e){var s,i;t===void 0&&(t=0);const a=Math.max(((s=this._mapPosToBlock(t))==null?void 0:s.index)||0,this.repeatFrom,0);let n;e!=null&&(n=(i=this._mapPosToBlock(e))==null?void 0:i.index),n==null&&(n=this._blocks.length-1);let r=0;for(let l=n;a<=l&&!this._blocks[l].unmaskedValue;--l,++r);r&&(this._blocks.splice(n-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(t,e){t===void 0&&(t=0),e===void 0&&(e=this.displayValue.length);const s=super.remove(t,e);return this._trimEmptyTail(t,e),s}totalInputPositions(t,e){return t===void 0&&(t=0),e==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,e)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}p.RepeatBlock=xt;try{globalThis.IMask=p}catch{}var yt={mask:void 0,prepare:Function,prepareChar:Function,validate:Function,commit:Function,overwrite:{type:Boolean,required:!1,default:void 0},eager:{required:!1,default:void 0,validator:u=>["append","remove"].includes(u)||typeof u=="boolean"},skipInvalid:{type:Boolean,required:!1,default:void 0},placeholderChar:String,displayChar:String,lazy:{type:Boolean,required:!1,default:void 0},definitions:Object,blocks:Object,enum:Array,maxLength:Number,from:Number,to:Number,pattern:String,format:Function,parse:Function,autofix:{required:!1,default:void 0,validator:u=>u==="pad"||typeof u=="boolean"},radix:String,thousandsSeparator:String,mapToRadix:Array,scale:Number,normalizeZeros:{type:Boolean,required:!1,default:void 0},padFractionalZeros:{type:Boolean,required:!1,default:void 0},min:[Number,Date],max:[Number,Date],dispatch:Function};function St(u,t){let{emit:e,onAccept:s,onComplete:i,defaultValue:a,defaultUnmaskedValue:n,defaultTypedValue:r}=t===void 0?{}:t;const l=c.isRef(u)?u:c.ref(u),o=c.ref(),d=c.ref(),k=c.ref(""),g=c.ref(""),m=c.ref();let C,I=k.value,V=g.value,z=m.value;function it(){z=m.value=d.value.typedValue,V=g.value=d.value.unmaskedValue,I=k.value=d.value.value}function j(_){it(),e&&(e("accept",k.value,_),e("accept:masked",k.value,_),e("accept:typed",m.value,_),e("accept:unmasked",g.value,_)),s==null||s(_)}function Dt(_){e&&(e("complete",d.value.value,_),e("complete:masked",d.value.value,_),e("complete:typed",d.value.typedValue,_),e("complete:unmasked",d.value.unmaskedValue,_)),i==null||i(_)}const at=()=>{!d.value||g.value===void 0||(V!==g.value&&(d.value.unmaskedValue=g.value,d.value.unmaskedValue!==g.value&&j()),V=void 0)};c.watch(g,at);const ut=()=>{!d.value||k.value===void 0||(I!==k.value&&(d.value.value=k.value,d.value.value!==k.value&&j()),I=void 0)};c.watch(k,ut);const nt=()=>{!d.value||m.value===void 0||(z!==m.value&&(d.value.typedValue=m.value,d.value.masked.typedValueEquals(m.value)||j()),z=void 0)};c.watch(m,nt);function rt(){C=o.value;const _=l.value;!C||!(_!=null&&_.mask)||(d.value=p(C,_),a!==void 0&&(k.value=a),n!==void 0&&(g.value=n),r!==void 0&&(m.value=r),at(),ut(),nt(),it(),d.value.on("accept",j).on("complete",Dt))}function lt(){var _;(_=d.value)==null||_.destroy(),d.value=void 0}return c.onMounted(rt),c.onUnmounted(lt),c.watch([o,l],()=>{const _=o.value,G=l.value;(!(G!=null&&G.mask)||_!==C)&<(),_&&(d.value?d.value.updateOptions(G):rt())}),{el:o,mask:c.readonly(d),masked:k,unmasked:g,typed:m}}function Bt(u,t){return u={...u},Object.keys(u).forEach(e=>{(u[e]===void 0||t.includes(e))&&delete u[e]}),u}const bt=["typed","unmasked","value","modelValue"];c.defineComponent({name:"imask-input",inheritAttrs:!1,props:{modelValue:String,value:String,unmasked:String,typed:{validator:()=>!0},...yt},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"],setup(u,t){let{attrs:e,emit:s}=t;const{el:i,mask:a,masked:n,unmasked:r,typed:l}=St(Bt(u,bt),{emit:s,onAccept:m=>{const C=n.value;s("accept:value",C,m),s("update:value",C,m),s("update:masked",C,m),s("update:modelValue",C,m),s("update:unmasked",r.value,m),s("update:typed",l.value,m)},onComplete:m=>{s("complete:value",n.value,m)}}),o=c.toRef(u,"value"),d=c.toRef(u,"modelValue"),k=c.toRef(u,"unmasked"),g=c.toRef(u,"typed");return n.value=d.value||o.value||"",r.value=k.value||"",l.value=g.value,c.watch(o,m=>n.value=m),c.watch(d,m=>n.value=m),c.watch(k,m=>r.value=m),c.watch(g,m=>l.value=m),()=>{const m={...e,value:u.value!=null?u.value:u.modelValue!=null?u.modelValue:a.value?a.value.displayValue:"",ref:i};return u.mask||(m.onInput=C=>{s("update:modelValue",C.target.value),s("update:value",C.target.value)}),c.h("input",m)}}});var Vt={name:"imask",beforeMount:(u,t)=>{let{value:e}=t;e&&et(u,e)},updated:(u,t)=>{let{value:e}=t;e?u.maskRef?(u.maskRef.updateOptions(e),u.value!==u.maskRef.value&&u.maskRef._onChange()):et(u,e):st(u)},unmounted:u=>{st(u)}};function tt(u,t,e){const s=document.createEvent("CustomEvent");s.initCustomEvent(t,!0,!0,e),u.dispatchEvent(s)}function et(u,t){u.maskRef=p(u,t).on("accept",()=>tt(u,"accept",u.maskRef)).on("complete",()=>tt(u,"complete",u.maskRef))}function st(u){u.maskRef&&(u.maskRef.destroy(),delete u.maskRef)}const It={formHelpers:{...ht,useInput:dt,useTextbox:pt,useMaskedInput:ct},install:u=>{u.directive("imask",Vt),u.provide("responsiveHelpers",{responsiveState:D,updateResponsiveState:ot})}};B.default=It,Object.defineProperties(B,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phila/phila-ui-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"private": false,
|
|
6
6
|
"files": [
|
|
@@ -41,5 +41,5 @@
|
|
|
41
41
|
"registry": "https://registry.npmjs.com/",
|
|
42
42
|
"access": "public"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "fdbb95c5dead04026c297ab8c38462de7456a374"
|
|
45
45
|
}
|