(function(g){g.extend(g.inputmask.defaults.aliases,{decimal:{mask:"~",placeholder:"",repeat:10,greedy:!1,numericInput:!0,digits:"*",groupSeparator:"",radixPoint:".",groupSize:3,autoGroup:!1,getMaskLength:function(d,e,c,b,a){var f=d.length;!e&&1<c&&(f+=d.length*(c-1));d=g.inputmask.escapeRegex.call(this,a.groupSeparator);a=g.inputmask.escapeRegex.call(this,a.radixPoint);b=b.join("");a=b.replace(RegExp(d,"g"),"").replace(RegExp(a),"");return f+(b.length-a.length)},postFormat:function(d,e,c,b){if(""==
b.groupSeparator)return e-1;var a=d.slice();c||a.splice(e,0,"?");a=a.join("");if(b.autoGroup||c&&-1!=a.indexOf(b.groupSeparator)){for(var f=g.inputmask.escapeRegex.call(this,b.groupSeparator),a=a.replace(RegExp(f,"g"),""),f=a.split(b.radixPoint),a=f[0],h=RegExp("([-+]?[\\d?]+)([\\d?]{"+b.groupSize+"})");h.test(a);)a=a.replace(h,"$1"+b.groupSeparator+"$2"),a=a.replace(b.groupSeparator+b.groupSeparator,b.groupSeparator);1<f.length&&(a+=b.radixPoint+f[1])}d.length=a.length;b=0;for(f=a.length;b<f;b++)d[b]=
a.charAt(b);e=c?e:g.inArray("?",d);c||d.splice(e,1);return e},regex:{number:function(d,e,c,b){d=g.inputmask.escapeRegex.call(this,d);c=g.inputmask.escapeRegex.call(this,c);b=isNaN(b)?b:"{0,"+b+"}";return RegExp("^[+-]?(\\d+|\\d{1,"+e+"}(("+d+"\\d{"+e+"})?)+)("+c+"\\d"+b+")?$")}},onKeyDown:function(d,e,c){var b=g(this);if(d.keyCode==c.keyCode.TAB){if(d=g.inArray(c.radixPoint,e),-1!=d){for(var a=b.data("inputmask").masksets,b=b.data("inputmask").activeMasksetIndex,f=1;f<=c.digits&&f<c.getMaskLength(a[b]._buffer,
a[b].greedy,a[b].repeat,e,c);f++)void 0==e[d+f]&&(e[d+f]="0");this._valueSet(e.join(""))}}else if(d.keyCode==c.keyCode.DELETE||d.keyCode==c.keyCode.BACKSPACE)c.postFormat(e,0,!0,c),this._valueSet(e.join(""))},definitions:{"~":{validator:function(d,e,c,b,a){if(""==d)return!1;if(1>=c&&"0"===e[0]&&/[\d-]/.test(d))return e[0]="",{pos:0};var f=b?e.slice(0,c):e.slice();f.splice(c+1,0,d);f=f.join("");if(a.autoGroup&&!b)var h=g.inputmask.escapeRegex.call(this,a.groupSeparator),f=f.replace(RegExp(h,"g"),"");
h=a.regex.number(a.groupSeparator,a.groupSize,a.radixPoint,a.digits).test(f);if(!h&&(f+="0",h=a.regex.number(a.groupSeparator,a.groupSize,a.radixPoint,a.digits).test(f),!h)){h=f.lastIndexOf(a.groupSeparator);for(i=f.length-h;3>=i;i++)f+="0";h=a.regex.number(a.groupSeparator,a.groupSize,a.radixPoint,a.digits).test(f);if(!h&&!b&&d==a.radixPoint&&(h=a.regex.number(a.groupSeparator,a.groupSize,a.radixPoint,a.digits).test("0"+f+"0")))return e[c]="0",c++,{pos:c}}return!1!=h&&!b&&d!=a.radixPoint?{pos:a.postFormat(e,
c+1,!1,a)}:h},cardinality:1,prevalidator:null}},insertMode:!0,autoUnmask:!1},"non-negative-decimal":{regex:{number:function(d,e,c,b){d=g.inputmask.escapeRegex.call(this,d);c=g.inputmask.escapeRegex.call(this,c);b=isNaN(b)?b:"{0,"+b+"}";return RegExp("^[+]?(\\d+|\\d{1,"+e+"}(("+d+"\\d{"+e+"})?)+)("+c+"\\d"+b+")?$")}},alias:"decimal"},integer:{regex:{number:function(d,e){var c=g.inputmask.escapeRegex.call(this,d);return RegExp("^[+-]?(\\d+|\\d{1,"+e+"}(("+c+"\\d{"+e+"})?)+)$")}},alias:"decimal"},"non-negative-integer":{regex:{number:function(d,
e){var c=g.inputmask.escapeRegex.call(this,d);return RegExp("^[+]?(\\d+|\\d{1,"+e+"}(("+c+"\\d{"+e+"})?)+)$")}},alias:"integer"}})})(jQuery);
