/*
 Input Mask plugin for jquery
 http://github.com/RobinHerbots/jquery.inputmask
 Copyright (c) 2010 - 2013 Robin Herbots
 Licensed under the MIT license (http://www.opensource.org/licenses/mit-license.php)
 Version: 2.2.18
*/
(function(e){void 0==e.fn.inputmask&&(e.inputmask={defaults:{placeholder:"_",optionalmarker:{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,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:e.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,radixPoint:"",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:[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,E,Q){var N=e.length;!E&&1<Q&&(N+=e.length*(Q-1));return N}},val:e.fn.val,escapeRegex:function(e){return e.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","gim"),"\\$1")}},e.fn.inputmask=function(w,E){var Q,N;function I(a,c){var f=b.aliases[a];return f?(f.alias&&I(f.alias),e.extend(!0,b,f),e.extend(!0,b,c),!0):!1}function O(a){var c=
!1,f=0,l=b.greedy,x=b.repeat;1==a.length&&!1==l&&(b.placeholder="");for(var a=e.map(a.split(""),function(a){var e=[];if(a==b.escapeChar)c=true;else if(a!=b.optionalmarker.start&&a!=b.optionalmarker.end||c){var l=b.definitions[a];if(l&&!c)for(a=0;a<l.cardinality;a++)e.push(F(f+a));else{e.push(a);c=false}f=f+e.length;return e}}),p=a.slice(),j=1;j<x&&l;j++)p=p.concat(a.slice());return{mask:p,repeat:x,greedy:l}}function S(a){var c=!1,f=!1,l=!1;return e.map(a.split(""),function(a){var e=[];if(a==b.escapeChar)f=
!0;else if(a==b.optionalmarker.start&&!f)l=c=!0;else if(a==b.optionalmarker.end&&!f)c=!1,l=!0;else{var j=b.definitions[a];if(j&&!f){for(var J=j.prevalidator,g=J?J.length:0,k=1;k<j.cardinality;k++){var d=g>=k?J[k-1]:[],h=d.validator,d=d.cardinality;e.push({fn:h?"string"==typeof h?RegExp(h):new function(){this.test=h}:/./,cardinality:d?d:1,optionality:c,newBlockMarker:!0==c?l:!1,offset:0,casing:j.casing,def:j.definitionSymbol|a});!0==c&&(l=!1)}e.push({fn:j.validator?"string"==typeof j.validator?RegExp(j.validator):
new function(){this.test=j.validator}:/./,cardinality:j.cardinality,optionality:c,newBlockMarker:l,offset:0,casing:j.casing,def:j.definitionSymbol|a})}else e.push({fn:null,cardinality:0,optionality:c,newBlockMarker:l,offset:0,casing:null,def:a}),f=!1;l=!1;return e}})}function X(){function a(a){var c=a.length;for(i=0;i<c&&a.charAt(i)!=b.optionalmarker.start;i++);var f=[a.substring(0,i)];i<c&&f.push(a.substring(i+1,c));return f}function c(x,p){var j=0,h=0,g=p.length;for(i=0;i<g&&!(p.charAt(i)==b.optionalmarker.start&&
j++,p.charAt(i)==b.optionalmarker.end&&h++,0<j&&j==h);i++);j=[p.substring(0,i)];i<g&&j.push(p.substring(i+1,g));var k=a(j[0]);if(1<k.length){if(g=x+k[0]+(b.optionalmarker.start+k[1]+b.optionalmarker.end)+(1<j.length?j[1]:""),-1==e.inArray(g,l)&&(l.push(g),h=O(g),f.push({mask:g,_buffer:h.mask,tests:S(g),lastValidPosition:void 0,greedy:h.greedy,repeat:h.repeat})),g=x+k[0]+(1<j.length?j[1]:""),-1==e.inArray(g,l)&&(l.push(g),h=O(g),f.push({mask:g,_buffer:h.mask,tests:S(g),lastValidPosition:void 0,greedy:h.greedy,
repeat:h.repeat})),1<a(k[1]).length&&c(x+k[0],k[1]+j[1]),1<j.length&&1<a(j[1]).length)c(x+k[0]+(b.optionalmarker.start+k[1]+b.optionalmarker.end),j[1]),c(x+k[0],j[1])}else g=x+j,-1==e.inArray(g,l)&&(l.push(g),h=O(g),f.push({mask:g,_buffer:h.mask,tests:S(g),lastValidPosition:void 0,greedy:h.greedy,repeat:h.repeat}))}var f=[],l=[];e.isArray(b.mask)?e.each(b.mask,function(a,b){c("",b.toString())}):c("",b.mask.toString());return f}function t(){return r[o]}function G(){return t().tests}function h(){return t()._buffer}
function H(a,c,f,l,h,p){function j(a,d){for(var e=C(a),h=c?1:0,k="",g=d.tests[e].cardinality;g>h;g--)k+=B(f,e-(g-1));c&&(k+=c);return null!=d.tests[e].fn?d.tests[e].fn.test(k,f,a,l,b):!1}if(l||p){p=j(a,t());if(!1!==p){!0===p&&(p={pos:a});var J=t(),g=p.pos||a;if(void 0==J.lastValidPosition||J.lastValidPosition<g)J.lastValidPosition=g}return p}var k=[],d=!1,m=o;e.each(r,function(d){o=d;var e=a;if(m!=o&&!z(a)){if(c==this._buffer[e]||c==b.skipOptionalPartCharacter)return k[d]={refresh:!0},this.lastValidPosition=
e,!1;e=h?K(f,a):u(f,a)}if((void 0==this.lastValidPosition&&e==(h?K(f,s(f)):u(f,-1))||h||b.numericInput?this.lastValidPosition<=b.numericInput?s(f):u(f,e):this.lastValidPosition>=K(f,e))&&0<=e&&e<s(f))if(k[d]=j(e,this),!1!==k[d]){if(!0===k[d]&&(k[d]={pos:e}),d=k[d].pos||e,void 0==this.lastValidPosition||this.lastValidPosition<d)this.lastValidPosition=d}else this.lastValidPosition=h?a==s(f)?void 0:u(f,a):0==a?void 0:K(f,a)});o=m;T(f,a,m,h,c);d=k[o]||d;setTimeout(function(){b.onKeyValidation.call(this,
d,b)},0);return d}function T(a,c,f,l){e.each(r,function(f){if(void 0!=this.lastValidPosition&&(l||b.numericInput?this.lastValidPosition<=c:this.lastValidPosition>=c))return o=f,y(void 0,a,!1,!0,!1,a.join(""),l),!1})}function z(a){a=C(a);a=G()[a];return void 0!=a?a.fn:!1}function C(a){return a%G().length}function F(a){return b.placeholder.charAt(a%b.placeholder.length)}function s(a){return b.getMaskLength(h(),t().greedy,t().repeat,a,b)}function u(a,c){var b=s(a);if(c>=b)return b;for(var e=c;++e<b&&
!z(e););return e}function K(a,c){var b=c;if(0>=b)return 0;for(;0<--b&&!z(b););return b}function M(a,c,b,e,h){e&&(c=Y(a,c,h));e=G()[C(c)];h=b;if(void 0!=h)switch(e.casing){case "upper":h=b.toUpperCase();break;case "lower":h=b.toLowerCase()}a[c]=h}function B(a,c,b){b&&(c=Y(a,c));return a[c]}function Y(a,c,b){if(b)for(;0>c&&a.length<s(a);){b=h().length-1;for(c=h().length;void 0!==h()[b];)a.unshift(h()[b--])}else for(;void 0==a[c]&&a.length<s(a);)for(b=0;void 0!==h()[b];)a.push(h()[b++]);return c}function D(a,
b,e){a._valueSet(b.join(""));void 0!=e&&m(a,e)}function U(a,b,e){for(var l=s(a);b<e&&b<l;b++)M(a,b,B(h().slice(),b))}function P(a,b){var e=C(b);M(a,b,B(h(),e))}function y(a,c,f,l,x,p,j){var j=void 0!=j?j:e(a).data("inputmask").isRTL,m=V(void 0!=p?p:a._valueGet(),j).split(""),l=void 0!=l?l:!0,p=s(c);if(j){var g=m.reverse();g.length=p;for(var k=0;k<p;k++){var d=C(p-(k+1));null==G()[d].fn&&g[k]!=B(h(),d)?(g.splice(k,0,B(h(),d)),g.length=p):g[k]=g[k]||B(h(),d)}m=g.reverse()}U(c,0,c.length);c.length=h().length;
for(var o=g=-1,r,y=m.length,d=0==y?p:-1,k=0;k<y;k++)for(var v=o+1;v<p;v++)if(z(v)){var A=m[k];!1!==(r=H(v,A,c,l,j,!0))?(!0!==r&&(v=void 0!=r.pos?r.pos:v,A=void 0!=r.c?r.c:A),M(c,v,A,!0,j),g=o=v):(P(c,v),A==F(v)&&(d=o=v));break}else if(P(c,v),g==o&&(g=v),o=v,m[k]==B(c,v))break;if(!1==t().greedy&&c.length>h().length){l=V(c.join(""),j).split("");k=l.length;for(m=0;m<k;m++)c[m]=l[m];c.length=l.length}f&&D(a,c);return j?b.numericInput?""!=b.radixPoint&&-1!=e.inArray(b.radixPoint,c)&&!0!==x?e.inArray(b.radixPoint,
c):u(c,p):u(c,d):u(c,g)}function aa(a){return e.inputmask.escapeRegex.call(this,a)}function V(a,b){return b?a.replace(RegExp("^("+aa(h().join(""))+")*"),""):a.replace(RegExp("("+aa(h().join(""))+")*$"),"")}function Z(a,b){y(a,b,!1);var f=b.slice(),h,m;if(e(a).data("inputmask").isRTL)for(m=0;m<=f.length-1;m++)if(h=C(m),G()[h].optionality)if(!z(m)||!H(m,b[m],b,!0))f.splice(0,1);else break;else break;else for(m=f.length-1;0<=m;m--)if(h=C(m),G()[h].optionality)if(!z(m)||!H(m,b[m],b,!0))f.pop();else break;
else break;D(a,f)}function ba(a,b){var f=a[0];if(G()&&(!0===b||!a.hasClass("hasDatepicker"))){var l=h().slice();y(f,l,!1);return e.map(l,function(a,b){return z(b)&&H(b,a,l,!0)?a:null}).join("")}return f._valueGet()}function m(a,c,f){var h=a.jquery&&0<a.length?a[0]:a;if("number"==typeof c)e(a).is(":visible")&&(f="number"==typeof f?f:c,!1==b.insertMode&&c==f&&f++,h.setSelectionRange?W?(setTimeout(function(){h.selectionStart=c;h.selectionEnd=W?c:f},10),Q=c,N=f):(h.selectionStart=c,h.selectionEnd=f):
h.createTextRange&&(a=h.createTextRange(),a.collapse(!0),a.moveEnd("character",f),a.moveStart("character",c),a.select()));else{if(!e(a).is(":visible"))return{begin:0,end:0};h.setSelectionRange?(c=h.selectionStart,f=h.selectionEnd):document.selection&&document.selection.createRange&&(a=document.selection.createRange(),c=0-a.duplicate().moveStart("character",-1E5),f=c+a.text.length);return{begin:c,end:f}}}function R(a){var b=!1,f=0,m=o;e.each(r,function(e,m){o=e;var j=K(a,s(a));if(void 0!=m.lastValidPosition&&
m.lastValidPosition>=f&&m.lastValidPosition==j){for(var l=!0,g=0;g<=j;g++){var k=z(g),d=C(g);if(k&&(void 0==a[g]||a[g]==F(g))||!k&&a[g]!=h()[d]){l=!1;break}}if(b=b||l)return!1}f=m.lastValidPosition});o=m;return b}function $(a){function c(a){a=e._data(a).events;e.each(a,function(a,b){e.each(b,function(a,b){if("inputmask"==b.namespace){var d=b.handler;b.handler=function(a){if(this.readOnly||this.disabled)a.preventDefault;else return d.apply(this,arguments)}}})})}function f(a){var b;Object.getOwnPropertyDescriptor&&
(b=Object.getOwnPropertyDescriptor(a,"value"));if(b&&b.get)a._valueGet||(a._valueGet=b.get,a._valueSet=b.set,Object.defineProperty(a,"value",{get:function(){var a=e(this),b=e(this).data("inputmask"),d=b.masksets,c=b.activeMasksetIndex;return b&&b.opts.autoUnmask?a.inputmask("unmaskedvalue"):this._valueGet()!=d[c]._buffer.join("")?this._valueGet():""},set:function(a){this._valueSet(a);e(this).triggerHandler("setvalue.inputmask")}}));else if(document.__lookupGetter__&&a.__lookupGetter__("value"))a._valueGet||
(a._valueGet=a.__lookupGetter__("value"),a._valueSet=a.__lookupSetter__("value"),a.__defineGetter__("value",function(){var a=e(this),b=e(this).data("inputmask"),d=b.masksets,c=b.activeMasksetIndex;return b&&b.opts.autoUnmask?a.inputmask("unmaskedvalue"):this._valueGet()!=d[c]._buffer.join("")?this._valueGet():""}),a.__defineSetter__("value",function(a){this._valueSet(a);e(this).triggerHandler("setvalue.inputmask")}));else if(a._valueGet||(a._valueGet=function(){return this.value},a._valueSet=function(a){this.value=
a}),!0!=e.fn.val.inputmaskpatch)e.fn.val=function(){if(arguments.length==0){var a=e(this);if(a.data("inputmask")){if(a.data("inputmask").opts.autoUnmask)return a.inputmask("unmaskedvalue");var a=e.inputmask.val.apply(a),b=e(this).data("inputmask");return a!=b.masksets[b.activeMasksetIndex]._buffer.join("")?a:""}return e.inputmask.val.apply(a)}var d=arguments;return this.each(function(){var a=e(this),b=e.inputmask.val.apply(a,d);a.data("inputmask")&&a.triggerHandler("setvalue.inputmask");return b})},
e.extend(e.fn.val,{inputmaskpatch:!0})}function l(a,d){if(b.numericInput&&""!=b.radixPoint){var e=a._valueGet().indexOf(b.radixPoint);q=d.begin<=e||d.end<=e||-1==e}}function x(a,b,e){for(;!z(a)&&0<=a-1;)a--;for(var c=a;c<b&&c<s(d);c++)if(z(c)){P(d,c);var f=u(d,c),k=B(d,f);if(k!=F(f))if(f<s(d)&&!1!==H(c,k,d,!0,q)&&G()[C(c)].def==G()[C(f)].def)M(d,c,B(d,f),!0,q),P(d,f);else{if(z(c))break}else if(void 0==e)break}else P(d,c);void 0!=e&&M(d,q?b:K(d,b),e);d=V(d.join(""),q).split("");0==d.length&&(d=h().slice());
return a}function p(a,b,c,e){for(;a<=b&&a<s(d);a++)if(z(a)){var f=B(d,a);M(d,a,c,!0,q);if(f!=F(a))if(c=u(d,a),c<s(d))if(!1!==H(c,f,d,!0,q)&&G()[C(a)].def==G()[C(c)].def)c=f;else if(z(c))break;else c=f;else break;else if(!0!==e)break}else P(d,a);e=d.length;d=V(d.join(""),q).split("");0==d.length&&(d=h().slice());return b-(e-d.length)}function j(a){I=!1;var c=this,f=a.keyCode,g=m(c);l(c,g);if(f==b.keyCode.BACKSPACE||f==b.keyCode.DELETE||da&&127==f){var j=s(d),L=u(d,-1);if(0==g.begin&&g.end==j)o=0,d=
h().slice(),D(c,d),m(c,y(c,d,!1));else if(1<g.end-g.begin||1==g.end-g.begin&&b.insertMode)U(d,g.begin,g.end),T(d,g.begin,o,q),D(c,d),j=q?y(c,d,!1):g.begin,t().lastValidPosition=j,m(c,j);else{var n=ca?g.end:g.begin;f==b.keyCode.DELETE?(n<L&&(n=L),n<j&&(b.numericInput&&""!=b.radixPoint&&d[n]==b.radixPoint?(n=d.length-1==n?n:u(d,n),n=x(n,j)):q?(n=p(L,n,F(n),!0),n=u(d,n)):n=x(n,j),T(d,n,o,q),t().lastValidPosition=n,D(c,d,n))):f==b.keyCode.BACKSPACE&&(n>L?(n-=1,b.numericInput&&""!=b.radixPoint&&d[n]==
b.radixPoint?(n=p(L,d.length-1==n?n:n-1,F(n),!0),n++):q?(n=p(L,n,F(n),!0),n=d[n+1]==b.radixPoint?n+1:u(d,n)):n=x(n,j),T(d,n,o,q),t().lastValidPosition=n,D(c,d,n)):0<o&&(o=0,U(d,0,L),L=u(d,-1),D(c,h(),q?j:L)))}c._valueGet()==h().join("")&&e(c).trigger("cleared");b.showTooltip&&k.prop("title",t().mask);a.preventDefault()}else f==b.keyCode.END||f==b.keyCode.PAGE_DOWN?setTimeout(function(){var e=y(c,d,!1);!b.insertMode&&(e==s(d)&&!a.shiftKey)&&e--;m(c,a.shiftKey?g.begin:e,e)},0):f==b.keyCode.HOME&&!a.shiftKey||
f==b.keyCode.PAGE_UP?m(c,0,a.shiftKey?g.begin:0):f==b.keyCode.ESCAPE?(c._valueSet(E),m(c,0,y(c,d,!1))):f==b.keyCode.INSERT?(b.insertMode=!b.insertMode,m(c,!b.insertMode&&g.begin==s(d)?g.begin-1:g.begin)):a.ctrlKey&&88==f?setTimeout(function(){m(c,y(c,d,!0))},0):b.insertMode||(f==b.keyCode.RIGHT?(j=g.begin==g.end?g.end+1:g.end,j=j<s(d)?j:g.end,m(c,a.shiftKey?g.begin:j,a.shiftKey?j+1:j)):f==b.keyCode.LEFT&&(j=g.begin-1,j=0<j?j:0,m(c,j,a.shiftKey?g.end:j)));b.onKeyDown.call(this,a,d,b);v=-1!=e.inArray(f,
b.ignorables)}function J(a){if(I)return!1;I=!0;var c=e(this),a=a||window.event,f=a.which||a.charCode||a.keyCode,h=String.fromCharCode(f);if(b.numericInput&&h==b.radixPoint){var g=this._valueGet().indexOf(b.radixPoint);m(this,u(d,-1!=g?g:s(d)))}if(a.ctrlKey||a.metaKey||v)return!0;if(f){var j=m(this),k=s(d),f=!0;1<j.end-j.begin&&U(d,j.begin,j.end);if(q){var g=K(d,j.end),l;if(!1!==(l=H(g==k||B(d,g)==b.radixPoint?K(d,g):g,h,d,!1,q))){var o=!1;!0!==l&&(o=l.refresh,g=void 0!=l.pos?l.pos:g,h=void 0!=l.c?
l.c:h);if(!0!==o){var k=s(d),r=u(d,-1);l=r;if(!0==b.insertMode){if(!0==t().greedy)for(o=d.slice();B(o,l,!0)!=F(l)&&l<=g;)l=l==k?k+1:u(d,l);l<=g&&(t().greedy||d.length<k)?(d[r]!=F(r)&&d.length<k&&(o=Y(d,-1,q),0!=j.end&&(g+=o),k=d.length),x(l,g,h)):f=!1}else M(d,g,h,!0,q)}f&&(D(this,d,b.numericInput?g+1:g),setTimeout(function(){R(d)&&c.trigger("complete")},0))}}else if(g=u(d,j.begin-1),!1!==(l=H(g,h,d,!1,q))){o=!1;!0!==l&&(o=l.refresh,g=void 0!=l.pos?l.pos:g,h=void 0!=l.c?l.c:h);if(!0!==o)if(!0==b.insertMode){j=
s(d);for(o=d.slice();B(o,j,!0)!=F(j)&&j>=g;)j=0==j?-1:K(d,j);j>=g?p(g,d.length,h):f=!1}else M(d,g,h,!0,q);f&&(h=u(d,g),D(this,d,h),setTimeout(function(){R(d)&&c.trigger("complete")},0))}W&&m(this,Q,N);b.showTooltip&&c.prop("title",t().mask);a.preventDefault()}}function g(a){var c=e(this),f=a.keyCode;b.onKeyUp.call(this,a,d,b);f==b.keyCode.TAB&&(c.hasClass("focus.inputmask")&&0==this._valueGet().length&&b.showMaskOnFocus)&&(d=h().slice(),D(this,d),q||m(this,0),E=this._valueGet())}var k=e(a);if(k.is(":input")){b.showTooltip&&
k.prop("title",t().mask);var d=h().slice();t().greedy=t().greedy?t().greedy:0==t().repeat;var w=k.prop("maxLength");s(d)>w&&-1<w&&(w<h().length&&(h().length=w),!1==t().greedy&&(t().repeat=Math.round(w/h().length)),k.prop("maxLength",2*s(d)));k.data("inputmask",{masksets:r,activeMasksetIndex:o,opts:b,isRTL:!1});f(a);var E=a._valueGet(),I=!1,v=!1,A=-1,q=!1;if("rtl"==a.dir||b.numericInput)("rtl"==a.dir||b.numericInput&&b.rightAlignNumerics)&&k.css("text-align","right"),a.dir="ltr",k.removeAttr("dir"),
w=k.data("inputmask"),w.isRTL=!0,k.data("inputmask",w),q=!0;k.unbind(".inputmask");k.removeClass("focus.inputmask");k.bind("mouseenter.inputmask",function(){if(!e(this).hasClass("focus.inputmask")&&b.showMaskOnHover){var a=this._valueGet().length;if(a<d.length){a==0&&(d=h().slice());D(this,d)}}}).bind("blur.inputmask",function(){var a=e(this),c=this._valueGet();a.removeClass("focus.inputmask");c!=E&&a.change();b.clearMaskOnLostFocus&&c!=""&&(c==h().join("")?this._valueSet(""):Z(this,d));if(!R(d)){a.trigger("incomplete");
if(b.clearIncomplete)if(b.clearMaskOnLostFocus)this._valueSet("");else{d=h().slice();D(this,d)}}}).bind("focus.inputmask",function(){var a=e(this),c=this._valueGet();if(b.showMaskOnFocus&&!a.hasClass("focus.inputmask")&&(!b.showMaskOnHover||b.showMaskOnHover&&c=="")){c=c.length;if(c<d.length){c==0&&(d=h().slice());m(this,y(this,d,true))}}a.addClass("focus.inputmask");E=this._valueGet()}).bind("mouseleave.inputmask",function(){var a=e(this);b.clearMaskOnLostFocus&&(a.hasClass("focus.inputmask")||(this._valueGet()==
h().join("")||this._valueGet()==""?this._valueSet(""):Z(this,d)))}).bind("click.inputmask",function(){var a=this;setTimeout(function(){var b=m(a);if(b.begin==b.end){var c=b.begin;A=y(a,d,false);l(a,b);q?m(a,c>A&&(H(c,d[c],d,true,q)!==false||!z(c))?c:A):m(a,c<A&&(H(c,d[c],d,true,q)!==false||!z(c))?c:A)}},0)}).bind("dblclick.inputmask",function(){var a=this;setTimeout(function(){m(a,0,A)},0)}).bind("keydown.inputmask",j).bind("keypress.inputmask",J).bind("keyup.inputmask",g).bind(ea+".inputmask dragdrop.inputmask drop.inputmask",
function(){var a=this;setTimeout(function(){m(a,y(a,d,true,false));R(d)&&k.trigger("complete")},0)}).bind("setvalue.inputmask",function(){E=this._valueGet();y(this,d,true,false);this._valueGet()==h().join("")&&this._valueSet("")}).bind("complete.inputmask",b.oncomplete).bind("incomplete.inputmask",b.onincomplete).bind("cleared.inputmask",b.oncleared);var A=y(a,d,!0),O;try{O=document.activeElement}catch(S){}O===a?(k.addClass("focus.inputmask"),m(a,A)):b.clearMaskOnLostFocus&&(a._valueGet()==h().join("")?
a._valueSet(""):Z(a,d));c(a)}}var b=e.extend(!0,{},e.inputmask.defaults,E),ea=function(a){var b=document.createElement("input"),a="on"+a,e=a in b;e||(b.setAttribute(a,"return;"),e="function"==typeof b[a]);return e}("paste")?"paste":"input",da=null!=navigator.userAgent.match(/iphone/i),W=null!=navigator.userAgent.match(/android.*safari.*/i),ca;if(W){var fa=navigator.userAgent.match(/safari.*/i);ca=533>=parseInt(RegExp(/[0-9]+/).exec(fa))}var r,o=0;if("string"==typeof w)switch(w){case "mask":return I(b.alias,
E),r=X(),this.each(function(){$(this)});case "unmaskedvalue":return r=this.data("inputmask").masksets,o=this.data("inputmask").activeMasksetIndex,b=this.data("inputmask").opts,ba(this);case "remove":return this.each(function(){var a=e(this),c=this;setTimeout(function(){if(a.data("inputmask")){r=a.data("inputmask").masksets;o=a.data("inputmask").activeMasksetIndex;b=a.data("inputmask").opts;c._valueSet(ba(a,!0));a.removeData("inputmask");a.unbind(".inputmask");a.removeClass("focus.inputmask");var e;
Object.getOwnPropertyDescriptor&&(e=Object.getOwnPropertyDescriptor(c,"value"));e&&e.get?c._valueGet&&Object.defineProperty(c,"value",{get:c._valueGet,set:c._valueSet}):document.__lookupGetter__&&c.__lookupGetter__("value")&&c._valueGet&&(c.__defineGetter__("value",c._valueGet),c.__defineSetter__("value",c._valueSet));delete c._valueGet;delete c._valueSet}},0)});case "getemptymask":return this.data("inputmask")?(r=this.data("inputmask").masksets,o=this.data("inputmask").activeMasksetIndex,r[o]._buffer.join("")):
"";case "hasMaskedValue":return this.data("inputmask")?!this.data("inputmask").opts.autoUnmask:!1;case "isComplete":return r=this.data("inputmask").masksets,o=this.data("inputmask").activeMasksetIndex,b=this.data("inputmask").opts,R(this[0]._valueGet().split(""));default:return I(w,E)||(b.mask=w),r=X(),this.each(function(){$(this)})}else{if("object"==typeof w)return b=e.extend(!0,{},e.inputmask.defaults,w),I(b.alias,w),r=X(),this.each(function(){$(this)});if(void 0==w)return this.each(function(){var a=
e(this).attr("data-inputmask");if(a&&""!=a)try{var a=a.replace(RegExp("'","g"),'"'),c=e.parseJSON("{"+a+"}");b=e.extend(!0,{},e.inputmask.defaults,c);I(b.alias,c);b.alias=void 0;e(this).inputmask(b)}catch(f){}})}return this})})(jQuery);
