Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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 5.1.6 to 5.1.7

2

dist/imask.es.min.js

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

function t(t){return"string"==typeof t||t instanceof String}const e={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function s(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}const u="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{};function i(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function a(t){for(var e=1;e<arguments.length;e++){var s=null!=arguments[e]?arguments[e]:{},u=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(u=u.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),u.forEach(function(e){i(t,e,s[e])})}return t}function n(t,e){if(null==t)return{};var s,u,i=function(t,e){if(null==t)return{};var s,u,i={},a=Object.keys(t);for(u=0;u<a.length;u++)s=a[u],e.indexOf(s)>=0||(i[s]=t[s]);return i}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(u=0;u<a.length;u++)s=a[u],e.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(t,s)&&(i[s]=t[s])}return i}class r{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(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?e.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?e.RIGHT:e.LEFT}}class h{constructor(t){Object.assign(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},t)}aggregate(t){return this.rawInserted+=t.rawInserted,this.skip=this.skip||t.skip,this.inserted+=t.inserted,this.tailShift+=t.tailShift,this}get offset(){return this.tailShift+this.inserted.length}}class o{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2?arguments[2]:void 0;this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0})}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}shiftBefore(t){if(this.from>=t||!this.value.length)return"";const e=this.value[0];return this.value=this.value.slice(1),e}}class l{constructor(t){this._value="",this._update(t),this.isInitialized=!0}updateOptions(t){Object.keys(t).length&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t)}resolve(t){return this.reset(),this.append(t,{input:!0},""),this.doCommit(),this.value}get unmaskedValue(){return this.value}set unmaskedValue(t){this.reset(),this.append(t,{},""),this.doCommit()}get typedValue(){return this.unmaskedValue}set typedValue(t){this.unmaskedValue=t}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(t){this.reset(),this.append(t,{raw:!0},""),this.doCommit()}get isComplete(){return!0}nearestInputPos(t,e){return t}extractInput(){let 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)}extractTail(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new o(this.extractInput(t,e),t)}_storeBeforeTailState(){this._beforeTailState=this.state}_restoreBeforeTailState(){this.state=this._beforeTailState}_resetBeforeTailState(){this._beforeTailState=null}appendTail(e){return t(e)&&(e=new o(String(e))),e.appendTo(this)}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(t=this.doPrepare(t,e))?(this._value+=t,new h({inserted:t,rawInserted:t})):new h}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0;const u=this.state,i=this._appendCharRaw(t,e);if(i.inserted){let t,a=!1!==this.doValidate(e);if(a&&null!=s){this._storeBeforeTailState(),this.overwrite&&(t=s.state,s.shiftBefore(this.value.length));const e=this.appendTail(s);(a=e.rawInserted===s.toString())&&e.inserted&&this._restoreBeforeTailState()}a||(i.rawInserted=i.inserted="",this.state=u,s&&t&&(s.state=t))}return i}append(e,s,u){if(!t(e))throw new Error("value should be string");const i=new h,a=t(u)?new o(String(u)):u;for(let t=0;t<e.length;++t)i.aggregate(this._appendChar(e[t],s,a));return null!=a&&(this._storeBeforeTailState(),i.tailShift+=this.appendTail(a).tailShift),i}remove(){let 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=this.value.slice(0,t)+this.value.slice(e),new h}withValueRefresh(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;const e=this.unmaskedValue,s=this.value,u=t();return this.resolve(s)!==s&&(this.unmaskedValue=e),delete this._refreshing,u}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare?this.prepare(t,this,e):t}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,u){const i=t+e,a=this.extractTail(i);let n=this.nearestInputPos(t,u);return new h({tailShift:n-t}).aggregate(this.remove(n)).aggregate(this.append(s,{input:!0},a))}}function c(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?u.IMask.MaskedRegExp:t(e)?u.IMask.MaskedPattern:e instanceof Date||e===Date?u.IMask.MaskedDate:e instanceof Number||"number"==typeof e||e===Number?u.IMask.MaskedNumber:Array.isArray(e)||e===Array?u.IMask.MaskedDynamic:e.prototype instanceof u.IMask.Masked?e:e instanceof Function?u.IMask.MaskedFunction:(console.warn("Mask not found for mask",e),u.IMask.Masked)}function d(t){const e=(t=a({},t)).mask;return e instanceof u.IMask.Masked?e:new(c(e))(t)}const p={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class g{constructor(t){const{mask:e}=t,s=n(t,["mask"]);this.masked=d({mask:e}),Object.assign(this,s)}reset(){this._isFilled=!1,this.masked.reset()}remove(){let 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 0===t&&e>=1?(this._isFilled=!1,this.masked.remove(t,e)):new h}get value(){return this.masked.value||(this._isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._isFilled)return new h;const s=this.masked.state,u=this.masked._appendChar(t,e);return u.inserted&&!1===this.doValidate(e)&&(u.inserted=u.rawInserted="",this.masked.state=s),u.inserted||this.isOptional||this.lazy||e.input||(u.inserted=this.placeholderChar),u.skip=!u.inserted&&!this.isOptional,this._isFilled=Boolean(u.inserted),u}append(){return this.masked.append(...arguments)}_appendPlaceholder(){const t=new h;return this._isFilled||this.isOptional?t:(this._isFilled=!0,t.inserted=this.placeholderChar,t)}extractTail(){return this.masked.extractTail(...arguments)}appendTail(){return this.masked.appendTail(...arguments)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2?arguments[2]:void 0;return this.masked.extractInput(t,e,s)}nearestInputPos(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE;const u=this.value.length,i=Math.min(Math.max(t,0),u);switch(s){case e.LEFT:case e.FORCE_LEFT:return this.isComplete?i:0;case e.RIGHT:case e.FORCE_RIGHT:return this.isComplete?i:u;case e.NONE:default:return i}}doValidate(){return this.masked.doValidate(...arguments)&&(!this.parent||this.parent.doValidate(...arguments))}doCommit(){this.masked.doCommit()}get state(){return{masked:this.masked.state,_isFilled:this._isFilled}}set state(t){this.masked.state=t.masked,this._isFilled=t._isFilled}}class _{constructor(t){Object.assign(this,t),this._value=""}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}reset(){this._isRawInput=!1,this._value=""}remove(){let 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=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new h}nearestInputPos(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE;const u=this._value.length;switch(s){case e.LEFT:case e.FORCE_LEFT:return 0;case e.NONE:case e.RIGHT:case e.FORCE_RIGHT:default:return u}}extractInput(){let 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(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}_appendChar(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=new h;if(this._value)return s;const u=this.char===t[0]&&(this.isUnmasking||e.input||e.raw)&&!e.tail;return u&&(s.rawInserted=this.char),this._value=s.inserted=this.char,this._isRawInput=u&&(e.raw||e.input),s}_appendPlaceholder(){const t=new h;return this._value?t:(this._value=t.inserted=this.char,t)}extractTail(){arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new o("")}appendTail(e){return t(e)&&(e=new o(String(e))),e.appendTo(this)}append(t,e,s){const u=this._appendChar(t,e);return null!=s&&(u.tailShift+=this.appendTail(s).tailShift),u}doCommit(){}get state(){return{_value:this._value,_isRawInput:this._isRawInput}}set state(t){Object.assign(this,t)}}class m{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;t(e)&&(e=new o(String(e)));const s=this.chunks[this.chunks.length-1],u=s&&(s.stop===e.stop||null==e.stop)&&e.from===s.from+s.toString().length;if(e instanceof o)u?s.extend(e.toString()):this.chunks.push(e);else if(e instanceof m){if(null==e.stop){let t;for(;e.chunks.length&&null==e.chunks[0].stop;)(t=e.chunks.shift()).from+=e.from,this.extend(t)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(t){if(!(t instanceof u.IMask.MaskedPattern)){return new o(this.toString()).appendTo(t)}const e=new h;for(let s=0;s<this.chunks.length&&!e.skip;++s){const u=this.chunks[s],i=t._mapPosToBlock(t.value.length),a=u.stop;let n;if(a&&(!i||i.index<=a)&&((u instanceof m||t._stops.indexOf(a)>=0)&&e.aggregate(t._appendPlaceholder(a)),n=u instanceof m&&t._blocks[a]),n){const s=n.appendTail(u);s.skip=!1,e.aggregate(s),t._value+=s.inserted;const i=u.toString().slice(s.rawInserted.length);i&&e.aggregate(t.append(i,{tail:!0}))}else e.aggregate(t.append(u.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:e}=t,s=n(t,["chunks"]);Object.assign(this,s),this.chunks=e.map(t=>{const e="chunks"in t?new m:new o;return e.state=t,e})}shiftBefore(t){if(this.from>=t||!this.chunks.length)return"";const e=t-this.from;let s=0;for(;s<this.chunks.length;){const t=this.chunks[s],u=t.shiftBefore(e);if(t.toString()){if(!u)break;++s}else this.chunks.splice(s,1);if(u)return u}return""}}class k extends l{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},p,t.definitions),super(a({},k.DEFAULTS,t))}_update(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this._stops=[],this._maskedBlocks={};let e=this.mask;if(!e||!t)return;let s=!1,u=!1;for(let i=0;i<e.length;++i){if(this.blocks){const t=e.slice(i),s=Object.keys(this.blocks).filter(e=>0===t.indexOf(e));s.sort((t,e)=>e.length-t.length);const u=s[0];if(u){const t=d(a({parent:this,lazy:this.lazy,placeholderChar:this.placeholderChar},this.blocks[u]));t&&(this._blocks.push(t),this._maskedBlocks[u]||(this._maskedBlocks[u]=[]),this._maskedBlocks[u].push(this._blocks.length-1)),i+=u.length-1;continue}}let n=e[i],r=n in t;if(n===k.STOP_CHAR){this._stops.push(this._blocks.length);continue}if("{"===n||"}"===n){s=!s;continue}if("["===n||"]"===n){u=!u;continue}if(n===k.ESCAPE_CHAR){if(!(n=e[++i]))break;r=!1}const h=r?new g({parent:this,lazy:this.lazy,placeholderChar:this.placeholderChar,mask:t[n],isOptional:u}):new _({char:n,isUnmasking:s});this._blocks.push(h)}}get state(){return a({},super.state,{_blocks:this._blocks.map(t=>t.state)})}set state(t){const{_blocks:e}=t,s=n(t,["_blocks"]);this._blocks.forEach((t,s)=>t.state=e[s]),super.state=s}_storeBeforeTailState(){this._blocks.forEach(t=>{"function"==typeof t._storeBeforeTailState&&t._storeBeforeTailState()}),super._storeBeforeTailState()}_restoreBeforeTailState(){this._blocks.forEach(t=>{"function"==typeof t._restoreBeforeTailState&&t._restoreBeforeTailState()}),super._restoreBeforeTailState()}_resetBeforeTailState(){this._blocks.forEach(t=>{"function"==typeof t._resetBeforeTailState&&t._resetBeforeTailState()}),super._resetBeforeTailState()}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this._blocks.every(t=>t.isComplete)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this._blocks.reduce((t,e)=>t+=e.unmaskedValue,"")}set unmaskedValue(t){super.unmaskedValue=t}get value(){return this._blocks.reduce((t,e)=>t+=e.value,"")}set value(t){super.value=t}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=this.doPrepare(t,e);const s=this._mapPosToBlock(this.value.length),u=new h;if(!s)return u;for(let i=s.index;;++i){const s=this._blocks[i];if(!s)break;const a=s._appendChar(t,e),n=a.skip;if(u.aggregate(a),n||a.rawInserted)break}return u}extractTail(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const s=new m;return t===e?s:(this._forEachBlocksInRange(t,e,(t,e,u,i)=>{const a=t.extractTail(u,i);a.stop=this._findStopBefore(e),a.from=this._blockStartPos(e),a instanceof m&&(a.blockIndex=e),s.extend(a)}),s)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";let u="";return this._forEachBlocksInRange(t,e,(t,e,i,a)=>{u+=t.extractInput(i,a,s)}),u}_findStopBefore(t){let e;for(let s=0;s<this._stops.length;++s){const u=this._stops[s];if(!(u<=t))break;e=u}return e}_appendPlaceholder(t){const e=new h;if(this.lazy&&null==t)return e;const s=this._mapPosToBlock(this.value.length);if(!s)return e;const u=s.index,i=null!=t?t:this._blocks.length;return this._blocks.slice(u,i).forEach(s=>{if("function"==typeof s._appendPlaceholder&&(!s.lazy||null!=t)){const t=null!=s._blocks?[s._blocks.length]:[],u=s._appendPlaceholder.apply(s,t);this._value+=u.inserted,e.aggregate(u)}}),e}_mapPosToBlock(t){let e="";for(let s=0;s<this._blocks.length;++s){const u=this._blocks[s],i=e.length;if(t<=(e+=u.value).length)return{index:s,offset:t-i}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+=e.value.length,0)}_forEachBlocksInRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2?arguments[2]:void 0;const u=this._mapPosToBlock(t);if(u){const t=this._mapPosToBlock(e),i=t&&u.index===t.index,a=u.offset,n=t&&i?t.offset:this._blocks[u.index].value.length;if(s(this._blocks[u.index],u.index,a,n),t&&!i){for(let e=u.index+1;e<t.index;++e)s(this._blocks[e],e,0,this._blocks[e].value.length);s(this._blocks[t.index],t.index,0,t.offset)}}}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;const s=super.remove(t,e);return this._forEachBlocksInRange(t,e,(t,e,u,i)=>{s.aggregate(t.remove(u,i))}),s}nearestInputPos(t){let s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE;const u=this._mapPosToBlock(t)||{index:0,offset:0},{offset:i,index:a}=u,n=this._blocks[a];if(!n)return t;let r=i;0!==r&&r<n.value.length&&(r=n.nearestInputPos(i,function(t){switch(t){case e.LEFT:return e.FORCE_LEFT;case e.RIGHT:return e.FORCE_RIGHT;default:return t}}(s)));const h=r===n.value.length;if(!(0===r)&&!h)return this._blockStartPos(a)+r;const o=h?a+1:a;if(s===e.NONE){if(o>0){const t=o-1,s=this._blocks[t],u=s.nearestInputPos(0,e.NONE);if(!s.value.length||u!==s.value.length)return this._blockStartPos(o)}for(let t=o;t<this._blocks.length;++t){const s=this._blocks[t],u=s.nearestInputPos(0,e.NONE);if(u!==s.value.length)return this._blockStartPos(t)+u}return this.value.length}if(s===e.LEFT||s===e.FORCE_LEFT){let u;for(let t=o;t<this._blocks.length;++t)if(this._blocks[t].value){u=t;break}if(null!=u){const t=this._blocks[u],s=t.nearestInputPos(0,e.RIGHT);if(0===s&&t.unmaskedValue.length)return this._blockStartPos(u)+s}let i,a=-1;for(let t=o-1;t>=0;--t){const s=this._blocks[t],u=s.nearestInputPos(s.value.length,e.FORCE_LEFT);if(null!=i||s.value&&0===u||(i=t),0!==u){if(u!==s.value.length)return this._blockStartPos(t)+u;a=t;break}}if(s===e.LEFT)for(let s=a+1;s<=Math.min(o,this._blocks.length-1);++s){const u=this._blocks[s],i=u.nearestInputPos(0,e.NONE),a=this._blockStartPos(s)+i;if((!u.value.length&&a===this.value.length||i!==u.value.length)&&a<=t)return a}if(a>=0)return this._blockStartPos(a)+this._blocks[a].value.length;if(s===e.FORCE_LEFT||this.lazy&&!this.extractInput()&&!function(t){if(!t)return!1;const s=t.value;return!s||t.nearestInputPos(0,e.NONE)!==s.length}(this._blocks[o]))return 0;if(null!=i)return this._blockStartPos(i);for(let t=o;t<this._blocks.length;++t){const s=this._blocks[t],u=s.nearestInputPos(0,e.NONE);if(!s.value.length||u!==s.value.length)return this._blockStartPos(t)+u}return 0}if(s===e.RIGHT||s===e.FORCE_RIGHT){let u,i;for(let t=o;t<this._blocks.length;++t){const s=this._blocks[t],a=s.nearestInputPos(0,e.NONE);if(a!==s.value.length){i=this._blockStartPos(t)+a,u=t;break}}if(null!=u&&null!=i){for(let t=u;t<this._blocks.length;++t){const s=this._blocks[t],u=s.nearestInputPos(0,e.FORCE_RIGHT);if(u!==s.value.length)return this._blockStartPos(t)+u}return s===e.FORCE_RIGHT?this.value.length:i}for(let s=Math.min(o,this._blocks.length-1);s>=0;--s){const u=this._blocks[s],i=u.nearestInputPos(u.value.length,e.LEFT);if(0!==i){const e=this._blockStartPos(s)+i;if(e>=t)return e;break}}}return t}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const e=this._maskedBlocks[t];return e?e.map(t=>this._blocks[t]):[]}}k.DEFAULTS={lazy:!0,placeholderChar:"_"},k.STOP_CHAR="`",k.ESCAPE_CHAR="\\",k.InputDefinition=g,k.FixedDefinition=_;class f extends k{get _matchFrom(){return this.maxLength-String(this.from).length}_update(t){t=a({to:this.to||0,from:this.from||0},t);let e=String(t.to).length;null!=t.maxLength&&(e=Math.max(e,t.maxLength)),t.maxLength=e;const s=String(t.from).padStart(e,"0"),u=String(t.to).padStart(e,"0");let i=0;for(;i<u.length&&u[i]===s[i];)++i;t.mask=u.slice(0,i).replace(/0/g,"\\0")+"0".repeat(e-i),super._update(t)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){let e="",s="";const[,u,i]=t.match(/^(\D*)(\d*)(\D*)/)||[];return i&&(e="0".repeat(u.length)+i,s="9".repeat(u.length)+i),[e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9")]}doPrepare(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t=super.doPrepare(t,e).replace(/\D/g,""),!this.autofix)return t;const s=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0"),i=this.value;let a="";for(let e=0;e<t.length;++e){const n=i+a+t[e],[r,h]=this.boundaries(n);Number(h)<this.from?a+=s[n.length-1]:Number(r)>this.to?a+=u[n.length-1]:a+=t[e]}return a}doValidate(){const t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;const[e,s]=this.boundaries(t);return this.from<=Number(s)&&Number(e)<=this.to&&super.doValidate(...arguments)}}class v extends k{constructor(t){super(a({},v.DEFAULTS,t))}_update(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern);const e=t.blocks;t.blocks=Object.assign({},v.GET_DEFAULT_BLOCKS()),t.min&&(t.blocks.Y.from=t.min.getFullYear()),t.max&&(t.blocks.Y.to=t.max.getFullYear()),t.min&&t.max&&t.blocks.Y.from===t.blocks.Y.to&&(t.blocks.m.from=t.min.getMonth()+1,t.blocks.m.to=t.max.getMonth()+1,t.blocks.m.from===t.blocks.m.to&&(t.blocks.d.from=t.min.getDate(),t.blocks.d.to=t.max.getDate())),Object.assign(t.blocks,e),Object.keys(t.blocks).forEach(e=>{const s=t.blocks[e];"autofix"in s||(s.autofix=t.autofix)}),super._update(t)}doValidate(){const t=this.date;return super.doValidate(...arguments)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=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)}get typedValue(){return this.date}set typedValue(t){this.date=t}}v.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=>{const[e,s,u]=t.split(".");return new Date(u,s-1,e)}},v.GET_DEFAULT_BLOCKS=()=>({d:{mask:f,from:1,to:31,maxLength:2},m:{mask:f,from:1,to:12,maxLength:2},Y:{mask:f,from:1900,to:9999}});class A{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch(t){}return null!=t?t:this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch(t){}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch(t){}}_unsafeSelect(t,e){}get isActive(){return!1}bindEvents(t){}unbindEvents(){}}class C extends A{constructor(t){super(),this.input=t,this._handlers={}}get isActive(){return this.input===document.activeElement}get _unsafeSelectionStart(){return this.input.selectionStart}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}bindEvents(t){Object.keys(t).forEach(e=>this._toggleEventHandler(C.EVENTS_MAP[e],t[e]))}unbindEvents(){Object.keys(this._handlers).forEach(t=>this._toggleEventHandler(t))}_toggleEventHandler(t,e){this._handlers[t]&&(this.input.removeEventListener(t,this._handlers[t]),delete this._handlers[t]),e&&(this.input.addEventListener(t,e),this._handlers[t]=e)}}C.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"};class F{constructor(t,e){this.el=t instanceof A?t:new C(t),this.masked=d(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._onFocus=this._onFocus.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||t===Date&&this.masked instanceof v)return;if(this.masked.constructor===c(t))return void this.masked.updateOptions({mask:t});const e=d({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()}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValue=t,this.updateControl(),this.alignCursor()}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this.alignCursorFriendly,focus:this._onFocus,commit:this._onChange})}_unbindEvents(){this.el.unbindEvents()}_fireEvent(t){const e=this._listeners[t];e&&e.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.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.value!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value}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){const{mask:e}=t,s=n(t,["mask"]);this.mask=e,function t(e,s){if(s===e)return!0;var u,i=Array.isArray(s),a=Array.isArray(e);if(i&&a){if(s.length!=e.length)return!1;for(u=0;u<s.length;u++)if(!t(s[u],e[u]))return!1;return!0}if(i!=a)return!1;if(s&&e&&"object"==typeof s&&"object"==typeof e){var n=s instanceof Date,r=e instanceof Date;if(n&&r)return s.getTime()==e.getTime();if(n!=r)return!1;var h=s instanceof RegExp,o=e instanceof RegExp;if(h&&o)return s.toString()==e.toString();if(h!=o)return!1;var l=Object.keys(s);for(u=0;u<l.length;u++)if(!Object.prototype.hasOwnProperty.call(e,l[u]))return!1;for(u=0;u<l.length;u++)if(!t(e[l[u]],s[l[u]]))return!1;return!0}return!(!s||!e||"function"!=typeof s||"function"!=typeof e)&&s.toString()===e.toString()}(this.masked,s)||this.masked.updateOptions(s),this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept"),this.masked.isComplete&&this._fireEvent("complete")}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,e.LEFT)}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;const s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(){if(this._abortUpdateCursor(),!this._selection)return this.updateValue();const t=new r(this.el.value,this.cursorPos,this.value,this._selection),s=this.masked.rawInputValue,u=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,i=s===this.masked.rawInputValue?t.removeDirection:e.NONE,a=this.masked.nearestInputPos(t.startChangePos+u,i);this.updateControl(),this.updateCursor(a)}_onChange(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.selectionStart===this.cursorPos&&(this._selection&&(this.cursorPos=this._selection.end),this.alignCursorFriendly())}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}class E extends l{constructor(t){super(a({},E.DEFAULTS,t))}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){let t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+s(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp(t+"(0|([1-9]+\\d*))?"+e),this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(s).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(s(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepare(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),u=1;u<e;u++)s[u-1]=arguments[u];return super.doPrepare(this._removeThousandsSeparators(t.replace(this._mapToRadixRegExp,this.radix)),...s)}_separatorsCount(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=0;for(let u=0;u<t;++u)this._value.indexOf(this.thousandsSeparator,u)===u&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._value;return this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2?arguments[2]:void 0;return[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.thousandsSeparator)return super._appendCharRaw(t,e);const s=this._separatorsCountFromSlice(e.tail&&this._beforeTailState?this._beforeTailState._value:this._value);this._value=this._removeThousandsSeparators(this.value);const u=super._appendCharRaw(t,e);this._value=this._insertThousandsSeparators(this._value);const i=this._separatorsCountFromSlice(e.tail&&this._beforeTailState?this._beforeTailState._value:this._value);return u.tailShift+=(i-s)*this.thousandsSeparator.length,u}_findSeparatorAround(t){if(this.thousandsSeparator){const e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){const s=this._findSeparatorAround(t);s>=0&&(t=s);const u=this._findSeparatorAround(e);return u>=0&&(e=u+this.thousandsSeparator.length),[t,e]}remove(){let 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,e]=this._adjustRangeWithSeparators(t,e);const s=this.value.slice(0,t),u=this.value.slice(e),i=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+u));const a=this._separatorsCountFromSlice(s);return new h({tailShift:(a-i)*this.thousandsSeparator.length})}nearestInputPos(t,s){if(!this.thousandsSeparator)return t;switch(s){case e.NONE:case e.LEFT:case e.FORCE_LEFT:{const u=this._findSeparatorAround(t-1);if(u>=0){const i=u+this.thousandsSeparator.length;if(t<i||this.value.length<=i||s===e.FORCE_LEFT)return u}break}case e.RIGHT:case e.FORCE_RIGHT:{const e=this._findSeparatorAround(t);if(e>=0)return e+this.thousandsSeparator.length}}return 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(){if(this.value){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.normalizeZeros&&(s=this._normalizeZeros(s)),this.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){if(!t)return t;const e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,".")}set unmaskedValue(t){super.unmaskedValue=t.replace(".",this.radix)}get number(){return Number(this.unmaskedValue)}set number(t){this.unmaskedValue=String(t)}get typedValue(){return this.number}set typedValue(t){this.number=t}get allowNegative(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}E.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};class b extends l{constructor(t){super(a({},b.DEFAULTS,t)),this.currentMask=null}_update(t){super._update(t),"mask"in t&&(this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>d(t)):[])}_appendCharRaw(){const t=this._applyDispatch(...arguments);return this.currentMask&&t.aggregate(this.currentMask._appendChar(...arguments)),t}_applyDispatch(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const s=e.tail&&this._beforeTailState?this._beforeTailState._value:this.value,u=this.rawInputValue,i=e.tail&&this._beforeTailState?this._beforeTailState._rawInputValue:u,a=u.slice(i.length),n=this.currentMask,r=new h,o=n&&n.state,l=n&&n._beforeTailState;if(this.currentMask=this.doDispatch(t,e),this.currentMask)if(this.currentMask!==n){this.currentMask.reset();const t=this.currentMask.append(i,{raw:!0});r.tailShift=t.inserted.length-s.length,a&&(r.tailShift+=this.currentMask.append(a,{raw:!0,tail:!0}).tailShift)}else this.currentMask.state=o,this.currentMask._beforeTailState=l;return r}doDispatch(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.dispatch(t,this,e)}doValidate(){return super.doValidate(...arguments)&&(!this.currentMask||this.currentMask.doValidate(...arguments))}reset(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(t){super.value=t}get unmaskedValue(){return this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.currentMask?this.currentMask.typedValue:""}set typedValue(t){let e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get isComplete(){return!!this.currentMask&&this.currentMask.isComplete}remove(){const t=new h;return this.currentMask&&t.aggregate(this.currentMask.remove(...arguments)).aggregate(this._applyDispatch()),t}get state(){return a({},super.state,{_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:this.currentMask&&this.currentMask.state})}set state(t){const{compiledMasks:e,currentMaskRef:s,currentMask:u}=t,i=n(t,["compiledMasks","currentMaskRef","currentMask"]);this.compiledMasks.forEach((t,s)=>t.state=e[s]),null!=s&&(this.currentMask=s,this.currentMask.state=u),super.state=i}extractInput(){return this.currentMask?this.currentMask.extractInput(...arguments):""}extractTail(){return this.currentMask?this.currentMask.extractTail(...arguments):super.extractTail(...arguments)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(){return this.currentMask?this.currentMask.nearestInputPos(...arguments):super.nearestInputPos(...arguments)}}function B(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new F(t,e)}b.DEFAULTS={dispatch:(t,e,s)=>{if(!e.compiledMasks.length)return;const u=e.rawInputValue,i=e.compiledMasks.map((e,i)=>{return e.rawInputValue=u,e.append(t,s),{weight:e.rawInputValue.length,index:i}});return i.sort((t,e)=>e.weight-t.weight),e.compiledMasks[i[0].index]}},B.InputMask=F,B.Masked=l,B.MaskedPattern=k,B.MaskedEnum=class extends k{_update(t){t.enum&&(t.mask="*".repeat(t.enum[0].length)),super._update(t)}doValidate(){return this.enum.some(t=>t.indexOf(this.unmaskedValue)>=0)&&super.doValidate(...arguments)}},B.MaskedRange=f,B.MaskedNumber=E,B.MaskedDate=v,B.MaskedRegExp=class extends l{_update(t){t.mask&&(t.validate=e=>e.search(t.mask)>=0),super._update(t)}},B.MaskedFunction=class extends l{_update(t){t.mask&&(t.validate=t.mask),super._update(t)}},B.MaskedDynamic=b,B.createMask=d,B.MaskElement=A,B.HTMLMaskElement=C,u.IMask=B;export default B;
function t(t){return"string"==typeof t||t instanceof String}var e={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function s(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}var u="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{};function a(t,e,s){return e in t?Object.defineProperty(t,e,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[e]=s,t}function r(t){for(var e=1;e<arguments.length;e++)if(e%2){var s=null!=arguments[e]?arguments[e]:{},u=Object.keys(s);"function"==typeof Object.getOwnPropertySymbols&&(u=u.concat(Object.getOwnPropertySymbols(s).filter(function(t){return Object.getOwnPropertyDescriptor(s,t).enumerable}))),u.forEach(function(e){a(t,e,s[e])})}else Object.defineProperties(t,Object.getOwnPropertyDescriptors(arguments[e]));return t}function i(t,e){if(null==t)return{};var s,u,a=function(t,e){if(null==t)return{};var s,u,a={},r=Object.keys(t);for(u=0;u<r.length;u++)s=r[u],e.indexOf(s)>=0||(a[s]=t[s]);return a}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(u=0;u<r.length;u++)s=r[u],e.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(t,s)&&(a[s]=t[s])}return a}class n{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(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?e.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?e.RIGHT:e.LEFT}}class h{constructor(t){Object.assign(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},t)}aggregate(t){return this.rawInserted+=t.rawInserted,this.skip=this.skip||t.skip,this.inserted+=t.inserted,this.tailShift+=t.tailShift,this}get offset(){return this.tailShift+this.inserted.length}}class l{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2?arguments[2]:void 0;this.value=t,this.from=e,this.stop=s}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}shiftBefore(t){if(this.from>=t||!this.value.length)return"";var e=this.value[0];return this.value=this.value.slice(1),e}}class o{constructor(t){this._value="",this._update(t),this.isInitialized=!0}updateOptions(t){Object.keys(t).length&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t)}resolve(t){return this.reset(),this.append(t,{input:!0},""),this.doCommit(),this.value}get unmaskedValue(){return this.value}set unmaskedValue(t){this.reset(),this.append(t,{},""),this.doCommit()}get typedValue(){return this.unmaskedValue}set typedValue(t){this.unmaskedValue=t}get rawInputValue(){return this.extractInput(0,this.value.length,{raw:!0})}set rawInputValue(t){this.reset(),this.append(t,{raw:!0},""),this.doCommit()}get isComplete(){return!0}nearestInputPos(t,e){return t}extractInput(){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)}extractTail(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new l(this.extractInput(t,e),t)}appendTail(e){return t(e)&&(e=new l(String(e))),e.appendTo(this)}_appendCharRaw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(t=this.doPrepare(t,e))?(this._value+=t,new h({inserted:t,rawInserted:t})):new h}_appendChar(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2?arguments[2]:void 0,u=this.state,a=this._appendCharRaw(t,e);if(a.inserted){var r,i=!1!==this.doValidate(e);if(i&&null!=s){var n=this.state;this.overwrite&&(r=s.state,s.shiftBefore(this.value.length));var h=this.appendTail(s);(i=h.rawInserted===s.toString())&&h.inserted&&(this.state=n)}i||(a.rawInserted=a.inserted="",this.state=u,s&&r&&(s.state=r))}return a}_appendPlaceholder(){return new h}append(e,s,u){if(!t(e))throw new Error("value should be string");var a=new h,r=t(u)?new l(String(u)):u;s.tail&&(s._beforeTailState=this.state);for(var i=0;i<e.length;++i)a.aggregate(this._appendChar(e[i],s,r));return null!=r&&(a.tailShift+=this.appendTail(r).tailShift),a}remove(){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=this.value.slice(0,t)+this.value.slice(e),new h}withValueRefresh(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;var e=this.unmaskedValue,s=this.value,u=t();return this.resolve(s)!==s&&(this.unmaskedValue=e),delete this._refreshing,u}doPrepare(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare?this.prepare(t,this,e):t}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,e,s,u){var a=t+e,r=this.extractTail(a),i=this.nearestInputPos(t,u);return new h({tailShift:i-t}).aggregate(this.remove(i)).aggregate(this.append(s,{input:!0},r))}}function d(e){if(null==e)throw new Error("mask property should be defined");return e instanceof RegExp?u.IMask.MaskedRegExp:t(e)?u.IMask.MaskedPattern:e instanceof Date||e===Date?u.IMask.MaskedDate:e instanceof Number||"number"==typeof e||e===Number?u.IMask.MaskedNumber:Array.isArray(e)||e===Array?u.IMask.MaskedDynamic:e.prototype instanceof u.IMask.Masked?e:e instanceof Function?u.IMask.MaskedFunction:(console.warn("Mask not found for mask",e),u.IMask.Masked)}function p(t){var e=(t=r({},t)).mask;return e instanceof u.IMask.Masked?e:new(d(e))(t)}var c={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class g{constructor(t){var{mask:e}=t,s=i(t,["mask"]);this.masked=p({mask:e}),Object.assign(this,s)}reset(){this._isFilled=!1,this.masked.reset()}remove(){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 0===t&&e>=1?(this._isFilled=!1,this.masked.remove(t,e)):new h}get value(){return this.masked.value||(this._isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get isComplete(){return Boolean(this.masked.value)||this.isOptional}_appendChar(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._isFilled)return new h;var s=this.masked.state,u=this.masked._appendChar(t,e);return u.inserted&&!1===this.doValidate(e)&&(u.inserted=u.rawInserted="",this.masked.state=s),u.inserted||this.isOptional||this.lazy||e.input||(u.inserted=this.placeholderChar),u.skip=!u.inserted&&!this.isOptional,this._isFilled=Boolean(u.inserted),u}append(){return this.masked.append(...arguments)}_appendPlaceholder(){var t=new h;return this._isFilled||this.isOptional?t:(this._isFilled=!0,t.inserted=this.placeholderChar,t)}extractTail(){return this.masked.extractTail(...arguments)}appendTail(){return this.masked.appendTail(...arguments)}extractInput(){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,s=arguments.length>2?arguments[2]:void 0;return this.masked.extractInput(t,e,s)}nearestInputPos(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE,u=this.value.length,a=Math.min(Math.max(t,0),u);switch(s){case e.LEFT:case e.FORCE_LEFT:return this.isComplete?a:0;case e.RIGHT:case e.FORCE_RIGHT:return this.isComplete?a:u;case e.NONE:default:return a}}doValidate(){return this.masked.doValidate(...arguments)&&(!this.parent||this.parent.doValidate(...arguments))}doCommit(){this.masked.doCommit()}get state(){return{masked:this.masked.state,_isFilled:this._isFilled}}set state(t){this.masked.state=t.masked,this._isFilled=t._isFilled}}class v{constructor(t){Object.assign(this,t),this._value=""}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}reset(){this._isRawInput=!1,this._value=""}remove(){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=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new h}nearestInputPos(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE,u=this._value.length;switch(s){case e.LEFT:case e.FORCE_LEFT:return 0;case e.NONE:case e.RIGHT:case e.FORCE_RIGHT:default:return u}}extractInput(){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(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).raw&&this._isRawInput&&this._value.slice(t,e)||""}get isComplete(){return!0}_appendChar(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=new h;if(this._value)return s;var u=this.char===t[0]&&(this.isUnmasking||e.input||e.raw)&&!e.tail;return u&&(s.rawInserted=this.char),this._value=s.inserted=this.char,this._isRawInput=u&&(e.raw||e.input),s}_appendPlaceholder(){var t=new h;return this._value?t:(this._value=t.inserted=this.char,t)}extractTail(){arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new l("")}appendTail(e){return t(e)&&(e=new l(String(e))),e.appendTo(this)}append(t,e,s){var u=this._appendChar(t,e);return null!=s&&(u.tailShift+=this.appendTail(s).tailShift),u}doCommit(){}get state(){return{_value:this._value,_isRawInput:this._isRawInput}}set state(t){Object.assign(this,t)}}class m{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.chunks=t,this.from=e}toString(){return this.chunks.map(String).join("")}extend(e){if(String(e)){t(e)&&(e=new l(String(e)));var s=this.chunks[this.chunks.length-1],u=s&&(s.stop===e.stop||null==e.stop)&&e.from===s.from+s.toString().length;if(e instanceof l)u?s.extend(e.toString()):this.chunks.push(e);else if(e instanceof m){if(null==e.stop)for(var a;e.chunks.length&&null==e.chunks[0].stop;)(a=e.chunks.shift()).from+=e.from,this.extend(a);e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}}appendTo(t){if(!(t instanceof u.IMask.MaskedPattern))return new l(this.toString()).appendTo(t);for(var e=new h,s=0;s<this.chunks.length&&!e.skip;++s){var a=this.chunks[s],r=t._mapPosToBlock(t.value.length),i=a.stop,n=void 0;if(i&&(!r||r.index<=i)&&((a instanceof m||t._stops.indexOf(i)>=0)&&e.aggregate(t._appendPlaceholder(i)),n=a instanceof m&&t._blocks[i]),n){var o=n.appendTail(a);o.skip=!1,e.aggregate(o),t._value+=o.inserted;var d=a.toString().slice(o.rawInserted.length);d&&e.aggregate(t.append(d,{tail:!0}))}else e.aggregate(t.append(a.toString(),{tail:!0}))}return e}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){var{chunks:e}=t,s=i(t,["chunks"]);Object.assign(this,s),this.chunks=e.map(t=>{var e="chunks"in t?new m:new l;return e.state=t,e})}shiftBefore(t){if(this.from>=t||!this.chunks.length)return"";for(var e=t-this.from,s=0;s<this.chunks.length;){var u=this.chunks[s],a=u.shiftBefore(e);if(u.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}}class k extends o{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},c,t.definitions),super(r({},k.DEFAULTS,{},t))}_update(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){var t=this,e=this.definitions;this._blocks=[],this._stops=[],this._maskedBlocks={};var s=this.mask;if(s&&e)for(var u=!1,a=!1,i=0;i<s.length;++i){if(this.blocks)if("continue"===function(){var e=s.slice(i),u=Object.keys(t.blocks).filter(t=>0===e.indexOf(t));u.sort((t,e)=>e.length-t.length);var a=u[0];if(a){var n=p(r({parent:t,lazy:t.lazy,placeholderChar:t.placeholderChar},t.blocks[a]));return n&&(t._blocks.push(n),t._maskedBlocks[a]||(t._maskedBlocks[a]=[]),t._maskedBlocks[a].push(t._blocks.length-1)),i+=a.length-1,"continue"}}())continue;var n=s[i],h=n in e;if(n!==k.STOP_CHAR)if("{"!==n&&"}"!==n)if("["!==n&&"]"!==n){if(n===k.ESCAPE_CHAR){if(!(n=s[++i]))break;h=!1}var l=h?new g({parent:this,lazy:this.lazy,placeholderChar:this.placeholderChar,mask:e[n],isOptional:a}):new v({char:n,isUnmasking:u});this._blocks.push(l)}else a=!a;else u=!u;else this._stops.push(this._blocks.length)}}get state(){return r({},super.state,{_blocks:this._blocks.map(t=>t.state)})}set state(t){var{_blocks:e}=t,s=i(t,["_blocks"]);this._blocks.forEach((t,s)=>t.state=e[s]),super.state=s}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this._blocks.every(t=>t.isComplete)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this._blocks.reduce((t,e)=>t+=e.unmaskedValue,"")}set unmaskedValue(t){super.unmaskedValue=t}get value(){return this._blocks.reduce((t,e)=>t+=e.value,"")}set value(t){super.value=t}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendCharRaw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=this.doPrepare(t,e);var s=this._mapPosToBlock(this.value.length),u=new h;if(!s)return u;for(var a=s.index;;++a){var r=this._blocks[a];if(!r)break;var i=r._appendChar(t,e),n=i.skip;if(u.aggregate(i),n||i.rawInserted)break}return u}extractTail(){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,s=new m;return t===e?s:(this._forEachBlocksInRange(t,e,(t,e,u,a)=>{var r=t.extractTail(u,a);r.stop=this._findStopBefore(e),r.from=this._blockStartPos(e),r instanceof m&&(r.blockIndex=e),s.extend(r)}),s)}extractInput(){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,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";var u="";return this._forEachBlocksInRange(t,e,(t,e,a,r)=>{u+=t.extractInput(a,r,s)}),u}_findStopBefore(t){for(var e,s=0;s<this._stops.length;++s){var u=this._stops[s];if(!(u<=t))break;e=u}return e}_appendPlaceholder(t){var e=new h;if(this.lazy&&null==t)return e;var s=this._mapPosToBlock(this.value.length);if(!s)return e;var u=s.index,a=null!=t?t:this._blocks.length;return this._blocks.slice(u,a).forEach(s=>{if(!s.lazy||null!=t){var u=null!=s._blocks?[s._blocks.length]:[],a=s._appendPlaceholder(...u);this._value+=a.inserted,e.aggregate(a)}}),e}_mapPosToBlock(t){for(var e="",s=0;s<this._blocks.length;++s){var u=this._blocks[s],a=e.length;if(t<=(e+=u.value).length)return{index:s,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((t,e)=>t+=e.value.length,0)}_forEachBlocksInRange(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,s=arguments.length>2?arguments[2]:void 0,u=this._mapPosToBlock(t);if(u){var a=this._mapPosToBlock(e),r=a&&u.index===a.index,i=u.offset,n=a&&r?a.offset:this._blocks[u.index].value.length;if(s(this._blocks[u.index],u.index,i,n),a&&!r){for(var h=u.index+1;h<a.index;++h)s(this._blocks[h],h,0,this._blocks[h].value.length);s(this._blocks[a.index],a.index,0,a.offset)}}}remove(){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,s=super.remove(t,e);return this._forEachBlocksInRange(t,e,(t,e,u,a)=>{s.aggregate(t.remove(u,a))}),s}nearestInputPos(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.NONE,u=this._mapPosToBlock(t)||{index:0,offset:0},{offset:a,index:r}=u,i=this._blocks[r];if(!i)return t;var n=a;0!==n&&n<i.value.length&&(n=i.nearestInputPos(a,function(t){switch(t){case e.LEFT:return e.FORCE_LEFT;case e.RIGHT:return e.FORCE_RIGHT;default:return t}}(s)));var h=n===i.value.length;if(!(0===n)&&!h)return this._blockStartPos(r)+n;var l=h?r+1:r;if(s===e.NONE){if(l>0){var o=l-1,d=this._blocks[o],p=d.nearestInputPos(0,e.NONE);if(!d.value.length||p!==d.value.length)return this._blockStartPos(l)}for(var c=l;c<this._blocks.length;++c){var g=this._blocks[c],v=g.nearestInputPos(0,e.NONE);if(v!==g.value.length)return this._blockStartPos(c)+v}for(var m=l-1;m>=0;--m){var k=this._blocks[m],_=k.nearestInputPos(0,e.NONE);if(!k.value.length||_!==k.value.length)return this._blockStartPos(m)+k.value.length}return t}if(s===e.LEFT||s===e.FORCE_LEFT){for(var f,A=l;A<this._blocks.length;++A)if(this._blocks[A].value){f=A;break}if(null!=f){var C=this._blocks[f],F=C.nearestInputPos(0,e.RIGHT);if(0===F&&C.unmaskedValue.length)return this._blockStartPos(f)+F}for(var E,b=-1,D=l-1;D>=0;--D){var B=this._blocks[D],S=B.nearestInputPos(B.value.length,e.FORCE_LEFT);if(B.value&&0===S||(E=D),0!==S){if(S!==B.value.length)return this._blockStartPos(D)+S;b=D;break}}if(s===e.LEFT)for(var x=b+1;x<=Math.min(l,this._blocks.length-1);++x){var T=this._blocks[x],w=T.nearestInputPos(0,e.NONE),P=this._blockStartPos(x)+w;if(P>t)break;if(w!==T.value.length)return P}if(b>=0)return this._blockStartPos(b)+this._blocks[b].value.length;if(s===e.FORCE_LEFT||this.lazy&&!this.extractInput()&&!function(t){if(!t)return!1;var s=t.value;return!s||t.nearestInputPos(0,e.NONE)!==s.length}(this._blocks[l]))return 0;if(null!=E)return this._blockStartPos(E);for(var M=l;M<this._blocks.length;++M){var I=this._blocks[M],O=I.nearestInputPos(0,e.NONE);if(!I.value.length||O!==I.value.length)return this._blockStartPos(M)+O}return 0}if(s===e.RIGHT||s===e.FORCE_RIGHT){for(var V,R,y=l;y<this._blocks.length;++y){var N=this._blocks[y],L=N.nearestInputPos(0,e.NONE);if(L!==N.value.length){R=this._blockStartPos(y)+L,V=y;break}}if(null!=V&&null!=R){for(var j=V;j<this._blocks.length;++j){var H=this._blocks[j],G=H.nearestInputPos(0,e.FORCE_RIGHT);if(G!==H.value.length)return this._blockStartPos(j)+G}return s===e.FORCE_RIGHT?this.value.length:R}for(var U=Math.min(l,this._blocks.length-1);U>=0;--U){var z=this._blocks[U],Y=z.nearestInputPos(z.value.length,e.LEFT);if(0!==Y){var Z=this._blockStartPos(U)+Y;if(Z>=t)return Z;break}}}return t}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){var e=this._maskedBlocks[t];return e?e.map(t=>this._blocks[t]):[]}}k.DEFAULTS={lazy:!0,placeholderChar:"_"},k.STOP_CHAR="`",k.ESCAPE_CHAR="\\",k.InputDefinition=g,k.FixedDefinition=v;class _ extends k{get _matchFrom(){return this.maxLength-String(this.from).length}_update(t){t=r({to:this.to||0,from:this.from||0},t);var e=String(t.to).length;null!=t.maxLength&&(e=Math.max(e,t.maxLength)),t.maxLength=e;for(var s=String(t.from).padStart(e,"0"),u=String(t.to).padStart(e,"0"),a=0;a<u.length&&u[a]===s[a];)++a;t.mask=u.slice(0,a).replace(/0/g,"\\0")+"0".repeat(e-a),super._update(t)}get isComplete(){return super.isComplete&&Boolean(this.value)}boundaries(t){var e="",s="",[,u,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(e="0".repeat(u.length)+a,s="9".repeat(u.length)+a),[e=e.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9")]}doPrepare(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t=super.doPrepare(t,e).replace(/\D/g,""),!this.autofix)return t;for(var s=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0"),a=this.value,r="",i=0;i<t.length;++i){var n=a+r+t[i],[h,l]=this.boundaries(n);Number(l)<this.from?r+=s[n.length-1]:Number(h)>this.to?r+=u[n.length-1]:r+=t[i]}return r}doValidate(){var t=this.value;if(-1===t.search(/[^0]/)&&t.length<=this._matchFrom)return!0;var[e,s]=this.boundaries(t);return this.from<=Number(s)&&Number(e)<=this.to&&super.doValidate(...arguments)}}class f extends k{constructor(t){super(r({},f.DEFAULTS,{},t))}_update(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern);var e=t.blocks;t.blocks=Object.assign({},f.GET_DEFAULT_BLOCKS()),t.min&&(t.blocks.Y.from=t.min.getFullYear()),t.max&&(t.blocks.Y.to=t.max.getFullYear()),t.min&&t.max&&t.blocks.Y.from===t.blocks.Y.to&&(t.blocks.m.from=t.min.getMonth()+1,t.blocks.m.to=t.max.getMonth()+1,t.blocks.m.from===t.blocks.m.to&&(t.blocks.d.from=t.min.getDate(),t.blocks.d.to=t.max.getDate())),Object.assign(t.blocks,e),Object.keys(t.blocks).forEach(e=>{var s=t.blocks[e];"autofix"in s||(s.autofix=t.autofix)}),super._update(t)}doValidate(){var t=this.date;return super.doValidate(...arguments)&&(!this.isComplete||this.isDateExist(this.value)&&null!=t&&(null==this.min||this.min<=t)&&(null==this.max||t<=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)}get typedValue(){return this.date}set typedValue(t){this.date=t}}f.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,s,u]=t.split(".");return new Date(u,s-1,e)}},f.GET_DEFAULT_BLOCKS=()=>({d:{mask:_,from:1,to:31,maxLength:2},m:{mask:_,from:1,to:12,maxLength:2},Y:{mask:_,from:1900,to:9999}});class A{get selectionStart(){var t;try{t=this._unsafeSelectionStart}catch(t){}return null!=t?t:this.value.length}get selectionEnd(){var t;try{t=this._unsafeSelectionEnd}catch(t){}return null!=t?t:this.value.length}select(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch(t){}}_unsafeSelect(t,e){}get isActive(){return!1}bindEvents(t){}unbindEvents(){}}class C extends A{constructor(t){super(),this.input=t,this._handlers={}}get isActive(){return this.input===document.activeElement}get _unsafeSelectionStart(){return this.input.selectionStart}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,e){this.input.setSelectionRange(t,e)}get value(){return this.input.value}set value(t){this.input.value=t}bindEvents(t){Object.keys(t).forEach(e=>this._toggleEventHandler(C.EVENTS_MAP[e],t[e]))}unbindEvents(){Object.keys(this._handlers).forEach(t=>this._toggleEventHandler(t))}_toggleEventHandler(t,e){this._handlers[t]&&(this.input.removeEventListener(t,this._handlers[t]),delete this._handlers[t]),e&&(this.input.addEventListener(t,e),this._handlers[t]=e)}}C.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"};class F{constructor(t,e){this.el=t instanceof A?t:new C(t),this.masked=p(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._onFocus=this._onFocus.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||t===Date&&this.masked instanceof f))if(this.masked.constructor!==d(t)){var e=p({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}else this.masked.updateOptions({mask:t})}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()}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValue=t,this.updateControl(),this.alignCursor()}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this.alignCursorFriendly,focus:this._onFocus,commit:this._onChange})}_unbindEvents(){this.el.unbindEvents()}_fireEvent(t){var e=this._listeners[t];e&&e.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.isActive&&(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.value!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value}updateControl(){var 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){var{mask:e}=t,s=i(t,["mask"]);this.mask=e,function t(e,s){if(s===e)return!0;var u,a=Array.isArray(s),r=Array.isArray(e);if(a&&r){if(s.length!=e.length)return!1;for(u=0;u<s.length;u++)if(!t(s[u],e[u]))return!1;return!0}if(a!=r)return!1;if(s&&e&&"object"==typeof s&&"object"==typeof e){var i=s instanceof Date,n=e instanceof Date;if(i&&n)return s.getTime()==e.getTime();if(i!=n)return!1;var h=s instanceof RegExp,l=e instanceof RegExp;if(h&&l)return s.toString()==e.toString();if(h!=l)return!1;var o=Object.keys(s);for(u=0;u<o.length;u++)if(!Object.prototype.hasOwnProperty.call(e,o[u]))return!1;for(u=0;u<o.length;u++)if(!t(e[o[u]],s[o[u]]))return!1;return!0}return!(!s||!e||"function"!=typeof s||"function"!=typeof e)&&s.toString()===e.toString()}(this.masked,s)||this.masked.updateOptions(s),this.updateControl()}updateCursor(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept"),this.masked.isComplete&&this._fireEvent("complete")}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,e.LEFT)}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}off(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;var s=this._listeners[t].indexOf(e);return s>=0&&this._listeners[t].splice(s,1),this}_onInput(){if(this._abortUpdateCursor(),!this._selection)return this.updateValue();var t=new n(this.el.value,this.cursorPos,this.value,this._selection),s=this.masked.rawInputValue,u=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,a=s===this.masked.rawInputValue?t.removeDirection:e.NONE,r=this.masked.nearestInputPos(t.startChangePos+u,a);this.updateControl(),this.updateCursor(r)}_onChange(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.selectionStart===this.cursorPos&&(this._selection&&(this.cursorPos=this._selection.end),this.alignCursorFriendly())}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}class E extends o{constructor(t){super(r({},E.DEFAULTS,{},t))}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){var t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+s(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp(t+"(0|([1-9]+\\d*))?"+e),this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(s).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(s(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){var e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}doPrepare(t){for(var e=arguments.length,s=new Array(e>1?e-1:0),u=1;u<e;u++)s[u-1]=arguments[u];return super.doPrepare(this._removeThousandsSeparators(t.replace(this._mapToRadixRegExp,this.radix)),...s)}_separatorsCount(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],s=0,u=0;u<t;++u)this._value.indexOf(this.thousandsSeparator,u)===u&&(++s,e&&(t+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._value;return this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(){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,s=arguments.length>2?arguments[2]:void 0;return[t,e]=this._adjustRangeWithSeparators(t,e),this._removeThousandsSeparators(super.extractInput(t,e,s))}_appendCharRaw(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.thousandsSeparator)return super._appendCharRaw(t,e);var s=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,u=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);var a=super._appendCharRaw(t,e);this._value=this._insertThousandsSeparators(this._value);var r=e.tail&&e._beforeTailState?e._beforeTailState._value:this._value,i=this._separatorsCountFromSlice(r);return a.tailShift+=(i-u)*this.thousandsSeparator.length,a}_findSeparatorAround(t){if(this.thousandsSeparator){var e=t-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,e);if(s<=t)return s}return-1}_adjustRangeWithSeparators(t,e){var s=this._findSeparatorAround(t);s>=0&&(t=s);var u=this._findSeparatorAround(e);return u>=0&&(e=u+this.thousandsSeparator.length),[t,e]}remove(){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,e]=this._adjustRangeWithSeparators(t,e);var s=this.value.slice(0,t),u=this.value.slice(e),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+u));var r=this._separatorsCountFromSlice(s);return new h({tailShift:(r-a)*this.thousandsSeparator.length})}nearestInputPos(t,s){if(!this.thousandsSeparator)return t;switch(s){case e.NONE:case e.LEFT:case e.FORCE_LEFT:var u=this._findSeparatorAround(t-1);if(u>=0){var a=u+this.thousandsSeparator.length;if(t<a||this.value.length<=a||s===e.FORCE_LEFT)return u}break;case e.RIGHT:case e.FORCE_RIGHT:var r=this._findSeparatorAround(t);if(r>=0)return r+this.thousandsSeparator.length}return t}doValidate(t){var e=(t.input?this._numberRegExpInput:this._numberRegExp).test(this._removeThousandsSeparators(this.value));if(e){var s=this.number;e=e&&!isNaN(s)&&(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(){if(this.value){var t=this.number,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));var s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(t){var 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){if(!t)return t;var e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,".")}set unmaskedValue(t){super.unmaskedValue=t.replace(".",this.radix)}get number(){return Number(this.unmaskedValue)}set number(t){this.unmaskedValue=String(t)}get typedValue(){return this.number}set typedValue(t){this.number=t}get allowNegative(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}E.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};class b extends o{constructor(t){super(r({},b.DEFAULTS,{},t)),this.currentMask=null}_update(t){super._update(t),"mask"in t&&(this.compiledMasks=Array.isArray(t.mask)?t.mask.map(t=>p(t)):[])}_appendCharRaw(){var t=this._applyDispatch(...arguments);return this.currentMask&&t.aggregate(this.currentMask._appendChar(...arguments)),t}_applyDispatch(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,u=this.rawInputValue,a=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:u,i=u.slice(a.length),n=this.currentMask,l=new h,o=n&&n.state;if(this.currentMask=this.doDispatch(t,r({},e)),this.currentMask)if(this.currentMask!==n){this.currentMask.reset();var d=this.currentMask.append(a,{raw:!0});l.tailShift=d.inserted.length-s.length,i&&(l.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)}else this.currentMask.state=o;return l}_appendPlaceholder(){var t=this._applyDispatch(...arguments);return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}doDispatch(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.dispatch(t,this,e)}doValidate(){return super.doValidate(...arguments)&&(!this.currentMask||this.currentMask.doValidate(...arguments))}reset(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.currentMask?this.currentMask.value:""}set value(t){super.value=t}get unmaskedValue(){return this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.currentMask?this.currentMask.typedValue:""}set typedValue(t){var e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}get isComplete(){return!!this.currentMask&&this.currentMask.isComplete}remove(){var t=new h;return this.currentMask&&t.aggregate(this.currentMask.remove(...arguments)).aggregate(this._applyDispatch()),t}get state(){return r({},super.state,{_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:this.currentMask&&this.currentMask.state})}set state(t){var{compiledMasks:e,currentMaskRef:s,currentMask:u}=t,a=i(t,["compiledMasks","currentMaskRef","currentMask"]);this.compiledMasks.forEach((t,s)=>t.state=e[s]),null!=s&&(this.currentMask=s,this.currentMask.state=u),super.state=a}extractInput(){return this.currentMask?this.currentMask.extractInput(...arguments):""}extractTail(){return this.currentMask?this.currentMask.extractTail(...arguments):super.extractTail(...arguments)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(){return this.currentMask?this.currentMask.nearestInputPos(...arguments):super.nearestInputPos(...arguments)}}function D(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new F(t,e)}b.DEFAULTS={dispatch:(t,e,s)=>{if(e.compiledMasks.length){var u=e.rawInputValue,a=e.compiledMasks.map((e,a)=>{return e.reset(),e.append(u,{raw:!0}),e.append(t,s),{weight:e.rawInputValue.length,index:a}});return a.sort((t,e)=>e.weight-t.weight),e.compiledMasks[a[0].index]}}},D.InputMask=F,D.Masked=o,D.MaskedPattern=k,D.MaskedEnum=class extends k{_update(t){t.enum&&(t.mask="*".repeat(t.enum[0].length)),super._update(t)}doValidate(){return this.enum.some(t=>t.indexOf(this.unmaskedValue)>=0)&&super.doValidate(...arguments)}},D.MaskedRange=_,D.MaskedNumber=E,D.MaskedDate=f,D.MaskedRegExp=class extends o{_update(t){t.mask&&(t.validate=e=>e.search(t.mask)>=0),super._update(t)}},D.MaskedFunction=class extends o{_update(t){t.mask&&(t.validate=t.mask),super._update(t)}},D.MaskedDynamic=b,D.createMask=p,D.MaskElement=A,D.HTMLMaskElement=C,u.IMask=D;export default D;
//# 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=t||self).IMask=e()}(this,function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n,u,i,r,a="object",s=function(t){return t&&t.Math==Math&&t},o=s(typeof globalThis==a&&globalThis)||s(typeof window==a&&window)||s(typeof self==a&&self)||s(typeof t==a&&t)||Function("return this")(),l=function(t){try{return!!t()}catch(t){return!0}},h=!l(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),c={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,p={f:f&&!c.call({1:2},1)?function(t){var e=f(this,t);return!!e&&e.enumerable}:c},d=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v={}.toString,k="".split,g=l(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==function(t){return v.call(t).slice(8,-1)}(t)?k.call(t,""):Object(t)}:Object,y=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},m=function(t){return g(y(t))},_=function(t){return"object"==typeof t?null!==t:"function"==typeof t},A=function(t,e){if(!_(t))return t;var n,u;if(e&&"function"==typeof(n=t.toString)&&!_(u=n.call(t)))return u;if("function"==typeof(n=t.valueOf)&&!_(u=n.call(t)))return u;if(!e&&"function"==typeof(n=t.toString)&&!_(u=n.call(t)))return u;throw TypeError("Can't convert object to primitive value")},C={}.hasOwnProperty,F=function(t,e){return C.call(t,e)},E=o.document,b=_(E)&&_(E.createElement),S=!h&&!l(function(){return 7!=Object.defineProperty((t="div",b?E.createElement(t):{}),"a",{get:function(){return 7}}).a;var t}),B=Object.getOwnPropertyDescriptor,D={f:h?B:function(t,e){if(t=m(t),e=A(e,!0),S)try{return B(t,e)}catch(t){}if(F(t,e))return d(!p.f.call(t,e),t[e])}},w=function(t){if(!_(t))throw TypeError(String(t)+" is not an object");return t},T=Object.defineProperty,x={f:h?T:function(t,e,n){if(w(t),e=A(e,!0),w(n),S)try{return T(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}},P=h?function(t,e,n){return x.f(t,e,d(1,n))}:function(t,e,n){return t[e]=n,t},O=function(t,e){try{P(o,t,e)}catch(n){o[t]=e}return e},M=e(function(t){var e=o["__core-js_shared__"]||O("__core-js_shared__",{});(t.exports=function(t,n){return e[t]||(e[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),I=M("native-function-to-string",Function.toString),R=o.WeakMap,V="function"==typeof R&&/native code/.test(I.call(R)),j=0,N=Math.random(),L=M("keys"),H={},G=o.WeakMap;if(V){var z=new G,U=z.get,Y=z.has,Z=z.set;n=function(t,e){return Z.call(z,t,e),e},u=function(t){return U.call(z,t)||{}},i=function(t){return Y.call(z,t)}}else{var W=L[r="state"]||(L[r]=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++j+N).toString(36)}(r));H[W]=!0,n=function(t,e){return P(t,W,e),e},u=function(t){return F(t,W)?t[W]:{}},i=function(t){return F(t,W)}}var $={set:n,get:u,has:i,enforce:function(t){return i(t)?u(t):n(t,{})},getterFor:function(t){return function(e){var n;if(!_(e)||(n=u(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},K=e(function(t){var e=$.get,n=$.enforce,u=String(I).split("toString");M("inspectSource",function(t){return I.call(t)}),(t.exports=function(t,e,i,r){var a=!!r&&!!r.unsafe,s=!!r&&!!r.enumerable,l=!!r&&!!r.noTargetGet;"function"==typeof i&&("string"!=typeof e||F(i,"name")||P(i,"name",e),n(i).source=u.join("string"==typeof e?e:"")),t!==o?(a?!l&&t[e]&&(s=!0):delete t[e],s?t[e]=i:P(t,e,i)):s?t[e]=i:O(e,i)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||I.call(this)})}),q=o,J=function(t){return"function"==typeof t?t:void 0},Q=function(t,e){return arguments.length<2?J(q[t])||J(o[t]):q[t]&&q[t][e]||o[t]&&o[t][e]},X=Math.ceil,tt=Math.floor,et=function(t){return isNaN(t=+t)?0:(t>0?tt:X)(t)},nt=Math.min,ut=function(t){return t>0?nt(et(t),9007199254740991):0},it=Math.max,rt=Math.min,at=function(t){return function(e,n,u){var i,r=m(e),a=ut(r.length),s=function(t,e){var n=et(t);return n<0?it(n+e,0):rt(n,e)}(u,a);if(t&&n!=n){for(;a>s;)if((i=r[s++])!=i)return!0}else for(;a>s;s++)if((t||s in r)&&r[s]===n)return t||s||0;return!t&&-1}},st={includes:at(!0),indexOf:at(!1)}.indexOf,ot=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),lt={f:Object.getOwnPropertyNames||function(t){return function(t,e){var n,u=m(t),i=0,r=[];for(n in u)!F(H,n)&&F(u,n)&&r.push(n);for(;e.length>i;)F(u,n=e[i++])&&(~st(r,n)||r.push(n));return r}(t,ot)}},ht={f:Object.getOwnPropertySymbols},ct=Q("Reflect","ownKeys")||function(t){var e=lt.f(w(t)),n=ht.f;return n?e.concat(n(t)):e},ft=function(t,e){for(var n=ct(e),u=x.f,i=D.f,r=0;r<n.length;r++){var a=n[r];F(t,a)||u(t,a,i(e,a))}},pt=/#|\.prototype\./,dt=function(t,e){var n=kt[vt(t)];return n==yt||n!=gt&&("function"==typeof e?l(e):!!e)},vt=dt.normalize=function(t){return String(t).replace(pt,".").toLowerCase()},kt=dt.data={},gt=dt.NATIVE="N",yt=dt.POLYFILL="P",mt=dt,_t=D.f,At=function(t,e){var n,u,i,r,a,s=t.target,l=t.global,h=t.stat;if(n=l?o:h?o[s]||O(s,{}):(o[s]||{}).prototype)for(u in e){if(r=e[u],i=t.noTargetGet?(a=_t(n,u))&&a.value:n[u],!mt(l?u:s+(h?".":"#")+u,t.forced)&&void 0!==i){if(typeof r==typeof i)continue;ft(r,i)}(t.sham||i&&i.sham)&&P(r,"sham",!0),K(n,u,r,t)}},Ct="".repeat||function(t){var e=String(y(this)),n="",u=et(t);if(u<0||u==1/0)throw RangeError("Wrong number of repetitions");for(;u>0;(u>>>=1)&&(e+=e))1&u&&(n+=e);return n},Ft=Math.ceil,Et=function(t){return function(e,n,u){var i,r,a=String(y(e)),s=a.length,o=void 0===u?" ":String(u),l=ut(n);return l<=s||""==o?a:(i=l-s,(r=Ct.call(o,Ft(i/o.length))).length>i&&(r=r.slice(0,i)),t?a+r:r+a)}},bt={start:Et(!1),end:Et(!0)},St=Q("navigator","userAgent")||"",Bt=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(St),Dt=bt.end;At({target:"String",proto:!0,forced:Bt},{padEnd:function(t){return Dt(this,t,arguments.length>1?arguments[1]:void 0)}});var wt=bt.start;function Tt(t){return(Tt="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})(t)}function xt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Pt(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)}}function Ot(t,e,n){return e&&Pt(t.prototype,e),n&&Pt(t,n),t}function Mt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function It(){return(It=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}).apply(this,arguments)}function Rt(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},u=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(u=u.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),u.forEach(function(e){Mt(t,e,n[e])})}return t}function Vt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Nt(t,e)}function jt(t){return(jt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Nt(t,e){return(Nt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Lt(t,e){if(null==t)return{};var n,u,i=function(t,e){if(null==t)return{};var n,u,i={},r=Object.keys(t);for(u=0;u<r.length;u++)n=r[u],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);for(u=0;u<r.length;u++)n=r[u],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function Ht(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Gt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=jt(t)););return t}function zt(t,e,n){return(zt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var u=Gt(t,e);if(u){var i=Object.getOwnPropertyDescriptor(u,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function Ut(t,e,n,u){return(Ut="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,u){var i,r=Gt(t,e);if(r){if((i=Object.getOwnPropertyDescriptor(r,e)).set)return i.set.call(u,n),!0;if(!i.writable)return!1}if(i=Object.getOwnPropertyDescriptor(u,e)){if(!i.writable)return!1;i.value=n,Object.defineProperty(u,e,i)}else Mt(u,e,n);return!0})(t,e,n,u)}function Yt(t,e,n,u,i){if(!Ut(t,e,n,u||t)&&i)throw new Error("failed to set property");return n}function Zt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],u=!0,i=!1,r=void 0;try{for(var a,s=t[Symbol.iterator]();!(u=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);u=!0);}catch(t){i=!0,r=t}finally{try{u||null==s.return||s.return()}finally{if(i)throw r}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Wt(t){return"string"==typeof t||t instanceof String}At({target:"String",proto:!0,forced:Bt},{padStart:function(t){return wt(this,t,arguments.length>1?arguments[1]:void 0)}}),At({target:"String",proto:!0},{repeat:Ct});var $t={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Kt(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}var qt="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{},Jt=function(){function t(e,n,u,i){for(xt(this,t),this.value=e,this.cursorPos=n,this.oldValue=u,this.oldSelection=i;this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start}return Ot(t,[{key:"startChangePos",get:function(){return Math.min(this.cursorPos,this.oldSelection.start)}},{key:"insertedCount",get:function(){return this.cursorPos-this.startChangePos}},{key:"inserted",get:function(){return this.value.substr(this.startChangePos,this.insertedCount)}},{key:"removedCount",get:function(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}},{key:"removed",get:function(){return this.oldValue.substr(this.startChangePos,this.removedCount)}},{key:"head",get:function(){return this.value.substring(0,this.startChangePos)}},{key:"tail",get:function(){return this.value.substring(this.startChangePos+this.insertedCount)}},{key:"removeDirection",get:function(){return!this.removedCount||this.insertedCount?$t.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?$t.RIGHT:$t.LEFT}}]),t}(),Qt=function(){function t(e){xt(this,t),It(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},e)}return Ot(t,[{key:"aggregate",value:function(t){return this.rawInserted+=t.rawInserted,this.skip=this.skip||t.skip,this.inserted+=t.inserted,this.tailShift+=t.tailShift,this}},{key:"offset",get:function(){return this.tailShift+this.inserted.length}}]),t}(),Xt=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2?arguments[2]:void 0;xt(this,t),this.value=e,this.from=n,this.stop=u}return Ot(t,[{key:"toString",value:function(){return this.value}},{key:"extend",value:function(t){this.value+=String(t)}},{key:"appendTo",value:function(t){return t.append(this.toString(),{tail:!0})}},{key:"shiftBefore",value:function(t){if(this.from>=t||!this.value.length)return"";var e=this.value[0];return this.value=this.value.slice(1),e}},{key:"state",get:function(){return{value:this.value,from:this.from,stop:this.stop}},set:function(t){It(this,t)}}]),t}(),te=function(){function t(e){xt(this,t),this._value="",this._update(e),this.isInitialized=!0}return Ot(t,[{key:"updateOptions",value:function(t){Object.keys(t).length&&this.withValueRefresh(this._update.bind(this,t))}},{key:"_update",value:function(t){It(this,t)}},{key:"reset",value:function(){this._value=""}},{key:"resolve",value:function(t){return this.reset(),this.append(t,{input:!0},""),this.doCommit(),this.value}},{key:"nearestInputPos",value:function(t,e){return t}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e)}},{key:"extractTail",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new Xt(this.extractInput(t,e),t)}},{key:"_storeBeforeTailState",value:function(){this._beforeTailState=this.state}},{key:"_restoreBeforeTailState",value:function(){this.state=this._beforeTailState}},{key:"_resetBeforeTailState",value:function(){this._beforeTailState=null}},{key:"appendTail",value:function(t){return Wt(t)&&(t=new Xt(String(t))),t.appendTo(this)}},{key:"_appendCharRaw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(t=this.doPrepare(t,e))?(this._value+=t,new Qt({inserted:t,rawInserted:t})):new Qt}},{key:"_appendChar",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,u=this.state,i=this._appendCharRaw(t,e);if(i.inserted){var r,a=!1!==this.doValidate(e);if(a&&null!=n){this._storeBeforeTailState(),this.overwrite&&(r=n.state,n.shiftBefore(this.value.length));var s=this.appendTail(n);(a=s.rawInserted===n.toString())&&s.inserted&&this._restoreBeforeTailState()}a||(i.rawInserted=i.inserted="",this.state=u,n&&r&&(n.state=r))}return i}},{key:"append",value:function(t,e,n){if(!Wt(t))throw new Error("value should be string");for(var u=new Qt,i=Wt(n)?new Xt(String(n)):n,r=0;r<t.length;++r)u.aggregate(this._appendChar(t[r],e,i));return null!=i&&(this._storeBeforeTailState(),u.tailShift+=this.appendTail(i).tailShift),u}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this._value=this.value.slice(0,t)+this.value.slice(e),new Qt}},{key:"withValueRefresh",value:function(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;var e=this.unmaskedValue,n=this.value,u=t();return this.resolve(n)!==n&&(this.unmaskedValue=e),delete this._refreshing,u}},{key:"doPrepare",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare?this.prepare(t,this,e):t}},{key:"doValidate",value:function(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}},{key:"doCommit",value:function(){this.commit&&this.commit(this.value,this)}},{key:"splice",value:function(t,e,n,u){var i=t+e,r=this.extractTail(i),a=this.nearestInputPos(t,u);return new Qt({tailShift:a-t}).aggregate(this.remove(a)).aggregate(this.append(n,{input:!0},r))}},{key:"state",get:function(){return{_value:this.value}},set:function(t){this._value=t._value}},{key:"value",get:function(){return this._value},set:function(t){this.resolve(t)}},{key:"unmaskedValue",get:function(){return this.value},set:function(t){this.reset(),this.append(t,{},""),this.doCommit()}},{key:"typedValue",get:function(){return this.unmaskedValue},set:function(t){this.unmaskedValue=t}},{key:"rawInputValue",get:function(){return this.extractInput(0,this.value.length,{raw:!0})},set:function(t){this.reset(),this.append(t,{raw:!0},""),this.doCommit()}},{key:"isComplete",get:function(){return!0}}]),t}();function ee(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?qt.IMask.MaskedRegExp:Wt(t)?qt.IMask.MaskedPattern:t instanceof Date||t===Date?qt.IMask.MaskedDate:t instanceof Number||"number"==typeof t||t===Number?qt.IMask.MaskedNumber:Array.isArray(t)||t===Array?qt.IMask.MaskedDynamic:t.prototype instanceof qt.IMask.Masked?t:t instanceof Function?qt.IMask.MaskedFunction:(console.warn("Mask not found for mask",t),qt.IMask.Masked)}function ne(t){var e=(t=Rt({},t)).mask;return e instanceof qt.IMask.Masked?e:new(ee(e))(t)}var ue={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]/,"*":/./},ie=function(){function t(e){xt(this,t);var n=e.mask,u=Lt(e,["mask"]);this.masked=ne({mask:n}),It(this,u)}return Ot(t,[{key:"reset",value:function(){this._isFilled=!1,this.masked.reset()}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return 0===t&&e>=1?(this._isFilled=!1,this.masked.remove(t,e)):new Qt}},{key:"_appendChar",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._isFilled)return new Qt;var n=this.masked.state,u=this.masked._appendChar(t,e);return u.inserted&&!1===this.doValidate(e)&&(u.inserted=u.rawInserted="",this.masked.state=n),u.inserted||this.isOptional||this.lazy||e.input||(u.inserted=this.placeholderChar),u.skip=!u.inserted&&!this.isOptional,this._isFilled=Boolean(u.inserted),u}},{key:"append",value:function(){var t;return(t=this.masked).append.apply(t,arguments)}},{key:"_appendPlaceholder",value:function(){var t=new Qt;return this._isFilled||this.isOptional?t:(this._isFilled=!0,t.inserted=this.placeholderChar,t)}},{key:"extractTail",value:function(){var t;return(t=this.masked).extractTail.apply(t,arguments)}},{key:"appendTail",value:function(){var t;return(t=this.masked).appendTail.apply(t,arguments)}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2?arguments[2]:void 0;return this.masked.extractInput(t,e,n)}},{key:"nearestInputPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t.NONE,n=this.value.length,u=Math.min(Math.max(t,0),n);switch(e){case $t.LEFT:case $t.FORCE_LEFT:return this.isComplete?u:0;case $t.RIGHT:case $t.FORCE_RIGHT:return this.isComplete?u:n;case $t.NONE:default:return u}}},{key:"doValidate",value:function(){var t,e;return(t=this.masked).doValidate.apply(t,arguments)&&(!this.parent||(e=this.parent).doValidate.apply(e,arguments))}},{key:"doCommit",value:function(){this.masked.doCommit()}},{key:"value",get:function(){return this.masked.value||(this._isFilled&&!this.isOptional?this.placeholderChar:"")}},{key:"unmaskedValue",get:function(){return this.masked.unmaskedValue}},{key:"isComplete",get:function(){return Boolean(this.masked.value)||this.isOptional}},{key:"state",get:function(){return{masked:this.masked.state,_isFilled:this._isFilled}},set:function(t){this.masked.state=t.masked,this._isFilled=t._isFilled}}]),t}(),re=function(){function t(e){xt(this,t),It(this,e),this._value=""}return Ot(t,[{key:"reset",value:function(){this._isRawInput=!1,this._value=""}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new Qt}},{key:"nearestInputPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t.NONE,n=this._value.length;switch(e){case $t.LEFT:case $t.FORCE_LEFT:return 0;case $t.NONE:case $t.RIGHT:case $t.FORCE_RIGHT:default:return n}}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).raw&&this._isRawInput&&this._value.slice(t,e)||""}},{key:"_appendChar",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Qt;if(this._value)return n;var u=this.char===t[0]&&(this.isUnmasking||e.input||e.raw)&&!e.tail;return u&&(n.rawInserted=this.char),this._value=n.inserted=this.char,this._isRawInput=u&&(e.raw||e.input),n}},{key:"_appendPlaceholder",value:function(){var t=new Qt;return this._value?t:(this._value=t.inserted=this.char,t)}},{key:"extractTail",value:function(){arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new Xt("")}},{key:"appendTail",value:function(t){return Wt(t)&&(t=new Xt(String(t))),t.appendTo(this)}},{key:"append",value:function(t,e,n){var u=this._appendChar(t,e);return null!=n&&(u.tailShift+=this.appendTail(n).tailShift),u}},{key:"doCommit",value:function(){}},{key:"value",get:function(){return this._value}},{key:"unmaskedValue",get:function(){return this.isUnmasking?this.value:""}},{key:"isComplete",get:function(){return!0}},{key:"state",get:function(){return{_value:this._value,_isRawInput:this._isRawInput}},set:function(t){It(this,t)}}]),t}(),ae=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;xt(this,t),this.chunks=e,this.from=n}return Ot(t,[{key:"toString",value:function(){return this.chunks.map(String).join("")}},{key:"extend",value:function(e){if(String(e)){Wt(e)&&(e=new Xt(String(e)));var n=this.chunks[this.chunks.length-1],u=n&&(n.stop===e.stop||null==e.stop)&&e.from===n.from+n.toString().length;if(e instanceof Xt)u?n.extend(e.toString()):this.chunks.push(e);else if(e instanceof t){if(null==e.stop)for(var i;e.chunks.length&&null==e.chunks[0].stop;)(i=e.chunks.shift()).from+=e.from,this.extend(i);e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}}},{key:"appendTo",value:function(e){if(!(e instanceof qt.IMask.MaskedPattern))return new Xt(this.toString()).appendTo(e);for(var n=new Qt,u=0;u<this.chunks.length&&!n.skip;++u){var i=this.chunks[u],r=e._mapPosToBlock(e.value.length),a=i.stop,s=void 0;if(a&&(!r||r.index<=a)&&((i instanceof t||e._stops.indexOf(a)>=0)&&n.aggregate(e._appendPlaceholder(a)),s=i instanceof t&&e._blocks[a]),s){var o=s.appendTail(i);o.skip=!1,n.aggregate(o),e._value+=o.inserted;var l=i.toString().slice(o.rawInserted.length);l&&n.aggregate(e.append(l,{tail:!0}))}else n.aggregate(e.append(i.toString(),{tail:!0}))}return n}},{key:"shiftBefore",value:function(t){if(this.from>=t||!this.chunks.length)return"";for(var e=t-this.from,n=0;n<this.chunks.length;){var u=this.chunks[n],i=u.shiftBefore(e);if(u.toString()){if(!i)break;++n}else this.chunks.splice(n,1);if(i)return i}return""}},{key:"state",get:function(){return{chunks:this.chunks.map(function(t){return t.state}),from:this.from,stop:this.stop,blockIndex:this.blockIndex}},set:function(e){var n=e.chunks;It(this,Lt(e,["chunks"])),this.chunks=n.map(function(e){var n="chunks"in e?new t:new Xt;return n.state=e,n})}}]),t}(),se=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return xt(this,e),t.definitions=It({},ue,t.definitions),Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,t)))}return Vt(e,te),Ot(e,[{key:"_update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=It({},this.definitions,t.definitions),zt(jt(e.prototype),"_update",this).call(this,t),this._rebuildMask()}},{key:"_rebuildMask",value:function(){var t=this,n=this.definitions;this._blocks=[],this._stops=[],this._maskedBlocks={};var u=this.mask;if(u&&n)for(var i=!1,r=!1,a=0;a<u.length;++a){if(this.blocks)if("continue"===function(){var e=u.slice(a),n=Object.keys(t.blocks).filter(function(t){return 0===e.indexOf(t)});n.sort(function(t,e){return e.length-t.length});var i=n[0];if(i){var r=ne(Rt({parent:t,lazy:t.lazy,placeholderChar:t.placeholderChar},t.blocks[i]));return r&&(t._blocks.push(r),t._maskedBlocks[i]||(t._maskedBlocks[i]=[]),t._maskedBlocks[i].push(t._blocks.length-1)),a+=i.length-1,"continue"}}())continue;var s=u[a],o=s in n;if(s!==e.STOP_CHAR)if("{"!==s&&"}"!==s)if("["!==s&&"]"!==s){if(s===e.ESCAPE_CHAR){if(!(s=u[++a]))break;o=!1}var l=o?new ie({parent:this,lazy:this.lazy,placeholderChar:this.placeholderChar,mask:n[s],isOptional:r}):new re({char:s,isUnmasking:i});this._blocks.push(l)}else r=!r;else i=!i;else this._stops.push(this._blocks.length)}}},{key:"_storeBeforeTailState",value:function(){this._blocks.forEach(function(t){"function"==typeof t._storeBeforeTailState&&t._storeBeforeTailState()}),zt(jt(e.prototype),"_storeBeforeTailState",this).call(this)}},{key:"_restoreBeforeTailState",value:function(){this._blocks.forEach(function(t){"function"==typeof t._restoreBeforeTailState&&t._restoreBeforeTailState()}),zt(jt(e.prototype),"_restoreBeforeTailState",this).call(this)}},{key:"_resetBeforeTailState",value:function(){this._blocks.forEach(function(t){"function"==typeof t._resetBeforeTailState&&t._resetBeforeTailState()}),zt(jt(e.prototype),"_resetBeforeTailState",this).call(this)}},{key:"reset",value:function(){zt(jt(e.prototype),"reset",this).call(this),this._blocks.forEach(function(t){return t.reset()})}},{key:"doCommit",value:function(){this._blocks.forEach(function(t){return t.doCommit()}),zt(jt(e.prototype),"doCommit",this).call(this)}},{key:"appendTail",value:function(t){return zt(jt(e.prototype),"appendTail",this).call(this,t).aggregate(this._appendPlaceholder())}},{key:"_appendCharRaw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=this.doPrepare(t,e);var n=this._mapPosToBlock(this.value.length),u=new Qt;if(!n)return u;for(var i=n.index;;++i){var r=this._blocks[i];if(!r)break;var a=r._appendChar(t,e),s=a.skip;if(u.aggregate(a),s||a.rawInserted)break}return u}},{key:"extractTail",value: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=new ae;return e===n?u:(this._forEachBlocksInRange(e,n,function(e,n,i,r){var a=e.extractTail(i,r);a.stop=t._findStopBefore(n),a.from=t._blockStartPos(n),a instanceof ae&&(a.blockIndex=n),u.extend(a)}),u)}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";var u="";return this._forEachBlocksInRange(t,e,function(t,e,i,r){u+=t.extractInput(i,r,n)}),u}},{key:"_findStopBefore",value:function(t){for(var e,n=0;n<this._stops.length;++n){var u=this._stops[n];if(!(u<=t))break;e=u}return e}},{key:"_appendPlaceholder",value:function(t){var e=this,n=new Qt;if(this.lazy&&null==t)return n;var u=this._mapPosToBlock(this.value.length);if(!u)return n;var i=u.index,r=null!=t?t:this._blocks.length;return this._blocks.slice(i,r).forEach(function(u){if("function"==typeof u._appendPlaceholder&&(!u.lazy||null!=t)){var i=null!=u._blocks?[u._blocks.length]:[],r=u._appendPlaceholder.apply(u,i);e._value+=r.inserted,n.aggregate(r)}}),n}},{key:"_mapPosToBlock",value:function(t){for(var e="",n=0;n<this._blocks.length;++n){var u=this._blocks[n],i=e.length;if(t<=(e+=u.value).length)return{index:n,offset:t-i}}}},{key:"_blockStartPos",value:function(t){return this._blocks.slice(0,t).reduce(function(t,e){return t+e.value.length},0)}},{key:"_forEachBlocksInRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2?arguments[2]:void 0,u=this._mapPosToBlock(t);if(u){var i=this._mapPosToBlock(e),r=i&&u.index===i.index,a=u.offset,s=i&&r?i.offset:this._blocks[u.index].value.length;if(n(this._blocks[u.index],u.index,a,s),i&&!r){for(var o=u.index+1;o<i.index;++o)n(this._blocks[o],o,0,this._blocks[o].value.length);n(this._blocks[i.index],i.index,0,i.offset)}}}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,u=zt(jt(e.prototype),"remove",this).call(this,t,n);return this._forEachBlocksInRange(t,n,function(t,e,n,i){u.aggregate(t.remove(n,i))}),u}},{key:"nearestInputPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t.NONE,n=this._mapPosToBlock(t)||{index:0,offset:0},u=n.offset,i=n.index,r=this._blocks[i];if(!r)return t;var a=u;0!==a&&a<r.value.length&&(a=r.nearestInputPos(u,function(t){switch(t){case $t.LEFT:return $t.FORCE_LEFT;case $t.RIGHT:return $t.FORCE_RIGHT;default:return t}}(e)));var s=a===r.value.length;if(!(0===a)&&!s)return this._blockStartPos(i)+a;var o=s?i+1:i;if(e===$t.NONE){if(o>0){var l=o-1,h=this._blocks[l],c=h.nearestInputPos(0,$t.NONE);if(!h.value.length||c!==h.value.length)return this._blockStartPos(o)}for(var f=o;f<this._blocks.length;++f){var p=this._blocks[f],d=p.nearestInputPos(0,$t.NONE);if(d!==p.value.length)return this._blockStartPos(f)+d}return this.value.length}if(e===$t.LEFT||e===$t.FORCE_LEFT){for(var v,k=o;k<this._blocks.length;++k)if(this._blocks[k].value){v=k;break}if(null!=v){var g=this._blocks[v],y=g.nearestInputPos(0,$t.RIGHT);if(0===y&&g.unmaskedValue.length)return this._blockStartPos(v)+y}for(var m,_=-1,A=o-1;A>=0;--A){var C=this._blocks[A],F=C.nearestInputPos(C.value.length,$t.FORCE_LEFT);if(null!=m||C.value&&0===F||(m=A),0!==F){if(F!==C.value.length)return this._blockStartPos(A)+F;_=A;break}}if(e===$t.LEFT)for(var E=_+1;E<=Math.min(o,this._blocks.length-1);++E){var b=this._blocks[E],S=b.nearestInputPos(0,$t.NONE),B=this._blockStartPos(E)+S;if((!b.value.length&&B===this.value.length||S!==b.value.length)&&B<=t)return B}if(_>=0)return this._blockStartPos(_)+this._blocks[_].value.length;if(e===$t.FORCE_LEFT||this.lazy&&!this.extractInput()&&!function(t){if(!t)return!1;var e=t.value;return!e||t.nearestInputPos(0,$t.NONE)!==e.length}(this._blocks[o]))return 0;if(null!=m)return this._blockStartPos(m);for(var D=o;D<this._blocks.length;++D){var w=this._blocks[D],T=w.nearestInputPos(0,$t.NONE);if(!w.value.length||T!==w.value.length)return this._blockStartPos(D)+T}return 0}if(e===$t.RIGHT||e===$t.FORCE_RIGHT){for(var x,P,O=o;O<this._blocks.length;++O){var M=this._blocks[O],I=M.nearestInputPos(0,$t.NONE);if(I!==M.value.length){P=this._blockStartPos(O)+I,x=O;break}}if(null!=x&&null!=P){for(var R=x;R<this._blocks.length;++R){var V=this._blocks[R],j=V.nearestInputPos(0,$t.FORCE_RIGHT);if(j!==V.value.length)return this._blockStartPos(R)+j}return e===$t.FORCE_RIGHT?this.value.length:P}for(var N=Math.min(o,this._blocks.length-1);N>=0;--N){var L=this._blocks[N],H=L.nearestInputPos(L.value.length,$t.LEFT);if(0!==H){var G=this._blockStartPos(N)+H;if(G>=t)return G;break}}}return t}},{key:"maskedBlock",value:function(t){return this.maskedBlocks(t)[0]}},{key:"maskedBlocks",value:function(t){var e=this,n=this._maskedBlocks[t];return n?n.map(function(t){return e._blocks[t]}):[]}},{key:"state",get:function(){return Rt({},zt(jt(e.prototype),"state",this),{_blocks:this._blocks.map(function(t){return t.state})})},set:function(t){var n=t._blocks,u=Lt(t,["_blocks"]);this._blocks.forEach(function(t,e){return t.state=n[e]}),Yt(jt(e.prototype),"state",u,this,!0)}},{key:"isComplete",get:function(){return this._blocks.every(function(t){return t.isComplete})}},{key:"unmaskedValue",get:function(){return this._blocks.reduce(function(t,e){return t+e.unmaskedValue},"")},set:function(t){Yt(jt(e.prototype),"unmaskedValue",t,this,!0)}},{key:"value",get:function(){return this._blocks.reduce(function(t,e){return t+e.value},"")},set:function(t){Yt(jt(e.prototype),"value",t,this,!0)}}]),e}();se.DEFAULTS={lazy:!0,placeholderChar:"_"},se.STOP_CHAR="`",se.ESCAPE_CHAR="\\",se.InputDefinition=ie,se.FixedDefinition=re;var oe=function(t){function e(){return xt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,se),Ot(e,[{key:"_update",value:function(t){t=Rt({to:this.to||0,from:this.from||0},t);var n=String(t.to).length;null!=t.maxLength&&(n=Math.max(n,t.maxLength)),t.maxLength=n;for(var u=String(t.from).padStart(n,"0"),i=String(t.to).padStart(n,"0"),r=0;r<i.length&&i[r]===u[r];)++r;t.mask=i.slice(0,r).replace(/0/g,"\\0")+"0".repeat(n-r),zt(jt(e.prototype),"_update",this).call(this,t)}},{key:"boundaries",value:function(t){var e="",n="",u=Zt(t.match(/^(\D*)(\d*)(\D*)/)||[],3),i=u[1],r=u[2];return r&&(e="0".repeat(i.length)+r,n="9".repeat(i.length)+r),[e=e.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9")]}},{key:"doPrepare",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t=zt(jt(e.prototype),"doPrepare",this).call(this,t,n).replace(/\D/g,""),!this.autofix)return t;for(var u=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0"),r=this.value,a="",s=0;s<t.length;++s){var o=r+a+t[s],l=Zt(this.boundaries(o),2),h=l[0],c=l[1];Number(c)<this.from?a+=u[o.length-1]:Number(h)>this.to?a+=i[o.length-1]:a+=t[s]}return a}},{key:"doValidate",value:function(){var t,n=this.value;if(-1===n.search(/[^0]/)&&n.length<=this._matchFrom)return!0;for(var u=Zt(this.boundaries(n),2),i=u[0],r=u[1],a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return this.from<=Number(r)&&Number(i)<=this.to&&(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(s))}},{key:"_matchFrom",get:function(){return this.maxLength-String(this.from).length}},{key:"isComplete",get:function(){return zt(jt(e.prototype),"isComplete",this)&&Boolean(this.value)}}]),e}(),le=function(t){function e(t){return xt(this,e),Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,t)))}return Vt(e,se),Ot(e,[{key:"_update",value:function(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern);var n=t.blocks;t.blocks=It({},e.GET_DEFAULT_BLOCKS()),t.min&&(t.blocks.Y.from=t.min.getFullYear()),t.max&&(t.blocks.Y.to=t.max.getFullYear()),t.min&&t.max&&t.blocks.Y.from===t.blocks.Y.to&&(t.blocks.m.from=t.min.getMonth()+1,t.blocks.m.to=t.max.getMonth()+1,t.blocks.m.from===t.blocks.m.to&&(t.blocks.d.from=t.min.getDate(),t.blocks.d.to=t.max.getDate())),It(t.blocks,n),Object.keys(t.blocks).forEach(function(e){var n=t.blocks[e];"autofix"in n||(n.autofix=t.autofix)}),zt(jt(e.prototype),"_update",this).call(this,t)}},{key:"doValidate",value:function(){for(var t,n=this.date,u=arguments.length,i=new Array(u),r=0;r<u;r++)i[r]=arguments[r];return(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(i))&&(!this.isComplete||this.isDateExist(this.value)&&null!=n&&(null==this.min||this.min<=n)&&(null==this.max||n<=this.max))}},{key:"isDateExist",value:function(t){return this.format(this.parse(t))===t}},{key:"date",get:function(){return this.isComplete?this.parse(this.value):null},set:function(t){this.value=this.format(t)}},{key:"typedValue",get:function(){return this.date},set:function(t){this.date=t}}]),e}();le.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=Zt(t.split("."),3),n=e[0],u=e[1],i=e[2];return new Date(i,u-1,n)}},le.GET_DEFAULT_BLOCKS=function(){return{d:{mask:oe,from:1,to:31,maxLength:2},m:{mask:oe,from:1,to:12,maxLength:2},Y:{mask:oe,from:1900,to:9999}}};var he=function(){function t(){xt(this,t)}return Ot(t,[{key:"select",value:function(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch(t){}}},{key:"_unsafeSelect",value:function(t,e){}},{key:"bindEvents",value:function(t){}},{key:"unbindEvents",value:function(){}},{key:"selectionStart",get:function(){var t;try{t=this._unsafeSelectionStart}catch(t){}return null!=t?t:this.value.length}},{key:"selectionEnd",get:function(){var t;try{t=this._unsafeSelectionEnd}catch(t){}return null!=t?t:this.value.length}},{key:"isActive",get:function(){return!1}}]),t}(),ce=function(t){function e(t){var n;return xt(this,e),(n=Ht(this,jt(e).call(this))).input=t,n._handlers={},n}return Vt(e,he),Ot(e,[{key:"_unsafeSelect",value:function(t,e){this.input.setSelectionRange(t,e)}},{key:"bindEvents",value:function(t){var n=this;Object.keys(t).forEach(function(u){return n._toggleEventHandler(e.EVENTS_MAP[u],t[u])})}},{key:"unbindEvents",value:function(){var t=this;Object.keys(this._handlers).forEach(function(e){return t._toggleEventHandler(e)})}},{key:"_toggleEventHandler",value:function(t,e){this._handlers[t]&&(this.input.removeEventListener(t,this._handlers[t]),delete this._handlers[t]),e&&(this.input.addEventListener(t,e),this._handlers[t]=e)}},{key:"isActive",get:function(){return this.input===document.activeElement}},{key:"_unsafeSelectionStart",get:function(){return this.input.selectionStart}},{key:"_unsafeSelectionEnd",get:function(){return this.input.selectionEnd}},{key:"value",get:function(){return this.input.value},set:function(t){this.input.value=t}}]),e}();ce.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"};var fe=function(){function t(e,n){xt(this,t),this.el=e instanceof he?e:new ce(e),this.masked=ne(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._onFocus=this._onFocus.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}return Ot(t,[{key:"_bindEvents",value:function(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this.alignCursorFriendly,focus:this._onFocus,commit:this._onChange})}},{key:"_unbindEvents",value:function(){this.el.unbindEvents()}},{key:"_fireEvent",value:function(t){var e=this._listeners[t];e&&e.forEach(function(t){return t()})}},{key:"_saveSelection",value:function(){this.value!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}},{key:"updateValue",value:function(){this.masked.value=this.el.value,this._value=this.masked.value}},{key:"updateControl",value: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()}},{key:"updateOptions",value:function(t){var e=t.mask,n=Lt(t,["mask"]);this.mask=e,function t(e,n){if(n===e)return!0;var u,i=Array.isArray(n),r=Array.isArray(e);if(i&&r){if(n.length!=e.length)return!1;for(u=0;u<n.length;u++)if(!t(n[u],e[u]))return!1;return!0}if(i!=r)return!1;if(n&&e&&"object"===Tt(n)&&"object"===Tt(e)){var a=n instanceof Date,s=e instanceof Date;if(a&&s)return n.getTime()==e.getTime();if(a!=s)return!1;var o=n instanceof RegExp,l=e instanceof RegExp;if(o&&l)return n.toString()==e.toString();if(o!=l)return!1;var h=Object.keys(n);for(u=0;u<h.length;u++)if(!Object.prototype.hasOwnProperty.call(e,h[u]))return!1;for(u=0;u<h.length;u++)if(!t(e[h[u]],n[h[u]]))return!1;return!0}return!(!n||!e||"function"!=typeof n||"function"!=typeof e)&&n.toString()===e.toString()}(this.masked,n)||this.masked.updateOptions(n),this.updateControl()}},{key:"updateCursor",value:function(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}},{key:"_delayUpdateCursor",value:function(t){var e=this;this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(function(){e.el&&(e.cursorPos=e._changingCursorPos,e._abortUpdateCursor())},10)}},{key:"_fireChangeEvents",value:function(){this._fireEvent("accept"),this.masked.isComplete&&this._fireEvent("complete")}},{key:"_abortUpdateCursor",value:function(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}},{key:"alignCursor",value:function(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,$t.LEFT)}},{key:"alignCursorFriendly",value:function(){this.selectionStart===this.cursorPos&&this.alignCursor()}},{key:"on",value:function(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}},{key:"off",value:function(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;var n=this._listeners[t].indexOf(e);return n>=0&&this._listeners[t].splice(n,1),this}},{key:"_onInput",value:function(){if(this._abortUpdateCursor(),!this._selection)return this.updateValue();var t=new Jt(this.el.value,this.cursorPos,this.value,this._selection),e=this.masked.rawInputValue,n=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,u=e===this.masked.rawInputValue?t.removeDirection:$t.NONE,i=this.masked.nearestInputPos(t.startChangePos+n,u);this.updateControl(),this.updateCursor(i)}},{key:"_onChange",value:function(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}},{key:"_onDrop",value:function(t){t.preventDefault(),t.stopPropagation()}},{key:"_onFocus",value:function(t){this.selectionStart===this.cursorPos&&(this._selection&&(this.cursorPos=this._selection.end),this.alignCursorFriendly())}},{key:"destroy",value:function(){this._unbindEvents(),this._listeners.length=0,delete this.el}},{key:"mask",get:function(){return this.masked.mask},set:function(t){if(!(null==t||t===this.masked.mask||t===Date&&this.masked instanceof le))if(this.masked.constructor!==ee(t)){var e=ne({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}else this.masked.updateOptions({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:"typedValue",get:function(){return this.masked.typedValue},set:function(t){this.masked.typedValue=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.isActive&&(this.el.select(t,t),this._saveSelection())}}]),t}(),pe=function(t){function e(){return xt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,se),Ot(e,[{key:"_update",value:function(t){t.enum&&(t.mask="*".repeat(t.enum[0].length)),zt(jt(e.prototype),"_update",this).call(this,t)}},{key:"doValidate",value:function(){for(var t,n=this,u=arguments.length,i=new Array(u),r=0;r<u;r++)i[r]=arguments[r];return this.enum.some(function(t){return t.indexOf(n.unmaskedValue)>=0})&&(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(i))}}]),e}(),de=function(t){function e(t){return xt(this,e),Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,t)))}return Vt(e,te),Ot(e,[{key:"_update",value:function(t){zt(jt(e.prototype),"_update",this).call(this,t),this._updateRegExps()}},{key:"_updateRegExps",value:function(){var t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+Kt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp(t+"(0|([1-9]+\\d*))?"+e),this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Kt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Kt(this.thousandsSeparator),"g")}},{key:"_removeThousandsSeparators",value:function(t){return t.replace(this._thousandsSeparatorRegExp,"")}},{key:"_insertThousandsSeparators",value:function(t){var e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}},{key:"doPrepare",value:function(t){for(var n,u=arguments.length,i=new Array(u>1?u-1:0),r=1;r<u;r++)i[r-1]=arguments[r];return(n=zt(jt(e.prototype),"doPrepare",this)).call.apply(n,[this,this._removeThousandsSeparators(t.replace(this._mapToRadixRegExp,this.radix))].concat(i))}},{key:"_separatorsCount",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=0,u=0;u<t;++u)this._value.indexOf(this.thousandsSeparator,u)===u&&(++n,e&&(t+=this.thousandsSeparator.length));return n}},{key:"_separatorsCountFromSlice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._value;return this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,u=arguments.length>2?arguments[2]:void 0,i=Zt(this._adjustRangeWithSeparators(t,n),2);return t=i[0],n=i[1],this._removeThousandsSeparators(zt(jt(e.prototype),"extractInput",this).call(this,t,n,u))}},{key:"_appendCharRaw",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.thousandsSeparator)return zt(jt(e.prototype),"_appendCharRaw",this).call(this,t,n);var u=this._separatorsCountFromSlice(n.tail&&this._beforeTailState?this._beforeTailState._value:this._value);this._value=this._removeThousandsSeparators(this.value);var i=zt(jt(e.prototype),"_appendCharRaw",this).call(this,t,n);this._value=this._insertThousandsSeparators(this._value);var r=this._separatorsCountFromSlice(n.tail&&this._beforeTailState?this._beforeTailState._value:this._value);return i.tailShift+=(r-u)*this.thousandsSeparator.length,i}},{key:"_findSeparatorAround",value:function(t){if(this.thousandsSeparator){var e=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,e);if(n<=t)return n}return-1}},{key:"_adjustRangeWithSeparators",value:function(t,e){var n=this._findSeparatorAround(t);n>=0&&(t=n);var u=this._findSeparatorAround(e);return u>=0&&(e=u+this.thousandsSeparator.length),[t,e]}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=Zt(this._adjustRangeWithSeparators(t,e),2);t=n[0],e=n[1];var u=this.value.slice(0,t),i=this.value.slice(e),r=this._separatorsCount(u.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(u+i));var a=this._separatorsCountFromSlice(u);return new Qt({tailShift:(a-r)*this.thousandsSeparator.length})}},{key:"nearestInputPos",value:function(t,e){if(!this.thousandsSeparator)return t;switch(e){case $t.NONE:case $t.LEFT:case $t.FORCE_LEFT:var n=this._findSeparatorAround(t-1);if(n>=0){var u=n+this.thousandsSeparator.length;if(t<u||this.value.length<=u||e===$t.FORCE_LEFT)return n}break;case $t.RIGHT:case $t.FORCE_RIGHT:var i=this._findSeparatorAround(t);if(i>=0)return i+this.thousandsSeparator.length}return t}},{key:"doValidate",value:function(t){var n=(t.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&&zt(jt(e.prototype),"doValidate",this).call(this,t)}},{key:"doCommit",value:function(){if(this.value){var t=this.number,n=t;null!=this.min&&(n=Math.max(n,this.min)),null!=this.max&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=String(n));var u=this.value;this.normalizeZeros&&(u=this._normalizeZeros(u)),this.padFractionalZeros&&(u=this._padFractionalZeros(u)),this._value=u}zt(jt(e.prototype),"doCommit",this).call(this)}},{key:"_normalizeZeros",value:function(t){var e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,function(t,e,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))}},{key:"_padFractionalZeros",value:function(t){if(!t)return t;var e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}},{key:"unmaskedValue",get:function(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,".")},set:function(t){Yt(jt(e.prototype),"unmaskedValue",t.replace(".",this.radix),this,!0)}},{key:"number",get:function(){return Number(this.unmaskedValue)},set:function(t){this.unmaskedValue=String(t)}},{key:"typedValue",get:function(){return this.number},set:function(t){this.number=t}},{key:"allowNegative",get:function(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}]),e}();de.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};var ve=function(t){function e(){return xt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,te),Ot(e,[{key:"_update",value:function(t){t.mask&&(t.validate=function(e){return e.search(t.mask)>=0}),zt(jt(e.prototype),"_update",this).call(this,t)}}]),e}(),ke=function(t){function e(){return xt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,te),Ot(e,[{key:"_update",value:function(t){t.mask&&(t.validate=t.mask),zt(jt(e.prototype),"_update",this).call(this,t)}}]),e}(),ge=function(t){function e(t){var n;return xt(this,e),(n=Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,t)))).currentMask=null,n}return Vt(e,te),Ot(e,[{key:"_update",value:function(t){zt(jt(e.prototype),"_update",this).call(this,t),"mask"in t&&(this.compiledMasks=Array.isArray(t.mask)?t.mask.map(function(t){return ne(t)}):[])}},{key:"_appendCharRaw",value:function(){var t,e=this._applyDispatch.apply(this,arguments);this.currentMask&&e.aggregate((t=this.currentMask)._appendChar.apply(t,arguments));return e}},{key:"_applyDispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.tail&&this._beforeTailState?this._beforeTailState._value:this.value,u=this.rawInputValue,i=e.tail&&this._beforeTailState?this._beforeTailState._rawInputValue:u,r=u.slice(i.length),a=this.currentMask,s=new Qt,o=a&&a.state,l=a&&a._beforeTailState;if(this.currentMask=this.doDispatch(t,e),this.currentMask)if(this.currentMask!==a){this.currentMask.reset();var h=this.currentMask.append(i,{raw:!0});s.tailShift=h.inserted.length-n.length,r&&(s.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)}else this.currentMask.state=o,this.currentMask._beforeTailState=l;return s}},{key:"doDispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.dispatch(t,this,e)}},{key:"doValidate",value:function(){for(var t,n,u=arguments.length,i=new Array(u),r=0;r<u;r++)i[r]=arguments[r];return(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(i))&&(!this.currentMask||(n=this.currentMask).doValidate.apply(n,i))}},{key:"reset",value:function(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(function(t){return t.reset()})}},{key:"remove",value:function(){var t,e=new Qt;this.currentMask&&e.aggregate((t=this.currentMask).remove.apply(t,arguments)).aggregate(this._applyDispatch());return e}},{key:"extractInput",value:function(){var t;return this.currentMask?(t=this.currentMask).extractInput.apply(t,arguments):""}},{key:"extractTail",value:function(){for(var t,n,u=arguments.length,i=new Array(u),r=0;r<u;r++)i[r]=arguments[r];return this.currentMask?(t=this.currentMask).extractTail.apply(t,i):(n=zt(jt(e.prototype),"extractTail",this)).call.apply(n,[this].concat(i))}},{key:"doCommit",value:function(){this.currentMask&&this.currentMask.doCommit(),zt(jt(e.prototype),"doCommit",this).call(this)}},{key:"nearestInputPos",value:function(){for(var t,n,u=arguments.length,i=new Array(u),r=0;r<u;r++)i[r]=arguments[r];return this.currentMask?(t=this.currentMask).nearestInputPos.apply(t,i):(n=zt(jt(e.prototype),"nearestInputPos",this)).call.apply(n,[this].concat(i))}},{key:"value",get:function(){return this.currentMask?this.currentMask.value:""},set:function(t){Yt(jt(e.prototype),"value",t,this,!0)}},{key:"unmaskedValue",get:function(){return this.currentMask?this.currentMask.unmaskedValue:""},set:function(t){Yt(jt(e.prototype),"unmaskedValue",t,this,!0)}},{key:"typedValue",get:function(){return this.currentMask?this.currentMask.typedValue:""},set:function(t){var e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}},{key:"isComplete",get:function(){return!!this.currentMask&&this.currentMask.isComplete}},{key:"state",get:function(){return Rt({},zt(jt(e.prototype),"state",this),{_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(function(t){return t.state}),currentMaskRef:this.currentMask,currentMask:this.currentMask&&this.currentMask.state})},set:function(t){var n=t.compiledMasks,u=t.currentMaskRef,i=t.currentMask,r=Lt(t,["compiledMasks","currentMaskRef","currentMask"]);this.compiledMasks.forEach(function(t,e){return t.state=n[e]}),null!=u&&(this.currentMask=u,this.currentMask.state=i),Yt(jt(e.prototype),"state",r,this,!0)}}]),e}();function ye(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new fe(t,e)}return ge.DEFAULTS={dispatch:function(t,e,n){if(e.compiledMasks.length){var u=e.rawInputValue,i=e.compiledMasks.map(function(e,i){return e.rawInputValue=u,e.append(t,n),{weight:e.rawInputValue.length,index:i}});return i.sort(function(t,e){return e.weight-t.weight}),e.compiledMasks[i[0].index]}}},ye.InputMask=fe,ye.Masked=te,ye.MaskedPattern=se,ye.MaskedEnum=pe,ye.MaskedRange=oe,ye.MaskedNumber=de,ye.MaskedDate=le,ye.MaskedRegExp=ve,ye.MaskedFunction=ke,ye.MaskedDynamic=ge,ye.createMask=ne,ye.MaskElement=he,ye.HTMLMaskElement=ce,qt.IMask=ye,ye});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).IMask=e()}(this,function(){"use strict";var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(t,e){return t(e={exports:{}},e.exports),e.exports}var n,u,r,i,a="object",s=function(t){return t&&t.Math==Math&&t},o=s(typeof globalThis==a&&globalThis)||s(typeof window==a&&window)||s(typeof self==a&&self)||s(typeof t==a&&t)||Function("return this")(),l=function(t){try{return!!t()}catch(t){return!0}},h=!l(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),c={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,p={f:f&&!c.call({1:2},1)?function(t){var e=f(this,t);return!!e&&e.enumerable}:c},d=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},v={}.toString,k="".split,g=l(function(){return!Object("z").propertyIsEnumerable(0)})?function(t){return"String"==function(t){return v.call(t).slice(8,-1)}(t)?k.call(t,""):Object(t)}:Object,y=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t},m=function(t){return g(y(t))},_=function(t){return"object"==typeof t?null!==t:"function"==typeof t},A=function(t,e){if(!_(t))return t;var n,u;if(e&&"function"==typeof(n=t.toString)&&!_(u=n.call(t)))return u;if("function"==typeof(n=t.valueOf)&&!_(u=n.call(t)))return u;if(!e&&"function"==typeof(n=t.toString)&&!_(u=n.call(t)))return u;throw TypeError("Can't convert object to primitive value")},C={}.hasOwnProperty,F=function(t,e){return C.call(t,e)},E=o.document,b=_(E)&&_(E.createElement),S=!h&&!l(function(){return 7!=Object.defineProperty((t="div",b?E.createElement(t):{}),"a",{get:function(){return 7}}).a;var t}),D=Object.getOwnPropertyDescriptor,B={f:h?D:function(t,e){if(t=m(t),e=A(e,!0),S)try{return D(t,e)}catch(t){}if(F(t,e))return d(!p.f.call(t,e),t[e])}},w=function(t){if(!_(t))throw TypeError(String(t)+" is not an object");return t},x=Object.defineProperty,P={f:h?x:function(t,e,n){if(w(t),e=A(e,!0),w(n),S)try{return x(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}},T=h?function(t,e,n){return P.f(t,e,d(1,n))}:function(t,e,n){return t[e]=n,t},O=function(t,e){try{T(o,t,e)}catch(n){o[t]=e}return e},M=e(function(t){var e=o["__core-js_shared__"]||O("__core-js_shared__",{});(t.exports=function(t,n){return e[t]||(e[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.1.3",mode:"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})}),I=M("native-function-to-string",Function.toString),R=o.WeakMap,V="function"==typeof R&&/native code/.test(I.call(R)),j=0,N=Math.random(),L=M("keys"),H={},G=o.WeakMap;if(V){var z=new G,U=z.get,Y=z.has,Z=z.set;n=function(t,e){return Z.call(z,t,e),e},u=function(t){return U.call(z,t)||{}},r=function(t){return Y.call(z,t)}}else{var W=L[i="state"]||(L[i]=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++j+N).toString(36)}(i));H[W]=!0,n=function(t,e){return T(t,W,e),e},u=function(t){return F(t,W)?t[W]:{}},r=function(t){return F(t,W)}}var $={set:n,get:u,has:r,enforce:function(t){return r(t)?u(t):n(t,{})},getterFor:function(t){return function(e){var n;if(!_(e)||(n=u(e)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return n}}},K=e(function(t){var e=$.get,n=$.enforce,u=String(I).split("toString");M("inspectSource",function(t){return I.call(t)}),(t.exports=function(t,e,r,i){var a=!!i&&!!i.unsafe,s=!!i&&!!i.enumerable,l=!!i&&!!i.noTargetGet;"function"==typeof r&&("string"!=typeof e||F(r,"name")||T(r,"name",e),n(r).source=u.join("string"==typeof e?e:"")),t!==o?(a?!l&&t[e]&&(s=!0):delete t[e],s?t[e]=r:T(t,e,r)):s?t[e]=r:O(e,r)})(Function.prototype,"toString",function(){return"function"==typeof this&&e(this).source||I.call(this)})}),q=o,J=function(t){return"function"==typeof t?t:void 0},Q=function(t,e){return arguments.length<2?J(q[t])||J(o[t]):q[t]&&q[t][e]||o[t]&&o[t][e]},X=Math.ceil,tt=Math.floor,et=function(t){return isNaN(t=+t)?0:(t>0?tt:X)(t)},nt=Math.min,ut=function(t){return t>0?nt(et(t),9007199254740991):0},rt=Math.max,it=Math.min,at=function(t){return function(e,n,u){var r,i=m(e),a=ut(i.length),s=function(t,e){var n=et(t);return n<0?rt(n+e,0):it(n,e)}(u,a);if(t&&n!=n){for(;a>s;)if((r=i[s++])!=r)return!0}else for(;a>s;s++)if((t||s in i)&&i[s]===n)return t||s||0;return!t&&-1}},st={includes:at(!0),indexOf:at(!1)}.indexOf,ot=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"].concat("length","prototype"),lt={f:Object.getOwnPropertyNames||function(t){return function(t,e){var n,u=m(t),r=0,i=[];for(n in u)!F(H,n)&&F(u,n)&&i.push(n);for(;e.length>r;)F(u,n=e[r++])&&(~st(i,n)||i.push(n));return i}(t,ot)}},ht={f:Object.getOwnPropertySymbols},ct=Q("Reflect","ownKeys")||function(t){var e=lt.f(w(t)),n=ht.f;return n?e.concat(n(t)):e},ft=function(t,e){for(var n=ct(e),u=P.f,r=B.f,i=0;i<n.length;i++){var a=n[i];F(t,a)||u(t,a,r(e,a))}},pt=/#|\.prototype\./,dt=function(t,e){var n=kt[vt(t)];return n==yt||n!=gt&&("function"==typeof e?l(e):!!e)},vt=dt.normalize=function(t){return String(t).replace(pt,".").toLowerCase()},kt=dt.data={},gt=dt.NATIVE="N",yt=dt.POLYFILL="P",mt=dt,_t=B.f,At=function(t,e){var n,u,r,i,a,s=t.target,l=t.global,h=t.stat;if(n=l?o:h?o[s]||O(s,{}):(o[s]||{}).prototype)for(u in e){if(i=e[u],r=t.noTargetGet?(a=_t(n,u))&&a.value:n[u],!mt(l?u:s+(h?".":"#")+u,t.forced)&&void 0!==r){if(typeof i==typeof r)continue;ft(i,r)}(t.sham||r&&r.sham)&&T(i,"sham",!0),K(n,u,i,t)}},Ct="".repeat||function(t){var e=String(y(this)),n="",u=et(t);if(u<0||u==1/0)throw RangeError("Wrong number of repetitions");for(;u>0;(u>>>=1)&&(e+=e))1&u&&(n+=e);return n},Ft=Math.ceil,Et=function(t){return function(e,n,u){var r,i,a=String(y(e)),s=a.length,o=void 0===u?" ":String(u),l=ut(n);return l<=s||""==o?a:(r=l-s,(i=Ct.call(o,Ft(r/o.length))).length>r&&(i=i.slice(0,r)),t?a+i:i+a)}},bt={start:Et(!1),end:Et(!0)},St=Q("navigator","userAgent")||"",Dt=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(St),Bt=bt.end;At({target:"String",proto:!0,forced:Dt},{padEnd:function(t){return Bt(this,t,arguments.length>1?arguments[1]:void 0)}});var wt=bt.start;function xt(t){return(xt="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})(t)}function Pt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Tt(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)}}function Ot(t,e,n){return e&&Tt(t.prototype,e),n&&Tt(t,n),t}function Mt(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function It(){return(It=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}).apply(this,arguments)}function Rt(t){for(var e=1;e<arguments.length;e++)if(e%2){var n=null!=arguments[e]?arguments[e]:{},u=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(u=u.concat(Object.getOwnPropertySymbols(n).filter(function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),u.forEach(function(e){Mt(t,e,n[e])})}else Object.defineProperties(t,Object.getOwnPropertyDescriptors(arguments[e]));return t}function Vt(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Nt(t,e)}function jt(t){return(jt=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Nt(t,e){return(Nt=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function Lt(t,e){if(null==t)return{};var n,u,r=function(t,e){if(null==t)return{};var n,u,r={},i=Object.keys(t);for(u=0;u<i.length;u++)n=i[u],e.indexOf(n)>=0||(r[n]=t[n]);return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(u=0;u<i.length;u++)n=i[u],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function Ht(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function Gt(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=jt(t)););return t}function zt(t,e,n){return(zt="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var u=Gt(t,e);if(u){var r=Object.getOwnPropertyDescriptor(u,e);return r.get?r.get.call(n):r.value}})(t,e,n||t)}function Ut(t,e,n,u){return(Ut="undefined"!=typeof Reflect&&Reflect.set?Reflect.set:function(t,e,n,u){var r,i=Gt(t,e);if(i){if((r=Object.getOwnPropertyDescriptor(i,e)).set)return r.set.call(u,n),!0;if(!r.writable)return!1}if(r=Object.getOwnPropertyDescriptor(u,e)){if(!r.writable)return!1;r.value=n,Object.defineProperty(u,e,r)}else Mt(u,e,n);return!0})(t,e,n,u)}function Yt(t,e,n,u,r){if(!Ut(t,e,n,u||t)&&r)throw new Error("failed to set property");return n}function Zt(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],u=!0,r=!1,i=void 0;try{for(var a,s=t[Symbol.iterator]();!(u=(a=s.next()).done)&&(n.push(a.value),!e||n.length!==e);u=!0);}catch(t){r=!0,i=t}finally{try{u||null==s.return||s.return()}finally{if(r)throw i}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function Wt(t){return"string"==typeof t||t instanceof String}At({target:"String",proto:!0,forced:Dt},{padStart:function(t){return wt(this,t,arguments.length>1?arguments[1]:void 0)}}),At({target:"String",proto:!0},{repeat:Ct});var $t={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Kt(t){switch(t){case $t.LEFT:return $t.FORCE_LEFT;case $t.RIGHT:return $t.FORCE_RIGHT;default:return t}}function qt(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}var Jt="undefined"!=typeof window&&window||"undefined"!=typeof global&&global.global===global&&global||"undefined"!=typeof self&&self.self===self&&self||{},Qt=function(){function t(e,n,u,r){for(Pt(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 Ot(t,[{key:"startChangePos",get:function(){return Math.min(this.cursorPos,this.oldSelection.start)}},{key:"insertedCount",get:function(){return this.cursorPos-this.startChangePos}},{key:"inserted",get:function(){return this.value.substr(this.startChangePos,this.insertedCount)}},{key:"removedCount",get:function(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}},{key:"removed",get:function(){return this.oldValue.substr(this.startChangePos,this.removedCount)}},{key:"head",get:function(){return this.value.substring(0,this.startChangePos)}},{key:"tail",get:function(){return this.value.substring(this.startChangePos+this.insertedCount)}},{key:"removeDirection",get:function(){return!this.removedCount||this.insertedCount?$t.NONE:this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos?$t.RIGHT:$t.LEFT}}]),t}(),Xt=function(){function t(e){Pt(this,t),It(this,{inserted:"",rawInserted:"",skip:!1,tailShift:0},e)}return Ot(t,[{key:"aggregate",value:function(t){return this.rawInserted+=t.rawInserted,this.skip=this.skip||t.skip,this.inserted+=t.inserted,this.tailShift+=t.tailShift,this}},{key:"offset",get:function(){return this.tailShift+this.inserted.length}}]),t}(),te=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,u=arguments.length>2?arguments[2]:void 0;Pt(this,t),this.value=e,this.from=n,this.stop=u}return Ot(t,[{key:"toString",value:function(){return this.value}},{key:"extend",value:function(t){this.value+=String(t)}},{key:"appendTo",value:function(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}},{key:"shiftBefore",value:function(t){if(this.from>=t||!this.value.length)return"";var e=this.value[0];return this.value=this.value.slice(1),e}},{key:"state",get:function(){return{value:this.value,from:this.from,stop:this.stop}},set:function(t){It(this,t)}}]),t}(),ee=function(){function t(e){Pt(this,t),this._value="",this._update(e),this.isInitialized=!0}return Ot(t,[{key:"updateOptions",value:function(t){Object.keys(t).length&&this.withValueRefresh(this._update.bind(this,t))}},{key:"_update",value:function(t){It(this,t)}},{key:"reset",value:function(){this._value=""}},{key:"resolve",value:function(t){return this.reset(),this.append(t,{input:!0},""),this.doCommit(),this.value}},{key:"nearestInputPos",value:function(t,e){return t}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this.value.slice(t,e)}},{key:"extractTail",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new te(this.extractInput(t,e),t)}},{key:"appendTail",value:function(t){return Wt(t)&&(t=new te(String(t))),t.appendTo(this)}},{key:"_appendCharRaw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return(t=this.doPrepare(t,e))?(this._value+=t,new Xt({inserted:t,rawInserted:t})):new Xt}},{key:"_appendChar",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,u=this.state,r=this._appendCharRaw(t,e);if(r.inserted){var i,a=!1!==this.doValidate(e);if(a&&null!=n){var s=this.state;this.overwrite&&(i=n.state,n.shiftBefore(this.value.length));var o=this.appendTail(n);(a=o.rawInserted===n.toString())&&o.inserted&&(this.state=s)}a||(r.rawInserted=r.inserted="",this.state=u,n&&i&&(n.state=i))}return r}},{key:"_appendPlaceholder",value:function(){return new Xt}},{key:"append",value:function(t,e,n){if(!Wt(t))throw new Error("value should be string");var u=new Xt,r=Wt(n)?new te(String(n)):n;e.tail&&(e._beforeTailState=this.state);for(var i=0;i<t.length;++i)u.aggregate(this._appendChar(t[i],e,r));return null!=r&&(u.tailShift+=this.appendTail(r).tailShift),u}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return this._value=this.value.slice(0,t)+this.value.slice(e),new Xt}},{key:"withValueRefresh",value:function(t){if(this._refreshing||!this.isInitialized)return t();this._refreshing=!0;var e=this.unmaskedValue,n=this.value,u=t();return this.resolve(n)!==n&&(this.unmaskedValue=e),delete this._refreshing,u}},{key:"doPrepare",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.prepare?this.prepare(t,this,e):t}},{key:"doValidate",value:function(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}},{key:"doCommit",value:function(){this.commit&&this.commit(this.value,this)}},{key:"splice",value:function(t,e,n,u){var r=t+e,i=this.extractTail(r),a=this.nearestInputPos(t,u);return new Xt({tailShift:a-t}).aggregate(this.remove(a)).aggregate(this.append(n,{input:!0},i))}},{key:"state",get:function(){return{_value:this.value}},set:function(t){this._value=t._value}},{key:"value",get:function(){return this._value},set:function(t){this.resolve(t)}},{key:"unmaskedValue",get:function(){return this.value},set:function(t){this.reset(),this.append(t,{},""),this.doCommit()}},{key:"typedValue",get:function(){return this.unmaskedValue},set:function(t){this.unmaskedValue=t}},{key:"rawInputValue",get:function(){return this.extractInput(0,this.value.length,{raw:!0})},set:function(t){this.reset(),this.append(t,{raw:!0},""),this.doCommit()}},{key:"isComplete",get:function(){return!0}}]),t}();function ne(t){if(null==t)throw new Error("mask property should be defined");return t instanceof RegExp?Jt.IMask.MaskedRegExp:Wt(t)?Jt.IMask.MaskedPattern:t instanceof Date||t===Date?Jt.IMask.MaskedDate:t instanceof Number||"number"==typeof t||t===Number?Jt.IMask.MaskedNumber:Array.isArray(t)||t===Array?Jt.IMask.MaskedDynamic:t.prototype instanceof Jt.IMask.Masked?t:t instanceof Function?Jt.IMask.MaskedFunction:(console.warn("Mask not found for mask",t),Jt.IMask.Masked)}function ue(t){var e=(t=Rt({},t)).mask;return e instanceof Jt.IMask.Masked?e:new(ne(e))(t)}var re={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]/,"*":/./},ie=function(){function t(e){Pt(this,t);var n=e.mask,u=Lt(e,["mask"]);this.masked=ue({mask:n}),It(this,u)}return Ot(t,[{key:"reset",value:function(){this._isFilled=!1,this.masked.reset()}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return 0===t&&e>=1?(this._isFilled=!1,this.masked.remove(t,e)):new Xt}},{key:"_appendChar",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this._isFilled)return new Xt;var n=this.masked.state,u=this.masked._appendChar(t,e);return u.inserted&&!1===this.doValidate(e)&&(u.inserted=u.rawInserted="",this.masked.state=n),u.inserted||this.isOptional||this.lazy||e.input||(u.inserted=this.placeholderChar),u.skip=!u.inserted&&!this.isOptional,this._isFilled=Boolean(u.inserted),u}},{key:"append",value:function(){var t;return(t=this.masked).append.apply(t,arguments)}},{key:"_appendPlaceholder",value:function(){var t=new Xt;return this._isFilled||this.isOptional?t:(this._isFilled=!0,t.inserted=this.placeholderChar,t)}},{key:"extractTail",value:function(){var t;return(t=this.masked).extractTail.apply(t,arguments)}},{key:"appendTail",value:function(){var t;return(t=this.masked).appendTail.apply(t,arguments)}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2?arguments[2]:void 0;return this.masked.extractInput(t,e,n)}},{key:"nearestInputPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t.NONE,n=0,u=this.value.length,r=Math.min(Math.max(t,n),u);switch(e){case $t.LEFT:case $t.FORCE_LEFT:return this.isComplete?r:n;case $t.RIGHT:case $t.FORCE_RIGHT:return this.isComplete?r:u;case $t.NONE:default:return r}}},{key:"doValidate",value:function(){var t,e;return(t=this.masked).doValidate.apply(t,arguments)&&(!this.parent||(e=this.parent).doValidate.apply(e,arguments))}},{key:"doCommit",value:function(){this.masked.doCommit()}},{key:"value",get:function(){return this.masked.value||(this._isFilled&&!this.isOptional?this.placeholderChar:"")}},{key:"unmaskedValue",get:function(){return this.masked.unmaskedValue}},{key:"isComplete",get:function(){return Boolean(this.masked.value)||this.isOptional}},{key:"state",get:function(){return{masked:this.masked.state,_isFilled:this._isFilled}},set:function(t){this.masked.state=t.masked,this._isFilled=t._isFilled}}]),t}(),ae=function(){function t(e){Pt(this,t),It(this,e),this._value=""}return Ot(t,[{key:"reset",value:function(){this._isRawInput=!1,this._value=""}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length;return this._value=this._value.slice(0,t)+this._value.slice(e),this._value||(this._isRawInput=!1),new Xt}},{key:"nearestInputPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t.NONE,n=0,u=this._value.length;switch(e){case $t.LEFT:case $t.FORCE_LEFT:return n;case $t.NONE:case $t.RIGHT:case $t.FORCE_RIGHT:default:return u}}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._value.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return n.raw&&this._isRawInput&&this._value.slice(t,e)||""}},{key:"_appendChar",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new Xt;if(this._value)return n;var u=this.char===t[0],r=u&&(this.isUnmasking||e.input||e.raw)&&!e.tail;return r&&(n.rawInserted=this.char),this._value=n.inserted=this.char,this._isRawInput=r&&(e.raw||e.input),n}},{key:"_appendPlaceholder",value:function(){var t=new Xt;return this._value?t:(this._value=t.inserted=this.char,t)}},{key:"extractTail",value:function(){arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length;return new te("")}},{key:"appendTail",value:function(t){return Wt(t)&&(t=new te(String(t))),t.appendTo(this)}},{key:"append",value:function(t,e,n){var u=this._appendChar(t,e);return null!=n&&(u.tailShift+=this.appendTail(n).tailShift),u}},{key:"doCommit",value:function(){}},{key:"value",get:function(){return this._value}},{key:"unmaskedValue",get:function(){return this.isUnmasking?this.value:""}},{key:"isComplete",get:function(){return!0}},{key:"state",get:function(){return{_value:this._value,_isRawInput:this._isRawInput}},set:function(t){It(this,t)}}]),t}(),se=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;Pt(this,t),this.chunks=e,this.from=n}return Ot(t,[{key:"toString",value:function(){return this.chunks.map(String).join("")}},{key:"extend",value:function(e){if(String(e)){Wt(e)&&(e=new te(String(e)));var n=this.chunks[this.chunks.length-1],u=n&&(n.stop===e.stop||null==e.stop)&&e.from===n.from+n.toString().length;if(e instanceof te)u?n.extend(e.toString()):this.chunks.push(e);else if(e instanceof t){if(null==e.stop)for(var r;e.chunks.length&&null==e.chunks[0].stop;)(r=e.chunks.shift()).from+=e.from,this.extend(r);e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}}},{key:"appendTo",value:function(e){if(!(e instanceof Jt.IMask.MaskedPattern))return new te(this.toString()).appendTo(e);for(var n=new Xt,u=0;u<this.chunks.length&&!n.skip;++u){var r=this.chunks[u],i=e._mapPosToBlock(e.value.length),a=r.stop,s=void 0;if(a&&(!i||i.index<=a)&&((r instanceof t||e._stops.indexOf(a)>=0)&&n.aggregate(e._appendPlaceholder(a)),s=r instanceof t&&e._blocks[a]),s){var o=s.appendTail(r);o.skip=!1,n.aggregate(o),e._value+=o.inserted;var l=r.toString().slice(o.rawInserted.length);l&&n.aggregate(e.append(l,{tail:!0}))}else n.aggregate(e.append(r.toString(),{tail:!0}))}return n}},{key:"shiftBefore",value:function(t){if(this.from>=t||!this.chunks.length)return"";for(var e=t-this.from,n=0;n<this.chunks.length;){var u=this.chunks[n],r=u.shiftBefore(e);if(u.toString()){if(!r)break;++n}else this.chunks.splice(n,1);if(r)return r}return""}},{key:"state",get:function(){return{chunks:this.chunks.map(function(t){return t.state}),from:this.from,stop:this.stop,blockIndex:this.blockIndex}},set:function(e){var n=e.chunks;It(this,Lt(e,["chunks"])),this.chunks=n.map(function(e){var n="chunks"in e?new t:new te;return n.state=e,n})}}]),t}(),oe=function(t){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Pt(this,e),t.definitions=It({},re,t.definitions),Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,{},t)))}return Vt(e,ee),Ot(e,[{key:"_update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};t.definitions=It({},this.definitions,t.definitions),zt(jt(e.prototype),"_update",this).call(this,t),this._rebuildMask()}},{key:"_rebuildMask",value:function(){var t=this,n=this.definitions;this._blocks=[],this._stops=[],this._maskedBlocks={};var u=this.mask;if(u&&n)for(var r=!1,i=!1,a=0;a<u.length;++a){if(this.blocks)if("continue"===function(){var e=u.slice(a),n=Object.keys(t.blocks).filter(function(t){return 0===e.indexOf(t)});n.sort(function(t,e){return e.length-t.length});var r=n[0];if(r){var i=ue(Rt({parent:t,lazy:t.lazy,placeholderChar:t.placeholderChar},t.blocks[r]));return i&&(t._blocks.push(i),t._maskedBlocks[r]||(t._maskedBlocks[r]=[]),t._maskedBlocks[r].push(t._blocks.length-1)),a+=r.length-1,"continue"}}())continue;var s=u[a],o=s in n;if(s!==e.STOP_CHAR)if("{"!==s&&"}"!==s)if("["!==s&&"]"!==s){if(s===e.ESCAPE_CHAR){if(!(s=u[++a]))break;o=!1}var l=o?new ie({parent:this,lazy:this.lazy,placeholderChar:this.placeholderChar,mask:n[s],isOptional:i}):new ae({char:s,isUnmasking:r});this._blocks.push(l)}else i=!i;else r=!r;else this._stops.push(this._blocks.length)}}},{key:"reset",value:function(){zt(jt(e.prototype),"reset",this).call(this),this._blocks.forEach(function(t){return t.reset()})}},{key:"doCommit",value:function(){this._blocks.forEach(function(t){return t.doCommit()}),zt(jt(e.prototype),"doCommit",this).call(this)}},{key:"appendTail",value:function(t){return zt(jt(e.prototype),"appendTail",this).call(this,t).aggregate(this._appendPlaceholder())}},{key:"_appendCharRaw",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t=this.doPrepare(t,e);var n=this._mapPosToBlock(this.value.length),u=new Xt;if(!n)return u;for(var r=n.index;;++r){var i=this._blocks[r];if(!i)break;var a=i._appendChar(t,e),s=a.skip;if(u.aggregate(a),s||a.rawInserted)break}return u}},{key:"extractTail",value: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=new se;return e===n?u:(this._forEachBlocksInRange(e,n,function(e,n,r,i){var a=e.extractTail(r,i);a.stop=t._findStopBefore(n),a.from=t._blockStartPos(n),a instanceof se&&(a.blockIndex=n),u.extend(a)}),u)}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t===e)return"";var u="";return this._forEachBlocksInRange(t,e,function(t,e,r,i){u+=t.extractInput(r,i,n)}),u}},{key:"_findStopBefore",value:function(t){for(var e,n=0;n<this._stops.length;++n){var u=this._stops[n];if(!(u<=t))break;e=u}return e}},{key:"_appendPlaceholder",value:function(t){var e=this,n=new Xt;if(this.lazy&&null==t)return n;var u=this._mapPosToBlock(this.value.length);if(!u)return n;var r=u.index,i=null!=t?t:this._blocks.length;return this._blocks.slice(r,i).forEach(function(u){if(!u.lazy||null!=t){var r=null!=u._blocks?[u._blocks.length]:[],i=u._appendPlaceholder.apply(u,r);e._value+=i.inserted,n.aggregate(i)}}),n}},{key:"_mapPosToBlock",value:function(t){for(var e="",n=0;n<this._blocks.length;++n){var u=this._blocks[n],r=e.length;if(t<=(e+=u.value).length)return{index:n,offset:t-r}}}},{key:"_blockStartPos",value:function(t){return this._blocks.slice(0,t).reduce(function(t,e){return t+e.value.length},0)}},{key:"_forEachBlocksInRange",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=arguments.length>2?arguments[2]:void 0,u=this._mapPosToBlock(t);if(u){var r=this._mapPosToBlock(e),i=r&&u.index===r.index,a=u.offset,s=r&&i?r.offset:this._blocks[u.index].value.length;if(n(this._blocks[u.index],u.index,a,s),r&&!i){for(var o=u.index+1;o<r.index;++o)n(this._blocks[o],o,0,this._blocks[o].value.length);n(this._blocks[r.index],r.index,0,r.offset)}}}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,u=zt(jt(e.prototype),"remove",this).call(this,t,n);return this._forEachBlocksInRange(t,n,function(t,e,n,r){u.aggregate(t.remove(n,r))}),u}},{key:"nearestInputPos",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$t.NONE,n=this._mapPosToBlock(t)||{index:0,offset:0},u=n.offset,r=n.index,i=this._blocks[r];if(!i)return t;var a=u;0!==a&&a<i.value.length&&(a=i.nearestInputPos(u,Kt(e)));var s=a===i.value.length,o=0===a;if(!o&&!s)return this._blockStartPos(r)+a;var l=s?r+1:r;if(e===$t.NONE){if(l>0){var h=l-1,c=this._blocks[h],f=c.nearestInputPos(0,$t.NONE);if(!c.value.length||f!==c.value.length)return this._blockStartPos(l)}for(var p=l,d=p;d<this._blocks.length;++d){var v=this._blocks[d],k=v.nearestInputPos(0,$t.NONE);if(k!==v.value.length)return this._blockStartPos(d)+k}for(var g=l-1;g>=0;--g){var y=this._blocks[g],m=y.nearestInputPos(0,$t.NONE);if(!y.value.length||m!==y.value.length)return this._blockStartPos(g)+y.value.length}return t}if(e===$t.LEFT||e===$t.FORCE_LEFT){for(var _,A=l;A<this._blocks.length;++A)if(this._blocks[A].value){_=A;break}if(null!=_){var C=this._blocks[_],F=C.nearestInputPos(0,$t.RIGHT);if(0===F&&C.unmaskedValue.length)return this._blockStartPos(_)+F}for(var E,b=-1,S=l-1;S>=0;--S){var D=this._blocks[S],B=D.nearestInputPos(D.value.length,$t.FORCE_LEFT);if(D.value&&0===B||(E=S),0!==B){if(B!==D.value.length)return this._blockStartPos(S)+B;b=S;break}}if(e===$t.LEFT)for(var w=b+1;w<=Math.min(l,this._blocks.length-1);++w){var x=this._blocks[w],P=x.nearestInputPos(0,$t.NONE),T=this._blockStartPos(w)+P;if(T>t)break;if(P!==x.value.length)return T}if(b>=0)return this._blockStartPos(b)+this._blocks[b].value.length;if(e===$t.FORCE_LEFT||this.lazy&&!this.extractInput()&&!le(this._blocks[l]))return 0;if(null!=E)return this._blockStartPos(E);for(var O=l;O<this._blocks.length;++O){var M=this._blocks[O],I=M.nearestInputPos(0,$t.NONE);if(!M.value.length||I!==M.value.length)return this._blockStartPos(O)+I}return 0}if(e===$t.RIGHT||e===$t.FORCE_RIGHT){for(var R,V,j=l;j<this._blocks.length;++j){var N=this._blocks[j],L=N.nearestInputPos(0,$t.NONE);if(L!==N.value.length){V=this._blockStartPos(j)+L,R=j;break}}if(null!=R&&null!=V){for(var H=R;H<this._blocks.length;++H){var G=this._blocks[H],z=G.nearestInputPos(0,$t.FORCE_RIGHT);if(z!==G.value.length)return this._blockStartPos(H)+z}return e===$t.FORCE_RIGHT?this.value.length:V}for(var U=Math.min(l,this._blocks.length-1);U>=0;--U){var Y=this._blocks[U],Z=Y.nearestInputPos(Y.value.length,$t.LEFT);if(0!==Z){var W=this._blockStartPos(U)+Z;if(W>=t)return W;break}}}return t}},{key:"maskedBlock",value:function(t){return this.maskedBlocks(t)[0]}},{key:"maskedBlocks",value:function(t){var e=this,n=this._maskedBlocks[t];return n?n.map(function(t){return e._blocks[t]}):[]}},{key:"state",get:function(){return Rt({},zt(jt(e.prototype),"state",this),{_blocks:this._blocks.map(function(t){return t.state})})},set:function(t){var n=t._blocks,u=Lt(t,["_blocks"]);this._blocks.forEach(function(t,e){return t.state=n[e]}),Yt(jt(e.prototype),"state",u,this,!0)}},{key:"isComplete",get:function(){return this._blocks.every(function(t){return t.isComplete})}},{key:"unmaskedValue",get:function(){return this._blocks.reduce(function(t,e){return t+e.unmaskedValue},"")},set:function(t){Yt(jt(e.prototype),"unmaskedValue",t,this,!0)}},{key:"value",get:function(){return this._blocks.reduce(function(t,e){return t+e.value},"")},set:function(t){Yt(jt(e.prototype),"value",t,this,!0)}}]),e}();function le(t){if(!t)return!1;var e=t.value;return!e||t.nearestInputPos(0,$t.NONE)!==e.length}oe.DEFAULTS={lazy:!0,placeholderChar:"_"},oe.STOP_CHAR="`",oe.ESCAPE_CHAR="\\",oe.InputDefinition=ie,oe.FixedDefinition=ae;var he=function(t){function e(){return Pt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,oe),Ot(e,[{key:"_update",value:function(t){t=Rt({to:this.to||0,from:this.from||0},t);var n=String(t.to).length;null!=t.maxLength&&(n=Math.max(n,t.maxLength)),t.maxLength=n;for(var u=String(t.from).padStart(n,"0"),r=String(t.to).padStart(n,"0"),i=0;i<r.length&&r[i]===u[i];)++i;t.mask=r.slice(0,i).replace(/0/g,"\\0")+"0".repeat(n-i),zt(jt(e.prototype),"_update",this).call(this,t)}},{key:"boundaries",value:function(t){var e="",n="",u=Zt(t.match(/^(\D*)(\d*)(\D*)/)||[],3),r=u[1],i=u[2];return i&&(e="0".repeat(r.length)+i,n="9".repeat(r.length)+i),[e=e.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9")]}},{key:"doPrepare",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t=zt(jt(e.prototype),"doPrepare",this).call(this,t,n).replace(/\D/g,""),!this.autofix)return t;for(var u=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0"),i=this.value,a="",s=0;s<t.length;++s){var o=i+a+t[s],l=this.boundaries(o),h=Zt(l,2),c=h[0],f=h[1];Number(f)<this.from?a+=u[o.length-1]:Number(c)>this.to?a+=r[o.length-1]:a+=t[s]}return a}},{key:"doValidate",value:function(){var t,n=this.value,u=n.search(/[^0]/);if(-1===u&&n.length<=this._matchFrom)return!0;for(var r=this.boundaries(n),i=Zt(r,2),a=i[0],s=i[1],o=arguments.length,l=new Array(o),h=0;h<o;h++)l[h]=arguments[h];return this.from<=Number(s)&&Number(a)<=this.to&&(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(l))}},{key:"_matchFrom",get:function(){return this.maxLength-String(this.from).length}},{key:"isComplete",get:function(){return zt(jt(e.prototype),"isComplete",this)&&Boolean(this.value)}}]),e}(),ce=function(t){function e(t){return Pt(this,e),Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,{},t)))}return Vt(e,oe),Ot(e,[{key:"_update",value:function(t){t.mask===Date&&delete t.mask,t.pattern&&(t.mask=t.pattern);var n=t.blocks;t.blocks=It({},e.GET_DEFAULT_BLOCKS()),t.min&&(t.blocks.Y.from=t.min.getFullYear()),t.max&&(t.blocks.Y.to=t.max.getFullYear()),t.min&&t.max&&t.blocks.Y.from===t.blocks.Y.to&&(t.blocks.m.from=t.min.getMonth()+1,t.blocks.m.to=t.max.getMonth()+1,t.blocks.m.from===t.blocks.m.to&&(t.blocks.d.from=t.min.getDate(),t.blocks.d.to=t.max.getDate())),It(t.blocks,n),Object.keys(t.blocks).forEach(function(e){var n=t.blocks[e];"autofix"in n||(n.autofix=t.autofix)}),zt(jt(e.prototype),"_update",this).call(this,t)}},{key:"doValidate",value:function(){for(var t,n=this.date,u=arguments.length,r=new Array(u),i=0;i<u;i++)r[i]=arguments[i];return(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(r))&&(!this.isComplete||this.isDateExist(this.value)&&null!=n&&(null==this.min||this.min<=n)&&(null==this.max||n<=this.max))}},{key:"isDateExist",value:function(t){return this.format(this.parse(t))===t}},{key:"date",get:function(){return this.isComplete?this.parse(this.value):null},set:function(t){this.value=this.format(t)}},{key:"typedValue",get:function(){return this.date},set:function(t){this.date=t}}]),e}();ce.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=Zt(t.split("."),3),n=e[0],u=e[1],r=e[2];return new Date(r,u-1,n)}},ce.GET_DEFAULT_BLOCKS=function(){return{d:{mask:he,from:1,to:31,maxLength:2},m:{mask:he,from:1,to:12,maxLength:2},Y:{mask:he,from:1900,to:9999}}};var fe=function(){function t(){Pt(this,t)}return Ot(t,[{key:"select",value:function(t,e){if(null!=t&&null!=e&&(t!==this.selectionStart||e!==this.selectionEnd))try{this._unsafeSelect(t,e)}catch(t){}}},{key:"_unsafeSelect",value:function(t,e){}},{key:"bindEvents",value:function(t){}},{key:"unbindEvents",value:function(){}},{key:"selectionStart",get:function(){var t;try{t=this._unsafeSelectionStart}catch(t){}return null!=t?t:this.value.length}},{key:"selectionEnd",get:function(){var t;try{t=this._unsafeSelectionEnd}catch(t){}return null!=t?t:this.value.length}},{key:"isActive",get:function(){return!1}}]),t}(),pe=function(t){function e(t){var n;return Pt(this,e),(n=Ht(this,jt(e).call(this))).input=t,n._handlers={},n}return Vt(e,fe),Ot(e,[{key:"_unsafeSelect",value:function(t,e){this.input.setSelectionRange(t,e)}},{key:"bindEvents",value:function(t){var n=this;Object.keys(t).forEach(function(u){return n._toggleEventHandler(e.EVENTS_MAP[u],t[u])})}},{key:"unbindEvents",value:function(){var t=this;Object.keys(this._handlers).forEach(function(e){return t._toggleEventHandler(e)})}},{key:"_toggleEventHandler",value:function(t,e){this._handlers[t]&&(this.input.removeEventListener(t,this._handlers[t]),delete this._handlers[t]),e&&(this.input.addEventListener(t,e),this._handlers[t]=e)}},{key:"isActive",get:function(){return this.input===document.activeElement}},{key:"_unsafeSelectionStart",get:function(){return this.input.selectionStart}},{key:"_unsafeSelectionEnd",get:function(){return this.input.selectionEnd}},{key:"value",get:function(){return this.input.value},set:function(t){this.input.value=t}}]),e}();pe.EVENTS_MAP={selectionChange:"keydown",input:"input",drop:"drop",click:"click",focus:"focus",commit:"blur"};var de=function(){function t(e,n){Pt(this,t),this.el=e instanceof fe?e:new pe(e),this.masked=ue(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._onFocus=this._onFocus.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}return Ot(t,[{key:"_bindEvents",value:function(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this.alignCursorFriendly,focus:this._onFocus,commit:this._onChange})}},{key:"_unbindEvents",value:function(){this.el.unbindEvents()}},{key:"_fireEvent",value:function(t){var e=this._listeners[t];e&&e.forEach(function(t){return t()})}},{key:"_saveSelection",value:function(){this.value!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}},{key:"updateValue",value:function(){this.masked.value=this.el.value,this._value=this.masked.value}},{key:"updateControl",value: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()}},{key:"updateOptions",value:function(t){var e=t.mask,n=Lt(t,["mask"]);this.mask=e,function t(e,n){if(n===e)return!0;var u,r=Array.isArray(n),i=Array.isArray(e);if(r&&i){if(n.length!=e.length)return!1;for(u=0;u<n.length;u++)if(!t(n[u],e[u]))return!1;return!0}if(r!=i)return!1;if(n&&e&&"object"===xt(n)&&"object"===xt(e)){var a=n instanceof Date,s=e instanceof Date;if(a&&s)return n.getTime()==e.getTime();if(a!=s)return!1;var o=n instanceof RegExp,l=e instanceof RegExp;if(o&&l)return n.toString()==e.toString();if(o!=l)return!1;var h=Object.keys(n);for(u=0;u<h.length;u++)if(!Object.prototype.hasOwnProperty.call(e,h[u]))return!1;for(u=0;u<h.length;u++)if(!t(e[h[u]],n[h[u]]))return!1;return!0}return!(!n||!e||"function"!=typeof n||"function"!=typeof e)&&n.toString()===e.toString()}(this.masked,n)||this.masked.updateOptions(n),this.updateControl()}},{key:"updateCursor",value:function(t){null!=t&&(this.cursorPos=t,this._delayUpdateCursor(t))}},{key:"_delayUpdateCursor",value:function(t){var e=this;this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(function(){e.el&&(e.cursorPos=e._changingCursorPos,e._abortUpdateCursor())},10)}},{key:"_fireChangeEvents",value:function(){this._fireEvent("accept"),this.masked.isComplete&&this._fireEvent("complete")}},{key:"_abortUpdateCursor",value:function(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}},{key:"alignCursor",value:function(){this.cursorPos=this.masked.nearestInputPos(this.cursorPos,$t.LEFT)}},{key:"alignCursorFriendly",value:function(){this.selectionStart===this.cursorPos&&this.alignCursor()}},{key:"on",value:function(t,e){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(e),this}},{key:"off",value:function(t,e){if(!this._listeners[t])return this;if(!e)return delete this._listeners[t],this;var n=this._listeners[t].indexOf(e);return n>=0&&this._listeners[t].splice(n,1),this}},{key:"_onInput",value:function(){if(this._abortUpdateCursor(),!this._selection)return this.updateValue();var t=new Qt(this.el.value,this.cursorPos,this.value,this._selection),e=this.masked.rawInputValue,n=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection).offset,u=e===this.masked.rawInputValue?t.removeDirection:$t.NONE,r=this.masked.nearestInputPos(t.startChangePos+n,u);this.updateControl(),this.updateCursor(r)}},{key:"_onChange",value:function(){this.value!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}},{key:"_onDrop",value:function(t){t.preventDefault(),t.stopPropagation()}},{key:"_onFocus",value:function(t){this.selectionStart===this.cursorPos&&(this._selection&&(this.cursorPos=this._selection.end),this.alignCursorFriendly())}},{key:"destroy",value:function(){this._unbindEvents(),this._listeners.length=0,delete this.el}},{key:"mask",get:function(){return this.masked.mask},set:function(t){if(!(null==t||t===this.masked.mask||t===Date&&this.masked instanceof ce))if(this.masked.constructor!==ne(t)){var e=ue({mask:t});e.unmaskedValue=this.masked.unmaskedValue,this.masked=e}else this.masked.updateOptions({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:"typedValue",get:function(){return this.masked.typedValue},set:function(t){this.masked.typedValue=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.isActive&&(this.el.select(t,t),this._saveSelection())}}]),t}(),ve=function(t){function e(){return Pt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,oe),Ot(e,[{key:"_update",value:function(t){t.enum&&(t.mask="*".repeat(t.enum[0].length)),zt(jt(e.prototype),"_update",this).call(this,t)}},{key:"doValidate",value:function(){for(var t,n=this,u=arguments.length,r=new Array(u),i=0;i<u;i++)r[i]=arguments[i];return this.enum.some(function(t){return t.indexOf(n.unmaskedValue)>=0})&&(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(r))}}]),e}(),ke=function(t){function e(t){return Pt(this,e),Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,{},t)))}return Vt(e,ee),Ot(e,[{key:"_update",value:function(t){zt(jt(e.prototype),"_update",this).call(this,t),this._updateRegExps()}},{key:"_updateRegExps",value:function(){var t="^"+(this.allowNegative?"[+|\\-]?":""),e=(this.scale?"("+qt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExpInput=new RegExp(t+"(0|([1-9]+\\d*))?"+e),this._numberRegExp=new RegExp(t+"\\d*"+e),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(qt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(qt(this.thousandsSeparator),"g")}},{key:"_removeThousandsSeparators",value:function(t){return t.replace(this._thousandsSeparatorRegExp,"")}},{key:"_insertThousandsSeparators",value:function(t){var e=t.split(this.radix);return e[0]=e[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),e.join(this.radix)}},{key:"doPrepare",value:function(t){for(var n,u=arguments.length,r=new Array(u>1?u-1:0),i=1;i<u;i++)r[i-1]=arguments[i];return(n=zt(jt(e.prototype),"doPrepare",this)).call.apply(n,[this,this._removeThousandsSeparators(t.replace(this._mapToRadixRegExp,this.radix))].concat(r))}},{key:"_separatorsCount",value:function(t){for(var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=0,u=0;u<t;++u)this._value.indexOf(this.thousandsSeparator,u)===u&&(++n,e&&(t+=this.thousandsSeparator.length));return n}},{key:"_separatorsCountFromSlice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._value;return this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}},{key:"extractInput",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,u=arguments.length>2?arguments[2]:void 0,r=this._adjustRangeWithSeparators(t,n),i=Zt(r,2);return t=i[0],n=i[1],this._removeThousandsSeparators(zt(jt(e.prototype),"extractInput",this).call(this,t,n,u))}},{key:"_appendCharRaw",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!this.thousandsSeparator)return zt(jt(e.prototype),"_appendCharRaw",this).call(this,t,n);var u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,r=this._separatorsCountFromSlice(u);this._value=this._removeThousandsSeparators(this.value);var i=zt(jt(e.prototype),"_appendCharRaw",this).call(this,t,n);this._value=this._insertThousandsSeparators(this._value);var a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,s=this._separatorsCountFromSlice(a);return i.tailShift+=(s-r)*this.thousandsSeparator.length,i}},{key:"_findSeparatorAround",value:function(t){if(this.thousandsSeparator){var e=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,e);if(n<=t)return n}return-1}},{key:"_adjustRangeWithSeparators",value:function(t,e){var n=this._findSeparatorAround(t);n>=0&&(t=n);var u=this._findSeparatorAround(e);return u>=0&&(e=u+this.thousandsSeparator.length),[t,e]}},{key:"remove",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.value.length,n=this._adjustRangeWithSeparators(t,e),u=Zt(n,2);t=u[0],e=u[1];var r=this.value.slice(0,t),i=this.value.slice(e),a=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+i));var s=this._separatorsCountFromSlice(r);return new Xt({tailShift:(s-a)*this.thousandsSeparator.length})}},{key:"nearestInputPos",value:function(t,e){if(!this.thousandsSeparator)return t;switch(e){case $t.NONE:case $t.LEFT:case $t.FORCE_LEFT:var n=this._findSeparatorAround(t-1);if(n>=0){var u=n+this.thousandsSeparator.length;if(t<u||this.value.length<=u||e===$t.FORCE_LEFT)return n}break;case $t.RIGHT:case $t.FORCE_RIGHT:var r=this._findSeparatorAround(t);if(r>=0)return r+this.thousandsSeparator.length}return t}},{key:"doValidate",value:function(t){var n=(t.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&&zt(jt(e.prototype),"doValidate",this).call(this,t)}},{key:"doCommit",value:function(){if(this.value){var t=this.number,n=t;null!=this.min&&(n=Math.max(n,this.min)),null!=this.max&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=String(n));var u=this.value;this.normalizeZeros&&(u=this._normalizeZeros(u)),this.padFractionalZeros&&(u=this._padFractionalZeros(u)),this._value=u}zt(jt(e.prototype),"doCommit",this).call(this)}},{key:"_normalizeZeros",value:function(t){var e=this._removeThousandsSeparators(t).split(this.radix);return e[0]=e[0].replace(/^(\D*)(0*)(\d*)/,function(t,e,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))}},{key:"_padFractionalZeros",value:function(t){if(!t)return t;var e=t.split(this.radix);return e.length<2&&e.push(""),e[1]=e[1].padEnd(this.scale,"0"),e.join(this.radix)}},{key:"unmaskedValue",get:function(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,".")},set:function(t){Yt(jt(e.prototype),"unmaskedValue",t.replace(".",this.radix),this,!0)}},{key:"number",get:function(){return Number(this.unmaskedValue)},set:function(t){this.unmaskedValue=String(t)}},{key:"typedValue",get:function(){return this.number},set:function(t){this.number=t}},{key:"allowNegative",get:function(){return this.signed||null!=this.min&&this.min<0||null!=this.max&&this.max<0}}]),e}();ke.DEFAULTS={radix:",",thousandsSeparator:"",mapToRadix:["."],scale:2,signed:!1,normalizeZeros:!0,padFractionalZeros:!1};var ge=function(t){function e(){return Pt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,ee),Ot(e,[{key:"_update",value:function(t){t.mask&&(t.validate=function(e){return e.search(t.mask)>=0}),zt(jt(e.prototype),"_update",this).call(this,t)}}]),e}(),ye=function(t){function e(){return Pt(this,e),Ht(this,jt(e).apply(this,arguments))}return Vt(e,ee),Ot(e,[{key:"_update",value:function(t){t.mask&&(t.validate=t.mask),zt(jt(e.prototype),"_update",this).call(this,t)}}]),e}(),me=function(t){function e(t){var n;return Pt(this,e),(n=Ht(this,jt(e).call(this,Rt({},e.DEFAULTS,{},t)))).currentMask=null,n}return Vt(e,ee),Ot(e,[{key:"_update",value:function(t){zt(jt(e.prototype),"_update",this).call(this,t),"mask"in t&&(this.compiledMasks=Array.isArray(t.mask)?t.mask.map(function(t){return ue(t)}):[])}},{key:"_appendCharRaw",value:function(){var t,e=this._applyDispatch.apply(this,arguments);this.currentMask&&e.aggregate((t=this.currentMask)._appendChar.apply(t,arguments));return e}},{key:"_applyDispatch",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.tail&&null!=e._beforeTailState?e._beforeTailState._value:this.value,u=this.rawInputValue,r=e.tail&&null!=e._beforeTailState?e._beforeTailState._rawInputValue:u,i=u.slice(r.length),a=this.currentMask,s=new Xt,o=a&&a.state;if(this.currentMask=this.doDispatch(t,Rt({},e)),this.currentMask)if(this.currentMask!==a){this.currentMask.reset();var l=this.currentMask.append(r,{raw:!0});s.tailShift=l.inserted.length-n.length,i&&(s.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)}else this.currentMask.state=o;return s}},{key:"_appendPlaceholder",value:function(){var t=this._applyDispatch.apply(this,arguments);return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}},{key:"doDispatch",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return this.dispatch(t,this,e)}},{key:"doValidate",value:function(){for(var t,n,u=arguments.length,r=new Array(u),i=0;i<u;i++)r[i]=arguments[i];return(t=zt(jt(e.prototype),"doValidate",this)).call.apply(t,[this].concat(r))&&(!this.currentMask||(n=this.currentMask).doValidate.apply(n,r))}},{key:"reset",value:function(){this.currentMask&&this.currentMask.reset(),this.compiledMasks.forEach(function(t){return t.reset()})}},{key:"remove",value:function(){var t,e=new Xt;this.currentMask&&e.aggregate((t=this.currentMask).remove.apply(t,arguments)).aggregate(this._applyDispatch());return e}},{key:"extractInput",value:function(){var t;return this.currentMask?(t=this.currentMask).extractInput.apply(t,arguments):""}},{key:"extractTail",value:function(){for(var t,n,u=arguments.length,r=new Array(u),i=0;i<u;i++)r[i]=arguments[i];return this.currentMask?(t=this.currentMask).extractTail.apply(t,r):(n=zt(jt(e.prototype),"extractTail",this)).call.apply(n,[this].concat(r))}},{key:"doCommit",value:function(){this.currentMask&&this.currentMask.doCommit(),zt(jt(e.prototype),"doCommit",this).call(this)}},{key:"nearestInputPos",value:function(){for(var t,n,u=arguments.length,r=new Array(u),i=0;i<u;i++)r[i]=arguments[i];return this.currentMask?(t=this.currentMask).nearestInputPos.apply(t,r):(n=zt(jt(e.prototype),"nearestInputPos",this)).call.apply(n,[this].concat(r))}},{key:"value",get:function(){return this.currentMask?this.currentMask.value:""},set:function(t){Yt(jt(e.prototype),"value",t,this,!0)}},{key:"unmaskedValue",get:function(){return this.currentMask?this.currentMask.unmaskedValue:""},set:function(t){Yt(jt(e.prototype),"unmaskedValue",t,this,!0)}},{key:"typedValue",get:function(){return this.currentMask?this.currentMask.typedValue:""},set:function(t){var e=String(t);this.currentMask&&(this.currentMask.typedValue=t,e=this.currentMask.unmaskedValue),this.unmaskedValue=e}},{key:"isComplete",get:function(){return!!this.currentMask&&this.currentMask.isComplete}},{key:"state",get:function(){return Rt({},zt(jt(e.prototype),"state",this),{_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(function(t){return t.state}),currentMaskRef:this.currentMask,currentMask:this.currentMask&&this.currentMask.state})},set:function(t){var n=t.compiledMasks,u=t.currentMaskRef,r=t.currentMask,i=Lt(t,["compiledMasks","currentMaskRef","currentMask"]);this.compiledMasks.forEach(function(t,e){return t.state=n[e]}),null!=u&&(this.currentMask=u,this.currentMask.state=r),Yt(jt(e.prototype),"state",i,this,!0)}}]),e}();function _e(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new de(t,e)}return me.DEFAULTS={dispatch:function(t,e,n){if(e.compiledMasks.length){var u=e.rawInputValue,r=e.compiledMasks.map(function(e,r){return e.reset(),e.append(u,{raw:!0}),e.append(t,n),{weight:e.rawInputValue.length,index:r}});return r.sort(function(t,e){return e.weight-t.weight}),e.compiledMasks[r[0].index]}}},_e.InputMask=de,_e.Masked=ee,_e.MaskedPattern=oe,_e.MaskedEnum=ve,_e.MaskedRange=he,_e.MaskedNumber=ke,_e.MaskedDate=ce,_e.MaskedRegExp=ge,_e.MaskedFunction=ye,_e.MaskedDynamic=me,_e.createMask=ue,_e.MaskElement=fe,_e.HTMLMaskElement=pe,Jt.IMask=_e,_e});
//# sourceMappingURL=imask.min.js.map

@@ -12,8 +12,8 @@ export as namespace IMask;

export type ElementEvent =
| "selectionChange"
| "input"
| "drop"
| "click"
| "focus"
| "commit";
| 'selectionChange'
| 'input'
| 'drop'
| 'click'
| 'focus'
| 'commit';

@@ -36,7 +36,2 @@ export class MaskElement {

type AppendType = {
input?: boolean;
tail?: boolean;
raw?: boolean;
};
type AppendFlags = {

@@ -50,3 +45,3 @@ input?: boolean;

};
type Direction = "NONE" | "LEFT" | "FORCE_LEFT" | "RIGHT" | "FORCE_RIGHT";
type Direction = 'NONE' | 'LEFT' | 'FORCE_LEFT' | 'RIGHT' | 'FORCE_RIGHT';
interface AppendTail {

@@ -87,5 +82,10 @@ append(str: string, flags?: AppendFlags): ChangeDetails;

Masked<MaskType>,
"parent" | "prepare" | "validate" | "commit" | "overwrite"
'parent' | 'prepare' | 'validate' | 'commit' | 'overwrite'
>
>;
type MaskedTypedValue<MaskType> = MaskType extends (typeof Number)
? number
: MaskType extends (typeof Date)
? Date
: string;
export class Masked<MaskType> {

@@ -96,3 +96,3 @@ mask: MaskType;

unmaskedValue: string;
typedValue: any;
typedValue: MaskedTypedValue<MaskType>;
rawInputValue: string;

@@ -104,3 +104,3 @@ readonly isComplete: boolean;

masked: Masked<MaskType>,
type: AppendType
flags: AppendFlags,
) => string;

@@ -110,3 +110,3 @@ validate: (

masked: Masked<MaskType>,
type: AppendType
flags: AppendFlags,
) => boolean;

@@ -142,12 +142,12 @@ commit: (value: string, masked: Masked<MaskType>) => void;

type MaskedPatternOptions = MaskedOptions<string> &
type MaskedPatternOptions<MaskType=string> = MaskedOptions<MaskType> &
Partial<
Pick<MaskedPattern, "blocks" | "definitions" | "placeholderChar" | "lazy">
Pick<MaskedPattern<MaskType>, 'blocks' | 'definitions' | 'placeholderChar' | 'lazy'>
>;
type MaskedPatternOptionsDefaults = Pick<
MaskedPattern,
"lazy" | "placeholderChar"
type MaskedPatternOptionsDefaults<MaskType=string> = Pick<
MaskedPattern<MaskType>,
'lazy' | 'placeholderChar'
>;
export class MaskedPattern extends Masked<string> {
static DEFAULTS: MaskedPatternOptionsDefaults;
export class MaskedPattern<MaskType=string> extends Masked<MaskType> {
static DEFAULTS: MaskedPatternOptionsDefaults<string>;
static STOP_CHAR: string;

@@ -160,4 +160,4 @@ static ESCAPE_CHAR: string;

constructor(opts: MaskedPatternOptions);
updateOptions(opts: Partial<MaskedPatternOptions>): void;
constructor(opts: MaskedPatternOptions<MaskType>);
updateOptions(opts: Partial<MaskedPatternOptions<MaskType>>): void;
maskedBlock(name: string): MaskedPattern.PatternBlock | undefined;

@@ -197,3 +197,3 @@ maskedBlocks(name: string): Array<MaskedPattern.PatternBlock>;

InputDefinition,
"parent" | "isOptional" | "lazy" | "placeholderChar"
'parent' | 'isOptional' | 'lazy' | 'placeholderChar'
>;

@@ -233,3 +233,3 @@ class InputDefinition implements PatternBlock {

FixedDefinition,
"char" | "isUnmasking"
'char' | 'isUnmasking'
>;

@@ -265,3 +265,3 @@ class FixedDefinition implements PatternBlock {

type MaskedEnumOptions = MaskedPatternOptions &
Partial<Pick<MaskedEnum, "enum">>;
Partial<Pick<MaskedEnum, 'enum'>>;
export class MaskedEnum extends MaskedPattern {

@@ -275,3 +275,3 @@ readonly enum: Array<string>;

type MaskedRangeOptions = MaskedPatternOptions &
Partial<Pick<MaskedRange, "from" | "to" | "autofix">>;
Partial<Pick<MaskedRange, 'from' | 'to' | 'autofix'>>;
export class MaskedRange extends MaskedPattern {

@@ -291,11 +291,11 @@ readonly maxLength: number;

MaskedNumber,
| "radix"
| "thousandsSeparator"
| "mapToRadix"
| "min"
| "max"
| "scale"
| "signed"
| "normalizeZeros"
| "padFractionalZeros"
| 'radix'
| 'thousandsSeparator'
| 'mapToRadix'
| 'min'
| 'max'
| 'scale'
| 'signed'
| 'normalizeZeros'
| 'padFractionalZeros'
>

@@ -306,9 +306,9 @@ >;

MaskedNumber,
| "radix"
| "thousandsSeparator"
| "mapToRadix"
| "scale"
| "signed"
| "normalizeZeros"
| "padFractionalZeros"
| 'radix'
| 'thousandsSeparator'
| 'mapToRadix'
| 'scale'
| 'signed'
| 'normalizeZeros'
| 'padFractionalZeros'
>;

@@ -325,3 +325,2 @@ readonly radix: string;

readonly allowNegative: boolean;
typedValue: number;
number: number;

@@ -333,12 +332,10 @@

type MaskedDateOptions = {
mask: typeof Date | string;
} & Pick<MaskedPatternOptions, Exclude<keyof MaskedPatternOptions, "mask">> &
type MaskedDateOptions = MaskedPatternOptions<typeof Date> &
Partial<
Pick<
MaskedDate,
"parse" | "format" | "pattern" | "min" | "max" | "autofix"
'parse' | 'format' | 'pattern' | 'min' | 'max' | 'autofix'
>
>;
export class MaskedDate extends MaskedPattern {
export class MaskedDate extends MaskedPattern<typeof Date> {
static GET_DEFAULT_BLOCKS: () => {

@@ -363,4 +360,4 @@ d: {

};
static DEFAULTS: MaskedPatternOptionsDefaults &
Pick<MaskedDate, "pattern" | "format" | "parse">;
static DEFAULTS: MaskedPatternOptionsDefaults<typeof Date> &
Pick<MaskedDate, 'pattern' | 'format' | 'parse'>;
readonly parse: (value: string) => Date;

@@ -373,3 +370,2 @@ readonly format: (value: Date) => string;

date: Date;
typedValue: Date;

@@ -385,3 +381,3 @@ constructor(opts: MaskedDateOptions);

export class MaskedDynamic extends Masked<AnyMaskedOptionsArray> {
static DEFAULTS: Pick<MaskedDynamic, "dispatch">;
static DEFAULTS: Pick<MaskedDynamic, 'dispatch'>;
readonly currentMask?: AnyMasked;

@@ -430,3 +426,3 @@ readonly compiledMasks: Array<AnyMasked>;

? MaskedDynamic
: Masked<Opts["mask"]>;
: Masked<Opts['mask']>;
export function createMask<Opts extends AnyMaskedOptions>(

@@ -436,10 +432,10 @@ opts: Opts

export type AnyMask = AnyMaskedOptions["mask"];
export type AnyMask = AnyMaskedOptions['mask'];
export class InputMask<Opts extends AnyMaskedOptions> {
el: MaskElement;
masked: DeduceMasked<Opts>;
mask: DeduceMasked<Opts>["mask"];
mask: Opts['mask'];
value: string;
unmaskedValue: string;
typedValue: any;
typedValue: MaskedTypedValue<Opts['mask']>;
cursorPos: number;

@@ -446,0 +442,0 @@ readonly selectionStart: number;

{
"name": "imask",
"version": "5.1.6",
"version": "5.1.7",
"author": "Alexey Kryazhev",

@@ -38,3 +38,3 @@ "license": "MIT",

},
"gitHead": "6ee2986e44766c3369d3fe5dca15bec93df25b9b"
"gitHead": "df5348e6aa3314341d20690f85f0e5b2ba70b92b"
}

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

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