-
Notifications
You must be signed in to change notification settings - Fork 38
/
Copy pathangular-input-masks.br.min.js
1 lines (1 loc) · 17.6 KB
/
angular-input-masks.br.min.js
1
require=function e(r,a,n){function t(s,u){if(!a[s]){if(!r[s]){var o="function"==typeof require&&require;if(!u&&o)return o(s,!0);if(i)return i(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=a[s]={exports:{}};r[s][0].call(l.exports,function(e){var a=r[s][1][e];return t(a?a:e)},l,l.exports,e,r,a,n)}return a[s].exports}for(var i="function"==typeof require&&require,s=0;s<n.length;s++)t(n[s]);return t}({1:[function(e,r,a){"use strict";r.exports=angular.module("ui.utils.masks",[e("./global/global-masks"),e("./br/br-masks")]).name},{"./br/br-masks":3,"./global/global-masks":14}],2:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("mask-factory"),i=new n("00000.00000 00000.000000 00000.000000 0 00000000000000");r.exports=t({clearValue:function(e){return e.replace(/[^0-9]/g,"").slice(0,47)},format:function(e){return 0===e.length?e:i.apply(e).replace(/[^0-9]$/,"")},validations:{brBoletoBancario:function(e){return 47===e.length}}})},{"mask-factory":"mask-factory","string-mask":void 0}],3:[function(e,r,a){"use strict";var n=angular.module("ui.utils.masks.br",[e("../helpers")]).directive("uiBrBoletoBancarioMask",e("./boleto-bancario/boleto-bancario")).directive("uiBrCepMask",e("./cep/cep")).directive("uiBrCnpjMask",e("./cnpj/cnpj")).directive("uiBrCpfMask",e("./cpf/cpf")).directive("uiBrCpfcnpjMask",e("./cpf-cnpj/cpf-cnpj")).directive("uiBrIeMask",e("./inscricao-estadual/ie")).directive("uiNfeAccessKeyMask",e("./nfe/nfe")).directive("uiBrCarPlateMask",e("./car-plate/car-plate")).directive("uiBrPhoneNumber",e("./phone/br-phone"));r.exports=n.name},{"../helpers":20,"./boleto-bancario/boleto-bancario":2,"./car-plate/car-plate":4,"./cep/cep":5,"./cnpj/cnpj":6,"./cpf-cnpj/cpf-cnpj":7,"./cpf/cpf":8,"./inscricao-estadual/ie":9,"./nfe/nfe":10,"./phone/br-phone":11}],4:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("mask-factory"),i=new n("UUU-0000");r.exports=t({clearValue:function(e){return e.replace(/[^a-zA-Z0-9]/g,"").slice(0,7)},format:function(e){return(i.apply(e)||"").replace(/[^a-zA-Z0-9]$/,"")},validations:{carPlate:function(e){return 7===e.length}}})},{"mask-factory":"mask-factory","string-mask":void 0}],5:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("mask-factory"),i=new n("00000-000");r.exports=t({clearValue:function(e){return e.toString().replace(/[^0-9]/g,"").slice(0,8)},format:function(e){return(i.apply(e)||"").replace(/[^0-9]$/,"")},validations:{cep:function(e){return 8===e.length}}})},{"mask-factory":"mask-factory","string-mask":void 0}],6:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("br-validations"),i=e("mask-factory"),s=new n("00.000.000/0000-00");r.exports=i({clearValue:function(e){return e.replace(/[^\d]/g,"").slice(0,14)},format:function(e){return(s.apply(e)||"").trim().replace(/[^0-9]$/,"")},validations:{cnpj:function(e){return t.cnpj.validate(e)}}})},{"br-validations":void 0,"mask-factory":"mask-factory","string-mask":void 0}],7:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("br-validations"),i=e("mask-factory"),s=new n("00.000.000/0000-00"),u=new n("000.000.000-00");r.exports=i({clearValue:function(e){return e.replace(/[^\d]/g,"").slice(0,14)},format:function(e){var r;return r=e.length>11?s.apply(e):u.apply(e)||"",r.trim().replace(/[^0-9]$/,"")},validations:{cpf:function(e){return e.length>11||t.cpf.validate(e)},cnpj:function(e){return e.length<=11||t.cnpj.validate(e)}}})},{"br-validations":void 0,"mask-factory":"mask-factory","string-mask":void 0}],8:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("br-validations"),i=e("mask-factory"),s=new n("000.000.000-00");r.exports=i({clearValue:function(e){return e.replace(/[^\d]/g,"").slice(0,11)},format:function(e){return(s.apply(e)||"").trim().replace(/[^0-9]$/,"")},validations:{cpf:function(e){return t.cpf.validate(e)}}})},{"br-validations":void 0,"mask-factory":"mask-factory","string-mask":void 0}],9:[function(e,r,a){"use strict";function n(e){function r(e){return e?e.replace(/[^0-9]/g,""):e}function a(e,a){if(e&&s[e]){if("SP"===e&&/^P/i.test(a))return s.SP[1].mask;for(var n=s[e],t=0;n[t].chars&&n[t].chars<r(a).length&&t<n.length-1;)t++;return n[t].mask}}function n(e,n){var t=a(n,e);if(!t)return e;var i=t.process(r(e)),s=i.result||"";return s=s.trim().replace(/[^0-9]$/,""),"SP"===n&&/^p/i.test(e)?"P"+s:s}var s={AC:[{mask:new t("00.000.000/000-00")}],AL:[{mask:new t("000000000")}],AM:[{mask:new t("00.000.000-0")}],AP:[{mask:new t("000000000")}],BA:[{chars:8,mask:new t("000000-00")},{mask:new t("0000000-00")}],CE:[{mask:new t("00000000-0")}],DF:[{mask:new t("00000000000-00")}],ES:[{mask:new t("00000000-0")}],GO:[{mask:new t("00.000.000-0")}],MA:[{mask:new t("000000000")}],MG:[{mask:new t("000.000.000/0000")}],MS:[{mask:new t("000000000")}],MT:[{mask:new t("0000000000-0")}],PA:[{mask:new t("00-000000-0")}],PB:[{mask:new t("00000000-0")}],PE:[{chars:9,mask:new t("0000000-00")},{mask:new t("00.0.000.0000000-0")}],PI:[{mask:new t("000000000")}],PR:[{mask:new t("000.00000-00")}],RJ:[{mask:new t("00.000.00-0")}],RN:[{chars:9,mask:new t("00.000.000-0")},{mask:new t("00.0.000.000-0")}],RO:[{mask:new t("0000000000000-0")}],RR:[{mask:new t("00000000-0")}],RS:[{mask:new t("000/0000000")}],SC:[{mask:new t("000.000.000")}],SE:[{mask:new t("00000000-0")}],SP:[{mask:new t("000.000.000.000")},{mask:new t("-00000000.0/000")}],TO:[{mask:new t("00000000000")}]};return{restrict:"A",require:"ngModel",link:function(a,t,s,u){function o(e){return u.$isEmpty(e)?e:n(e,l)}function c(e){if(u.$isEmpty(e))return e;var a=n(e,l),t=r(a);return u.$viewValue!==a&&(u.$setViewValue(a),u.$render()),l&&"SP"===l.toUpperCase()&&/^p/i.test(e)?"P"+t:t}var l=(e(s.uiBrIeMask)(a)||"").toUpperCase();u.$formatters.push(o),u.$parsers.push(c),u.$validators.ie=function(e){return u.$isEmpty(e)||i.ie(l).validate(e)},a.$watch(s.uiBrIeMask,function(e){l=(e||"").toUpperCase(),c(u.$viewValue),u.$validate()})}}}var t=e("string-mask"),i=e("br-validations");n.$inject=["$parse"],r.exports=n},{"br-validations":void 0,"string-mask":void 0}],10:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("mask-factory"),i=new n("0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000");r.exports=t({clearValue:function(e){return e.replace(/[^0-9]/g,"").slice(0,44)},format:function(e){return(i.apply(e)||"").replace(/[^0-9]$/,"")},validations:{nfeAccessKey:function(e){return 44===e.length}}})},{"mask-factory":"mask-factory","string-mask":void 0}],11:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("mask-factory"),i={areaCode:new n("(00) 0000-0000"),simple:new n("0000-0000")},s={areaCode:new n("(00) 00000-0000"),simple:new n("00000-0000")},u={areaCode:null,simple:new n("0000-000-0000")};r.exports=t({clearValue:function(e){return e.toString().replace(/[^0-9]/g,"").slice(0,11)},format:function(e){var r;return r=0===e.indexOf("0800")?u.simple.apply(e):e.length<9?i.simple.apply(e)||"":e.length<10?s.simple.apply(e):e.length<11?i.areaCode.apply(e):s.areaCode.apply(e),r.trim().replace(/[^0-9]$/,"")},getModelValue:function(e,r){var a=this.clearValue(e);return"number"===r?parseInt(a):a},validations:{brPhoneNumber:function(e){var r=e&&e.toString().length;return r>=8&&r<=11}}})},{"mask-factory":"mask-factory","string-mask":void 0}],12:[function(e,r,a){"use strict";var n=e("string-mask"),t=e("mask-factory"),i=16,s=new n("0000 0000 0000 0000");r.exports=t({clearValue:function(e){return e.toString().replace(/[^0-9]/g,"").slice(0,i)},format:function(e){var r;return r=s.apply(e)||"",r.trim().replace(/[^0-9]$/,"")},validations:{creditCard:function(e){var r=e&&e.toString().length;return r===i}}})},{"mask-factory":"mask-factory","string-mask":void 0}],13:[function(e,r,a){"use strict";function n(e){return/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}\.[0-9]{3}([-+][0-9]{2}:[0-9]{2}|Z)$/.test(e.toString())}function t(e){var r={"pt-br":"DD/MM/YYYY",ru:"DD.MM.YYYY"},a=r[e.id]||"YYYY-MM-DD";return{restrict:"A",require:"ngModel",link:function(e,r,t,u){function o(e){if(u.$isEmpty(e))return e;var r=e;("object"==typeof e||n(e))&&(r=i(e).format(a)),r=r.replace(/[^0-9]/g,"");var t=c.apply(r)||"";return t.trim().replace(/[^0-9]$/,"")}t.parse=t.parse||"true",a=t.uiDateMask||a;var c=new s(a.replace(/[YMD]/g,"0"));u.$formatters.push(o),u.$parsers.push(function(e){if(u.$isEmpty(e))return e;var r=o(e);return u.$viewValue!==r&&(u.$setViewValue(r),u.$render()),"false"===t.parse?r:i(r,a).toDate()}),u.$validators.date=function(e,r){return!!u.$isEmpty(e)||i(r,a).isValid()&&r.length===a.length}}}}var i=e("moment"),s=e("string-mask");t.$inject=["$locale"],r.exports=t},{moment:void 0,"string-mask":void 0}],14:[function(e,r,a){"use strict";var n=angular.module("ui.utils.masks.global",[e("../helpers")]).directive("uiDateMask",e("./date/date")).directive("uiMoneyMask",e("./money/money")).directive("uiNumberMask",e("./number/number")).directive("uiPercentageMask",e("./percentage/percentage")).directive("uiScientificNotationMask",e("./scientific-notation/scientific-notation")).directive("uiTimeMask",e("./time/time")).directive("uiCreditCard",e("./credit-card/credit-card"));r.exports=n.name},{"../helpers":20,"./credit-card/credit-card":12,"./date/date":13,"./money/money":15,"./number/number":16,"./percentage/percentage":17,"./scientific-notation/scientific-notation":18,"./time/time":19}],15:[function(e,r,a){"use strict";function n(e,r,a){return{restrict:"A",require:"ngModel",link:function(n,s,u,o){function c(e){var r=e>0?p+new Array(e+1).join("0"):"",a="#"+m+"##0"+r;return angular.isDefined(u.uiCurrencyAfter)?a+=v:a=v+a,new t(a,{reverse:!0})}function l(e){if(o.$isEmpty(e))return e;var r=angular.isDefined(u.uiNegativeNumber)&&e<0?"-":"",n=a.prepareNumberToFormatter(e,g);return angular.isDefined(u.uiCurrencyAfter)?r+$.apply(n)+d:r+d+$.apply(n)}function f(e){if(o.$isEmpty(e))return e;var r,a=e.replace(/[^\d]+/g,"");if(a=a.replace(/^[0]+([1-9])/,"$1"),a=a||"0",k&&angular.isDefined(u.uiCurrencyAfter)&&0!==a&&(a=a.substring(0,a.length-1),k=!1),r=angular.isDefined(u.uiCurrencyAfter)?$.apply(a)+d:d+$.apply(a),angular.isDefined(u.uiNegativeNumber)){var n="-"===e[0],t="-"===e.slice(-1);t^n&&a&&(a*=-1,r="-"+r)}return e!==r&&(o.$setViewValue(r),o.$render()),r?parseInt(r.replace(/[^\d\-]+/g,""))/Math.pow(10,g):null}var p=e.NUMBER_FORMATS.DECIMAL_SEP,m=e.NUMBER_FORMATS.GROUP_SEP,d=e.NUMBER_FORMATS.CURRENCY_SYM,v=" ",g=r(u.uiMoneyMask)(n),k=!1;s.bind("keydown keypress",function(e){k=8===e.which}),angular.isDefined(u.uiDecimalDelimiter)&&(p=u.uiDecimalDelimiter),angular.isDefined(u.uiThousandsDelimiter)&&(m=u.uiThousandsDelimiter),angular.isDefined(u.uiHideGroupSep)&&(m=""),angular.isDefined(u.uiHideSpace)&&(v=""),angular.isDefined(u.currencySymbol)&&(d=u.currencySymbol,0===u.currencySymbol.length&&(v="")),isNaN(g)&&(g=2),g=parseInt(g);var $=c(g);if(o.$formatters.push(l),o.$parsers.push(f),u.uiMoneyMask&&n.$watch(u.uiMoneyMask,function(e){g=isNaN(e)?2:e,g=parseInt(g),$=c(g),f(o.$viewValue)}),u.min){var y;o.$validators.min=function(e){return i.minNumber(o,e,y)},n.$watch(u.min,function(e){y=e,o.$validate()})}if(u.max){var M;o.$validators.max=function(e){return i.maxNumber(o,e,M)},n.$watch(u.max,function(e){M=e,o.$validate()})}}}}var t=e("string-mask"),i=e("validators");n.$inject=["$locale","$parse","PreFormatters"],r.exports=n},{"string-mask":void 0,validators:"validators"}],16:[function(e,r,a){"use strict";function n(e,r,a,n){return{restrict:"A",require:"ngModel",link:function(i,s,u,o){function c(e){if(o.$isEmpty(e))return null;var r=a.clearDelimitersAndLeadingZeros(e)||"0",n=v.apply(r),t=parseFloat(g.apply(r));if(angular.isDefined(u.uiNegativeNumber)){var i="-"===e[0],s="-"===e.slice(-1);(s^i||"-"===e)&&(t*=-1,n="-"+(0!==t?n:""))}return o.$viewValue!==n&&(o.$setViewValue(n),o.$render()),t}function l(e){if(o.$isEmpty(e))return e;var r=angular.isDefined(u.uiNegativeNumber)&&e<0?"-":"",n=a.prepareNumberToFormatter(e,d);return r+v.apply(n)}function f(){"-"===o.$viewValue&&(o.$setViewValue(""),o.$render())}var p=e.NUMBER_FORMATS.DECIMAL_SEP,m=e.NUMBER_FORMATS.GROUP_SEP,d=r(u.uiNumberMask)(i);angular.isDefined(u.uiHideGroupSep)&&(m=""),isNaN(d)&&(d=2);var v=n.viewMask(d,p,m),g=n.modelMask(d);if(s.on("blur",f),o.$formatters.push(l),o.$parsers.push(c),u.uiNumberMask&&i.$watch(u.uiNumberMask,function(e){d=isNaN(e)?2:e,v=n.viewMask(d,p,m),g=n.modelMask(d),c(o.$viewValue)}),u.min){var k;o.$validators.min=function(e){return t.minNumber(o,e,k)},i.$watch(u.min,function(e){k=e,o.$validate()})}if(u.max){var $;o.$validators.max=function(e){return t.maxNumber(o,e,$)},i.$watch(u.max,function(e){$=e,o.$validate()})}}}}var t=e("validators");n.$inject=["$locale","$parse","PreFormatters","NumberMasks"],r.exports=n},{validators:"validators"}],17:[function(e,r,a){"use strict";function n(e,r,a,n){function i(e,r,n){return a.clearDelimitersAndLeadingZeros((parseFloat(e)*n).toFixed(r))}return{restrict:"A",require:"ngModel",link:function(r,s,u,o){function c(e){if(o.$isEmpty(e))return e;var r=i(e,m,g.multiplier);return $.apply(r)+(d?"%":" %")}function l(e){if(o.$isEmpty(e))return null;var r=a.clearDelimitersAndLeadingZeros(e)||"0";e.length>1&&e.indexOf("%")===-1&&(r=r.slice(0,r.length-1)),v&&1===e.length&&"%"!==e&&(r="0");var n=d?"%":" %",t=$.apply(r)+n,i=parseFloat(y.apply(r));return o.$viewValue!==t&&(o.$setViewValue(t),o.$render()),i}var f=e.NUMBER_FORMATS.DECIMAL_SEP,p=e.NUMBER_FORMATS.GROUP_SEP,m=parseInt(u.uiPercentageMask),d=!1,v=!1;s.bind("keydown keypress",function(e){v=8===e.which});var g={multiplier:100,decimalMask:2};angular.isDefined(u.uiHideGroupSep)&&(p=""),angular.isDefined(u.uiHideSpace)&&(d=!0),angular.isDefined(u.uiPercentageValue)&&(g.multiplier=1,g.decimalMask=0),isNaN(m)&&(m=2);var k=m+g.decimalMask,$=n.viewMask(m,f,p),y=n.modelMask(k);if(o.$formatters.push(c),o.$parsers.push(l),u.uiPercentageMask&&r.$watch(u.uiPercentageMask,function(e){m=isNaN(e)?2:e,angular.isDefined(u.uiPercentageValue)&&(g.multiplier=1,g.decimalMask=0),k=m+g.decimalMask,$=n.viewMask(m,f,p),y=n.modelMask(k),l(o.$viewValue)}),u.min){var M;o.$validators.min=function(e){return t.minNumber(o,e,M)},r.$watch(u.min,function(e){M=e,o.$validate()})}if(u.max){var w;o.$validators.max=function(e){return t.maxNumber(o,e,w)},r.$watch(u.max,function(e){w=e,o.$validate()})}}}}var t=e("validators");n.$inject=["$locale","$parse","PreFormatters","NumberMasks"],r.exports=n},{validators:"validators"}],18:[function(e,r,a){"use strict";function n(e,r){function a(e){var r="0";if(e>0){r+=n;for(var a=0;a<e;a++)r+="0"}return new t(r,{reverse:!0})}var n=e.NUMBER_FORMATS.DECIMAL_SEP,i=2;return{restrict:"A",require:"ngModel",link:function(e,t,s,u){function o(e){var r=e.toString(),a=r.match(/(-?[0-9]*)[\.]?([0-9]*)?[Ee]?([\+-]?[0-9]*)?/);return{integerPartOfSignificand:a[1],decimalPartOfSignificand:a[2],exponent:0|a[3]}}function c(e){if(u.$isEmpty(e))return e;"string"==typeof e?e=e.replace(n,"."):"number"==typeof e&&(e=e.toExponential(f));var r,a,t=o(e),i=t.integerPartOfSignificand||0,s=i.toString();angular.isDefined(t.decimalPartOfSignificand)&&(s+=t.decimalPartOfSignificand);var c=(i>=1||i<=-1)&&(angular.isDefined(t.decimalPartOfSignificand)&&t.decimalPartOfSignificand.length>f||0===f&&s.length>=2);return c&&(a=s.slice(f+1,s.length),s=s.slice(0,f+1)),r=p.apply(s),0!==t.exponent&&(a=t.exponent),angular.isDefined(a)&&(r+="e"+a),r}function l(e){if(u.$isEmpty(e))return e;var r=c(e),a=parseFloat(r.replace(n,"."));return u.$viewValue!==r&&(u.$setViewValue(r),u.$render()),a}var f=r(s.uiScientificNotationMask)(e);isNaN(f)&&(f=i);var p=a(f);u.$formatters.push(c),u.$parsers.push(l),u.$validators.max=function(e){return u.$isEmpty(e)||e<Number.MAX_VALUE}}}}var t=e("string-mask");n.$inject=["$locale","$parse"],r.exports=n},{"string-mask":void 0}],19:[function(e,r,a){"use strict";var n=e("string-mask");r.exports=function(){return{restrict:"A",require:"ngModel",link:function(e,r,a,t){function i(e){if(t.$isEmpty(e))return e;var r=e.replace(/[^0-9]/g,"").slice(0,o)||"";return(c.apply(r)||"").replace(/[^0-9]$/,"")}var s="00:00:00";angular.isDefined(a.uiTimeMask)&&"short"===a.uiTimeMask&&(s="00:00");var u=s.length,o=s.replace(":","").length,c=new n(s);t.$formatters.push(i),t.$parsers.push(function(e){if(t.$isEmpty(e))return e;var r=i(e),a=r;return t.$viewValue!==r&&(t.$setViewValue(r),t.$render()),a}),t.$validators.time=function(e){if(t.$isEmpty(e))return!0;var r=e.toString().split(/:/).filter(function(e){return!!e}),a=parseInt(r[0]),n=parseInt(r[1]),i=parseInt(r[2]||0);return e.toString().length===u&&a<24&&n<60&&i<60}}}}},{"string-mask":void 0}],20:[function(e,r,a){"use strict";var n=e("string-mask"),t=angular.module("ui.utils.masks.helpers",[]);r.exports=t.name,t.factory("PreFormatters",[function(){function e(e){if("0"===e)return"0";var r=e.replace(/^-/,"").replace(/^0*/,"");return r.replace(/[^0-9]/g,"")}function r(r,a){return e(parseFloat(r).toFixed(a))}return{clearDelimitersAndLeadingZeros:e,prepareNumberToFormatter:r}}]).factory("NumberMasks",[function(){return{viewMask:function(e,r,a){var t="#"+a+"##0";if(e>0){t+=r;for(var i=0;i<e;i++)t+="0"}return new n(t,{reverse:!0})},modelMask:function(e){var r="###0";if(e>0){r+=".";for(var a=0;a<e;a++)r+="0"}return new n(r,{reverse:!0})}}}])},{"string-mask":void 0}],"mask-factory":[function(e,r,a){"use strict";r.exports=function(e){return function(){return{restrict:"A",require:"ngModel",link:function(r,a,n,t){t.$formatters.push(function(r){if(t.$isEmpty(r))return r;var a=e.clearValue(r);return e.format(a)}),t.$parsers.push(function(r){if(t.$isEmpty(r))return r;var a=e.clearValue(r),n=e.format(a);if(t.$viewValue!==n&&(t.$setViewValue(n),t.$render()),angular.isUndefined(e.getModelValue))return a;var i=typeof t.$modelValue;return e.getModelValue(n,i)}),angular.forEach(e.validations,function(e,r){t.$validators[r]=function(r,a){return t.$isEmpty(r)||e(r,a)}})}}}}},{}],validators:[function(e,r,a){"use strict";r.exports={maxNumber:function(e,r,a){var n=parseFloat(a,10);return e.$isEmpty(r)||isNaN(n)||r<=n},minNumber:function(e,r,a){var n=parseFloat(a,10);return e.$isEmpty(r)||isNaN(n)||r>=n}}},{}]},{},[1]);