From 812bf04853f7c630350d140a421ed54e238ff655 Mon Sep 17 00:00:00 2001 From: Chris O'Hara Date: Thu, 22 Jun 2017 12:34:14 +1000 Subject: [PATCH] Additional stuff for #670 --- CHANGELOG.md | 2 ++ lib/isURL.js | 2 +- validator.js | 2 +- validator.min.js | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 335c4f5fe..714bdf6f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ - Added an `isISRC()` validator for [ISRC](https://en.wikipedia.org/wiki/International_Standard_Recording_Code) ([#660](https://github.com/chriso/validator.js/pull/660)) +- Fixed a bug in credit card validation + ([#670](https://github.com/chriso/validator.js/pull/670)) - New locales ([#647](https://github.com/chriso/validator.js/pull/647), [#667](https://github.com/chriso/validator.js/pull/667), diff --git a/lib/isURL.js b/lib/isURL.js index adfb2251a..81dcc535a 100644 --- a/lib/isURL.js +++ b/lib/isURL.js @@ -52,7 +52,7 @@ function checkHost(host, matches) { function isURL(url, options) { (0, _assertString2.default)(url); - if (!url || url.length > 2083 || /[\s<>]/.test(url)) { + if (!url || url.length >= 2083 || /[\s<>]/.test(url)) { return false; } if (url.indexOf('mailto:') === 0) { diff --git a/validator.js b/validator.js index 929bbcb40..0fda3a11c 100644 --- a/validator.js +++ b/validator.js @@ -438,7 +438,7 @@ function isURL(url, options) { assertString(url); - if (!url || url.length > 2083 || /[\s<>]/.test(url)) { + if (!url || url.length >= 2083 || /[\s<>]/.test(url)) { return false; } if (url.indexOf('mailto:') === 0) { diff --git a/validator.min.js b/validator.min.js index d2177d498..eaddbadf5 100644 --- a/validator.min.js +++ b/validator.min.js @@ -20,4 +20,4 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.validator=e()}(this,function(){"use strict";function t(t){if(!("string"==typeof t||t instanceof String))throw new TypeError("This library (validator.js) validates strings only")}function e(e){return t(e),e=Date.parse(e),isNaN(e)?null:new Date(e)}function o(e){return t(e),parseFloat(e)}function r(e,o){return t(e),parseInt(e,o||10)}function i(e,o){return t(e),o?"1"===e||"true"===e:"0"!==e&&"false"!==e&&""!==e}function n(e,o){return t(e),e===o}function l(t){return"object"===(void 0===t?"undefined":ht(t))&&null!==t?t="function"==typeof t.toString?t.toString():"[object Object]":(null===t||void 0===t||isNaN(t)&&!t.length)&&(t=""),String(t)}function a(e,o){return t(e),e.indexOf(l(o))>=0}function u(e,o,r){return t(e),"[object RegExp]"!==Object.prototype.toString.call(o)&&(o=new RegExp(o,r)),o.test(e)}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];for(var o in e)void 0===t[o]&&(t[o]=e[o]);return t}function c(e,o){t(e);var r=void 0,i=void 0;"object"===(void 0===o?"undefined":ht(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=encodeURI(e).split(/%..|./).length-1;return n>=r&&(void 0===i||n<=i)}function d(e,o){t(e),o=s(o,pt),o.allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1));var r=e.split(".");if(o.require_tld){var i=r.pop();if(!r.length||!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(i))return!1}for(var n,l=0;l1&&void 0!==arguments[1]?arguments[1]:"";if(t(e),!(o=String(o)))return h(e,4)||h(e,6);if("4"===o){if(!xt.test(e))return!1;return e.split(".").sort(function(t,e){return t-e})[3]<=255}if("6"===o){var r=e.split(":"),i=!1,n=h(r[r.length-1],4),l=n?7:8;if(r.length>l)return!1;if("::"===e)return!0;"::"===e.substr(0,2)?(r.shift(),r.shift(),i=!0):"::"===e.substr(e.length-2)&&(r.pop(),r.pop(),i=!0);for(var a=0;a0&&a=1:r.length===l}return!1}function p(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function g(t,e){for(var o=0;o=2083||/[\s<>]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;o=s(o,yt);var r=void 0,i=void 0,n=void 0,l=void 0,a=void 0,u=void 0,c=void 0,f=void 0;if(c=e.split("#"),e=c.shift(),c=e.split("?"),e=c.shift(),c=e.split("://"),c.length>1){if(r=c.shift(),o.require_valid_protocol&&-1===o.protocols.indexOf(r))return!1}else{if(o.require_protocol)return!1;o.allow_protocol_relative_urls&&"//"===e.substr(0,2)&&(c[0]=e.substr(2))}if(e=c.join("://"),c=e.split("/"),""===(e=c.shift())&&!o.require_host)return!0;if(c=e.split("@"),c.length>1&&(i=c.shift(),i.indexOf(":")>=0&&i.split(":").length>2))return!1;l=c.join("@"),u=f=null;var p=l.match(wt);return p?(n="",f=p[1],u=p[2]||null):(c=l.split(":"),n=c.shift(),c.length&&(u=c.join(":"))),!(null!==u&&(a=parseInt(u,10),!/^[0-9]+$/.test(u)||a<=0||a>65535))&&(!!(h(n)||d(n,o)||f&&h(f,6)||"localhost"===n)&&(n=n||f,!(o.host_whitelist&&!g(n,o.host_whitelist))&&(!o.host_blacklist||!g(n,o.host_blacklist))))}function v(e){return t(e),bt.test(e)}function _(e){return t(e),["true","false","1","0"].indexOf(e)>=0}function F(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if(t(e),o in kt)return kt[o].test(e);throw new Error("Invalid locale '"+o+"'")}function $(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if(t(e),o in St)return St[o].test(e);throw new Error("Invalid locale '"+o+"'")}function x(e){return t(e),Rt.test(e)}function A(e){return t(e),e===e.toLowerCase()}function y(e){return t(e),e===e.toUpperCase()}function w(e){return t(e),Ct.test(e)}function b(e){return t(e),jt.test(e)}function k(e){return t(e),Pt.test(e)}function S(e){return t(e),jt.test(e)&&Pt.test(e)}function D(e){return t(e),Ut.test(e)}function Z(e){return t(e),zt.test(e)}function E(e,o){t(e),o=o||{};var r=o.hasOwnProperty("allow_leading_zeroes")&&!o.allow_leading_zeroes?Lt:Nt,i=!o.hasOwnProperty("min")||e>=o.min,n=!o.hasOwnProperty("max")||e<=o.max,l=!o.hasOwnProperty("lt")||eo.gt;return r.test(e)&&i&&n&&l&&a}function I(e,o){return t(e),o=o||{},""!==e&&"."!==e&&(Bt.test(e)&&(!o.hasOwnProperty("min")||e>=o.min)&&(!o.hasOwnProperty("max")||e<=o.max)&&(!o.hasOwnProperty("lt")||eo.gt))}function O(e){return t(e),""!==e&&qt.test(e)}function R(e){return t(e),Tt.test(e)}function C(e,r){return t(e),o(e)%parseInt(r,10)==0}function j(e){return t(e),Ht.test(e)}function P(e){return t(e),Kt.test(e)}function U(e){return t(e),Mt.test(e)}function z(e){t(e);try{var o=JSON.parse(e);return!!o&&"object"===(void 0===o?"undefined":ht(o))}catch(t){}return!1}function L(e){return t(e),0===e.length}function N(e,o){t(e);var r=void 0,i=void 0;"object"===(void 0===o?"undefined":ht(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],l=e.length-n.length;return l>=r&&(void 0===i||l<=i)}function B(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";t(e);var r=Wt[o];return r&&r.test(e)}function q(e){return t(e),R(e)&&24===e.length}function T(o){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);t(o);var i=e(r),n=e(o);return!!(n&&i&&n>i)}function H(o){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);t(o);var i=e(r),n=e(o);return!!(n&&i&&n=0}return"object"===(void 0===o?"undefined":ht(o))?o.hasOwnProperty(e):!(!o||"function"!=typeof o.indexOf)&&o.indexOf(e)>=0}function M(e){t(e);var o=e.replace(/[^0-9]+/g,"");if(!Gt.test(o))return!1;for(var r=0,i=void 0,n=void 0,l=void 0,a=o.length-1;a>=0;a--)i=o.substring(a,a+1),n=parseInt(i,10),l?(n*=2,r+=n>=10?n%10+1:n):r+=n,l=!l;return!(r%10!=0||!o)}function W(e){if(t(e),!Yt.test(e))return!1;for(var o=e.replace(/[A-Z]/g,function(t){return parseInt(t,36)}),r=0,i=void 0,n=void 0,l=!0,a=o.length-2;a>=0;a--)i=o.substring(a,a+1),n=parseInt(i,10),l?(n*=2,r+=n>=10?n+1:n):r+=n,l=!l;return parseInt(e.substr(e.length-1),10)===(1e4-r)%10}function G(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t(e),!(o=String(o)))return G(e,10)||G(e,13);var r=e.replace(/[\s-]+/g,""),i=0,n=void 0;if("10"===o){if(!Jt.test(r))return!1;for(n=0;n<9;n++)i+=(n+1)*r.charAt(n);if("X"===r.charAt(9)?i+=100:i+=10*r.charAt(9),i%11==0)return!!r}else if("13"===o){if(!Qt.test(r))return!1;for(n=0;n<12;n++)i+=Xt[n%2]*r.charAt(n);if(r.charAt(12)-(10-i%10)%10==0)return!!r}return!1}function Y(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(e);var r=Vt;if(r=o.require_hyphen?r.replace("?",""):r,r=o.case_sensitive?new RegExp(r):new RegExp(r,"i"),!r.test(e))return!1;var i=e.replace("-",""),n=8,l=0,a=!0,u=!1,s=void 0;try{for(var c,d=i[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){var f=c.value;l+=("X"===f.toUpperCase()?10:+f)*n,--n}}catch(t){u=!0,s=t}finally{try{!a&&d.return&&d.return()}finally{if(u)throw s}}return l%11==0}function J(e,o){return t(e),o in te&&te[o].test(e)}function Q(t){var e="(\\"+t.symbol.replace(/\./g,"\\.")+")"+(t.require_symbol?"":"?"),o="[1-9]\\d{0,2}(\\"+t.thousands_separator+"\\d{3})*",r=["0","[1-9]\\d*",o],i="("+r.join("|")+")?",n="(\\"+t.decimal_separator+"\\d{2})?",l=i+n;return t.allow_negatives&&!t.parens_for_negatives&&(t.negative_sign_after_digits?l+="-?":t.negative_sign_before_digits&&(l="-?"+l)),t.allow_negative_sign_placeholder?l="( (?!\\-))?"+l:t.allow_space_after_symbol?l=" ?"+l:t.allow_space_after_digits&&(l+="( (?!$))?"),t.symbol_after_digits?l+=e:l=e+l,t.allow_negatives&&(t.parens_for_negatives?l="(\\("+l+"\\)|"+l+")":t.negative_sign_before_digits||t.negative_sign_after_digits||(l="-?"+l)),new RegExp("^(?!-? )(?=.*\\d)"+l+"$")}function X(e,o){return t(e),o=s(o,ee),Q(o).test(e)}function V(e){return t(e),oe.test(e)}function tt(e){t(e);var o=e.length;if(!o||o%4!=0||re.test(e))return!1;var r=e.indexOf("=");return-1===r||r===o-1||r===o-2&&"="===e[o-1]}function et(e){return t(e),ie.test(e)}function ot(e,o){t(e);var r=o?new RegExp("^["+o+"]+","g"):/^\s+/g;return e.replace(r,"")}function rt(e,o){t(e);for(var r=o?new RegExp("["+o+"]"):/\s/,i=e.length-1;i>=0&&r.test(e[i]);)i--;return i/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")}function lt(e){return t(e),e.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/`/g,"`")}function at(e,o){return t(e),e.replace(new RegExp("["+o+"]+","g"),"")}function ut(e,o){return t(e),at(e,o?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F")}function st(e,o){return t(e),e.replace(new RegExp("[^"+o+"]+","g"),"")}function ct(e,o){t(e);for(var r=e.length-1;r>=0;r--)if(-1===o.indexOf(e[r]))return!1;return!0}function dt(t,e){if(e=s(e,ne),!f(t))return!1;var o=t.split("@"),r=o.pop(),i=o.join("@"),n=[i,r];if(n[1]=n[1].toLowerCase(),"gmail.com"===n[1]||"googlemail.com"===n[1]){if(e.gmail_remove_subaddress&&(n[0]=n[0].split("+")[0]),e.gmail_remove_dots&&(n[0]=n[0].replace(/\./g,"")),!n[0].length)return!1;(e.all_lowercase||e.gmail_lowercase)&&(n[0]=n[0].toLowerCase()),n[1]=e.gmail_convert_googlemaildotcom?"gmail.com":n[1]}else if(~le.indexOf(n[1])){if(e.icloud_remove_subaddress&&(n[0]=n[0].split("+")[0]),!n[0].length)return!1;(e.all_lowercase||e.icloud_lowercase)&&(n[0]=n[0].toLowerCase())}else if(~ae.indexOf(n[1])){if(e.outlookdotcom_remove_subaddress&&(n[0]=n[0].split("+")[0]),!n[0].length)return!1;(e.all_lowercase||e.outlookdotcom_lowercase)&&(n[0]=n[0].toLowerCase())}else if(~ue.indexOf(n[1])){if(e.yahoo_remove_subaddress){var l=n[0].split("-");n[0]=l.length>1?l.slice(0,-1).join("-"):l[0]}if(!n[0].length)return!1;(e.all_lowercase||e.yahoo_lowercase)&&(n[0]=n[0].toLowerCase())}else e.all_lowercase&&(n[0]=n[0].toLowerCase());return n.join("@")}for(var ft,ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt=(function(){function t(t){this.value=t}function e(e){function o(t,e){return new Promise(function(o,i){var a={key:t,arg:e,resolve:o,reject:i,next:null};l?l=l.next=a:(n=l=a,r(t,e))})}function r(o,n){try{var l=e[o](n),a=l.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(l.done?"return":"normal",l.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}n=n.next,n?r(n.key,n.arg):l=null}var n,l;this._invoke=o,"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),{require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1}),gt={allow_display_name:!1,require_display_name:!1,allow_utf8_local_part:!0,require_tld:!0},mt=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i,vt=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,_t=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,Ft=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,$t=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,xt=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,At=/^[0-9A-F]{1,4}$/i,yt={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},wt=/^\[([^\]]+)\](?::([0-9]+))?$/,bt=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,kt={"en-US":/^[A-Z]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"nl-NL":/^[A-ZÉËÏÓÖÜ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[А-ЩЬЮЯЄIЇҐ]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},St={"en-US":/^[0-9A-Z]+$/i,"cs-CZ":/^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[0-9A-ZÆØÅ]$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"hu-HU":/^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"nl-NL":/^[0-9A-ZÉËÏÓÖÜ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁ]+$/i,"sr-RS@latin":/^[0-9A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[0-9А-ЯЂЈЉЊЋЏ]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[0-9А-ЩЬЮЯЄIЇҐ]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},Dt=["AU","GB","HK","IN","NZ","ZA","ZM"],Zt=0;Zt=0}function u(e,o,r){return t(e),"[object RegExp]"!==Object.prototype.toString.call(o)&&(o=new RegExp(o,r)),o.test(e)}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments[1];for(var o in e)void 0===t[o]&&(t[o]=e[o]);return t}function c(e,o){t(e);var r=void 0,i=void 0;"object"===(void 0===o?"undefined":ht(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=encodeURI(e).split(/%..|./).length-1;return n>=r&&(void 0===i||n<=i)}function d(e,o){t(e),o=s(o,pt),o.allow_trailing_dot&&"."===e[e.length-1]&&(e=e.substring(0,e.length-1));var r=e.split(".");if(o.require_tld){var i=r.pop();if(!r.length||!/^([a-z\u00a1-\uffff]{2,}|xn[a-z0-9-]{2,})$/i.test(i))return!1}for(var n,l=0;l1&&void 0!==arguments[1]?arguments[1]:"";if(t(e),!(o=String(o)))return h(e,4)||h(e,6);if("4"===o){if(!xt.test(e))return!1;return e.split(".").sort(function(t,e){return t-e})[3]<=255}if("6"===o){var r=e.split(":"),i=!1,n=h(r[r.length-1],4),l=n?7:8;if(r.length>l)return!1;if("::"===e)return!0;"::"===e.substr(0,2)?(r.shift(),r.shift(),i=!0):"::"===e.substr(e.length-2)&&(r.pop(),r.pop(),i=!0);for(var a=0;a0&&a=1:r.length===l}return!1}function p(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function g(t,e){for(var o=0;o=2083||/[\s<>]/.test(e))return!1;if(0===e.indexOf("mailto:"))return!1;o=s(o,yt);var r=void 0,i=void 0,n=void 0,l=void 0,a=void 0,u=void 0,c=void 0,f=void 0;if(c=e.split("#"),e=c.shift(),c=e.split("?"),e=c.shift(),c=e.split("://"),c.length>1){if(r=c.shift(),o.require_valid_protocol&&-1===o.protocols.indexOf(r))return!1}else{if(o.require_protocol)return!1;o.allow_protocol_relative_urls&&"//"===e.substr(0,2)&&(c[0]=e.substr(2))}if(e=c.join("://"),c=e.split("/"),""===(e=c.shift())&&!o.require_host)return!0;if(c=e.split("@"),c.length>1&&(i=c.shift(),i.indexOf(":")>=0&&i.split(":").length>2))return!1;l=c.join("@"),u=f=null;var p=l.match(wt);return p?(n="",f=p[1],u=p[2]||null):(c=l.split(":"),n=c.shift(),c.length&&(u=c.join(":"))),!(null!==u&&(a=parseInt(u,10),!/^[0-9]+$/.test(u)||a<=0||a>65535))&&(!!(h(n)||d(n,o)||f&&h(f,6)||"localhost"===n)&&(n=n||f,!(o.host_whitelist&&!g(n,o.host_whitelist))&&(!o.host_blacklist||!g(n,o.host_blacklist))))}function v(e){return t(e),bt.test(e)}function _(e){return t(e),["true","false","1","0"].indexOf(e)>=0}function F(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if(t(e),o in kt)return kt[o].test(e);throw new Error("Invalid locale '"+o+"'")}function $(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"en-US";if(t(e),o in St)return St[o].test(e);throw new Error("Invalid locale '"+o+"'")}function x(e){return t(e),Rt.test(e)}function A(e){return t(e),e===e.toLowerCase()}function y(e){return t(e),e===e.toUpperCase()}function w(e){return t(e),Ct.test(e)}function b(e){return t(e),jt.test(e)}function k(e){return t(e),Pt.test(e)}function S(e){return t(e),jt.test(e)&&Pt.test(e)}function D(e){return t(e),Ut.test(e)}function Z(e){return t(e),zt.test(e)}function E(e,o){t(e),o=o||{};var r=o.hasOwnProperty("allow_leading_zeroes")&&!o.allow_leading_zeroes?Lt:Nt,i=!o.hasOwnProperty("min")||e>=o.min,n=!o.hasOwnProperty("max")||e<=o.max,l=!o.hasOwnProperty("lt")||eo.gt;return r.test(e)&&i&&n&&l&&a}function I(e,o){return t(e),o=o||{},""!==e&&"."!==e&&(Bt.test(e)&&(!o.hasOwnProperty("min")||e>=o.min)&&(!o.hasOwnProperty("max")||e<=o.max)&&(!o.hasOwnProperty("lt")||eo.gt))}function O(e){return t(e),""!==e&&qt.test(e)}function R(e){return t(e),Tt.test(e)}function C(e,r){return t(e),o(e)%parseInt(r,10)==0}function j(e){return t(e),Ht.test(e)}function P(e){return t(e),Kt.test(e)}function U(e){return t(e),Mt.test(e)}function z(e){t(e);try{var o=JSON.parse(e);return!!o&&"object"===(void 0===o?"undefined":ht(o))}catch(t){}return!1}function L(e){return t(e),0===e.length}function N(e,o){t(e);var r=void 0,i=void 0;"object"===(void 0===o?"undefined":ht(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],l=e.length-n.length;return l>=r&&(void 0===i||l<=i)}function B(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"all";t(e);var r=Wt[o];return r&&r.test(e)}function q(e){return t(e),R(e)&&24===e.length}function T(o){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);t(o);var i=e(r),n=e(o);return!!(n&&i&&n>i)}function H(o){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:String(new Date);t(o);var i=e(r),n=e(o);return!!(n&&i&&n=0}return"object"===(void 0===o?"undefined":ht(o))?o.hasOwnProperty(e):!(!o||"function"!=typeof o.indexOf)&&o.indexOf(e)>=0}function M(e){t(e);var o=e.replace(/[^0-9]+/g,"");if(!Gt.test(o))return!1;for(var r=0,i=void 0,n=void 0,l=void 0,a=o.length-1;a>=0;a--)i=o.substring(a,a+1),n=parseInt(i,10),l?(n*=2,r+=n>=10?n%10+1:n):r+=n,l=!l;return!(r%10!=0||!o)}function W(e){if(t(e),!Yt.test(e))return!1;for(var o=e.replace(/[A-Z]/g,function(t){return parseInt(t,36)}),r=0,i=void 0,n=void 0,l=!0,a=o.length-2;a>=0;a--)i=o.substring(a,a+1),n=parseInt(i,10),l?(n*=2,r+=n>=10?n+1:n):r+=n,l=!l;return parseInt(e.substr(e.length-1),10)===(1e4-r)%10}function G(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(t(e),!(o=String(o)))return G(e,10)||G(e,13);var r=e.replace(/[\s-]+/g,""),i=0,n=void 0;if("10"===o){if(!Jt.test(r))return!1;for(n=0;n<9;n++)i+=(n+1)*r.charAt(n);if("X"===r.charAt(9)?i+=100:i+=10*r.charAt(9),i%11==0)return!!r}else if("13"===o){if(!Qt.test(r))return!1;for(n=0;n<12;n++)i+=Xt[n%2]*r.charAt(n);if(r.charAt(12)-(10-i%10)%10==0)return!!r}return!1}function Y(e){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t(e);var r=Vt;if(r=o.require_hyphen?r.replace("?",""):r,r=o.case_sensitive?new RegExp(r):new RegExp(r,"i"),!r.test(e))return!1;var i=e.replace("-",""),n=8,l=0,a=!0,u=!1,s=void 0;try{for(var c,d=i[Symbol.iterator]();!(a=(c=d.next()).done);a=!0){var f=c.value;l+=("X"===f.toUpperCase()?10:+f)*n,--n}}catch(t){u=!0,s=t}finally{try{!a&&d.return&&d.return()}finally{if(u)throw s}}return l%11==0}function J(e,o){return t(e),o in te&&te[o].test(e)}function Q(t){var e="(\\"+t.symbol.replace(/\./g,"\\.")+")"+(t.require_symbol?"":"?"),o="[1-9]\\d{0,2}(\\"+t.thousands_separator+"\\d{3})*",r=["0","[1-9]\\d*",o],i="("+r.join("|")+")?",n="(\\"+t.decimal_separator+"\\d{2})?",l=i+n;return t.allow_negatives&&!t.parens_for_negatives&&(t.negative_sign_after_digits?l+="-?":t.negative_sign_before_digits&&(l="-?"+l)),t.allow_negative_sign_placeholder?l="( (?!\\-))?"+l:t.allow_space_after_symbol?l=" ?"+l:t.allow_space_after_digits&&(l+="( (?!$))?"),t.symbol_after_digits?l+=e:l=e+l,t.allow_negatives&&(t.parens_for_negatives?l="(\\("+l+"\\)|"+l+")":t.negative_sign_before_digits||t.negative_sign_after_digits||(l="-?"+l)),new RegExp("^(?!-? )(?=.*\\d)"+l+"$")}function X(e,o){return t(e),o=s(o,ee),Q(o).test(e)}function V(e){return t(e),oe.test(e)}function tt(e){t(e);var o=e.length;if(!o||o%4!=0||re.test(e))return!1;var r=e.indexOf("=");return-1===r||r===o-1||r===o-2&&"="===e[o-1]}function et(e){return t(e),ie.test(e)}function ot(e,o){t(e);var r=o?new RegExp("^["+o+"]+","g"):/^\s+/g;return e.replace(r,"")}function rt(e,o){t(e);for(var r=o?new RegExp("["+o+"]"):/\s/,i=e.length-1;i>=0&&r.test(e[i]);)i--;return i/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")}function lt(e){return t(e),e.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/`/g,"`")}function at(e,o){return t(e),e.replace(new RegExp("["+o+"]+","g"),"")}function ut(e,o){return t(e),at(e,o?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F")}function st(e,o){return t(e),e.replace(new RegExp("[^"+o+"]+","g"),"")}function ct(e,o){t(e);for(var r=e.length-1;r>=0;r--)if(-1===o.indexOf(e[r]))return!1;return!0}function dt(t,e){if(e=s(e,ne),!f(t))return!1;var o=t.split("@"),r=o.pop(),i=o.join("@"),n=[i,r];if(n[1]=n[1].toLowerCase(),"gmail.com"===n[1]||"googlemail.com"===n[1]){if(e.gmail_remove_subaddress&&(n[0]=n[0].split("+")[0]),e.gmail_remove_dots&&(n[0]=n[0].replace(/\./g,"")),!n[0].length)return!1;(e.all_lowercase||e.gmail_lowercase)&&(n[0]=n[0].toLowerCase()),n[1]=e.gmail_convert_googlemaildotcom?"gmail.com":n[1]}else if(~le.indexOf(n[1])){if(e.icloud_remove_subaddress&&(n[0]=n[0].split("+")[0]),!n[0].length)return!1;(e.all_lowercase||e.icloud_lowercase)&&(n[0]=n[0].toLowerCase())}else if(~ae.indexOf(n[1])){if(e.outlookdotcom_remove_subaddress&&(n[0]=n[0].split("+")[0]),!n[0].length)return!1;(e.all_lowercase||e.outlookdotcom_lowercase)&&(n[0]=n[0].toLowerCase())}else if(~ue.indexOf(n[1])){if(e.yahoo_remove_subaddress){var l=n[0].split("-");n[0]=l.length>1?l.slice(0,-1).join("-"):l[0]}if(!n[0].length)return!1;(e.all_lowercase||e.yahoo_lowercase)&&(n[0]=n[0].toLowerCase())}else e.all_lowercase&&(n[0]=n[0].toLowerCase());return n.join("@")}for(var ft,ht="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pt=(function(){function t(t){this.value=t}function e(e){function o(t,e){return new Promise(function(o,i){var a={key:t,arg:e,resolve:o,reject:i,next:null};l?l=l.next=a:(n=l=a,r(t,e))})}function r(o,n){try{var l=e[o](n),a=l.value;a instanceof t?Promise.resolve(a.value).then(function(t){r("next",t)},function(t){r("throw",t)}):i(l.done?"return":"normal",l.value)}catch(t){i("throw",t)}}function i(t,e){switch(t){case"return":n.resolve({value:e,done:!0});break;case"throw":n.reject(e);break;default:n.resolve({value:e,done:!1})}n=n.next,n?r(n.key,n.arg):l=null}var n,l;this._invoke=o,"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(e.prototype[Symbol.asyncIterator]=function(){return this}),e.prototype.next=function(t){return this._invoke("next",t)},e.prototype.throw=function(t){return this._invoke("throw",t)},e.prototype.return=function(t){return this._invoke("return",t)}}(),{require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1}),gt={allow_display_name:!1,require_display_name:!1,allow_utf8_local_part:!0,require_tld:!0},mt=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i,vt=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,_t=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,Ft=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,$t=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i,xt=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,At=/^[0-9A-F]{1,4}$/i,yt={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1},wt=/^\[([^\]]+)\](?::([0-9]+))?$/,bt=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,kt={"en-US":/^[A-Z]+$/i,"cs-CZ":/^[A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[A-ZÆØÅ]+$/i,"de-DE":/^[A-ZÄÖÜß]+$/i,"es-ES":/^[A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"nl-NL":/^[A-ZÉËÏÓÖÜ]+$/i,"hu-HU":/^[A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"pl-PL":/^[A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[А-ЯЁ]+$/i,"sr-RS@latin":/^[A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[А-ЯЂЈЉЊЋЏ]+$/i,"tr-TR":/^[A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[А-ЩЬЮЯЄIЇҐ]+$/i,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},St={"en-US":/^[0-9A-Z]+$/i,"cs-CZ":/^[0-9A-ZÁČĎÉĚÍŇÓŘŠŤÚŮÝŽ]+$/i,"da-DK":/^[0-9A-ZÆØÅ]$/i,"de-DE":/^[0-9A-ZÄÖÜß]+$/i,"es-ES":/^[0-9A-ZÁÉÍÑÓÚÜ]+$/i,"fr-FR":/^[0-9A-ZÀÂÆÇÉÈÊËÏÎÔŒÙÛÜŸ]+$/i,"hu-HU":/^[0-9A-ZÁÉÍÓÖŐÚÜŰ]+$/i,"nl-NL":/^[0-9A-ZÉËÏÓÖÜ]+$/i,"pl-PL":/^[0-9A-ZĄĆĘŚŁŃÓŻŹ]+$/i,"pt-PT":/^[0-9A-ZÃÁÀÂÇÉÊÍÕÓÔÚÜ]+$/i,"ru-RU":/^[0-9А-ЯЁ]+$/i,"sr-RS@latin":/^[0-9A-ZČĆŽŠĐ]+$/i,"sr-RS":/^[0-9А-ЯЂЈЉЊЋЏ]+$/i,"tr-TR":/^[0-9A-ZÇĞİıÖŞÜ]+$/i,"uk-UA":/^[0-9А-ЩЬЮЯЄIЇҐ]+$/i,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},Dt=["AU","GB","HK","IN","NZ","ZA","ZM"],Zt=0;Zt