!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).VueMask={})}(this,(function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function a(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:o,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"_";if(!u(e))throw new Error("Text-mask:convertMaskToPlaceholder; The mask property must be an array.");if(-1!==e.indexOf(t))throw new Error("Placeholder character must not be used as part of the mask. Please specify a character that is not present in your mask as your placeholder character.\n\n"+"The placeholder character that was received is: ".concat(JSON.stringify(t),"\n\n")+"The mask that was received is: ".concat(JSON.stringify(e)));return e.map((function(e){return e instanceof RegExp?t:e})).join("")}function u(e){return Array.isArray&&Array.isArray(e)||e instanceof Array}function c(e){for(var t,r=[];-1!==(t=e.indexOf("[]"));)r.push(t),e.splice(t,1);return{maskWithoutCaretTraps:e,indexes:r}}var s=[];function f(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:s,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!u(r)){if("function"!==t(r))throw new Error("Text-mask:conformToMask; The mask property must be an array.");r=c(r=r(e,n)).maskWithoutCaretTraps}var a=n.guide,o=void 0===a||a,f=n.previousConformedValue,l=void 0===f?"":f,p=n.placeholderChar,d=void 0===p?"_":p,v=n.placeholder,h=void 0===v?i(r,d):v,y=n.currentCaretPosition,m=n.keepCharPositions,g=!1===o&&void 0!==l,b=e.length,k=l.length,w=h.length,O=r.length,x=b-k,j=x>0,P=y+(j?-x:0),E=P+Math.abs(x);if(!0===m&&!j){for(var M="",T=P;T=P&&t=0;S--){var A=V[S].char;if(A!==d){var C=S>=P&&k===O;A===h[C?S-x:S]&&V.splice(S,1)}}var _="",N=!1;e:for(var D=0;D0)for(;V.length>0;){var U=V.shift(),L=U.char,z=U.isNew;if(L===d&&!0!==g){_+=d;continue e}if(r[D].test(L)){if(!0===m&&!1!==z&&""!==l&&!1!==o&&j){for(var H=V.length,I=null,J=0;J-1?"\\".concat(e):e}(e),"]/"))}(e)};function h(e){return e.split("").map((function(e,t,r){var n=p[e]||e,a=r[t-1];return n===l?null:(p[a]||a)===l?d(v(n)):n})).filter(Boolean)}var y=function(e,t){var r=document.createEvent("HTMLEvents");r.initEvent(t,!0,!0),e.dispatchEvent(r)},m=function(e){return e instanceof HTMLInputElement?e:e.querySelector("input")||e},g="undefined"!=typeof window&&window.navigator.userAgent.toLowerCase(),b=g&&g.indexOf("edge/")>0,k=g&&g.indexOf("android")>0,w=g&&/chrome\/\d+/.test(g)&&!b;function O(e,t){for(var r=0;r1&&void 0!==arguments[1]&&arguments[1],r=e.value,n=x.get(e),a=n.previousValue,o=n.mask,i=n.rawMask,u=r.length!==a.length,c=u,s=r.length?r:"";if(t||c){var l=f(s,o,{guide:!1}),p=l.conformedValue;e.value=p,e.dataset.unmasked=O(p,i),j(e)}x.partiallyUpdate(e,{previousValue:s})}function E(e,t){x.partiallyUpdate(e,{mask:h(t),rawMask:t})}var M={bind:function(e,t){var r=t.value;E(e=m(e),r),P(e)},componentUpdated:function(e,t){var r=t.value,n=t.oldValue;e=m(e);var a=r!==n;a&&E(e,r),P(e,a)},unbind:function(e){e=m(e),x.remove(e)}};function T(e,t){return f(e,h(t),{guide:!1}).conformedValue}var V=function(e){e.directive("mask",M),e.filter("VMask",T)};e.VueMaskDirective=M,e.VueMaskFilter=T,e.VueMaskPlugin=V,e.default=V,Object.defineProperty(e,"__esModule",{value:!0})}));