/*
 Input Mask plugin for jquery
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2014 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Version: 2.4.18
*/
(function(e){if(void 0===e.fn.inputmask){var R=function(e){var k=document.createElement("input");e="on"+e;var a=e in k;a||(k.setAttribute(e,"return;"),a="function"==typeof k[e]);return a},F=function(f,k,a){return(f=a.aliases[f])?(f.alias&&F(f.alias,void 0,a),e.extend(!0,a,f),e.extend(!0,a,k),!0):!1},C=function(f){function k(a){f.numericInput&&(a=a.split("").reverse().join(""));var c=!1,k=0,m=f.greedy,n=f.repeat;"*"==n&&(m=!1);1==a.length&&!1==m&&0!=n&&(f.placeholder="");a=e.map(a.split(""),function(a,
e){var l=[];if(a==f.escapeChar)c=!0;else if(a!=f.optionalmarker.start&&a!=f.optionalmarker.end||c){var p=f.definitions[a];if(p&&!c)for(var n=0;n<p.cardinality;n++)l.push(f.placeholder.charAt((k+n)%f.placeholder.length));else l.push(a),c=!1;k+=l.length;return l}});for(var r=a.slice(),p=1;p<n&&m;p++)r=r.concat(a.slice());return{mask:r,repeat:n,greedy:m}}function a(a){f.numericInput&&(a=a.split("").reverse().join(""));var c=!1,n=!1,k=!1;return e.map(a.split(""),function(a,e){var l=[];if(a==f.escapeChar)n=
!0;else{if(a!=f.optionalmarker.start||n){if(a!=f.optionalmarker.end||n){var h=f.definitions[a];if(h&&!n){for(var q=h.prevalidator,G=q?q.length:0,w=1;w<h.cardinality;w++){var B=G>=w?q[w-1]:[],K=B.validator,B=B.cardinality;l.push({fn:K?"string"==typeof K?RegExp(K):new function(){this.test=K}:/./,cardinality:B?B:1,optionality:c,newBlockMarker:!0==c?k:!1,offset:0,casing:h.casing,def:h.definitionSymbol||a});!0==c&&(k=!1)}l.push({fn:h.validator?"string"==typeof h.validator?RegExp(h.validator):new function(){this.test=
h.validator}:/./,cardinality:h.cardinality,optionality:c,newBlockMarker:k,offset:0,casing:h.casing,def:h.definitionSymbol||a})}else l.push({fn:null,cardinality:0,optionality:c,newBlockMarker:k,offset:0,casing:null,def:a}),n=!1;k=!1;return l}c=!1}else c=!0;k=!0}})}function h(a){for(var e=a.length,c=0;c<e&&a.charAt(c)!=f.optionalmarker.start;c++);var k=[a.substring(0,c)];c<e&&k.push(a.substring(c+1,e));return k}function c(l,s,w){for(var m=0,x=0,r=s.length,p=0;p<r&&!(s.charAt(p)==f.optionalmarker.start&&
m++,s.charAt(p)==f.optionalmarker.end&&x++,0<m&&m==x);p++);m=[s.substring(0,p)];p<r&&m.push(s.substring(p+1,r));p=h(m[0]);1<p.length?(s=l+p[0]+(f.optionalmarker.start+p[1]+f.optionalmarker.end)+(1<m.length?m[1]:""),-1==e.inArray(s,n)&&""!=s&&(n.push(s),r=k(s),q.push({mask:s,_buffer:r.mask,buffer:r.mask.slice(),tests:a(s),lastValidPosition:-1,greedy:r.greedy,repeat:r.repeat,metadata:w})),s=l+p[0]+(1<m.length?m[1]:""),-1==e.inArray(s,n)&&""!=s&&(n.push(s),r=k(s),q.push({mask:s,_buffer:r.mask,buffer:r.mask.slice(),
tests:a(s),lastValidPosition:-1,greedy:r.greedy,repeat:r.repeat,metadata:w})),1<h(p[1]).length&&c(l+p[0],p[1]+m[1],w),1<m.length&&1<h(m[1]).length&&(c(l+p[0]+(f.optionalmarker.start+p[1]+f.optionalmarker.end),m[1],w),c(l+p[0],m[1],w))):(s=l+m,-1==e.inArray(s,n)&&""!=s&&(n.push(s),r=k(s),q.push({mask:s,_buffer:r.mask,buffer:r.mask.slice(),tests:a(s),lastValidPosition:-1,greedy:r.greedy,repeat:r.repeat,metadata:w})))}var q=[],n=[];e.isFunction(f.mask)&&(f.mask=f.mask.call(this,f));e.isArray(f.mask)?
e.each(f.mask,function(a,e){void 0!=e.mask?c("",e.mask.toString(),e):c("",e.toString())}):c("",f.mask.toString());return f.greedy?q:q.sort(function(a,e){return a.mask.length-e.mask.length})},da=null!==navigator.userAgent.match(/msie 10/i),ea=null!==navigator.userAgent.match(/iphone/i),fa=null!==navigator.userAgent.match(/android.*safari.*/i),W=null!==navigator.userAgent.match(/android.*chrome.*/i),ga=R("paste")?"paste":R("input")?"input":"propertychange",w=function(f,k,a,h){function c(){return f[k]}
function q(){return c().tests}function n(){return c()._buffer}function l(){return c().buffer}function s(y,d,b){function g(y,b,d,g){for(var e=x(y),c=d?1:0,v="",L=b.buffer,f=b.tests[e].cardinality;f>c;f--)v+=G(L,e-(f-1));d&&(v+=d);return null!=b.tests[e].fn?b.tests[e].fn.test(v,L,y,g,a):d==G(b._buffer,y,!0)||d==a.skipOptionalPartCharacter?{refresh:!0,c:G(b._buffer,y,!0),pos:y}:!1}if(b=!0===b){var v=g(y,c(),d,b);!0===v&&(v={pos:y});return v}var L=[],v=!1,E=k,n=l().slice(),h=c().lastValidPosition;H(y);
var s=[];e.each(f,function(a,e){if("object"==typeof e){k=a;var f=y,u=c().lastValidPosition,q;if(u==h){if(1<f-h)for(u=-1==u?0:u;u<f&&(q=g(u,c(),n[u],!0),!1!==q);u++)I(l(),u,n[u],!0),!0===q&&(q={pos:u}),q=q.pos||u,c().lastValidPosition<q&&(c().lastValidPosition=q);if(!m(f)&&!g(f,c(),d,b)){u=p(f)-f;for(q=0;q<u&&!1===g(++f,c(),d,b);q++);s.push(k)}}(c().lastValidPosition>=h||k==E)&&0<=f&&f<r()&&(v=g(f,c(),d,b),!1!==v&&(!0===v&&(v={pos:f}),q=v.pos||f,c().lastValidPosition<q&&(c().lastValidPosition=q)),
L.push({activeMasksetIndex:a,result:v}))}});k=E;return function(a,b){var v=!1;e.each(b,function(y,b){if(v=-1==e.inArray(b.activeMasksetIndex,a)&&!1!==b.result)return!1});if(v)b=e.map(b,function(y,b){if(-1==e.inArray(y.activeMasksetIndex,a))return y;f[y.activeMasksetIndex].lastValidPosition=h});else{var c=-1,L=-1,l;e.each(b,function(y,b){-1!=e.inArray(b.activeMasksetIndex,a)&&!1!==b.result&(-1==c||c>b.result.pos)&&(c=b.result.pos,L=b.activeMasksetIndex)});b=e.map(b,function(b,v){if(-1!=e.inArray(b.activeMasksetIndex,
a)){if(b.result.pos==c)return b;if(!1!==b.result){for(var E=y;E<c;E++)if(l=g(E,f[b.activeMasksetIndex],f[L].buffer[E],!0),!1===l){f[b.activeMasksetIndex].lastValidPosition=c-1;break}else I(f[b.activeMasksetIndex].buffer,E,f[L].buffer[E],!0),f[b.activeMasksetIndex].lastValidPosition=E;l=g(c,f[b.activeMasksetIndex],d,!0);!1!==l&&(I(f[b.activeMasksetIndex].buffer,c,d,!0),f[b.activeMasksetIndex].lastValidPosition=c);return b}}})}return b}(s,L)}function w(){var a=k,d={activeMasksetIndex:0,lastValidPosition:-1,
next:-1};e.each(f,function(a,y){"object"==typeof y&&(k=a,c().lastValidPosition>d.lastValidPosition?(d.activeMasksetIndex=a,d.lastValidPosition=c().lastValidPosition,d.next=p(c().lastValidPosition)):c().lastValidPosition==d.lastValidPosition&&(-1==d.next||d.next>p(c().lastValidPosition))&&(d.activeMasksetIndex=a,d.lastValidPosition=c().lastValidPosition,d.next=p(c().lastValidPosition)))});k=-1!=d.lastValidPosition&&f[a].lastValidPosition==d.lastValidPosition?a:d.activeMasksetIndex;a!=k&&(K(l(),p(d.lastValidPosition),
r()),c().writeOutBuffer=!0);t.data("_inputmask").activeMasksetIndex=k}function m(a){a=x(a);a=q()[a];return void 0!=a?a.fn:!1}function x(a){return a%q().length}function r(){return a.getMaskLength(n(),c().greedy,c().repeat,l(),a)}function p(a){var d=r();if(a>=d)return d;for(;++a<d&&!m(a););return a}function H(a){if(0>=a)return 0;for(;0<--a&&!m(a););return a}function I(a,d,b,g){g&&(d=F(a,d));g=q()[x(d)];var c=b;if(void 0!=c&&void 0!=g)switch(g.casing){case "upper":c=b.toUpperCase();break;case "lower":c=
b.toLowerCase()}a[d]=c}function G(a,d,b){b&&(d=F(a,d));return a[d]}function F(a,d){for(var b;void 0==a[d]&&a.length<r();)for(b=0;void 0!==n()[b];)a.push(n()[b++]);return d}function B(a,d,b){a._valueSet(d.join(""));void 0!=b&&z(a,b)}function K(a,d,b,c){for(var e=r();d<b&&d<e;d++)!0===c?m(d)||I(a,d,""):I(a,d,G(n().slice(),d,!0))}function C(a,d){var b=x(d);I(a,d,G(n(),b))}function N(y){return a.placeholder.charAt(y%a.placeholder.length)}function O(a,d,b,g,v){g=void 0!=g?g.slice():S(a._valueGet()).split("");
e.each(f,function(a,b){"object"==typeof b&&(b.buffer=b._buffer.slice(),b.lastValidPosition=-1,b.p=-1)});!0!==b&&(k=0);d&&a._valueSet("");r();e.each(g,function(g,f){if(!0===v){var l=c().p,l=-1==l?l:H(l),k=-1==l?g:p(l);-1==e.inArray(f,n().slice(l+1,k))&&T.call(a,void 0,!0,f.charCodeAt(0),d,b,g)}else T.call(a,void 0,!0,f.charCodeAt(0),d,b,g)});!0===b&&-1!=c().p&&(c().lastValidPosition=H(c().p))}function R(a){return e.inputmask.escapeRegex.call(this,a)}function S(a){return a.replace(RegExp("("+R(n().join(""))+
")*$"),"")}function U(a){var d=l(),b=d.slice(),c,e;for(e=b.length-1;0<=e;e--)if(c=x(e),q()[c].optionality)if(m(e)&&s(e,d[e],!0))break;else b.pop();else break;B(a,b)}function ha(c,d){if(!q()||!0!==d&&c.hasClass("hasDatepicker"))return c[0]._valueGet();var b=e.map(l(),function(a,b){return m(b)&&s(b,a,!0)?a:null}),b=(A?b.reverse():b).join("");return void 0!=a.onUnMask?a.onUnMask.call(this,l().join(""),b):b}function J(c){!A||"number"!=typeof c||a.greedy&&""==a.placeholder||(c=l().length-c);return c}function z(c,
d,b){var g=c.jquery&&0<c.length?c[0]:c;if("number"==typeof d)d=J(d),b=J(b),e(c).is(":visible")&&(b="number"==typeof b?b:d,g.scrollLeft=g.scrollWidth,!1==a.insertMode&&d==b&&b++,g.setSelectionRange?(g.selectionStart=d,g.selectionEnd=fa?d:b):g.createTextRange&&(c=g.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",d),c.select()));else{if(!e(c).is(":visible"))return{begin:0,end:0};g.setSelectionRange?(d=g.selectionStart,b=g.selectionEnd):document.selection&&document.selection.createRange&&
(c=document.selection.createRange(),d=0-c.duplicate().moveStart("character",-1E5),b=d+c.text.length);d=J(d);b=J(b);return{begin:d,end:b}}}function P(c){if("*"!=a.repeat){var d=!1,b=0,g=k;e.each(f,function(a,e){if("object"==typeof e){k=a;var g=H(r());if(e.lastValidPosition>=b&&e.lastValidPosition==g){for(var f=!0,l=0;l<=g;l++){var h=m(l),p=x(l);if(h&&(void 0==c[l]||c[l]==N(l))||!h&&c[l]!=n()[p]){f=!1;break}}if(d=d||f)return!1}b=e.lastValidPosition}});k=g;return d}}function ia(a){a=e._data(a).events;
e.each(a,function(a,b){e.each(b,function(a,b){if("inputmask"==b.namespace&&"setvalue"!=b.type){var c=b.handler;b.handler=function(a){if(this.readOnly||this.disabled)a.preventDefault;else return c.apply(this,arguments)}}})})}function ja(a){var c;Object.getOwnPropertyDescriptor&&(c=Object.getOwnPropertyDescriptor(a,"value"));if(c&&c.get){if(!a._valueGet){var b=c.get,g=c.set;a._valueGet=function(){return A?b.call(this).split("").reverse().join(""):b.call(this)};a._valueSet=function(a){g.call(this,A?
a.split("").reverse().join(""):a)};Object.defineProperty(a,"value",{get:function(){var a=e(this),c=e(this).data("_inputmask"),d=c.masksets,g=c.activeMasksetIndex;return c&&c.opts.autoUnmask?a.inputmask("unmaskedvalue"):b.call(this)!=d[g]._buffer.join("")?b.call(this):""},set:function(a){g.call(this,a);e(this).triggerHandler("setvalue.inputmask")}})}}else if(document.__lookupGetter__&&a.__lookupGetter__("value"))a._valueGet||(b=a.__lookupGetter__("value"),g=a.__lookupSetter__("value"),a._valueGet=
function(){return A?b.call(this).split("").reverse().join(""):b.call(this)},a._valueSet=function(a){g.call(this,A?a.split("").reverse().join(""):a)},a.__defineGetter__("value",function(){var a=e(this),c=e(this).data("_inputmask"),d=c.masksets,g=c.activeMasksetIndex;return c&&c.opts.autoUnmask?a.inputmask("unmaskedvalue"):b.call(this)!=d[g]._buffer.join("")?b.call(this):""}),a.__defineSetter__("value",function(a){g.call(this,a);e(this).triggerHandler("setvalue.inputmask")}));else if(a._valueGet||(a._valueGet=
function(){return A?this.value.split("").reverse().join(""):this.value},a._valueSet=function(a){this.value=A?a.split("").reverse().join(""):a}),void 0==e.valHooks.text||!0!=e.valHooks.text.inputmaskpatch)b=e.valHooks.text&&e.valHooks.text.get?e.valHooks.text.get:function(a){return a.value},g=e.valHooks.text&&e.valHooks.text.set?e.valHooks.text.set:function(a,b){a.value=b;return a},jQuery.extend(e.valHooks,{text:{get:function(a){var c=e(a);if(c.data("_inputmask")){if(c.data("_inputmask").opts.autoUnmask)return c.inputmask("unmaskedvalue");
a=b(a);c=c.data("_inputmask");return a!=c.masksets[c.activeMasksetIndex]._buffer.join("")?a:""}return b(a)},set:function(a,b){var c=e(a),d=g(a,b);c.data("_inputmask")&&c.triggerHandler("setvalue.inputmask");return d},inputmaskpatch:!0}})}function X(a,d,b,e){var f=l();if(!1!==e)for(;!m(a)&&0<=a-1;)a--;for(e=a;e<d&&e<r();e++)if(m(e)){C(f,e);var k=p(e),h=G(f,k);if(h!=N(k))if(k<r()&&!1!==s(e,h,!0)&&q()[x(e)].def==q()[x(k)].def)I(f,e,h,!0);else if(m(e))break}else C(f,e);void 0!=b&&I(f,H(d),b);if(!1==c().greedy){d=
S(f.join("")).split("");f.length=d.length;e=0;for(b=f.length;e<b;e++)f[e]=d[e];0==f.length&&(c().buffer=n().slice())}return a}function Y(a,e,b){var f=l();if(G(f,a,!0)!=N(a))for(var k=H(e);k>a&&0<=k;k--)if(m(k)){var h=H(k),p=G(f,h);p!=N(h)&&!1!==s(h,p,!0)&&q()[x(k)].def==q()[x(h)].def&&(I(f,k,p,!0),C(f,h))}else C(f,k);void 0!=b&&G(f,a)==N(a)&&I(f,a,b);a=f.length;if(!1==c().greedy){b=S(f.join("")).split("");f.length=b.length;k=0;for(h=f.length;k<h;k++)f[k]=b[k];0==f.length&&(c().buffer=n().slice())}return e-
(a-f.length)}function Z(e,d,b){if(a.numericInput||A){switch(d){case a.keyCode.BACKSPACE:d=a.keyCode.DELETE;break;case a.keyCode.DELETE:d=a.keyCode.BACKSPACE}if(A){var g=b.end;b.end=b.begin;b.begin=g}}g=!0;b.begin==b.end?(g=d==a.keyCode.BACKSPACE?b.begin-1:b.begin,a.isNumeric&&""!=a.radixPoint&&l()[g]==a.radixPoint&&(b.begin=l().length-1==g?b.begin:d==a.keyCode.BACKSPACE?g:p(g),b.end=b.begin),g=!1,d==a.keyCode.BACKSPACE?b.begin--:d==a.keyCode.DELETE&&b.end++):1!=b.end-b.begin||a.insertMode||(g=!1,
d==a.keyCode.BACKSPACE&&b.begin--);K(l(),b.begin,b.end);var k=r();if(!1==a.greedy)X(b.begin,k,void 0,!A&&d==a.keyCode.BACKSPACE&&!g);else{for(var h=b.begin,n=b.begin;n<b.end;n++)if(m(n)||!g)h=X(b.begin,k,void 0,!A&&d==a.keyCode.BACKSPACE&&!g);g||(b.begin=h)}d=p(-1);K(l(),b.begin,b.end,!0);O(e,!1,void 0==f[1]||d>=b.end,l());c().lastValidPosition<d?(c().lastValidPosition=-1,c().p=d):c().p=b.begin}function $(f){V=!1;var d=this,b=e(d),g=f.keyCode,k=z(d);g==a.keyCode.BACKSPACE||g==a.keyCode.DELETE||ea&&
127==g||f.ctrlKey&&88==g?(f.preventDefault(),88==g&&(M=l().join("")),Z(d,g,k),w(),B(d,l(),c().p),d._valueGet()==n().join("")&&b.trigger("cleared"),a.showTooltip&&b.prop("title",c().mask)):g==a.keyCode.END||g==a.keyCode.PAGE_DOWN?setTimeout(function(){var b=p(c().lastValidPosition);a.insertMode||b!=r()||f.shiftKey||b--;z(d,f.shiftKey?k.begin:b,b)},0):g==a.keyCode.HOME&&!f.shiftKey||g==a.keyCode.PAGE_UP?z(d,0,f.shiftKey?k.begin:0):g==a.keyCode.ESCAPE||90==g&&f.ctrlKey?(O(d,!0,!1,M.split("")),b.click()):
g!=a.keyCode.INSERT||f.shiftKey||f.ctrlKey?!1!=a.insertMode||f.shiftKey||(g==a.keyCode.RIGHT?setTimeout(function(){var a=z(d);z(d,a.begin)},0):g==a.keyCode.LEFT&&setTimeout(function(){var a=z(d);z(d,a.begin-1)},0)):(a.insertMode=!a.insertMode,z(d,a.insertMode||k.begin!=r()?k.begin:k.begin-1));b=z(d);!0===a.onKeyDown.call(this,f,l(),a)&&z(d,b.begin,b.end);aa=-1!=e.inArray(g,a.ignorables)}function T(h,d,b,g,n,q){if(void 0==b&&V)return!1;V=!0;var E=e(this);h=h||window.event;b=d?b:h.which||h.charCode||
h.keyCode;if(!(!0===d||h.ctrlKey&&h.altKey)&&(h.ctrlKey||h.metaKey||aa))return!0;if(b){!0!==d&&46==b&&!1==h.shiftKey&&","==a.radixPoint&&(b=44);var m,t,x=String.fromCharCode(b);d?(b=n?q:c().lastValidPosition+1,m={begin:b,end:b}):m=z(this);q=A?1<m.begin-m.end||1==m.begin-m.end&&a.insertMode:1<m.end-m.begin||1==m.end-m.begin&&a.insertMode;var F=k;q&&(k=F,e.each(f,function(a,b){"object"==typeof b&&(k=a,c().undoBuffer=l().join(""))}),Z(this,a.keyCode.DELETE,m),a.insertMode||e.each(f,function(a,b){"object"==
typeof b&&(k=a,Y(m.begin,r()),c().lastValidPosition=p(c().lastValidPosition))}),k=F);var C=l().join("").indexOf(a.radixPoint);a.isNumeric&&!0!==d&&-1!=C&&(a.greedy&&m.begin<=C?(m.begin=H(m.begin),m.end=m.begin):x==a.radixPoint&&(m.begin=C,m.end=m.begin));var D=m.begin;b=s(D,x,n);!0===n&&(b=[{activeMasksetIndex:k,result:b}]);var u=-1;e.each(b,function(b,e){k=e.activeMasksetIndex;c().writeOutBuffer=!0;var d=e.result;if(!1!==d){var f=!1,g=l();!0!==d&&(f=d.refresh,D=void 0!=d.pos?d.pos:D,x=void 0!=d.c?
d.c:x);if(!0!==f){if(!0==a.insertMode){d=r();for(g=g.slice();G(g,d,!0)!=N(d)&&d>=D;)d=0==d?-1:H(d);d>=D?(Y(D,r(),x),g=c().lastValidPosition,d=p(g),d!=r()&&g>=D&&G(l(),d,!0)!=N(d)&&(c().lastValidPosition=d)):c().writeOutBuffer=!1}else I(g,D,x,!0);if(-1==u||u>p(D))u=p(D)}else!n&&(g=D<r()?D+1:D,-1==u||u>g)&&(u=g);u>c().p&&(c().p=u)}});!0!==n&&(k=F,w());if(!1!==g&&(e.each(b,function(a,b){if(b.activeMasksetIndex==k)return t=b,!1}),void 0!=t)){var K=this;setTimeout(function(){a.onKeyValidation.call(K,t.result,
a)},0);if(c().writeOutBuffer&&!1!==t.result){var J=l();g=d?void 0:a.numericInput?D>C?H(u):x==a.radixPoint?u-1:H(u-1):u;B(this,J,g);!0!==d&&setTimeout(function(){!0===P(J)&&E.trigger("complete");Q=!0;E.trigger("input")},0)}else q&&(c().buffer=c().undoBuffer.split(""))}a.showTooltip&&E.prop("title",c().mask);h&&h.preventDefault()}}function ka(c){var d=e(this),b=c.keyCode,f=l();W&&b==a.keyCode.BACKSPACE&&ba==this._valueGet()&&$.call(this,c);a.onKeyUp.call(this,c,f,a);b==a.keyCode.TAB&&a.showMaskOnFocus&&
(d.hasClass("focus.inputmask")&&0==this._valueGet().length?(f=n().slice(),B(this,f),z(this,0),M=l().join("")):(B(this,f),f.join("")==n().join("")&&-1!=e.inArray(a.radixPoint,f)?(z(this,J(0)),d.click()):z(this,J(0),J(r()))))}function ca(a){if(!0===Q)return Q=!1,!0;a=e(this);ba=l().join("");O(this,!1,!1);B(this,l());!0===P(l())&&a.trigger("complete");a.click()}function la(h){t=e(h);if(t.is(":input")){t.data("_inputmask",{masksets:f,activeMasksetIndex:k,opts:a,isRTL:!1});a.showTooltip&&t.prop("title",
c().mask);c().greedy=c().greedy?c().greedy:0==c().repeat;if(null!=t.attr("maxLength")){var d=t.prop("maxLength");-1<d&&e.each(f,function(a,b){"object"==typeof b&&"*"==b.repeat&&(b.repeat=d)});r()>=d&&-1<d&&(d<n().length&&(n().length=d),!1==c().greedy&&(c().repeat=Math.round(d/n().length)),t.prop("maxLength",2*r()))}ja(h);a.numericInput&&(a.isNumeric=a.numericInput);("rtl"==h.dir||a.numericInput&&a.rightAlignNumerics||a.isNumeric&&a.rightAlignNumerics)&&t.css("text-align","right");if("rtl"==h.dir||
a.numericInput){h.dir="ltr";t.removeAttr("dir");var b=t.data("_inputmask");b.isRTL=!0;t.data("_inputmask",b);A=!0}t.unbind(".inputmask");t.removeClass("focus.inputmask");t.closest("form").bind("submit",function(){M!=l().join("")&&t.change()}).bind("reset",function(){setTimeout(function(){t.trigger("setvalue")},0)});t.bind("mouseenter.inputmask",function(){!e(this).hasClass("focus.inputmask")&&a.showMaskOnHover&&this._valueGet()!=l().join("")&&B(this,l())}).bind("blur.inputmask",function(){var b=e(this),
c=this._valueGet(),d=l();b.removeClass("focus.inputmask");M!=l().join("")&&b.change();a.clearMaskOnLostFocus&&""!=c&&(c==n().join("")?this._valueSet(""):U(this));!1===P(d)&&(b.trigger("incomplete"),a.clearIncomplete&&(e.each(f,function(a,b){"object"==typeof b&&(b.buffer=b._buffer.slice(),b.lastValidPosition=-1)}),k=0,a.clearMaskOnLostFocus?this._valueSet(""):(d=n().slice(),B(this,d))))}).bind("focus.inputmask",function(){var b=e(this),d=this._valueGet();a.showMaskOnFocus&&!b.hasClass("focus.inputmask")&&
(!a.showMaskOnHover||a.showMaskOnHover&&""==d)&&this._valueGet()!=l().join("")&&B(this,l(),p(c().lastValidPosition));b.addClass("focus.inputmask");M=l().join("")}).bind("mouseleave.inputmask",function(){var b=e(this);a.clearMaskOnLostFocus&&(b.hasClass("focus.inputmask")||this._valueGet()==b.attr("placeholder")||(this._valueGet()==n().join("")||""==this._valueGet()?this._valueSet(""):U(this)))}).bind("click.inputmask",function(){var b=this;setTimeout(function(){var d=z(b),f=l();if(d.begin==d.end){var d=
A?J(d.begin):d.begin,g=c().lastValidPosition,f=a.isNumeric?!1===a.skipRadixDance&&""!=a.radixPoint&&-1!=e.inArray(a.radixPoint,f)?a.numericInput?p(e.inArray(a.radixPoint,f)):e.inArray(a.radixPoint,f):p(g):p(g);d<f?m(d)?z(b,d):z(b,p(d)):z(b,f)}},0)}).bind("dblclick.inputmask",function(){var a=this;setTimeout(function(){z(a,0,p(c().lastValidPosition))},0)}).bind(ga+".inputmask dragdrop.inputmask drop.inputmask",function(b){if(!0===Q)return Q=!1,!0;var c=this,d=e(c);if("propertychange"==b.type&&c._valueGet().length<=
r())return!0;setTimeout(function(){var b=void 0!=a.onBeforePaste?a.onBeforePaste.call(this,c._valueGet()):c._valueGet();O(c,!0,!1,b.split(""),!0);!0===P(l())&&d.trigger("complete");d.click()},0)}).bind("setvalue.inputmask",function(){O(this,!0);M=l().join("");this._valueGet()==n().join("")&&this._valueSet("")}).bind("complete.inputmask",a.oncomplete).bind("incomplete.inputmask",a.onincomplete).bind("cleared.inputmask",a.oncleared).bind("keyup.inputmask",ka);W?t.bind("input.inputmask",ca):t.bind("keydown.inputmask",
$).bind("keypress.inputmask",T);da&&t.bind("input.inputmask",ca);O(h,!0,!1);M=l().join("");var g;try{g=document.activeElement}catch(q){}g===h?(t.addClass("focus.inputmask"),z(h,p(c().lastValidPosition))):a.clearMaskOnLostFocus?l().join("")==n().join("")?h._valueSet(""):U(h):B(h,l());ia(h)}}var A=!1,M=l().join(""),t,ba,V=!1,Q=!1,aa=!1;if(void 0!=h)switch(h.action){case "isComplete":return P(h.buffer);case "unmaskedvalue":return A=h.$input.data("_inputmask").isRTL,ha(h.$input,h.skipDatepickerCheck);
case "mask":la(h.el);break;case "format":return t=e({}),t.data("_inputmask",{masksets:f,activeMasksetIndex:k,opts:a,isRTL:a.numericInput}),a.numericInput&&(a.isNumeric=a.numericInput,A=!0),O(t,!1,!1,h.value.split(""),!0),l().join("")}};e.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},escapeChar:"\\",mask:null,oncomplete:e.noop,onincomplete:e.noop,oncleared:e.noop,repeat:0,greedy:!0,autoUnmask:!1,clearMaskOnLostFocus:!0,
insertMode:!0,clearIncomplete:!1,aliases:{},onKeyUp:e.noop,onKeyDown:e.noop,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:e.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,isNumeric:!1,radixPoint:"",skipRadixDance:!1,rightAlignNumerics:!0,definitions:{9:{validator:"[0-9]",cardinality:1},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451]",cardinality:1},"*":{validator:"[A-Za-z\u0410-\u044f\u0401\u04510-9]",cardinality:1}},keyCode:{ALT:18,
BACKSPACE:8,CAPS_LOCK:20,COMMA:188,COMMAND:91,COMMAND_LEFT:91,COMMAND_RIGHT:93,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,MENU:93,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38,WINDOWS:91},ignorables:[8,9,13,19,27,33,34,35,36,37,38,39,40,45,46,93,112,113,114,115,116,117,118,119,120,121,122,123],getMaskLength:function(e,k,a,h,
c){c=e.length;k||("*"==a?c=h.length+1:1<a&&(c+=e.length*(a-1)));return c}},escapeRegex:function(e){return e.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","gim"),"\\$1")},format:function(f,k){var a=e.extend(!0,{},e.inputmask.defaults,k);F(a.alias,k,a);return w(C(a),0,a,{action:"format",value:f})}};e.fn.inputmask=function(f,k){var a=e.extend(!0,{},e.inputmask.defaults,k),h,c=0;if("string"===typeof f)switch(f){case "mask":return F(a.alias,k,a),h=C(a),0==h.length?this:this.each(function(){w(e.extend(!0,
{},h),0,a,{action:"mask",el:this})});case "unmaskedvalue":var q=e(this);return q.data("_inputmask")?(h=q.data("_inputmask").masksets,c=q.data("_inputmask").activeMasksetIndex,a=q.data("_inputmask").opts,w(h,c,a,{action:"unmaskedvalue",$input:q})):q.val();case "remove":return this.each(function(){var f=e(this);if(f.data("_inputmask")){h=f.data("_inputmask").masksets;c=f.data("_inputmask").activeMasksetIndex;a=f.data("_inputmask").opts;this._valueSet(w(h,c,a,{action:"unmaskedvalue",$input:f,skipDatepickerCheck:!0}));
f.removeData("_inputmask");f.unbind(".inputmask");f.removeClass("focus.inputmask");var k;Object.getOwnPropertyDescriptor&&(k=Object.getOwnPropertyDescriptor(this,"value"));k&&k.get?this._valueGet&&Object.defineProperty(this,"value",{get:this._valueGet,set:this._valueSet}):document.__lookupGetter__&&this.__lookupGetter__("value")&&this._valueGet&&(this.__defineGetter__("value",this._valueGet),this.__defineSetter__("value",this._valueSet));try{delete this._valueGet,delete this._valueSet}catch(q){this._valueSet=
this._valueGet=void 0}}});case "getemptymask":return this.data("_inputmask")?(h=this.data("_inputmask").masksets,c=this.data("_inputmask").activeMasksetIndex,h[c]._buffer.join("")):"";case "hasMaskedValue":return this.data("_inputmask")?!this.data("_inputmask").opts.autoUnmask:!1;case "isComplete":return h=this.data("_inputmask").masksets,c=this.data("_inputmask").activeMasksetIndex,a=this.data("_inputmask").opts,w(h,c,a,{action:"isComplete",buffer:this[0]._valueGet().split("")});case "getmetadata":if(this.data("_inputmask"))return h=
this.data("_inputmask").masksets,c=this.data("_inputmask").activeMasksetIndex,h[c].metadata;break;default:return F(f,k,a)||(a.mask=f),h=C(a),0==h.length?this:this.each(function(){w(e.extend(!0,{},h),c,a,{action:"mask",el:this})})}else{if("object"==typeof f)return a=e.extend(!0,{},e.inputmask.defaults,f),F(a.alias,f,a),h=C(a),0==h.length?this:this.each(function(){w(e.extend(!0,{},h),c,a,{action:"mask",el:this})});if(void 0==f)return this.each(function(){var c=e(this).attr("data-inputmask");if(c&&""!=
c)try{var c=c.replace(RegExp("'","g"),'"'),f=e.parseJSON("{"+c+"}");e.extend(!0,f,k);a=e.extend(!0,{},e.inputmask.defaults,f);F(a.alias,f,a);a.alias=void 0;e(this).inputmask(a)}catch(h){}})}}}})(jQuery);
