/*
 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: 3.0.0
*/
(function(f){if(void 0===f.fn.inputmask){var S=function(e){var a=document.createElement("input");e="on"+e;var f=e in a;f||(a.setAttribute(e,"return;"),f="function"==typeof a[e]);return f},F=function(e,a,c){return(e=c.aliases[e])?(e.alias&&F(e.alias,void 0,c),f.extend(!0,c,e),f.extend(!0,c,a),!0):!1},I=function(e){function a(a){function f(a,d,e){this.matches=[];this.isGroup=a||!1;this.isOptional=d||!1;this.isQuantifier=e||!1;this.quantifier={min:1,max:1}}function c(a,d,f){var g=e.definitions[d];f=
void 0!=f?f:a.matches.length;if(g&&!u){for(var m=g.prevalidator,n=m?m.length:0,h=1;h<g.cardinality;h++){var w=n>=h?m[h-1]:[],p=w.validator,w=w.cardinality;a.matches.splice(f++,0,{fn:p?"string"==typeof p?RegExp(p):new function(){this.test=p}:/./,cardinality:w?w:1,optionality:a.isOptional,casing:g.casing,def:g.definitionSymbol||d})}a.matches.splice(f++,0,{fn:g.validator?"string"==typeof g.validator?RegExp(g.validator):new function(){this.test=g.validator}:/./,cardinality:g.cardinality,optionality:a.isOptional,
casing:g.casing,def:g.definitionSymbol||d})}else a.matches.splice(f++,0,{fn:null,cardinality:0,optionality:a.isOptional,casing:null,def:d}),u=!1}for(var h=/(?:[?*+]|\{[0-9]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,u=!1,t=new f,d,g=[],m=[];d=h.exec(a);)switch(d=d[0],d.charAt(0)){case e.optionalmarker.end:case e.groupmarker.end:var n=g.pop();0<g.length?g[g.length-1].matches.push(n):t.matches.push(n);break;case e.optionalmarker.start:g.push(new f(!1,!0));break;case e.groupmarker.start:g.push(new f(!0));
break;case e.quantifiermarker.start:n=new f(!1,!1,!0);d=d.replace(/[{}]/g,"");var p=d.split(",");d=isNaN(p[0])?p[0]:parseInt(p[0]);p=1==p.length?d:isNaN(p[1])?p[1]:parseInt(p[1]);n.quantifier={min:d,max:p};if("*"==p||"+"==p)e.greedy=!1;if(0<g.length){p=g[g.length-1].matches;d=p.pop();if(!d.isGroup){var r=new f(!0);r.matches.push(d);d=r}p.push(d);p.push(n)}else d=t.matches.pop(),d.isGroup||(r=new f(!0),r.matches.push(d),d=r),t.matches.push(d),t.matches.push(n);break;case e.escapeChar:u=!0;break;default:0<
g.length?c(g[g.length-1],d):(0<t.matches.length&&(n=t.matches[t.matches.length-1],n.isGroup&&(n.isGroup=!1,c(n,e.groupmarker.start,0),c(n,e.groupmarker.end))),c(t,d))}0<t.matches.length&&m.push(t);return m}function c(c,h){e.numericInput&&(c=c.split("").reverse().join(""));if(void 0!=c&&""!=c){if(0<e.repeat||"*"==e.repeat||"+"==e.repeat)c=e.groupmarker.start+c+e.groupmarker.end+e.quantifiermarker.start+("*"==e.repeat?0:"+"==e.repeat?1:e.repeat)+","+e.repeat+e.quantifiermarker.end;void 0==f.inputmask.masksCache[c]&&
(f.inputmask.masksCache[c]={mask:c,maskToken:a(c),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:h});return f.extend(!0,{},f.inputmask.masksCache[c])}}var h=[];f.isFunction(e.mask)&&(e.mask=e.mask.call(this,e));f.isArray(e.mask)?f.each(e.mask,function(a,f){void 0!=f.mask?h.push(c(f.mask.toString(),f)):h.push(c(f.toString()))}):(1==e.mask.length&&!1==e.greedy&&0!=e.repeat&&(e.placeholder=""),h=void 0!=e.mask.mask?c(e.mask.mask.toString(),e.mask):c(e.mask.toString()));return h},da=
"function"===typeof ScriptEngineMajorVersion?ScriptEngineMajorVersion():10<=(new Function("/*@cc_on return @_jscript_version; @*/"))(),q=navigator.userAgent,ea=null!==q.match(/iphone/i),fa=null!==q.match(/android.*safari.*/i),ga=null!==q.match(/android.*chrome.*/i),Y=null!==q.match(/android.*firefox.*/i),Z=/Kindle/i.test(q)||/Silk/i.test(q)||/KFTT/i.test(q)||/KFOT/i.test(q)||/KFJWA/i.test(q)||/KFJWI/i.test(q)||/KFSOWI/i.test(q)||/KFTHWA/i.test(q)||/KFTHWI/i.test(q)||/KFAPWA/i.test(q)||/KFAPWI/i.test(q),
T=S("paste")?"paste":S("input")?"input":"propertychange",E=function(e,a,c){function h(b,H,f){H=H||0;var d=[],c,l=0,g;do{if(!0===b&&e.validPositions[l]){var k=e.validPositions[l];g=k.match;c=k.locator.slice();d.push(null==g.fn?g.def:!0===f?k.input:a.placeholder.charAt(l%a.placeholder.length))}else c=u(l,!1,c,l-1),c=c[a.greedy||H>l?0:c.length-1],g=c.match,c=c.locator.slice(),d.push(null==g.fn?g.def:a.placeholder.charAt(l%a.placeholder.length));l++}while((void 0==K||l-1<K)&&null!=g.fn||null==g.fn&&""!=
g.def||H>=l);d.pop();return d}function O(b){var a=e;a.buffer=void 0;a.tests={};!0!==b&&(a._buffer=void 0,a.validPositions={},a.p=-1)}function w(b){var a=e;b=-1;for(var f in a.validPositions)a=parseInt(f),a>b&&(b=a);return b}function A(b,d,y,c){if(a.insertMode&&void 0!=e.validPositions[b]&&void 0==c){c=f.extend(!0,{},e.validPositions);for(var g=J(r());g>b&&0<=g;g--)if(p(g)){var l=J(g),v=e.validPositions[l];void 0!=v&&q(g).def==q(l).def&&void 0==e.validPositions[g]&&!1!==n(g,v.input,y,!0)&&delete e.validPositions[l]}if(void 0==
e.validPositions[b])e.validPositions[b]=d;else return e.validPositions=f.extend(!0,{},c),!1}else e.validPositions[b]=d;return!0}function q(b){return e.validPositions[b]?e.validPositions[b].match:u(b)[0].match}function u(b,a,f,d){function c(a,f,d,e){function H(d,e,g){var C=v;if(v==b&&void 0==d.matches)return k.push({match:d,locator:e.reverse()}),!0;if(void 0!=d.matches)if(d.isGroup&&!0!==g){if(d=H(a.matches[y+1],e))return!0}else if(d.isOptional){var l=d;if(d=c(d,f,e,g))d=k[k.length-1].match,(d=0==
l.matches.indexOf(d))&&(m=!0),v=C}else if(d.isQuantifier&&!0!==g)for(C=d,g=0<f.length&&!0!==g?f.shift():0;g<(isNaN(C.quantifier.max)?g+1:C.quantifier.max)&&v<=b;g++){if(l=a.matches[a.matches.indexOf(C)-1],d=H(l,[g].concat(e),!0))if(d=k[k.length-1].match,g>C.quantifier.min-1&&(d.optionalQuantifier=!0),d=0==l.matches.indexOf(d))if(g>C.quantifier.min-1){m=!0;v=b;break}else return!0;else return!0}else{if(d=c(d,f,e,g))return!0}else v++}for(var y=0<f.length?f.shift():0;y<a.matches.length;y++)if(!0!==a.matches[y].isQuantifier){var g=
H(a.matches[y],[y].concat(d),e);if(g&&v==b)return g;if(v>b)break}}var g=e.maskToken,v=f?d:0;d=f||[0];var k=[],m=!1;if(!0!==a&&e.tests[b]&&!e.validPositions[b])return e.tests[b];if(void 0==f){for(a=b-1;void 0==(f=e.validPositions[a])&&-1<a;)a--;if(void 0!=f&&-1<a)v=a,d=f.locator.slice();else{for(a=b-1;void 0==(f=e.tests[a])&&-1<a;)a--;void 0!=f&&-1<a&&(v=a,d=f[0].locator.slice())}}for(a=d.shift();a<g.length&&!(c(g[a],d,[a])&&v==b||v>b);a++);(0==k.length||m&&2>k.length)&&k.push({match:{fn:null,cardinality:0,
optionality:!0,casing:null,def:""},locator:[]});return e.tests[b]=k}function t(){void 0==e._buffer&&(e._buffer=h(!1,1));return e._buffer}function d(){void 0==e.buffer&&(e.buffer=h(!0,w(),!0));return e.buffer}function g(b,a){for(var e=d(),c=b;c<a;c++)if(e[c]!=Q(c)){var g=u(c,!1)[0];A(c,f.extend({},g,{input:m(e[c],g.match)}),!0)}}function m(b,a){switch(a.casing){case "upper":b=b.toUpperCase();break;case "lower":b=b.toLowerCase()}return b}function n(b,c,y,C){function h(b,c,y,H){var l=!1;f.each(u(b,!y),
function(C,v){for(var k=v.match,h=c?1:0,D="",n=d(),p=k.cardinality;p>h;p--)D+=void 0==e.validPositions[b-(p-1)]?Q(b-(p-1)):e.validPositions[b-(p-1)].input;c&&(D+=c);l=null!=k.fn?k.fn.test(D,n,b,y,a):c!=k.def&&c!=a.skipOptionalPartCharacter||""==k.def?!1:{c:k.def,pos:b};if(!1!==l)return h=void 0!=l.c?l.c:c,h=h==a.skipOptionalPartCharacter?k.def:h,D=b,l.refreshFromBuffer?(n=l.refreshFromBuffer,y=!0,D=void 0!=l.pos?l.pos:b,v=u(D,!y)[0],!0===n?(e.validPositions={},g(0,d().length)):g(n.start,n.end)):!0!==
l&&l.pos!=b&&(A(b,f.extend({},v,{input:m(n[b],k)}),y),D=l.pos,g(b+1,D),v=u(D,!y)[0]),0<C&&O(!0),A(D,f.extend({},v,{input:m(h,k)}),y,H)||(l=!1),!1});return l}y=!0===y;var l=h(b,c,y,C);if(!y&&(a.insertMode||void 0==e.validPositions[B(b)])&&!1===l&&!p(b))for(var v=b+1,k=B(b);v<=k;v++)if(l=h(v,c,y,C),!1!==l){b=v;break}!0===l&&(l={pos:b});return l}function p(b){b=q(b);return null!=b.fn?b.fn:!1}function r(){var b;K=s.prop("maxLength");-1==K&&(K=void 0);if(!1==a.greedy){b=w()+1;for(var f=q(b);null!=f.fn||
""!=f.def;)f=q(++b),!0!==f.optionality&&(f=u(b),f=f[f.length-1].match);b=h(!0,b).length;e.tests={}}else b=d().length;return void 0==K||b<K?b:K}function B(b){var d=r();if(b>=d)return d;for(;++b<d&&!p(b)&&(!0!==a.nojumps||a.nojumpsThreshold>b););return b}function J(b){if(0>=b)return 0;for(;0<--b&&!p(b););return b}function G(b,a,d){b._valueSet(a.join(""));void 0!=d&&x(b,d)}function Q(b){var d=q(b);return null==d.fn?d.def:a.placeholder.charAt(b%a.placeholder.length)}function N(b,a,d,c,g){c=void 0!=c?
c.slice():F(b._valueGet()).split("");O();a&&b._valueSet("");f.each(c,function(c,C){if(!0===g){var k=e.p,k=-1==k?k:J(k),h=-1==k?c:B(k);-1==f.inArray(C,t().slice(k+1,h))&&U.call(b,void 0,!0,C.charCodeAt(0),a,d,c)}else U.call(b,void 0,!0,C.charCodeAt(0),a,d,c),d=d||0<c&&c>e.p})}function E(b){return f.inputmask.escapeRegex.call(this,b)}function F(b){return b.replace(RegExp("("+E(t().join(""))+")*$"),"")}function I(b){var a=d().slice(),f;for(f=a.length-1;0<=f;f--){var e=q(f);if((e.optionality||e.optionalQuantifier)&&
a[f]==Q(f))a.pop();else break}G(b,a)}function R(b,e){if(!b.data("_inputmask")||!0!==e&&b.hasClass("hasDatepicker"))return b[0]._valueGet();var c=f.map(d(),function(b,a){return p(a)&&n(a,b,!0)?b:null}),c=(z?c.reverse():c).join(""),g=(z?d().reverse():d()).join("");return f.isFunction(a.onUnMask)?a.onUnMask.call(b,g,c,a):c}function L(b){!z||"number"!=typeof b||a.greedy&&""==a.placeholder||(b=d().length-b);return b}function x(b,d,e){b=b.jquery&&0<b.length?b[0]:b;if("number"==typeof d){d=L(d);e=L(e);e=
"number"==typeof e?e:d;var c=f(b).data("_inputmask")||{};c.caret={begin:d,end:e};f(b).data("_inputmask",c);f(b).is(":visible")&&(b.scrollLeft=b.scrollWidth,!1==a.insertMode&&d==e&&e++,b.setSelectionRange?(b.selectionStart=d,b.selectionEnd=e):b.createTextRange&&(b=b.createTextRange(),b.collapse(!0),b.moveEnd("character",e),b.moveStart("character",d),b.select()))}else return c=f(b).data("_inputmask"),!f(b).is(":visible")&&c&&void 0!=c.caret?(d=c.caret.begin,e=c.caret.end):b.setSelectionRange?(d=b.selectionStart,
e=b.selectionEnd):document.selection&&document.selection.createRange&&(b=document.selection.createRange(),d=0-b.duplicate().moveStart("character",-1E5),e=d+b.text.length),d=L(d),e=L(e),{begin:d,end:e}}function P(b){if(f.isFunction(a.isComplete))return a.isComplete.call(s,b,a);if("*"!=a.repeat){var d=!1,e=J(r());if(w()==e)for(var d=!0,c=0;c<=e;c++){var g=p(c);if(g&&(void 0==b[c]||b[c]==Q(c))||!g&&b[c]!=Q(c)){d=!1;break}}return d}}function S(b){b=f._data(b).events;f.each(b,function(b,d){f.each(d,function(b,
d){if("inputmask"==d.namespace&&"setvalue"!=d.type){var a=d.handler;d.handler=function(b){if(this.readOnly||this.disabled)b.preventDefault;else return a.apply(this,arguments)}}})})}function ha(b){function d(b){if(void 0==f.valHooks[b]||!0!=f.valHooks[b].inputmaskpatch){var a=f.valHooks[b]&&f.valHooks[b].get?f.valHooks[b].get:function(b){return b.value},e=f.valHooks[b]&&f.valHooks[b].set?f.valHooks[b].set:function(b,d){b.value=d;return b};f.valHooks[b]={get:function(b){var d=f(b);if(d.data("_inputmask")){if(d.data("_inputmask").opts.autoUnmask)return d.inputmask("unmaskedvalue");
b=a(b);d=(d=d.data("_inputmask").maskset._buffer)?d.join(""):"";return b!=d?b:""}return a(b)},set:function(b,d){var a=f(b),c=e(b,d);a.data("_inputmask")&&a.triggerHandler("setvalue.inputmask");return c},inputmaskpatch:!0}}}var a;Object.getOwnPropertyDescriptor&&(a=Object.getOwnPropertyDescriptor(b,"value"));if(a&&a.get){if(!b._valueGet){var e=a.get,c=a.set;b._valueGet=function(){return z?e.call(this).split("").reverse().join(""):e.call(this)};b._valueSet=function(b){c.call(this,z?b.split("").reverse().join(""):
b)};Object.defineProperty(b,"value",{get:function(){var b=f(this),d=f(this).data("_inputmask"),a=d.maskset;return d&&d.opts.autoUnmask?b.inputmask("unmaskedvalue"):e.call(this)!=a._buffer.join("")?e.call(this):""},set:function(b){c.call(this,b);f(this).triggerHandler("setvalue.inputmask")}})}}else document.__lookupGetter__&&b.__lookupGetter__("value")?b._valueGet||(e=b.__lookupGetter__("value"),c=b.__lookupSetter__("value"),b._valueGet=function(){return z?e.call(this).split("").reverse().join(""):
e.call(this)},b._valueSet=function(b){c.call(this,z?b.split("").reverse().join(""):b)},b.__defineGetter__("value",function(){var b=f(this),d=f(this).data("_inputmask"),a=d.maskset;return d&&d.opts.autoUnmask?b.inputmask("unmaskedvalue"):e.call(this)!=a._buffer.join("")?e.call(this):""}),b.__defineSetter__("value",function(b){c.call(this,b);f(this).triggerHandler("setvalue.inputmask")})):(b._valueGet||(b._valueGet=function(){return z?this.value.split("").reverse().join(""):this.value},b._valueSet=
function(b){this.value=z?b.split("").reverse().join(""):b}),d(b.type))}function $(b,f,c){if(a.numericInput||z){switch(f){case a.keyCode.BACKSPACE:f=a.keyCode.DELETE;break;case a.keyCode.DELETE:f=a.keyCode.BACKSPACE}z&&(b=c.end,c.end=c.begin,c.begin=b)}c.begin==c.end?(b=f==a.keyCode.BACKSPACE?c.begin-1:c.begin,a.isNumeric&&""!=a.radixPoint&&d()[b]==a.radixPoint&&(c.begin=d().length-1==b?c.begin:f==a.keyCode.BACKSPACE?b:B(b),c.end=c.begin),f==a.keyCode.BACKSPACE?c.begin=J(c.begin):f==a.keyCode.DELETE&&
c.end++):1!=c.end-c.begin||a.insertMode||f==a.keyCode.BACKSPACE&&c.begin--;b=c.begin;var g=c.end;for(f=B(b-1);b<g;b++)delete e.validPositions[b];b=g;for(g=r();b<g;b++){var h=e.validPositions[b],l=e.validPositions[f];void 0!=h&&void 0==l&&(q(f).def==h.match.def&&!1!==n(f,h.input,!0)&&delete e.validPositions[b],f=B(f))}O(!0);f=B(-1);w()<f?e.p=f:e.p=c.begin}function V(b){W=!1;var c=this,h=f(c),m=b.keyCode,n=x(c);m==a.keyCode.BACKSPACE||m==a.keyCode.DELETE||ea&&127==m||b.ctrlKey&&88==m?(b.preventDefault(),
88==m&&(M=d().join("")),$(c,m,n),G(c,d(),e.p),c._valueGet()==t().join("")&&h.trigger("cleared"),a.showTooltip&&h.prop("title",e.mask)):m==a.keyCode.END||m==a.keyCode.PAGE_DOWN?setTimeout(function(){var d=B(w());a.insertMode||d!=r()||b.shiftKey||d--;x(c,b.shiftKey?n.begin:d,d)},0):m==a.keyCode.HOME&&!b.shiftKey||m==a.keyCode.PAGE_UP?x(c,0,b.shiftKey?n.begin:0):m==a.keyCode.ESCAPE||90==m&&b.ctrlKey?(N(c,!0,!1,M.split("")),h.click()):m!=a.keyCode.INSERT||b.shiftKey||b.ctrlKey?!1!=a.insertMode||b.shiftKey||
(m==a.keyCode.RIGHT?setTimeout(function(){var b=x(c);x(c,b.begin)},0):m==a.keyCode.LEFT&&setTimeout(function(){var b=x(c);x(c,b.begin-1)},0)):(a.insertMode=!a.insertMode,x(c,a.insertMode||n.begin!=r()?n.begin:n.begin-1));var h=x(c),l=a.onKeyDown.call(this,b,d(),a);l&&!0===l.refreshFromBuffer&&(e.validPositions={},g(0,d().length),x(c,h.begin,h.end));aa=-1!=f.inArray(m,a.ignorables)}function U(b,c,g,m,h,l){if(void 0==g&&W)return!1;W=!0;var p=f(this);b=b||window.event;g=c?g:b.which||b.charCode||b.keyCode;
if(!(!0===c||b.ctrlKey&&b.altKey)&&(b.ctrlKey||b.metaKey||aa))return!0;if(g){!0!==c&&46==g&&!1==b.shiftKey&&","==a.radixPoint&&(g=44);var k,r;g=String.fromCharCode(g);c?(l=h?l:w()+1,k={begin:l,end:l}):k=x(this);if(l=z?1<k.begin-k.end||1==k.begin-k.end&&a.insertMode:1<k.end-k.begin||1==k.end-k.begin&&a.insertMode)e.undoPositions=f.extend(!0,{},e.validPositions),$(this,a.keyCode.DELETE,k),a.insertMode||(a.insertMode=!a.insertMode,A(k.begin,void 0,h),a.insertMode=!a.insertMode),l=!a.multi;var t=d().join("").indexOf(a.radixPoint);
a.isNumeric&&!0!==c&&-1!=t&&(a.greedy&&k.begin<=t?(k.begin=J(k.begin),k.end=k.begin):g==a.radixPoint&&(k.begin=t,k.end=k.begin));e.writeOutBuffer=!0;k=k.begin;var s=n(k,g,h);!1!==s&&(!0!==s&&(k=void 0!=s.pos?s.pos:k,g=void 0!=s.c?s.c:g),O(!0),r=B(k),e.p=r);if(!1!==m){var u=this;setTimeout(function(){a.onKeyValidation.call(u,s,a)},0);if(e.writeOutBuffer&&!1!==s){var q=d();m=c?void 0:a.numericInput?k>t?J(r):g==a.radixPoint?r-1:J(r-1):r;G(this,q,m);!0!==c&&setTimeout(function(){!0===P(q)&&p.trigger("complete");
X=!0;p.trigger("input")},0)}else l&&(e.buffer=void 0,e.validPositions=e.undoPositions)}else l&&(e.buffer=void 0,e.validPositions=e.undoPositions);a.showTooltip&&p.prop("title",e.mask);b&&(b.preventDefault?b.preventDefault():b.returnValue=!1)}}function ba(b){var c=f(this),m=b.keyCode,h=d();(b=a.onKeyUp.call(this,b,h,a))&&!0===b.refreshFromBuffer&&(e.validPositions={},g(0,d().length));m==a.keyCode.TAB&&a.showMaskOnFocus&&(c.hasClass("focus.inputmask")&&0==this._valueGet().length?(O(),h=d(),G(this,h),
x(this,0),M=d().join("")):(G(this,h),h.join("")==t().join("")&&-1!=f.inArray(a.radixPoint,h)?(x(this,L(0)),c.click()):x(this,L(0),L(r()))))}function ca(b){if(!0===X&&"input"==b.type)return X=!1,!0;var c=this,e=f(c);if("propertychange"==b.type&&c._valueGet().length<=r())return!0;setTimeout(function(){var b=f.isFunction(a.onBeforePaste)?a.onBeforePaste.call(c,c._valueGet(),a):c._valueGet();N(c,!1,!1,b.split(""),!0);G(c,d());!0===P(d())&&e.trigger("complete");e.click()},0)}function ia(b){var c=f(this),
e=x(this),g=this._valueGet(),g=g.replace(RegExp("("+E(t().join(""))+")*"),"");e.begin>g.length&&(x(this,g.length),e=x(this));1!=d().length-g.length||g.charAt(e.begin)==d()[e.begin]||g.charAt(e.begin+1)==d()[e.begin]||p(e.begin)?(N(this,!1,!1,g.split("")),G(this,d()),!0===P(d())&&c.trigger("complete"),c.click()):(b.keyCode=a.keyCode.BACKSPACE,V.call(this,b));b.preventDefault()}function ja(b){s=f(b);if(s.is(":input")){s.data("_inputmask",{maskset:e,opts:a,isRTL:!1});a.showTooltip&&s.prop("title",e.mask);
ha(b);a.numericInput&&(a.isNumeric=a.numericInput);("rtl"==b.dir||a.numericInput&&a.rightAlignNumerics||a.isNumeric&&a.rightAlignNumerics)&&s.css("text-align","right");if("rtl"==b.dir||a.numericInput){b.dir="ltr";s.removeAttr("dir");var c=s.data("_inputmask");c.isRTL=!0;s.data("_inputmask",c);z=!0}s.unbind(".inputmask");s.removeClass("focus.inputmask");s.closest("form").bind("submit",function(){M!=d().join("")&&s.change()}).bind("reset",function(){setTimeout(function(){s.trigger("setvalue")},0)});
s.bind("mouseenter.inputmask",function(){!f(this).hasClass("focus.inputmask")&&a.showMaskOnHover&&this._valueGet()!=d().join("")&&G(this,d())}).bind("blur.inputmask",function(){var b=f(this),c=this._valueGet(),e=d();b.removeClass("focus.inputmask");M!=d().join("")&&b.change();a.clearMaskOnLostFocus&&""!=c&&(c==t().join("")?this._valueSet(""):I(this));!1===P(e)&&(b.trigger("incomplete"),a.clearIncomplete&&(O(),a.clearMaskOnLostFocus?this._valueSet(""):(e=t().slice(),G(this,e))))}).bind("focus.inputmask",
function(){var b=f(this),c=this._valueGet();a.showMaskOnFocus&&!b.hasClass("focus.inputmask")&&(!a.showMaskOnHover||a.showMaskOnHover&&""==c)&&this._valueGet()!=d().join("")&&G(this,d(),B(w()));b.addClass("focus.inputmask");M=d().join("")}).bind("mouseleave.inputmask",function(){var b=f(this);a.clearMaskOnLostFocus&&(b.hasClass("focus.inputmask")||this._valueGet()==b.attr("placeholder")||(this._valueGet()==t().join("")||""==this._valueGet()?this._valueSet(""):I(this)))}).bind("click.inputmask",function(){var b=
this;setTimeout(function(){var c=x(b),e=d();if(c.begin==c.end){var c=z?L(c.begin):c.begin,g=w(c),e=a.isNumeric?!1===a.skipRadixDance&&""!=a.radixPoint&&-1!=f.inArray(a.radixPoint,e)?a.numericInput?B(f.inArray(a.radixPoint,e)):f.inArray(a.radixPoint,e):B(g):B(g);c<e?p(c)?x(b,c):x(b,B(c)):x(b,e)}},0)}).bind("dblclick.inputmask",function(){var b=this;setTimeout(function(){x(b,0,B(w()))},0)}).bind(T+".inputmask dragdrop.inputmask drop.inputmask",ca).bind("setvalue.inputmask",function(){N(this,!0);M=d().join("");
this._valueGet()==t().join("")&&this._valueSet("")}).bind("complete.inputmask",a.oncomplete).bind("incomplete.inputmask",a.onincomplete).bind("cleared.inputmask",a.oncleared);s.bind("keydown.inputmask",V).bind("keypress.inputmask",U).bind("keyup.inputmask",ba);if(fa||Y||ga||Z)if(s.attr("autocomplete","off").attr("autocorrect","off").attr("autocapitalize","off").attr("spellcheck",!1),Y||Z)s.unbind("keydown.inputmask",V).unbind("keypress.inputmask",U).unbind("keyup.inputmask",ba),"input"==T&&s.unbind(T+
".inputmask"),s.bind("input.inputmask",ia);da&&s.bind("input.inputmask",ca);c=f.isFunction(a.onBeforeMask)?a.onBeforeMask.call(b,b._valueGet(),a):b._valueGet();N(b,!0,!1,c.split(""),!0);M=d().join("");var g;try{g=document.activeElement}catch(h){}g===b?(s.addClass("focus.inputmask"),x(b,B(w()))):a.clearMaskOnLostFocus?d().join("")==t().join("")?b._valueSet(""):I(b):G(b,d());S(b)}}var z=!1,M=d().join(""),s,W=!1,X=!1,aa=!1,K;if(void 0!=c)switch(c.action){case "isComplete":return s=f(c.el),P(c.buffer);
case "unmaskedvalue":return s=c.$input,z=c.$input.data("_inputmask").isRTL,R(c.$input,c.skipDatepickerCheck);case "mask":ja(c.el);break;case "format":return s=f({}),s.data("_inputmask",{maskset:e,opts:a,isRTL:a.numericInput}),a.numericInput&&(a.isNumeric=a.numericInput,z=!0),c=c.value.split(""),N(s,!1,!1,z?c.reverse():c,!0),z?d().reverse().join(""):d().join("");case "isValid":return s=f({}),s.data("_inputmask",{maskset:e,opts:a,isRTL:a.numericInput}),a.numericInput&&(a.isNumeric=a.numericInput,z=
!0),c=c.value.split(""),N(s,!1,!0,z?c.reverse():c),P(d())}},R=function(e,a,c){function h(d,a,h){d=d.jquery&&0<d.length?d[0]:d;if("number"==typeof a){a=q(a);h=q(h);h="number"==typeof h?h:a;if(d!=e){var n=f(d).data("_inputmask")||{};n.caret={begin:a,end:h};f(d).data("_inputmask",n)}f(d).is(":visible")&&(d.scrollLeft=d.scrollWidth,!1==c.insertMode&&a==h&&h++,d.setSelectionRange?(d.selectionStart=a,d.selectionEnd=h):d.createTextRange&&(d=d.createTextRange(),d.collapse(!0),d.moveEnd("character",h),d.moveStart("character",
a),d.select()))}else return f(d).is(":visible")||void 0==f(d).data("_inputmask").caret?d.setSelectionRange?(a=d.selectionStart,h=d.selectionEnd):document.selection&&document.selection.createRange&&(d=document.selection.createRange(),a=0-d.duplicate().moveStart("character",-1E5),h=a+d.text.length):(n=f(d).data("_inputmask"),a=n.caret.begin,h=n.caret.end),a=q(a),h=q(h),{begin:a,end:h}}function q(d){!F||"number"!=typeof d||c.greedy&&""==c.placeholder||(d=e.value.length-d);return d}function w(d,a){if("multiMaskScope"!=
d){var m=-1,n=-1,p=-1;f.each(a,function(a,c){var d=f(c).data("_inputmask").maskset,e=-1,g=0,r=h(c).begin,w;for(w in d.validPositions)d=parseInt(w),d>e&&(e=d),g++;if(g>m||g==m&&n>r&&p>e||g==m&&n==r&&p<e)m=g,n=r,u=a,p=e});f.isFunction(c.determineActiveMasksetIndex)&&(u=c.determineActiveMasksetIndex.call(A,d,a));var r=A.data("_inputmask-multi")||{activeMasksetIndex:0,elmasks:a};r.activeMasksetIndex=u;A.data("_inputmask-multi",r)}-1==["focus"].indexOf(d)&&e.value!=a[u]._valueGet()&&(r=""==f(a[u]).val()?
a[u]._valueGet():f(a[u]).val(),A.val(r));-1==["blur","focus"].indexOf(d)&&f(a[u]).hasClass("focus.inputmask")&&(r=h(a[u]),h(e,r.begin,r.end))}c.multi=!0;var A=f(e),F="rtl"==e.dir||c.numericInput,u=0,t=f.map(a,function(a,e){var h='<input type="text" ';A.attr("value")&&(h+='value="'+A.attr("value")+'" ');A.attr("dir")&&(h+='dir="'+A.attr("dir")+'" ');h=f(h+"/>")[0];E(f.extend(!0,{},a),c,{action:"mask",el:h});return h});A.data("_inputmask-multi",{activeMasksetIndex:0,elmasks:t});("rtl"==e.dir||c.numericInput&&
c.rightAlignNumerics||c.isNumeric&&c.rightAlignNumerics)&&A.css("text-align","right");e.dir="ltr";A.removeAttr("dir");A.bind("mouseenter blur focus mouseleave click dblclick keydown keypress keypress",function(a){var g=h(e),m,n=!0;if("keydown"==a.type){m=a.keyCode;if(m==c.keyCode.DOWN&&u<t.length-1)return u++,w("multiMaskScope",t),!1;if(m==c.keyCode.UP&&0<u)return u--,w("multiMaskScope",t),!1;if(a.ctrlKey||a.shiftKey||a.altKey)return!0}else if("keypress"==a.type&&(a.ctrlKey||a.shiftKey||a.altKey))return!0;
f.each(t,function(e,r){if("keydown"==a.type){m=a.keyCode;if(m==c.keyCode.BACKSPACE&&r._valueGet().length<g.begin)return;if(m==c.keyCode.TAB)n=!1;else{if(m==c.keyCode.RIGHT){h(r,g.begin+1,g.end+1);n=!1;return}if(m==c.keyCode.LEFT){h(r,g.begin-1,g.end-1);n=!1;return}}}if(-1!=["click"].indexOf(a.type)&&(h(r,q(g.begin),q(g.end)),g.begin!=g.end)){n=!1;return}-1!=["keydown"].indexOf(a.type)&&g.begin!=g.end&&h(r,g.begin,g.end);f(r).triggerHandler(a)});n&&setTimeout(function(){w(a.type,t)},0)});A.bind(T+
" dragdrop drop setvalue.inputmaskmulti",function(a){h(e);setTimeout(function(){f.each(t,function(c,h){h._valueSet(e.value);f(h).triggerHandler(a)});setTimeout(function(){w(a.type,t)},0)},0)});(function(a){if(void 0==f.valHooks[a]||!0!=f.valHooks[a].inputmaskmultipatch){var c=f.valHooks[a]&&f.valHooks[a].get?f.valHooks[a].get:function(a){return a.value},e=f.valHooks[a]&&f.valHooks[a].set?f.valHooks[a].set:function(a,c){a.value=c;return a};f.valHooks[a]={get:function(a){var d=f(a);return d.data("_inputmask-multi")?
(a=d.data("_inputmask-multi"),c(a.elmasks[a.activeMasksetIndex])):c(a)},set:function(a,c){var d=f(a),g=e(a,c);d.data("_inputmask-multi")&&d.triggerHandler("setvalue.inputmaskmulti");return g},inputmaskmultipatch:!0}}})(e.type);""!=A.attr("value")&&setTimeout(function(){w("init",t)},0)};f.inputmask={defaults:{placeholder:"_",optionalmarker:{start:"[",end:"]"},quantifiermarker:{start:"{",end:"}"},groupmarker:{start:"(",end:")"},escapeChar:"\\",mask:null,oncomplete:f.noop,onincomplete:f.noop,oncleared:f.noop,
repeat:0,greedy:!0,autoUnmask:!1,clearMaskOnLostFocus:!0,insertMode:!0,clearIncomplete:!1,aliases:{},onKeyUp:f.noop,onKeyDown:f.noop,onBeforeMask:void 0,onBeforePaste:void 0,onUnMask:void 0,showMaskOnFocus:!0,showMaskOnHover:!0,onKeyValidation:f.noop,skipOptionalPartCharacter:" ",showTooltip:!1,numericInput:!1,isNumeric:!1,radixPoint:"",skipRadixDance:!1,rightAlignNumerics:!0,definitions:{9:{validator:"[0-9]",cardinality:1,definitionSymbol:"*"},a:{validator:"[A-Za-z\u0410-\u044f\u0401\u0451]",cardinality:1,
definitionSymbol:"*"},"*":{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],isComplete:void 0,multi:!1,nojumps:!1,nojumpsThreshold:0,determineActiveMasksetIndex:void 0},masksCache:{},escapeRegex:function(e){return e.replace(RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","gim"),"\\$1")},format:function(e,a){var c=f.extend(!0,{},f.inputmask.defaults,a);F(c.alias,a,c);return E(I(c),c,{action:"format",value:e})},isValid:function(e,a){var c=f.extend(!0,{},f.inputmask.defaults,a);F(c.alias,
a,c);return E(I(c),c,{action:"isValid",value:e})}};f.fn.inputmask=function(e,a){var c=f.extend(!0,{},f.inputmask.defaults,a),h;if("string"===typeof e)switch(e){case "mask":return F(c.alias,a,c),h=I(c),0==h.length?this:this.each(function(){f.isArray(h)?R(this,h,c):E(f.extend(!0,{},h),c,{action:"mask",el:this})});case "unmaskedvalue":var q=f(this);return q.data("_inputmask")?(h=q.data("_inputmask").maskset,c=q.data("_inputmask").opts,E(h,c,{action:"unmaskedvalue",$input:q})):q.val();case "remove":return this.each(function(){var a=
f(this);if(a.data("_inputmask")){h=a.data("_inputmask").maskset;c=a.data("_inputmask").opts;this._valueSet(E(h,c,{action:"unmaskedvalue",$input:a,skipDatepickerCheck:!0}));a.removeData("_inputmask");a.unbind(".inputmask");a.removeClass("focus.inputmask");var e;Object.getOwnPropertyDescriptor&&(e=Object.getOwnPropertyDescriptor(this,"value"));e&&e.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").maskset,h._buffer.join("")):"";case "hasMaskedValue":return this.data("_inputmask")?!this.data("_inputmask").opts.autoUnmask:!1;case "isComplete":return this.data("_inputmask")?(h=this.data("_inputmask").maskset,c=this.data("_inputmask").opts,
E(h,c,{action:"isComplete",buffer:this[0]._valueGet().split(""),el:this})):!0;case "getmetadata":if(this.data("_inputmask"))return h=this.data("_inputmask").maskset,h.metadata;break;default:return F(e,a,c)||(c.mask=e),h=I(c),void 0==h?this:this.each(function(){f.isArray(h)?R(this,h,c):E(f.extend(!0,{},h),c,{action:"mask",el:this})})}else{if("object"==typeof e)return c=f.extend(!0,{},f.inputmask.defaults,e),F(c.alias,e,c),h=I(c),void 0==h?this:this.each(function(){f.isArray(h)?R(this,h,c):E(f.extend(!0,
{},h),c,{action:"mask",el:this})});if(void 0==e)return this.each(function(){var e=f(this).attr("data-inputmask");if(e&&""!=e)try{var e=e.replace(RegExp("'","g"),'"'),h=f.parseJSON("{"+e+"}");f.extend(!0,h,a);c=f.extend(!0,{},f.inputmask.defaults,h);F(c.alias,h,c);c.alias=void 0;f(this).inputmask(c)}catch(q){}})}}}})(jQuery);
