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.0.0 to 2.0.1

30

dist/imask.es.js

@@ -897,5 +897,5 @@ class ChangeDetails {

this._value += def.char;
resolved = chres && (def.unmasking || flags.input) && !flags.tail;
def.isRawInput = resolved && (flags.raw || def.unmasking && flags.input);
if (def.isRawInput) rawInserted += chres;
resolved = chres && (def.unmasking || flags.input || flags.raw) && !flags.tail;
def.isRawInput = resolved && (flags.raw || flags.input);
if (def.isRawInput) rawInserted += def.char;
}

@@ -986,6 +986,7 @@

nearestInputPos(cursorPos, direction = DIRECTION.LEFT) {
if (!direction) return cursorPos;
nearestInputPos(cursorPos, direction = DIRECTION.NONE) {
let dir = direction || DIRECTION.LEFT;
const initialDefIndex = this.mapPosToDefIndex(cursorPos);
const initialDef = this._charDefs[initialDefIndex];
let di = initialDefIndex;

@@ -996,3 +997,3 @@

// search forward
for (nextdi = indexInDirection(di, direction); 0 <= nextdi && nextdi < this._charDefs.length; di += direction, nextdi += direction) {
for (nextdi = indexInDirection(di, dir); 0 <= nextdi && nextdi < this._charDefs.length; di += dir, nextdi += dir) {
const nextDef = this._charDefs[nextdi];

@@ -1007,9 +1008,12 @@ if (firstInputIndex == null && nextDef.isInput) firstInputIndex = di;

if (direction === DIRECTION.LEFT || firstInputIndex == null) {
// search backwards
direction = -direction;
// if has aligned left not inside fixed and has come to the start - use start position
if (direction === DIRECTION.LEFT && di === 0 && (!initialDef || !initialDef.isInput)) firstInputIndex = 0;
if (direction === DIRECTION.NONE || firstInputIndex == null) {
// search backward
dir = -dir;
let overflow = false;
// find hollows only before initial pos
for (nextdi = indexInDirection(di, direction); 0 <= nextdi && nextdi < this._charDefs.length; di += direction, nextdi += direction) {
for (nextdi = indexInDirection(di, dir); 0 <= nextdi && nextdi < this._charDefs.length; di += dir, nextdi += dir) {
const nextDef = this._charDefs[nextdi];

@@ -1207,2 +1211,6 @@ if (nextDef.isInput) {

}
nearestInputPos(...args) {
return this.currentMask ? this.currentMask.nearestInputPos(...args) : super.nearestInputPos(...args);
}
}

@@ -1477,3 +1485,3 @@

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

@@ -1480,0 +1488,0 @@ this.updateControl();

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

function isString(t){return"string"==typeof t||t instanceof String}function conform(t,e,s=""){return isString(t)?t:t?e:s}function indexInDirection(t,e){return e===DIRECTION.LEFT&&--t,t}function escapeRegExp(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(t,e){if(e===t)return!0;var s,u=Array.isArray(e),i=Array.isArray(t);if(u&&i){if(e.length!=t.length)return!1;for(s=0;s<e.length;s++)if(!objectIncludes(e[s],t[s]))return!1;return!0}if(u!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){var a=Object.keys(e),n=e instanceof Date,r=t instanceof Date;if(n&&r)return e.getTime()==t.getTime();if(n!=r)return!1;var h=e instanceof RegExp,o=t instanceof RegExp;if(h&&o)return e.toString()==t.toString();if(h!=o)return!1;for(s=0;s<a.length;s++)if(!Object.prototype.hasOwnProperty.call(t,a[s]))return!1;for(s=0;s<a.length;s++)if(!objectIncludes(e[a[s]],t[a[s]]))return!1;return!0}return!1}function maskedClass(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?MaskedRegExp:isString(t)?IMask.MaskedPattern:t.prototype instanceof Masked?t:Array.isArray(t)||t===Array?IMask.MaskedDynamic:t instanceof Number||"number"==typeof t||t===Number?MaskedNumber:t instanceof Date||t===Date?IMask.MaskedDate:t instanceof Function?MaskedFunction:(console.warn("Mask not found for mask",t),Masked)}function createMask(t){const e=(t=Object.assign({},t)).mask;if(e instanceof Masked)return e;return new(maskedClass(e))(t)}function EnumGroup(t){return{mask:"*".repeat(t[0].length),validate:(e,s)=>t.some(t=>t.indexOf(s.unmaskedValue)>=0)}}function IMask$1(t,e={}){return new InputMask(t,e)}class ChangeDetails{constructor(t){Object.assign(this,{inserted:"",overflow:!1,removedCount:0,shift:0},t)}aggregate(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}get offset(){return this.shift+this.inserted.length-this.removedCount}get rawInserted(){return null!=this._rawInserted?this._rawInserted:this.inserted}set rawInserted(t){this._rawInserted=t}}var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(t[u]=s[u])}return t},slicedToArray=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var s=[],u=!0,i=!1,a=void 0;try{for(var n,r=t[Symbol.iterator]();!(u=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);u=!0);}catch(t){i=!0,a=t}finally{try{!u&&r.return&&r.return()}finally{if(i)throw a}}return s}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();class Masked{constructor(t){this._value="",this._update(_extends({},Masked.DEFAULTS,t)),this.isInitialized=!0}updateOptions(t){this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}clone(){const t=new Masked(this);return t._value=this.value.slice(),t}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t)}resolve(t){return this.reset(),this.appendWithTail(t),this.doCommit(),this.value}get unmaskedValue(){return this._unmask()}set unmaskedValue(t){this.reset(),this._append(t),this.appendWithTail(""),this.doCommit()}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(t){this.reset(),this._append(t,{raw:!0}),this.appendWithTail(""),this.doCommit()}get isComplete(){return!0}nearestInputPos(t){return t}extractInput(t=0,e=this.value.length){return this.value.slice(t,e)}extractTail(t=0,e=this.value.length){return this.extractInput(t,e)}_appendTail(t){return t?this._append(t,{tail:!0}):new ChangeDetails}_append(t,e={}){const s=this.value.length;let u=this.clone(),i=!1;t=this.doPrepare(t,e);for(let s=0;s<t.length;++s){if(this._value+=t[s],!1===this.doValidate(e)&&(Object.assign(this,u),!e.input)){i=!0;break}u=this.clone()}return new ChangeDetails({inserted:this.value.slice(s),overflow:i})}appendWithTail(t,e){const s=new ChangeDetails;let u,i=this.clone();for(let a=0;a<t.length;++a){const n=t[a],r=this._append(n,{input:!0});u=this.clone();if(!(!r.overflow&&!this._appendTail(e).overflow)||!1===this.doValidate({tail:!0})){Object.assign(this,i);break}i=this.clone(),Object.assign(this,u),s.aggregate(r)}return s.shift+=this._appendTail(e).shift,s}_unmask(){return this.value}remove(t=0,e=this.value.length-t){this._value=this.value.slice(0,t)+this.value.slice(t+e)}withValueRefresh(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;const e=this.unmaskedValue,s=t();return this.unmaskedValue=e,delete this._refreshing,s}doPrepare(t,e){return this.prepare(t,this,e)}doValidate(t){return this.validate(this.value,this,t)}doCommit(){this.commit(this.value,this)}splice(t,e,s,u){const i=t+e,a=this.extractTail(i),n=this.nearestInputPos(t,u);this.remove(n);const r=this.appendWithTail(s,a);return r.shift+=n-t,r}}Masked.DEFAULTS={prepare:t=>t,validate:()=>!0,commit:()=>{}};const DIRECTION={NONE:0,LEFT:-1,RIGHT:1};class MaskedRegExp extends Masked{_update(t){t.validate=(e=>e.search(t.mask)>=0),super._update(t)}}class MaskedFunction extends Masked{_update(t){t.validate=t.mask,super._update(t)}}class MaskedNumber extends Masked{constructor(t){t.postFormat=Object.assign({},MaskedNumber.DEFAULTS.postFormat,t.postFormat),super(_extends({},MaskedNumber.DEFAULTS,t))}_update(t){t.postFormat=Object.assign({},this.postFormat,t.postFormat),super._update(t),this._updateRegExps()}_updateRegExps(){let t="",e="";this.allowNegative?(t+="([+|\\-]?|([+|\\-]?(0|([1-9]+\\d*))))",e+="[+|\\-]?"):t+="(0|([1-9]+\\d*))",e+="\\d*";let s=(this.scale?"("+this.radix+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp("^"+t+s),this._numberRegExp=new RegExp("^"+e+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}extractTail(t=0,e=this.value.length){return this._removeThousandsSeparators(super.extractTail(t,e))}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepare(t,...e){return super.doPrepare(this._removeThousandsSeparators(t.replace(this._mapToRadixRegExp,this.radix)),...e)}appendWithTail(t,e){const s=this.value.length;this._value=this._removeThousandsSeparators(this.value);let u=this.value.length;const i=super.appendWithTail(t,e);this._value=this._insertThousandsSeparators(this.value);let a=u+i.inserted.length;for(let t=0;t<=a;++t)this.value[t]===this.thousandsSeparator&&(t<=u&&++u,++a);return i.rawInserted=i.inserted,i.inserted=this.value.slice(u,a),i.shift+=u-s,i}nearestInputPos(t,e=DIRECTION.LEFT){if(!e)return t;const s=indexInDirection(t,e);return this.value[s]===this.thousandsSeparator&&(t+=e),t}doValidate(t){let e=(t.input?this._numberRegExpInput:this._numberRegExp).test(this._removeThousandsSeparators(this.value));if(e){const t=this.number;e=e&&!isNaN(t)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return e&&super.doValidate(t)}doCommit(){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=String(e));let s=this.value;this.postFormat.normalizeZeros&&(s=this._normalizeZeros(s)),this.postFormat.padFractionalZeros&&(s=this._padFractionalZeros(s)),this._value=s,super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,s,u)=>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))}_padFractionalZeros(t){const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}get number(){let t=this._removeThousandsSeparators(this._normalizeZeros(this.unmaskedValue)).replace(this.radix,".");return Number(t)}set number(t){this.unmaskedValue=String(t).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,postFormat:{normalizeZeros:!0,padFractionalZeros:!1}};class PatternDefinition{constructor(t){Object.assign(this,t),this.mask&&(this._masked=createMask(t))}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(t){return!!this._masked&&this._masked.resolve(t)}}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(t,{name:e,offset:s,mask:u,validate:i}){this.masked=t,this.name=e,this.offset=s,this.mask=u,this.validate=i||(()=>!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(t){return this.validate(this.value,this,t)}}class RangeGroup{constructor([t,e],s=String(e).length){this._from=t,this._to=e,this._maxLength=s,this.validate=this.validate.bind(this),this._update()}get to(){return this._to}set to(t){this._to=t,this._update()}get from(){return this._from}set from(t){this._from=t,this._update()}get maxLength(){return this._maxLength}set maxLength(t){this._maxLength=t,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(t){let e="",s="";var u=t.match(/^(\D*)(\d*)(\D*)/),i=slicedToArray(u,3);const a=i[1],n=i[2];n&&(e="0".repeat(a.length)+n,s="9".repeat(a.length)+n);return-1===t.search(/[^0]/)&&t.length<=this._matchFrom||(e=e.padEnd(this._maxLength,"0"),s=s.padEnd(this._maxLength,"9"),this.from<=Number(s)&&Number(e)<=this.to)}}PatternGroup.Range=RangeGroup,PatternGroup.Enum=EnumGroup;class MaskedPattern extends Masked{constructor(t={}){t.placeholder=Object.assign({},MaskedPattern.DEFAULT_PLACEHOLDER,t.placeholder),t.definitions=Object.assign({},PatternDefinition.DEFAULTS,t.definitions),super(t)}_update(t){t.placeholder=Object.assign({},this.placeholder,t.placeholder),t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._updateMask()}_updateMask(){const t=this.definitions;this._charDefs=[],this._groupDefs=[];let e=this.mask;if(!e||!t)return;let s=!1,u=!1,i=!1;for(let a=0;a<e.length;++a){if(this.groups){const t=e.slice(a),s=Object.keys(this.groups).filter(e=>0===t.indexOf(e));s.sort((t,e)=>e.length-t.length);const u=s[0];if(u){const t=this.groups[u];this._groupDefs.push(new PatternGroup(this,{name:u,offset:this._charDefs.length,mask:t.mask,validate:t.validate})),e=e.replace(u,t.mask)}}let n=e[a],r=!s&&n in t?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(++a,!(n=e[a]))break;r=PatternDefinition.TYPES.FIXED}this._charDefs.push(new PatternDefinition({char:n,type:r,optional:o,stopAlign:i,unmasking:h,mask:r===PatternDefinition.TYPES.INPUT?t[n]:t=>t===n})),i=!1}else u=!u;else s=!s;else i=!0}}doValidate(...t){return this._groupDefs.every(e=>e.doValidate(...t))&&super.doValidate(...t)}clone(){const t=new MaskedPattern(this);return t._value=this.value,t._charDefs.forEach((t,e)=>Object.assign(t,this._charDefs[e])),t._groupDefs.forEach((t,e)=>Object.assign(t,this._groupDefs[e])),t}reset(){super.reset(),this._charDefs.forEach(t=>{delete t.isHollow})}get isComplete(){return!this._charDefs.some((t,e)=>t.isInput&&!t.optional&&(t.isHollow||!this.extractInput(e,e+1)))}hiddenHollowsBefore(t){return this._charDefs.slice(0,t).filter(t=>t.isHiddenHollow).length}mapDefIndexToPos(t){if(null!=t)return t-this.hiddenHollowsBefore(t)}mapPosToDefIndex(t){if(null==t)return;let e=t;for(let t=0;t<this._charDefs.length;++t){const s=this._charDefs[t];if(t>=e)break;s.isHiddenHollow&&++e}return e}_unmask(){const t=this.value;let e="";for(let s=0,u=0;s<t.length&&u<this._charDefs.length;++u){const i=t[s],a=this._charDefs[u];a.isHiddenHollow||(a.unmasking&&!a.isHollow&&(e+=i),++s)}return e}_appendTail(t){return(t?this._appendChunks(t,{tail:!0}):new ChangeDetails).aggregate(this._appendPlaceholder())}_append(t,e={}){const s=this.value.length;let u="",i=!1;t=this.doPrepare(t,e.input);for(let s=0,a=this.mapPosToDefIndex(this.value.length);s<t.length;){const n=t[s],r=this._charDefs[a];if(!r){i=!0;break}r.isHollow=!1;let h,o,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||e.input||(this._value+=this.placeholder.char,o=!1),o||(r.isHollow=!0))):(this._value+=r.char,h=l&&(r.unmasking||e.input)&&!e.tail,r.isRawInput=h&&(e.raw||r.unmasking&&e.input),r.isRawInput&&(u+=l)),o||++a,(h||o)&&++s}return new ChangeDetails({inserted:this.value.slice(s),rawInserted:u,overflow:i})}_appendChunks(t,...e){const s=new ChangeDetails;for(let i=0;i<t.length;++i){var u=slicedToArray(t[i],2);const a=u[0],n=u[1];if(null!=a&&s.aggregate(this._appendPlaceholder(a)),s.aggregate(this._append(n,...e)).overflow)break}return s}extractTail(t,e){return this.extractInputChunks(t,e)}extractInput(t=0,e=this.value.length,s={}){const u=this.value;let i="";const a=this.mapPosToDefIndex(e);for(let n=t,r=this.mapPosToDefIndex(t);n<e&&n<u.length&&r<a;++r){const t=u[n],e=this._charDefs[r];if(!e)break;e.isHiddenHollow||((e.isInput&&!e.isHollow||s.raw&&!e.isInput&&e.isRawInput)&&(i+=t),++n)}return i}extractInputChunks(t=0,e=this.value.length){const s=this.mapPosToDefIndex(t),u=this.mapPosToDefIndex(e),i=this._charDefs.map((t,e)=>[t,e]).slice(s,u).filter(([t])=>t.stopAlign).map(([,t])=>t),a=[s,...i,u];return a.map((t,e)=>[i.indexOf(t)>=0?t:null,this.extractInput(this.mapDefIndexToPos(t),this.mapDefIndexToPos(a[++e]))]).filter(([t,e])=>null!=t||e)}_appendPlaceholder(t){const e=this.value.length,s=t||this._charDefs.length;for(let e=this.mapPosToDefIndex(this.value.length);e<s;++e){const s=this._charDefs[e];s.isInput&&(s.isHollow=!0),this.placeholder.lazy&&!t||(this._value+=s.isInput?s.optional?"":this.placeholder.char:s.char)}return new ChangeDetails({inserted:this.value.slice(e)})}remove(t=0,e=this.value.length-t){const s=t+e;this._value=this.value.slice(0,t)+this.value.slice(s);const u=this.mapPosToDefIndex(t),i=this.mapPosToDefIndex(s);this._charDefs.slice(u,i).forEach(t=>t.reset())}nearestInputPos(t,e=DIRECTION.LEFT){if(!e)return t;const s=this.mapPosToDefIndex(t);let u,i,a,n,r=s;for(n=indexInDirection(r,e);0<=n&&n<this._charDefs.length;r+=e,n+=e){const t=this._charDefs[n];if(null==u&&t.isInput&&(u=r),null==a&&t.isHollow&&!t.isHiddenHollow&&(a=r),t.isInput&&!t.isHollow){i=r;break}}if(e===DIRECTION.LEFT||null==u){let t=!1;for(n=indexInDirection(r,e=-e);0<=n&&n<this._charDefs.length;r+=e,n+=e){const e=this._charDefs[n];if(e.isInput&&(u=r,e.isHollow&&!e.isHiddenHollow))break;if(r===s&&(t=!0),t&&null!=u)break}(t=t||n>=this._charDefs.length)&&null!=u&&(r=u)}else null==i&&(r=null!=a?a:u);return this.mapDefIndexToPos(r)}group(t){return this.groupsByName(t)[0]}groupsByName(t){return this._groupDefs.filter(e=>e.name===t)}}MaskedPattern.DEFAULT_PLACEHOLDER={lazy:!0,char:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.Definition=PatternDefinition,MaskedPattern.Group=PatternGroup;class MaskedDate extends MaskedPattern{constructor(t){super(_extends({},MaskedDate.DEFAULTS,t))}_update(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern,delete t.pattern);const e=t.groups;t.groups=Object.assign({},MaskedDate.GET_DEFAULT_GROUPS()),t.min&&(t.groups.Y.from=t.min.getFullYear()),t.max&&(t.groups.Y.to=t.max.getFullYear()),Object.assign(t.groups,e),super._update(t)}doValidate(...t){const e=super.doValidate(...t),s=this.date;return e&&(!this.isComplete||this.isDateExist(this.value)&&s&&(null==this.min||this.min<=s)&&(null==this.max||s<=this.max))}isDateExist(t){return this.format(this.parse(t))===t}get date(){return this.isComplete?this.parse(this.value):null}set date(t){this.value=this.format(t)}}MaskedDate.DEFAULTS={pattern:"d{.}`m{.}`Y",format:t=>{return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:t=>{var e=t.split("."),s=slicedToArray(e,3);const u=s[0],i=s[1],a=s[2];return new Date(a,i-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 MaskedDynamic extends Masked{constructor(t){super(_extends({},MaskedDynamic.DEFAULTS,t)),this.currentMask=null}_update(t){super._update(t),this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>createMask(t)):[]}_append(t,...e){const s=this.value.length,u=new ChangeDetails;t=this.doPrepare(t,...e);const i=this.rawInputValue;return this.currentMask=this.doDispatch(t,...e),this.currentMask&&(this.currentMask.rawInputValue=i,u.shift=this.value.length-s,u.aggregate(this.currentMask._append(t,...e))),u}appendWithTail(t,e){return this._append("").aggregate(super.appendWithTail(t,e))}doDispatch(t,e){return this.dispatch(t,this,e)}clone(){const t=new MaskedDynamic(this);return t._value=this.value,this.currentMask&&(t.currentMask=this.currentMask.clone()),t}reset(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(t){this.resolve(t)}get isComplete(){return!!this.currentMask&&this.currentMask.isComplete}_unmask(){return this.currentMask?this.currentMask._unmask():""}remove(...t){this.currentMask&&this.currentMask.remove(...t)}extractInput(...t){return this.currentMask?this.currentMask.extractInput(...t):""}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}}MaskedDynamic.DEFAULTS={dispatch:(t,e,s)=>{if(!e.compiledMasks.length)return;const u=e.rawInputValue;e.compiledMasks.forEach(e=>{e.rawInputValue=u,e._append(t,s)});const i=e.compiledMasks.map((t,e)=>({value:t.rawInputValue.length,index:e}));return i.sort((t,e)=>e.value-t.value),e.compiledMasks[i[0].index]}};class ActionDetails{constructor(t,e,s,u){for(this.value=t,this.cursorPos=e,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(){this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return this.removedCount&&!this.insertedCount&&(this.oldSelection.end===this.cursorPos?DIRECTION.RIGHT:DIRECTION.LEFT)}}class InputMask{constructor(t,e){this.el=t,this.masked=createMask(e),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(t){if(null==t||t===this.masked.mask)return;if(this.masked.constructor===maskedClass(t))return void(this.masked.mask=t);const e=createMask({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.masked.value=t,this.updateControl(),this.alignCursor()}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.masked.unmaskedValue=t,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(t){(this._listeners[t]||[]).forEach(t=>t())}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el===document.activeElement&&(this.el.setSelectionRange(t,t),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 t=this.masked.unmaskedValue,e=this.masked.value,s=this.unmaskedValue!==t||this.value!==e;this._unmaskedValue=t,this._value=e,this.el.value!==e&&(this.el.value=e),s&&this._fireChangeEvents()}updateOptions(t){(t=Object.assign({},t)).mask===Date&&this.masked instanceof MaskedDate&&delete t.mask,objectIncludes(this.masked,t)||(this.masked.updateOptions(t),this.updateControl())}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{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)}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return;if(!e)return void delete this._listeners[t];const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners.splice(s,1),this}_onInput(){this._abortUpdateCursor();const t=new ActionDetails(this.el.value,this.cursorPos,this.value,this._selection),e=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,s=this.masked.nearestInputPos(t.startChangePos+e,t.removeDirection);this.updateControl(),this.updateCursor(s)}_onChange(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl()}_onDrop(t){t.preventDefault(),t.stopPropagation()}destroy(){this.unbindEvents(),this._listeners.length=0}}IMask$1.InputMask=InputMask,IMask$1.Masked=Masked,IMask$1.MaskedPattern=MaskedPattern,IMask$1.MaskedNumber=MaskedNumber,IMask$1.MaskedDate=MaskedDate,IMask$1.MaskedRegExp=MaskedRegExp,IMask$1.MaskedFunction=MaskedFunction,IMask$1.MaskedDynamic=MaskedDynamic,window.IMask=IMask$1;export default IMask$1;
function isString(t){return"string"==typeof t||t instanceof String}function conform(t,e,s=""){return isString(t)?t:t?e:s}function indexInDirection(t,e){return e===DIRECTION.LEFT&&--t,t}function escapeRegExp(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(t,e){if(e===t)return!0;var s,u=Array.isArray(e),i=Array.isArray(t);if(u&&i){if(e.length!=t.length)return!1;for(s=0;s<e.length;s++)if(!objectIncludes(e[s],t[s]))return!1;return!0}if(u!=i)return!1;if(e&&t&&"object"==typeof e&&"object"==typeof t){var a=Object.keys(e),n=e instanceof Date,r=t instanceof Date;if(n&&r)return e.getTime()==t.getTime();if(n!=r)return!1;var h=e instanceof RegExp,o=t instanceof RegExp;if(h&&o)return e.toString()==t.toString();if(h!=o)return!1;for(s=0;s<a.length;s++)if(!Object.prototype.hasOwnProperty.call(t,a[s]))return!1;for(s=0;s<a.length;s++)if(!objectIncludes(e[a[s]],t[a[s]]))return!1;return!0}return!1}function maskedClass(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?MaskedRegExp:isString(t)?IMask.MaskedPattern:t.prototype instanceof Masked?t:Array.isArray(t)||t===Array?IMask.MaskedDynamic:t instanceof Number||"number"==typeof t||t===Number?MaskedNumber:t instanceof Date||t===Date?IMask.MaskedDate:t instanceof Function?MaskedFunction:(console.warn("Mask not found for mask",t),Masked)}function createMask(t){const e=(t=Object.assign({},t)).mask;if(e instanceof Masked)return e;return new(maskedClass(e))(t)}function EnumGroup(t){return{mask:"*".repeat(t[0].length),validate:(e,s)=>t.some(t=>t.indexOf(s.unmaskedValue)>=0)}}function IMask$1(t,e={}){return new InputMask(t,e)}class ChangeDetails{constructor(t){Object.assign(this,{inserted:"",overflow:!1,removedCount:0,shift:0},t)}aggregate(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}get offset(){return this.shift+this.inserted.length-this.removedCount}get rawInserted(){return null!=this._rawInserted?this._rawInserted:this.inserted}set rawInserted(t){this._rawInserted=t}}var _extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var s=arguments[e];for(var u in s)Object.prototype.hasOwnProperty.call(s,u)&&(t[u]=s[u])}return t},slicedToArray=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var s=[],u=!0,i=!1,a=void 0;try{for(var n,r=t[Symbol.iterator]();!(u=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);u=!0);}catch(t){i=!0,a=t}finally{try{!u&&r.return&&r.return()}finally{if(i)throw a}}return s}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();class Masked{constructor(t){this._value="",this._update(_extends({},Masked.DEFAULTS,t)),this.isInitialized=!0}updateOptions(t){this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}clone(){const t=new Masked(this);return t._value=this.value.slice(),t}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t)}resolve(t){return this.reset(),this.appendWithTail(t),this.doCommit(),this.value}get unmaskedValue(){return this._unmask()}set unmaskedValue(t){this.reset(),this._append(t),this.appendWithTail(""),this.doCommit()}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(t){this.reset(),this._append(t,{raw:!0}),this.appendWithTail(""),this.doCommit()}get isComplete(){return!0}nearestInputPos(t){return t}extractInput(t=0,e=this.value.length){return this.value.slice(t,e)}extractTail(t=0,e=this.value.length){return this.extractInput(t,e)}_appendTail(t){return t?this._append(t,{tail:!0}):new ChangeDetails}_append(t,e={}){const s=this.value.length;let u=this.clone(),i=!1;t=this.doPrepare(t,e);for(let s=0;s<t.length;++s){if(this._value+=t[s],!1===this.doValidate(e)&&(Object.assign(this,u),!e.input)){i=!0;break}u=this.clone()}return new ChangeDetails({inserted:this.value.slice(s),overflow:i})}appendWithTail(t,e){const s=new ChangeDetails;let u,i=this.clone();for(let a=0;a<t.length;++a){const n=t[a],r=this._append(n,{input:!0});u=this.clone();if(!(!r.overflow&&!this._appendTail(e).overflow)||!1===this.doValidate({tail:!0})){Object.assign(this,i);break}i=this.clone(),Object.assign(this,u),s.aggregate(r)}return s.shift+=this._appendTail(e).shift,s}_unmask(){return this.value}remove(t=0,e=this.value.length-t){this._value=this.value.slice(0,t)+this.value.slice(t+e)}withValueRefresh(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;const e=this.unmaskedValue,s=t();return this.unmaskedValue=e,delete this._refreshing,s}doPrepare(t,e){return this.prepare(t,this,e)}doValidate(t){return this.validate(this.value,this,t)}doCommit(){this.commit(this.value,this)}splice(t,e,s,u){const i=t+e,a=this.extractTail(i),n=this.nearestInputPos(t,u);this.remove(n);const r=this.appendWithTail(s,a);return r.shift+=n-t,r}}Masked.DEFAULTS={prepare:t=>t,validate:()=>!0,commit:()=>{}};const DIRECTION={NONE:0,LEFT:-1,RIGHT:1};class MaskedRegExp extends Masked{_update(t){t.validate=(e=>e.search(t.mask)>=0),super._update(t)}}class MaskedFunction extends Masked{_update(t){t.validate=t.mask,super._update(t)}}class MaskedNumber extends Masked{constructor(t){t.postFormat=Object.assign({},MaskedNumber.DEFAULTS.postFormat,t.postFormat),super(_extends({},MaskedNumber.DEFAULTS,t))}_update(t){t.postFormat=Object.assign({},this.postFormat,t.postFormat),super._update(t),this._updateRegExps()}_updateRegExps(){let t="",e="";this.allowNegative?(t+="([+|\\-]?|([+|\\-]?(0|([1-9]+\\d*))))",e+="[+|\\-]?"):t+="(0|([1-9]+\\d*))",e+="\\d*";let s=(this.scale?"("+this.radix+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp("^"+t+s),this._numberRegExp=new RegExp("^"+e+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}extractTail(t=0,e=this.value.length){return this._removeThousandsSeparators(super.extractTail(t,e))}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepare(t,...e){return super.doPrepare(this._removeThousandsSeparators(t.replace(this._mapToRadixRegExp,this.radix)),...e)}appendWithTail(t,e){const s=this.value.length;this._value=this._removeThousandsSeparators(this.value);let u=this.value.length;const i=super.appendWithTail(t,e);this._value=this._insertThousandsSeparators(this.value);let a=u+i.inserted.length;for(let t=0;t<=a;++t)this.value[t]===this.thousandsSeparator&&(t<=u&&++u,++a);return i.rawInserted=i.inserted,i.inserted=this.value.slice(u,a),i.shift+=u-s,i}nearestInputPos(t,e=DIRECTION.LEFT){if(!e)return t;const s=indexInDirection(t,e);return this.value[s]===this.thousandsSeparator&&(t+=e),t}doValidate(t){let e=(t.input?this._numberRegExpInput:this._numberRegExp).test(this._removeThousandsSeparators(this.value));if(e){const t=this.number;e=e&&!isNaN(t)&&(null==this.min||this.min>=0||this.min<=this.number)&&(null==this.max||this.max<=0||this.number<=this.max)}return e&&super.doValidate(t)}doCommit(){const t=this.number;let e=t;null!=this.min&&(e=Math.max(e,this.min)),null!=this.max&&(e=Math.min(e,this.max)),e!==t&&(this.unmaskedValue=String(e));let s=this.value;this.postFormat.normalizeZeros&&(s=this._normalizeZeros(s)),this.postFormat.padFractionalZeros&&(s=this._padFractionalZeros(s)),this._value=s,super.doCommit()}_normalizeZeros(t){const e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,(t,e,s,u)=>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))}_padFractionalZeros(t){const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}get number(){let t=this._removeThousandsSeparators(this._normalizeZeros(this.unmaskedValue)).replace(this.radix,".");return Number(t)}set number(t){this.unmaskedValue=String(t).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,postFormat:{normalizeZeros:!0,padFractionalZeros:!1}};class PatternDefinition{constructor(t){Object.assign(this,t),this.mask&&(this._masked=createMask(t))}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(t){return!!this._masked&&this._masked.resolve(t)}}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(t,{name:e,offset:s,mask:u,validate:i}){this.masked=t,this.name=e,this.offset=s,this.mask=u,this.validate=i||(()=>!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(t){return this.validate(this.value,this,t)}}class RangeGroup{constructor([t,e],s=String(e).length){this._from=t,this._to=e,this._maxLength=s,this.validate=this.validate.bind(this),this._update()}get to(){return this._to}set to(t){this._to=t,this._update()}get from(){return this._from}set from(t){this._from=t,this._update()}get maxLength(){return this._maxLength}set maxLength(t){this._maxLength=t,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(t){let e="",s="";var u=t.match(/^(\D*)(\d*)(\D*)/),i=slicedToArray(u,3);const a=i[1],n=i[2];n&&(e="0".repeat(a.length)+n,s="9".repeat(a.length)+n);return-1===t.search(/[^0]/)&&t.length<=this._matchFrom||(e=e.padEnd(this._maxLength,"0"),s=s.padEnd(this._maxLength,"9"),this.from<=Number(s)&&Number(e)<=this.to)}}PatternGroup.Range=RangeGroup,PatternGroup.Enum=EnumGroup;class MaskedPattern extends Masked{constructor(t={}){t.placeholder=Object.assign({},MaskedPattern.DEFAULT_PLACEHOLDER,t.placeholder),t.definitions=Object.assign({},PatternDefinition.DEFAULTS,t.definitions),super(t)}_update(t){t.placeholder=Object.assign({},this.placeholder,t.placeholder),t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._updateMask()}_updateMask(){const t=this.definitions;this._charDefs=[],this._groupDefs=[];let e=this.mask;if(!e||!t)return;let s=!1,u=!1,i=!1;for(let a=0;a<e.length;++a){if(this.groups){const t=e.slice(a),s=Object.keys(this.groups).filter(e=>0===t.indexOf(e));s.sort((t,e)=>e.length-t.length);const u=s[0];if(u){const t=this.groups[u];this._groupDefs.push(new PatternGroup(this,{name:u,offset:this._charDefs.length,mask:t.mask,validate:t.validate})),e=e.replace(u,t.mask)}}let n=e[a],r=!s&&n in t?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(++a,!(n=e[a]))break;r=PatternDefinition.TYPES.FIXED}this._charDefs.push(new PatternDefinition({char:n,type:r,optional:o,stopAlign:i,unmasking:h,mask:r===PatternDefinition.TYPES.INPUT?t[n]:t=>t===n})),i=!1}else u=!u;else s=!s;else i=!0}}doValidate(...t){return this._groupDefs.every(e=>e.doValidate(...t))&&super.doValidate(...t)}clone(){const t=new MaskedPattern(this);return t._value=this.value,t._charDefs.forEach((t,e)=>Object.assign(t,this._charDefs[e])),t._groupDefs.forEach((t,e)=>Object.assign(t,this._groupDefs[e])),t}reset(){super.reset(),this._charDefs.forEach(t=>{delete t.isHollow})}get isComplete(){return!this._charDefs.some((t,e)=>t.isInput&&!t.optional&&(t.isHollow||!this.extractInput(e,e+1)))}hiddenHollowsBefore(t){return this._charDefs.slice(0,t).filter(t=>t.isHiddenHollow).length}mapDefIndexToPos(t){if(null!=t)return t-this.hiddenHollowsBefore(t)}mapPosToDefIndex(t){if(null==t)return;let e=t;for(let t=0;t<this._charDefs.length;++t){const s=this._charDefs[t];if(t>=e)break;s.isHiddenHollow&&++e}return e}_unmask(){const t=this.value;let e="";for(let s=0,u=0;s<t.length&&u<this._charDefs.length;++u){const i=t[s],a=this._charDefs[u];a.isHiddenHollow||(a.unmasking&&!a.isHollow&&(e+=i),++s)}return e}_appendTail(t){return(t?this._appendChunks(t,{tail:!0}):new ChangeDetails).aggregate(this._appendPlaceholder())}_append(t,e={}){const s=this.value.length;let u="",i=!1;t=this.doPrepare(t,e.input);for(let s=0,a=this.mapPosToDefIndex(this.value.length);s<t.length;){const n=t[s],r=this._charDefs[a];if(!r){i=!0;break}r.isHollow=!1;let h,o,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||e.input||(this._value+=this.placeholder.char,o=!1),o||(r.isHollow=!0))):(this._value+=r.char,h=l&&(r.unmasking||e.input||e.raw)&&!e.tail,r.isRawInput=h&&(e.raw||e.input),r.isRawInput&&(u+=r.char)),o||++a,(h||o)&&++s}return new ChangeDetails({inserted:this.value.slice(s),rawInserted:u,overflow:i})}_appendChunks(t,...e){const s=new ChangeDetails;for(let i=0;i<t.length;++i){var u=slicedToArray(t[i],2);const a=u[0],n=u[1];if(null!=a&&s.aggregate(this._appendPlaceholder(a)),s.aggregate(this._append(n,...e)).overflow)break}return s}extractTail(t,e){return this.extractInputChunks(t,e)}extractInput(t=0,e=this.value.length,s={}){const u=this.value;let i="";const a=this.mapPosToDefIndex(e);for(let n=t,r=this.mapPosToDefIndex(t);n<e&&n<u.length&&r<a;++r){const t=u[n],e=this._charDefs[r];if(!e)break;e.isHiddenHollow||((e.isInput&&!e.isHollow||s.raw&&!e.isInput&&e.isRawInput)&&(i+=t),++n)}return i}extractInputChunks(t=0,e=this.value.length){const s=this.mapPosToDefIndex(t),u=this.mapPosToDefIndex(e),i=this._charDefs.map((t,e)=>[t,e]).slice(s,u).filter(([t])=>t.stopAlign).map(([,t])=>t),a=[s,...i,u];return a.map((t,e)=>[i.indexOf(t)>=0?t:null,this.extractInput(this.mapDefIndexToPos(t),this.mapDefIndexToPos(a[++e]))]).filter(([t,e])=>null!=t||e)}_appendPlaceholder(t){const e=this.value.length,s=t||this._charDefs.length;for(let e=this.mapPosToDefIndex(this.value.length);e<s;++e){const s=this._charDefs[e];s.isInput&&(s.isHollow=!0),this.placeholder.lazy&&!t||(this._value+=s.isInput?s.optional?"":this.placeholder.char:s.char)}return new ChangeDetails({inserted:this.value.slice(e)})}remove(t=0,e=this.value.length-t){const s=t+e;this._value=this.value.slice(0,t)+this.value.slice(s);const u=this.mapPosToDefIndex(t),i=this.mapPosToDefIndex(s);this._charDefs.slice(u,i).forEach(t=>t.reset())}nearestInputPos(t,e=DIRECTION.NONE){let s=e||DIRECTION.LEFT;const u=this.mapPosToDefIndex(t),i=this._charDefs[u];let a,n,r,h,o=u;for(h=indexInDirection(o,s);0<=h&&h<this._charDefs.length;o+=s,h+=s){const t=this._charDefs[h];if(null==a&&t.isInput&&(a=o),null==r&&t.isHollow&&!t.isHiddenHollow&&(r=o),t.isInput&&!t.isHollow){n=o;break}}if(e!==DIRECTION.LEFT||0!==o||i&&i.isInput||(a=0),e===DIRECTION.NONE||null==a){let t=!1;for(h=indexInDirection(o,s=-s);0<=h&&h<this._charDefs.length;o+=s,h+=s){const e=this._charDefs[h];if(e.isInput&&(a=o,e.isHollow&&!e.isHiddenHollow))break;if(o===u&&(t=!0),t&&null!=a)break}(t=t||h>=this._charDefs.length)&&null!=a&&(o=a)}else null==n&&(o=null!=r?r:a);return this.mapDefIndexToPos(o)}group(t){return this.groupsByName(t)[0]}groupsByName(t){return this._groupDefs.filter(e=>e.name===t)}}MaskedPattern.DEFAULT_PLACEHOLDER={lazy:!0,char:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.Definition=PatternDefinition,MaskedPattern.Group=PatternGroup;class MaskedDate extends MaskedPattern{constructor(t){super(_extends({},MaskedDate.DEFAULTS,t))}_update(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern,delete t.pattern);const e=t.groups;t.groups=Object.assign({},MaskedDate.GET_DEFAULT_GROUPS()),t.min&&(t.groups.Y.from=t.min.getFullYear()),t.max&&(t.groups.Y.to=t.max.getFullYear()),Object.assign(t.groups,e),super._update(t)}doValidate(...t){const e=super.doValidate(...t),s=this.date;return e&&(!this.isComplete||this.isDateExist(this.value)&&s&&(null==this.min||this.min<=s)&&(null==this.max||s<=this.max))}isDateExist(t){return this.format(this.parse(t))===t}get date(){return this.isComplete?this.parse(this.value):null}set date(t){this.value=this.format(t)}}MaskedDate.DEFAULTS={pattern:"d{.}`m{.}`Y",format:t=>{return[String(t.getDate()).padStart(2,"0"),String(t.getMonth()+1).padStart(2,"0"),t.getFullYear()].join(".")},parse:t=>{var e=t.split("."),s=slicedToArray(e,3);const u=s[0],i=s[1],a=s[2];return new Date(a,i-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 MaskedDynamic extends Masked{constructor(t){super(_extends({},MaskedDynamic.DEFAULTS,t)),this.currentMask=null}_update(t){super._update(t),this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>createMask(t)):[]}_append(t,...e){const s=this.value.length,u=new ChangeDetails;t=this.doPrepare(t,...e);const i=this.rawInputValue;return this.currentMask=this.doDispatch(t,...e),this.currentMask&&(this.currentMask.rawInputValue=i,u.shift=this.value.length-s,u.aggregate(this.currentMask._append(t,...e))),u}appendWithTail(t,e){return this._append("").aggregate(super.appendWithTail(t,e))}doDispatch(t,e){return this.dispatch(t,this,e)}clone(){const t=new MaskedDynamic(this);return t._value=this.value,this.currentMask&&(t.currentMask=this.currentMask.clone()),t}reset(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(t){this.resolve(t)}get isComplete(){return!!this.currentMask&&this.currentMask.isComplete}_unmask(){return this.currentMask?this.currentMask._unmask():""}remove(...t){this.currentMask&&this.currentMask.remove(...t)}extractInput(...t){return this.currentMask?this.currentMask.extractInput(...t):""}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(...t){return this.currentMask?this.currentMask.nearestInputPos(...t):super.nearestInputPos(...t)}}MaskedDynamic.DEFAULTS={dispatch:(t,e,s)=>{if(!e.compiledMasks.length)return;const u=e.rawInputValue;e.compiledMasks.forEach(e=>{e.rawInputValue=u,e._append(t,s)});const i=e.compiledMasks.map((t,e)=>({value:t.rawInputValue.length,index:e}));return i.sort((t,e)=>e.value-t.value),e.compiledMasks[i[0].index]}};class ActionDetails{constructor(t,e,s,u){for(this.value=t,this.cursorPos=e,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(){this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return this.removedCount&&!this.insertedCount&&(this.oldSelection.end===this.cursorPos?DIRECTION.RIGHT:DIRECTION.LEFT)}}class InputMask{constructor(t,e){this.el=t,this.masked=createMask(e),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(t){if(null==t||t===this.masked.mask)return;if(this.masked.constructor===maskedClass(t))return void(this.masked.mask=t);const e=createMask({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}get value(){return this._value}set value(t){this.masked.value=t,this.updateControl(),this.alignCursor()}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.masked.unmaskedValue=t,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(t){(this._listeners[t]||[]).forEach(t=>t())}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){this.el===document.activeElement&&(this.el.setSelectionRange(t,t),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 t=this.masked.unmaskedValue,e=this.masked.value,s=this.unmaskedValue!==t||this.value!==e;this._unmaskedValue=t,this._value=e,this.el.value!==e&&(this.el.value=e),s&&this._fireChangeEvents()}updateOptions(t){(t=Object.assign({},t)).mask===Date&&this.masked instanceof MaskedDate&&delete t.mask,objectIncludes(this.masked,t)||(this.masked.updateOptions(t),this.updateControl())}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{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)}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return;if(!e)return void delete this._listeners[t];const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners.splice(s,1),this}_onInput(){this._abortUpdateCursor();const t=new ActionDetails(this.el.value,this.cursorPos,this.value,this._selection),e=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,s=this.masked.nearestInputPos(t.startChangePos+e);this.updateControl(),this.updateCursor(s)}_onChange(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl()}_onDrop(t){t.preventDefault(),t.stopPropagation()}destroy(){this.unbindEvents(),this._listeners.length=0}}IMask$1.InputMask=InputMask,IMask$1.Masked=Masked,IMask$1.MaskedPattern=MaskedPattern,IMask$1.MaskedNumber=MaskedNumber,IMask$1.MaskedDate=MaskedDate,IMask$1.MaskedRegExp=MaskedRegExp,IMask$1.MaskedFunction=MaskedFunction,IMask$1.MaskedDynamic=MaskedDynamic,window.IMask=IMask$1;export default IMask$1;
//# 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===ut.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?rt:e(t)?IMask.MaskedPattern:t.prototype instanceof nt?t:Array.isArray(t)||t===Array?IMask.MaskedDynamic:t instanceof Number||"number"==typeof t||t===Number?ot:t instanceof Date||t===Date?IMask.MaskedDate:t instanceof Function?it:(console.warn("Mask not found for mask",t),nt)}function s(t){var e=(t=K({},t)).mask;if(e instanceof nt)return e;return new(o(e))(t)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new dt(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},F=Math.max,_=Math.min,D=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)}),C=D["__core-js_shared__"]||(D["__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 C[t]||(C[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?F(t+e,0):_(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),P=function(t){return w[t]||(w[t]=B(t))}("IE_PROTO"),T="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),b=Object.keys||function(t){return function(t,e){var n,u=d(t),r=0,i=[];for(n in u)n!=P&&p(u,n)&&i.push(n);for(;e.length>r;)p(u,n=e[r++])&&(~x(i,n)||i.push(n));return i}(t,T)},S=t(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),I=(S.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),M=function(t){if(!I(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=D.document,V=I(L)&&I(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(!I(t))return t;var n,u;if(e&&"function"==typeof(n=t.toString)&&!I(u=n.call(t)))return u;if("function"==typeof(n=t.valueOf)&&!I(u=n.call(t)))return u;if(!e&&"function"==typeof(n=t.toString)&&!I(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},Y=t(function(t){var e=B("src"),n=Function.toString,u=(""+n).split("toString");S.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===D?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)})}),z=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)}},W=function(t,e,n){var u,r,i,o,s=t&W.F,a=t&W.G,h=t&W.S,l=t&W.P,p=t&W.B,c=a?D:h?D[e]||(D[e]={}):(D[e]||{}).prototype,f=a?S:S[e]||(S[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?z(i,D):l&&"function"==typeof i?z(Function.call,i):i,c&&Y(c,u,i,t&W.U),f[u]!=i&&N(f,u,o),l&&d[u]!=i&&(d[u]=i)};D.core=S,W.F=1,W.G=2,W.S=4,W.P=8,W.B=16,W.W=32,W.U=64,W.R=128;var G=W;!function(t,e){var n=(S.Object||{})[t]||Object[t],u={};u[t]=e(n),G(G.S+G.F*O(function(){n(1)}),"Object",u)}("keys",function(){return function(t){return b(function(t){return Object(h(t))}(t))}});S.Object.keys;var Z=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};G(G.P,"String",{repeat:Z});S.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=Z.call(o,Math.ceil(a/o.length));return l.length>a&&(l=l.slice(0,a)),u?l+r:r+l};G(G.P,"String",{padStart:function(t){return $(this,t,arguments.length>1?arguments[1]:void 0,!0)}});S.String.padStart;G(G.P,"String",{padEnd:function(t){return $(this,t,arguments.length>1?arguments[1]:void 0,!1)}});S.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=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}(),nt=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.appendWithTail(t),this.doCommit(),this.value},t.prototype.nearestInputPos=function(t){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(t){return t?this._append(t,{tail:!0}):new et},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 et({inserted:this.value.slice(n),overflow:r})},t.prototype.appendWithTail=function(t,e){for(var n=new et,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}u=this.clone(),K(this,r),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,e){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.appendWithTail(""),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.appendWithTail(""),this.doCommit()}},{key:"isComplete",get:function(){return!0}}]),t}();nt.DEFAULTS={prepare:function(t){return t},validate:function(){return!0},commit:function(){}};var ut={NONE:0,LEFT:-1,RIGHT:1},rt=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}(nt),it=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}(nt),ot=function(t){function e(n){return q(this,e),n.postFormat=K({},e.DEFAULTS.postFormat,n.postFormat),tt(this,t.call(this,K({},e.DEFAULTS,n)))}return Q(e,t),e.prototype._update=function(e){e.postFormat=K({},this.postFormat,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(e,n){var u=this.value.length;this._value=this._removeThousandsSeparators(this.value);var r=this.value.length,i=t.prototype.appendWithTail.call(this,e,n);this._value=this._insertThousandsSeparators(this.value);for(var o=r+i.inserted.length,s=0;s<=o;++s)this.value[s]===this.thousandsSeparator&&(s<=r&&++r,++o);return i.rawInserted=i.inserted,i.inserted=this.value.slice(r,o),i.shift+=r-u,i},e.prototype.nearestInputPos=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut.LEFT;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.postFormat.normalizeZeros&&(u=this._normalizeZeros(u)),this.postFormat.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}(nt);ot.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,postFormat:{normalizeZeros:!0,padFractionalZeros:!1}};var st=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}();st.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]/,"*":/./},st.TYPES={INPUT:"input",FIXED:"fixed"};var at=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}(),ht=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}();at.Range=ht,at.Enum=function(t){return{mask:"*".repeat(t[0].length),validate:function(e,n){return t.some(function(t){return t.indexOf(n.unmaskedValue)>=0})}}};var lt=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return q(this,e),n.placeholder=K({},e.DEFAULT_PLACEHOLDER,n.placeholder),n.definitions=K({},st.DEFAULTS,n.definitions),tt(this,t.call(this,n))}return Q(e,t),e.prototype._update=function(e){e.placeholder=K({},this.placeholder,e.placeholder),e.definitions=K({},this.definitions,e.definitions),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 at(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?st.TYPES.INPUT:st.TYPES.FIXED,v=d===st.TYPES.INPUT||r,g=d===st.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=st.TYPES.FIXED}t._charDefs.push(new st({char:f,type:d,optional:g,stopAlign:o,unmasking:v,mask:d===st.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){if(null!=t)return t-this.hiddenHollowsBefore(t)},e.prototype.mapPosToDefIndex=function(t){if(null!=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(t){return(t?this._appendChunks(t,{tail:!0}):new et).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.input);for(var o=0,s=this.mapPosToDefIndex(this.value.length);o<t.length;){var a=t[o],h=this._charDefs[s];if(!h){i=!0;break}h.isHollow=!1;var l=void 0,p=void 0,c=n(h.resolve(a),a);h.type===st.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.placeholder.char,p=!1),p||(h.isHollow=!0))):(this._value+=h.char,l=c&&(h.unmasking||e.input)&&!e.tail,h.isRawInput=l&&(e.raw||h.unmasking&&e.input),h.isRawInput&&(r+=c)),p||++s,(l||p)&&++o}return new et({inserted:this.value.slice(u),rawInserted:r,overflow:i})},e.prototype._appendChunks=function(t){for(var e=new et,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(t,e){return this.extractInputChunks(t,e)},e.prototype.extractInput=function(){for(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]:{},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,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.placeholder.lazy&&!t||(this._value+=r.isInput?r.optional?"":this.placeholder.char:r.char)}return new et({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]:ut.LEFT;if(!e)return t;var n=this.mapPosToDefIndex(t),r=n,i=void 0,o=void 0,s=void 0,a=void 0;for(a=u(r,e);0<=a&&a<this._charDefs.length;r+=e,a+=e){var h=this._charDefs[a];if(null==i&&h.isInput&&(i=r),null==s&&h.isHollow&&!h.isHiddenHollow&&(s=r),h.isInput&&!h.isHollow){o=r;break}}if(e===ut.LEFT||null==i){var l=!1;for(a=u(r,e=-e);0<=a&&a<this._charDefs.length;r+=e,a+=e){var p=this._charDefs[a];if(p.isInput&&(i=r,p.isHollow&&!p.isHiddenHollow))break;if(r===n&&(l=!0),l&&null!=i)break}(l=l||a>=this._charDefs.length)&&null!=i&&(r=i)}else null==o&&(r=null!=s?s:i);return this.mapDefIndexToPos(r)},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}(nt);lt.DEFAULT_PLACEHOLDER={lazy:!0,char:"_"},lt.STOP_CHAR="`",lt.ESCAPE_CHAR="\\",lt.Definition=st,lt.Group=at;var pt=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}(lt);pt.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)}},pt.GET_DEFAULT_GROUPS=function(){return{d:new at.Range([1,31]),m:new at.Range([1,12]),Y:new at.Range([1900,9999])}};var ct=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 et,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.appendWithTail=function(e,n){return this._append("").aggregate(t.prototype.appendWithTail.call(this,e,n))},e.prototype.doDispatch=function(t,e){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)},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}(nt);ct.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]}}};var ft=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(){this.value.substring(this.startChangePos+this.insertedCount)}},{key:"removeDirection",get:function(){return this.removedCount&&!this.insertedCount&&(this.oldSelection.end===this.cursorPos?ut.RIGHT:ut.LEFT)}}]),t}(),dt=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 pt&&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.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)},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.splice(n,1),this}delete this._listeners[t]}},t.prototype._onInput=function(){this._abortUpdateCursor();var t=new ft(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,t.removeDirection);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},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}();return a.InputMask=dt,a.Masked=nt,a.MaskedPattern=lt,a.MaskedNumber=ot,a.MaskedDate=pt,a.MaskedRegExp=rt,a.MaskedFunction=it,a.MaskedDynamic=ct,window.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";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===ut.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?rt:e(t)?IMask.MaskedPattern:t.prototype instanceof nt?t:Array.isArray(t)||t===Array?IMask.MaskedDynamic:t instanceof Number||"number"==typeof t||t===Number?ot:t instanceof Date||t===Date?IMask.MaskedDate:t instanceof Function?it:(console.warn("Mask not found for mask",t),nt)}function s(t){var e=(t=K({},t)).mask;if(e instanceof nt)return e;return new(o(e))(t)}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new dt(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},F=Math.max,_=Math.min,D=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)}),C=D["__core-js_shared__"]||(D["__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 C[t]||(C[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?F(t+e,0):_(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),P=function(t){return w[t]||(w[t]=B(t))}("IE_PROTO"),T="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),b=Object.keys||function(t){return function(t,e){var n,u=d(t),r=0,i=[];for(n in u)n!=P&&p(u,n)&&i.push(n);for(;e.length>r;)p(u,n=e[r++])&&(~x(i,n)||i.push(n));return i}(t,T)},S=t(function(t){var e=t.exports={version:"2.4.0"};"number"==typeof __e&&(__e=e)}),I=(S.version,function(t){return"object"==typeof t?null!==t:"function"==typeof t}),M=function(t){if(!I(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=D.document,V=I(L)&&I(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(!I(t))return t;var n,u;if(e&&"function"==typeof(n=t.toString)&&!I(u=n.call(t)))return u;if("function"==typeof(n=t.valueOf)&&!I(u=n.call(t)))return u;if(!e&&"function"==typeof(n=t.toString)&&!I(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},Y=t(function(t){var e=B("src"),n=Function.toString,u=(""+n).split("toString");S.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===D?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)})}),z=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)}},W=function(t,e,n){var u,r,i,o,s=t&W.F,a=t&W.G,h=t&W.S,l=t&W.P,p=t&W.B,c=a?D:h?D[e]||(D[e]={}):(D[e]||{}).prototype,f=a?S:S[e]||(S[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?z(i,D):l&&"function"==typeof i?z(Function.call,i):i,c&&Y(c,u,i,t&W.U),f[u]!=i&&N(f,u,o),l&&d[u]!=i&&(d[u]=i)};D.core=S,W.F=1,W.G=2,W.S=4,W.P=8,W.B=16,W.W=32,W.U=64,W.R=128;var G=W;!function(t,e){var n=(S.Object||{})[t]||Object[t],u={};u[t]=e(n),G(G.S+G.F*O(function(){n(1)}),"Object",u)}("keys",function(){return function(t){return b(function(t){return Object(h(t))}(t))}});S.Object.keys;var Z=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};G(G.P,"String",{repeat:Z});S.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=Z.call(o,Math.ceil(a/o.length));return l.length>a&&(l=l.slice(0,a)),u?l+r:r+l};G(G.P,"String",{padStart:function(t){return $(this,t,arguments.length>1?arguments[1]:void 0,!0)}});S.String.padStart;G(G.P,"String",{padEnd:function(t){return $(this,t,arguments.length>1?arguments[1]:void 0,!1)}});S.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=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}(),nt=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.appendWithTail(t),this.doCommit(),this.value},t.prototype.nearestInputPos=function(t){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(t){return t?this._append(t,{tail:!0}):new et},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 et({inserted:this.value.slice(n),overflow:r})},t.prototype.appendWithTail=function(t,e){for(var n=new et,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}u=this.clone(),K(this,r),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,e){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.appendWithTail(""),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.appendWithTail(""),this.doCommit()}},{key:"isComplete",get:function(){return!0}}]),t}();nt.DEFAULTS={prepare:function(t){return t},validate:function(){return!0},commit:function(){}};var ut={NONE:0,LEFT:-1,RIGHT:1},rt=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}(nt),it=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}(nt),ot=function(t){function e(n){return q(this,e),n.postFormat=K({},e.DEFAULTS.postFormat,n.postFormat),tt(this,t.call(this,K({},e.DEFAULTS,n)))}return Q(e,t),e.prototype._update=function(e){e.postFormat=K({},this.postFormat,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(e,n){var u=this.value.length;this._value=this._removeThousandsSeparators(this.value);var r=this.value.length,i=t.prototype.appendWithTail.call(this,e,n);this._value=this._insertThousandsSeparators(this.value);for(var o=r+i.inserted.length,s=0;s<=o;++s)this.value[s]===this.thousandsSeparator&&(s<=r&&++r,++o);return i.rawInserted=i.inserted,i.inserted=this.value.slice(r,o),i.shift+=r-u,i},e.prototype.nearestInputPos=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ut.LEFT;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.postFormat.normalizeZeros&&(u=this._normalizeZeros(u)),this.postFormat.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}(nt);ot.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,postFormat:{normalizeZeros:!0,padFractionalZeros:!1}};var st=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}();st.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]/,"*":/./},st.TYPES={INPUT:"input",FIXED:"fixed"};var at=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}(),ht=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}();at.Range=ht,at.Enum=function(t){return{mask:"*".repeat(t[0].length),validate:function(e,n){return t.some(function(t){return t.indexOf(n.unmaskedValue)>=0})}}};var lt=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return q(this,e),n.placeholder=K({},e.DEFAULT_PLACEHOLDER,n.placeholder),n.definitions=K({},st.DEFAULTS,n.definitions),tt(this,t.call(this,n))}return Q(e,t),e.prototype._update=function(e){e.placeholder=K({},this.placeholder,e.placeholder),e.definitions=K({},this.definitions,e.definitions),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 at(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?st.TYPES.INPUT:st.TYPES.FIXED,v=d===st.TYPES.INPUT||r,g=d===st.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=st.TYPES.FIXED}t._charDefs.push(new st({char:f,type:d,optional:g,stopAlign:o,unmasking:v,mask:d===st.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){if(null!=t)return t-this.hiddenHollowsBefore(t)},e.prototype.mapPosToDefIndex=function(t){if(null!=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(t){return(t?this._appendChunks(t,{tail:!0}):new et).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.input);for(var o=0,s=this.mapPosToDefIndex(this.value.length);o<t.length;){var a=t[o],h=this._charDefs[s];if(!h){i=!0;break}h.isHollow=!1;var l=void 0,p=void 0,c=n(h.resolve(a),a);h.type===st.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.placeholder.char,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 et({inserted:this.value.slice(u),rawInserted:r,overflow:i})},e.prototype._appendChunks=function(t){for(var e=new et,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(t,e){return this.extractInputChunks(t,e)},e.prototype.extractInput=function(){for(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]:{},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,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.placeholder.lazy&&!t||(this._value+=r.isInput?r.optional?"":this.placeholder.char:r.char)}return new et({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]:ut.NONE,n=e||ut.LEFT,r=this.mapPosToDefIndex(t),i=this._charDefs[r],o=r,s=void 0,a=void 0,h=void 0,l=void 0;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!==ut.LEFT||0!==o||i&&i.isInput||(s=0),e===ut.NONE||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}(nt);lt.DEFAULT_PLACEHOLDER={lazy:!0,char:"_"},lt.STOP_CHAR="`",lt.ESCAPE_CHAR="\\",lt.Definition=st,lt.Group=at;var pt=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}(lt);pt.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)}},pt.GET_DEFAULT_GROUPS=function(){return{d:new at.Range([1,31]),m:new at.Range([1,12]),Y:new at.Range([1900,9999])}};var ct=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 et,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.appendWithTail=function(e,n){return this._append("").aggregate(t.prototype.appendWithTail.call(this,e,n))},e.prototype.doDispatch=function(t,e){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}(nt);ct.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]}}};var ft=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(){this.value.substring(this.startChangePos+this.insertedCount)}},{key:"removeDirection",get:function(){return this.removedCount&&!this.insertedCount&&(this.oldSelection.end===this.cursorPos?ut.RIGHT:ut.LEFT)}}]),t}(),dt=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 pt&&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.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)},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.splice(n,1),this}delete this._listeners[t]}},t.prototype._onInput=function(){this._abortUpdateCursor();var t=new ft(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},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}();return a.InputMask=dt,a.Masked=nt,a.MaskedPattern=lt,a.MaskedNumber=ot,a.MaskedDate=pt,a.MaskedRegExp=rt,a.MaskedFunction=it,a.MaskedDynamic=ct,window.IMask=a,a});
//# sourceMappingURL=imask.min.js.map
{
"name": "imask",
"version": "2.0.0",
"version": "2.0.1",
"description": "vanilla javascript input mask",

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

@@ -10,16 +10,16 @@ # imaskjs

## Features
* get and set raw and unmasked values easily
* get and set *raw* and *unmasked* values easily
* no external dependencies
* show placeholder always and only when necessary
* unmasked value can contain fixed parts
* optional input parts (greedy)
* RegExp mask
* Functional mask
* Number mask (integer and decimal)
* Date mask (various format support)
* Dynamic/on-the-fly mask
* **RegExp** mask
* **Functional** mask
* **Number** mask (integer and decimal)
* **Date** mask (various format support)
* **Dynamic/on-the-fly** mask
* **Pattern** mask
- show placeholder always and only when necessary
- unmasked value can contain fixed parts
- optional input parts (greedy)
Further plans:
* Angular/React/Vue plugin
## Further plans
* Angular/React/Vue plugins
* more unit tests

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

@@ -216,5 +216,3 @@ import {objectIncludes} from '../core/utils.js';

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

@@ -221,0 +219,0 @@ this.updateControl();

@@ -94,2 +94,8 @@ import ChangeDetails from '../core/change-details.js';

}
nearestInputPos(...args) {
return this.currentMask ?
this.currentMask.nearestInputPos(...args) :
super.nearestInputPos(...args);
}
}

@@ -96,0 +102,0 @@

@@ -211,5 +211,5 @@ import {conform, DIRECTION, indexInDirection} from '../core/utils.js';

this._value += def.char;
resolved = chres && (def.unmasking || flags.input) && !flags.tail;
def.isRawInput = resolved && (flags.raw || def.unmasking && flags.input);
if (def.isRawInput) rawInserted += chres;
resolved = chres && (def.unmasking || flags.input || flags.raw) && !flags.tail;
def.isRawInput = resolved && (flags.raw || flags.input);
if (def.isRawInput) rawInserted += def.char;
}

@@ -323,6 +323,7 @@

nearestInputPos (cursorPos, direction=DIRECTION.LEFT) {
if (!direction) return cursorPos;
nearestInputPos (cursorPos, direction=DIRECTION.NONE) {
let dir = direction || DIRECTION.LEFT;
const initialDefIndex = this.mapPosToDefIndex(cursorPos);
const initialDef = this._charDefs[initialDefIndex];
let di = initialDefIndex;

@@ -337,5 +338,5 @@

for (
nextdi = indexInDirection(di, direction);
nextdi = indexInDirection(di, dir);
0 <= nextdi && nextdi < this._charDefs.length;
di += direction, nextdi += direction
di += dir, nextdi += dir
) {

@@ -351,5 +352,9 @@ const nextDef = this._charDefs[nextdi];

if (direction === DIRECTION.LEFT || firstInputIndex == null) {
// search backwards
direction = -direction;
// if has aligned left not inside fixed and has come to the start - use start position
if (direction === DIRECTION.LEFT && di === 0 &&
(!initialDef || !initialDef.isInput)) firstInputIndex = 0;
if (direction === DIRECTION.NONE || firstInputIndex == null) {
// search backward
dir = -dir;
let overflow = false;

@@ -359,5 +364,5 @@

for (
nextdi = indexInDirection(di, direction);
nextdi = indexInDirection(di, dir);
0 <= nextdi && nextdi < this._charDefs.length;
di += direction, nextdi += direction
di += dir, nextdi += dir
) {

@@ -364,0 +369,0 @@ const nextDef = this._charDefs[nextdi];

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