Socket
Socket
Sign inDemoInstall

imask

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

imask - npm Package Compare versions

Comparing version 2.2.0 to 3.0.0

748

dist/imask.es.js

@@ -0,1 +1,2 @@

/** Checks if value is string */
function isString(str) {

@@ -5,2 +6,3 @@ return typeof str === 'string' || str instanceof String;

/** Conforms string with fallback */
function conform(res, str, fallback = '') {

@@ -10,2 +12,8 @@ return isString(res) ? res : res ? str : fallback;

/**
Direction
@prop {number} NONE
@prop {number} LEFT
@prop {number} RIGHT
*/
const DIRECTION = {

@@ -15,5 +23,9 @@ NONE: 0,

RIGHT: 1
/**
Direction
@enum {number}
*/
};
/** Returns next char position in direction */
function indexInDirection(pos, direction) {

@@ -24,2 +36,3 @@ if (direction === DIRECTION.LEFT) --pos;

/** Escapes regular expression control chars */
function escapeRegExp(str) {

@@ -73,4 +86,9 @@ return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');

/** Selection range */
/** Provides details of changing input */
class ActionDetails {
/** Old input value */
/** Current input value */
constructor(value, cursorPos, oldValue, oldSelection) {

@@ -88,2 +106,10 @@ this.value = value;

/**
Start changing position
@readonly
*/
/** Old selection */
/** Current cursor position */
get startChangePos() {

@@ -93,2 +119,6 @@ return Math.min(this.cursorPos, this.oldSelection.start);

/**
Inserted symbols count
@readonly
*/
get insertedCount() {

@@ -98,2 +128,6 @@ return this.cursorPos - this.startChangePos;

/**
Inserted symbols
@readonly
*/
get inserted() {

@@ -103,2 +137,6 @@ return this.value.substr(this.startChangePos, this.insertedCount);

/**
Removed symbols count
@readonly
*/
get removedCount() {

@@ -111,2 +149,6 @@ // Math.max for opposite operation

/**
Removed symbols
@readonly
*/
get removed() {

@@ -116,2 +158,6 @@ return this.oldValue.substr(this.startChangePos, this.removedCount);

/**
Unchanged head symbols
@readonly
*/
get head() {

@@ -121,2 +167,6 @@ return this.value.substring(0, this.startChangePos);

/**
Unchanged tail symbols
@readonly
*/
get tail() {

@@ -126,2 +176,6 @@ return this.value.substring(this.startChangePos + this.insertedCount);

/**
Remove direction
@readonly
*/
get removeDirection() {

@@ -135,4 +189,14 @@ if (!this.removedCount || this.insertedCount) return DIRECTION.NONE;

/**
Provides details of changing model value
@param {Object} [details]
@param {string} [details.inserted] - Inserted symbols
@param {boolean} [details.overflow] - Is overflowed
@param {number} [details.removeCount] - Removed symbols count
@param {number} [details.shift] - Additional offset if any changes occurred before current position
*/
class ChangeDetails {
/** Additional offset if any changes occurred before current position */
/** Inserted symbols */
constructor(details) {

@@ -142,3 +206,2 @@ Object.assign(this, {

overflow: false,
removedCount: 0,
shift: 0

@@ -148,5 +211,10 @@ }, details);

/**
Aggregate changes
@returns {ChangeDetails} `this`
*/
/** Is overflowed */
aggregate(details) {
this.inserted += details.inserted;
this.removedCount += details.removedCount;
this.shift += details.shift;

@@ -158,6 +226,8 @@ this.overflow = this.overflow || details.overflow;

/** Total offset considering all changes */
get offset() {
return this.shift + this.inserted.length - this.removedCount;
return this.shift + this.inserted.length;
}
/** Raw inserted is used by dynamic mask */
get rawInserted() {

@@ -224,4 +294,16 @@ return this._rawInserted != null ? this._rawInserted : this.inserted;

/** Supported mask type */
/** Append flags */
/** Extract flags */
/** Provides common masking stuff */
class Masked {
/** Does additional processing in the end of editing */
/** Transforms value before mask processing */
constructor(opts) {

@@ -231,4 +313,12 @@ this._value = '';

this.isInitialized = true;
} // $Shape<MaskedOptions>; TODO after fix https://github.com/facebook/flow/issues/4773
}
/** Sets and applies new options */
/** */
/** Validates if value is acceptable */
// $Shape<MaskedOptions>; TODO after fix https://github.com/facebook/flow/issues/4773
/** @type {Mask} */
updateOptions(opts) {

@@ -238,2 +328,6 @@ this.withValueRefresh(this._update.bind(this, opts));

/**
Sets new options
@protected
*/
_update(opts) {

@@ -243,2 +337,3 @@ Object.assign(this, opts);

/** Clones masked with options and value */
clone() {

@@ -250,2 +345,9 @@ const m = new Masked(this);

/** */
assign(source) {
// $FlowFixMe
return Object.assign(this, source);
}
/** Resets value */
reset() {

@@ -255,2 +357,3 @@ this._value = '';

/** */
get value() {

@@ -264,2 +367,3 @@ return this._value;

/** Resolve new value */
resolve(value) {

@@ -273,4 +377,5 @@ this.reset();

/** */
get unmaskedValue() {
return this._unmask();
return this.value;
}

@@ -285,2 +390,3 @@

/** Value that includes raw user input */
get rawInputValue() {

@@ -297,2 +403,3 @@ return this.extractInput(0, this.value.length, { raw: true });

/** */
get isComplete() {

@@ -302,2 +409,3 @@ return true;

/** Finds nearest input position in direction */
nearestInputPos(cursorPos, direction) {

@@ -307,2 +415,3 @@ return cursorPos;

/** Extracts value in range considering flags */
extractInput(fromPos = 0, toPos = this.value.length, flags) {

@@ -312,10 +421,17 @@ return this.value.slice(fromPos, toPos);

/** Extracts tail in range */
_extractTail(fromPos = 0, toPos = this.value.length) {
return this.extractInput(fromPos, toPos);
return {
value: this.extractInput(fromPos, toPos),
fromPos,
toPos
};
}
_appendTail(tail = "") {
return this._append(tail, { tail: true });
/** Appends tail */
_appendTail(tail) {
return this._append(tail ? tail.value : '', { tail: true });
}
/** Appends symbols considering flags */
_append(str, flags = {}) {

@@ -331,4 +447,3 @@ const oldValueLength = this.value.length;

if (this.doValidate(flags) === false) {
// $FlowFixMe
Object.assign(this, consistentValue);
this.assign(consistentValue);
if (!flags.input) {

@@ -350,2 +465,3 @@ // in `input` mode dont skip invalid chars

/** Appends symbols considering tail */
appendWithTail(str, tail) {

@@ -364,9 +480,7 @@ // TODO refactor

if (!tailAppended || this.doValidate({ tail: true }) === false) {
// $FlowFixMe
Object.assign(this, consistentValue);
this.assign(consistentValue);
break;
}
// $FlowFixMe
Object.assign(this, consistentAppended);
this.assign(consistentAppended);
consistentValue = this.clone();

@@ -387,10 +501,9 @@ aggregateDetails.aggregate(appendDetails);

_unmask() {
return this.value;
}
/** */
remove(from = 0, count = this.value.length - from) {
this._value = this.value.slice(0, from) + this.value.slice(from + count);
return new ChangeDetails();
}
/** Calls function and reapplies current value */
withValueRefresh(fn) {

@@ -410,2 +523,6 @@ if (this._refreshing || !this.isInitialized) return fn();

/**
Prepares string before mask processing
@protected
*/
doPrepare(str, flags = {}) {

@@ -415,2 +532,6 @@ return this.prepare(str, this, flags);

/**
Validates if value is acceptable
@protected
*/
doValidate(flags) {

@@ -420,2 +541,6 @@ return this.validate(this.value, this, flags);

/**
Does additional processing in the end of editing
@protected
*/
doCommit() {

@@ -428,2 +553,3 @@ this.commit(this.value, this);

/** */
splice(start, deleteCount, inserted, removeDirection) {

@@ -433,12 +559,10 @@ const tailPos = start + deleteCount;

const startChangePos = this.nearestInputPos(start, removeDirection);
this.remove(startChangePos);
const changeDetails = this.appendWithTail(inserted, tail);
let startChangePos = this.nearestInputPos(start, removeDirection);
const changeDetails = new ChangeDetails({
shift: startChangePos - start // adjust shift if start was aligned
}).aggregate(this.remove(startChangePos)).aggregate(this.appendWithTail(inserted, tail));
// adjust shift if start was aligned
changeDetails.shift += startChangePos - start;
return changeDetails;
}
}
Masked.DEFAULTS = {

@@ -450,2 +574,3 @@ prepare: val => val,

/** Get Masked class by mask type */
function maskedClass(mask) {

@@ -470,2 +595,3 @@ if (mask == null) {

/** Creates new {@link Masked} depending on mask type */
function createMask(opts) {

@@ -481,4 +607,12 @@ opts = Object.assign({}, opts); // clone

/** */
/** */
class PatternDefinition {
/** */
/** */
/** */
constructor(opts) {

@@ -493,2 +627,12 @@ // TODO flow

/** */
/** */
/** */
/** */
/** */
reset() {

@@ -500,2 +644,3 @@ this.isHollow = false;

/** */
get isInput() {

@@ -505,2 +650,3 @@ return this.type === PatternDefinition.TYPES.INPUT;

/** */
get isHiddenHollow() {

@@ -510,2 +656,3 @@ return this.isHollow && this.optional;

/** */
resolve(ch) {

@@ -521,2 +668,6 @@ if (!this._masked) return false;

};
/**
@prop {string} INPUT
@prop {string} FIXED
*/
PatternDefinition.TYPES = {

@@ -527,4 +678,23 @@ INPUT: 'input',

/** */
/** */
/**
Pattern group symbols from parent
@param {MaskedPattern} masked - Internal {@link masked} model
@param {Object} opts
@param {string} opts.name - Group name
@param {number} opts.offset - Group offset in masked definitions array
@param {string} opts.mask - Group mask
@param {Function} [opts.validate] - Custom group validator
*/
class PatternGroup {
/** Group mask */
/** Group name */
/** */
constructor(masked, { name, offset, mask, validate }) {

@@ -538,2 +708,12 @@ this.masked = masked;

/** Slice of internal {@link masked} value */
/** Custom group validator */
/** Group offset in masked definitions array */
/** Internal {@link masked} model */
/** */
get value() {

@@ -543,2 +723,3 @@ return this.masked.value.slice(this.masked.mapDefIndexToPos(this.offset), this.masked.mapDefIndexToPos(this.offset + this.mask.length));

/** Unmasked slice of internal {@link masked} value */
get unmaskedValue() {

@@ -548,2 +729,3 @@ return this.masked.extractInput(this.masked.mapDefIndexToPos(this.offset), this.masked.mapDefIndexToPos(this.offset + this.mask.length));

/** Validates if current value is acceptable */
doValidate(flags) {

@@ -554,4 +736,9 @@ return this.validate(this.value, this, flags);

/**
Pattern group that validates number ranges
@param {number[]} range - [from, to]
@param {?number} maxlen - Maximum number length, will be padded with leading zeros
*/
class RangeGroup {
/** @type {Function} */
constructor([from, to], maxlen = String(to).length) {

@@ -565,3 +752,5 @@ this._from = from;

}
/** @type {string} */
get to() {

@@ -628,2 +817,3 @@ return this._to;

/** Pattern group that validates enum values */
function EnumGroup(enums) {

@@ -639,5 +829,37 @@ return {

class ChunksTailDetails {
constructor(chunks) {
this.chunks = chunks;
}
get value() {
return this.chunks.map(c => c.value).join('');
}
get fromPos() {
const firstChunk = this.chunks[0];
return firstChunk && firstChunk.stop;
}
get toPos() {
const lastChunk = this.chunks[this.chunks.length - 1];
return lastChunk && lastChunk.stop;
}
}
/**
Pattern mask
@param {Object} opts
@param {Object} opts.groups
@param {Object} opts.definitions
@param {string} opts.placeholderChar
@param {boolean} opts.lazy
*/
class MaskedPattern extends Masked {
// TODO deprecated, remove in 3.0
// TODO mask type
/** Single char for empty input */
/** */
constructor(opts = {}) {

@@ -649,20 +871,18 @@ // TODO type $Shape<MaskedPatternOptions>={} does not work

/**
@override
@param {Object} opts
*/
/** Show placeholder only when needed */
/** */
_update(opts = {}) {
opts.definitions = Object.assign({}, this.definitions, opts.definitions);
if (opts.placeholder != null) {
console.warn("'placeholder' option is deprecated and will be removed in next major release, use 'placeholderChar' and 'lazy' instead.");
if ('char' in opts.placeholder) opts.placeholderChar = opts.placeholder.char;
if ('lazy' in opts.placeholder) opts.lazy = opts.placeholder.lazy;
delete opts.placeholder;
}
if (opts.placeholderLazy != null) {
console.warn("'placeholderLazy' option is deprecated and will be removed in next major release, use 'lazy' instead.");
opts.lazy = opts.placeholderLazy;
delete opts.placeholderLazy;
}
super._update(opts);
this._updateMask();
this._rebuildMask();
}
_updateMask() {
/** */
_rebuildMask() {
const defs = this.definitions;

@@ -700,3 +920,3 @@ this._charDefs = [];

let char = pattern[i];
let type = !unmaskingBlock && char in defs ? PatternDefinition.TYPES.INPUT : PatternDefinition.TYPES.FIXED;
let type = char in defs ? PatternDefinition.TYPES.INPUT : PatternDefinition.TYPES.FIXED;
const unmasking = type === PatternDefinition.TYPES.INPUT || unmaskingBlock;

@@ -740,2 +960,5 @@ const optional = type === PatternDefinition.TYPES.INPUT && optionalBlock;

/**
@override
*/
doValidate(...args) {

@@ -745,2 +968,5 @@ return this._groupDefs.every(g$$1 => g$$1.doValidate(...args)) && super.doValidate(...args);

/**
@override
*/
clone() {

@@ -756,2 +982,5 @@ const m = new MaskedPattern(this);

/**
@override
*/
reset() {

@@ -764,2 +993,5 @@ super.reset();

/**
@override
*/
get isComplete() {

@@ -769,2 +1001,3 @@ return !this._charDefs.some((d, i) => d.isInput && !d.optional && (d.isHollow || !this.extractInput(i, i + 1)));

/** */
hiddenHollowsBefore(defIndex) {

@@ -774,2 +1007,3 @@ return this._charDefs.slice(0, defIndex).filter(d => d.isHiddenHollow).length;

/** Map definition index to position on view */
mapDefIndexToPos(defIndex) {

@@ -779,2 +1013,3 @@ return defIndex - this.hiddenHollowsBefore(defIndex);

/** Map position on view to definition index */
mapPosToDefIndex(pos) {

@@ -790,3 +1025,6 @@ let defIndex = pos;

_unmask() {
/**
@override
*/
get unmaskedValue() {
const str = this.value;

@@ -807,6 +1045,20 @@ let unmasked = '';

_appendTail(tail = []) {
return this._appendChunks(tail, { tail: true }).aggregate(this._appendPlaceholder());
set unmaskedValue(unmaskedValue) {
super.unmaskedValue = unmaskedValue;
}
/**
@override
*/
_appendTail(tail) {
const details = new ChangeDetails();
if (tail) {
details.aggregate(tail instanceof ChunksTailDetails ? this._appendChunks(tail.chunks, { tail: true }) : super._appendTail(tail));
}
return details.aggregate(this._appendPlaceholder());
}
/**
@override
*/
_append(str, flags = {}) {

@@ -848,3 +1100,3 @@ const oldValueLength = this.value.length;

if (!chres) {
if (!def.optional && !flags.input) {
if (!def.optional && !flags.input && !this.lazy) {
this._value += this.placeholderChar;

@@ -875,12 +1127,14 @@ skipped = false;

/** Appends chunks splitted by stop chars */
_appendChunks(chunks, ...args) {
const details = new ChangeDetails();
for (let ci = 0; ci < chunks.length; ++ci) {
var _chunks$ci = slicedToArray(chunks[ci], 2);
var _chunks$ci = chunks[ci];
const stop = _chunks$ci.stop,
value = _chunks$ci.value;
const fromDefIndex = _chunks$ci[0],
input = _chunks$ci[1];
if (fromDefIndex != null) details.aggregate(this._appendPlaceholder(fromDefIndex));
if (details.aggregate(this._append(input, ...args)).overflow) break;
const fromDef = stop != null && this._charDefs[stop];
// lets double check if stopAlign is here
if (fromDef && fromDef.stopAlign) details.aggregate(this._appendPlaceholder(stop));
if (details.aggregate(this._append(value, ...args)).overflow) break;
}

@@ -890,6 +1144,12 @@ return details;

/**
@override
*/
_extractTail(fromPos = 0, toPos = this.value.length) {
return this._extractInputChunks(fromPos, toPos);
return new ChunksTailDetails(this._extractInputChunks(fromPos, toPos));
}
/**
@override
*/
extractInput(fromPos = 0, toPos = this.value.length, flags = {}) {

@@ -915,2 +1175,3 @@ if (fromPos === toPos) return '';

/** Extracts chunks from input splitted by stop chars */
_extractInputChunks(fromPos = 0, toPos = this.value.length) {

@@ -925,5 +1186,10 @@ if (fromPos === toPos) return [];

return stops.map((s, i) => [stopDefIndices.indexOf(s) >= 0 ? s : null, this.extractInput(this.mapDefIndexToPos(s), this.mapDefIndexToPos(stops[++i]))]).filter(([stop, input]) => stop != null || input);
return stops.map((s, i) => ({
stop: stopDefIndices.indexOf(s) >= 0 ? s : null,
value: this.extractInput(this.mapDefIndexToPos(s), this.mapDefIndexToPos(stops[++i]))
})).filter(({ stop, value }) => stop != null || value);
}
/** Appends placeholder depending on laziness */
_appendPlaceholder(toDefIndex) {

@@ -945,12 +1211,18 @@ const oldValueLength = this.value.length;

/**
@override
*/
remove(from = 0, count = this.value.length - from) {
const to = from + count;
this._value = this.value.slice(0, from) + this.value.slice(to);
const fromDefIndex = this.mapPosToDefIndex(from);
const toDefIndex = this.mapPosToDefIndex(to);
const toDefIndex = this.mapPosToDefIndex(from + count);
this._charDefs.slice(fromDefIndex, toDefIndex).forEach(d => d.reset());
return super.remove(from, count);
}
/**
@override
*/
nearestInputPos(cursorPos, direction = DIRECTION.NONE) {
let step = direction || DIRECTION.LEFT;
let step = direction || DIRECTION.RIGHT;

@@ -975,3 +1247,6 @@ const initialDefIndex = this.mapPosToDefIndex(cursorPos);

const nextDef = this._charDefs[nextdi];
if (firstInputIndex == null && nextDef.isInput) firstInputIndex = di;
if (firstInputIndex == null && nextDef.isInput) {
firstInputIndex = di;
if (direction === DIRECTION.NONE) break;
}
if (firstVisibleHollowIndex == null && nextDef.isHollow && !nextDef.isHiddenHollow) firstVisibleHollowIndex = di;

@@ -985,6 +1260,6 @@ if (nextDef.isInput && !nextDef.isHollow) {

// if has aligned left inside fixed and has came to the start - use start position
if (direction === DIRECTION.LEFT && di === 0 && (!initialDef || !initialDef.isInput)) firstInputIndex = 0;
// for lazy if has aligned left inside fixed and has came to the start - use start position
if (direction === DIRECTION.LEFT && di === 0 && this.lazy && (!initialDef || !initialDef.isInput)) firstInputIndex = 0;
if (direction !== DIRECTION.RIGHT || firstInputIndex == null) {
if (direction === DIRECTION.LEFT || firstInputIndex == null) {
// search backward

@@ -1021,2 +1296,3 @@ step = -step;

/** Get group by name */
group(name) {

@@ -1026,2 +1302,3 @@ return this.groupsByName(name)[0];

/** Get all groups by name */
groupsByName(name) {

@@ -1040,4 +1317,12 @@ return this._groupDefs.filter(g$$1 => g$$1.name === name);

/** Date mask */
class MaskedDate extends MaskedPattern {
/**
@param {Object} opts
*/
/** Start date */
/** Format Date to string */
constructor(opts) {

@@ -1047,4 +1332,13 @@ super(_extends({}, MaskedDate.DEFAULTS, opts));

/**
@override
*/
/** End date */
/** Pattern mask for date according to {@link MaskedDate#format} */
/** Parse string to Date */
_update(opts) {
// TODO pattern mask is string, but date mask is Date
if (opts.mask === Date) delete opts.mask;

@@ -1066,2 +1360,5 @@ if (opts.pattern) {

/**
@override
*/
doValidate(...args) {

@@ -1074,2 +1371,3 @@ const valid = super.doValidate(...args);

/** Checks if date is exists */
isDateExist(str) {

@@ -1079,2 +1377,3 @@ return this.format(this.parse(str)) === str;

/** Parsed Date */
get date() {

@@ -1116,4 +1415,20 @@ return this.isComplete ? this.parse(this.value) : null;

/**
Generic element API to use with mask
@interface
*/
/** Listens to element events and controls changes between element and {@link Masked} */
class InputMask {
/**
@param {UIElement} el
@param {Object} opts
*/
/**
View element
@readonly
*/
constructor(el, opts) {

@@ -1134,3 +1449,3 @@ this.el = el;

this.bindEvents();
this._bindEvents();

@@ -1142,2 +1457,9 @@ // refresh

/** Read or update mask */
/**
Internal {@link Masked} model
@readonly
*/
get mask() {

@@ -1159,2 +1481,3 @@ return this.masked.mask;

/** Raw value */
get value() {

@@ -1170,2 +1493,3 @@ return this._value;

/** Unmasked value */
get unmaskedValue() {

@@ -1181,3 +1505,7 @@ return this._unmaskedValue;

bindEvents() {
/**
Starts listening to element events
@protected
*/
_bindEvents() {
this.el.addEventListener('keydown', this._saveSelection);

@@ -1190,3 +1518,7 @@ this.el.addEventListener('input', this._onInput);

unbindEvents() {
/**
Stops listening to element events
@protected
*/
_unbindEvents() {
this.el.removeEventListener('keydown', this._saveSelection);

@@ -1199,3 +1531,7 @@ this.el.removeEventListener('input', this._onInput);

fireEvent(ev) {
/**
Fires custom event
@protected
*/
_fireEvent(ev) {
const listeners = this._listeners[ev] || [];

@@ -1205,2 +1541,6 @@ listeners.forEach(l => l());

/**
Current selection start
@readonly
*/
get selectionStart() {

@@ -1210,6 +1550,6 @@ return this._cursorChanging ? this._changingCursorPos : this.el.selectionStart;

/** Current cursor position */
get cursorPos() {
return this._cursorChanging ? this._changingCursorPos : this.el.selectionEnd;
}
set cursorPos(pos) {

@@ -1222,2 +1562,6 @@ if (this.el !== document.activeElement) return;

/**
Stores current selection
@protected
*/
_saveSelection() /* ev */{

@@ -1233,2 +1577,3 @@ if (this.value !== this.el.value) {

/** Syncronizes model value from view */
updateValue() {

@@ -1238,2 +1583,3 @@ this.masked.value = this.el.value;

/** Syncronizes view from model value, fires change events */
updateControl() {

@@ -1251,2 +1597,3 @@ const newUnmaskedValue = this.masked.unmaskedValue;

/** Updates options with deep equal check, recreates @{link Masked} model if mask type changes */
updateOptions(opts) {

@@ -1263,2 +1610,3 @@ opts = Object.assign({}, opts); // clone

/** Updates cursor */
updateCursor(cursorPos) {

@@ -1272,2 +1620,6 @@ if (cursorPos == null) return;

/**
Delays cursor update to support mobile browsers
@private
*/
_delayUpdateCursor(cursorPos) {

@@ -1283,7 +1635,15 @@ this._abortUpdateCursor();

/**
Fires custom events
@protected
*/
_fireChangeEvents() {
this.fireEvent('accept');
if (this.masked.isComplete) this.fireEvent('complete');
this._fireEvent('accept');
if (this.masked.isComplete) this._fireEvent('complete');
}
/**
Aborts delayed cursor update
@private
*/
_abortUpdateCursor() {

@@ -1296,2 +1656,3 @@ if (this._cursorChanging) {

/** Aligns cursor to nearest available position */
alignCursor() {

@@ -1301,2 +1662,3 @@ this.cursorPos = this.masked.nearestInputPos(this.cursorPos, DIRECTION.LEFT);

/** Aligns cursor only if selection is empty */
alignCursorFriendly() {

@@ -1307,2 +1669,3 @@ if (this.selectionStart !== this.cursorPos) return;

/** Adds listener on custom event */
on(ev, handler) {

@@ -1314,2 +1677,3 @@ if (!this._listeners[ev]) this._listeners[ev] = [];

/** Removes custom event listener */
off(ev, handler) {

@@ -1326,2 +1690,3 @@ if (!this._listeners[ev]) return;

/** Handles view input event */
_onInput() {

@@ -1338,3 +1703,3 @@ this._abortUpdateCursor();

const cursorPos = this.masked.nearestInputPos(details.startChangePos + offset);
const cursorPos = this.masked.nearestInputPos(details.startChangePos + offset, details.removeDirection);

@@ -1345,2 +1710,3 @@ this.updateControl();

/** Handles view change event and commits model value */
_onChange() {

@@ -1354,2 +1720,3 @@ if (this.value !== this.el.value) {

/** Handles view drop event, prevents by default */
_onDrop(ev) {

@@ -1360,4 +1727,5 @@ ev.preventDefault();

/** Unbind view events and removes element reference */
destroy() {
this.unbindEvents();
this._unbindEvents();
// $FlowFixMe why not do so?

@@ -1369,4 +1737,23 @@ this._listeners.length = 0;

/**
Number mask
@param {Object} opts
@param {string} opts.radix - Single char
@param {string} opts.thousandsSeparator - Single char
@param {Array<string>} opts.mapToRadix - Array of single chars
@param {number} opts.min
@param {number} opts.max
@param {number} opts.scale - Digits after point
@param {boolean} opts.signed - Allow negative
@param {boolean} opts.normalizeZeros - Flag to remove leading and trailing zeros in the end of editing
@param {boolean} opts.padFractionalZeros - Flag to pad trailing zeros after point in the end of editing
*/
class MaskedNumber extends Masked {
// TODO deprecarted, remove in 3.0
/** Flag to remove leading and trailing zeros in the end of editing */
/** Digits after point */
/** */
/** Single char */
constructor(opts) {

@@ -1376,8 +1763,17 @@ super(_extends({}, MaskedNumber.DEFAULTS, opts));

/**
@override
*/
/** Flag to pad trailing zeros after point in the end of editing */
/** */
/** */
/** Array of single chars */
/** Single char */
_update(opts) {
if (opts.postFormat) {
console.warn("'postFormat' option is deprecated and will be removed in next release, use plain options instead.");
Object.assign(opts, opts.postFormat);
delete opts.postFormat;
}
super._update(opts);

@@ -1387,2 +1783,3 @@ this._updateRegExps();

/** */
_updateRegExps() {

@@ -1410,6 +1807,14 @@ // use different regexp to process user input (more strict, input suffix) and tail shifting

/**
@override
*/
_extractTail(fromPos = 0, toPos = this.value.length) {
return this._removeThousandsSeparators(super._extractTail(fromPos, toPos));
const tail = super._extractTail(fromPos, toPos);
return _extends({}, tail, {
value: this._removeThousandsSeparators(tail.value)
});
}
/** */
_removeThousandsSeparators(value) {

@@ -1419,2 +1824,3 @@ return value.replace(this._thousandsSeparatorRegExp, '');

/** */
_insertThousandsSeparators(value) {

@@ -1427,2 +1833,5 @@ // https://stackoverflow.com/questions/2901102/how-to-print-a-number-with-commas-as-thousands-separators-in-javascript

/**
@override
*/
doPrepare(str, ...args) {

@@ -1432,2 +1841,5 @@ return super.doPrepare(this._removeThousandsSeparators(str.replace(this._mapToRadixRegExp, this.radix)), ...args);

/**
@override
*/
appendWithTail(...args) {

@@ -1463,2 +1875,5 @@ let previousValue = this.value;

/**
@override
*/
nearestInputPos(cursorPos, direction) {

@@ -1472,2 +1887,5 @@ if (!direction) return cursorPos;

/**
@override
*/
doValidate(flags) {

@@ -1492,2 +1910,5 @@ const regexp = flags.input ? this._numberRegExpInput : this._numberRegExp;

/**
@override
*/
doCommit() {

@@ -1512,2 +1933,3 @@ const number = this.number;

/** */
_normalizeZeros(value) {

@@ -1529,3 +1951,6 @@ const parts = this._removeThousandsSeparators(value).split(this.radix);

/** */
_padFractionalZeros(value) {
if (!value) return value;
const parts = value.split(this.radix);

@@ -1537,12 +1962,26 @@ if (parts.length < 2) parts.push('');

get number() {
let numstr = this._removeThousandsSeparators(this._normalizeZeros(this.unmaskedValue)).replace(this.radix, '.');
/**
@override
*/
get unmaskedValue() {
return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix, '.');
}
return Number(numstr);
set unmaskedValue(unmaskedValue) {
super.unmaskedValue = unmaskedValue.replace('.', this.radix);
}
/** Parsed Number */
get number() {
return Number(this.unmaskedValue);
}
set number(number) {
this.unmaskedValue = String(number).replace('.', this.radix);
this.unmaskedValue = String(number);
}
/**
Is negative allowed
@readonly
*/
get allowNegative() {

@@ -1562,3 +2001,8 @@ return this.signed || this.min != null && this.min < 0 || this.max != null && this.max < 0;

/** Masking by RegExp */
class MaskedRegExp extends Masked {
/**
@override
@param {Object} opts
*/
_update(opts) {

@@ -1570,3 +2014,8 @@ opts.validate = value => value.search(opts.mask) >= 0;

/** Masking by custom Function */
class MaskedFunction extends Masked {
/**
@override
@param {Object} opts
*/
_update(opts) {

@@ -1578,4 +2027,10 @@ opts.validate = opts.mask;

/** Dynamic mask for choosing apropriate mask in run-time */
class MaskedDynamic extends Masked {
/**
@param {Object} opts
*/
/** Compliled {@link Masked} options */
constructor(opts) {

@@ -1587,19 +2042,24 @@ super(_extends({}, MaskedDynamic.DEFAULTS, opts));

/**
@override
*/
/** Chooses {@link Masked} depending on input value */
/** Currently chosen mask */
_update(opts) {
super._update(opts);
// mask could be totally dynamic with only `dispatch` option
this.compiledMasks = Array.isArray(opts.mask) ? opts.mask.map(m => createMask(m)) : [];
}
/**
@override
*/
_append(str, ...args) {
const oldValueLength = this.value.length;
const details = new ChangeDetails();
str = this.doPrepare(str, ...args);
const inputValue = this.rawInputValue;
this.currentMask = this.doDispatch(str, ...args);
const details = this._applyDispatch(str, ...args);
if (this.currentMask) {
// update current mask
this.currentMask.rawInputValue = inputValue;
details.shift = this.value.length - oldValueLength;
details.aggregate(this.currentMask._append(str, ...args));

@@ -1611,2 +2071,22 @@ }

_applyDispatch(appended, ...args) {
const oldValueLength = this.value.length;
const inputValue = this.rawInputValue;
const oldMask = this.currentMask;
const details = new ChangeDetails();
this.currentMask = this.doDispatch(appended, ...args);
if (this.currentMask && this.currentMask !== oldMask) {
this.currentMask.reset();
// $FlowFixMe - it's ok, we don't change current mask
this.currentMask._append(inputValue, { raw: true });
details.shift = this.value.length - oldValueLength;
}
return details;
}
/**
@override
*/
doDispatch(appended, flags = {}) {

@@ -1616,9 +2096,21 @@ return this.dispatch(appended, this, flags);

/**
@override
*/
clone() {
const m = new MaskedDynamic(this);
m._value = this.value;
if (this.currentMask) m.currentMask = this.currentMask.clone();
// try to keep reference to compiled masks
const currentMaskIndex = this.compiledMasks.indexOf(this.currentMask);
if (this.currentMask) {
m.currentMask = currentMaskIndex >= 0 ? m.compiledMasks[currentMaskIndex].assign(this.currentMask) : this.currentMask.clone();
}
return m;
}
/**
@override
*/
reset() {

@@ -1629,2 +2121,5 @@ if (this.currentMask) this.currentMask.reset();

/**
@override
*/
get value() {

@@ -1635,5 +2130,19 @@ return this.currentMask ? this.currentMask.value : '';

set value(value) {
this.resolve(value);
super.value = value;
}
/**
@override
*/
get unmaskedValue() {
return this.currentMask ? this.currentMask.unmaskedValue : '';
}
set unmaskedValue(unmaskedValue) {
super.unmaskedValue = unmaskedValue;
}
/**
@override
*/
get isComplete() {

@@ -1643,10 +2152,19 @@ return !!this.currentMask && this.currentMask.isComplete;

_unmask() {
return this.currentMask ? this.currentMask._unmask() : '';
}
/**
@override
*/
remove(...args) {
const details = new ChangeDetails();
if (this.currentMask) {
details.aggregate(this.currentMask.remove(...args))
// update with dispatch
.aggregate(this._applyDispatch(''));
}
remove(...args) {
if (this.currentMask) this.currentMask.remove(...args);
return details;
}
/**
@override
*/
extractInput(...args) {

@@ -1656,2 +2174,19 @@ return this.currentMask ? this.currentMask.extractInput(...args) : '';

/**
@override
*/
_extractTail(...args) {
return this.currentMask ? this.currentMask._extractTail(...args) : super._extractTail(...args);
}
/**
@override
*/
_appendTail(...args) {
return this.currentMask ? this.currentMask._appendTail(...args) : super._appendTail(...args);
}
/**
@override
*/
doCommit() {

@@ -1662,2 +2197,5 @@ if (this.currentMask) this.currentMask.doCommit();

/**
@override
*/
nearestInputPos(...args) {

@@ -1688,2 +2226,9 @@ return this.currentMask ? this.currentMask.nearestInputPos(...args) : super.nearestInputPos(...args);

/**
* Applies mask on element.
* @constructor
* @param {HTMLInput|UIElement} el - Element to apply mask
* @param {Object} opts - Custom mask options
* @return {InputMask}
*/
function IMask(el, opts = {}) {

@@ -1694,11 +2239,20 @@ // currently available only for input-like elements

/** {@link InputMask} */
IMask.InputMask = InputMask;
/** {@link Masked} */
IMask.Masked = Masked;
/** {@link MaskedPattern} */
IMask.MaskedPattern = MaskedPattern;
/** {@link MaskedNumber} */
IMask.MaskedNumber = MaskedNumber;
/** {@link MaskedDate} */
IMask.MaskedDate = MaskedDate;
/** {@link MaskedRegExp} */
IMask.MaskedRegExp = MaskedRegExp;
/** {@link MaskedFunction} */
IMask.MaskedFunction = MaskedFunction;
/** {@link MaskedDynamic} */
IMask.MaskedDynamic = MaskedDynamic;
/** {@link createMask} */
IMask.createMask = createMask;

@@ -1705,0 +2259,0 @@

2

dist/imask.es.min.js

@@ -1,2 +0,2 @@

function isString(e){return"string"==typeof e||e instanceof String}function conform(e,t,s=""){return isString(e)?e:e?t:s}function indexInDirection(e,t){return t===DIRECTION.LEFT&&--e,e}function escapeRegExp(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(e,t){if(t===e)return!0;var s,u=Array.isArray(t),a=Array.isArray(e);if(u&&a){if(t.length!=e.length)return!1;for(s=0;s<t.length;s++)if(!objectIncludes(t[s],e[s]))return!1;return!0}if(u!=a)return!1;if(t&&e&&"object"==typeof t&&"object"==typeof e){var i=Object.keys(t),n=t instanceof Date,r=e instanceof Date;if(n&&r)return t.getTime()==e.getTime();if(n!=r)return!1;var o=t instanceof RegExp,h=e instanceof RegExp;if(o&&h)return t.toString()==e.toString();if(o!=h)return!1;for(s=0;s<i.length;s++)if(!Object.prototype.hasOwnProperty.call(e,i[s]))return!1;for(s=0;s<i.length;s++)if(!objectIncludes(t[i[s]],e[i[s]]))return!1;return!0}return!1}function maskedClass(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?g.IMask.MaskedRegExp:isString(e)?g.IMask.MaskedPattern:e instanceof Date||e===Date?g.IMask.MaskedDate:e instanceof Number||"number"==typeof e||e===Number?g.IMask.MaskedNumber:Array.isArray(e)||e===Array?g.IMask.MaskedDynamic:e.prototype instanceof g.IMask.Masked?e:e instanceof Function?g.IMask.MaskedFunction:(console.warn("Mask not found for mask",e),g.IMask.Masked)}function createMask(e){const t=(e=Object.assign({},e)).mask;if(t instanceof g.IMask.Masked)return t;return new(maskedClass(t))(e)}function EnumGroup(e){return{mask:"*".repeat(e[0].length),validate:(t,s,u)=>e.some(e=>e.indexOf(s.unmaskedValue)>=0)}}function IMask(e,t={}){return new InputMask(e,t)}const DIRECTION={NONE:0,LEFT:-1,RIGHT:1},g="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{};class ActionDetails{constructor(e,t,s,u){for(this.value=e,this.cursorPos=t,this.oldValue=s,this.oldSelection=u;this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}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?DIRECTION.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?DIRECTION.RIGHT:DIRECTION.LEFT}}class ChangeDetails{constructor(e){Object.assign(this,{inserted:"",overflow:!1,removedCount:0,shift:0},e)}aggregate(e){return this.inserted+=e.inserted,this.removedCount+=e.removedCount,this.shift+=e.shift,this.overflow=this.overflow||e.overflow,e.rawInserted&&(this.rawInserted+=e.rawInserted),this}get offset(){return this.shift+this.inserted.length-this.removedCount}get rawInserted(){return null!=this._rawInserted?this._rawInserted:this.inserted}set rawInserted(e){this._rawInserted=e}}var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(e[u]=s[u])}return e},slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var s=[],u=!0,a=!1,i=void 0;try{for(var n,r=e[Symbol.iterator]();!(u=(n=r.next()).done)&&(s.push(n.value),!t||s.length!==t);u=!0);}catch(e){a=!0,i=e}finally{try{!u&&r.return&&r.return()}finally{if(a)throw i}}return s}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();class Masked{constructor(e){this._value="",this._update(_extends({},Masked.DEFAULTS,e)),this.isInitialized=!0}updateOptions(e){this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}clone(){const e=new Masked(this);return e._value=this.value.slice(),e}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e)}resolve(e){return this.reset(),this._append(e,{input:!0}),this._appendTail(),this.doCommit(),this.value}get unmaskedValue(){return this._unmask()}set unmaskedValue(e){this.reset(),this._append(e),this._appendTail(),this.doCommit()}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(e){this.reset(),this._append(e,{raw:!0}),this._appendTail(),this.doCommit()}get isComplete(){return!0}nearestInputPos(e,t){return e}extractInput(e=0,t=this.value.length,s){return this.value.slice(e,t)}_extractTail(e=0,t=this.value.length){return this.extractInput(e,t)}_appendTail(e=""){return this._append(e,{tail:!0})}_append(e,t={}){const s=this.value.length;let u=this.clone(),a=!1;e=this.doPrepare(e,t);for(let s=0;s<e.length;++s){if(this._value+=e[s],!1===this.doValidate(t)&&(Object.assign(this,u),!t.input)){a=!0;break}u=this.clone()}return new ChangeDetails({inserted:this.value.slice(s),overflow:a})}appendWithTail(e,t){const s=new ChangeDetails;let u,a=this.clone();for(let i=0;i<e.length;++i){const n=e[i],r=this._append(n,{input:!0});u=this.clone();if(!(!r.overflow&&!this._appendTail(t).overflow)||!1===this.doValidate({tail:!0})){Object.assign(this,a);break}Object.assign(this,u),a=this.clone(),s.aggregate(r)}return s.shift+=this._appendTail(t).shift,s}_unmask(){return this.value}remove(e=0,t=this.value.length-e){this._value=this.value.slice(0,e)+this.value.slice(e+t)}withValueRefresh(e){if(this._refreshing||!this.isInitialized)return e();this._refreshing=!0;const t=this.unmaskedValue,s=e();return this.unmaskedValue=t,delete this._refreshing,s}doPrepare(e,t={}){return this.prepare(e,this,t)}doValidate(e){return this.validate(this.value,this,e)}doCommit(){this.commit(this.value,this)}splice(e,t,s,u){const a=e+t,i=this._extractTail(a),n=this.nearestInputPos(e,u);this.remove(n);const r=this.appendWithTail(s,i);return r.shift+=n-e,r}}Masked.DEFAULTS={prepare:e=>e,validate:()=>!0,commit:()=>{}};class PatternDefinition{constructor(e){Object.assign(this,e),this.mask&&(this._masked=createMask(e))}reset(){this.isHollow=!1,this.isRawInput=!1,this._masked&&this._masked.reset()}get isInput(){return this.type===PatternDefinition.TYPES.INPUT}get isHiddenHollow(){return this.isHollow&&this.optional}resolve(e){return!!this._masked&&this._masked.resolve(e)}}PatternDefinition.DEFAULTS={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]/,"*":/./},PatternDefinition.TYPES={INPUT:"input",FIXED:"fixed"};class PatternGroup{constructor(e,{name:t,offset:s,mask:u,validate:a}){this.masked=e,this.name=t,this.offset=s,this.mask=u,this.validate=a||(()=>!0)}get value(){return this.masked.value.slice(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}get unmaskedValue(){return this.masked.extractInput(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}doValidate(e){return this.validate(this.value,this,e)}}class RangeGroup{constructor([e,t],s=String(t).length){this._from=e,this._to=t,this._maxLength=s,this.validate=this.validate.bind(this),this._update()}get to(){return this._to}set to(e){this._to=e,this._update()}get from(){return this._from}set from(e){this._from=e,this._update()}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=e,this._update()}get _matchFrom(){return this.maxLength-String(this.from).length}_update(){this._maxLength=Math.max(this._maxLength,String(this.to).length),this.mask="0".repeat(this._maxLength)}validate(e){let t="",s="";var u=e.match(/^(\D*)(\d*)(\D*)/)||[],a=slicedToArray(u,3);const i=a[1],n=a[2];n&&(t="0".repeat(i.length)+n,s="9".repeat(i.length)+n);return-1===e.search(/[^0]/)&&e.length<=this._matchFrom||(t=t.padEnd(this._maxLength,"0"),s=s.padEnd(this._maxLength,"9"),this.from<=Number(s)&&Number(t)<=this.to)}}PatternGroup.Range=RangeGroup,PatternGroup.Enum=EnumGroup;class MaskedPattern extends Masked{constructor(e={}){e.definitions=Object.assign({},PatternDefinition.DEFAULTS,e.definitions),super(_extends({},MaskedPattern.DEFAULTS,e))}_update(e={}){e.definitions=Object.assign({},this.definitions,e.definitions),null!=e.placeholder&&(console.warn("'placeholder' option is deprecated and will be removed in next major release, use 'placeholderChar' and 'lazy' instead."),"char"in e.placeholder&&(e.placeholderChar=e.placeholder.char),"lazy"in e.placeholder&&(e.lazy=e.placeholder.lazy),delete e.placeholder),null!=e.placeholderLazy&&(console.warn("'placeholderLazy' option is deprecated and will be removed in next major release, use 'lazy' instead."),e.lazy=e.placeholderLazy,delete e.placeholderLazy),super._update(e),this._updateMask()}_updateMask(){const e=this.definitions;this._charDefs=[],this._groupDefs=[];let t=this.mask;if(!t||!e)return;let s=!1,u=!1,a=!1;for(let i=0;i<t.length;++i){if(this.groups){const e=t.slice(i),s=Object.keys(this.groups).filter(t=>0===e.indexOf(t));s.sort((e,t)=>t.length-e.length);const u=s[0];if(u){const e=this.groups[u];this._groupDefs.push(new PatternGroup(this,{name:u,offset:this._charDefs.length,mask:e.mask,validate:e.validate})),t=t.replace(u,e.mask)}}let n=t[i],r=!s&&n in e?PatternDefinition.TYPES.INPUT:PatternDefinition.TYPES.FIXED;const o=r===PatternDefinition.TYPES.INPUT||s,h=r===PatternDefinition.TYPES.INPUT&&u;if(n!==MaskedPattern.STOP_CHAR)if("{"!==n&&"}"!==n)if("["!==n&&"]"!==n){if(n===MaskedPattern.ESCAPE_CHAR){if(++i,!(n=t[i]))break;r=PatternDefinition.TYPES.FIXED}this._charDefs.push(new PatternDefinition({char:n,type:r,optional:h,stopAlign:a,unmasking:o,mask:r===PatternDefinition.TYPES.INPUT?e[n]:e=>e===n})),a=!1}else u=!u;else s=!s;else a=!0}}doValidate(...e){return this._groupDefs.every(t=>t.doValidate(...e))&&super.doValidate(...e)}clone(){const e=new MaskedPattern(this);return e._value=this.value,e._charDefs.forEach((e,t)=>Object.assign(e,this._charDefs[t])),e._groupDefs.forEach((e,t)=>Object.assign(e,this._groupDefs[t])),e}reset(){super.reset(),this._charDefs.forEach(e=>{delete e.isHollow})}get isComplete(){return!this._charDefs.some((e,t)=>e.isInput&&!e.optional&&(e.isHollow||!this.extractInput(t,t+1)))}hiddenHollowsBefore(e){return this._charDefs.slice(0,e).filter(e=>e.isHiddenHollow).length}mapDefIndexToPos(e){return e-this.hiddenHollowsBefore(e)}mapPosToDefIndex(e){let t=e;for(let e=0;e<this._charDefs.length;++e){const s=this._charDefs[e];if(e>=t)break;s.isHiddenHollow&&++t}return t}_unmask(){const e=this.value;let t="";for(let s=0,u=0;s<e.length&&u<this._charDefs.length;++u){const a=e[s],i=this._charDefs[u];i.isHiddenHollow||(i.unmasking&&!i.isHollow&&(t+=a),++s)}return t}_appendTail(e=[]){return this._appendChunks(e,{tail:!0}).aggregate(this._appendPlaceholder())}_append(e,t={}){const s=this.value.length;let u="",a=!1;e=this.doPrepare(e,t);for(let s=0,i=this.mapPosToDefIndex(this.value.length);s<e.length;){const n=e[s],r=this._charDefs[i];if(null==r){a=!0;break}r.isHollow=!1;let o,h,l=conform(r.resolve(n),n);r.type===PatternDefinition.TYPES.INPUT?(l&&(this._value+=l,this.doValidate()||(l="",this._value=this.value.slice(0,-1))),o=!!l,h=!l&&!r.optional,l?u+=l:(r.optional||t.input||(this._value+=this.placeholderChar,h=!1),h||(r.isHollow=!0))):(this._value+=r.char,o=l&&(r.unmasking||t.input||t.raw)&&!t.tail,r.isRawInput=o&&(t.raw||t.input),r.isRawInput&&(u+=r.char)),h||++i,(o||h)&&++s}return new ChangeDetails({inserted:this.value.slice(s),rawInserted:u,overflow:a})}_appendChunks(e,...t){const s=new ChangeDetails;for(let a=0;a<e.length;++a){var u=slicedToArray(e[a],2);const i=u[0],n=u[1];if(null!=i&&s.aggregate(this._appendPlaceholder(i)),s.aggregate(this._append(n,...t)).overflow)break}return s}_extractTail(e=0,t=this.value.length){return this._extractInputChunks(e,t)}extractInput(e=0,t=this.value.length,s={}){if(e===t)return"";const u=this.value;let a="";const i=this.mapPosToDefIndex(t);for(let n=e,r=this.mapPosToDefIndex(e);n<t&&n<u.length&&r<i;++r){const e=u[n],t=this._charDefs[r];if(!t)break;t.isHiddenHollow||((t.isInput&&!t.isHollow||s.raw&&!t.isInput&&t.isRawInput)&&(a+=e),++n)}return a}_extractInputChunks(e=0,t=this.value.length){if(e===t)return[];const s=this.mapPosToDefIndex(e),u=this.mapPosToDefIndex(t),a=this._charDefs.map((e,t)=>[e,t]).slice(s,u).filter(([e])=>e.stopAlign).map(([,e])=>e),i=[s,...a,u];return i.map((e,t)=>[a.indexOf(e)>=0?e:null,this.extractInput(this.mapDefIndexToPos(e),this.mapDefIndexToPos(i[++t]))]).filter(([e,t])=>null!=e||t)}_appendPlaceholder(e){const t=this.value.length,s=e||this._charDefs.length;for(let t=this.mapPosToDefIndex(this.value.length);t<s;++t){const s=this._charDefs[t];s.isInput&&(s.isHollow=!0),this.lazy&&!e||(this._value+=s.isInput||null==s.char?s.optional?"":this.placeholderChar:s.char)}return new ChangeDetails({inserted:this.value.slice(t)})}remove(e=0,t=this.value.length-e){const s=e+t;this._value=this.value.slice(0,e)+this.value.slice(s);const u=this.mapPosToDefIndex(e),a=this.mapPosToDefIndex(s);this._charDefs.slice(u,a).forEach(e=>e.reset())}nearestInputPos(e,t=DIRECTION.NONE){let s=t||DIRECTION.LEFT;const u=this.mapPosToDefIndex(e),a=this._charDefs[u];let i,n,r,o,h=u;if(t!==DIRECTION.RIGHT&&(a&&a.isInput||t===DIRECTION.NONE&&e===this.value.length)&&(i=u,a&&!a.isHollow&&(n=u)),null==n&&t==DIRECTION.LEFT||null==i)for(o=indexInDirection(h,s);0<=o&&o<this._charDefs.length;h+=s,o+=s){const e=this._charDefs[o];if(null==i&&e.isInput&&(i=h),null==r&&e.isHollow&&!e.isHiddenHollow&&(r=h),e.isInput&&!e.isHollow){n=h;break}}if(t!==DIRECTION.LEFT||0!==h||a&&a.isInput||(i=0),t!==DIRECTION.RIGHT||null==i){let e=!1;for(o=indexInDirection(h,s=-s);0<=o&&o<this._charDefs.length;h+=s,o+=s){const t=this._charDefs[o];if(t.isInput&&(i=h,t.isHollow&&!t.isHiddenHollow))break;if(h===u&&(e=!0),e&&null!=i)break}(e=e||o>=this._charDefs.length)&&null!=i&&(h=i)}else null==n&&(h=null!=r?r:i);return this.mapDefIndexToPos(h)}group(e){return this.groupsByName(e)[0]}groupsByName(e){return this._groupDefs.filter(t=>t.name===e)}}MaskedPattern.DEFAULTS={lazy:!0,placeholderChar:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.Definition=PatternDefinition,MaskedPattern.Group=PatternGroup;class MaskedDate extends MaskedPattern{constructor(e){super(_extends({},MaskedDate.DEFAULTS,e))}_update(e){e.mask===Date&&delete e.mask,e.pattern&&(e.mask=e.pattern,delete e.pattern);const t=e.groups;e.groups=Object.assign({},MaskedDate.GET_DEFAULT_GROUPS()),e.min&&(e.groups.Y.from=e.min.getFullYear()),e.max&&(e.groups.Y.to=e.max.getFullYear()),Object.assign(e.groups,t),super._update(e)}doValidate(...e){const t=super.doValidate(...e),s=this.date;return t&&(!this.isComplete||this.isDateExist(this.value)&&s&&(null==this.min||this.min<=s)&&(null==this.max||s<=this.max))}isDateExist(e){return this.format(this.parse(e))===e}get date(){return this.isComplete?this.parse(this.value):null}set date(e){this.value=this.format(e)}}MaskedDate.DEFAULTS={pattern:"d{.}`m{.}`Y",format:e=>{return[String(e.getDate()).padStart(2,"0"),String(e.getMonth()+1).padStart(2,"0"),e.getFullYear()].join(".")},parse:e=>{var t=e.split("."),s=slicedToArray(t,3);const u=s[0],a=s[1],i=s[2];return new Date(i,a-1,u)}},MaskedDate.GET_DEFAULT_GROUPS=(()=>({d:new PatternGroup.Range([1,31]),m:new PatternGroup.Range([1,12]),Y:new PatternGroup.Range([1900,9999])}));class InputMask{constructor(e,t){this.el=e,this.masked=createMask(t),this._listeners={},this._value="",this._unmaskedValue="",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.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this.bindEvents(),this.updateValue(),this._onChange()}get mask(){return this.masked.mask}set mask(e){if(null==e||e===this.masked.mask)return;if(this.masked.constructor===maskedClass(e))return void(this.masked.mask=e);const t=createMask({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.masked.value=e,this.updateControl(),this.alignCursor()}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.masked.unmaskedValue=e,this.updateControl(),this.alignCursor()}bindEvents(){this.el.addEventListener("keydown",this._saveSelection),this.el.addEventListener("input",this._onInput),this.el.addEventListener("drop",this._onDrop),this.el.addEventListener("click",this.alignCursorFriendly),this.el.addEventListener("change",this._onChange)}unbindEvents(){this.el.removeEventListener("keydown",this._saveSelection),this.el.removeEventListener("input",this._onInput),this.el.removeEventListener("drop",this._onDrop),this.el.removeEventListener("click",this.alignCursorFriendly),this.el.removeEventListener("change",this._onChange)}fireEvent(e){(this._listeners[e]||[]).forEach(e=>e())}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el===document.activeElement&&(this.el.setSelectionRange(e,e),this._saveSelection())}_saveSelection(){this.value!==this.el.value&&console.warn("Uncontrolled input change, refresh mask manually!"),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value}updateControl(){const e=this.masked.unmaskedValue,t=this.masked.value,s=this.unmaskedValue!==e||this.value!==t;this._unmaskedValue=e,this._value=t,this.el.value!==t&&(this.el.value=t),s&&this._fireChangeEvents()}updateOptions(e){(e=Object.assign({},e)).mask===Date&&this.masked instanceof MaskedDate&&delete e.mask,objectIncludes(this.masked,e)||(this.masked.updateOptions(e),this.updateControl())}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this.fireEvent("accept"),this.masked.isComplete&&this.fireEvent("complete")}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,DIRECTION.LEFT)}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return;if(!t)return void delete this._listeners[e];const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(){this._abortUpdateCursor();const e=new ActionDetails(this.el.value,this.cursorPos,this.value,this._selection),t=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection).offset,s=this.masked.nearestInputPos(e.startChangePos+t);this.updateControl(),this.updateCursor(s)}_onChange(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl()}_onDrop(e){e.preventDefault(),e.stopPropagation()}destroy(){this.unbindEvents(),this._listeners.length=0,delete this.el}}class MaskedNumber extends Masked{constructor(e){super(_extends({},MaskedNumber.DEFAULTS,e))}_update(e){e.postFormat&&(console.warn("'postFormat' option is deprecated and will be removed in next release, use plain options instead."),Object.assign(e,e.postFormat),delete e.postFormat),super._update(e),this._updateRegExps()}_updateRegExps(){let e="",t="";this.allowNegative?(e+="([+|\\-]?|([+|\\-]?(0|([1-9]+\\d*))))",t+="[+|\\-]?"):e+="(0|([1-9]+\\d*))",t+="\\d*";let s=(this.scale?"("+this.radix+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp("^"+e+s),this._numberRegExp=new RegExp("^"+t+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}_extractTail(e=0,t=this.value.length){return this._removeThousandsSeparators(super._extractTail(e,t))}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepare(e,...t){return super.doPrepare(this._removeThousandsSeparators(e.replace(this._mapToRadixRegExp,this.radix)),...t)}appendWithTail(...e){let t=this.value;this._value=this._removeThousandsSeparators(this.value);let s=this.value.length;const u=super.appendWithTail(...e);this._value=this._insertThousandsSeparators(this.value);let a=s+u.inserted.length;for(let e=0;e<=a;++e)this.value[e]===this.thousandsSeparator&&((e<s||e===s&&t[e]===this.thousandsSeparator)&&++s,e<a&&++a);return u.rawInserted=u.inserted,u.inserted=this.value.slice(s,a),u.shift+=s-t.length,u}nearestInputPos(e,t){if(!t)return e;const s=indexInDirection(e,t);return this.value[s]===this.thousandsSeparator&&(e+=t),e}doValidate(e){let t=(e.input?this._numberRegExpInput:this._numberRegExp).test(this._removeThousandsSeparators(this.value));if(t){const e=this.number;t=t&&!isNaN(e)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return t&&super.doValidate(e)}doCommit(){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=String(t));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&(s=this._padFractionalZeros(s)),this._value=s,super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(e,t,s,u)=>t+u),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}get number(){let e=this._removeThousandsSeparators(this._normalizeZeros(this.unmaskedValue)).replace(this.radix,".");return Number(e)}set number(e){this.unmaskedValue=String(e).replace(".",this.radix)}get allowNegative(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}MaskedNumber.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};class MaskedRegExp extends Masked{_update(e){e.validate=(t=>t.search(e.mask)>=0),super._update(e)}}class MaskedFunction extends Masked{_update(e){e.validate=e.mask,super._update(e)}}class MaskedDynamic extends Masked{constructor(e){super(_extends({},MaskedDynamic.DEFAULTS,e)),this.currentMask=null}_update(e){super._update(e),this.compiledMasks=Array.isArray(e.mask)?e.mask.map(e=>createMask(e)):[]}_append(e,...t){const s=this.value.length,u=new ChangeDetails;e=this.doPrepare(e,...t);const a=this.rawInputValue;return this.currentMask=this.doDispatch(e,...t),this.currentMask&&(this.currentMask.rawInputValue=a,u.shift=this.value.length-s,u.aggregate(this.currentMask._append(e,...t))),u}doDispatch(e,t={}){return this.dispatch(e,this,t)}clone(){const e=new MaskedDynamic(this);return e._value=this.value,this.currentMask&&(e.currentMask=this.currentMask.clone()),e}reset(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(e=>e.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(e){this.resolve(e)}get isComplete(){return!!this.currentMask&&this.currentMask.isComplete}_unmask(){return this.currentMask?this.currentMask._unmask():""}remove(...e){this.currentMask&&this.currentMask.remove(...e)}extractInput(...e){return this.currentMask?this.currentMask.extractInput(...e):""}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(...e){return this.currentMask?this.currentMask.nearestInputPos(...e):super.nearestInputPos(...e)}}MaskedDynamic.DEFAULTS={dispatch:(e,t,s)=>{if(!t.compiledMasks.length)return;const u=t.rawInputValue;t.compiledMasks.forEach(t=>{t.rawInputValue=u,t._append(e,s)});const a=t.compiledMasks.map((e,t)=>({value:e.rawInputValue.length,index:t}));return a.sort((e,t)=>t.value-e.value),t.compiledMasks[a[0].index]}},IMask.InputMask=InputMask,IMask.Masked=Masked,IMask.MaskedPattern=MaskedPattern,IMask.MaskedNumber=MaskedNumber,IMask.MaskedDate=MaskedDate,IMask.MaskedRegExp=MaskedRegExp,IMask.MaskedFunction=MaskedFunction,IMask.MaskedDynamic=MaskedDynamic,IMask.createMask=createMask,g.IMask=IMask;export default IMask;
function isString(e){return"string"==typeof e||e instanceof String}function conform(e,t,s=""){return isString(e)?e:e?t:s}const DIRECTION={NONE:0,LEFT:-1,RIGHT:1};function indexInDirection(e,t){return t===DIRECTION.LEFT&&--e,e}function escapeRegExp(e){return e.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(e,t){if(t===e)return!0;var s,u=Array.isArray(t),a=Array.isArray(e);if(u&&a){if(t.length!=e.length)return!1;for(s=0;s<t.length;s++)if(!objectIncludes(t[s],e[s]))return!1;return!0}if(u!=a)return!1;if(t&&e&&"object"==typeof t&&"object"==typeof e){var i=Object.keys(t),n=t instanceof Date,r=e instanceof Date;if(n&&r)return t.getTime()==e.getTime();if(n!=r)return!1;var h=t instanceof RegExp,o=e instanceof RegExp;if(h&&o)return t.toString()==e.toString();if(h!=o)return!1;for(s=0;s<i.length;s++)if(!Object.prototype.hasOwnProperty.call(e,i[s]))return!1;for(s=0;s<i.length;s++)if(!objectIncludes(t[i[s]],e[i[s]]))return!1;return!0}return!1}const g="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{};class ActionDetails{constructor(e,t,s,u){for(this.value=e,this.cursorPos=t,this.oldValue=s,this.oldSelection=u;this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}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?DIRECTION.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?DIRECTION.RIGHT:DIRECTION.LEFT}}class ChangeDetails{constructor(e){Object.assign(this,{inserted:"",overflow:!1,shift:0},e)}aggregate(e){return this.inserted+=e.inserted,this.shift+=e.shift,this.overflow=this.overflow||e.overflow,e.rawInserted&&(this.rawInserted+=e.rawInserted),this}get offset(){return this.shift+this.inserted.length}get rawInserted(){return null!=this._rawInserted?this._rawInserted:this.inserted}set rawInserted(e){this._rawInserted=e}}var _extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(e[u]=s[u])}return e},slicedToArray=function(){return function(e,t){if(Array.isArray(e))return e;if(Symbol.iterator in Object(e))return function(e,t){var s=[],u=!0,a=!1,i=void 0;try{for(var n,r=e[Symbol.iterator]();!(u=(n=r.next()).done)&&(s.push(n.value),!t||s.length!==t);u=!0);}catch(e){a=!0,i=e}finally{try{!u&&r.return&&r.return()}finally{if(a)throw i}}return s}(e,t);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();class Masked{constructor(e){this._value="",this._update(_extends({},Masked.DEFAULTS,e)),this.isInitialized=!0}updateOptions(e){this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}clone(){const e=new Masked(this);return e._value=this.value.slice(),e}assign(e){return Object.assign(this,e)}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e)}resolve(e){return this.reset(),this._append(e,{input:!0}),this._appendTail(),this.doCommit(),this.value}get unmaskedValue(){return this.value}set unmaskedValue(e){this.reset(),this._append(e),this._appendTail(),this.doCommit()}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(e){this.reset(),this._append(e,{raw:!0}),this._appendTail(),this.doCommit()}get isComplete(){return!0}nearestInputPos(e,t){return e}extractInput(e=0,t=this.value.length,s){return this.value.slice(e,t)}_extractTail(e=0,t=this.value.length){return{value:this.extractInput(e,t),fromPos:e,toPos:t}}_appendTail(e){return this._append(e?e.value:"",{tail:!0})}_append(e,t={}){const s=this.value.length;let u=this.clone(),a=!1;e=this.doPrepare(e,t);for(let s=0;s<e.length;++s){if(this._value+=e[s],!1===this.doValidate(t)&&(this.assign(u),!t.input)){a=!0;break}u=this.clone()}return new ChangeDetails({inserted:this.value.slice(s),overflow:a})}appendWithTail(e,t){const s=new ChangeDetails;let u,a=this.clone();for(let i=0;i<e.length;++i){const n=e[i],r=this._append(n,{input:!0});if(u=this.clone(),!(!r.overflow&&!this._appendTail(t).overflow)||!1===this.doValidate({tail:!0})){this.assign(a);break}this.assign(u),a=this.clone(),s.aggregate(r)}return s.shift+=this._appendTail(t).shift,s}remove(e=0,t=this.value.length-e){return this._value=this.value.slice(0,e)+this.value.slice(e+t),new ChangeDetails}withValueRefresh(e){if(this._refreshing||!this.isInitialized)return e();this._refreshing=!0;const t=this.unmaskedValue,s=e();return this.unmaskedValue=t,delete this._refreshing,s}doPrepare(e,t={}){return this.prepare(e,this,t)}doValidate(e){return this.validate(this.value,this,e)}doCommit(){this.commit(this.value,this)}splice(e,t,s,u){const a=e+t,i=this._extractTail(a);let n=this.nearestInputPos(e,u);return new ChangeDetails({shift:n-e}).aggregate(this.remove(n)).aggregate(this.appendWithTail(s,i))}}function maskedClass(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?g.IMask.MaskedRegExp:isString(e)?g.IMask.MaskedPattern:e instanceof Date||e===Date?g.IMask.MaskedDate:e instanceof Number||"number"==typeof e||e===Number?g.IMask.MaskedNumber:Array.isArray(e)||e===Array?g.IMask.MaskedDynamic:e.prototype instanceof g.IMask.Masked?e:e instanceof Function?g.IMask.MaskedFunction:(console.warn("Mask not found for mask",e),g.IMask.Masked)}function createMask(e){const t=(e=Object.assign({},e)).mask;return t instanceof g.IMask.Masked?t:new(maskedClass(t))(e)}Masked.DEFAULTS={prepare:e=>e,validate:()=>!0,commit:()=>{}};class PatternDefinition{constructor(e){Object.assign(this,e),this.mask&&(this._masked=createMask(e))}reset(){this.isHollow=!1,this.isRawInput=!1,this._masked&&this._masked.reset()}get isInput(){return this.type===PatternDefinition.TYPES.INPUT}get isHiddenHollow(){return this.isHollow&&this.optional}resolve(e){return!!this._masked&&this._masked.resolve(e)}}PatternDefinition.DEFAULTS={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]/,"*":/./},PatternDefinition.TYPES={INPUT:"input",FIXED:"fixed"};class PatternGroup{constructor(e,{name:t,offset:s,mask:u,validate:a}){this.masked=e,this.name=t,this.offset=s,this.mask=u,this.validate=a||(()=>!0)}get value(){return this.masked.value.slice(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}get unmaskedValue(){return this.masked.extractInput(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}doValidate(e){return this.validate(this.value,this,e)}}class RangeGroup{constructor([e,t],s=String(t).length){this._from=e,this._to=t,this._maxLength=s,this.validate=this.validate.bind(this),this._update()}get to(){return this._to}set to(e){this._to=e,this._update()}get from(){return this._from}set from(e){this._from=e,this._update()}get maxLength(){return this._maxLength}set maxLength(e){this._maxLength=e,this._update()}get _matchFrom(){return this.maxLength-String(this.from).length}_update(){this._maxLength=Math.max(this._maxLength,String(this.to).length),this.mask="0".repeat(this._maxLength)}validate(e){let t="",s="";var u=e.match(/^(\D*)(\d*)(\D*)/)||[],a=slicedToArray(u,3);const i=a[1],n=a[2];return n&&(t="0".repeat(i.length)+n,s="9".repeat(i.length)+n),-1===e.search(/[^0]/)&&e.length<=this._matchFrom||(t=t.padEnd(this._maxLength,"0"),s=s.padEnd(this._maxLength,"9"),this.from<=Number(s)&&Number(t)<=this.to)}}function EnumGroup(e){return{mask:"*".repeat(e[0].length),validate:(t,s,u)=>e.some(e=>e.indexOf(s.unmaskedValue)>=0)}}PatternGroup.Range=RangeGroup,PatternGroup.Enum=EnumGroup;class ChunksTailDetails{constructor(e){this.chunks=e}get value(){return this.chunks.map(e=>e.value).join("")}get fromPos(){const e=this.chunks[0];return e&&e.stop}get toPos(){const e=this.chunks[this.chunks.length-1];return e&&e.stop}}class MaskedPattern extends Masked{constructor(e={}){e.definitions=Object.assign({},PatternDefinition.DEFAULTS,e.definitions),super(_extends({},MaskedPattern.DEFAULTS,e))}_update(e={}){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._charDefs=[],this._groupDefs=[];let t=this.mask;if(!t||!e)return;let s=!1,u=!1,a=!1;for(let i=0;i<t.length;++i){if(this.groups){const e=t.slice(i),s=Object.keys(this.groups).filter(t=>0===e.indexOf(t));s.sort((e,t)=>t.length-e.length);const u=s[0];if(u){const e=this.groups[u];this._groupDefs.push(new PatternGroup(this,{name:u,offset:this._charDefs.length,mask:e.mask,validate:e.validate})),t=t.replace(u,e.mask)}}let n=t[i],r=n in e?PatternDefinition.TYPES.INPUT:PatternDefinition.TYPES.FIXED;const h=r===PatternDefinition.TYPES.INPUT||s,o=r===PatternDefinition.TYPES.INPUT&&u;if(n!==MaskedPattern.STOP_CHAR)if("{"!==n&&"}"!==n)if("["!==n&&"]"!==n){if(n===MaskedPattern.ESCAPE_CHAR){if(!(n=t[++i]))break;r=PatternDefinition.TYPES.FIXED}this._charDefs.push(new PatternDefinition({char:n,type:r,optional:o,stopAlign:a,unmasking:h,mask:r===PatternDefinition.TYPES.INPUT?e[n]:e=>e===n})),a=!1}else u=!u;else s=!s;else a=!0}}doValidate(...e){return this._groupDefs.every(t=>t.doValidate(...e))&&super.doValidate(...e)}clone(){const e=new MaskedPattern(this);return e._value=this.value,e._charDefs.forEach((e,t)=>Object.assign(e,this._charDefs[t])),e._groupDefs.forEach((e,t)=>Object.assign(e,this._groupDefs[t])),e}reset(){super.reset(),this._charDefs.forEach(e=>{delete e.isHollow})}get isComplete(){return!this._charDefs.some((e,t)=>e.isInput&&!e.optional&&(e.isHollow||!this.extractInput(t,t+1)))}hiddenHollowsBefore(e){return this._charDefs.slice(0,e).filter(e=>e.isHiddenHollow).length}mapDefIndexToPos(e){return e-this.hiddenHollowsBefore(e)}mapPosToDefIndex(e){let t=e;for(let e=0;e<this._charDefs.length;++e){const s=this._charDefs[e];if(e>=t)break;s.isHiddenHollow&&++t}return t}get unmaskedValue(){const e=this.value;let t="";for(let s=0,u=0;s<e.length&&u<this._charDefs.length;++u){const a=e[s],i=this._charDefs[u];i.isHiddenHollow||(i.unmasking&&!i.isHollow&&(t+=a),++s)}return t}set unmaskedValue(e){super.unmaskedValue=e}_appendTail(e){const t=new ChangeDetails;return e&&t.aggregate(e instanceof ChunksTailDetails?this._appendChunks(e.chunks,{tail:!0}):super._appendTail(e)),t.aggregate(this._appendPlaceholder())}_append(e,t={}){const s=this.value.length;let u="",a=!1;e=this.doPrepare(e,t);for(let s=0,i=this.mapPosToDefIndex(this.value.length);s<e.length;){const n=e[s],r=this._charDefs[i];if(null==r){a=!0;break}let h,o;r.isHollow=!1;let l=conform(r.resolve(n),n);r.type===PatternDefinition.TYPES.INPUT?(l&&(this._value+=l,this.doValidate()||(l="",this._value=this.value.slice(0,-1))),h=!!l,o=!l&&!r.optional,l?u+=l:(r.optional||t.input||this.lazy||(this._value+=this.placeholderChar,o=!1),o||(r.isHollow=!0))):(this._value+=r.char,h=l&&(r.unmasking||t.input||t.raw)&&!t.tail,r.isRawInput=h&&(t.raw||t.input),r.isRawInput&&(u+=r.char)),o||++i,(h||o)&&++s}return new ChangeDetails({inserted:this.value.slice(s),rawInserted:u,overflow:a})}_appendChunks(e,...t){const s=new ChangeDetails;for(let a=0;a<e.length;++a){var u=e[a];const i=u.stop,n=u.value,r=null!=i&&this._charDefs[i];if(r&&r.stopAlign&&s.aggregate(this._appendPlaceholder(i)),s.aggregate(this._append(n,...t)).overflow)break}return s}_extractTail(e=0,t=this.value.length){return new ChunksTailDetails(this._extractInputChunks(e,t))}extractInput(e=0,t=this.value.length,s={}){if(e===t)return"";const u=this.value;let a="";const i=this.mapPosToDefIndex(t);for(let n=e,r=this.mapPosToDefIndex(e);n<t&&n<u.length&&r<i;++r){const e=u[n],t=this._charDefs[r];if(!t)break;t.isHiddenHollow||((t.isInput&&!t.isHollow||s.raw&&!t.isInput&&t.isRawInput)&&(a+=e),++n)}return a}_extractInputChunks(e=0,t=this.value.length){if(e===t)return[];const s=this.mapPosToDefIndex(e),u=this.mapPosToDefIndex(t),a=this._charDefs.map((e,t)=>[e,t]).slice(s,u).filter(([e])=>e.stopAlign).map(([,e])=>e),i=[s,...a,u];return i.map((e,t)=>({stop:a.indexOf(e)>=0?e:null,value:this.extractInput(this.mapDefIndexToPos(e),this.mapDefIndexToPos(i[++t]))})).filter(({stop:e,value:t})=>null!=e||t)}_appendPlaceholder(e){const t=this.value.length,s=e||this._charDefs.length;for(let t=this.mapPosToDefIndex(this.value.length);t<s;++t){const s=this._charDefs[t];s.isInput&&(s.isHollow=!0),this.lazy&&!e||(this._value+=s.isInput||null==s.char?s.optional?"":this.placeholderChar:s.char)}return new ChangeDetails({inserted:this.value.slice(t)})}remove(e=0,t=this.value.length-e){const s=this.mapPosToDefIndex(e),u=this.mapPosToDefIndex(e+t);return this._charDefs.slice(s,u).forEach(e=>e.reset()),super.remove(e,t)}nearestInputPos(e,t=DIRECTION.NONE){let s=t||DIRECTION.RIGHT;const u=this.mapPosToDefIndex(e),a=this._charDefs[u];let i,n,r,h,o=u;if(t!==DIRECTION.RIGHT&&(a&&a.isInput||t===DIRECTION.NONE&&e===this.value.length)&&(i=u,a&&!a.isHollow&&(n=u)),null==n&&t==DIRECTION.LEFT||null==i)for(h=indexInDirection(o,s);0<=h&&h<this._charDefs.length;o+=s,h+=s){const e=this._charDefs[h];if(null==i&&e.isInput&&(i=o,t===DIRECTION.NONE))break;if(null==r&&e.isHollow&&!e.isHiddenHollow&&(r=o),e.isInput&&!e.isHollow){n=o;break}}if(t!==DIRECTION.LEFT||0!==o||!this.lazy||a&&a.isInput||(i=0),t===DIRECTION.LEFT||null==i){let e=!1;for(h=indexInDirection(o,s=-s);0<=h&&h<this._charDefs.length;o+=s,h+=s){const t=this._charDefs[h];if(t.isInput&&(i=o,t.isHollow&&!t.isHiddenHollow))break;if(o===u&&(e=!0),e&&null!=i)break}(e=e||h>=this._charDefs.length)&&null!=i&&(o=i)}else null==n&&(o=null!=r?r:i);return this.mapDefIndexToPos(o)}group(e){return this.groupsByName(e)[0]}groupsByName(e){return this._groupDefs.filter(t=>t.name===e)}}MaskedPattern.DEFAULTS={lazy:!0,placeholderChar:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.Definition=PatternDefinition,MaskedPattern.Group=PatternGroup;class MaskedDate extends MaskedPattern{constructor(e){super(_extends({},MaskedDate.DEFAULTS,e))}_update(e){e.mask===Date&&delete e.mask,e.pattern&&(e.mask=e.pattern,delete e.pattern);const t=e.groups;e.groups=Object.assign({},MaskedDate.GET_DEFAULT_GROUPS()),e.min&&(e.groups.Y.from=e.min.getFullYear()),e.max&&(e.groups.Y.to=e.max.getFullYear()),Object.assign(e.groups,t),super._update(e)}doValidate(...e){const t=super.doValidate(...e),s=this.date;return t&&(!this.isComplete||this.isDateExist(this.value)&&s&&(null==this.min||this.min<=s)&&(null==this.max||s<=this.max))}isDateExist(e){return this.format(this.parse(e))===e}get date(){return this.isComplete?this.parse(this.value):null}set date(e){this.value=this.format(e)}}MaskedDate.DEFAULTS={pattern:"d{.}`m{.}`Y",format:e=>{return[String(e.getDate()).padStart(2,"0"),String(e.getMonth()+1).padStart(2,"0"),e.getFullYear()].join(".")},parse:e=>{var t=e.split("."),s=slicedToArray(t,3);const u=s[0],a=s[1],i=s[2];return new Date(i,a-1,u)}},MaskedDate.GET_DEFAULT_GROUPS=(()=>({d:new PatternGroup.Range([1,31]),m:new PatternGroup.Range([1,12]),Y:new PatternGroup.Range([1900,9999])}));class InputMask{constructor(e,t){this.el=e,this.masked=createMask(t),this._listeners={},this._value="",this._unmaskedValue="",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.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}get mask(){return this.masked.mask}set mask(e){if(null==e||e===this.masked.mask)return;if(this.masked.constructor===maskedClass(e))return void(this.masked.mask=e);const t=createMask({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.masked.value=e,this.updateControl(),this.alignCursor()}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.masked.unmaskedValue=e,this.updateControl(),this.alignCursor()}_bindEvents(){this.el.addEventListener("keydown",this._saveSelection),this.el.addEventListener("input",this._onInput),this.el.addEventListener("drop",this._onDrop),this.el.addEventListener("click",this.alignCursorFriendly),this.el.addEventListener("change",this._onChange)}_unbindEvents(){this.el.removeEventListener("keydown",this._saveSelection),this.el.removeEventListener("input",this._onInput),this.el.removeEventListener("drop",this._onDrop),this.el.removeEventListener("click",this.alignCursorFriendly),this.el.removeEventListener("change",this._onChange)}_fireEvent(e){(this._listeners[e]||[]).forEach(e=>e())}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){this.el===document.activeElement&&(this.el.setSelectionRange(e,e),this._saveSelection())}_saveSelection(){this.value!==this.el.value&&console.warn("Uncontrolled input change, refresh mask manually!"),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value}updateControl(){const e=this.masked.unmaskedValue,t=this.masked.value,s=this.unmaskedValue!==e||this.value!==t;this._unmaskedValue=e,this._value=t,this.el.value!==t&&(this.el.value=t),s&&this._fireChangeEvents()}updateOptions(e){(e=Object.assign({},e)).mask===Date&&this.masked instanceof MaskedDate&&delete e.mask,objectIncludes(this.masked,e)||(this.masked.updateOptions(e),this.updateControl())}updateCursor(e){null!=e&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept"),this.masked.isComplete&&this._fireEvent("complete")}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,DIRECTION.LEFT)}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return;if(!t)return void delete this._listeners[e];const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(){this._abortUpdateCursor();const e=new ActionDetails(this.el.value,this.cursorPos,this.value,this._selection),t=this.masked.splice(e.startChangePos,e.removed.length,e.inserted,e.removeDirection).offset,s=this.masked.nearestInputPos(e.startChangePos+t,e.removeDirection);this.updateControl(),this.updateCursor(s)}_onChange(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl()}_onDrop(e){e.preventDefault(),e.stopPropagation()}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}class MaskedNumber extends Masked{constructor(e){super(_extends({},MaskedNumber.DEFAULTS,e))}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){let e="",t="";this.allowNegative?(e+="([+|\\-]?|([+|\\-]?(0|([1-9]+\\d*))))",t+="[+|\\-]?"):e+="(0|([1-9]+\\d*))",t+="\\d*";let s=(this.scale?"("+this.radix+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp("^"+e+s),this._numberRegExp=new RegExp("^"+t+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}_extractTail(e=0,t=this.value.length){const s=super._extractTail(e,t);return _extends({},s,{value:this._removeThousandsSeparators(s.value)})}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepare(e,...t){return super.doPrepare(this._removeThousandsSeparators(e.replace(this._mapToRadixRegExp,this.radix)),...t)}appendWithTail(...e){let t=this.value;this._value=this._removeThousandsSeparators(this.value);let s=this.value.length;const u=super.appendWithTail(...e);this._value=this._insertThousandsSeparators(this.value);let a=s+u.inserted.length;for(let e=0;e<=a;++e)this.value[e]===this.thousandsSeparator&&((e<s||e===s&&t[e]===this.thousandsSeparator)&&++s,e<a&&++a);return u.rawInserted=u.inserted,u.inserted=this.value.slice(s,a),u.shift+=s-t.length,u}nearestInputPos(e,t){if(!t)return e;const s=indexInDirection(e,t);return this.value[s]===this.thousandsSeparator&&(e+=t),e}doValidate(e){let t=(e.input?this._numberRegExpInput:this._numberRegExp).test(this._removeThousandsSeparators(this.value));if(t){const e=this.number;t=t&&!isNaN(e)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return t&&super.doValidate(e)}doCommit(){const e=this.number;let t=e;null!=this.min&&(t=Math.max(t,this.min)),null!=this.max&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=String(t));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&(s=this._padFractionalZeros(s)),this._value=s,super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(e,t,s,u)=>t+u),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,".")}set unmaskedValue(e){super.unmaskedValue=e.replace(".",this.radix)}get number(){return Number(this.unmaskedValue)}set number(e){this.unmaskedValue=String(e)}get allowNegative(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}MaskedNumber.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};class MaskedRegExp extends Masked{_update(e){e.validate=(t=>t.search(e.mask)>=0),super._update(e)}}class MaskedFunction extends Masked{_update(e){e.validate=e.mask,super._update(e)}}class MaskedDynamic extends Masked{constructor(e){super(_extends({},MaskedDynamic.DEFAULTS,e)),this.currentMask=null}_update(e){super._update(e),this.compiledMasks=Array.isArray(e.mask)?e.mask.map(e=>createMask(e)):[]}_append(e,...t){e=this.doPrepare(e,...t);const s=this._applyDispatch(e,...t);return this.currentMask&&s.aggregate(this.currentMask._append(e,...t)),s}_applyDispatch(e,...t){const s=this.value.length,u=this.rawInputValue,a=this.currentMask,i=new ChangeDetails;return this.currentMask=this.doDispatch(e,...t),this.currentMask&&this.currentMask!==a&&(this.currentMask.reset(),this.currentMask._append(u,{raw:!0}),i.shift=this.value.length-s),i}doDispatch(e,t={}){return this.dispatch(e,this,t)}clone(){const e=new MaskedDynamic(this);e._value=this.value;const t=this.compiledMasks.indexOf(this.currentMask);return this.currentMask&&(e.currentMask=t>=0?e.compiledMasks[t].assign(this.currentMask):this.currentMask.clone()),e}reset(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(e=>e.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(e){super.value=e}get unmaskedValue(){return this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){super.unmaskedValue=e}get isComplete(){return!!this.currentMask&&this.currentMask.isComplete}remove(...e){const t=new ChangeDetails;return this.currentMask&&t.aggregate(this.currentMask.remove(...e)).aggregate(this._applyDispatch("")),t}extractInput(...e){return this.currentMask?this.currentMask.extractInput(...e):""}_extractTail(...e){return this.currentMask?this.currentMask._extractTail(...e):super._extractTail(...e)}_appendTail(...e){return this.currentMask?this.currentMask._appendTail(...e):super._appendTail(...e)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(...e){return this.currentMask?this.currentMask.nearestInputPos(...e):super.nearestInputPos(...e)}}function IMask(e,t={}){return new InputMask(e,t)}MaskedDynamic.DEFAULTS={dispatch:(e,t,s)=>{if(!t.compiledMasks.length)return;const u=t.rawInputValue;t.compiledMasks.forEach(t=>{t.rawInputValue=u,t._append(e,s)});const a=t.compiledMasks.map((e,t)=>({value:e.rawInputValue.length,index:t}));return a.sort((e,t)=>t.value-e.value),t.compiledMasks[a[0].index]}},IMask.InputMask=InputMask,IMask.Masked=Masked,IMask.MaskedPattern=MaskedPattern,IMask.MaskedNumber=MaskedNumber,IMask.MaskedDate=MaskedDate,IMask.MaskedRegExp=MaskedRegExp,IMask.MaskedFunction=MaskedFunction,IMask.MaskedDynamic=MaskedDynamic,IMask.createMask=createMask,g.IMask=IMask;export default IMask;
//# sourceMappingURL=imask.es.min.js.map

@@ -1,2 +0,2 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.IMask=e()}(this,function(){"use strict";function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t){return"string"==typeof t||t instanceof String}function n(t,n){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return e(t)?t:t?n:u}function u(t,e){return e===et.LEFT&&--t,t}function r(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function i(t,e){if(e===t)return!0;var n,u=Array.isArray(e),r=Array.isArray(t);if(u&&r){if(e.length!=t.length)return!1;for(n=0;n<e.length;n++)if(!i(e[n],t[n]))return!1;return!0}if(u!=r)return!1;if(e&&t&&"object"===(void 0===e?"undefined":X(e))&&"object"===(void 0===t?"undefined":X(t))){var o=Object.keys(e),s=e instanceof Date,a=t instanceof Date;if(s&&a)return e.getTime()==t.getTime();if(s!=a)return!1;var h=e instanceof RegExp,l=t instanceof RegExp;if(h&&l)return e.toString()==t.toString();if(h!=l)return!1;for(n=0;n<o.length;n++)if(!Object.prototype.hasOwnProperty.call(t,o[n]))return!1;for(n=0;n<o.length;n++)if(!i(e[o[n]],t[o[n]]))return!1;return!0}return!1}function o(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?nt.IMask.MaskedRegExp:e(t)?nt.IMask.MaskedPattern:t instanceof Date||t===Date?nt.IMask.MaskedDate:t instanceof Number||"number"==typeof t||t===Number?nt.IMask.MaskedNumber:Array.isArray(t)||t===Array?nt.IMask.MaskedDynamic:t.prototype instanceof nt.IMask.Masked?t:t instanceof Function?nt.IMask.MaskedFunction:(console.warn("Mask not found for mask",t),nt.IMask.Masked)}function s(t){var e=(t=K({},t)).mask;if(e instanceof nt.IMask.Masked)return e;return new(o(e))(t)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new pt(t,e)}var h=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},l={}.hasOwnProperty,p=function(t,e){return l.call(t,e)},c={}.toString,f=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==function(t){return c.call(t).slice(8,-1)}(t)?t.split(""):Object(t)},d=function(t){return f(h(t))},v=Math.ceil,g=Math.floor,m=function(t){return isNaN(t=+t)?0:(t>0?g:v)(t)},A=Math.min,y=function(t){return t>0?A(m(t),9007199254740991):0},_=Math.max,F=Math.min,C=t(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),D=C["__core-js_shared__"]||(C["__core-js_shared__"]={}),E=0,k=Math.random(),B=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++E+k).toString(36))},w=function(t){return D[t]||(D[t]={})}("keys"),x=function(t){return function(e,n,u){var r,i=d(e),o=y(i.length),s=function(t,e){return(t=m(t))<0?_(t+e,0):F(t,e)}(u,o);if(t&&n!=n){for(;o>s;)if((r=i[s++])!=r)return!0}else for(;o>s;s++)if((t||s in i)&&i[s]===n)return t||s||0;return!t&&-1}}(!1),b=function(t){return w[t]||(w[t]=B(t))}("IE_PROTO"),P="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),S=Object.keys||function(t){return function(t,e){var n,u=d(t),r=0,i=[];for(n in u)n!=b&&p(u,n)&&i.push(n);for(;e.length>r;)p(u,n=e[r++])&&(~x(i,n)||i.push(n));return i}(t,P)},I=t(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),T=(I.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),M=function(t){if(!T(t))throw TypeError(t+" is not an object!");return t},O=function(t){try{return!!t()}catch(t){return!0}},R=!O(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),L=C.document,V=T(L)&&T(L.createElement),j=!R&&!O(function(){return 7!=Object.defineProperty(function(t){return V?L.createElement(t):{}}("div"),"a",{get:function(){return 7}}).a}),H=Object.defineProperty,U={f:R?Object.defineProperty:function(t,e,n){if(M(t),e=function(t,e){if(!T(t))return t;var n,u;if(e&&"function"==typeof(n=t.toString)&&!T(u=n.call(t)))return u;if("function"==typeof(n=t.valueOf)&&!T(u=n.call(t)))return u;if(!e&&"function"==typeof(n=t.toString)&&!T(u=n.call(t)))return u;throw TypeError("Can't convert object to primitive value")}(e,!0),M(n),j)try{return H(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t}},N=R?function(t,e,n){return U.f(t,e,function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}(1,n))}:function(t,e,n){return t[e]=n,t},z=t(function(t){var e=B("src"),n=Function.toString,u=(""+n).split("toString");I.inspectSource=function(t){return n.call(t)},(t.exports=function(t,n,r,i){var o="function"==typeof r;o&&(p(r,"name")||N(r,"name",n)),t[n]!==r&&(o&&(p(r,e)||N(r,e,t[n]?""+t[n]:u.join(String(n)))),t===C?t[n]=r:i?t[n]?t[n]=r:N(t,n,r):(delete t[n],N(t,n,r)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[e]||n.call(this)})}),Y=function(t,e,n){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,u){return t.call(e,n,u)};case 3:return function(n,u,r){return t.call(e,n,u,r)}}return function(){return t.apply(e,arguments)}},G=function(t,e,n){var u,r,i,o,s=t&G.F,a=t&G.G,h=t&G.S,l=t&G.P,p=t&G.B,c=a?C:h?C[e]||(C[e]={}):(C[e]||{}).prototype,f=a?I:I[e]||(I[e]={}),d=f.prototype||(f.prototype={});a&&(n=e);for(u in n)i=((r=!s&&c&&void 0!==c[u])?c:n)[u],o=p&&r?Y(i,C):l&&"function"==typeof i?Y(Function.call,i):i,c&&z(c,u,i,t&G.U),f[u]!=i&&N(f,u,o),l&&d[u]!=i&&(d[u]=i)};C.core=I,G.F=1,G.G=2,G.S=4,G.P=8,G.B=16,G.W=32,G.U=64,G.R=128;var Z=G;!function(t,e){var n=(I.Object||{})[t]||Object[t],u={};u[t]=e(n),Z(Z.S+Z.F*O(function(){n(1)}),"Object",u)}("keys",function(){return function(t){return S(function(t){return Object(h(t))}(t))}});I.Object.keys;var W=function(t){var e=String(h(this)),n="",u=m(t);if(u<0||u==1/0)throw RangeError("Count can't be negative");for(;u>0;(u>>>=1)&&(e+=e))1&u&&(n+=e);return n};Z(Z.P,"String",{repeat:W});I.String.repeat;var $=function(t,e,n,u){var r=String(h(t)),i=r.length,o=void 0===n?" ":String(n),s=y(e);if(s<=i||""==o)return r;var a=s-i,l=W.call(o,Math.ceil(a/o.length));return l.length>a&&(l=l.slice(0,a)),u?l+r:r+l};Z(Z.P,"String",{padStart:function(t){return $(this,t,arguments.length>1?arguments[1]:void 0,!0)}});I.String.padStart;Z(Z.P,"String",{padEnd:function(t){return $(this,t,arguments.length>1?arguments[1]:void 0,!1)}});I.String.padEnd;var X="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},q=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},J=function(){function t(t,e){for(var n=0;n<e.length;n++){var u=e[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(t,u.key,u)}}return function(e,n,u){return n&&t(e.prototype,n),u&&t(e,u),e}}(),K=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var u in n)Object.prototype.hasOwnProperty.call(n,u)&&(t[u]=n[u])}return t},Q=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},tt=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},et={NONE:0,LEFT:-1,RIGHT:1},nt="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{},ut=function(){function t(e,n,u,r){for(q(this,t),this.value=e,this.cursorPos=n,this.oldValue=u,this.oldSelection=r;this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}return J(t,[{key:"startChangePos",get:function(){return Math.min(this.cursorPos,this.oldSelection.start)}},{key:"insertedCount",get:function(){return this.cursorPos-this.startChangePos}},{key:"inserted",get:function(){return this.value.substr(this.startChangePos,this.insertedCount)}},{key:"removedCount",get:function(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}},{key:"removed",get:function(){return this.oldValue.substr(this.startChangePos,this.removedCount)}},{key:"head",get:function(){return this.value.substring(0,this.startChangePos)}},{key:"tail",get:function(){return this.value.substring(this.startChangePos+this.insertedCount)}},{key:"removeDirection",get:function(){return!this.removedCount||this.insertedCount?et.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?et.RIGHT:et.LEFT}}]),t}(),rt=function(){function t(e){q(this,t),K(this,{inserted:"",overflow:!1,removedCount:0,shift:0},e)}return t.prototype.aggregate=function(t){return this.inserted+=t.inserted,this.removedCount+=t.removedCount,this.shift+=t.shift,this.overflow=this.overflow||t.overflow,t.rawInserted&&(this.rawInserted+=t.rawInserted),this},J(t,[{key:"offset",get:function(){return this.shift+this.inserted.length-this.removedCount}},{key:"rawInserted",get:function(){return null!=this._rawInserted?this._rawInserted:this.inserted},set:function(t){this._rawInserted=t}}]),t}(),it=function(){function t(e){q(this,t),this._value="",this._update(K({},t.DEFAULTS,e)),this.isInitialized=!0}return t.prototype.updateOptions=function(t){this.withValueRefresh(this._update.bind(this,t))},t.prototype._update=function(t){K(this,t)},t.prototype.clone=function(){var e=new t(this);return e._value=this.value.slice(),e},t.prototype.reset=function(){this._value=""},t.prototype.resolve=function(t){return this.reset(),this._append(t,{input:!0}),this._appendTail(),this.doCommit(),this.value},t.prototype.nearestInputPos=function(t,e){return t},t.prototype.extractInput=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e)},t.prototype._extractTail=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.extractInput(t,e)},t.prototype._appendTail=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return this._append(t,{tail:!0})},t.prototype._append=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.value.length,u=this.clone(),r=!1;t=this.doPrepare(t,e);for(var i=0;i<t.length;++i){if(this._value+=t[i],!1===this.doValidate(e)&&(K(this,u),!e.input)){r=!0;break}u=this.clone()}return new rt({inserted:this.value.slice(n),overflow:r})},t.prototype.appendWithTail=function(t,e){for(var n=new rt,u=this.clone(),r=void 0,i=0;i<t.length;++i){var o=t[i],s=this._append(o,{input:!0});r=this.clone();if(!(!s.overflow&&!this._appendTail(e).overflow)||!1===this.doValidate({tail:!0})){K(this,u);break}K(this,r),u=this.clone(),n.aggregate(s)}return n.shift+=this._appendTail(e).shift,n},t.prototype._unmask=function(){return this.value},t.prototype.remove=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length-t;this._value=this.value.slice(0,t)+this.value.slice(t+e)},t.prototype.withValueRefresh=function(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;var e=this.unmaskedValue,n=t();return this.unmaskedValue=e,delete this._refreshing,n},t.prototype.doPrepare=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare(t,this,e)},t.prototype.doValidate=function(t){return this.validate(this.value,this,t)},t.prototype.doCommit=function(){this.commit(this.value,this)},t.prototype.splice=function(t,e,n,u){var r=t+e,i=this._extractTail(r),o=this.nearestInputPos(t,u);this.remove(o);var s=this.appendWithTail(n,i);return s.shift+=o-t,s},J(t,[{key:"value",get:function(){return this._value},set:function(t){this.resolve(t)}},{key:"unmaskedValue",get:function(){return this._unmask()},set:function(t){this.reset(),this._append(t),this._appendTail(),this.doCommit()}},{key:"rawInputValue",get:function(){return this.extractInput(0,this.value.length,{raw:!0})},set:function(t){this.reset(),this._append(t,{raw:!0}),this._appendTail(),this.doCommit()}},{key:"isComplete",get:function(){return!0}}]),t}();it.DEFAULTS={prepare:function(t){return t},validate:function(){return!0},commit:function(){}};var ot=function(){function t(e){q(this,t),K(this,e),this.mask&&(this._masked=s(e))}return t.prototype.reset=function(){this.isHollow=!1,this.isRawInput=!1,this._masked&&this._masked.reset()},t.prototype.resolve=function(t){return!!this._masked&&this._masked.resolve(t)},J(t,[{key:"isInput",get:function(){return this.type===t.TYPES.INPUT}},{key:"isHiddenHollow",get:function(){return this.isHollow&&this.optional}}]),t}();ot.DEFAULTS={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]/,"*":/./},ot.TYPES={INPUT:"input",FIXED:"fixed"};var st=function(){function t(e,n){var u=n.name,r=n.offset,i=n.mask,o=n.validate;q(this,t),this.masked=e,this.name=u,this.offset=r,this.mask=i,this.validate=o||function(){return!0}}return t.prototype.doValidate=function(t){return this.validate(this.value,this,t)},J(t,[{key:"value",get:function(){return this.masked.value.slice(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}},{key:"unmaskedValue",get:function(){return this.masked.extractInput(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}}]),t}(),at=function(){function t(e){var n=e[0],u=e[1],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(u).length;q(this,t),this._from=n,this._to=u,this._maxLength=r,this.validate=this.validate.bind(this),this._update()}return t.prototype._update=function(){this._maxLength=Math.max(this._maxLength,String(this.to).length),this.mask="0".repeat(this._maxLength)},t.prototype.validate=function(t){var e="",n="",u=t.match(/^(\D*)(\d*)(\D*)/)||[],r=u[1],i=u[2];i&&(e="0".repeat(r.length)+i,n="9".repeat(r.length)+i);return-1===t.search(/[^0]/)&&t.length<=this._matchFrom||(e=e.padEnd(this._maxLength,"0"),n=n.padEnd(this._maxLength,"9"),this.from<=Number(n)&&Number(e)<=this.to)},J(t,[{key:"to",get:function(){return this._to},set:function(t){this._to=t,this._update()}},{key:"from",get:function(){return this._from},set:function(t){this._from=t,this._update()}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t,this._update()}},{key:"_matchFrom",get:function(){return this.maxLength-String(this.from).length}}]),t}();st.Range=at,st.Enum=function(t){return{mask:"*".repeat(t[0].length),validate:function(e,n,u){return t.some(function(t){return t.indexOf(n.unmaskedValue)>=0})}}};var ht=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return q(this,e),n.definitions=K({},ot.DEFAULTS,n.definitions),tt(this,t.call(this,K({},e.DEFAULTS,n)))}return Q(e,t),e.prototype._update=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};e.definitions=K({},this.definitions,e.definitions),null!=e.placeholder&&(console.warn("'placeholder' option is deprecated and will be removed in next major release, use 'placeholderChar' and 'lazy' instead."),"char"in e.placeholder&&(e.placeholderChar=e.placeholder.char),"lazy"in e.placeholder&&(e.lazy=e.placeholder.lazy),delete e.placeholder),null!=e.placeholderLazy&&(console.warn("'placeholderLazy' option is deprecated and will be removed in next major release, use 'lazy' instead."),e.lazy=e.placeholderLazy,delete e.placeholderLazy),t.prototype._update.call(this,e),this._updateMask()},e.prototype._updateMask=function(){var t=this,n=this.definitions;this._charDefs=[],this._groupDefs=[];var u=this.mask;if(u&&n){var r=!1,i=!1,o=!1,s=function(s){if(t.groups){var h=u.slice(s),l=Object.keys(t.groups).filter(function(t){return 0===h.indexOf(t)});l.sort(function(t,e){return e.length-t.length});var p=l[0];if(p){var c=t.groups[p];t._groupDefs.push(new st(t,{name:p,offset:t._charDefs.length,mask:c.mask,validate:c.validate})),u=u.replace(p,c.mask)}}var f=u[s],d=!r&&f in n?ot.TYPES.INPUT:ot.TYPES.FIXED,v=d===ot.TYPES.INPUT||r,g=d===ot.TYPES.INPUT&&i;if(f===e.STOP_CHAR)return o=!0,"continue";if("{"===f||"}"===f)return r=!r,"continue";if("["===f||"]"===f)return i=!i,"continue";if(f===e.ESCAPE_CHAR){if(++s,!(f=u[s]))return"break";d=ot.TYPES.FIXED}t._charDefs.push(new ot({char:f,type:d,optional:g,stopAlign:o,unmasking:v,mask:d===ot.TYPES.INPUT?n[f]:function(t){return t===f}})),o=!1,a=s};t:for(var a=0;a<u.length;++a){switch(s(a)){case"continue":continue;case"break":break t}}}},e.prototype.doValidate=function(){for(var e,n=arguments.length,u=Array(n),r=0;r<n;r++)u[r]=arguments[r];return this._groupDefs.every(function(t){return t.doValidate.apply(t,u)})&&(e=t.prototype.doValidate).call.apply(e,[this].concat(u))},e.prototype.clone=function(){var t=this,n=new e(this);return n._value=this.value,n._charDefs.forEach(function(e,n){return K(e,t._charDefs[n])}),n._groupDefs.forEach(function(e,n){return K(e,t._groupDefs[n])}),n},e.prototype.reset=function(){t.prototype.reset.call(this),this._charDefs.forEach(function(t){delete t.isHollow})},e.prototype.hiddenHollowsBefore=function(t){return this._charDefs.slice(0,t).filter(function(t){return t.isHiddenHollow}).length},e.prototype.mapDefIndexToPos=function(t){return t-this.hiddenHollowsBefore(t)},e.prototype.mapPosToDefIndex=function(t){for(var e=t,n=0;n<this._charDefs.length;++n){var u=this._charDefs[n];if(n>=e)break;u.isHiddenHollow&&++e}return e},e.prototype._unmask=function(){for(var t=this.value,e="",n=0,u=0;n<t.length&&u<this._charDefs.length;++u){var r=t[n],i=this._charDefs[u];i.isHiddenHollow||(i.unmasking&&!i.isHollow&&(e+=r),++n)}return e},e.prototype._appendTail=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this._appendChunks(t,{tail:!0}).aggregate(this._appendPlaceholder())},e.prototype._append=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=this.value.length,r="",i=!1;t=this.doPrepare(t,e);for(var o=0,s=this.mapPosToDefIndex(this.value.length);o<t.length;){var a=t[o],h=this._charDefs[s];if(null==h){i=!0;break}h.isHollow=!1;var l=void 0,p=void 0,c=n(h.resolve(a),a);h.type===ot.TYPES.INPUT?(c&&(this._value+=c,this.doValidate()||(c="",this._value=this.value.slice(0,-1))),l=!!c,p=!c&&!h.optional,c?r+=c:(h.optional||e.input||(this._value+=this.placeholderChar,p=!1),p||(h.isHollow=!0))):(this._value+=h.char,l=c&&(h.unmasking||e.input||e.raw)&&!e.tail,h.isRawInput=l&&(e.raw||e.input),h.isRawInput&&(r+=h.char)),p||++s,(l||p)&&++o}return new rt({inserted:this.value.slice(u),rawInserted:r,overflow:i})},e.prototype._appendChunks=function(t){for(var e=new rt,n=arguments.length,u=Array(n>1?n-1:0),r=1;r<n;r++)u[r-1]=arguments[r];for(var i=0;i<t.length;++i){var o=t[i],s=o[0],a=o[1];if(null!=s&&e.aggregate(this._appendPlaceholder(s)),e.aggregate(this._append.apply(this,[a].concat(u))).overflow)break}return e},e.prototype._extractTail=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this._extractInputChunks(t,e)},e.prototype.extractInput=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";for(var u=this.value,r="",i=this.mapPosToDefIndex(e),o=t,s=this.mapPosToDefIndex(t);o<e&&o<u.length&&s<i;++s){var a=u[o],h=this._charDefs[s];if(!h)break;h.isHiddenHollow||((h.isInput&&!h.isHollow||n.raw&&!h.isInput&&h.isRawInput)&&(r+=a),++o)}return r},e.prototype._extractInputChunks=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;if(e===n)return[];var u=this.mapPosToDefIndex(e),r=this.mapPosToDefIndex(n),i=this._charDefs.map(function(t,e){return[t,e]}).slice(u,r).filter(function(t){return t[0].stopAlign}).map(function(t){return t[1]}),o=[u].concat(i,[r]);return o.map(function(e,n){return[i.indexOf(e)>=0?e:null,t.extractInput(t.mapDefIndexToPos(e),t.mapDefIndexToPos(o[++n]))]}).filter(function(t){var e=t[0],n=t[1];return null!=e||n})},e.prototype._appendPlaceholder=function(t){for(var e=this.value.length,n=t||this._charDefs.length,u=this.mapPosToDefIndex(this.value.length);u<n;++u){var r=this._charDefs[u];r.isInput&&(r.isHollow=!0),this.lazy&&!t||(this._value+=r.isInput||null==r.char?r.optional?"":this.placeholderChar:r.char)}return new rt({inserted:this.value.slice(e)})},e.prototype.remove=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=t+(arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length-t);this._value=this.value.slice(0,t)+this.value.slice(e);var n=this.mapPosToDefIndex(t),u=this.mapPosToDefIndex(e);this._charDefs.slice(n,u).forEach(function(t){return t.reset()})},e.prototype.nearestInputPos=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:et.NONE,n=e||et.LEFT,r=this.mapPosToDefIndex(t),i=this._charDefs[r],o=r,s=void 0,a=void 0,h=void 0,l=void 0;if(e!==et.RIGHT&&(i&&i.isInput||e===et.NONE&&t===this.value.length)&&(s=r,i&&!i.isHollow&&(a=r)),null==a&&e==et.LEFT||null==s)for(l=u(o,n);0<=l&&l<this._charDefs.length;o+=n,l+=n){var p=this._charDefs[l];if(null==s&&p.isInput&&(s=o),null==h&&p.isHollow&&!p.isHiddenHollow&&(h=o),p.isInput&&!p.isHollow){a=o;break}}if(e!==et.LEFT||0!==o||i&&i.isInput||(s=0),e!==et.RIGHT||null==s){var c=!1;for(l=u(o,n=-n);0<=l&&l<this._charDefs.length;o+=n,l+=n){var f=this._charDefs[l];if(f.isInput&&(s=o,f.isHollow&&!f.isHiddenHollow))break;if(o===r&&(c=!0),c&&null!=s)break}(c=c||l>=this._charDefs.length)&&null!=s&&(o=s)}else null==a&&(o=null!=h?h:s);return this.mapDefIndexToPos(o)},e.prototype.group=function(t){return this.groupsByName(t)[0]},e.prototype.groupsByName=function(t){return this._groupDefs.filter(function(e){return e.name===t})},J(e,[{key:"isComplete",get:function(){var t=this;return!this._charDefs.some(function(e,n){return e.isInput&&!e.optional&&(e.isHollow||!t.extractInput(n,n+1))})}}]),e}(it);ht.DEFAULTS={lazy:!0,placeholderChar:"_"},ht.STOP_CHAR="`",ht.ESCAPE_CHAR="\\",ht.Definition=ot,ht.Group=st;var lt=function(t){function e(n){return q(this,e),tt(this,t.call(this,K({},e.DEFAULTS,n)))}return Q(e,t),e.prototype._update=function(n){n.mask===Date&&delete n.mask,n.pattern&&(n.mask=n.pattern,delete n.pattern);var u=n.groups;n.groups=K({},e.GET_DEFAULT_GROUPS()),n.min&&(n.groups.Y.from=n.min.getFullYear()),n.max&&(n.groups.Y.to=n.max.getFullYear()),K(n.groups,u),t.prototype._update.call(this,n)},e.prototype.doValidate=function(){for(var e,n=arguments.length,u=Array(n),r=0;r<n;r++)u[r]=arguments[r];var i=(e=t.prototype.doValidate).call.apply(e,[this].concat(u)),o=this.date;return i&&(!this.isComplete||this.isDateExist(this.value)&&o&&(null==this.min||this.min<=o)&&(null==this.max||o<=this.max))},e.prototype.isDateExist=function(t){return this.format(this.parse(t))===t},J(e,[{key:"date",get:function(){return this.isComplete?this.parse(this.value):null},set:function(t){this.value=this.format(t)}}]),e}(ht);lt.DEFAULTS={pattern:"d{.}`m{.}`Y",format:function(t){return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:function(t){var e=t.split("."),n=e[0],u=e[1],r=e[2];return new Date(r,u-1,n)}},lt.GET_DEFAULT_GROUPS=function(){return{d:new st.Range([1,31]),m:new st.Range([1,12]),Y:new st.Range([1900,9999])}};var pt=function(){function t(e,n){q(this,t),this.el=e,this.masked=s(n),this._listeners={},this._value="",this._unmaskedValue="",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.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this.bindEvents(),this.updateValue(),this._onChange()}return t.prototype.bindEvents=function(){this.el.addEventListener("keydown",this._saveSelection),this.el.addEventListener("input",this._onInput),this.el.addEventListener("drop",this._onDrop),this.el.addEventListener("click",this.alignCursorFriendly),this.el.addEventListener("change",this._onChange)},t.prototype.unbindEvents=function(){this.el.removeEventListener("keydown",this._saveSelection),this.el.removeEventListener("input",this._onInput),this.el.removeEventListener("drop",this._onDrop),this.el.removeEventListener("click",this.alignCursorFriendly),this.el.removeEventListener("change",this._onChange)},t.prototype.fireEvent=function(t){(this._listeners[t]||[]).forEach(function(t){return t()})},t.prototype._saveSelection=function(){this.value!==this.el.value&&console.warn("Uncontrolled input change, refresh mask manually!"),this._selection={start:this.selectionStart,end:this.cursorPos}},t.prototype.updateValue=function(){this.masked.value=this.el.value},t.prototype.updateControl=function(){var t=this.masked.unmaskedValue,e=this.masked.value,n=this.unmaskedValue!==t||this.value!==e;this._unmaskedValue=t,this._value=e,this.el.value!==e&&(this.el.value=e),n&&this._fireChangeEvents()},t.prototype.updateOptions=function(t){(t=K({},t)).mask===Date&&this.masked instanceof lt&&delete t.mask,i(this.masked,t)||(this.masked.updateOptions(t),this.updateControl())},t.prototype.updateCursor=function(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))},t.prototype._delayUpdateCursor=function(t){var e=this;this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(function(){e.el&&(e.cursorPos=e._changingCursorPos,e._abortUpdateCursor())},10)},t.prototype._fireChangeEvents=function(){this.fireEvent("accept"),this.masked.isComplete&&this.fireEvent("complete")},t.prototype._abortUpdateCursor=function(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)},t.prototype.alignCursor=function(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,et.LEFT)},t.prototype.alignCursorFriendly=function(){this.selectionStart===this.cursorPos&&this.alignCursor()},t.prototype.on=function(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this},t.prototype.off=function(t,e){if(this._listeners[t]){if(e){var n=this._listeners[t].indexOf(e);return n>=0&&this._listeners[t].splice(n,1),this}delete this._listeners[t]}},t.prototype._onInput=function(){this._abortUpdateCursor();var t=new ut(this.el.value,this.cursorPos,this.value,this._selection),e=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,n=this.masked.nearestInputPos(t.startChangePos+e);this.updateControl(),this.updateCursor(n)},t.prototype._onChange=function(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl()},t.prototype._onDrop=function(t){t.preventDefault(),t.stopPropagation()},t.prototype.destroy=function(){this.unbindEvents(),this._listeners.length=0,delete this.el},J(t,[{key:"mask",get:function(){return this.masked.mask},set:function(t){if(null!=t&&t!==this.masked.mask)if(this.masked.constructor!==o(t)){var e=s({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}else this.masked.mask=t}},{key:"value",get:function(){return this._value},set:function(t){this.masked.value=t,this.updateControl(),this.alignCursor()}},{key:"unmaskedValue",get:function(){return this._unmaskedValue},set:function(t){this.masked.unmaskedValue=t,this.updateControl(),this.alignCursor()}},{key:"selectionStart",get:function(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}},{key:"cursorPos",get:function(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd},set:function(t){this.el===document.activeElement&&(this.el.setSelectionRange(t,t),this._saveSelection())}}]),t}(),ct=function(t){function e(n){return q(this,e),tt(this,t.call(this,K({},e.DEFAULTS,n)))}return Q(e,t),e.prototype._update=function(e){e.postFormat&&(console.warn("'postFormat' option is deprecated and will be removed in next release, use plain options instead."),K(e,e.postFormat),delete e.postFormat),t.prototype._update.call(this,e),this._updateRegExps()},e.prototype._updateRegExps=function(){var t="",e="";this.allowNegative?(t+="([+|\\-]?|([+|\\-]?(0|([1-9]+\\d*))))",e+="[+|\\-]?"):t+="(0|([1-9]+\\d*))",e+="\\d*";var n=(this.scale?"("+this.radix+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp("^"+t+n),this._numberRegExp=new RegExp("^"+e+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(r).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(r(this.thousandsSeparator),"g")},e.prototype._extractTail=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this._removeThousandsSeparators(t.prototype._extractTail.call(this,e,n))},e.prototype._removeThousandsSeparators=function(t){return t.replace(this._thousandsSeparatorRegExp,"")},e.prototype._insertThousandsSeparators=function(t){var e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)},e.prototype.doPrepare=function(e){for(var n,u=arguments.length,r=Array(u>1?u-1:0),i=1;i<u;i++)r[i-1]=arguments[i];return(n=t.prototype.doPrepare).call.apply(n,[this,this._removeThousandsSeparators(e.replace(this._mapToRadixRegExp,this.radix))].concat(r))},e.prototype.appendWithTail=function(){var e,n=this.value;this._value=this._removeThousandsSeparators(this.value);for(var u=this.value.length,r=arguments.length,i=Array(r),o=0;o<r;o++)i[o]=arguments[o];var s=(e=t.prototype.appendWithTail).call.apply(e,[this].concat(i));this._value=this._insertThousandsSeparators(this.value);for(var a=u+s.inserted.length,h=0;h<=a;++h)this.value[h]===this.thousandsSeparator&&((h<u||h===u&&n[h]===this.thousandsSeparator)&&++u,h<a&&++a);return s.rawInserted=s.inserted,s.inserted=this.value.slice(u,a),s.shift+=u-n.length,s},e.prototype.nearestInputPos=function(t,e){if(!e)return t;var n=u(t,e);return this.value[n]===this.thousandsSeparator&&(t+=e),t},e.prototype.doValidate=function(e){var n=(e.input?this._numberRegExpInput:this._numberRegExp).test(this._removeThousandsSeparators(this.value));if(n){var u=this.number;n=n&&!isNaN(u)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return n&&t.prototype.doValidate.call(this,e)},e.prototype.doCommit=function(){var e=this.number,n=e;null!=this.min&&(n=Math.max(n,this.min)),null!=this.max&&(n=Math.min(n,this.max)),n!==e&&(this.unmaskedValue=String(n));var u=this.value;this.normalizeZeros&&(u=this._normalizeZeros(u)),this.padFractionalZeros&&(u=this._padFractionalZeros(u)),this._value=u,t.prototype.doCommit.call(this)},e.prototype._normalizeZeros=function(t){var e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,function(t,e,n,u){return e+u}),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))},e.prototype._padFractionalZeros=function(t){var e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)},J(e,[{key:"number",get:function(){var t=this._removeThousandsSeparators(this._normalizeZeros(this.unmaskedValue)).replace(this.radix,".");return Number(t)},set:function(t){this.unmaskedValue=String(t).replace(".",this.radix)}},{key:"allowNegative",get:function(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}]),e}(it);ct.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};var ft=function(t){function e(){return q(this,e),tt(this,t.apply(this,arguments))}return Q(e,t),e.prototype._update=function(e){e.validate=function(t){return t.search(e.mask)>=0},t.prototype._update.call(this,e)},e}(it),dt=function(t){function e(){return q(this,e),tt(this,t.apply(this,arguments))}return Q(e,t),e.prototype._update=function(e){e.validate=e.mask,t.prototype._update.call(this,e)},e}(it),vt=function(t){function e(n){q(this,e);var u=tt(this,t.call(this,K({},e.DEFAULTS,n)));return u.currentMask=null,u}return Q(e,t),e.prototype._update=function(e){t.prototype._update.call(this,e),this.compiledMasks=Array.isArray(e.mask)?e.mask.map(function(t){return s(t)}):[]},e.prototype._append=function(t){for(var e=this.value.length,n=new rt,u=arguments.length,r=Array(u>1?u-1:0),i=1;i<u;i++)r[i-1]=arguments[i];t=this.doPrepare.apply(this,[t].concat(r));var o=this.rawInputValue;if(this.currentMask=this.doDispatch.apply(this,[t].concat(r)),this.currentMask){var s;this.currentMask.rawInputValue=o,n.shift=this.value.length-e,n.aggregate((s=this.currentMask)._append.apply(s,[t].concat(r)))}return n},e.prototype.doDispatch=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.dispatch(t,this,e)},e.prototype.clone=function(){var t=new e(this);return t._value=this.value,this.currentMask&&(t.currentMask=this.currentMask.clone()),t},e.prototype.reset=function(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(function(t){return t.reset()})},e.prototype._unmask=function(){return this.currentMask?this.currentMask._unmask():""},e.prototype.remove=function(){var t;this.currentMask&&(t=this.currentMask).remove.apply(t,arguments)},e.prototype.extractInput=function(){var t;return this.currentMask?(t=this.currentMask).extractInput.apply(t,arguments):""},e.prototype.doCommit=function(){this.currentMask&&this.currentMask.doCommit(),t.prototype.doCommit.call(this)},e.prototype.nearestInputPos=function(){for(var e,n,u=arguments.length,r=Array(u),i=0;i<u;i++)r[i]=arguments[i];return this.currentMask?(e=this.currentMask).nearestInputPos.apply(e,r):(n=t.prototype.nearestInputPos).call.apply(n,[this].concat(r))},J(e,[{key:"value",get:function(){return this.currentMask?this.currentMask.value:""},set:function(t){this.resolve(t)}},{key:"isComplete",get:function(){return!!this.currentMask&&this.currentMask.isComplete}}]),e}(it);return vt.DEFAULTS={dispatch:function(t,e,n){if(e.compiledMasks.length){var u=e.rawInputValue;e.compiledMasks.forEach(function(e){e.rawInputValue=u,e._append(t,n)});var r=e.compiledMasks.map(function(t,e){return{value:t.rawInputValue.length,index:e}});return r.sort(function(t,e){return e.value-t.value}),e.compiledMasks[r[0].index]}}},a.InputMask=pt,a.Masked=it,a.MaskedPattern=ht,a.MaskedNumber=ct,a.MaskedDate=lt,a.MaskedRegExp=ft,a.MaskedFunction=dt,a.MaskedDynamic=vt,a.createMask=s,nt.IMask=a,a});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.IMask=e()}(this,function(){"use strict";var t=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},e={}.hasOwnProperty,u=function(t,u){return e.call(t,u)},n={}.toString,r=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==(e=t,n.call(e).slice(8,-1))?t.split(""):Object(t);var e},i=function(e){return r(t(e))},s=Math.ceil,a=Math.floor,o=function(t){return isNaN(t=+t)?0:(t>0?a:s)(t)},l=Math.min,h=function(t){return t>0?l(o(t),9007199254740991):0},c=Math.max,p=Math.min;function f(t,e){return t(e={exports:{}},e.exports),e.exports}var d,v,g,_=f(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),y="__core-js_shared__",k=_[y]||(_[y]={}),m=0,A=Math.random(),F=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++m+A).toString(36))},D=k[d="keys"]||(k[d]={}),C=(v=!1,function(t,e,u){var n,r,s,a=i(t),l=h(a.length),f=(r=l,(n=o(n=u))<0?c(n+r,0):p(n,r));if(v&&e!=e){for(;l>f;)if((s=a[f++])!=s)return!0}else for(;l>f;f++)if((v||f in a)&&a[f]===e)return v||f||0;return!v&&-1}),E=D[g="IE_PROTO"]||(D[g]=F(g)),B="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),b=Object.keys||function(t){return function(t,e){var n,r=i(t),s=0,a=[];for(n in r)n!=E&&u(r,n)&&a.push(n);for(;e.length>s;)u(r,n=e[s++])&&(~C(a,n)||a.push(n));return a}(t,B)},P=f(function(t){var e=t.exports={version:"2.5.3"};"number"==typeof __e&&(__e=e)}),w=(P.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),O=function(t){if(!w(t))throw TypeError(t+" is not an object!");return t},x=function(t){try{return!!t()}catch(t){return!0}},T=!x(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),S=_.document,I=w(S)&&w(S.createElement),M=!T&&!x(function(){return 7!=Object.defineProperty((t="div",I?S.createElement(t):{}),"a",{get:function(){return 7}}).a;var t}),j=Object.defineProperty,V={f:T?Object.defineProperty:function(t,e,u){if(O(t),e=function(t,e){if(!w(t))return t;var u,n;if(e&&"function"==typeof(u=t.toString)&&!w(n=u.call(t)))return n;if("function"==typeof(u=t.valueOf)&&!w(n=u.call(t)))return n;if(!e&&"function"==typeof(u=t.toString)&&!w(n=u.call(t)))return n;throw TypeError("Can't convert object to primitive value")}(e,!0),O(u),M)try{return j(t,e,u)}catch(t){}if("get"in u||"set"in u)throw TypeError("Accessors not supported!");return"value"in u&&(t[e]=u.value),t}},R=T?function(t,e,u){return V.f(t,e,{enumerable:!(1&(n=1)),configurable:!(2&n),writable:!(4&n),value:u});var n}:function(t,e,u){return t[e]=u,t},L=f(function(t){var e=F("src"),n="toString",r=Function[n],i=(""+r).split(n);P.inspectSource=function(t){return r.call(t)},(t.exports=function(t,n,r,s){var a="function"==typeof r;a&&(u(r,"name")||R(r,"name",n)),t[n]!==r&&(a&&(u(r,e)||R(r,e,t[n]?""+t[n]:i.join(String(n)))),t===_?t[n]=r:s?t[n]?t[n]=r:R(t,n,r):(delete t[n],R(t,n,r)))})(Function.prototype,n,function(){return"function"==typeof this&&this[e]||r.call(this)})}),H=function(t,e,u){if(function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!")}(t),void 0===e)return t;switch(u){case 1:return function(u){return t.call(e,u)};case 2:return function(u,n){return t.call(e,u,n)};case 3:return function(u,n,r){return t.call(e,u,n,r)}}return function(){return t.apply(e,arguments)}},N="prototype",U=function(t,e,u){var n,r,i,s,a=t&U.F,o=t&U.G,l=t&U.S,h=t&U.P,c=t&U.B,p=o?_:l?_[e]||(_[e]={}):(_[e]||{})[N],f=o?P:P[e]||(P[e]={}),d=f[N]||(f[N]={});o&&(u=e);for(n in u)i=((r=!a&&p&&void 0!==p[n])?p:u)[n],s=c&&r?H(i,_):h&&"function"==typeof i?H(Function.call,i):i,p&&L(p,n,i,t&U.U),f[n]!=i&&R(f,n,s),h&&d[n]!=i&&(d[n]=i)};_.core=P,U.F=1,U.G=2,U.S=4,U.P=8,U.B=16,U.W=32,U.U=64,U.R=128;var Y,z,G,Z,W=U;Y="keys",z=function(){return function(e){return b(Object(t(e)))}},G=(P.Object||{})[Y]||Object[Y],(Z={})[Y]=z(G),W(W.S+W.F*x(function(){G(1)}),"Object",Z);P.Object.keys;var $=function(e){var u=String(t(this)),n="",r=o(e);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;r>0;(r>>>=1)&&(u+=u))1&r&&(n+=u);return n};W(W.P,"String",{repeat:$});P.String.repeat;var X=function(e,u,n,r){var i=String(t(e)),s=i.length,a=void 0===n?" ":String(n),o=h(u);if(o<=s||""==a)return i;var l=o-s,c=$.call(a,Math.ceil(l/a.length));return c.length>l&&(c=c.slice(0,l)),r?c+i:i+c},q=_.navigator,J=q&&q.userAgent||"";W(W.P+W.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(J),"String",{padStart:function(t){return X(this,t,arguments.length>1?arguments[1]:void 0,!0)}});P.String.padStart;W(W.P+W.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(J),"String",{padEnd:function(t){return X(this,t,arguments.length>1?arguments[1]:void 0,!1)}});P.String.padEnd;var K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},tt=function(){function t(t,e){for(var u=0;u<e.length;u++){var n=e[u];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,u,n){return u&&t(e.prototype,u),n&&t(e,n),e}}(),et=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var u=arguments[e];for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(t[n]=u[n])}return t},ut=function t(e,u,n){null===e&&(e=Function.prototype);var r=Object.getOwnPropertyDescriptor(e,u);if(void 0===r){var i=Object.getPrototypeOf(e);return null===i?void 0:t(i,u,n)}if("value"in r)return r.value;var s=r.get;return void 0!==s?s.call(n):void 0},nt=function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)},rt=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e},it=function t(e,u,n,r){var i=Object.getOwnPropertyDescriptor(e,u);if(void 0===i){var s=Object.getPrototypeOf(e);null!==s&&t(s,u,n,r)}else if("value"in i&&i.writable)i.value=n;else{var a=i.set;void 0!==a&&a.call(r,n)}return n},st=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var u=[],n=!0,r=!1,i=void 0;try{for(var s,a=t[Symbol.iterator]();!(n=(s=a.next()).done)&&(u.push(s.value),!e||u.length!==e);n=!0);}catch(t){r=!0,i=t}finally{try{!n&&a.return&&a.return()}finally{if(r)throw i}}return u}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),at=function(t){if(Array.isArray(t)){for(var e=0,u=Array(t.length);e<t.length;e++)u[e]=t[e];return u}return Array.from(t)};function ot(t){return"string"==typeof t||t instanceof String}function lt(t,e){var u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return ot(t)?t:t?e:u}var ht={NONE:0,LEFT:-1,RIGHT:1};function ct(t,e){return e===ht.LEFT&&--t,t}function pt(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}var ft="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{},dt=function(){function t(e,u,n,r){for(Q(this,t),this.value=e,this.cursorPos=u,this.oldValue=n,this.oldSelection=r;this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}return tt(t,[{key:"startChangePos",get:function(){return Math.min(this.cursorPos,this.oldSelection.start)}},{key:"insertedCount",get:function(){return this.cursorPos-this.startChangePos}},{key:"inserted",get:function(){return this.value.substr(this.startChangePos,this.insertedCount)}},{key:"removedCount",get:function(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}},{key:"removed",get:function(){return this.oldValue.substr(this.startChangePos,this.removedCount)}},{key:"head",get:function(){return this.value.substring(0,this.startChangePos)}},{key:"tail",get:function(){return this.value.substring(this.startChangePos+this.insertedCount)}},{key:"removeDirection",get:function(){return!this.removedCount||this.insertedCount?ht.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?ht.RIGHT:ht.LEFT}}]),t}(),vt=function(){function t(e){Q(this,t),et(this,{inserted:"",overflow:!1,shift:0},e)}return tt(t,[{key:"aggregate",value:function(t){return this.inserted+=t.inserted,this.shift+=t.shift,this.overflow=this.overflow||t.overflow,t.rawInserted&&(this.rawInserted+=t.rawInserted),this}},{key:"offset",get:function(){return this.shift+this.inserted.length}},{key:"rawInserted",get:function(){return null!=this._rawInserted?this._rawInserted:this.inserted},set:function(t){this._rawInserted=t}}]),t}(),gt=function(){function t(e){Q(this,t),this._value="",this._update(et({},t.DEFAULTS,e)),this.isInitialized=!0}return tt(t,[{key:"updateOptions",value:function(t){this.withValueRefresh(this._update.bind(this,t))}},{key:"_update",value:function(t){et(this,t)}},{key:"clone",value:function(){var e=new t(this);return e._value=this.value.slice(),e}},{key:"assign",value:function(t){return et(this,t)}},{key:"reset",value:function(){this._value=""}},{key:"resolve",value:function(t){return this.reset(),this._append(t,{input:!0}),this._appendTail(),this.doCommit(),this.value}},{key:"nearestInputPos",value:function(t,e){return t}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e)}},{key:"_extractTail",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return{value:this.extractInput(t,e),fromPos:t,toPos:e}}},{key:"_appendTail",value:function(t){return this._append(t?t.value:"",{tail:!0})}},{key:"_append",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=this.value.length,n=this.clone(),r=!1;t=this.doPrepare(t,e);for(var i=0;i<t.length;++i){if(this._value+=t[i],!1===this.doValidate(e)&&(this.assign(n),!e.input)){r=!0;break}n=this.clone()}return new vt({inserted:this.value.slice(u),overflow:r})}},{key:"appendWithTail",value:function(t,e){for(var u=new vt,n=this.clone(),r=void 0,i=0;i<t.length;++i){var s=t[i],a=this._append(s,{input:!0});if(r=this.clone(),!(!a.overflow&&!this._appendTail(e).overflow)||!1===this.doValidate({tail:!0})){this.assign(n);break}this.assign(r),n=this.clone(),u.aggregate(a)}return u.shift+=this._appendTail(e).shift,u}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length-t;return this._value=this.value.slice(0,t)+this.value.slice(t+e),new vt}},{key:"withValueRefresh",value:function(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;var e=this.unmaskedValue,u=t();return this.unmaskedValue=e,delete this._refreshing,u}},{key:"doPrepare",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare(t,this,e)}},{key:"doValidate",value:function(t){return this.validate(this.value,this,t)}},{key:"doCommit",value:function(){this.commit(this.value,this)}},{key:"splice",value:function(t,e,u,n){var r=t+e,i=this._extractTail(r),s=this.nearestInputPos(t,n);return new vt({shift:s-t}).aggregate(this.remove(s)).aggregate(this.appendWithTail(u,i))}},{key:"value",get:function(){return this._value},set:function(t){this.resolve(t)}},{key:"unmaskedValue",get:function(){return this.value},set:function(t){this.reset(),this._append(t),this._appendTail(),this.doCommit()}},{key:"rawInputValue",get:function(){return this.extractInput(0,this.value.length,{raw:!0})},set:function(t){this.reset(),this._append(t,{raw:!0}),this._appendTail(),this.doCommit()}},{key:"isComplete",get:function(){return!0}}]),t}();function _t(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?ft.IMask.MaskedRegExp:ot(t)?ft.IMask.MaskedPattern:t instanceof Date||t===Date?ft.IMask.MaskedDate:t instanceof Number||"number"==typeof t||t===Number?ft.IMask.MaskedNumber:Array.isArray(t)||t===Array?ft.IMask.MaskedDynamic:t.prototype instanceof ft.IMask.Masked?t:t instanceof Function?ft.IMask.MaskedFunction:(console.warn("Mask not found for mask",t),ft.IMask.Masked)}function yt(t){var e=(t=et({},t)).mask;return e instanceof ft.IMask.Masked?e:new(_t(e))(t)}gt.DEFAULTS={prepare:function(t){return t},validate:function(){return!0},commit:function(){}};var kt=function(){function t(e){Q(this,t),et(this,e),this.mask&&(this._masked=yt(e))}return tt(t,[{key:"reset",value:function(){this.isHollow=!1,this.isRawInput=!1,this._masked&&this._masked.reset()}},{key:"resolve",value:function(t){return!!this._masked&&this._masked.resolve(t)}},{key:"isInput",get:function(){return this.type===t.TYPES.INPUT}},{key:"isHiddenHollow",get:function(){return this.isHollow&&this.optional}}]),t}();kt.DEFAULTS={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]/,"*":/./},kt.TYPES={INPUT:"input",FIXED:"fixed"};var mt=function(){function t(e,u){var n=u.name,r=u.offset,i=u.mask,s=u.validate;Q(this,t),this.masked=e,this.name=n,this.offset=r,this.mask=i,this.validate=s||function(){return!0}}return tt(t,[{key:"doValidate",value:function(t){return this.validate(this.value,this,t)}},{key:"value",get:function(){return this.masked.value.slice(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}},{key:"unmaskedValue",get:function(){return this.masked.extractInput(this.masked.mapDefIndexToPos(this.offset),this.masked.mapDefIndexToPos(this.offset+this.mask.length))}}]),t}(),At=function(){function t(e){var u=st(e,2),n=u[0],r=u[1],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(r).length;Q(this,t),this._from=n,this._to=r,this._maxLength=i,this.validate=this.validate.bind(this),this._update()}return tt(t,[{key:"_update",value:function(){this._maxLength=Math.max(this._maxLength,String(this.to).length),this.mask="0".repeat(this._maxLength)}},{key:"validate",value:function(t){var e="",u="",n=t.match(/^(\D*)(\d*)(\D*)/)||[],r=st(n,3),i=r[1],s=r[2];return s&&(e="0".repeat(i.length)+s,u="9".repeat(i.length)+s),-1===t.search(/[^0]/)&&t.length<=this._matchFrom||(e=e.padEnd(this._maxLength,"0"),u=u.padEnd(this._maxLength,"9"),this.from<=Number(u)&&Number(e)<=this.to)}},{key:"to",get:function(){return this._to},set:function(t){this._to=t,this._update()}},{key:"from",get:function(){return this._from},set:function(t){this._from=t,this._update()}},{key:"maxLength",get:function(){return this._maxLength},set:function(t){this._maxLength=t,this._update()}},{key:"_matchFrom",get:function(){return this.maxLength-String(this.from).length}}]),t}();mt.Range=At,mt.Enum=function(t){return{mask:"*".repeat(t[0].length),validate:function(e,u,n){return t.some(function(t){return t.indexOf(u.unmaskedValue)>=0})}}};var Ft=function(){function t(e){Q(this,t),this.chunks=e}return tt(t,[{key:"value",get:function(){return this.chunks.map(function(t){return t.value}).join("")}},{key:"fromPos",get:function(){var t=this.chunks[0];return t&&t.stop}},{key:"toPos",get:function(){var t=this.chunks[this.chunks.length-1];return t&&t.stop}}]),t}(),Dt=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Q(this,e),t.definitions=et({},kt.DEFAULTS,t.definitions),rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,et({},e.DEFAULTS,t)))}return nt(e,gt),tt(e,[{key:"_update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=et({},this.definitions,t.definitions),ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_update",this).call(this,t),this._rebuildMask()}},{key:"_rebuildMask",value:function(){var t=this,u=this.definitions;this._charDefs=[],this._groupDefs=[];var n=this.mask;if(n&&u){var r=!1,i=!1,s=!1,a=function(a){if(t.groups){var l=n.slice(a),h=Object.keys(t.groups).filter(function(t){return 0===l.indexOf(t)});h.sort(function(t,e){return e.length-t.length});var c=h[0];if(c){var p=t.groups[c];t._groupDefs.push(new mt(t,{name:c,offset:t._charDefs.length,mask:p.mask,validate:p.validate})),n=n.replace(c,p.mask)}}var f=n[a],d=f in u?kt.TYPES.INPUT:kt.TYPES.FIXED,v=d===kt.TYPES.INPUT||r,g=d===kt.TYPES.INPUT&&i;if(f===e.STOP_CHAR)return s=!0,"continue";if("{"===f||"}"===f)return r=!r,"continue";if("["===f||"]"===f)return i=!i,"continue";if(f===e.ESCAPE_CHAR){if(!(f=n[++a]))return"break";d=kt.TYPES.FIXED}t._charDefs.push(new kt({char:f,type:d,optional:g,stopAlign:s,unmasking:v,mask:d===kt.TYPES.INPUT?u[f]:function(t){return t===f}})),s=!1,o=a};t:for(var o=0;o<n.length;++o){switch(a(o)){case"continue":continue;case"break":break t}}}}},{key:"doValidate",value:function(){for(var t,u=arguments.length,n=Array(u),r=0;r<u;r++)n[r]=arguments[r];return this._groupDefs.every(function(t){return t.doValidate.apply(t,at(n))})&&(t=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"doValidate",this)).call.apply(t,[this].concat(at(n)))}},{key:"clone",value:function(){var t=this,u=new e(this);return u._value=this.value,u._charDefs.forEach(function(e,u){return et(e,t._charDefs[u])}),u._groupDefs.forEach(function(e,u){return et(e,t._groupDefs[u])}),u}},{key:"reset",value:function(){ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"reset",this).call(this),this._charDefs.forEach(function(t){delete t.isHollow})}},{key:"hiddenHollowsBefore",value:function(t){return this._charDefs.slice(0,t).filter(function(t){return t.isHiddenHollow}).length}},{key:"mapDefIndexToPos",value:function(t){return t-this.hiddenHollowsBefore(t)}},{key:"mapPosToDefIndex",value:function(t){for(var e=t,u=0;u<this._charDefs.length;++u){var n=this._charDefs[u];if(u>=e)break;n.isHiddenHollow&&++e}return e}},{key:"_appendTail",value:function(t){var u=new vt;return t&&u.aggregate(t instanceof Ft?this._appendChunks(t.chunks,{tail:!0}):ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_appendTail",this).call(this,t)),u.aggregate(this._appendPlaceholder())}},{key:"_append",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},u=this.value.length,n="",r=!1;t=this.doPrepare(t,e);for(var i=0,s=this.mapPosToDefIndex(this.value.length);i<t.length;){var a=t[i],o=this._charDefs[s];if(null==o){r=!0;break}o.isHollow=!1;var l=void 0,h=void 0,c=lt(o.resolve(a),a);o.type===kt.TYPES.INPUT?(c&&(this._value+=c,this.doValidate()||(c="",this._value=this.value.slice(0,-1))),l=!!c,h=!c&&!o.optional,c?n+=c:(o.optional||e.input||this.lazy||(this._value+=this.placeholderChar,h=!1),h||(o.isHollow=!0))):(this._value+=o.char,l=c&&(o.unmasking||e.input||e.raw)&&!e.tail,o.isRawInput=l&&(e.raw||e.input),o.isRawInput&&(n+=o.char)),h||++s,(l||h)&&++i}return new vt({inserted:this.value.slice(u),rawInserted:n,overflow:r})}},{key:"_appendChunks",value:function(t){for(var e=new vt,u=arguments.length,n=Array(u>1?u-1:0),r=1;r<u;r++)n[r-1]=arguments[r];for(var i=0;i<t.length;++i){var s=t[i],a=s.stop,o=s.value,l=null!=a&&this._charDefs[a];if(l&&l.stopAlign&&e.aggregate(this._appendPlaceholder(a)),e.aggregate(this._append.apply(this,[o].concat(at(n)))).overflow)break}return e}},{key:"_extractTail",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new Ft(this._extractInputChunks(t,e))}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";for(var n=this.value,r="",i=this.mapPosToDefIndex(e),s=t,a=this.mapPosToDefIndex(t);s<e&&s<n.length&&a<i;++a){var o=n[s],l=this._charDefs[a];if(!l)break;l.isHiddenHollow||((l.isInput&&!l.isHollow||u.raw&&!l.isInput&&l.isRawInput)&&(r+=o),++s)}return r}},{key:"_extractInputChunks",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;if(e===u)return[];var n=this.mapPosToDefIndex(e),r=this.mapPosToDefIndex(u),i=this._charDefs.map(function(t,e){return[t,e]}).slice(n,r).filter(function(t){return st(t,1)[0].stopAlign}).map(function(t){return st(t,2)[1]}),s=[n].concat(at(i),[r]);return s.map(function(e,u){return{stop:i.indexOf(e)>=0?e:null,value:t.extractInput(t.mapDefIndexToPos(e),t.mapDefIndexToPos(s[++u]))}}).filter(function(t){var e=t.stop,u=t.value;return null!=e||u})}},{key:"_appendPlaceholder",value:function(t){for(var e=this.value.length,u=t||this._charDefs.length,n=this.mapPosToDefIndex(this.value.length);n<u;++n){var r=this._charDefs[n];r.isInput&&(r.isHollow=!0),this.lazy&&!t||(this._value+=r.isInput||null==r.char?r.optional?"":this.placeholderChar:r.char)}return new vt({inserted:this.value.slice(e)})}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length-t,n=this.mapPosToDefIndex(t),r=this.mapPosToDefIndex(t+u);return this._charDefs.slice(n,r).forEach(function(t){return t.reset()}),ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"remove",this).call(this,t,u)}},{key:"nearestInputPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ht.NONE,u=e||ht.RIGHT,n=this.mapPosToDefIndex(t),r=this._charDefs[n],i=n,s=void 0,a=void 0,o=void 0,l=void 0;if(e!==ht.RIGHT&&(r&&r.isInput||e===ht.NONE&&t===this.value.length)&&(s=n,r&&!r.isHollow&&(a=n)),null==a&&e==ht.LEFT||null==s)for(l=ct(i,u);0<=l&&l<this._charDefs.length;i+=u,l+=u){var h=this._charDefs[l];if(null==s&&h.isInput&&(s=i,e===ht.NONE))break;if(null==o&&h.isHollow&&!h.isHiddenHollow&&(o=i),h.isInput&&!h.isHollow){a=i;break}}if(e!==ht.LEFT||0!==i||!this.lazy||r&&r.isInput||(s=0),e===ht.LEFT||null==s){var c=!1;for(l=ct(i,u=-u);0<=l&&l<this._charDefs.length;i+=u,l+=u){var p=this._charDefs[l];if(p.isInput&&(s=i,p.isHollow&&!p.isHiddenHollow))break;if(i===n&&(c=!0),c&&null!=s)break}(c=c||l>=this._charDefs.length)&&null!=s&&(i=s)}else null==a&&(i=null!=o?o:s);return this.mapDefIndexToPos(i)}},{key:"group",value:function(t){return this.groupsByName(t)[0]}},{key:"groupsByName",value:function(t){return this._groupDefs.filter(function(e){return e.name===t})}},{key:"isComplete",get:function(){var t=this;return!this._charDefs.some(function(e,u){return e.isInput&&!e.optional&&(e.isHollow||!t.extractInput(u,u+1))})}},{key:"unmaskedValue",get:function(){for(var t=this.value,e="",u=0,n=0;u<t.length&&n<this._charDefs.length;++n){var r=t[u],i=this._charDefs[n];i.isHiddenHollow||(i.unmasking&&!i.isHollow&&(e+=r),++u)}return e},set:function(t){it(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"unmaskedValue",t,this)}}]),e}();Dt.DEFAULTS={lazy:!0,placeholderChar:"_"},Dt.STOP_CHAR="`",Dt.ESCAPE_CHAR="\\",Dt.Definition=kt,Dt.Group=mt;var Ct=function(t){function e(t){return Q(this,e),rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,et({},e.DEFAULTS,t)))}return nt(e,Dt),tt(e,[{key:"_update",value:function(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern,delete t.pattern);var u=t.groups;t.groups=et({},e.GET_DEFAULT_GROUPS()),t.min&&(t.groups.Y.from=t.min.getFullYear()),t.max&&(t.groups.Y.to=t.max.getFullYear()),et(t.groups,u),ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_update",this).call(this,t)}},{key:"doValidate",value:function(){for(var t,u=arguments.length,n=Array(u),r=0;r<u;r++)n[r]=arguments[r];var i=(t=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"doValidate",this)).call.apply(t,[this].concat(at(n))),s=this.date;return i&&(!this.isComplete||this.isDateExist(this.value)&&s&&(null==this.min||this.min<=s)&&(null==this.max||s<=this.max))}},{key:"isDateExist",value:function(t){return this.format(this.parse(t))===t}},{key:"date",get:function(){return this.isComplete?this.parse(this.value):null},set:function(t){this.value=this.format(t)}}]),e}();Ct.DEFAULTS={pattern:"d{.}`m{.}`Y",format:function(t){return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:function(t){var e=t.split("."),u=st(e,3),n=u[0],r=u[1],i=u[2];return new Date(i,r-1,n)}},Ct.GET_DEFAULT_GROUPS=function(){return{d:new mt.Range([1,31]),m:new mt.Range([1,12]),Y:new mt.Range([1900,9999])}};var Et=function(){function t(e,u){Q(this,t),this.el=e,this.masked=yt(u),this._listeners={},this._value="",this._unmaskedValue="",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.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}return tt(t,[{key:"_bindEvents",value:function(){this.el.addEventListener("keydown",this._saveSelection),this.el.addEventListener("input",this._onInput),this.el.addEventListener("drop",this._onDrop),this.el.addEventListener("click",this.alignCursorFriendly),this.el.addEventListener("change",this._onChange)}},{key:"_unbindEvents",value:function(){this.el.removeEventListener("keydown",this._saveSelection),this.el.removeEventListener("input",this._onInput),this.el.removeEventListener("drop",this._onDrop),this.el.removeEventListener("click",this.alignCursorFriendly),this.el.removeEventListener("change",this._onChange)}},{key:"_fireEvent",value:function(t){(this._listeners[t]||[]).forEach(function(t){return t()})}},{key:"_saveSelection",value:function(){this.value!==this.el.value&&console.warn("Uncontrolled input change, refresh mask manually!"),this._selection={start:this.selectionStart,end:this.cursorPos}}},{key:"updateValue",value:function(){this.masked.value=this.el.value}},{key:"updateControl",value:function(){var t=this.masked.unmaskedValue,e=this.masked.value,u=this.unmaskedValue!==t||this.value!==e;this._unmaskedValue=t,this._value=e,this.el.value!==e&&(this.el.value=e),u&&this._fireChangeEvents()}},{key:"updateOptions",value:function(t){(t=et({},t)).mask===Date&&this.masked instanceof Ct&&delete t.mask,function t(e,u){if(u===e)return!0;var n,r=Array.isArray(u),i=Array.isArray(e);if(r&&i){if(u.length!=e.length)return!1;for(n=0;n<u.length;n++)if(!t(u[n],e[n]))return!1;return!0}if(r!=i)return!1;if(u&&e&&"object"===(void 0===u?"undefined":K(u))&&"object"===(void 0===e?"undefined":K(e))){var s=Object.keys(u),a=u instanceof Date,o=e instanceof Date;if(a&&o)return u.getTime()==e.getTime();if(a!=o)return!1;var l=u instanceof RegExp,h=e instanceof RegExp;if(l&&h)return u.toString()==e.toString();if(l!=h)return!1;for(n=0;n<s.length;n++)if(!Object.prototype.hasOwnProperty.call(e,s[n]))return!1;for(n=0;n<s.length;n++)if(!t(u[s[n]],e[s[n]]))return!1;return!0}return!1}(this.masked,t)||(this.masked.updateOptions(t),this.updateControl())}},{key:"updateCursor",value:function(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}},{key:"_delayUpdateCursor",value:function(t){var e=this;this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(function(){e.el&&(e.cursorPos=e._changingCursorPos,e._abortUpdateCursor())},10)}},{key:"_fireChangeEvents",value:function(){this._fireEvent("accept"),this.masked.isComplete&&this._fireEvent("complete")}},{key:"_abortUpdateCursor",value:function(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}},{key:"alignCursor",value:function(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,ht.LEFT)}},{key:"alignCursorFriendly",value:function(){this.selectionStart===this.cursorPos&&this.alignCursor()}},{key:"on",value:function(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}},{key:"off",value:function(t,e){if(this._listeners[t]){if(e){var u=this._listeners[t].indexOf(e);return u>=0&&this._listeners[t].splice(u,1),this}delete this._listeners[t]}}},{key:"_onInput",value:function(){this._abortUpdateCursor();var t=new dt(this.el.value,this.cursorPos,this.value,this._selection),e=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,u=this.masked.nearestInputPos(t.startChangePos+e,t.removeDirection);this.updateControl(),this.updateCursor(u)}},{key:"_onChange",value:function(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl()}},{key:"_onDrop",value:function(t){t.preventDefault(),t.stopPropagation()}},{key:"destroy",value:function(){this._unbindEvents(),this._listeners.length=0,delete this.el}},{key:"mask",get:function(){return this.masked.mask},set:function(t){if(null!=t&&t!==this.masked.mask)if(this.masked.constructor!==_t(t)){var e=yt({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}else this.masked.mask=t}},{key:"value",get:function(){return this._value},set:function(t){this.masked.value=t,this.updateControl(),this.alignCursor()}},{key:"unmaskedValue",get:function(){return this._unmaskedValue},set:function(t){this.masked.unmaskedValue=t,this.updateControl(),this.alignCursor()}},{key:"selectionStart",get:function(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}},{key:"cursorPos",get:function(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd},set:function(t){this.el===document.activeElement&&(this.el.setSelectionRange(t,t),this._saveSelection())}}]),t}(),Bt=function(t){function e(t){return Q(this,e),rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,et({},e.DEFAULTS,t)))}return nt(e,gt),tt(e,[{key:"_update",value:function(t){ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_update",this).call(this,t),this._updateRegExps()}},{key:"_updateRegExps",value:function(){var t="",e="";this.allowNegative?(t+="([+|\\-]?|([+|\\-]?(0|([1-9]+\\d*))))",e+="[+|\\-]?"):t+="(0|([1-9]+\\d*))",e+="\\d*";var u=(this.scale?"("+this.radix+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp("^"+t+u),this._numberRegExp=new RegExp("^"+e+u),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(pt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(pt(this.thousandsSeparator),"g")}},{key:"_extractTail",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_extractTail",this).call(this,t,u);return et({},n,{value:this._removeThousandsSeparators(n.value)})}},{key:"_removeThousandsSeparators",value:function(t){return t.replace(this._thousandsSeparatorRegExp,"")}},{key:"_insertThousandsSeparators",value:function(t){var e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}},{key:"doPrepare",value:function(t){for(var u,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return(u=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"doPrepare",this)).call.apply(u,[this,this._removeThousandsSeparators(t.replace(this._mapToRadixRegExp,this.radix))].concat(at(r)))}},{key:"appendWithTail",value:function(){var t,u=this.value;this._value=this._removeThousandsSeparators(this.value);for(var n=this.value.length,r=arguments.length,i=Array(r),s=0;s<r;s++)i[s]=arguments[s];var a=(t=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"appendWithTail",this)).call.apply(t,[this].concat(at(i)));this._value=this._insertThousandsSeparators(this.value);for(var o=n+a.inserted.length,l=0;l<=o;++l)this.value[l]===this.thousandsSeparator&&((l<n||l===n&&u[l]===this.thousandsSeparator)&&++n,l<o&&++o);return a.rawInserted=a.inserted,a.inserted=this.value.slice(n,o),a.shift+=n-u.length,a}},{key:"nearestInputPos",value:function(t,e){if(!e)return t;var u=ct(t,e);return this.value[u]===this.thousandsSeparator&&(t+=e),t}},{key:"doValidate",value:function(t){var u=(t.input?this._numberRegExpInput:this._numberRegExp).test(this._removeThousandsSeparators(this.value));if(u){var n=this.number;u=u&&!isNaN(n)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return u&&ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"doValidate",this).call(this,t)}},{key:"doCommit",value:function(){var t=this.number,u=t;null!=this.min&&(u=Math.max(u,this.min)),null!=this.max&&(u=Math.min(u,this.max)),u!==t&&(this.unmaskedValue=String(u));var n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&(n=this._padFractionalZeros(n)),this._value=n,ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"doCommit",this).call(this)}},{key:"_normalizeZeros",value:function(t){var e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,function(t,e,u,n){return e+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))}},{key:"_padFractionalZeros",value:function(t){if(!t)return t;var e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}},{key:"unmaskedValue",get:function(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,".")},set:function(t){it(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"unmaskedValue",t.replace(".",this.radix),this)}},{key:"number",get:function(){return Number(this.unmaskedValue)},set:function(t){this.unmaskedValue=String(t)}},{key:"allowNegative",get:function(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}]),e}();Bt.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};var bt=function(t){function e(){return Q(this,e),rt(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return nt(e,gt),tt(e,[{key:"_update",value:function(t){t.validate=function(e){return e.search(t.mask)>=0},ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_update",this).call(this,t)}}]),e}(),Pt=function(t){function e(){return Q(this,e),rt(this,(e.__proto__||Object.getPrototypeOf(e)).apply(this,arguments))}return nt(e,gt),tt(e,[{key:"_update",value:function(t){t.validate=t.mask,ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_update",this).call(this,t)}}]),e}(),wt=function(t){function e(t){Q(this,e);var u=rt(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,et({},e.DEFAULTS,t)));return u.currentMask=null,u}return nt(e,gt),tt(e,[{key:"_update",value:function(t){ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_update",this).call(this,t),this.compiledMasks=Array.isArray(t.mask)?t.mask.map(function(t){return yt(t)}):[]}},{key:"_append",value:function(t){for(var e=arguments.length,u=Array(e>1?e-1:0),n=1;n<e;n++)u[n-1]=arguments[n];t=this.doPrepare.apply(this,[t].concat(at(u)));var r,i=this._applyDispatch.apply(this,[t].concat(at(u)));this.currentMask&&i.aggregate((r=this.currentMask)._append.apply(r,[t].concat(at(u))));return i}},{key:"_applyDispatch",value:function(t){for(var e=this.value.length,u=this.rawInputValue,n=this.currentMask,r=new vt,i=arguments.length,s=Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];return this.currentMask=this.doDispatch.apply(this,[t].concat(at(s))),this.currentMask&&this.currentMask!==n&&(this.currentMask.reset(),this.currentMask._append(u,{raw:!0}),r.shift=this.value.length-e),r}},{key:"doDispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.dispatch(t,this,e)}},{key:"clone",value:function(){var t=new e(this);t._value=this.value;var u=this.compiledMasks.indexOf(this.currentMask);return this.currentMask&&(t.currentMask=u>=0?t.compiledMasks[u].assign(this.currentMask):this.currentMask.clone()),t}},{key:"reset",value:function(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(function(t){return t.reset()})}},{key:"remove",value:function(){var t,e=new vt;this.currentMask&&e.aggregate((t=this.currentMask).remove.apply(t,arguments)).aggregate(this._applyDispatch(""));return e}},{key:"extractInput",value:function(){var t;return this.currentMask?(t=this.currentMask).extractInput.apply(t,arguments):""}},{key:"_extractTail",value:function(){for(var t,u,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.currentMask?(t=this.currentMask)._extractTail.apply(t,at(r)):(u=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_extractTail",this)).call.apply(u,[this].concat(at(r)))}},{key:"_appendTail",value:function(){for(var t,u,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.currentMask?(t=this.currentMask)._appendTail.apply(t,at(r)):(u=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"_appendTail",this)).call.apply(u,[this].concat(at(r)))}},{key:"doCommit",value:function(){this.currentMask&&this.currentMask.doCommit(),ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"doCommit",this).call(this)}},{key:"nearestInputPos",value:function(){for(var t,u,n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];return this.currentMask?(t=this.currentMask).nearestInputPos.apply(t,at(r)):(u=ut(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"nearestInputPos",this)).call.apply(u,[this].concat(at(r)))}},{key:"value",get:function(){return this.currentMask?this.currentMask.value:""},set:function(t){it(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"value",t,this)}},{key:"unmaskedValue",get:function(){return this.currentMask?this.currentMask.unmaskedValue:""},set:function(t){it(e.prototype.__proto__||Object.getPrototypeOf(e.prototype),"unmaskedValue",t,this)}},{key:"isComplete",get:function(){return!!this.currentMask&&this.currentMask.isComplete}}]),e}();function Ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Et(t,e)}return wt.DEFAULTS={dispatch:function(t,e,u){if(e.compiledMasks.length){var n=e.rawInputValue;e.compiledMasks.forEach(function(e){e.rawInputValue=n,e._append(t,u)});var r=e.compiledMasks.map(function(t,e){return{value:t.rawInputValue.length,index:e}});return r.sort(function(t,e){return e.value-t.value}),e.compiledMasks[r[0].index]}}},Ot.InputMask=Et,Ot.Masked=gt,Ot.MaskedPattern=Dt,Ot.MaskedNumber=Bt,Ot.MaskedDate=Ct,Ot.MaskedRegExp=bt,Ot.MaskedFunction=Pt,Ot.MaskedDynamic=wt,Ot.createMask=yt,ft.IMask=Ot,Ot});
//# sourceMappingURL=imask.min.js.map
{
"name": "imask",
"version": "2.2.0",
"version": "3.0.0",
"description": "vanilla javascript input mask",

@@ -10,4 +10,5 @@ "main": "dist/imask.js",

"babel-core": "^6.26.0",
"babel-eslint": "^8.0.2",
"babel-eslint": "^8.2.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-istanbul": "^4.1.5",
"babel-plugin-transform-object-assign": "^6.22.0",

@@ -20,5 +21,6 @@ "babel-plugin-transform-object-rest-spread": "^6.26.0",

"coveralls": "^3.0.0",
"eslint-plugin-flowtype": "^2.39.1",
"flow-bin": "^0.60.1",
"karma": "^1.7.0",
"documentation": "^5.3.5",
"eslint-plugin-flowtype": "^2.41.0",
"flow-bin": "^0.63.1",
"karma": "^2.0.0",
"karma-chai": "^0.1.0",

@@ -29,16 +31,14 @@ "karma-chrome-launcher": "^2.2.0",

"karma-phantomjs-launcher": "^1.0.4",
"karma-rollup-plugin": "^0.2.4",
"karma-rollup-preprocessor": "^5.0.2",
"karma-rollup-preprocessor": "^5.1.1",
"karma-sinon": "^1.0.5",
"mocha": "^4.0.1",
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"rollup": "^0.51.7",
"rollup-plugin-babel": "^3.0.2",
"rollup": "^0.54.1",
"rollup-plugin-babel": "^3.0.3",
"rollup-plugin-commonjs": "^8.2.6",
"rollup-plugin-eslint": "^4.0.0",
"rollup-plugin-node-resolve": "^3.0.0",
"rollup-plugin-node-resolve": "^3.0.2",
"rollup-plugin-uglify": "^2.0.1",
"rollup-watch": "^4.3.1",
"sinon": "^4.1.2",
"uglify-es": "^3.1.9"
"sinon": "^4.1.6",
"uglify-es": "^3.3.7"
},

@@ -59,3 +59,4 @@ "engines": {

"flow": "flow",
"prepublishOnly": "flow check && npm run test && npm run build",
"doc": "documentation build src/imask.js -f html -o docs",
"prepublishOnly": "flow check && npm run test && npm run build && npm run doc",
"coveralls": "npm run test && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js"

@@ -74,4 +75,3 @@ },

"files": [
"dist",
"src"
"dist"
],

@@ -78,0 +78,0 @@ "author": "Alexey Kryazhev",

@@ -21,6 +21,5 @@ # imaskjs

- optional input parts (greedy)
* [React](https://github.com/uNmAnNeR/imaskjs/tree/gh-pages/plugins/react)/[Angular](https://github.com/uNmAnNeR/imaskjs/tree/gh-pages/plugins/angular) plugins
* [React](https://github.com/uNmAnNeR/imaskjs/tree/gh-pages/plugins/react)/[Angular](https://github.com/uNmAnNeR/imaskjs/tree/gh-pages/plugins/angular)/[Vue](https://github.com/uNmAnNeR/imaskjs/tree/gh-pages/plugins/vue) plugins
## Further plans
* Vue plugins
* more unit tests

@@ -27,0 +26,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc