mirror of https://github.com/ColorlibHQ/gentelella
2 lines
33 KiB
JavaScript
2 lines
33 KiB
JavaScript
![]() |
!function(e){function t(e){var t=document.createElement("input"),i="on"+e,a=i in t;return a||(t.setAttribute(i,"return;"),a="function"==typeof t[i]),t=null,a}function i(e){var t="text"==e||"tel"==e;if(!t){var i=document.createElement("input");i.setAttribute("type",e),t="text"===i.type,i=null}return t}function a(t,i,n){var o=n.aliases[t];return o?(o.alias&&a(o.alias,void 0,n),e.extend(!0,n,o),e.extend(!0,n,i),!0):!1}function n(t){function i(i){function a(e,t,i,a){this.matches=[],this.isGroup=e||!1,this.isOptional=t||!1,this.isQuantifier=i||!1,this.isAlternator=a||!1,this.quantifier={min:1,max:1}}function n(i,a,n){var o=t.definitions[a],r=0==i.matches.length;if(n=void 0!=n?n:i.matches.length,o&&!p){o.placeholder=e.isFunction(o.placeholder)?o.placeholder.call(this,t):o.placeholder;for(var s=o.prevalidator,l=s?s.length:0,u=1;u<o.cardinality;u++){var c=l>=u?s[u-1]:[],d=c.validator,v=c.cardinality;i.matches.splice(n++,0,{fn:d?"string"==typeof d?new RegExp(d):new function(){this.test=d}:new RegExp("."),cardinality:v?v:1,optionality:i.isOptional,newBlockMarker:r,casing:o.casing,def:o.definitionSymbol||a,placeholder:o.placeholder,mask:a})}i.matches.splice(n++,0,{fn:o.validator?"string"==typeof o.validator?new RegExp(o.validator):new function(){this.test=o.validator}:new RegExp("."),cardinality:o.cardinality,optionality:i.isOptional,newBlockMarker:r,casing:o.casing,def:o.definitionSymbol||a,placeholder:o.placeholder,mask:a})}else i.matches.splice(n++,0,{fn:null,cardinality:0,optionality:i.isOptional,newBlockMarker:r,casing:null,def:a,placeholder:void 0,mask:a}),p=!1}for(var o,r,s,l,u,c,d=/(?:[?*+]|\{[0-9\+\*]+(?:,[0-9\+\*]*)?\})\??|[^.?*+^${[]()|\\]+|./g,p=!1,v=new a,f=[],m=[];o=d.exec(i);)switch(r=o[0],r.charAt(0)){case t.optionalmarker.end:case t.groupmarker.end:if(s=f.pop(),f.length>0){if(l=f[f.length-1],l.matches.push(s),l.isAlternator){u=f.pop();for(var h=0;h<u.matches.length;h++)u.matches[h].isGroup=!1;f.length>0?(l=f[f.length-1],l.matches.push(u)):v.matches.push(u)}}else v.matches.push(s);break;case t.optionalmarker.start:f.push(new a(!1,!0));break;case t.groupmarker.start:f.push(new a(!0));break;case t.quantifiermarker.start:var k=new a(!1,!1,!0);r=r.replace(/[{}]/g,"");var g=r.split(","),b=isNaN(g[0])?g[0]:parseInt(g[0]),y=1==g.length?b:isNaN(g[1])?g[1]:parseInt(g[1]);if(("*"==y||"+"==y)&&(b="*"==y?0:1),k.quantifier={min:b,max:y},f.length>0){var _=f[f.length-1].matches;if(o=_.pop(),!o.isGroup){var P=new a(!0);P.matches.push(o),o=P}_.push(o),_.push(k)}else{if(o=v.matches.pop(),!o.isGroup){var P=new a(!0);P.matches.push(o),o=P}v.matches.push(o),v.matches.push(k)}break;case t.escapeChar:p=!0;break;case t.alternatormarker:f.length>0?(l=f[f.length-1],c=l.matches.pop()):c=v.matches.pop(),c.isAlternator?f.push(c):(u=new a(!1,!1,!1,!0),u.matches.push(c),f.push(u));break;default:if(f.length>0){if(l=f[f.length-1],l.matches.length>0&&(c=l.matches[l.matches.length-1],c.isGroup&&(c.isGroup=!1,n(c,t.groupmarker.start,0),n(c,t.groupmarker.end))),n(l,r),l.isAlternator){u=f.pop();for(var h=0;h<u.matches.length;h++)u.matches[h].isGroup=!1;f.length>0?(l=f[f.length-1],l.matches.push(u)):v.matches.push(u)}}else v.matches.length>0&&(c=v.matches[v.matches.length-1],c.isGroup&&(c.isGroup=!1,n(c,t.groupmarker.start,0),n(c,t.groupmarker.end))),n(v,r)}return v.matches.length>0&&(c=v.matches[v.matches.length-1],c.isGroup&&(c.isGroup=!1,n(c,t.groupmarker.start,0),n(c,t.groupmarker.end)),m.push(v)),m}function a(a,n){if(void 0==a||""==a)return void 0;if(1==a.length&&0==t.greedy&&0!=t.repeat&&(t.placeholder=""),t.repeat>0||"*"==t.repeat||"+"==t.repeat){var o="*"==t.repeat?0:"+"==t.repeat?1:t.repeat;a=t.groupmarker.start+a+t.groupmarker.end+t.quantifiermarker.start+o+","+t.repeat+t.quantifiermarker.end}return void 0==e.inputmask.masksCache[a]&&(e.inputmask.masksCache[a]={mask:a,maskToken:i(a),validPositions:{},_buffer:void 0,buffer:void 0,tests:{},metadata:n}),e.extend(!0,{},e.inputmask.masksCache[a])}function n(e){if(e=e.toString(),t.numericInput){e=e.split("").reverse();for(var i=0;i<e.length;i++)e[i]==t.optionalmarker.start?e[i]=t.optionalmarker.end:
|
||
|
for(var r in i){var s=o.data("inputmask-"+r.toLowerCase());void 0!=s&&("mask"==r&&0==s.indexOf("[")?(i[r]=s.replace(/[\s[\]]/g,"").split("','"),i[r][0]=i[r][0].replace("'",""),i[r][i[r].length-1]=i[r][i[r].length-1].replace("'","")):i[r]="boolean"==typeof s?s:s.toString(),n&&(n[r]=i[r]))}return i}var s,l=e.extend(!0,{},e.inputmask.defaults,i);if("string"==typeof t)switch(t){case"mask":return a(l.alias,i,l),s=n(l),void 0==s?this:this.each(function(){o({action:"mask",el:this},e.extend(!0,{},s),r(this,l))});case"unmaskedvalue":var u=e(this);return u.data("_inputmask")?o({action:"unmaskedvalue",$input:u}):u.val();case"remove":return this.each(function(){var t=e(this);t.data("_inputmask")&&o({action:"remove",el:this})});case"getemptymask":return this.data("_inputmask")?o({action:"getemptymask",el:this}):"";case"hasMaskedValue":return this.data("_inputmask")?!this.data("_inputmask").opts.autoUnmask:!1;case"isComplete":return this.data("_inputmask")?o({action:"isComplete",buffer:this[0]._valueGet().split(""),el:this}):!0;case"getmetadata":return this.data("_inputmask")?o({action:"getmetadata",el:this}):void 0;default:return a(l.alias,i,l),a(t,i,l)||(l.mask=t),s=n(l),void 0==s?this:this.each(function(){o({action:"mask",el:this},e.extend(!0,{},s),r(this,l))})}else{if("object"==typeof t)return l=e.extend(!0,{},e.inputmask.defaults,t),a(l.alias,t,l),s=n(l),void 0==s?this:this.each(function(){o({action:"mask",el:this},e.extend(!0,{},s),r(this,l))});if(void 0==t)return this.each(function(){var t=e(this).attr("data-inputmask");if(t&&""!=t)try{t=t.replace(new RegExp("'","g"),'"');var n=e.parseJSON("{"+t+"}");e.extend(!0,n,i),l=e.extend(!0,{},e.inputmask.defaults,n),l=r(this,l),a(l.alias,n,l),l.alias=void 0,e(this).inputmask("mask",l)}catch(o){}if(e(this).attr("data-inputmask-mask")||e(this).attr("data-inputmask-alias")){l=e.extend(!0,{},e.inputmask.defaults,{});var s={};l=r(this,l,s),a(l.alias,s,l),l.alias=void 0,e(this).inputmask("mask",l)}})}}}return e.fn.inputmask}(jQuery);
|