From e15b7179a0f09dc86376fc429b8f63de139e0e53 Mon Sep 17 00:00:00 2001 From: IOAyman Date: Tue, 27 Sep 2016 17:36:23 +0100 Subject: [PATCH] Added ukranian locale requested in https://github.com/chriso/validator.js/issues/584 --- lib/alpha.js | 2 ++ src/lib/alpha.js | 2 ++ test/validators.js | 34 ++++++++++++++++++++++++++++++++++ validator.js | 2 ++ validator.min.js | 2 +- 5 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lib/alpha.js b/lib/alpha.js index 3344edb98..38a550086 100644 --- a/lib/alpha.js +++ b/lib/alpha.js @@ -17,6 +17,7 @@ var alpha = exports.alpha = { 'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i, 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, + 'uk-UA': /^[А-ЯЄIЇҐ]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ }; @@ -34,6 +35,7 @@ var alphanumeric = exports.alphanumeric = { '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ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ }; diff --git a/src/lib/alpha.js b/src/lib/alpha.js index e937bcd3b..5ac16b583 100644 --- a/src/lib/alpha.js +++ b/src/lib/alpha.js @@ -12,6 +12,7 @@ export const alpha = { 'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i, 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, + 'uk-UA': /^[А-ЯЄIЇҐ]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, }; @@ -29,6 +30,7 @@ export const alphanumeric = { '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ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/, }; diff --git a/test/validators.js b/test/validators.js index f3c37a6ed..319088bf7 100644 --- a/test/validators.js +++ b/test/validators.js @@ -776,6 +776,25 @@ describe('Validators', function () { }); }); + it('should validate ukranian alpha strings', function () { + test({ + validator: 'isAlpha', + args: ['uk-UA'], + valid: [ + 'ЯЄIЇҐ', + ], + invalid: [ + '0AİıÖöÇ窺ĞğÜüZ1', + ' AİıÖöÇ窺ĞğÜüZ ', + 'abc1', + ' foo ', + '', + 'ÄBC', + 'Heiß', + ], + }); + }); + it('should validate alphanumeric strings', function () { test({ validator: 'isAlphanumeric', @@ -956,6 +975,21 @@ describe('Validators', function () { }); }); + it('should validate urkrainian alphanumeric strings', function () { + test({ + validator: 'isAlphanumeric', + args: ['uk-UA'], + valid: [ + 'ЯЄIЇҐ123', + ], + invalid: [ + 'éeoc ', + 'foo!!', + 'ÄBC', + ], + }); + }); + it('should error on invalid locale', function () { try { validator.isAlphanumeric('abc123', 'in-INVALID'); diff --git a/validator.js b/validator.js index d55dfd6f3..1bd17d6b1 100644 --- a/validator.js +++ b/validator.js @@ -434,6 +434,7 @@ 'sr-RS@latin': /^[A-ZČĆŽŠĐ]+$/i, 'sr-RS': /^[А-ЯЂЈЉЊЋЏ]+$/i, 'tr-TR': /^[A-ZÇĞİıÖŞÜ]+$/i, + 'uk-UA': /^[А-ЯЄIЇҐ]+$/i, ar: /^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ }; @@ -451,6 +452,7 @@ '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ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/ }; diff --git a/validator.min.js b/validator.min.js index b6dfe9776..bc1a5f5e8 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(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.validator=t()}(this,function(){"use strict";function e(e){if("string"!=typeof e)throw new TypeError("This library (validator.js) validates strings only")}function t(t){return e(t),t=Date.parse(t),isNaN(t)?null:new Date(t)}function o(t){return e(t),parseFloat(t)}function r(t,o){return e(t),parseInt(t,o||10)}function i(t,o){return e(t),o?"1"===t||"true"===t:"0"!==t&&"false"!==t&&""!==t}function n(t,o){return e(t),t===o}function l(e){return"object"===("undefined"==typeof e?"undefined":ge(e))&&null!==e?e="function"==typeof e.toString?e.toString():"[object Object]":(null===e||"undefined"==typeof e||isNaN(e)&&!e.length)&&(e=""),String(e)}function a(t,o){return e(t),t.indexOf(l(o))>=0}function u(t,o,r){return e(t),"[object RegExp]"!==Object.prototype.toString.call(o)&&(o=new RegExp(o,r)),o.test(t)}function s(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];for(var o in t)"undefined"==typeof e[o]&&(e[o]=t[o]);return e}function f(t,o){e(t);var r=void 0,i=void 0;"object"===("undefined"==typeof o?"undefined":ge(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=encodeURI(t).split(/%..|./).length-1;return n>=r&&("undefined"==typeof i||n<=i)}function c(t,o){e(t),o=s(o,pe),o.allow_trailing_dot&&"."===t[t.length-1]&&(t=t.substring(0,t.length-1));var r=t.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;la)return!1;if("::"===t)return!0;"::"===t.substr(0,2)?(i.shift(),i.shift(),n=!0):"::"===t.substr(t.length-2)&&(i.pop(),i.pop(),n=!0);for(var u=0;u0&&u=1:i.length===a}return!1}function p(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function m(e,t){for(var o=0;o=2083||/\s/.test(t))return!1;if(0===t.indexOf("mailto:"))return!1;o=s(o,we);var r=void 0,i=void 0,n=void 0,l=void 0,a=void 0,u=void 0,f=void 0,d=void 0;if(f=t.split("#"),t=f.shift(),f=t.split("?"),t=f.shift(),f=t.split("://"),f.length>1){if(r=f.shift(),o.require_valid_protocol&&o.protocols.indexOf(r)===-1)return!1}else{if(o.require_protocol)return!1;o.allow_protocol_relative_urls&&"//"===t.substr(0,2)&&(f[0]=t.substr(2))}if(t=f.join("://"),f=t.split("/"),t=f.shift(),""===t&&!o.require_host)return!0;if(f=t.split("@"),f.length>1&&(i=f.shift(),i.indexOf(":")>=0&&i.split(":").length>2))return!1;l=f.join("@"),u=d=null;var p=l.match(be);return p?(n="",d=p[1],u=p[2]||null):(f=l.split(":"),n=f.shift(),f.length&&(u=f.join(":"))),!(null!==u&&(a=parseInt(u,10),!/^[0-9]+$/.test(u)||a<=0||a>65535))&&(!!(g(n)||c(n,o)||d&&g(d,6)||"localhost"===n)&&(n=n||d,!(o.host_whitelist&&!m(n,o.host_whitelist))&&(!o.host_blacklist||!m(n,o.host_blacklist))))}function _(t){return e(t),ye.test(t)}function v(t){return e(t),["true","false","1","0"].indexOf(t)>=0}function F(t){var o=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),o in ke)return ke[o].test(t);throw new Error("Invalid locale '"+o+"'")}function $(t){var o=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),o in De)return De[o].test(t);throw new Error("Invalid locale '"+o+"'")}function x(t){return e(t),Ie.test(t)}function A(t){return e(t),t===t.toLowerCase()}function w(t){return e(t),t===t.toUpperCase()}function b(t){return e(t),Re.test(t)}function y(t){return e(t),je.test(t)}function k(t){return e(t),ze.test(t)}function D(t){return e(t),je.test(t)&&ze.test(t)}function S(t){return e(t),Ne.test(t)}function E(t){return e(t),Ue.test(t)}function Z(t,o){e(t),o=o||{};var r=o.hasOwnProperty("allow_leading_zeroes")&&!o.allow_leading_zeroes?Be:Le,i=!o.hasOwnProperty("min")||t>=o.min,n=!o.hasOwnProperty("max")||t<=o.max;return r.test(t)&&i&&n}function O(t,o){return e(t),o=o||{},""!==t&&"."!==t&&(Pe.test(t)&&(!o.hasOwnProperty("min")||t>=o.min)&&(!o.hasOwnProperty("max")||t<=o.max))}function C(t){return e(t),""!==t&&qe.test(t)}function I(t){return e(t),Te.test(t)}function R(t,r){return e(t),o(t)%parseInt(r,10)===0}function j(t){return e(t),Me.test(t)}function z(t){return e(t),He.test(t)}function N(t){e(t);try{var o=JSON.parse(t);return!!o&&"object"===("undefined"==typeof o?"undefined":ge(o))}catch(e){}return!1}function U(t){return e(t),0===t.length}function B(t,o){e(t);var r=void 0,i=void 0;"object"===("undefined"==typeof o?"undefined":ge(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=t.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],l=t.length-n.length;return l>=r&&("undefined"==typeof i||l<=i)}function L(t){var o=arguments.length<=1||void 0===arguments[1]?"all":arguments[1];e(t);var r=We[o];return r&&r.test(t)}function P(t){return e(t),I(t)&&24===t.length}function q(t){return e(t),Ye.test(t)}function T(e){var t=e.match(Ye),o=void 0,r=void 0,i=void 0,n=void 0;if(t){if(o=t[21],!o)return t[12]?null:0;if("z"===o||"Z"===o)return 0;r=t[22],o.indexOf(":")!==-1?(i=parseInt(t[23],10),n=parseInt(t[24],10)):(i=0,n=parseInt(t[23],10))}else{if(e=e.toLowerCase(),o=e.match(/(?:\s|gmt\s*)(-|\+)(\d{1,4})(\s|$)/),!o)return e.indexOf("gmt")!==-1?0:null;r=o[1];var l=o[2];3===l.length&&(l="0"+l),l.length<=2?(i=0,n=parseInt(l,10)):(i=parseInt(l.slice(0,2),10),n=parseInt(l.slice(2,4),10))}return(60*i+n)*("-"===r?1:-1)}function M(t){e(t);var o=new Date(Date.parse(t));if(isNaN(o))return!1;var r=T(t);if(null!==r){var i=o.getTimezoneOffset()-r;o=new Date(o.getTime()+6e4*i)}var n=String(o.getDate()),l=void 0,a=void 0,u=void 0;return!(a=t.match(/(^|[^:\d])[23]\d([^T:\d]|$)/g))||(l=a.map(function(e){return e.match(/\d+/g)[0]}).join("/"),u=String(o.getFullYear()).slice(-2),l===n||l===u||(l===""+n/u||l===""+u/n))}function H(o){var r=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(o);var i=t(r),n=t(o);return!!(n&&i&&n>i)}function W(o){var r=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(o);var i=t(r),n=t(o);return!!(n&&i&&n=0}return"object"===("undefined"==typeof o?"undefined":ge(o))?o.hasOwnProperty(t):!(!o||"function"!=typeof o.indexOf)&&o.indexOf(t)>=0}function G(t){e(t);var o=t.replace(/[^0-9]+/g,"");if(!Ge.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 J(t){if(e(t),!Je.test(t))return!1;for(var o=t.replace(/[A-Z]/g,function(e){return parseInt(e,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(t.substr(t.length-1),10)===(1e4-r)%10}function K(t){var o=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e(t),o=String(o),!o)return K(t,10)||K(t,13);var r=t.replace(/[\s-]+/g,""),i=0,n=void 0;if("10"===o){if(!Ke.test(r))return!1;for(n=0;n<9;n++)i+=(n+1)*r.charAt(n);if(i+="X"===r.charAt(9)?100:10*r.charAt(9),i%11===0)return!!r}else if("13"===o){if(!Qe.test(r))return!1;for(n=0;n<12;n++)i+=Ve[n%2]*r.charAt(n);if(r.charAt(12)-(10-i%10)%10===0)return!!r}return!1}function Q(t,o){return e(t),o in Xe&&Xe[o].test(t)}function V(e){var t="(\\"+e.symbol.replace(/\./g,"\\.")+")"+(e.require_symbol?"":"?"),o="-?",r="[1-9]\\d*",i="[1-9]\\d{0,2}(\\"+e.thousands_separator+"\\d{3})*",n=["0",r,i],l="("+n.join("|")+")?",a="(\\"+e.decimal_separator+"\\d{2})?",u=l+a;return e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?u+=o:e.negative_sign_before_digits&&(u=o+u)),e.allow_negative_sign_placeholder?u="( (?!\\-))?"+u:e.allow_space_after_symbol?u=" ?"+u:e.allow_space_after_digits&&(u+="( (?!$))?"),e.symbol_after_digits?u+=t:u=t+u,e.allow_negatives&&(e.parens_for_negatives?u="(\\("+u+"\\)|"+u+")":e.negative_sign_before_digits||e.negative_sign_after_digits||(u=o+u)),new RegExp("^(?!-? )(?=.*\\d)"+u+"$")}function X(t,o){return e(t),o=s(o,et),V(o).test(t)}function ee(t){e(t);var o=t.length;if(!o||o%4!==0||tt.test(t))return!1;var r=t.indexOf("=");return r===-1||r===o-1||r===o-2&&"="===t[o-1]}function te(t){return e(t),ot.test(t)}function oe(t,o){e(t);var r=o?new RegExp("^["+o+"]+","g"):/^\s+/g;return t.replace(r,"")}function re(t,o){e(t);for(var r=o?new RegExp("["+o+"]"):/\s/,i=t.length-1;i>=0&&r.test(t[i]);)i--;return i/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")}function le(t){return e(t),t.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/`/g,"`")}function ae(t,o){return e(t),t.replace(new RegExp("["+o+"]+","g"),"")}function ue(t,o){e(t);var r=o?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F";return ae(t,r)}function se(t,o){return e(t),t.replace(new RegExp("[^"+o+"]+","g"),"")}function fe(t,o){e(t);for(var r=t.length-1;r>=0;r--)if(o.indexOf(t[r])===-1)return!1;return!0}function ce(e,t){if(t=s(t,rt),!d(e))return!1;var o=e.split("@",2);if(o[1]=o[1].toLowerCase(),"gmail.com"===o[1]||"googlemail.com"===o[1]){if(t.gmail_remove_subaddress&&(o[0]=o[0].split("+")[0]),t.gmail_remove_dots&&(o[0]=o[0].replace(/\./g,"")),!o[0].length)return!1;(t.all_lowercase||t.gmail_lowercase)&&(o[0]=o[0].toLowerCase()),o[1]=t.gmail_convert_googlemaildotcom?"gmail.com":o[1]}else if(~it.indexOf(o[1])){if(t.icloud_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(t.all_lowercase||t.icloud_lowercase)&&(o[0]=o[0].toLowerCase())}else if(~nt.indexOf(o[1])){if(t.outlookdotcom_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(t.all_lowercase||t.outlookdotcom_lowercase)&&(o[0]=o[0].toLowerCase())}else if(~lt.indexOf(o[1])){if(t.yahoo_remove_subaddress){var r=o[0].split("-");o[0]=r.length>1?r.slice(0,-1).join("-"):r[0]}if(!o[0].length)return!1;(t.all_lowercase||t.yahoo_lowercase)&&(o[0]=o[0].toLowerCase())}else t.all_lowercase&&(o[0]=o[0].toLowerCase());return o.join("@")}for(var de,ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},pe={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1},me={allow_display_name:!1,allow_utf8_local_part:!0,require_tld:!0},he=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i,_e=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,ve=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,Fe=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,$e=/^([\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,xe=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,Ae=/^[0-9A-F]{1,4}$/i,we={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},be=/^\[([^\]]+)\](?::([0-9]+))?$/,ye=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,ke={"en-US":/^[A-Z]+$/i,"cs-CZ":/^[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,ar:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},De={"en-US":/^[0-9A-Z]+$/i,"cs-CZ":/^[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,ar:/^[٠١٢٣٤٥٦٧٨٩0-9ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},Se=["AU","GB","HK","IN","NZ","ZA","ZM"],Ee=0;Ee=0}function u(t,o,r){return e(t),"[object RegExp]"!==Object.prototype.toString.call(o)&&(o=new RegExp(o,r)),o.test(t)}function s(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],t=arguments[1];for(var o in t)"undefined"==typeof e[o]&&(e[o]=t[o]);return e}function f(t,o){e(t);var r=void 0,i=void 0;"object"===("undefined"==typeof o?"undefined":ge(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=encodeURI(t).split(/%..|./).length-1;return n>=r&&("undefined"==typeof i||n<=i)}function c(t,o){e(t),o=s(o,pe),o.allow_trailing_dot&&"."===t[t.length-1]&&(t=t.substring(0,t.length-1));var r=t.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;la)return!1;if("::"===t)return!0;"::"===t.substr(0,2)?(i.shift(),i.shift(),n=!0):"::"===t.substr(t.length-2)&&(i.pop(),i.pop(),n=!0);for(var u=0;u0&&u=1:i.length===a}return!1}function p(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function m(e,t){for(var o=0;o=2083||/\s/.test(t))return!1;if(0===t.indexOf("mailto:"))return!1;o=s(o,we);var r=void 0,i=void 0,n=void 0,l=void 0,a=void 0,u=void 0,f=void 0,d=void 0;if(f=t.split("#"),t=f.shift(),f=t.split("?"),t=f.shift(),f=t.split("://"),f.length>1){if(r=f.shift(),o.require_valid_protocol&&o.protocols.indexOf(r)===-1)return!1}else{if(o.require_protocol)return!1;o.allow_protocol_relative_urls&&"//"===t.substr(0,2)&&(f[0]=t.substr(2))}if(t=f.join("://"),f=t.split("/"),t=f.shift(),""===t&&!o.require_host)return!0;if(f=t.split("@"),f.length>1&&(i=f.shift(),i.indexOf(":")>=0&&i.split(":").length>2))return!1;l=f.join("@"),u=d=null;var p=l.match(be);return p?(n="",d=p[1],u=p[2]||null):(f=l.split(":"),n=f.shift(),f.length&&(u=f.join(":"))),!(null!==u&&(a=parseInt(u,10),!/^[0-9]+$/.test(u)||a<=0||a>65535))&&(!!(g(n)||c(n,o)||d&&g(d,6)||"localhost"===n)&&(n=n||d,!(o.host_whitelist&&!m(n,o.host_whitelist))&&(!o.host_blacklist||!m(n,o.host_blacklist))))}function _(t){return e(t),ye.test(t)}function v(t){return e(t),["true","false","1","0"].indexOf(t)>=0}function F(t){var o=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),o in ke)return ke[o].test(t);throw new Error("Invalid locale '"+o+"'")}function $(t){var o=arguments.length<=1||void 0===arguments[1]?"en-US":arguments[1];if(e(t),o in De)return De[o].test(t);throw new Error("Invalid locale '"+o+"'")}function x(t){return e(t),Ce.test(t)}function A(t){return e(t),t===t.toLowerCase()}function w(t){return e(t),t===t.toUpperCase()}function b(t){return e(t),Re.test(t)}function y(t){return e(t),je.test(t)}function k(t){return e(t),ze.test(t)}function D(t){return e(t),je.test(t)&&ze.test(t)}function S(t){return e(t),Ue.test(t)}function E(t){return e(t),Ne.test(t)}function Z(t,o){e(t),o=o||{};var r=o.hasOwnProperty("allow_leading_zeroes")&&!o.allow_leading_zeroes?Be:Le,i=!o.hasOwnProperty("min")||t>=o.min,n=!o.hasOwnProperty("max")||t<=o.max;return r.test(t)&&i&&n}function I(t,o){return e(t),o=o||{},""!==t&&"."!==t&&(Pe.test(t)&&(!o.hasOwnProperty("min")||t>=o.min)&&(!o.hasOwnProperty("max")||t<=o.max))}function O(t){return e(t),""!==t&&qe.test(t)}function C(t){return e(t),Te.test(t)}function R(t,r){return e(t),o(t)%parseInt(r,10)===0}function j(t){return e(t),Me.test(t)}function z(t){return e(t),He.test(t)}function U(t){e(t);try{var o=JSON.parse(t);return!!o&&"object"===("undefined"==typeof o?"undefined":ge(o))}catch(e){}return!1}function N(t){return e(t),0===t.length}function B(t,o){e(t);var r=void 0,i=void 0;"object"===("undefined"==typeof o?"undefined":ge(o))?(r=o.min||0,i=o.max):(r=arguments[1],i=arguments[2]);var n=t.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g)||[],l=t.length-n.length;return l>=r&&("undefined"==typeof i||l<=i)}function L(t){var o=arguments.length<=1||void 0===arguments[1]?"all":arguments[1];e(t);var r=We[o];return r&&r.test(t)}function P(t){return e(t),C(t)&&24===t.length}function q(t){return e(t),Ye.test(t)}function T(e){var t=e.match(Ye),o=void 0,r=void 0,i=void 0,n=void 0;if(t){if(o=t[21],!o)return t[12]?null:0;if("z"===o||"Z"===o)return 0;r=t[22],o.indexOf(":")!==-1?(i=parseInt(t[23],10),n=parseInt(t[24],10)):(i=0,n=parseInt(t[23],10))}else{if(e=e.toLowerCase(),o=e.match(/(?:\s|gmt\s*)(-|\+)(\d{1,4})(\s|$)/),!o)return e.indexOf("gmt")!==-1?0:null;r=o[1];var l=o[2];3===l.length&&(l="0"+l),l.length<=2?(i=0,n=parseInt(l,10)):(i=parseInt(l.slice(0,2),10),n=parseInt(l.slice(2,4),10))}return(60*i+n)*("-"===r?1:-1)}function M(t){e(t);var o=new Date(Date.parse(t));if(isNaN(o))return!1;var r=T(t);if(null!==r){var i=o.getTimezoneOffset()-r;o=new Date(o.getTime()+6e4*i)}var n=String(o.getDate()),l=void 0,a=void 0,u=void 0;return!(a=t.match(/(^|[^:\d])[23]\d([^T:\d]|$)/g))||(l=a.map(function(e){return e.match(/\d+/g)[0]}).join("/"),u=String(o.getFullYear()).slice(-2),l===n||l===u||(l===""+n/u||l===""+u/n))}function H(o){var r=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(o);var i=t(r),n=t(o);return!!(n&&i&&n>i)}function W(o){var r=arguments.length<=1||void 0===arguments[1]?String(new Date):arguments[1];e(o);var i=t(r),n=t(o);return!!(n&&i&&n=0}return"object"===("undefined"==typeof o?"undefined":ge(o))?o.hasOwnProperty(t):!(!o||"function"!=typeof o.indexOf)&&o.indexOf(t)>=0}function G(t){e(t);var o=t.replace(/[^0-9]+/g,"");if(!Ge.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 J(t){if(e(t),!Je.test(t))return!1;for(var o=t.replace(/[A-Z]/g,function(e){return parseInt(e,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(t.substr(t.length-1),10)===(1e4-r)%10}function K(t){var o=arguments.length<=1||void 0===arguments[1]?"":arguments[1];if(e(t),o=String(o),!o)return K(t,10)||K(t,13);var r=t.replace(/[\s-]+/g,""),i=0,n=void 0;if("10"===o){if(!Ke.test(r))return!1;for(n=0;n<9;n++)i+=(n+1)*r.charAt(n);if(i+="X"===r.charAt(9)?100:10*r.charAt(9),i%11===0)return!!r}else if("13"===o){if(!Qe.test(r))return!1;for(n=0;n<12;n++)i+=Ve[n%2]*r.charAt(n);if(r.charAt(12)-(10-i%10)%10===0)return!!r}return!1}function Q(t,o){return e(t),o in Xe&&Xe[o].test(t)}function V(e){var t="(\\"+e.symbol.replace(/\./g,"\\.")+")"+(e.require_symbol?"":"?"),o="-?",r="[1-9]\\d*",i="[1-9]\\d{0,2}(\\"+e.thousands_separator+"\\d{3})*",n=["0",r,i],l="("+n.join("|")+")?",a="(\\"+e.decimal_separator+"\\d{2})?",u=l+a;return e.allow_negatives&&!e.parens_for_negatives&&(e.negative_sign_after_digits?u+=o:e.negative_sign_before_digits&&(u=o+u)),e.allow_negative_sign_placeholder?u="( (?!\\-))?"+u:e.allow_space_after_symbol?u=" ?"+u:e.allow_space_after_digits&&(u+="( (?!$))?"),e.symbol_after_digits?u+=t:u=t+u,e.allow_negatives&&(e.parens_for_negatives?u="(\\("+u+"\\)|"+u+")":e.negative_sign_before_digits||e.negative_sign_after_digits||(u=o+u)),new RegExp("^(?!-? )(?=.*\\d)"+u+"$")}function X(t,o){return e(t),o=s(o,et),V(o).test(t)}function ee(t){e(t);var o=t.length;if(!o||o%4!==0||tt.test(t))return!1;var r=t.indexOf("=");return r===-1||r===o-1||r===o-2&&"="===t[o-1]}function te(t){return e(t),ot.test(t)}function oe(t,o){e(t);var r=o?new RegExp("^["+o+"]+","g"):/^\s+/g;return t.replace(r,"")}function re(t,o){e(t);for(var r=o?new RegExp("["+o+"]"):/\s/,i=t.length-1;i>=0&&r.test(t[i]);)i--;return i/g,">").replace(/\//g,"/").replace(/\\/g,"\").replace(/`/g,"`")}function le(t){return e(t),t.replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">").replace(///g,"/").replace(/`/g,"`")}function ae(t,o){return e(t),t.replace(new RegExp("["+o+"]+","g"),"")}function ue(t,o){e(t);var r=o?"\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F":"\\x00-\\x1F\\x7F";return ae(t,r)}function se(t,o){return e(t),t.replace(new RegExp("[^"+o+"]+","g"),"")}function fe(t,o){e(t);for(var r=t.length-1;r>=0;r--)if(o.indexOf(t[r])===-1)return!1;return!0}function ce(e,t){if(t=s(t,rt),!d(e))return!1;var o=e.split("@",2);if(o[1]=o[1].toLowerCase(),"gmail.com"===o[1]||"googlemail.com"===o[1]){if(t.gmail_remove_subaddress&&(o[0]=o[0].split("+")[0]),t.gmail_remove_dots&&(o[0]=o[0].replace(/\./g,"")),!o[0].length)return!1;(t.all_lowercase||t.gmail_lowercase)&&(o[0]=o[0].toLowerCase()),o[1]=t.gmail_convert_googlemaildotcom?"gmail.com":o[1]}else if(~it.indexOf(o[1])){if(t.icloud_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(t.all_lowercase||t.icloud_lowercase)&&(o[0]=o[0].toLowerCase())}else if(~nt.indexOf(o[1])){if(t.outlookdotcom_remove_subaddress&&(o[0]=o[0].split("+")[0]),!o[0].length)return!1;(t.all_lowercase||t.outlookdotcom_lowercase)&&(o[0]=o[0].toLowerCase())}else if(~lt.indexOf(o[1])){if(t.yahoo_remove_subaddress){var r=o[0].split("-");o[0]=r.length>1?r.slice(0,-1).join("-"):r[0]}if(!o[0].length)return!1;(t.all_lowercase||t.yahoo_lowercase)&&(o[0]=o[0].toLowerCase())}else t.all_lowercase&&(o[0]=o[0].toLowerCase());return o.join("@")}for(var de,ge="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},pe={require_tld:!0,allow_underscores:!1,allow_trailing_dot:!1},me={allow_display_name:!1,allow_utf8_local_part:!0,require_tld:!0},he=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\.\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF\s]*<(.+)>$/i,_e=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i,ve=/^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i,Fe=/^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i,$e=/^([\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,xe=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/,Ae=/^[0-9A-F]{1,4}$/i,we={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},be=/^\[([^\]]+)\](?::([0-9]+))?$/,ye=/^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/,ke={"en-US":/^[A-Z]+$/i,"cs-CZ":/^[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:/^[ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},De={"en-US":/^[0-9A-Z]+$/i,"cs-CZ":/^[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ءآأؤإئابةتثجحخدذرزسشصضطظعغفقكلمنهوىيًٌٍَُِّْٰ]+$/},Se=["AU","GB","HK","IN","NZ","ZA","ZM"],Ee=0;Ee