Plugin Directory

Changeset 3158785


Ignore:
Timestamp:
09/27/2024 01:15:25 PM (18 months ago)
Author:
aliakro
Message:

Update to version 10.14 from GitHub

Location:
weight-loss-tracker
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • weight-loss-tracker/tags/10.14/assets/js/libraries/additional-methods.js

    r3151452 r3158785  
    11/*!
    2  * jQuery Validation Plugin v1.19.5
     2 * jQuery Validation Plugin v1.21.0
    33 *
    44 * https://jqueryvalidation.org/
    55 *
    6  * Copyright (c) 2022 Jörn Zaefferer
     6 * Copyright (c) 2024 Jörn Zaefferer
    77 * Released under the MIT license
    88 */
     
    14601460 */
    14611461$.validator.addMethod( "vinUS", function( v ) {
    1462     if ( v.length !== 17 ) {
    1463         return false;
    1464     }
    1465 
    1466     var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ],
    1467         VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ],
    1468         FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ],
    1469         rs = 0,
    1470         i, n, d, f, cd, cdv;
    1471 
    1472     for ( i = 0; i < 17; i++ ) {
    1473         f = FL[ i ];
    1474         d = v.slice( i, i + 1 );
    1475         if ( i === 8 ) {
    1476             cdv = d;
    1477         }
    1478         if ( !isNaN( d ) ) {
    1479             d *= f;
    1480         } else {
    1481             for ( n = 0; n < LL.length; n++ ) {
    1482                 if ( d.toUpperCase() === LL[ n ] ) {
    1483                     d = VL[ n ];
    1484                     d *= f;
    1485                     if ( isNaN( cdv ) && n === 8 ) {
    1486                         cdv = LL[ n ];
    1487                     }
    1488                     break;
    1489                 }
    1490             }
    1491         }
    1492         rs += d;
    1493     }
    1494     cd = rs % 11;
    1495     if ( cd === 10 ) {
    1496         cd = "X";
    1497     }
    1498     if ( cd === cdv ) {
    1499         return true;
    1500     }
    1501     return false;
     1462    if ( v.length !== 17 ) {
     1463        return false;
     1464    }
     1465
     1466    var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ],
     1467        VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ],
     1468        FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ],
     1469        rs = 0,
     1470        i, n, d, f, cd, cdv;
     1471
     1472    for ( i = 0; i < 17; i++ ) {
     1473        f = FL[ i ];
     1474        d = v.slice( i, i + 1 );
     1475        if ( isNaN( d ) ) {
     1476            d = d.toUpperCase();
     1477            n = VL[ LL.indexOf( d ) ];
     1478        } else {
     1479            n = parseInt( d, 10 );
     1480        }
     1481        if ( i === 8 )
     1482        {
     1483            cdv = n;
     1484            if ( d === "X" ) {
     1485                cdv = 10;
     1486            }
     1487        }
     1488        rs += n * f;
     1489    }
     1490    cd = rs % 11;
     1491    if ( cd === cdv ) {
     1492        return true;
     1493    }
     1494    return false;
    15021495}, "The specified vehicle identification number (VIN) is invalid." );
    15031496
  • weight-loss-tracker/tags/10.14/assets/js/libraries/additional-methods.min.js

    r3151452 r3158785  
    1 /*! jQuery Validation Plugin - v1.19.5 - 7/1/2022
     1/*! jQuery Validation Plugin - v1.21.0 - 7/17/2024
    22 * https://jqueryvalidation.org/
    3  * Copyright (c) 2022 Jörn Zaefferer; Licensed MIT */
    4 !function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("abaRoutingNumber",function(a){var b=0,c=a.split(""),d=c.length;if(9!==d)return!1;for(var e=0;e<d;e+=3)b+=3*parseInt(c[e],10)+7*parseInt(c[e+1],10)+parseInt(c[e+2],10);return 0!==b&&b%10===0},"Please enter a valid routing number."),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(g))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please."),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;c<h;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number."),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number."),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a.toUpperCase())},"Please specify a valid BIC code."),a.validator.addMethod("cifES",function(a,b){"use strict";function c(a){return a%2===0}if(this.optional(b))return!0;var d,e,f,g,h=new RegExp(/^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi),i=a.substring(0,1),j=a.substring(1,8),k=a.substring(8,9),l=0,m=0,n=0;if(9!==a.length||!h.test(a))return!1;for(d=0;d<j.length;d++)e=parseInt(j[d],10),c(d)?(e*=2,n+=e<10?e:e-9):m+=e;return l=m+n,f=(10-l.toString().substr(-1)).toString(),f=parseInt(f,10)>9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cnhBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f,g,h=0,i=0;if(b=a.charAt(0),new Array(12).join(b)===a)return!1;for(e=0,f=9,g=0;e<9;++e,--f)h+=+(a.charAt(e)*f);for(c=h%11,c>=10&&(c=0,i=2),h=0,e=0,f=1,g=0;e<9;++e,++f)h+=+(a.charAt(e)*f);return d=h%11,d>=10?d=0:d-=i,String(c).concat(d)===a.substr(-2)},"Please specify a valid CNH number."),a.validator.addMethod("cnpjBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/[^\d]+/g,""),14!==a.length)return!1;if("00000000000000"===a||"11111111111111"===a||"22222222222222"===a||"33333333333333"===a||"44444444444444"===a||"55555555555555"===a||"66666666666666"===a||"77777777777777"===a||"88888888888888"===a||"99999999999999"===a)return!1;for(var c=a.length-2,d=a.substring(0,c),e=a.substring(c),f=0,g=c-7,h=c;h>=1;h--)f+=d.charAt(c-h)*g--,g<2&&(g=9);var i=f%11<2?0:11-f%11;if(i!==parseInt(e.charAt(0),10))return!1;c+=1,d=a.substring(0,c),f=0,g=c-7;for(var j=c;j>=1;j--)f+=d.charAt(c-j)*g--,g<2&&(g=9);return i=f%11<2?0:11-f%11,i===parseInt(e.charAt(1),10)},"Please specify a CNPJ value number."),a.validator.addMethod("cpfBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var c,d,e,f,g=0;if(c=parseInt(a.substring(9,10),10),d=parseInt(a.substring(10,11),10),e=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(f=1;f<=9;f++)g+=parseInt(a.substring(f-1,f),10)*(11-f);if(e(g,c)){for(g=0,f=1;f<=10;f++)g+=parseInt(a.substring(f-1,f),10)*(12-f);return e(g,d)}return!1},"Please specify a valid CPF number."),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&(/^(5[12345])/.test(a)||/^(2[234567])/.test(a))?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency."),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number."),a.validator.addMethod("greaterThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThan-blur").length&&e.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",function(){a(c).valid()}),b>e.val()},"Please enter a greater value."),a.validator.addMethod("greaterThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThanEqual-blur").length&&e.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",function(){a(c).valid()}),b>=e.val()},"Please enter a greater value."),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.length<q)return!1;if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN."),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please."),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lessThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThan-blur").length&&e.addClass("validate-lessThan-blur").on("blur.validate-lessThan",function(){a(c).valid()}),b<e.val()},"Please enter a lesser value."),a.validator.addMethod("lessThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThanEqual-blur").length&&e.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",function(){a(c).valid()}),b<=e.val()},"Please enter a lesser value."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please."),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please."),a.validator.addMethod("maxfiles",function(b,c,d){return!!this.optional(c)||!("file"===a(c).attr("type")&&c.files&&c.files.length>d)},a.validator.format("Please select no more than {0} files.")),a.validator.addMethod("maxsize",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0;e<c.files.length;e++)if(c.files[e].size>d)return!1;return!0},a.validator.format("File size must not exceed {0} bytes each.")),a.validator.addMethod("maxsizetotal",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0,f=0;f<c.files.length;f++)if(e+=c.files[f].size,e>d)return!1;return!0},a.validator.format("Total size of all files must not exceed {0} bytes.")),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number."),a.validator.addMethod("mobileRU",function(a,b){var c=a.replace(/\(|\)|\s+|-/g,"");return this.optional(b)||c.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(c)},"Please specify a valid mobile number."),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number."),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("nisBR",function(a){var b,c,d,e,f,g=0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;for(c=parseInt(a.substring(10,11),10),b=parseInt(a.substring(0,10),10),e=2;e<12;e++)f=e,10===e&&(f=2),11===e&&(f=3),g+=b%10*f,b=parseInt(b/10,10);return d=g%11,d=d>1?11-d:0,c===d},"Please specify a valid NIS/PIS number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please."),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonePL",function(a,b){a=a.replace(/\s+/g,"");var c=/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/;return this.optional(b)||c.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number."),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number."),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode."),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state."),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters.")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59."),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format."),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c<h.length;c++)if(d.toUpperCase()===h[c]){d=i[c],d*=e,isNaN(g)&&8===c&&(g=h[c]);break}}else d*=e;k+=d}return f=k%11,10===f&&(f="X"),f===g},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid."),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx."),a});
     3 * Copyright (c) 2024 Jörn Zaefferer; Licensed MIT */
     4!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("abaRoutingNumber",function(a){var b=0,c=a.split(""),d=c.length;if(9!==d)return!1;for(var e=0;e<d;e+=3)b+=3*parseInt(c[e],10)+7*parseInt(c[e+1],10)+parseInt(c[e+2],10);return 0!==b&&b%10===0},"Please enter a valid routing number."),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(g))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please."),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;c<h;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number."),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number."),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a.toUpperCase())},"Please specify a valid BIC code."),a.validator.addMethod("cifES",function(a,b){"use strict";function c(a){return a%2===0}if(this.optional(b))return!0;var d,e,f,g,h=new RegExp(/^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi),i=a.substring(0,1),j=a.substring(1,8),k=a.substring(8,9),l=0,m=0,n=0;if(9!==a.length||!h.test(a))return!1;for(d=0;d<j.length;d++)e=parseInt(j[d],10),c(d)?(e*=2,n+=e<10?e:e-9):m+=e;return l=m+n,f=(10-l.toString().substr(-1)).toString(),f=parseInt(f,10)>9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cnhBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f,g,h=0,i=0;if(b=a.charAt(0),new Array(12).join(b)===a)return!1;for(e=0,f=9,g=0;e<9;++e,--f)h+=+(a.charAt(e)*f);for(c=h%11,c>=10&&(c=0,i=2),h=0,e=0,f=1,g=0;e<9;++e,++f)h+=+(a.charAt(e)*f);return d=h%11,d>=10?d=0:d-=i,String(c).concat(d)===a.substr(-2)},"Please specify a valid CNH number."),a.validator.addMethod("cnpjBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/[^\d]+/g,""),14!==a.length)return!1;if("00000000000000"===a||"11111111111111"===a||"22222222222222"===a||"33333333333333"===a||"44444444444444"===a||"55555555555555"===a||"66666666666666"===a||"77777777777777"===a||"88888888888888"===a||"99999999999999"===a)return!1;for(var c=a.length-2,d=a.substring(0,c),e=a.substring(c),f=0,g=c-7,h=c;h>=1;h--)f+=d.charAt(c-h)*g--,g<2&&(g=9);var i=f%11<2?0:11-f%11;if(i!==parseInt(e.charAt(0),10))return!1;c+=1,d=a.substring(0,c),f=0,g=c-7;for(var j=c;j>=1;j--)f+=d.charAt(c-j)*g--,g<2&&(g=9);return i=f%11<2?0:11-f%11,i===parseInt(e.charAt(1),10)},"Please specify a CNPJ value number."),a.validator.addMethod("cpfBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var c,d,e,f,g=0;if(c=parseInt(a.substring(9,10),10),d=parseInt(a.substring(10,11),10),e=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(f=1;f<=9;f++)g+=parseInt(a.substring(f-1,f),10)*(11-f);if(e(g,c)){for(g=0,f=1;f<=10;f++)g+=parseInt(a.substring(f-1,f),10)*(12-f);return e(g,d)}return!1},"Please specify a valid CPF number."),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&(/^(5[12345])/.test(a)||/^(2[234567])/.test(a))?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency."),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number."),a.validator.addMethod("greaterThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThan-blur").length&&e.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",function(){a(c).valid()}),b>e.val()},"Please enter a greater value."),a.validator.addMethod("greaterThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThanEqual-blur").length&&e.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",function(){a(c).valid()}),b>=e.val()},"Please enter a greater value."),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.length<q)return!1;if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN."),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please."),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lessThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThan-blur").length&&e.addClass("validate-lessThan-blur").on("blur.validate-lessThan",function(){a(c).valid()}),b<e.val()},"Please enter a lesser value."),a.validator.addMethod("lessThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThanEqual-blur").length&&e.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",function(){a(c).valid()}),b<=e.val()},"Please enter a lesser value."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please."),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please."),a.validator.addMethod("maxfiles",function(b,c,d){return!!this.optional(c)||!("file"===a(c).attr("type")&&c.files&&c.files.length>d)},a.validator.format("Please select no more than {0} files.")),a.validator.addMethod("maxsize",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0;e<c.files.length;e++)if(c.files[e].size>d)return!1;return!0},a.validator.format("File size must not exceed {0} bytes each.")),a.validator.addMethod("maxsizetotal",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0,f=0;f<c.files.length;f++)if(e+=c.files[f].size,e>d)return!1;return!0},a.validator.format("Total size of all files must not exceed {0} bytes.")),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number."),a.validator.addMethod("mobileRU",function(a,b){var c=a.replace(/\(|\)|\s+|-/g,"");return this.optional(b)||c.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(c)},"Please specify a valid mobile number."),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number."),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("nisBR",function(a){var b,c,d,e,f,g=0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;for(c=parseInt(a.substring(10,11),10),b=parseInt(a.substring(0,10),10),e=2;e<12;e++)f=e,10===e&&(f=2),11===e&&(f=3),g+=b%10*f,b=parseInt(b/10,10);return d=g%11,d=d>1?11-d:0,c===d},"Please specify a valid NIS/PIS number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please."),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonePL",function(a,b){a=a.replace(/\s+/g,"");var c=/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/;return this.optional(b)||c.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number."),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number."),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode."),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state."),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters.")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59."),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format."),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++)e=j[b],d=a.slice(b,b+1),isNaN(d)?(d=d.toUpperCase(),c=i[h.indexOf(d)]):c=parseInt(d,10),8===b&&(g=c,"X"===d&&(g=10)),k+=c*e;return f=k%11,f===g},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid."),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx."),a});
  • weight-loss-tracker/tags/10.14/assets/js/libraries/jquery.validate.js

    r3145588 r3158785  
    11/*!
    2  * jQuery Validation Plugin v1.13.1
     2 * jQuery Validation Plugin v1.21.0
    33 *
    4  * http://jqueryvalidation.org/
     4 * https://jqueryvalidation.org/
    55 *
    6  * Copyright (c) 2014 Jörn Zaefferer
     6 * Copyright (c) 2024 Jörn Zaefferer
    77 * Released under the MIT license
    88 */
     
    1010    if ( typeof define === "function" && define.amd ) {
    1111        define( ["jquery"], factory );
     12    } else if (typeof module === "object" && module.exports) {
     13        module.exports = factory( require( "jquery" ) );
    1214    } else {
    1315        factory( jQuery );
     
    1517}(function( $ ) {
    1618
    17 $.extend($.fn, {
    18     // http://jqueryvalidation.org/validate/
     19$.extend( $.fn, {
     20
     21    // https://jqueryvalidation.org/validate/
    1922    validate: function( options ) {
    2023
    21         // if nothing is selected, return nothing; can't chain anyway
     24        // If nothing is selected, return nothing; can't chain anyway
    2225        if ( !this.length ) {
    2326            if ( options && options.debug && window.console ) {
     
    2730        }
    2831
    29         // check if a validator for this form was already created
     32        // Check if a validator for this form was already created
    3033        var validator = $.data( this[ 0 ], "validator" );
    3134        if ( validator ) {
     
    4144        if ( validator.settings.onsubmit ) {
    4245
    43             this.validateDelegate( ":submit", "click", function( event ) {
    44                 if ( validator.settings.submitHandler ) {
    45                     validator.submitButton = event.target;
    46                 }
    47                 // allow suppressing validation by adding a cancel class to the submit button
    48                 if ( $( event.target ).hasClass( "cancel" ) ) {
     46            this.on( "click.validate", ":submit", function( event ) {
     47
     48                // Track the used submit button to properly handle scripted
     49                // submits later.
     50                validator.submitButton = event.currentTarget;
     51
     52                // Allow suppressing validation by adding a cancel class to the submit button
     53                if ( $( this ).hasClass( "cancel" ) ) {
    4954                    validator.cancelSubmit = true;
    5055                }
    5156
    52                 // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
    53                 if ( $( event.target ).attr( "formnovalidate" ) !== undefined ) {
     57                // Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
     58                if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
    5459                    validator.cancelSubmit = true;
    5560                }
    56             });
    57 
    58             // validate the form on submit
    59             this.submit( function( event ) {
     61            } );
     62
     63            // Validate the form on submit
     64            this.on( "submit.validate", function( event ) {
    6065                if ( validator.settings.debug ) {
    61                     // prevent form submit to be able to see console output
     66
     67                    // Prevent form submit to be able to see console output
    6268                    event.preventDefault();
    6369                }
     70
    6471                function handle() {
    6572                    var hidden, result;
    66                     if ( validator.settings.submitHandler ) {
    67                         if ( validator.submitButton ) {
    68                             // insert a hidden input as a replacement for the missing submit button
    69                             hidden = $( "<input type='hidden'/>" )
    70                                 .attr( "name", validator.submitButton.name )
    71                                 .val( $( validator.submitButton ).val() )
    72                                 .appendTo( validator.currentForm );
    73                         }
     73
     74                    // Insert a hidden input as a replacement for the missing submit button
     75                    // The hidden input is inserted in two cases:
     76                    //   - A user defined a `submitHandler`
     77                    //   - There was a pending request due to `remote` method and `stopRequest()`
     78                    //     was called to submit the form in case it's valid
     79                    if ( validator.submitButton && ( validator.settings.submitHandler || validator.formSubmitted ) ) {
     80                        hidden = $( "<input type='hidden'/>" )
     81                            .attr( "name", validator.submitButton.name )
     82                            .val( $( validator.submitButton ).val() )
     83                            .appendTo( validator.currentForm );
     84                    }
     85
     86                    if ( validator.settings.submitHandler && !validator.settings.debug ) {
    7487                        result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
    75                         if ( validator.submitButton ) {
    76                             // and clean up afterwards; thanks to no-block-scope, hidden can be referenced
     88                        if ( hidden ) {
     89
     90                            // And clean up afterwards; thanks to no-block-scope, hidden can be referenced
    7791                            hidden.remove();
    7892                        }
     
    8599                }
    86100
    87                 // prevent submit for invalid forms or custom submit handlers
     101                // Prevent submit for invalid forms or custom submit handlers
    88102                if ( validator.cancelSubmit ) {
    89103                    validator.cancelSubmit = false;
     
    100114                    return false;
    101115                }
    102             });
     116            } );
    103117        }
    104118
    105119        return validator;
    106120    },
    107     // http://jqueryvalidation.org/valid/
     121
     122    // https://jqueryvalidation.org/valid/
    108123    valid: function() {
    109         var valid, validator;
     124        var valid, validator, errorList;
    110125
    111126        if ( $( this[ 0 ] ).is( "form" ) ) {
    112127            valid = this.validate().form();
    113128        } else {
     129            errorList = [];
    114130            valid = true;
    115131            validator = $( this[ 0 ].form ).validate();
    116132            this.each( function() {
    117133                valid = validator.element( this ) && valid;
    118             });
     134                if ( !valid ) {
     135                    errorList = errorList.concat( validator.errorList );
     136                }
     137            } );
     138            validator.errorList = errorList;
    119139        }
    120140        return valid;
    121141    },
    122     // attributes: space separated list of attributes to retrieve and remove
    123     removeAttrs: function( attributes ) {
    124         var result = {},
    125             $element = this;
    126         $.each( attributes.split( /\s/ ), function( index, value ) {
    127             result[ value ] = $element.attr( value );
    128             $element.removeAttr( value );
    129         });
    130         return result;
    131     },
    132     // http://jqueryvalidation.org/rules/
     142
     143    // https://jqueryvalidation.org/rules/
    133144    rules: function( command, argument ) {
    134145        var element = this[ 0 ],
     146            isContentEditable = typeof this.attr( "contenteditable" ) !== "undefined" && this.attr( "contenteditable" ) !== "false",
    135147            settings, staticRules, existingRules, data, param, filtered;
     148
     149        // If nothing is selected, return empty object; can't chain anyway
     150        if ( element == null ) {
     151            return;
     152        }
     153
     154        if ( !element.form && isContentEditable ) {
     155            element.form = this.closest( "form" )[ 0 ];
     156            element.name = this.attr( "name" );
     157        }
     158
     159        if ( element.form == null ) {
     160            return;
     161        }
    136162
    137163        if ( command ) {
     
    142168            case "add":
    143169                $.extend( existingRules, $.validator.normalizeRule( argument ) );
    144                 // remove messages from rules, but allow them to be set separately
     170
     171                // Remove messages from rules, but allow them to be set separately
    145172                delete existingRules.messages;
    146173                staticRules[ element.name ] = existingRules;
     
    158185                    filtered[ method ] = existingRules[ method ];
    159186                    delete existingRules[ method ];
    160                     if ( method === "required" ) {
    161                         $( element ).removeAttr( "aria-required" );
    162                     }
    163                 });
     187                } );
    164188                return filtered;
    165189            }
     
    175199        ), element );
    176200
    177         // make sure required is at front
     201        // Make sure required is at front
    178202        if ( data.required ) {
    179203            param = data.required;
    180204            delete data.required;
    181205            data = $.extend( { required: param }, data );
    182             $( element ).attr( "aria-required", "true" );
    183         }
    184 
    185         // make sure remote is at back
     206        }
     207
     208        // Make sure remote is at back
    186209        if ( data.remote ) {
    187210            param = data.remote;
    188211            delete data.remote;
    189             data = $.extend( data, { remote: param });
     212            data = $.extend( data, { remote: param } );
    190213        }
    191214
    192215        return data;
    193216    }
    194 });
     217} );
     218
     219// JQuery trim is deprecated, provide a trim method based on String.prototype.trim
     220var trim = function( str ) {
     221
     222    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#Polyfill
     223    return str.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "" );
     224};
    195225
    196226// Custom selectors
    197 $.extend( $.expr[ ":" ], {
    198     // http://jqueryvalidation.org/blank-selector/
     227$.extend( $.expr.pseudos || $.expr[ ":" ], {        // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
     228
     229    // https://jqueryvalidation.org/blank-selector/
    199230    blank: function( a ) {
    200         return !$.trim( "" + $( a ).val() );
     231        return !trim( "" + $( a ).val() );
    201232    },
    202     // http://jqueryvalidation.org/filled-selector/
     233
     234    // https://jqueryvalidation.org/filled-selector/
    203235    filled: function( a ) {
    204         return !!$.trim( "" + $( a ).val() );
     236        var val = $( a ).val();
     237        return val !== null && !!trim( "" + val );
    205238    },
    206     // http://jqueryvalidation.org/unchecked-selector/
     239
     240    // https://jqueryvalidation.org/unchecked-selector/
    207241    unchecked: function( a ) {
    208242        return !$( a ).prop( "checked" );
    209243    }
    210 });
    211 
    212 // constructor for validator
     244} );
     245
     246// Constructor for validator
    213247$.validator = function( options, form ) {
    214248    this.settings = $.extend( true, {}, $.validator.defaults, options );
     
    217251};
    218252
    219 // http://jqueryvalidation.org/jQuery.validator.format/
     253// https://jqueryvalidation.org/jQuery.validator.format/
    220254$.validator.format = function( source, params ) {
    221255    if ( arguments.length === 1 ) {
     
    225259            return $.validator.format.apply( this, args );
    226260        };
     261    }
     262    if ( params === undefined ) {
     263        return source;
    227264    }
    228265    if ( arguments.length > 2 && params.constructor !== Array  ) {
     
    235272        source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
    236273            return n;
    237         });
    238     });
     274        } );
     275    } );
    239276    return source;
    240277};
     
    247284        rules: {},
    248285        errorClass: "error",
     286        pendingClass: "pending",
    249287        validClass: "valid",
    250288        errorElement: "label",
     
    256294        ignore: ":hidden",
    257295        ignoreTitle: false,
     296        customElements: [],
    258297        onfocusin: function( element ) {
    259298            this.lastActive = element;
     
    273312        },
    274313        onkeyup: function( element, event ) {
    275             if ( event.which === 9 && this.elementValue( element ) === "" ) {
     314
     315            // Avoid revalidate the field when pressing one of the following keys
     316            // Shift       => 16
     317            // Ctrl        => 17
     318            // Alt         => 18
     319            // Caps lock   => 20
     320            // End         => 35
     321            // Home        => 36
     322            // Left arrow  => 37
     323            // Up arrow    => 38
     324            // Right arrow => 39
     325            // Down arrow  => 40
     326            // Insert      => 45
     327            // Num lock    => 144
     328            // AltGr key   => 225
     329            var excludedKeys = [
     330                16, 17, 18, 20, 35, 36, 37,
     331                38, 39, 40, 45, 144, 225
     332            ];
     333
     334            if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
    276335                return;
    277             } else if ( element.name in this.submitted || element === this.lastElement ) {
     336            } else if ( element.name in this.submitted || element.name in this.invalid ) {
    278337                this.element( element );
    279338            }
    280339        },
    281340        onclick: function( element ) {
    282             // click on selects, radiobuttons and checkboxes
     341
     342            // Click on selects, radiobuttons and checkboxes
    283343            if ( element.name in this.submitted ) {
    284344                this.element( element );
    285345
    286             // or option elements, check parent select in that case
     346            // Or option elements, check parent select in that case
    287347            } else if ( element.parentNode.name in this.submitted ) {
    288348                this.element( element.parentNode );
     
    305365    },
    306366
    307     // http://jqueryvalidation.org/jQuery.validator.setDefaults/
     367    // https://jqueryvalidation.org/jQuery.validator.setDefaults/
    308368    setDefaults: function( settings ) {
    309369        $.extend( $.validator.defaults, settings );
     
    316376        url: "Please enter a valid URL.",
    317377        date: "Please enter a valid date.",
    318         dateISO: "Please enter a valid date ( ISO ).",
     378        dateISO: "Please enter a valid date (ISO).",
    319379        number: "Please enter a valid number.",
    320380        digits: "Please enter only digits.",
    321         creditcard: "Please enter a valid credit card number.",
    322381        equalTo: "Please enter the same value again.",
    323382        maxlength: $.validator.format( "Please enter no more than {0} characters." ),
     
    326385        range: $.validator.format( "Please enter a value between {0} and {1}." ),
    327386        max: $.validator.format( "Please enter a value less than or equal to {0}." ),
    328         min: $.validator.format( "Please enter a value greater than or equal to {0}." )
     387        min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
     388        step: $.validator.format( "Please enter a multiple of {0}." )
    329389    },
    330390
     
    344404            this.reset();
    345405
    346             var groups = ( this.groups = {} ),
     406            var currentForm = this.currentForm,
     407                groups = ( this.groups = {} ),
    347408                rules;
    348409            $.each( this.settings.groups, function( key, value ) {
     
    352413                $.each( value, function( index, name ) {
    353414                    groups[ name ] = key;
    354                 });
    355             });
     415                } );
     416            } );
    356417            rules = this.settings.rules;
    357418            $.each( rules, function( key, value ) {
    358419                rules[ key ] = $.validator.normalizeRule( value );
    359             });
     420            } );
    360421
    361422            function delegate( event ) {
    362                 var validator = $.data( this[ 0 ].form, "validator" ),
     423                var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
     424
     425                // Set form expando on contenteditable
     426                if ( !this.form && isContentEditable ) {
     427                    this.form = $( this ).closest( "form" )[ 0 ];
     428                    this.name = $( this ).attr( "name" );
     429                }
     430
     431                // Ignore the element if it belongs to another form. This will happen mainly
     432                // when setting the `form` attribute of an input to the id of another form.
     433                if ( currentForm !== this.form ) {
     434                    return;
     435                }
     436
     437                var validator = $.data( this.form, "validator" ),
    363438                    eventType = "on" + event.type.replace( /^validate/, "" ),
    364439                    settings = validator.settings;
    365                 if ( settings[ eventType ] && !this.is( settings.ignore ) ) {
    366                     settings[ eventType ].call( validator, this[ 0 ], event );
    367                 }
    368             }
     440                if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
     441                    settings[ eventType ].call( validator, this, event );
     442                }
     443            }
     444            var focusListeners = [ ":text", "[type='password']", "[type='file']", "select", "textarea", "[type='number']", "[type='search']",
     445                                "[type='tel']", "[type='url']", "[type='email']", "[type='datetime']", "[type='date']", "[type='month']",
     446                                "[type='week']", "[type='time']", "[type='datetime-local']", "[type='range']", "[type='color']",
     447                                "[type='radio']", "[type='checkbox']", "[contenteditable]", "[type='button']" ];
     448            var clickListeners = [ "select", "option", "[type='radio']", "[type='checkbox']" ];
    369449            $( this.currentForm )
    370                 .validateDelegate( ":text, [type='password'], [type='file'], select, textarea, " +
    371                     "[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
    372                     "[type='email'], [type='datetime'], [type='date'], [type='month'], " +
    373                     "[type='week'], [type='time'], [type='datetime-local'], " +
    374                     "[type='range'], [type='color'], [type='radio'], [type='checkbox']",
    375                     "focusin focusout keyup", delegate)
     450                .on( "focusin.validate focusout.validate keyup.validate", focusListeners.concat( this.settings.customElements ).join( ", " ), delegate )
     451
    376452                // Support: Chrome, oldIE
    377453                // "select" is provided as event.target when clicking a option
    378                 .validateDelegate("select, option, [type='radio'], [type='checkbox']", "click", delegate);
     454                .on( "click.validate", clickListeners.concat( this.settings.customElements ).join( ", " ), delegate );
    379455
    380456            if ( this.settings.invalidHandler ) {
    381                 $( this.currentForm ).bind( "invalid-form.validate", this.settings.invalidHandler );
    382             }
    383 
    384             // Add aria-required to any Static/Data/Class required fields before first validation
    385             // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html
    386             $( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" );
    387         },
    388 
    389         // http://jqueryvalidation.org/Validator.form/
     457                $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
     458            }
     459        },
     460
     461        // https://jqueryvalidation.org/Validator.form/
    390462        form: function() {
    391463            this.checkForm();
    392464            $.extend( this.submitted, this.errorMap );
    393             this.invalid = $.extend({}, this.errorMap );
     465            this.invalid = $.extend( {}, this.errorMap );
    394466            if ( !this.valid() ) {
    395                 $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
     467                $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
    396468            }
    397469            this.showErrors();
     
    407479        },
    408480
    409         // http://jqueryvalidation.org/Validator.element/
     481        // https://jqueryvalidation.org/Validator.element/
    410482        element: function( element ) {
    411483            var cleanElement = this.clean( element ),
    412484                checkElement = this.validationTargetFor( cleanElement ),
    413                 result = true;
    414 
    415             this.lastElement = checkElement;
     485                v = this,
     486                result = true,
     487                rs, group;
    416488
    417489            if ( checkElement === undefined ) {
     
    421493                this.currentElements = $( checkElement );
    422494
    423                 result = this.check( checkElement ) !== false;
    424                 if ( result ) {
    425                     delete this.invalid[ checkElement.name ];
     495                // If this element is grouped, then validate all group elements already
     496                // containing a value
     497                group = this.groups[ checkElement.name ];
     498                if ( group ) {
     499                    $.each( this.groups, function( name, testgroup ) {
     500                        if ( testgroup === group && name !== checkElement.name ) {
     501                            cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
     502                            if ( cleanElement && cleanElement.name in v.invalid ) {
     503                                v.currentElements.push( cleanElement );
     504                                result = v.check( cleanElement ) && result;
     505                            }
     506                        }
     507                    } );
     508                }
     509
     510                rs = this.check( checkElement ) !== false;
     511                result = result && rs;
     512                if ( rs ) {
     513                    this.invalid[ checkElement.name ] = false;
    426514                } else {
    427515                    this.invalid[ checkElement.name ] = true;
    428516                }
    429             }
    430             // Add aria-invalid status for screen readers
    431             $( element ).attr( "aria-invalid", !result );
    432 
    433             if ( !this.numberOfInvalids() ) {
    434                 // Hide error containers on last error
    435                 this.toHide = this.toHide.add( this.containers );
    436             }
    437             this.showErrors();
     517
     518                if ( !this.numberOfInvalids() ) {
     519
     520                    // Hide error containers on last error
     521                    this.toHide = this.toHide.add( this.containers );
     522                }
     523                this.showErrors();
     524
     525                // Add aria-invalid status for screen readers
     526                $( element ).attr( "aria-invalid", !rs );
     527            }
     528
    438529            return result;
    439530        },
    440531
    441         // http://jqueryvalidation.org/Validator.showErrors/
     532        // https://jqueryvalidation.org/Validator.showErrors/
    442533        showErrors: function( errors ) {
    443534            if ( errors ) {
    444                 // add items to error list and map
     535                var validator = this;
     536
     537                // Add items to error list and map
    445538                $.extend( this.errorMap, errors );
    446                 this.errorList = [];
    447                 for ( var name in errors ) {
    448                     this.errorList.push({
    449                         message: errors[ name ],
    450                         element: this.findByName( name )[ 0 ]
    451                     });
    452                 }
    453                 // remove items from success list
     539                this.errorList = $.map( this.errorMap, function( message, name ) {
     540                    return {
     541                        message: message,
     542                        element: validator.findByName( name )[ 0 ]
     543                    };
     544                } );
     545
     546                // Remove items from success list
    454547                this.successList = $.grep( this.successList, function( element ) {
    455548                    return !( element.name in errors );
    456                 });
     549                } );
    457550            }
    458551            if ( this.settings.showErrors ) {
     
    463556        },
    464557
    465         // http://jqueryvalidation.org/Validator.resetForm/
     558        // https://jqueryvalidation.org/Validator.resetForm/
    466559        resetForm: function() {
    467560            if ( $.fn.resetForm ) {
    468561                $( this.currentForm ).resetForm();
    469562            }
     563            this.invalid = {};
    470564            this.submitted = {};
    471             this.lastElement = null;
    472565            this.prepareForm();
    473566            this.hideErrors();
    474             this.elements()
     567            var elements = this.elements()
     568                .removeData( "previousValue" )
     569                .removeAttr( "aria-invalid" );
     570
     571            this.resetElements( elements );
     572        },
     573
     574        resetElements: function( elements ) {
     575            var i;
     576
     577            if ( this.settings.unhighlight ) {
     578                for ( i = 0; elements[ i ]; i++ ) {
     579                    this.settings.unhighlight.call( this, elements[ i ],
     580                        this.settings.errorClass, "" );
     581                    this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
     582                }
     583            } else {
     584                elements
    475585                    .removeClass( this.settings.errorClass )
    476                     .removeData( "previousValue" )
    477                     .removeAttr( "aria-invalid" );
     586                    .removeClass( this.settings.validClass );
     587            }
    478588        },
    479589
     
    487597                i;
    488598            for ( i in obj ) {
    489                 count++;
     599
     600                // This check allows counting elements with empty error
     601                // message as invalid elements
     602                if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
     603                    count++;
     604                }
    490605            }
    491606            return count;
     
    512627            if ( this.settings.focusInvalid ) {
    513628                try {
    514                     $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [])
     629                    $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
    515630                    .filter( ":visible" )
    516                     .focus()
    517                     // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
     631                    .trigger( "focus" )
     632
     633                    // Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
    518634                    .trigger( "focusin" );
    519635                } catch ( e ) {
    520                     // ignore IE throwing errors when focusing hidden elements
     636
     637                    // Ignore IE throwing errors when focusing hidden elements
    521638                }
    522639            }
     
    527644            return lastActive && $.grep( this.errorList, function( n ) {
    528645                return n.element.name === lastActive.name;
    529             }).length === 1 && lastActive;
     646            } ).length === 1 && lastActive;
    530647        },
    531648
    532649        elements: function() {
    533650            var validator = this,
    534                 rulesCache = {};
    535 
    536             // select all valid inputs inside the form (no submit or reset buttons)
     651                rulesCache = {},
     652                selectors = [ "input", "select", "textarea", "[contenteditable]" ];
     653
     654            // Select all valid inputs inside the form (no submit or reset buttons)
    537655            return $( this.currentForm )
    538             .find( "input, select, textarea" )
    539             .not( ":submit, :reset, :image, [disabled], [readonly]" )
     656            .find( selectors.concat( this.settings.customElements ).join( ", " ) )
     657            .not( ":submit, :reset, :image, :disabled" )
    540658            .not( this.settings.ignore )
    541659            .filter( function() {
    542                 if ( !this.name && validator.settings.debug && window.console ) {
     660                var name = this.name || $( this ).attr( "name" ); // For contenteditable
     661                var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
     662
     663                if ( !name && validator.settings.debug && window.console ) {
    543664                    console.error( "%o has no name assigned", this );
    544665                }
    545666
    546                 // select only the first element for each name, and only those with rules specified
    547                 if ( this.name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
     667                // Set form expando on contenteditable
     668                if ( isContentEditable ) {
     669                    this.form = $( this ).closest( "form" )[ 0 ];
     670                    this.name = name;
     671                }
     672
     673                // Ignore elements that belong to other/nested forms
     674                if ( this.form !== validator.currentForm ) {
    548675                    return false;
    549676                }
    550677
    551                 rulesCache[ this.name ] = true;
     678                // Select only the first element for each name, and only those with rules specified
     679                if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
     680                    return false;
     681                }
     682
     683                rulesCache[ name ] = true;
    552684                return true;
    553             });
     685            } );
    554686        },
    555687
     
    563695        },
    564696
    565         reset: function() {
     697        resetInternals: function() {
    566698            this.successList = [];
    567699            this.errorList = [];
     
    569701            this.toShow = $( [] );
    570702            this.toHide = $( [] );
     703        },
     704
     705        reset: function() {
     706            this.resetInternals();
    571707            this.currentElements = $( [] );
    572708        },
     
    583719
    584720        elementValue: function( element ) {
    585             var val,
    586                 $element = $( element ),
    587                 type = element.type;
     721            var $element = $( element ),
     722                type = element.type,
     723                isContentEditable = typeof $element.attr( "contenteditable" ) !== "undefined" && $element.attr( "contenteditable" ) !== "false",
     724                val, idx;
    588725
    589726            if ( type === "radio" || type === "checkbox" ) {
    590                 return $( "input[name='" + element.name + "']:checked" ).val();
     727                return this.findByName( element.name ).filter( ":checked" ).val();
    591728            } else if ( type === "number" && typeof element.validity !== "undefined" ) {
    592                 return element.validity.badInput ? false : $element.val();
    593             }
    594 
    595             val = $element.val();
     729                return element.validity.badInput ? "NaN" : $element.val();
     730            }
     731
     732            if ( isContentEditable ) {
     733                val = $element.text();
     734            } else {
     735                val = $element.val();
     736            }
     737
     738            if ( type === "file" ) {
     739
     740                // Modern browser (chrome & safari)
     741                if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
     742                    return val.substr( 12 );
     743                }
     744
     745                // Legacy browsers
     746                // Unix-based path
     747                idx = val.lastIndexOf( "/" );
     748                if ( idx >= 0 ) {
     749                    return val.substr( idx + 1 );
     750                }
     751
     752                // Windows-based path
     753                idx = val.lastIndexOf( "\\" );
     754                if ( idx >= 0 ) {
     755                    return val.substr( idx + 1 );
     756                }
     757
     758                // Just the file name
     759                return val;
     760            }
     761
    596762            if ( typeof val === "string" ) {
    597                 return val.replace(/\r/g, "" );
     763                return val.replace( /\r/g, "" );
    598764            }
    599765            return val;
     
    606772                rulesCount = $.map( rules, function( n, i ) {
    607773                    return i;
    608                 }).length,
     774                } ).length,
    609775                dependencyMismatch = false,
    610776                val = this.elementValue( element ),
    611                 result, method, rule;
     777                result, method, rule, normalizer;
     778
     779            // Abort any pending Ajax request from a previous call to this method.
     780            this.abortRequest( element );
     781
     782            // Prioritize the local normalizer defined for this element over the global one
     783            // if the former exists, otherwise user the global one in case it exists.
     784            if ( typeof rules.normalizer === "function" ) {
     785                normalizer = rules.normalizer;
     786            } else if ( typeof this.settings.normalizer === "function" ) {
     787                normalizer = this.settings.normalizer;
     788            }
     789
     790            // If normalizer is defined, then call it to retreive the changed value instead
     791            // of using the real one.
     792            // Note that `this` in the normalizer is `element`.
     793            if ( normalizer ) {
     794                val = normalizer.call( element, val );
     795
     796                // Delete the normalizer from rules to avoid treating it as a pre-defined method.
     797                delete rules.normalizer;
     798            }
    612799
    613800            for ( method in rules ) {
    614801                rule = { method: method, parameters: rules[ method ] };
    615802                try {
    616 
    617803                    result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
    618804
    619                     // if a method indicates that the field is optional and therefore valid,
     805                    // If a method indicates that the field is optional and therefore valid,
    620806                    // don't mark it as valid when there are no other rules
    621807                    if ( result === "dependency-mismatch" && rulesCount === 1 ) {
     
    638824                        console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
    639825                    }
     826                    if ( e instanceof TypeError ) {
     827                        e.message += ".  Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
     828                    }
     829
    640830                    throw e;
    641831                }
     
    650840        },
    651841
    652         // return the custom message for the given element and validation method
     842        // Return the custom message for the given element and validation method
    653843        // specified in the element's HTML5 data attribute
    654844        // return the generic message if present and no method specific message is present
     
    658848        },
    659849
    660         // return the custom message for the given element name and validation method
     850        // Return the custom message for the given element name and validation method
    661851        customMessage: function( name, method ) {
    662852            var m = this.settings.messages[ name ];
    663             return m && ( m.constructor === String ? m : m[ method ]);
    664         },
    665 
    666         // return the first defined argument, allowing empty strings
     853            return m && ( m.constructor === String ? m : m[ method ] );
     854        },
     855
     856        // Return the first defined argument, allowing empty strings
    667857        findDefined: function() {
    668             for ( var i = 0; i < arguments.length; i++) {
     858            for ( var i = 0; i < arguments.length; i++ ) {
    669859                if ( arguments[ i ] !== undefined ) {
    670860                    return arguments[ i ];
     
    674864        },
    675865
    676         defaultMessage: function( element, method ) {
    677             return this.findDefined(
    678                 this.customMessage( element.name, method ),
    679                 this.customDataMessage( element, method ),
    680                 // title is never undefined, so handle empty string as undefined
    681                 !this.settings.ignoreTitle && element.title || undefined,
    682                 $.validator.messages[ method ],
    683                 "<strong>Warning: No message defined for " + element.name + "</strong>"
    684             );
    685         },
    686 
    687         formatAndAdd: function( element, rule ) {
    688             var message = this.defaultMessage( element, rule.method ),
     866        // The second parameter 'rule' used to be a string, and extended to an object literal
     867        // of the following form:
     868        // rule = {
     869        //     method: "method name",
     870        //     parameters: "the given method parameters"
     871        // }
     872        //
     873        // The old behavior still supported, kept to maintain backward compatibility with
     874        // old code, and will be removed in the next major release.
     875        defaultMessage: function( element, rule ) {
     876            if ( typeof rule === "string" ) {
     877                rule = { method: rule };
     878            }
     879
     880            var message = this.findDefined(
     881                    this.customMessage( element.name, rule.method ),
     882                    this.customDataMessage( element, rule.method ),
     883
     884                    // 'title' is never undefined, so handle empty string as undefined
     885                    !this.settings.ignoreTitle && element.title || undefined,
     886                    $.validator.messages[ rule.method ],
     887                    "<strong>Warning: No message defined for " + element.name + "</strong>"
     888                ),
    689889                theregex = /\$?\{(\d+)\}/g;
    690890            if ( typeof message === "function" ) {
     
    693893                message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
    694894            }
    695             this.errorList.push({
     895
     896            return message;
     897        },
     898
     899        formatAndAdd: function( element, rule ) {
     900            var message = this.defaultMessage( element, rule );
     901
     902            this.errorList.push( {
    696903                message: message,
    697904                element: element,
    698905                method: rule.method
    699             });
     906            } );
    700907
    701908            this.errorMap[ element.name ] = message;
     
    742949
    743950        invalidElements: function() {
    744             return $( this.errorList ).map(function() {
     951            return $( this.errorList ).map( function() {
    745952                return this.element;
    746             });
     953            } );
    747954        },
    748955
    749956        showLabel: function( element, message ) {
    750             var place, group, errorID,
     957            var place, group, errorID, v,
    751958                error = this.errorsFor( element ),
    752959                elementID = this.idOrName( element ),
    753960                describedBy = $( element ).attr( "aria-describedby" );
     961
    754962            if ( error.length ) {
    755                 // refresh error/success class
     963
     964                // Refresh error/success class
    756965                error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
    757                 // replace message on existing label
    758                 error.html( message );
     966
     967                // Replace message on existing label
     968                if ( this.settings && this.settings.escapeHtml ) {
     969                    error.text( message || "" );
     970                } else {
     971                    error.html( message || "" );
     972                }
    759973            } else {
    760                 // create error element
     974
     975                // Create error element
    761976                error = $( "<" + this.settings.errorElement + ">" )
    762977                    .attr( "id", elementID + "-error" )
    763                     .addClass( this.settings.errorClass )
    764                     .html( message || "" );
     978                    .addClass( this.settings.errorClass );
     979
     980                if ( this.settings && this.settings.escapeHtml ) {
     981                    error.text( message || "" );
     982                } else {
     983                    error.html( message || "" );
     984                }
    765985
    766986                // Maintain reference to the element to be placed into the DOM
    767987                place = error;
    768988                if ( this.settings.wrapper ) {
    769                     // make sure the element is visible, even in IE
     989
     990                    // Make sure the element is visible, even in IE
    770991                    // actually showing the wrapped element is handled elsewhere
    771992                    place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
     
    774995                    this.labelContainer.append( place );
    775996                } else if ( this.settings.errorPlacement ) {
    776                     this.settings.errorPlacement( place, $( element ) );
     997                    this.settings.errorPlacement.call( this, place, $( element ) );
    777998                } else {
    778999                    place.insertAfter( element );
     
    7811002                // Link error back to the element
    7821003                if ( error.is( "label" ) ) {
     1004
    7831005                    // If the error is a label, then associate using 'for'
    7841006                    error.attr( "for", elementID );
    785                 } else if ( error.parents( "label[for='" + elementID + "']" ).length === 0 ) {
     1007
    7861008                    // If the element is not a child of an associated label, then it's necessary
    7871009                    // to explicitly apply aria-describedby
    788 
    789                     errorID = error.attr( "id" ).replace( /(:|\.|\[|\])/g, "\\$1");
     1010                } else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
     1011                    errorID = error.attr( "id" );
     1012
    7901013                    // Respect existing non-error aria-describedby
    7911014                    if ( !describedBy ) {
    7921015                        describedBy = errorID;
    793                     } else if ( !describedBy.match( new RegExp( "\\b" + errorID + "\\b" ) ) ) {
     1016                    } else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
     1017
    7941018                        // Add to end of list if not already present
    7951019                        describedBy += " " + errorID;
     
    8001024                    group = this.groups[ element.name ];
    8011025                    if ( group ) {
    802                         $.each( this.groups, function( name, testgroup ) {
     1026                        v = this;
     1027                        $.each( v.groups, function( name, testgroup ) {
    8031028                            if ( testgroup === group ) {
    804                                 $( "[name='" + name + "']", this.currentForm )
     1029                                $( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm )
    8051030                                    .attr( "aria-describedby", error.attr( "id" ) );
    8061031                            }
    807                         });
     1032                        } );
    8081033                    }
    8091034                }
     
    8211046
    8221047        errorsFor: function( element ) {
    823             var name = this.idOrName( element ),
     1048            var name = this.escapeCssMeta( this.idOrName( element ) ),
    8241049                describer = $( element ).attr( "aria-describedby" ),
    8251050                selector = "label[for='" + name + "'], label[for='" + name + "'] *";
    8261051
    827             // aria-describedby should directly reference the error element
     1052            // 'aria-describedby' should directly reference the error element
    8281053            if ( describer ) {
    829                 selector = selector + ", #" + describer.replace( /\s+/g, ", #" );
    830             }
     1054                selector = selector + ", #" + this.escapeCssMeta( describer )
     1055                    .replace( /\s+/g, ", #" );
     1056            }
     1057
    8311058            return this
    8321059                .errors()
     
    8341061        },
    8351062
     1063        // See https://api.jquery.com/category/selectors/, for CSS
     1064        // meta-characters that should be escaped in order to be used with JQuery
     1065        // as a literal part of a name/id or any selector.
     1066        escapeCssMeta: function( string ) {
     1067            if ( string === undefined ) {
     1068                return "";
     1069            }
     1070
     1071            return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
     1072        },
     1073
    8361074        idOrName: function( element ) {
    8371075            return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
     
    8541092
    8551093        findByName: function( name ) {
    856             return $( this.currentForm ).find( "[name='" + name + "']" );
     1094            return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" );
    8571095        },
    8581096
     
    8701108
    8711109        depend: function( param, element ) {
    872             return this.dependTypes[typeof param] ? this.dependTypes[typeof param]( param, element ) : true;
     1110            return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
    8731111        },
    8741112
     
    8901128        },
    8911129
     1130        elementAjaxPort: function( element ) {
     1131            return "validate" + element.name;
     1132        },
     1133
    8921134        startRequest: function( element ) {
    8931135            if ( !this.pending[ element.name ] ) {
    8941136                this.pendingRequest++;
     1137                $( element ).addClass( this.settings.pendingClass );
    8951138                this.pending[ element.name ] = true;
    8961139            }
     
    8991142        stopRequest: function( element, valid ) {
    9001143            this.pendingRequest--;
    901             // sometimes synchronization fails, make sure pendingRequest is never < 0
     1144
     1145            // Sometimes synchronization fails, make sure pendingRequest is never < 0
    9021146            if ( this.pendingRequest < 0 ) {
    9031147                this.pendingRequest = 0;
    9041148            }
    9051149            delete this.pending[ element.name ];
    906             if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
    907                 $( this.currentForm ).submit();
     1150            $( element ).removeClass( this.settings.pendingClass );
     1151            if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) {
     1152                $( this.currentForm ).trigger( "submit" );
     1153
     1154                // Remove the hidden input that was used as a replacement for the
     1155                // missing submit button. The hidden input is added by `handle()`
     1156                // to ensure that the value of the used submit button is passed on
     1157                // for scripted submits triggered by this method
     1158                if ( this.submitButton ) {
     1159                    $( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
     1160                }
     1161
    9081162                this.formSubmitted = false;
    909             } else if (!valid && this.pendingRequest === 0 && this.formSubmitted ) {
    910                 $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
     1163            } else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
     1164                $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
    9111165                this.formSubmitted = false;
    9121166            }
    9131167        },
    9141168
    915         previousValue: function( element ) {
     1169        abortRequest: function( element ) {
     1170            var port;
     1171
     1172            if ( this.pending[ element.name ] ) {
     1173                port = this.elementAjaxPort( element );
     1174                $.ajaxAbort( port );
     1175
     1176                this.pendingRequest--;
     1177
     1178                // Sometimes synchronization fails, make sure pendingRequest is never < 0
     1179                if ( this.pendingRequest < 0 ) {
     1180                    this.pendingRequest = 0;
     1181                }
     1182
     1183                delete this.pending[ element.name ];
     1184                $( element ).removeClass( this.settings.pendingClass );
     1185            }
     1186        },
     1187
     1188        previousValue: function( element, method ) {
     1189            method = typeof method === "string" && method || "remote";
     1190
    9161191            return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
    9171192                old: null,
    9181193                valid: true,
    919                 message: this.defaultMessage( element, "remote" )
    920             });
     1194                message: this.defaultMessage( element, { method: method } )
     1195            } );
     1196        },
     1197
     1198        // Cleans up all forms and elements, removes validator-specific events
     1199        destroy: function() {
     1200            this.resetForm();
     1201
     1202            $( this.currentForm )
     1203                .off( ".validate" )
     1204                .removeData( "validator" )
     1205                .find( ".validate-equalTo-blur" )
     1206                    .off( ".validate-equalTo" )
     1207                    .removeClass( "validate-equalTo-blur" )
     1208                .find( ".validate-lessThan-blur" )
     1209                    .off( ".validate-lessThan" )
     1210                    .removeClass( "validate-lessThan-blur" )
     1211                .find( ".validate-lessThanEqual-blur" )
     1212                    .off( ".validate-lessThanEqual" )
     1213                    .removeClass( "validate-lessThanEqual-blur" )
     1214                .find( ".validate-greaterThanEqual-blur" )
     1215                    .off( ".validate-greaterThanEqual" )
     1216                    .removeClass( "validate-greaterThanEqual-blur" )
     1217                .find( ".validate-greaterThan-blur" )
     1218                    .off( ".validate-greaterThan" )
     1219                    .removeClass( "validate-greaterThan-blur" );
    9211220        }
    9221221
     
    9491248            $.each( classes.split( " " ), function() {
    9501249                if ( this in $.validator.classRuleSettings ) {
    951                     $.extend( rules, $.validator.classRuleSettings[ this ]);
    952                 }
    953             });
     1250                    $.extend( rules, $.validator.classRuleSettings[ this ] );
     1251                }
     1252            } );
    9541253        }
    9551254        return rules;
     1255    },
     1256
     1257    normalizeAttributeRule: function( rules, type, method, value ) {
     1258
     1259        // Convert the value to a number for number inputs, and for text for backwards compability
     1260        // allows type="date" and others to be compared as strings
     1261        if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
     1262            value = Number( value );
     1263
     1264            // Support Opera Mini, which returns NaN for undefined minlength
     1265            if ( isNaN( value ) ) {
     1266                value = undefined;
     1267            }
     1268        }
     1269
     1270        if ( value || value === 0 ) {
     1271            rules[ method ] = value;
     1272        } else if ( type === method && type !== "range" ) {
     1273
     1274            // Exception: the jquery validate 'range' method
     1275            // does not test for the html5 'range' type
     1276            rules[ type === "date" ? "dateISO" : method ] = true;
     1277        }
    9561278    },
    9571279
     
    9641286        for ( method in $.validator.methods ) {
    9651287
    966             // support for <input required> in both html5 and older browsers
     1288            // Support for <input required> in both html5 and older browsers
    9671289            if ( method === "required" ) {
    9681290                value = element.getAttribute( method );
     1291
    9691292                // Some browsers return an empty string for the required attribute
    9701293                // and non-HTML5 browsers might have required="" markup
     
    9721295                    value = true;
    9731296                }
    974                 // force non-HTML5 browsers to return bool
     1297
     1298                // Force non-HTML5 browsers to return bool
    9751299                value = !!value;
    9761300            } else {
     
    9781302            }
    9791303
    980             // convert the value to a number for number inputs, and for text for backwards compability
    981             // allows type="date" and others to be compared as strings
    982             if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
    983                 value = Number( value );
    984             }
    985 
    986             if ( value || value === 0 ) {
    987                 rules[ method ] = value;
    988             } else if ( type === method && type !== "range" ) {
    989                 // exception: the jquery validate 'range' method
    990                 // does not test for the html5 'range' type
    991                 rules[ method ] = true;
    992             }
    993         }
    994 
    995         // maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
     1304            this.normalizeAttributeRule( rules, type, method, value );
     1305        }
     1306
     1307        // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
    9961308        if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
    9971309            delete rules.maxlength;
     
    10021314
    10031315    dataRules: function( element ) {
    1004         var method, value,
    1005             rules = {}, $element = $( element );
     1316        var rules = {},
     1317            $element = $( element ),
     1318            type = element.getAttribute( "type" ),
     1319            method, value;
     1320
    10061321        for ( method in $.validator.methods ) {
    10071322            value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
    1008             if ( value !== undefined ) {
    1009                 rules[ method ] = value;
    1010             }
     1323
     1324            // Cast empty attributes like `data-rule-required` to `true`
     1325            if ( value === "" ) {
     1326                value = true;
     1327            }
     1328
     1329            this.normalizeAttributeRule( rules, type, method, value );
    10111330        }
    10121331        return rules;
     
    10241343
    10251344    normalizeRules: function( rules, element ) {
    1026         // handle dependency check
     1345
     1346        // Handle dependency check
    10271347        $.each( rules, function( prop, val ) {
    1028             // ignore rule when param is explicitly false, eg. required:false
     1348
     1349            // Ignore rule when param is explicitly false, eg. required:false
    10291350            if ( val === false ) {
    10301351                delete rules[ prop ];
     
    10441365                    rules[ prop ] = val.param !== undefined ? val.param : true;
    10451366                } else {
     1367                    $.data( element.form, "validator" ).resetElements( $( element ) );
    10461368                    delete rules[ prop ];
    10471369                }
    10481370            }
    1049         });
    1050 
    1051         // evaluate parameters
     1371        } );
     1372
     1373        // Evaluate parameters
    10521374        $.each( rules, function( rule, parameter ) {
    1053             rules[ rule ] = $.isFunction( parameter ) ? parameter( element ) : parameter;
    1054         });
    1055 
    1056         // clean number parameters
    1057         $.each([ "minlength", "maxlength" ], function() {
     1375            rules[ rule ] = typeof parameter === "function" && rule !== "normalizer" ? parameter( element ) : parameter;
     1376        } );
     1377
     1378        // Clean number parameters
     1379        $.each( [ "minlength", "maxlength" ], function() {
    10581380            if ( rules[ this ] ) {
    10591381                rules[ this ] = Number( rules[ this ] );
    10601382            }
    1061         });
    1062         $.each([ "rangelength", "range" ], function() {
     1383        } );
     1384        $.each( [ "rangelength", "range" ], function() {
    10631385            var parts;
    10641386            if ( rules[ this ] ) {
    1065                 if ( $.isArray( rules[ this ] ) ) {
    1066                     rules[ this ] = [ Number( rules[ this ][ 0 ]), Number( rules[ this ][ 1 ] ) ];
     1387                if ( Array.isArray( rules[ this ] ) ) {
     1388                    rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
    10671389                } else if ( typeof rules[ this ] === "string" ) {
    1068                     parts = rules[ this ].replace(/[\[\]]/g, "" ).split( /[\s,]+/ );
    1069                     rules[ this ] = [ Number( parts[ 0 ]), Number( parts[ 1 ] ) ];
    1070                 }
    1071             }
    1072         });
     1390                    parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
     1391                    rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
     1392                }
     1393            }
     1394        } );
    10731395
    10741396        if ( $.validator.autoCreateRanges ) {
    1075             // auto-create ranges
     1397
     1398            // Auto-create ranges
    10761399            if ( rules.min != null && rules.max != null ) {
    10771400                rules.range = [ rules.min, rules.max ];
     
    10951418            $.each( data.split( /\s/ ), function() {
    10961419                transformed[ this ] = true;
    1097             });
     1420            } );
    10981421            data = transformed;
    10991422        }
     
    11011424    },
    11021425
    1103     // http://jqueryvalidation.org/jQuery.validator.addMethod/
     1426    // https://jqueryvalidation.org/jQuery.validator.addMethod/
    11041427    addMethod: function( name, method, message ) {
    11051428        $.validator.methods[ name ] = method;
     
    11101433    },
    11111434
     1435    // https://jqueryvalidation.org/jQuery.validator.methods/
    11121436    methods: {
    11131437
    1114         // http://jqueryvalidation.org/required-method/
     1438        // https://jqueryvalidation.org/required-method/
    11151439        required: function( value, element, param ) {
    1116             // check if dependency is met
     1440
     1441            // Check if dependency is met
    11171442            if ( !this.depend( param, element ) ) {
    11181443                return "dependency-mismatch";
    11191444            }
    11201445            if ( element.nodeName.toLowerCase() === "select" ) {
    1121                 // could be an array for select-multiple or a string, both are fine this way
     1446
     1447                // Could be an array for select-multiple or a string, both are fine this way
    11221448                var val = $( element ).val();
    11231449                return val && val.length > 0;
     
    11261452                return this.getLength( value, element ) > 0;
    11271453            }
    1128             return $.trim( value ).length > 0;
    1129         },
    1130 
    1131         // http://jqueryvalidation.org/email-method/
     1454            return value !== undefined && value !== null && value.length > 0;
     1455        },
     1456
     1457        // https://jqueryvalidation.org/email-method/
    11321458        email: function( value, element ) {
    1133             // From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
     1459
     1460            // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
    11341461            // Retrieved 2014-01-14
    11351462            // If you have a problem with this implementation, report a bug against the above spec
     
    11381465        },
    11391466
    1140         // http://jqueryvalidation.org/url-method/
     1467        // https://jqueryvalidation.org/url-method/
    11411468        url: function( value, element ) {
    1142             // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
    1143             return this.optional( element ) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
    1144         },
    1145 
    1146         // http://jqueryvalidation.org/date-method/
    1147         date: function( value, element ) {
    1148             return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
    1149         },
    1150 
    1151         // http://jqueryvalidation.org/dateISO-method/
     1469
     1470            // Copyright (c) 2010-2013 Diego Perini, MIT licensed
     1471            // https://gist.github.com/dperini/729294
     1472            // see also https://mathiasbynens.be/demo/url-regex
     1473            // modified to allow protocol-relative URLs
     1474            return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
     1475        },
     1476
     1477        // https://jqueryvalidation.org/date-method/
     1478        date: ( function() {
     1479            var called = false;
     1480
     1481            return function( value, element ) {
     1482                if ( !called ) {
     1483                    called = true;
     1484                    if ( this.settings.debug && window.console ) {
     1485                        console.warn(
     1486                            "The `date` method is deprecated and will be removed in version '2.0.0'.\n" +
     1487                            "Please don't use it, since it relies on the Date constructor, which\n" +
     1488                            "behaves very differently across browsers and locales. Use `dateISO`\n" +
     1489                            "instead or one of the locale specific methods in `localizations/`\n" +
     1490                            "and `additional-methods.js`."
     1491                        );
     1492                    }
     1493                }
     1494
     1495                return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
     1496            };
     1497        }() ),
     1498
     1499        // https://jqueryvalidation.org/dateISO-method/
    11521500        dateISO: function( value, element ) {
    11531501            return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
    11541502        },
    11551503
    1156         // http://jqueryvalidation.org/number-method/
     1504        // https://jqueryvalidation.org/number-method/
    11571505        number: function( value, element ) {
    1158             return this.optional( element ) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
    1159         },
    1160 
    1161         // http://jqueryvalidation.org/digits-method/
     1506            return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test( value );
     1507        },
     1508
     1509        // https://jqueryvalidation.org/digits-method/
    11621510        digits: function( value, element ) {
    11631511            return this.optional( element ) || /^\d+$/.test( value );
    11641512        },
    11651513
    1166         // http://jqueryvalidation.org/creditcard-method/
    1167         // based on http://en.wikipedia.org/wiki/Luhn/
    1168         creditcard: function( value, element ) {
     1514        // https://jqueryvalidation.org/minlength-method/
     1515        minlength: function( value, element, param ) {
     1516            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
     1517            return this.optional( element ) || length >= param;
     1518        },
     1519
     1520        // https://jqueryvalidation.org/maxlength-method/
     1521        maxlength: function( value, element, param ) {
     1522            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
     1523            return this.optional( element ) || length <= param;
     1524        },
     1525
     1526        // https://jqueryvalidation.org/rangelength-method/
     1527        rangelength: function( value, element, param ) {
     1528            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
     1529            return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
     1530        },
     1531
     1532        // https://jqueryvalidation.org/min-method/
     1533        min: function( value, element, param ) {
     1534            return this.optional( element ) || value >= param;
     1535        },
     1536
     1537        // https://jqueryvalidation.org/max-method/
     1538        max: function( value, element, param ) {
     1539            return this.optional( element ) || value <= param;
     1540        },
     1541
     1542        // https://jqueryvalidation.org/range-method/
     1543        range: function( value, element, param ) {
     1544            return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
     1545        },
     1546
     1547        // https://jqueryvalidation.org/step-method/
     1548        step: function( value, element, param ) {
     1549            var type = $( element ).attr( "type" ),
     1550                errorMessage = "Step attribute on input type " + type + " is not supported.",
     1551                supportedTypes = [ "text", "number", "range" ],
     1552                re = new RegExp( "\\b" + type + "\\b" ),
     1553                notSupported = type && !re.test( supportedTypes.join() ),
     1554                decimalPlaces = function( num ) {
     1555                    var match = ( "" + num ).match( /(?:\.(\d+))?$/ );
     1556                    if ( !match ) {
     1557                        return 0;
     1558                    }
     1559
     1560                    // Number of digits right of decimal point.
     1561                    return match[ 1 ] ? match[ 1 ].length : 0;
     1562                },
     1563                toInt = function( num ) {
     1564                    return Math.round( num * Math.pow( 10, decimals ) );
     1565                },
     1566                valid = true,
     1567                decimals;
     1568
     1569            // Works only for text, number and range input types
     1570            // TODO find a way to support input types date, datetime, datetime-local, month, time and week
     1571            if ( notSupported ) {
     1572                throw new Error( errorMessage );
     1573            }
     1574
     1575            decimals = decimalPlaces( param );
     1576
     1577            // Value can't have too many decimals
     1578            if ( decimalPlaces( value ) > decimals || toInt( value ) % toInt( param ) !== 0 ) {
     1579                valid = false;
     1580            }
     1581
     1582            return this.optional( element ) || valid;
     1583        },
     1584
     1585        // https://jqueryvalidation.org/equalTo-method/
     1586        equalTo: function( value, element, param ) {
     1587
     1588            // Bind to the blur event of the target in order to revalidate whenever the target field is updated
     1589            var target = $( param );
     1590            if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
     1591                target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
     1592                    $( element ).valid();
     1593                } );
     1594            }
     1595            return value === target.val();
     1596        },
     1597
     1598        // https://jqueryvalidation.org/remote-method/
     1599        remote: function( value, element, param, method ) {
    11691600            if ( this.optional( element ) ) {
    11701601                return "dependency-mismatch";
    11711602            }
    1172             // accept only spaces, digits and dashes
    1173             if ( /[^0-9 \-]+/.test( value ) ) {
    1174                 return false;
    1175             }
    1176             var nCheck = 0,
    1177                 nDigit = 0,
    1178                 bEven = false,
    1179                 n, cDigit;
    1180 
    1181             value = value.replace( /\D/g, "" );
    1182 
    1183             // Basing min and max length on
    1184             // http://developer.ean.com/general_info/Valid_Credit_Card_Types
    1185             if ( value.length < 13 || value.length > 19 ) {
    1186                 return false;
    1187             }
    1188 
    1189             for ( n = value.length - 1; n >= 0; n--) {
    1190                 cDigit = value.charAt( n );
    1191                 nDigit = parseInt( cDigit, 10 );
    1192                 if ( bEven ) {
    1193                     if ( ( nDigit *= 2 ) > 9 ) {
    1194                         nDigit -= 9;
    1195                     }
    1196                 }
    1197                 nCheck += nDigit;
    1198                 bEven = !bEven;
    1199             }
    1200 
    1201             return ( nCheck % 10 ) === 0;
    1202         },
    1203 
    1204         // http://jqueryvalidation.org/minlength-method/
    1205         minlength: function( value, element, param ) {
    1206             var length = $.isArray( value ) ? value.length : this.getLength( value, element );
    1207             return this.optional( element ) || length >= param;
    1208         },
    1209 
    1210         // http://jqueryvalidation.org/maxlength-method/
    1211         maxlength: function( value, element, param ) {
    1212             var length = $.isArray( value ) ? value.length : this.getLength( value, element );
    1213             return this.optional( element ) || length <= param;
    1214         },
    1215 
    1216         // http://jqueryvalidation.org/rangelength-method/
    1217         rangelength: function( value, element, param ) {
    1218             var length = $.isArray( value ) ? value.length : this.getLength( value, element );
    1219             return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
    1220         },
    1221 
    1222         // http://jqueryvalidation.org/min-method/
    1223         min: function( value, element, param ) {
    1224             return this.optional( element ) || value >= param;
    1225         },
    1226 
    1227         // http://jqueryvalidation.org/max-method/
    1228         max: function( value, element, param ) {
    1229             return this.optional( element ) || value <= param;
    1230         },
    1231 
    1232         // http://jqueryvalidation.org/range-method/
    1233         range: function( value, element, param ) {
    1234             return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
    1235         },
    1236 
    1237         // http://jqueryvalidation.org/equalTo-method/
    1238         equalTo: function( value, element, param ) {
    1239             // bind to the blur event of the target in order to revalidate whenever the target field is updated
    1240             // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
    1241             var target = $( param );
    1242             if ( this.settings.onfocusout ) {
    1243                 target.unbind( ".validate-equalTo" ).bind( "blur.validate-equalTo", function() {
    1244                     $( element ).valid();
    1245                 });
    1246             }
    1247             return value === target.val();
    1248         },
    1249 
    1250         // http://jqueryvalidation.org/remote-method/
    1251         remote: function( value, element, param ) {
    1252             if ( this.optional( element ) ) {
    1253                 return "dependency-mismatch";
    1254             }
    1255 
    1256             var previous = this.previousValue( element ),
    1257                 validator, data;
    1258 
    1259             if (!this.settings.messages[ element.name ] ) {
     1603
     1604            method = typeof method === "string" && method || "remote";
     1605
     1606            var previous = this.previousValue( element, method ),
     1607                validator, data, optionDataString;
     1608
     1609            if ( !this.settings.messages[ element.name ] ) {
    12601610                this.settings.messages[ element.name ] = {};
    12611611            }
    1262             previous.originalMessage = this.settings.messages[ element.name ].remote;
    1263             this.settings.messages[ element.name ].remote = previous.message;
     1612            previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
     1613            this.settings.messages[ element.name ][ method ] = previous.message;
    12641614
    12651615            param = typeof param === "string" && { url: param } || param;
    1266 
    1267             if ( previous.old === value ) {
     1616            optionDataString = $.param( $.extend( { data: value }, param.data ) );
     1617            if ( previous.valid !== null && previous.old === optionDataString ) {
    12681618                return previous.valid;
    12691619            }
    12701620
    1271             previous.old = value;
     1621            previous.old = optionDataString;
     1622            previous.valid = null;
    12721623            validator = this;
    12731624            this.startRequest( element );
     
    12751626            data[ element.name ] = value;
    12761627            $.ajax( $.extend( true, {
    1277                 url: param,
    12781628                mode: "abort",
    1279                 port: "validate" + element.name,
     1629                port: this.elementAjaxPort( element ),
    12801630                dataType: "json",
    12811631                data: data,
     
    12851635                        errors, message, submitted;
    12861636
    1287                     validator.settings.messages[ element.name ].remote = previous.originalMessage;
     1637                    validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
    12881638                    if ( valid ) {
    12891639                        submitted = validator.formSubmitted;
    1290                         validator.prepareElement( element );
     1640                        validator.toHide = validator.errorsFor( element );
    12911641                        validator.formSubmitted = submitted;
    12921642                        validator.successList.push( element );
    1293                         delete validator.invalid[ element.name ];
     1643                        validator.invalid[ element.name ] = false;
    12941644                        validator.showErrors();
    12951645                    } else {
    12961646                        errors = {};
    1297                         message = response || validator.defaultMessage( element, "remote" );
    1298                         errors[ element.name ] = previous.message = $.isFunction( message ) ? message( value ) : message;
     1647                        message = response || validator.defaultMessage( element, { method: method, parameters: value } );
     1648                        errors[ element.name ] = previous.message = message;
    12991649                        validator.invalid[ element.name ] = true;
    13001650                        validator.showErrors( errors );
     
    13061656            return "pending";
    13071657        }
    1308 
    13091658    }
    13101659
    1311 });
    1312 
    1313 $.format = function deprecated() {
    1314     throw "$.format has been deprecated. Please use $.validator.format instead.";
    1315 };
    1316 
    1317 // ajax mode: abort
     1660} );
     1661
     1662// Ajax mode: abort
    13181663// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
     1664//        $.ajaxAbort( port );
    13191665// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
    13201666
    13211667var pendingRequests = {},
    13221668    ajax;
     1669
    13231670// Use a prefilter if available (1.5+)
    13241671if ( $.ajaxPrefilter ) {
    1325     $.ajaxPrefilter(function( settings, _, xhr ) {
     1672    $.ajaxPrefilter( function( settings, _, xhr ) {
    13261673        var port = settings.port;
    13271674        if ( settings.mode === "abort" ) {
    1328             if ( pendingRequests[port] ) {
    1329                 pendingRequests[port].abort();
    1330             }
    1331             pendingRequests[port] = xhr;
    1332         }
    1333     });
     1675            $.ajaxAbort( port );
     1676            pendingRequests[ port ] = xhr;
     1677        }
     1678    } );
    13341679} else {
     1680
    13351681    // Proxy ajax
    13361682    ajax = $.ajax;
     
    13391685            port = ( "port" in settings ? settings : $.ajaxSettings ).port;
    13401686        if ( mode === "abort" ) {
    1341             if ( pendingRequests[port] ) {
    1342                 pendingRequests[port].abort();
    1343             }
    1344             pendingRequests[port] = ajax.apply(this, arguments);
    1345             return pendingRequests[port];
    1346         }
    1347         return ajax.apply(this, arguments);
     1687            $.ajaxAbort( port );
     1688            pendingRequests[ port ] = ajax.apply( this, arguments );
     1689            return pendingRequests[ port ];
     1690        }
     1691        return ajax.apply( this, arguments );
    13481692    };
    13491693}
    13501694
    1351 // provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
    1352 // handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
    1353 
    1354 $.extend($.fn, {
    1355     validateDelegate: function( delegate, type, handler ) {
    1356         return this.bind(type, function( event ) {
    1357             var target = $(event.target);
    1358             if ( target.is(delegate) ) {
    1359                 return handler.apply(target, arguments);
    1360             }
    1361         });
     1695// Abort the previous request without sending a new one
     1696$.ajaxAbort = function( port ) {
     1697    if ( pendingRequests[ port ] ) {
     1698        pendingRequests[ port ].abort();
     1699        delete pendingRequests[ port ];
    13621700    }
    1363 });
    1364 
     1701};
     1702return $;
    13651703}));
  • weight-loss-tracker/tags/10.14/assets/js/libraries/jquery.validate.min.js

    r3145588 r3158785  
    1 /**
    2  * selectize.js (v0.13.6)
    3  * Copyright (c) 2013–2015 Brian Reavis & contributors
    4  * Copyright (c) 2020-2022 Selectize Team & contributors
    5  *
    6  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
    7  * file except in compliance with the License. You may obtain a copy of the License at:
    8  * http://www.apache.org/licenses/LICENSE-2.0
    9  *
    10  * Unless required by applicable law or agreed to in writing, software distributed under
    11  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
    12  * ANY KIND, either express or implied. See the License for the specific language
    13  * governing permissions and limitations under the License.
    14  *
    15  * @author Brian Reavis <brian@thirdroute.com>
    16  * @author Ris Adams <selectize@risadams.com>
    17  */
    18 
    19 /*jshint curly:false */
    20 /*jshint browser:true */
    21 !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a];return void 0},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})});
     1/*! jQuery Validation Plugin - v1.21.0 - 7/17/2024
     2 * https://jqueryvalidation.org/
     3 * Copyright (c) 2024 Jörn Zaefferer; Licensed MIT */
     4!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}});var b=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};a.extend(a.expr.pseudos||a.expr[":"],{blank:function(c){return!b(""+a(c).val())},filled:function(c){var d=a(c).val();return null!==d&&!!b(""+d)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,customElements:[],onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)});var f=[":text","[type='password']","[type='file']","select","textarea","[type='number']","[type='search']","[type='tel']","[type='url']","[type='email']","[type='datetime']","[type='date']","[type='month']","[type='week']","[type='time']","[type='datetime-local']","[type='range']","[type='color']","[type='radio']","[type='checkbox']","[contenteditable]","[type='button']"],g=["select","option","[type='radio']","[type='checkbox']"];a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",f.concat(this.settings.customElements).join(", "),b).on("click.validate",g.concat(this.settings.customElements).join(", "),b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={},d=["input","select","textarea","[contenteditable]"];return a(this.currentForm).find(d.concat(this.settings.customElements).join(", ")).not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);this.abortRequest(b),"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=".  Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),this.settings&&this.settings.escapeHtml?h.text(c||""):h.html(c||"")):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass),this.settings&&this.settings.escapeHtml?h.text(c||""):h.html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return void 0===a?"":a.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},elementAjaxPort:function(a){return"validate"+a.name},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()&&0===this.pendingRequest?(a(this.currentForm).trigger("submit"),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},abortRequest:function(b){var c;this.pending[b.name]&&(c=this.elementAjaxPort(b),a.ajaxAbort(c),this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass))},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a["date"===b?"dateISO":c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(a,d){b[a]="function"==typeof d&&"normalizer"!==a?d(c):d}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var a;b[this]&&(Array.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(a=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(a[0]),Number(a[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c},maxlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d<=c},rangelength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c[0]&&d<=c[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),null!==i.valid&&i.old===h?i.valid:(i.old=h,i.valid=null,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:this.elementAjaxPort(c),dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var c,d={};return a.ajaxPrefilter?a.ajaxPrefilter(function(b,c,e){var f=b.port;"abort"===b.mode&&(a.ajaxAbort(f),d[f]=e)}):(c=a.ajax,a.ajax=function(b){var e=("mode"in b?b:a.ajaxSettings).mode,f=("port"in b?b:a.ajaxSettings).port;return"abort"===e?(a.ajaxAbort(f),d[f]=c.apply(this,arguments),d[f]):c.apply(this,arguments)}),a.ajaxAbort=function(a){d[a]&&(d[a].abort(),delete d[a])},a});
  • weight-loss-tracker/tags/10.14/includes/core.php

    r3145588 r3158785  
    3333                    'user-id'                           => $user_id,
    3434                    'current-url'                       => apply_filters( 'wlt_current_url', get_permalink() ),
    35                     'photos-enabled'                    => ( ws_ls_meta_fields_photo_any_enabled( true ) ) ? 'true' : 'false',
     35                    'photos-enabled'                    => ws_ls_meta_fields_photo_any_enabled( false ) ? 'true' : 'false',
    3636                    'date-picker-locale'                => ws_ls_config_js_datapicker_locale(),
    3737                    'in-admin'                          => ( is_admin() ) ? 'true' : 'false',
  • weight-loss-tracker/tags/10.14/pro-features/plus/meta-fields/functions.php

    r3145588 r3158785  
    590590        // Show Add button
    591591        $html .= sprintf('<div class="ws-ls-cell ws-ls-photo-select">
    592                                 <input type="file" data-msg="%6$s \'%7$s\'." name="%1$s" id="%8$s" tabindex="%2$s" data-rule-accept="png|jpeg|jpg" class="ws-ls-hide ws-ls-input-file ws-ls-meta-fields-photo" %5$s data-required="%4$s" />
     592                                <input type="file" data-msg="%6$s \'%7$s\'." name="%1$s" id="%8$s" tabindex="%2$s"data-rule-accept="image/jpeg,image/pjpeg,image/png"
     593                                    class="ws-ls-hide ws-ls-input-file ws-ls-meta-fields-photo" %5$s data-required="%4$s" />
    593594                                <label for="%8$s" class="ws-ls-button">
    594595                                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"><path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"/></svg>
  • weight-loss-tracker/tags/10.14/readme.txt

    r3154754 r3158785  
    44Requires at least: 6.0
    55Tested up to: 6.5
    6 Stable tag: 10.13
     6Stable tag: 10.14
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    170170
    171171== Changelog ==
     172
     173= 10.14 =
     174
     175* Bug fix: Fixed an issue where photo uploads weren't allowed when "hide from shortcodes" was selected.
    172176
    173177= 10.13 =
  • weight-loss-tracker/tags/10.14/weight-loss-tracker.php

    r3154754 r3158785  
    66 * Plugin Name:         Weight Tracker
    77 * Description:         Allow your users to track their weight, body measurements, photos and other pieces of custom data. Display in charts, tables, shortcodes and widgets. Manage their data, issue awards, email notifications, etc! Provide advanced data on Body Mass Index (BMI), Basal Metabolic Rate (BMR), Calorie intake, Harris Benedict Formula, Macronutrients Calculator and more.
    8  * Version:             10.13
     8 * Version:             10.14
    99 * Requires at least:   6.0
    1010 * Tested up to:        6.5
     
    1818 */
    1919
    20 define( 'WE_LS_CURRENT_VERSION', '10.13' );
     20define( 'WE_LS_CURRENT_VERSION', '10.14' );
    2121define( 'WS_LS_ABSPATH', plugin_dir_path( __FILE__ ) );
    2222define( 'WS_LS_BASE_URL', plugin_dir_url( __FILE__ ) );
  • weight-loss-tracker/trunk/assets/js/libraries/additional-methods.js

    r3151452 r3158785  
    11/*!
    2  * jQuery Validation Plugin v1.19.5
     2 * jQuery Validation Plugin v1.21.0
    33 *
    44 * https://jqueryvalidation.org/
    55 *
    6  * Copyright (c) 2022 Jörn Zaefferer
     6 * Copyright (c) 2024 Jörn Zaefferer
    77 * Released under the MIT license
    88 */
     
    14601460 */
    14611461$.validator.addMethod( "vinUS", function( v ) {
    1462     if ( v.length !== 17 ) {
    1463         return false;
    1464     }
    1465 
    1466     var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ],
    1467         VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ],
    1468         FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ],
    1469         rs = 0,
    1470         i, n, d, f, cd, cdv;
    1471 
    1472     for ( i = 0; i < 17; i++ ) {
    1473         f = FL[ i ];
    1474         d = v.slice( i, i + 1 );
    1475         if ( i === 8 ) {
    1476             cdv = d;
    1477         }
    1478         if ( !isNaN( d ) ) {
    1479             d *= f;
    1480         } else {
    1481             for ( n = 0; n < LL.length; n++ ) {
    1482                 if ( d.toUpperCase() === LL[ n ] ) {
    1483                     d = VL[ n ];
    1484                     d *= f;
    1485                     if ( isNaN( cdv ) && n === 8 ) {
    1486                         cdv = LL[ n ];
    1487                     }
    1488                     break;
    1489                 }
    1490             }
    1491         }
    1492         rs += d;
    1493     }
    1494     cd = rs % 11;
    1495     if ( cd === 10 ) {
    1496         cd = "X";
    1497     }
    1498     if ( cd === cdv ) {
    1499         return true;
    1500     }
    1501     return false;
     1462    if ( v.length !== 17 ) {
     1463        return false;
     1464    }
     1465
     1466    var LL = [ "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ],
     1467        VL = [ 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9 ],
     1468        FL = [ 8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2 ],
     1469        rs = 0,
     1470        i, n, d, f, cd, cdv;
     1471
     1472    for ( i = 0; i < 17; i++ ) {
     1473        f = FL[ i ];
     1474        d = v.slice( i, i + 1 );
     1475        if ( isNaN( d ) ) {
     1476            d = d.toUpperCase();
     1477            n = VL[ LL.indexOf( d ) ];
     1478        } else {
     1479            n = parseInt( d, 10 );
     1480        }
     1481        if ( i === 8 )
     1482        {
     1483            cdv = n;
     1484            if ( d === "X" ) {
     1485                cdv = 10;
     1486            }
     1487        }
     1488        rs += n * f;
     1489    }
     1490    cd = rs % 11;
     1491    if ( cd === cdv ) {
     1492        return true;
     1493    }
     1494    return false;
    15021495}, "The specified vehicle identification number (VIN) is invalid." );
    15031496
  • weight-loss-tracker/trunk/assets/js/libraries/additional-methods.min.js

    r3151452 r3158785  
    1 /*! jQuery Validation Plugin - v1.19.5 - 7/1/2022
     1/*! jQuery Validation Plugin - v1.21.0 - 7/17/2024
    22 * https://jqueryvalidation.org/
    3  * Copyright (c) 2022 Jörn Zaefferer; Licensed MIT */
    4 !function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("abaRoutingNumber",function(a){var b=0,c=a.split(""),d=c.length;if(9!==d)return!1;for(var e=0;e<d;e+=3)b+=3*parseInt(c[e],10)+7*parseInt(c[e+1],10)+parseInt(c[e+2],10);return 0!==b&&b%10===0},"Please enter a valid routing number."),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(g))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please."),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;c<h;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number."),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number."),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a.toUpperCase())},"Please specify a valid BIC code."),a.validator.addMethod("cifES",function(a,b){"use strict";function c(a){return a%2===0}if(this.optional(b))return!0;var d,e,f,g,h=new RegExp(/^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi),i=a.substring(0,1),j=a.substring(1,8),k=a.substring(8,9),l=0,m=0,n=0;if(9!==a.length||!h.test(a))return!1;for(d=0;d<j.length;d++)e=parseInt(j[d],10),c(d)?(e*=2,n+=e<10?e:e-9):m+=e;return l=m+n,f=(10-l.toString().substr(-1)).toString(),f=parseInt(f,10)>9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cnhBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f,g,h=0,i=0;if(b=a.charAt(0),new Array(12).join(b)===a)return!1;for(e=0,f=9,g=0;e<9;++e,--f)h+=+(a.charAt(e)*f);for(c=h%11,c>=10&&(c=0,i=2),h=0,e=0,f=1,g=0;e<9;++e,++f)h+=+(a.charAt(e)*f);return d=h%11,d>=10?d=0:d-=i,String(c).concat(d)===a.substr(-2)},"Please specify a valid CNH number."),a.validator.addMethod("cnpjBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/[^\d]+/g,""),14!==a.length)return!1;if("00000000000000"===a||"11111111111111"===a||"22222222222222"===a||"33333333333333"===a||"44444444444444"===a||"55555555555555"===a||"66666666666666"===a||"77777777777777"===a||"88888888888888"===a||"99999999999999"===a)return!1;for(var c=a.length-2,d=a.substring(0,c),e=a.substring(c),f=0,g=c-7,h=c;h>=1;h--)f+=d.charAt(c-h)*g--,g<2&&(g=9);var i=f%11<2?0:11-f%11;if(i!==parseInt(e.charAt(0),10))return!1;c+=1,d=a.substring(0,c),f=0,g=c-7;for(var j=c;j>=1;j--)f+=d.charAt(c-j)*g--,g<2&&(g=9);return i=f%11<2?0:11-f%11,i===parseInt(e.charAt(1),10)},"Please specify a CNPJ value number."),a.validator.addMethod("cpfBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var c,d,e,f,g=0;if(c=parseInt(a.substring(9,10),10),d=parseInt(a.substring(10,11),10),e=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(f=1;f<=9;f++)g+=parseInt(a.substring(f-1,f),10)*(11-f);if(e(g,c)){for(g=0,f=1;f<=10;f++)g+=parseInt(a.substring(f-1,f),10)*(12-f);return e(g,d)}return!1},"Please specify a valid CPF number."),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&(/^(5[12345])/.test(a)||/^(2[234567])/.test(a))?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency."),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number."),a.validator.addMethod("greaterThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThan-blur").length&&e.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",function(){a(c).valid()}),b>e.val()},"Please enter a greater value."),a.validator.addMethod("greaterThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThanEqual-blur").length&&e.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",function(){a(c).valid()}),b>=e.val()},"Please enter a greater value."),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.length<q)return!1;if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN."),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please."),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lessThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThan-blur").length&&e.addClass("validate-lessThan-blur").on("blur.validate-lessThan",function(){a(c).valid()}),b<e.val()},"Please enter a lesser value."),a.validator.addMethod("lessThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThanEqual-blur").length&&e.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",function(){a(c).valid()}),b<=e.val()},"Please enter a lesser value."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please."),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please."),a.validator.addMethod("maxfiles",function(b,c,d){return!!this.optional(c)||!("file"===a(c).attr("type")&&c.files&&c.files.length>d)},a.validator.format("Please select no more than {0} files.")),a.validator.addMethod("maxsize",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0;e<c.files.length;e++)if(c.files[e].size>d)return!1;return!0},a.validator.format("File size must not exceed {0} bytes each.")),a.validator.addMethod("maxsizetotal",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0,f=0;f<c.files.length;f++)if(e+=c.files[f].size,e>d)return!1;return!0},a.validator.format("Total size of all files must not exceed {0} bytes.")),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number."),a.validator.addMethod("mobileRU",function(a,b){var c=a.replace(/\(|\)|\s+|-/g,"");return this.optional(b)||c.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(c)},"Please specify a valid mobile number."),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number."),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("nisBR",function(a){var b,c,d,e,f,g=0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;for(c=parseInt(a.substring(10,11),10),b=parseInt(a.substring(0,10),10),e=2;e<12;e++)f=e,10===e&&(f=2),11===e&&(f=3),g+=b%10*f,b=parseInt(b/10,10);return d=g%11,d=d>1?11-d:0,c===d},"Please specify a valid NIS/PIS number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please."),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonePL",function(a,b){a=a.replace(/\s+/g,"");var c=/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/;return this.optional(b)||c.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number."),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number."),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode."),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state."),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters.")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59."),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format."),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++){if(e=j[b],d=a.slice(b,b+1),8===b&&(g=d),isNaN(d)){for(c=0;c<h.length;c++)if(d.toUpperCase()===h[c]){d=i[c],d*=e,isNaN(g)&&8===c&&(g=h[c]);break}}else d*=e;k+=d}return f=k%11,10===f&&(f="X"),f===g},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid."),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx."),a});
     3 * Copyright (c) 2024 Jörn Zaefferer; Licensed MIT */
     4!function(a){"function"==typeof define&&define.amd?define(["jquery","./jquery.validate.min"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){return function(){function b(a){return a.replace(/<.[^<>]*?>/g," ").replace(/&nbsp;|&#160;/gi," ").replace(/[.(),;:!?%#$'\"_+=\/\-“”’]*/g,"")}a.validator.addMethod("maxWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length<=d},a.validator.format("Please enter {0} words or less.")),a.validator.addMethod("minWords",function(a,c,d){return this.optional(c)||b(a).match(/\b\w+\b/g).length>=d},a.validator.format("Please enter at least {0} words.")),a.validator.addMethod("rangeWords",function(a,c,d){var e=b(a),f=/\b\w+\b/g;return this.optional(c)||e.match(f).length>=d[0]&&e.match(f).length<=d[1]},a.validator.format("Please enter between {0} and {1} words."))}(),a.validator.addMethod("abaRoutingNumber",function(a){var b=0,c=a.split(""),d=c.length;if(9!==d)return!1;for(var e=0;e<d;e+=3)b+=3*parseInt(c[e],10)+7*parseInt(c[e+1],10)+parseInt(c[e+2],10);return 0!==b&&b%10===0},"Please enter a valid routing number."),a.validator.addMethod("accept",function(b,c,d){var e,f,g,h="string"==typeof d?d.replace(/\s/g,""):"image/*",i=this.optional(c);if(i)return i;if("file"===a(c).attr("type")&&(h=h.replace(/[\-\[\]\/\{\}\(\)\+\?\.\\\^\$\|]/g,"\\$&").replace(/,/g,"|").replace(/\/\*/g,"/.*"),c.files&&c.files.length))for(g=new RegExp(".?("+h+")$","i"),e=0;e<c.files.length;e++)if(f=c.files[e],!f.type.match(g))return!1;return!0},a.validator.format("Please enter a value with a valid mimetype.")),a.validator.addMethod("alphanumeric",function(a,b){return this.optional(b)||/^\w+$/i.test(a)},"Letters, numbers, and underscores only please."),a.validator.addMethod("bankaccountNL",function(a,b){if(this.optional(b))return!0;if(!/^[0-9]{9}|([0-9]{2} ){3}[0-9]{3}$/.test(a))return!1;var c,d,e,f=a.replace(/ /g,""),g=0,h=f.length;for(c=0;c<h;c++)d=h-c,e=f.substring(c,c+1),g+=d*e;return g%11===0},"Please specify a valid bank account number."),a.validator.addMethod("bankorgiroaccountNL",function(b,c){return this.optional(c)||a.validator.methods.bankaccountNL.call(this,b,c)||a.validator.methods.giroaccountNL.call(this,b,c)},"Please specify a valid bank or giro account number."),a.validator.addMethod("bic",function(a,b){return this.optional(b)||/^([A-Z]{6}[A-Z2-9][A-NP-Z1-9])(X{3}|[A-WY-Z0-9][A-Z0-9]{2})?$/.test(a.toUpperCase())},"Please specify a valid BIC code."),a.validator.addMethod("cifES",function(a,b){"use strict";function c(a){return a%2===0}if(this.optional(b))return!0;var d,e,f,g,h=new RegExp(/^([ABCDEFGHJKLMNPQRSUVW])(\d{7})([0-9A-J])$/gi),i=a.substring(0,1),j=a.substring(1,8),k=a.substring(8,9),l=0,m=0,n=0;if(9!==a.length||!h.test(a))return!1;for(d=0;d<j.length;d++)e=parseInt(j[d],10),c(d)?(e*=2,n+=e<10?e:e-9):m+=e;return l=m+n,f=(10-l.toString().substr(-1)).toString(),f=parseInt(f,10)>9?"0":f,g="JABCDEFGHI".substr(f,1).toString(),i.match(/[ABEH]/)?k===f:i.match(/[KPQS]/)?k===g:k===f||k===g},"Please specify a valid CIF number."),a.validator.addMethod("cnhBR",function(a){if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var b,c,d,e,f,g,h=0,i=0;if(b=a.charAt(0),new Array(12).join(b)===a)return!1;for(e=0,f=9,g=0;e<9;++e,--f)h+=+(a.charAt(e)*f);for(c=h%11,c>=10&&(c=0,i=2),h=0,e=0,f=1,g=0;e<9;++e,++f)h+=+(a.charAt(e)*f);return d=h%11,d>=10?d=0:d-=i,String(c).concat(d)===a.substr(-2)},"Please specify a valid CNH number."),a.validator.addMethod("cnpjBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/[^\d]+/g,""),14!==a.length)return!1;if("00000000000000"===a||"11111111111111"===a||"22222222222222"===a||"33333333333333"===a||"44444444444444"===a||"55555555555555"===a||"66666666666666"===a||"77777777777777"===a||"88888888888888"===a||"99999999999999"===a)return!1;for(var c=a.length-2,d=a.substring(0,c),e=a.substring(c),f=0,g=c-7,h=c;h>=1;h--)f+=d.charAt(c-h)*g--,g<2&&(g=9);var i=f%11<2?0:11-f%11;if(i!==parseInt(e.charAt(0),10))return!1;c+=1,d=a.substring(0,c),f=0,g=c-7;for(var j=c;j>=1;j--)f+=d.charAt(c-j)*g--,g<2&&(g=9);return i=f%11<2?0:11-f%11,i===parseInt(e.charAt(1),10)},"Please specify a CNPJ value number."),a.validator.addMethod("cpfBR",function(a,b){"use strict";if(this.optional(b))return!0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;var c,d,e,f,g=0;if(c=parseInt(a.substring(9,10),10),d=parseInt(a.substring(10,11),10),e=function(a,b){var c=10*a%11;return 10!==c&&11!==c||(c=0),c===b},""===a||"00000000000"===a||"11111111111"===a||"22222222222"===a||"33333333333"===a||"44444444444"===a||"55555555555"===a||"66666666666"===a||"77777777777"===a||"88888888888"===a||"99999999999"===a)return!1;for(f=1;f<=9;f++)g+=parseInt(a.substring(f-1,f),10)*(11-f);if(e(g,c)){for(g=0,f=1;f<=10;f++)g+=parseInt(a.substring(f-1,f),10)*(12-f);return e(g,d)}return!1},"Please specify a valid CPF number."),a.validator.addMethod("creditcard",function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},"Please enter a valid credit card number."),a.validator.addMethod("creditcardtypes",function(a,b,c){if(/[^0-9\-]+/.test(a))return!1;a=a.replace(/\D/g,"");var d=0;return c.mastercard&&(d|=1),c.visa&&(d|=2),c.amex&&(d|=4),c.dinersclub&&(d|=8),c.enroute&&(d|=16),c.discover&&(d|=32),c.jcb&&(d|=64),c.unknown&&(d|=128),c.all&&(d=255),1&d&&(/^(5[12345])/.test(a)||/^(2[234567])/.test(a))?16===a.length:2&d&&/^(4)/.test(a)?16===a.length:4&d&&/^(3[47])/.test(a)?15===a.length:8&d&&/^(3(0[012345]|[68]))/.test(a)?14===a.length:16&d&&/^(2(014|149))/.test(a)?15===a.length:32&d&&/^(6011)/.test(a)?16===a.length:64&d&&/^(3)/.test(a)?16===a.length:64&d&&/^(2131|1800)/.test(a)?15===a.length:!!(128&d)},"Please enter a valid credit card number."),a.validator.addMethod("currency",function(a,b,c){var d,e="string"==typeof c,f=e?c:c[0],g=!!e||c[1];return f=f.replace(/,/g,""),f=g?f+"]":f+"]?",d="^["+f+"([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$",d=new RegExp(d),this.optional(b)||d.test(a)},"Please specify a valid currency."),a.validator.addMethod("dateFA",function(a,b){return this.optional(b)||/^[1-4]\d{3}\/((0?[1-6]\/((3[0-1])|([1-2][0-9])|(0?[1-9])))|((1[0-2]|(0?[7-9]))\/(30|([1-2][0-9])|(0?[1-9]))))$/.test(a)},a.validator.messages.date),a.validator.addMethod("dateITA",function(a,b){var c,d,e,f,g,h=!1,i=/^\d{1,2}\/\d{1,2}\/\d{4}$/;return i.test(a)?(c=a.split("/"),d=parseInt(c[0],10),e=parseInt(c[1],10),f=parseInt(c[2],10),g=new Date(Date.UTC(f,e-1,d,12,0,0,0)),h=g.getUTCFullYear()===f&&g.getUTCMonth()===e-1&&g.getUTCDate()===d):h=!1,this.optional(b)||h},a.validator.messages.date),a.validator.addMethod("dateNL",function(a,b){return this.optional(b)||/^(0?[1-9]|[12]\d|3[01])[\.\/\-](0?[1-9]|1[012])[\.\/\-]([12]\d)?(\d\d)$/.test(a)},a.validator.messages.date),a.validator.addMethod("extension",function(a,b,c){return c="string"==typeof c?c.replace(/,/g,"|"):"png|jpe?g|gif",this.optional(b)||a.match(new RegExp("\\.("+c+")$","i"))},a.validator.format("Please enter a value with a valid extension.")),a.validator.addMethod("giroaccountNL",function(a,b){return this.optional(b)||/^[0-9]{1,7}$/.test(a)},"Please specify a valid giro account number."),a.validator.addMethod("greaterThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThan-blur").length&&e.addClass("validate-greaterThan-blur").on("blur.validate-greaterThan",function(){a(c).valid()}),b>e.val()},"Please enter a greater value."),a.validator.addMethod("greaterThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-greaterThanEqual-blur").length&&e.addClass("validate-greaterThanEqual-blur").on("blur.validate-greaterThanEqual",function(){a(c).valid()}),b>=e.val()},"Please enter a greater value."),a.validator.addMethod("iban",function(a,b){if(this.optional(b))return!0;var c,d,e,f,g,h,i,j,k,l=a.replace(/ /g,"").toUpperCase(),m="",n=!0,o="",p="",q=5;if(l.length<q)return!1;if(c=l.substring(0,2),h={AL:"\\d{8}[\\dA-Z]{16}",AD:"\\d{8}[\\dA-Z]{12}",AT:"\\d{16}",AZ:"[\\dA-Z]{4}\\d{20}",BE:"\\d{12}",BH:"[A-Z]{4}[\\dA-Z]{14}",BA:"\\d{16}",BR:"\\d{23}[A-Z][\\dA-Z]",BG:"[A-Z]{4}\\d{6}[\\dA-Z]{8}",CR:"\\d{17}",HR:"\\d{17}",CY:"\\d{8}[\\dA-Z]{16}",CZ:"\\d{20}",DK:"\\d{14}",DO:"[A-Z]{4}\\d{20}",EE:"\\d{16}",FO:"\\d{14}",FI:"\\d{14}",FR:"\\d{10}[\\dA-Z]{11}\\d{2}",GE:"[\\dA-Z]{2}\\d{16}",DE:"\\d{18}",GI:"[A-Z]{4}[\\dA-Z]{15}",GR:"\\d{7}[\\dA-Z]{16}",GL:"\\d{14}",GT:"[\\dA-Z]{4}[\\dA-Z]{20}",HU:"\\d{24}",IS:"\\d{22}",IE:"[\\dA-Z]{4}\\d{14}",IL:"\\d{19}",IT:"[A-Z]\\d{10}[\\dA-Z]{12}",KZ:"\\d{3}[\\dA-Z]{13}",KW:"[A-Z]{4}[\\dA-Z]{22}",LV:"[A-Z]{4}[\\dA-Z]{13}",LB:"\\d{4}[\\dA-Z]{20}",LI:"\\d{5}[\\dA-Z]{12}",LT:"\\d{16}",LU:"\\d{3}[\\dA-Z]{13}",MK:"\\d{3}[\\dA-Z]{10}\\d{2}",MT:"[A-Z]{4}\\d{5}[\\dA-Z]{18}",MR:"\\d{23}",MU:"[A-Z]{4}\\d{19}[A-Z]{3}",MC:"\\d{10}[\\dA-Z]{11}\\d{2}",MD:"[\\dA-Z]{2}\\d{18}",ME:"\\d{18}",NL:"[A-Z]{4}\\d{10}",NO:"\\d{11}",PK:"[\\dA-Z]{4}\\d{16}",PS:"[\\dA-Z]{4}\\d{21}",PL:"\\d{24}",PT:"\\d{21}",RO:"[A-Z]{4}[\\dA-Z]{16}",SM:"[A-Z]\\d{10}[\\dA-Z]{12}",SA:"\\d{2}[\\dA-Z]{18}",RS:"\\d{18}",SK:"\\d{20}",SI:"\\d{15}",ES:"\\d{20}",SE:"\\d{20}",CH:"\\d{5}[\\dA-Z]{12}",TN:"\\d{20}",TR:"\\d{5}[\\dA-Z]{17}",AE:"\\d{3}\\d{16}",GB:"[A-Z]{4}\\d{14}",VG:"[\\dA-Z]{4}\\d{16}"},g=h[c],"undefined"!=typeof g&&(i=new RegExp("^[A-Z]{2}\\d{2}"+g+"$",""),!i.test(l)))return!1;for(d=l.substring(4,l.length)+l.substring(0,4),j=0;j<d.length;j++)e=d.charAt(j),"0"!==e&&(n=!1),n||(m+="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ".indexOf(e));for(k=0;k<m.length;k++)f=m.charAt(k),p=""+o+f,o=p%97;return 1===o},"Please specify a valid IBAN."),a.validator.addMethod("integer",function(a,b){return this.optional(b)||/^-?\d+$/.test(a)},"A positive or negative non-decimal number please."),a.validator.addMethod("ipv4",function(a,b){return this.optional(b)||/^(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)\.(25[0-5]|2[0-4]\d|[01]?\d\d?)$/i.test(a)},"Please enter a valid IP v4 address."),a.validator.addMethod("ipv6",function(a,b){return this.optional(b)||/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b)\.){3}(\b((25[0-5])|(1\d{2})|(2[0-4]\d)|(\d{1,2}))\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))$/i.test(a)},"Please enter a valid IP v6 address."),a.validator.addMethod("lessThan",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThan-blur").length&&e.addClass("validate-lessThan-blur").on("blur.validate-lessThan",function(){a(c).valid()}),b<e.val()},"Please enter a lesser value."),a.validator.addMethod("lessThanEqual",function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-lessThanEqual-blur").length&&e.addClass("validate-lessThanEqual-blur").on("blur.validate-lessThanEqual",function(){a(c).valid()}),b<=e.val()},"Please enter a lesser value."),a.validator.addMethod("lettersonly",function(a,b){return this.optional(b)||/^[a-z]+$/i.test(a)},"Letters only please."),a.validator.addMethod("letterswithbasicpunc",function(a,b){return this.optional(b)||/^[a-z\-.,()'"\s]+$/i.test(a)},"Letters or punctuation only please."),a.validator.addMethod("maxfiles",function(b,c,d){return!!this.optional(c)||!("file"===a(c).attr("type")&&c.files&&c.files.length>d)},a.validator.format("Please select no more than {0} files.")),a.validator.addMethod("maxsize",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0;e<c.files.length;e++)if(c.files[e].size>d)return!1;return!0},a.validator.format("File size must not exceed {0} bytes each.")),a.validator.addMethod("maxsizetotal",function(b,c,d){if(this.optional(c))return!0;if("file"===a(c).attr("type")&&c.files&&c.files.length)for(var e=0,f=0;f<c.files.length;f++)if(e+=c.files[f].size,e>d)return!1;return!0},a.validator.format("Total size of all files must not exceed {0} bytes.")),a.validator.addMethod("mobileNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)6((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid mobile number."),a.validator.addMethod("mobileRU",function(a,b){var c=a.replace(/\(|\)|\s+|-/g,"");return this.optional(b)||c.length>9&&/^((\+7|7|8)+([0-9]){10})$/.test(c)},"Please specify a valid mobile number."),a.validator.addMethod("mobileUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)7(?:[1345789]\d{2}|624)\s?\d{3}\s?\d{3})$/)},"Please specify a valid mobile number."),a.validator.addMethod("netmask",function(a,b){return this.optional(b)||/^(254|252|248|240|224|192|128)\.0\.0\.0|255\.(254|252|248|240|224|192|128|0)\.0\.0|255\.255\.(254|252|248|240|224|192|128|0)\.0|255\.255\.255\.(254|252|248|240|224|192|128|0)/i.test(a)},"Please enter a valid netmask."),a.validator.addMethod("nieES",function(a,b){"use strict";if(this.optional(b))return!0;var c,d=new RegExp(/^[MXYZ]{1}[0-9]{7,8}[TRWAGMYFPDXBNJZSQVHLCKET]{1}$/gi),e="TRWAGMYFPDXBNJZSQVHLCKET",f=a.substr(a.length-1).toUpperCase();return a=a.toString().toUpperCase(),!(a.length>10||a.length<9||!d.test(a))&&(a=a.replace(/^[X]/,"0").replace(/^[Y]/,"1").replace(/^[Z]/,"2"),c=9===a.length?a.substr(0,8):a.substr(0,9),e.charAt(parseInt(c,10)%23)===f)},"Please specify a valid NIE number."),a.validator.addMethod("nifES",function(a,b){"use strict";return!!this.optional(b)||(a=a.toUpperCase(),!!a.match("((^[A-Z]{1}[0-9]{7}[A-Z0-9]{1}$|^[T]{1}[A-Z0-9]{8}$)|^[0-9]{8}[A-Z]{1}$)")&&(/^[0-9]{8}[A-Z]{1}$/.test(a)?"TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,0)%23)===a.charAt(8):!!/^[KLM]{1}/.test(a)&&a[8]==="TRWAGMYFPDXBNJZSQVHLCKE".charAt(a.substring(8,1)%23)))},"Please specify a valid NIF number."),a.validator.addMethod("nipPL",function(a){"use strict";if(a=a.replace(/[^0-9]/g,""),10!==a.length)return!1;for(var b=[6,5,7,2,3,4,5,6,7],c=0,d=0;d<9;d++)c+=b[d]*a[d];var e=c%11,f=10===e?0:e;return f===parseInt(a[9],10)},"Please specify a valid NIP number."),a.validator.addMethod("nisBR",function(a){var b,c,d,e,f,g=0;if(a=a.replace(/([~!@#$%^&*()_+=`{}\[\]\-|\\:;'<>,.\/? ])+/g,""),11!==a.length)return!1;for(c=parseInt(a.substring(10,11),10),b=parseInt(a.substring(0,10),10),e=2;e<12;e++)f=e,10===e&&(f=2),11===e&&(f=3),g+=b%10*f,b=parseInt(b/10,10);return d=g%11,d=d>1?11-d:0,c===d},"Please specify a valid NIS/PIS number."),a.validator.addMethod("notEqualTo",function(b,c,d){return this.optional(c)||!a.validator.methods.equalTo.call(this,b,c,d)},"Please enter a different value, values must not be the same."),a.validator.addMethod("nowhitespace",function(a,b){return this.optional(b)||/^\S+$/i.test(a)},"No white space please."),a.validator.addMethod("pattern",function(a,b,c){return!!this.optional(b)||("string"==typeof c&&(c=new RegExp("^(?:"+c+")$")),c.test(a))},"Invalid format."),a.validator.addMethod("phoneNL",function(a,b){return this.optional(b)||/^((\+|00(\s|\s?\-\s?)?)31(\s|\s?\-\s?)?(\(0\)[\-\s]?)?|0)[1-9]((\s|\s?\-\s?)?[0-9]){8}$/.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonePL",function(a,b){a=a.replace(/\s+/g,"");var c=/^(?:(?:(?:\+|00)?48)|(?:\(\+?48\)))?(?:1[2-8]|2[2-69]|3[2-49]|4[1-68]|5[0-9]|6[0-35-9]|[7-8][1-9]|9[145])\d{7}$/;return this.optional(b)||c.test(a)},"Please specify a valid phone number."),a.validator.addMethod("phonesUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?|0)(?:1\d{8,9}|[23]\d{9}|7(?:[1345789]\d{8}|624\d{6})))$/)},"Please specify a valid uk phone number."),a.validator.addMethod("phoneUK",function(a,b){return a=a.replace(/\(|\)|\s+|-/g,""),this.optional(b)||a.length>9&&a.match(/^(?:(?:(?:00\s?|\+)44\s?)|(?:\(?0))(?:\d{2}\)?\s?\d{4}\s?\d{4}|\d{3}\)?\s?\d{3}\s?\d{3,4}|\d{4}\)?\s?(?:\d{5}|\d{3}\s?\d{3})|\d{5}\)?\s?\d{4,5})$/)},"Please specify a valid phone number."),a.validator.addMethod("phoneUS",function(a,b){return a=a.replace(/\s+/g,""),this.optional(b)||a.length>9&&a.match(/^(\+?1-?)?(\([2-9]([02-9]\d|1[02-9])\)|[2-9]([02-9]\d|1[02-9]))-?[2-9]\d{2}-?\d{4}$/)},"Please specify a valid phone number."),a.validator.addMethod("postalcodeBR",function(a,b){return this.optional(b)||/^\d{2}.\d{3}-\d{3}?$|^\d{5}-?\d{3}?$/.test(a)},"Informe um CEP válido."),a.validator.addMethod("postalCodeCA",function(a,b){return this.optional(b)||/^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] *\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeIT",function(a,b){return this.optional(b)||/^\d{5}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postalcodeNL",function(a,b){return this.optional(b)||/^[1-9][0-9]{3}\s?[a-zA-Z]{2}$/.test(a)},"Please specify a valid postal code."),a.validator.addMethod("postcodeUK",function(a,b){return this.optional(b)||/^((([A-PR-UWYZ][0-9])|([A-PR-UWYZ][0-9][0-9])|([A-PR-UWYZ][A-HK-Y][0-9])|([A-PR-UWYZ][A-HK-Y][0-9][0-9])|([A-PR-UWYZ][0-9][A-HJKSTUW])|([A-PR-UWYZ][A-HK-Y][0-9][ABEHMNPRVWXY]))\s?([0-9][ABD-HJLNP-UW-Z]{2})|(GIR)\s?(0AA))$/i.test(a)},"Please specify a valid UK postcode."),a.validator.addMethod("require_from_group",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_req_grp")?f.data("valid_req_grp"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length>=d[0];return f.data("valid_req_grp",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),h},a.validator.format("Please fill at least {0} of these fields.")),a.validator.addMethod("skip_or_fill_minimum",function(b,c,d){var e=a(d[1],c.form),f=e.eq(0),g=f.data("valid_skip")?f.data("valid_skip"):a.extend({},this),h=e.filter(function(){return g.elementValue(this)}).length,i=0===h||h>=d[0];return f.data("valid_skip",g),a(c).data("being_validated")||(e.data("being_validated",!0),e.each(function(){g.element(this)}),e.data("being_validated",!1)),i},a.validator.format("Please either skip these fields or fill at least {0} of them.")),a.validator.addMethod("stateUS",function(a,b,c){var d,e="undefined"==typeof c,f=!e&&"undefined"!=typeof c.caseSensitive&&c.caseSensitive,g=!e&&"undefined"!=typeof c.includeTerritories&&c.includeTerritories,h=!e&&"undefined"!=typeof c.includeMilitary&&c.includeMilitary;return d=g||h?g&&h?"^(A[AEKLPRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":g?"^(A[KLRSZ]|C[AOT]|D[CE]|FL|G[AU]|HI|I[ADLN]|K[SY]|LA|M[ADEINOPST]|N[CDEHJMVY]|O[HKR]|P[AR]|RI|S[CD]|T[NX]|UT|V[AIT]|W[AIVY])$":"^(A[AEKLPRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$":"^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$",d=f?new RegExp(d):new RegExp(d,"i"),this.optional(b)||d.test(a)},"Please specify a valid state."),a.validator.addMethod("strippedminlength",function(b,c,d){return a(b).text().length>=d},a.validator.format("Please enter at least {0} characters.")),a.validator.addMethod("time",function(a,b){return this.optional(b)||/^([01]\d|2[0-3]|[0-9])(:[0-5]\d){1,2}$/.test(a)},"Please enter a valid time, between 00:00 and 23:59."),a.validator.addMethod("time12h",function(a,b){return this.optional(b)||/^((0?[1-9]|1[012])(:[0-5]\d){1,2}(\ ?[AP]M))$/i.test(a)},"Please enter a valid time in 12-hour am/pm format."),a.validator.addMethod("url2",function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?)|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff])|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62}\.)))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},a.validator.messages.url),a.validator.addMethod("vinUS",function(a){if(17!==a.length)return!1;var b,c,d,e,f,g,h=["A","B","C","D","E","F","G","H","J","K","L","M","N","P","R","S","T","U","V","W","X","Y","Z"],i=[1,2,3,4,5,6,7,8,1,2,3,4,5,7,9,2,3,4,5,6,7,8,9],j=[8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2],k=0;for(b=0;b<17;b++)e=j[b],d=a.slice(b,b+1),isNaN(d)?(d=d.toUpperCase(),c=i[h.indexOf(d)]):c=parseInt(d,10),8===b&&(g=c,"X"===d&&(g=10)),k+=c*e;return f=k%11,f===g},"The specified vehicle identification number (VIN) is invalid."),a.validator.addMethod("zipcodeUS",function(a,b){return this.optional(b)||/^\d{5}(-\d{4})?$/.test(a)},"The specified US ZIP Code is invalid."),a.validator.addMethod("ziprange",function(a,b){return this.optional(b)||/^90[2-5]\d\{2\}-\d{4}$/.test(a)},"Your ZIP-code must be in the range 902xx-xxxx to 905xx-xxxx."),a});
  • weight-loss-tracker/trunk/assets/js/libraries/jquery.validate.js

    r3145588 r3158785  
    11/*!
    2  * jQuery Validation Plugin v1.13.1
     2 * jQuery Validation Plugin v1.21.0
    33 *
    4  * http://jqueryvalidation.org/
     4 * https://jqueryvalidation.org/
    55 *
    6  * Copyright (c) 2014 Jörn Zaefferer
     6 * Copyright (c) 2024 Jörn Zaefferer
    77 * Released under the MIT license
    88 */
     
    1010    if ( typeof define === "function" && define.amd ) {
    1111        define( ["jquery"], factory );
     12    } else if (typeof module === "object" && module.exports) {
     13        module.exports = factory( require( "jquery" ) );
    1214    } else {
    1315        factory( jQuery );
     
    1517}(function( $ ) {
    1618
    17 $.extend($.fn, {
    18     // http://jqueryvalidation.org/validate/
     19$.extend( $.fn, {
     20
     21    // https://jqueryvalidation.org/validate/
    1922    validate: function( options ) {
    2023
    21         // if nothing is selected, return nothing; can't chain anyway
     24        // If nothing is selected, return nothing; can't chain anyway
    2225        if ( !this.length ) {
    2326            if ( options && options.debug && window.console ) {
     
    2730        }
    2831
    29         // check if a validator for this form was already created
     32        // Check if a validator for this form was already created
    3033        var validator = $.data( this[ 0 ], "validator" );
    3134        if ( validator ) {
     
    4144        if ( validator.settings.onsubmit ) {
    4245
    43             this.validateDelegate( ":submit", "click", function( event ) {
    44                 if ( validator.settings.submitHandler ) {
    45                     validator.submitButton = event.target;
    46                 }
    47                 // allow suppressing validation by adding a cancel class to the submit button
    48                 if ( $( event.target ).hasClass( "cancel" ) ) {
     46            this.on( "click.validate", ":submit", function( event ) {
     47
     48                // Track the used submit button to properly handle scripted
     49                // submits later.
     50                validator.submitButton = event.currentTarget;
     51
     52                // Allow suppressing validation by adding a cancel class to the submit button
     53                if ( $( this ).hasClass( "cancel" ) ) {
    4954                    validator.cancelSubmit = true;
    5055                }
    5156
    52                 // allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
    53                 if ( $( event.target ).attr( "formnovalidate" ) !== undefined ) {
     57                // Allow suppressing validation by adding the html5 formnovalidate attribute to the submit button
     58                if ( $( this ).attr( "formnovalidate" ) !== undefined ) {
    5459                    validator.cancelSubmit = true;
    5560                }
    56             });
    57 
    58             // validate the form on submit
    59             this.submit( function( event ) {
     61            } );
     62
     63            // Validate the form on submit
     64            this.on( "submit.validate", function( event ) {
    6065                if ( validator.settings.debug ) {
    61                     // prevent form submit to be able to see console output
     66
     67                    // Prevent form submit to be able to see console output
    6268                    event.preventDefault();
    6369                }
     70
    6471                function handle() {
    6572                    var hidden, result;
    66                     if ( validator.settings.submitHandler ) {
    67                         if ( validator.submitButton ) {
    68                             // insert a hidden input as a replacement for the missing submit button
    69                             hidden = $( "<input type='hidden'/>" )
    70                                 .attr( "name", validator.submitButton.name )
    71                                 .val( $( validator.submitButton ).val() )
    72                                 .appendTo( validator.currentForm );
    73                         }
     73
     74                    // Insert a hidden input as a replacement for the missing submit button
     75                    // The hidden input is inserted in two cases:
     76                    //   - A user defined a `submitHandler`
     77                    //   - There was a pending request due to `remote` method and `stopRequest()`
     78                    //     was called to submit the form in case it's valid
     79                    if ( validator.submitButton && ( validator.settings.submitHandler || validator.formSubmitted ) ) {
     80                        hidden = $( "<input type='hidden'/>" )
     81                            .attr( "name", validator.submitButton.name )
     82                            .val( $( validator.submitButton ).val() )
     83                            .appendTo( validator.currentForm );
     84                    }
     85
     86                    if ( validator.settings.submitHandler && !validator.settings.debug ) {
    7487                        result = validator.settings.submitHandler.call( validator, validator.currentForm, event );
    75                         if ( validator.submitButton ) {
    76                             // and clean up afterwards; thanks to no-block-scope, hidden can be referenced
     88                        if ( hidden ) {
     89
     90                            // And clean up afterwards; thanks to no-block-scope, hidden can be referenced
    7791                            hidden.remove();
    7892                        }
     
    8599                }
    86100
    87                 // prevent submit for invalid forms or custom submit handlers
     101                // Prevent submit for invalid forms or custom submit handlers
    88102                if ( validator.cancelSubmit ) {
    89103                    validator.cancelSubmit = false;
     
    100114                    return false;
    101115                }
    102             });
     116            } );
    103117        }
    104118
    105119        return validator;
    106120    },
    107     // http://jqueryvalidation.org/valid/
     121
     122    // https://jqueryvalidation.org/valid/
    108123    valid: function() {
    109         var valid, validator;
     124        var valid, validator, errorList;
    110125
    111126        if ( $( this[ 0 ] ).is( "form" ) ) {
    112127            valid = this.validate().form();
    113128        } else {
     129            errorList = [];
    114130            valid = true;
    115131            validator = $( this[ 0 ].form ).validate();
    116132            this.each( function() {
    117133                valid = validator.element( this ) && valid;
    118             });
     134                if ( !valid ) {
     135                    errorList = errorList.concat( validator.errorList );
     136                }
     137            } );
     138            validator.errorList = errorList;
    119139        }
    120140        return valid;
    121141    },
    122     // attributes: space separated list of attributes to retrieve and remove
    123     removeAttrs: function( attributes ) {
    124         var result = {},
    125             $element = this;
    126         $.each( attributes.split( /\s/ ), function( index, value ) {
    127             result[ value ] = $element.attr( value );
    128             $element.removeAttr( value );
    129         });
    130         return result;
    131     },
    132     // http://jqueryvalidation.org/rules/
     142
     143    // https://jqueryvalidation.org/rules/
    133144    rules: function( command, argument ) {
    134145        var element = this[ 0 ],
     146            isContentEditable = typeof this.attr( "contenteditable" ) !== "undefined" && this.attr( "contenteditable" ) !== "false",
    135147            settings, staticRules, existingRules, data, param, filtered;
     148
     149        // If nothing is selected, return empty object; can't chain anyway
     150        if ( element == null ) {
     151            return;
     152        }
     153
     154        if ( !element.form && isContentEditable ) {
     155            element.form = this.closest( "form" )[ 0 ];
     156            element.name = this.attr( "name" );
     157        }
     158
     159        if ( element.form == null ) {
     160            return;
     161        }
    136162
    137163        if ( command ) {
     
    142168            case "add":
    143169                $.extend( existingRules, $.validator.normalizeRule( argument ) );
    144                 // remove messages from rules, but allow them to be set separately
     170
     171                // Remove messages from rules, but allow them to be set separately
    145172                delete existingRules.messages;
    146173                staticRules[ element.name ] = existingRules;
     
    158185                    filtered[ method ] = existingRules[ method ];
    159186                    delete existingRules[ method ];
    160                     if ( method === "required" ) {
    161                         $( element ).removeAttr( "aria-required" );
    162                     }
    163                 });
     187                } );
    164188                return filtered;
    165189            }
     
    175199        ), element );
    176200
    177         // make sure required is at front
     201        // Make sure required is at front
    178202        if ( data.required ) {
    179203            param = data.required;
    180204            delete data.required;
    181205            data = $.extend( { required: param }, data );
    182             $( element ).attr( "aria-required", "true" );
    183         }
    184 
    185         // make sure remote is at back
     206        }
     207
     208        // Make sure remote is at back
    186209        if ( data.remote ) {
    187210            param = data.remote;
    188211            delete data.remote;
    189             data = $.extend( data, { remote: param });
     212            data = $.extend( data, { remote: param } );
    190213        }
    191214
    192215        return data;
    193216    }
    194 });
     217} );
     218
     219// JQuery trim is deprecated, provide a trim method based on String.prototype.trim
     220var trim = function( str ) {
     221
     222    // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trim#Polyfill
     223    return str.replace( /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "" );
     224};
    195225
    196226// Custom selectors
    197 $.extend( $.expr[ ":" ], {
    198     // http://jqueryvalidation.org/blank-selector/
     227$.extend( $.expr.pseudos || $.expr[ ":" ], {        // '|| $.expr[ ":" ]' here enables backwards compatibility to jQuery 1.7. Can be removed when dropping jQ 1.7.x support
     228
     229    // https://jqueryvalidation.org/blank-selector/
    199230    blank: function( a ) {
    200         return !$.trim( "" + $( a ).val() );
     231        return !trim( "" + $( a ).val() );
    201232    },
    202     // http://jqueryvalidation.org/filled-selector/
     233
     234    // https://jqueryvalidation.org/filled-selector/
    203235    filled: function( a ) {
    204         return !!$.trim( "" + $( a ).val() );
     236        var val = $( a ).val();
     237        return val !== null && !!trim( "" + val );
    205238    },
    206     // http://jqueryvalidation.org/unchecked-selector/
     239
     240    // https://jqueryvalidation.org/unchecked-selector/
    207241    unchecked: function( a ) {
    208242        return !$( a ).prop( "checked" );
    209243    }
    210 });
    211 
    212 // constructor for validator
     244} );
     245
     246// Constructor for validator
    213247$.validator = function( options, form ) {
    214248    this.settings = $.extend( true, {}, $.validator.defaults, options );
     
    217251};
    218252
    219 // http://jqueryvalidation.org/jQuery.validator.format/
     253// https://jqueryvalidation.org/jQuery.validator.format/
    220254$.validator.format = function( source, params ) {
    221255    if ( arguments.length === 1 ) {
     
    225259            return $.validator.format.apply( this, args );
    226260        };
     261    }
     262    if ( params === undefined ) {
     263        return source;
    227264    }
    228265    if ( arguments.length > 2 && params.constructor !== Array  ) {
     
    235272        source = source.replace( new RegExp( "\\{" + i + "\\}", "g" ), function() {
    236273            return n;
    237         });
    238     });
     274        } );
     275    } );
    239276    return source;
    240277};
     
    247284        rules: {},
    248285        errorClass: "error",
     286        pendingClass: "pending",
    249287        validClass: "valid",
    250288        errorElement: "label",
     
    256294        ignore: ":hidden",
    257295        ignoreTitle: false,
     296        customElements: [],
    258297        onfocusin: function( element ) {
    259298            this.lastActive = element;
     
    273312        },
    274313        onkeyup: function( element, event ) {
    275             if ( event.which === 9 && this.elementValue( element ) === "" ) {
     314
     315            // Avoid revalidate the field when pressing one of the following keys
     316            // Shift       => 16
     317            // Ctrl        => 17
     318            // Alt         => 18
     319            // Caps lock   => 20
     320            // End         => 35
     321            // Home        => 36
     322            // Left arrow  => 37
     323            // Up arrow    => 38
     324            // Right arrow => 39
     325            // Down arrow  => 40
     326            // Insert      => 45
     327            // Num lock    => 144
     328            // AltGr key   => 225
     329            var excludedKeys = [
     330                16, 17, 18, 20, 35, 36, 37,
     331                38, 39, 40, 45, 144, 225
     332            ];
     333
     334            if ( event.which === 9 && this.elementValue( element ) === "" || $.inArray( event.keyCode, excludedKeys ) !== -1 ) {
    276335                return;
    277             } else if ( element.name in this.submitted || element === this.lastElement ) {
     336            } else if ( element.name in this.submitted || element.name in this.invalid ) {
    278337                this.element( element );
    279338            }
    280339        },
    281340        onclick: function( element ) {
    282             // click on selects, radiobuttons and checkboxes
     341
     342            // Click on selects, radiobuttons and checkboxes
    283343            if ( element.name in this.submitted ) {
    284344                this.element( element );
    285345
    286             // or option elements, check parent select in that case
     346            // Or option elements, check parent select in that case
    287347            } else if ( element.parentNode.name in this.submitted ) {
    288348                this.element( element.parentNode );
     
    305365    },
    306366
    307     // http://jqueryvalidation.org/jQuery.validator.setDefaults/
     367    // https://jqueryvalidation.org/jQuery.validator.setDefaults/
    308368    setDefaults: function( settings ) {
    309369        $.extend( $.validator.defaults, settings );
     
    316376        url: "Please enter a valid URL.",
    317377        date: "Please enter a valid date.",
    318         dateISO: "Please enter a valid date ( ISO ).",
     378        dateISO: "Please enter a valid date (ISO).",
    319379        number: "Please enter a valid number.",
    320380        digits: "Please enter only digits.",
    321         creditcard: "Please enter a valid credit card number.",
    322381        equalTo: "Please enter the same value again.",
    323382        maxlength: $.validator.format( "Please enter no more than {0} characters." ),
     
    326385        range: $.validator.format( "Please enter a value between {0} and {1}." ),
    327386        max: $.validator.format( "Please enter a value less than or equal to {0}." ),
    328         min: $.validator.format( "Please enter a value greater than or equal to {0}." )
     387        min: $.validator.format( "Please enter a value greater than or equal to {0}." ),
     388        step: $.validator.format( "Please enter a multiple of {0}." )
    329389    },
    330390
     
    344404            this.reset();
    345405
    346             var groups = ( this.groups = {} ),
     406            var currentForm = this.currentForm,
     407                groups = ( this.groups = {} ),
    347408                rules;
    348409            $.each( this.settings.groups, function( key, value ) {
     
    352413                $.each( value, function( index, name ) {
    353414                    groups[ name ] = key;
    354                 });
    355             });
     415                } );
     416            } );
    356417            rules = this.settings.rules;
    357418            $.each( rules, function( key, value ) {
    358419                rules[ key ] = $.validator.normalizeRule( value );
    359             });
     420            } );
    360421
    361422            function delegate( event ) {
    362                 var validator = $.data( this[ 0 ].form, "validator" ),
     423                var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
     424
     425                // Set form expando on contenteditable
     426                if ( !this.form && isContentEditable ) {
     427                    this.form = $( this ).closest( "form" )[ 0 ];
     428                    this.name = $( this ).attr( "name" );
     429                }
     430
     431                // Ignore the element if it belongs to another form. This will happen mainly
     432                // when setting the `form` attribute of an input to the id of another form.
     433                if ( currentForm !== this.form ) {
     434                    return;
     435                }
     436
     437                var validator = $.data( this.form, "validator" ),
    363438                    eventType = "on" + event.type.replace( /^validate/, "" ),
    364439                    settings = validator.settings;
    365                 if ( settings[ eventType ] && !this.is( settings.ignore ) ) {
    366                     settings[ eventType ].call( validator, this[ 0 ], event );
    367                 }
    368             }
     440                if ( settings[ eventType ] && !$( this ).is( settings.ignore ) ) {
     441                    settings[ eventType ].call( validator, this, event );
     442                }
     443            }
     444            var focusListeners = [ ":text", "[type='password']", "[type='file']", "select", "textarea", "[type='number']", "[type='search']",
     445                                "[type='tel']", "[type='url']", "[type='email']", "[type='datetime']", "[type='date']", "[type='month']",
     446                                "[type='week']", "[type='time']", "[type='datetime-local']", "[type='range']", "[type='color']",
     447                                "[type='radio']", "[type='checkbox']", "[contenteditable]", "[type='button']" ];
     448            var clickListeners = [ "select", "option", "[type='radio']", "[type='checkbox']" ];
    369449            $( this.currentForm )
    370                 .validateDelegate( ":text, [type='password'], [type='file'], select, textarea, " +
    371                     "[type='number'], [type='search'] ,[type='tel'], [type='url'], " +
    372                     "[type='email'], [type='datetime'], [type='date'], [type='month'], " +
    373                     "[type='week'], [type='time'], [type='datetime-local'], " +
    374                     "[type='range'], [type='color'], [type='radio'], [type='checkbox']",
    375                     "focusin focusout keyup", delegate)
     450                .on( "focusin.validate focusout.validate keyup.validate", focusListeners.concat( this.settings.customElements ).join( ", " ), delegate )
     451
    376452                // Support: Chrome, oldIE
    377453                // "select" is provided as event.target when clicking a option
    378                 .validateDelegate("select, option, [type='radio'], [type='checkbox']", "click", delegate);
     454                .on( "click.validate", clickListeners.concat( this.settings.customElements ).join( ", " ), delegate );
    379455
    380456            if ( this.settings.invalidHandler ) {
    381                 $( this.currentForm ).bind( "invalid-form.validate", this.settings.invalidHandler );
    382             }
    383 
    384             // Add aria-required to any Static/Data/Class required fields before first validation
    385             // Screen readers require this attribute to be present before the initial submission http://www.w3.org/TR/WCAG-TECHS/ARIA2.html
    386             $( this.currentForm ).find( "[required], [data-rule-required], .required" ).attr( "aria-required", "true" );
    387         },
    388 
    389         // http://jqueryvalidation.org/Validator.form/
     457                $( this.currentForm ).on( "invalid-form.validate", this.settings.invalidHandler );
     458            }
     459        },
     460
     461        // https://jqueryvalidation.org/Validator.form/
    390462        form: function() {
    391463            this.checkForm();
    392464            $.extend( this.submitted, this.errorMap );
    393             this.invalid = $.extend({}, this.errorMap );
     465            this.invalid = $.extend( {}, this.errorMap );
    394466            if ( !this.valid() ) {
    395                 $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
     467                $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
    396468            }
    397469            this.showErrors();
     
    407479        },
    408480
    409         // http://jqueryvalidation.org/Validator.element/
     481        // https://jqueryvalidation.org/Validator.element/
    410482        element: function( element ) {
    411483            var cleanElement = this.clean( element ),
    412484                checkElement = this.validationTargetFor( cleanElement ),
    413                 result = true;
    414 
    415             this.lastElement = checkElement;
     485                v = this,
     486                result = true,
     487                rs, group;
    416488
    417489            if ( checkElement === undefined ) {
     
    421493                this.currentElements = $( checkElement );
    422494
    423                 result = this.check( checkElement ) !== false;
    424                 if ( result ) {
    425                     delete this.invalid[ checkElement.name ];
     495                // If this element is grouped, then validate all group elements already
     496                // containing a value
     497                group = this.groups[ checkElement.name ];
     498                if ( group ) {
     499                    $.each( this.groups, function( name, testgroup ) {
     500                        if ( testgroup === group && name !== checkElement.name ) {
     501                            cleanElement = v.validationTargetFor( v.clean( v.findByName( name ) ) );
     502                            if ( cleanElement && cleanElement.name in v.invalid ) {
     503                                v.currentElements.push( cleanElement );
     504                                result = v.check( cleanElement ) && result;
     505                            }
     506                        }
     507                    } );
     508                }
     509
     510                rs = this.check( checkElement ) !== false;
     511                result = result && rs;
     512                if ( rs ) {
     513                    this.invalid[ checkElement.name ] = false;
    426514                } else {
    427515                    this.invalid[ checkElement.name ] = true;
    428516                }
    429             }
    430             // Add aria-invalid status for screen readers
    431             $( element ).attr( "aria-invalid", !result );
    432 
    433             if ( !this.numberOfInvalids() ) {
    434                 // Hide error containers on last error
    435                 this.toHide = this.toHide.add( this.containers );
    436             }
    437             this.showErrors();
     517
     518                if ( !this.numberOfInvalids() ) {
     519
     520                    // Hide error containers on last error
     521                    this.toHide = this.toHide.add( this.containers );
     522                }
     523                this.showErrors();
     524
     525                // Add aria-invalid status for screen readers
     526                $( element ).attr( "aria-invalid", !rs );
     527            }
     528
    438529            return result;
    439530        },
    440531
    441         // http://jqueryvalidation.org/Validator.showErrors/
     532        // https://jqueryvalidation.org/Validator.showErrors/
    442533        showErrors: function( errors ) {
    443534            if ( errors ) {
    444                 // add items to error list and map
     535                var validator = this;
     536
     537                // Add items to error list and map
    445538                $.extend( this.errorMap, errors );
    446                 this.errorList = [];
    447                 for ( var name in errors ) {
    448                     this.errorList.push({
    449                         message: errors[ name ],
    450                         element: this.findByName( name )[ 0 ]
    451                     });
    452                 }
    453                 // remove items from success list
     539                this.errorList = $.map( this.errorMap, function( message, name ) {
     540                    return {
     541                        message: message,
     542                        element: validator.findByName( name )[ 0 ]
     543                    };
     544                } );
     545
     546                // Remove items from success list
    454547                this.successList = $.grep( this.successList, function( element ) {
    455548                    return !( element.name in errors );
    456                 });
     549                } );
    457550            }
    458551            if ( this.settings.showErrors ) {
     
    463556        },
    464557
    465         // http://jqueryvalidation.org/Validator.resetForm/
     558        // https://jqueryvalidation.org/Validator.resetForm/
    466559        resetForm: function() {
    467560            if ( $.fn.resetForm ) {
    468561                $( this.currentForm ).resetForm();
    469562            }
     563            this.invalid = {};
    470564            this.submitted = {};
    471             this.lastElement = null;
    472565            this.prepareForm();
    473566            this.hideErrors();
    474             this.elements()
     567            var elements = this.elements()
     568                .removeData( "previousValue" )
     569                .removeAttr( "aria-invalid" );
     570
     571            this.resetElements( elements );
     572        },
     573
     574        resetElements: function( elements ) {
     575            var i;
     576
     577            if ( this.settings.unhighlight ) {
     578                for ( i = 0; elements[ i ]; i++ ) {
     579                    this.settings.unhighlight.call( this, elements[ i ],
     580                        this.settings.errorClass, "" );
     581                    this.findByName( elements[ i ].name ).removeClass( this.settings.validClass );
     582                }
     583            } else {
     584                elements
    475585                    .removeClass( this.settings.errorClass )
    476                     .removeData( "previousValue" )
    477                     .removeAttr( "aria-invalid" );
     586                    .removeClass( this.settings.validClass );
     587            }
    478588        },
    479589
     
    487597                i;
    488598            for ( i in obj ) {
    489                 count++;
     599
     600                // This check allows counting elements with empty error
     601                // message as invalid elements
     602                if ( obj[ i ] !== undefined && obj[ i ] !== null && obj[ i ] !== false ) {
     603                    count++;
     604                }
    490605            }
    491606            return count;
     
    512627            if ( this.settings.focusInvalid ) {
    513628                try {
    514                     $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [])
     629                    $( this.findLastActive() || this.errorList.length && this.errorList[ 0 ].element || [] )
    515630                    .filter( ":visible" )
    516                     .focus()
    517                     // manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
     631                    .trigger( "focus" )
     632
     633                    // Manually trigger focusin event; without it, focusin handler isn't called, findLastActive won't have anything to find
    518634                    .trigger( "focusin" );
    519635                } catch ( e ) {
    520                     // ignore IE throwing errors when focusing hidden elements
     636
     637                    // Ignore IE throwing errors when focusing hidden elements
    521638                }
    522639            }
     
    527644            return lastActive && $.grep( this.errorList, function( n ) {
    528645                return n.element.name === lastActive.name;
    529             }).length === 1 && lastActive;
     646            } ).length === 1 && lastActive;
    530647        },
    531648
    532649        elements: function() {
    533650            var validator = this,
    534                 rulesCache = {};
    535 
    536             // select all valid inputs inside the form (no submit or reset buttons)
     651                rulesCache = {},
     652                selectors = [ "input", "select", "textarea", "[contenteditable]" ];
     653
     654            // Select all valid inputs inside the form (no submit or reset buttons)
    537655            return $( this.currentForm )
    538             .find( "input, select, textarea" )
    539             .not( ":submit, :reset, :image, [disabled], [readonly]" )
     656            .find( selectors.concat( this.settings.customElements ).join( ", " ) )
     657            .not( ":submit, :reset, :image, :disabled" )
    540658            .not( this.settings.ignore )
    541659            .filter( function() {
    542                 if ( !this.name && validator.settings.debug && window.console ) {
     660                var name = this.name || $( this ).attr( "name" ); // For contenteditable
     661                var isContentEditable = typeof $( this ).attr( "contenteditable" ) !== "undefined" && $( this ).attr( "contenteditable" ) !== "false";
     662
     663                if ( !name && validator.settings.debug && window.console ) {
    543664                    console.error( "%o has no name assigned", this );
    544665                }
    545666
    546                 // select only the first element for each name, and only those with rules specified
    547                 if ( this.name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
     667                // Set form expando on contenteditable
     668                if ( isContentEditable ) {
     669                    this.form = $( this ).closest( "form" )[ 0 ];
     670                    this.name = name;
     671                }
     672
     673                // Ignore elements that belong to other/nested forms
     674                if ( this.form !== validator.currentForm ) {
    548675                    return false;
    549676                }
    550677
    551                 rulesCache[ this.name ] = true;
     678                // Select only the first element for each name, and only those with rules specified
     679                if ( name in rulesCache || !validator.objectLength( $( this ).rules() ) ) {
     680                    return false;
     681                }
     682
     683                rulesCache[ name ] = true;
    552684                return true;
    553             });
     685            } );
    554686        },
    555687
     
    563695        },
    564696
    565         reset: function() {
     697        resetInternals: function() {
    566698            this.successList = [];
    567699            this.errorList = [];
     
    569701            this.toShow = $( [] );
    570702            this.toHide = $( [] );
     703        },
     704
     705        reset: function() {
     706            this.resetInternals();
    571707            this.currentElements = $( [] );
    572708        },
     
    583719
    584720        elementValue: function( element ) {
    585             var val,
    586                 $element = $( element ),
    587                 type = element.type;
     721            var $element = $( element ),
     722                type = element.type,
     723                isContentEditable = typeof $element.attr( "contenteditable" ) !== "undefined" && $element.attr( "contenteditable" ) !== "false",
     724                val, idx;
    588725
    589726            if ( type === "radio" || type === "checkbox" ) {
    590                 return $( "input[name='" + element.name + "']:checked" ).val();
     727                return this.findByName( element.name ).filter( ":checked" ).val();
    591728            } else if ( type === "number" && typeof element.validity !== "undefined" ) {
    592                 return element.validity.badInput ? false : $element.val();
    593             }
    594 
    595             val = $element.val();
     729                return element.validity.badInput ? "NaN" : $element.val();
     730            }
     731
     732            if ( isContentEditable ) {
     733                val = $element.text();
     734            } else {
     735                val = $element.val();
     736            }
     737
     738            if ( type === "file" ) {
     739
     740                // Modern browser (chrome & safari)
     741                if ( val.substr( 0, 12 ) === "C:\\fakepath\\" ) {
     742                    return val.substr( 12 );
     743                }
     744
     745                // Legacy browsers
     746                // Unix-based path
     747                idx = val.lastIndexOf( "/" );
     748                if ( idx >= 0 ) {
     749                    return val.substr( idx + 1 );
     750                }
     751
     752                // Windows-based path
     753                idx = val.lastIndexOf( "\\" );
     754                if ( idx >= 0 ) {
     755                    return val.substr( idx + 1 );
     756                }
     757
     758                // Just the file name
     759                return val;
     760            }
     761
    596762            if ( typeof val === "string" ) {
    597                 return val.replace(/\r/g, "" );
     763                return val.replace( /\r/g, "" );
    598764            }
    599765            return val;
     
    606772                rulesCount = $.map( rules, function( n, i ) {
    607773                    return i;
    608                 }).length,
     774                } ).length,
    609775                dependencyMismatch = false,
    610776                val = this.elementValue( element ),
    611                 result, method, rule;
     777                result, method, rule, normalizer;
     778
     779            // Abort any pending Ajax request from a previous call to this method.
     780            this.abortRequest( element );
     781
     782            // Prioritize the local normalizer defined for this element over the global one
     783            // if the former exists, otherwise user the global one in case it exists.
     784            if ( typeof rules.normalizer === "function" ) {
     785                normalizer = rules.normalizer;
     786            } else if ( typeof this.settings.normalizer === "function" ) {
     787                normalizer = this.settings.normalizer;
     788            }
     789
     790            // If normalizer is defined, then call it to retreive the changed value instead
     791            // of using the real one.
     792            // Note that `this` in the normalizer is `element`.
     793            if ( normalizer ) {
     794                val = normalizer.call( element, val );
     795
     796                // Delete the normalizer from rules to avoid treating it as a pre-defined method.
     797                delete rules.normalizer;
     798            }
    612799
    613800            for ( method in rules ) {
    614801                rule = { method: method, parameters: rules[ method ] };
    615802                try {
    616 
    617803                    result = $.validator.methods[ method ].call( this, val, element, rule.parameters );
    618804
    619                     // if a method indicates that the field is optional and therefore valid,
     805                    // If a method indicates that the field is optional and therefore valid,
    620806                    // don't mark it as valid when there are no other rules
    621807                    if ( result === "dependency-mismatch" && rulesCount === 1 ) {
     
    638824                        console.log( "Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.", e );
    639825                    }
     826                    if ( e instanceof TypeError ) {
     827                        e.message += ".  Exception occurred when checking element " + element.id + ", check the '" + rule.method + "' method.";
     828                    }
     829
    640830                    throw e;
    641831                }
     
    650840        },
    651841
    652         // return the custom message for the given element and validation method
     842        // Return the custom message for the given element and validation method
    653843        // specified in the element's HTML5 data attribute
    654844        // return the generic message if present and no method specific message is present
     
    658848        },
    659849
    660         // return the custom message for the given element name and validation method
     850        // Return the custom message for the given element name and validation method
    661851        customMessage: function( name, method ) {
    662852            var m = this.settings.messages[ name ];
    663             return m && ( m.constructor === String ? m : m[ method ]);
    664         },
    665 
    666         // return the first defined argument, allowing empty strings
     853            return m && ( m.constructor === String ? m : m[ method ] );
     854        },
     855
     856        // Return the first defined argument, allowing empty strings
    667857        findDefined: function() {
    668             for ( var i = 0; i < arguments.length; i++) {
     858            for ( var i = 0; i < arguments.length; i++ ) {
    669859                if ( arguments[ i ] !== undefined ) {
    670860                    return arguments[ i ];
     
    674864        },
    675865
    676         defaultMessage: function( element, method ) {
    677             return this.findDefined(
    678                 this.customMessage( element.name, method ),
    679                 this.customDataMessage( element, method ),
    680                 // title is never undefined, so handle empty string as undefined
    681                 !this.settings.ignoreTitle && element.title || undefined,
    682                 $.validator.messages[ method ],
    683                 "<strong>Warning: No message defined for " + element.name + "</strong>"
    684             );
    685         },
    686 
    687         formatAndAdd: function( element, rule ) {
    688             var message = this.defaultMessage( element, rule.method ),
     866        // The second parameter 'rule' used to be a string, and extended to an object literal
     867        // of the following form:
     868        // rule = {
     869        //     method: "method name",
     870        //     parameters: "the given method parameters"
     871        // }
     872        //
     873        // The old behavior still supported, kept to maintain backward compatibility with
     874        // old code, and will be removed in the next major release.
     875        defaultMessage: function( element, rule ) {
     876            if ( typeof rule === "string" ) {
     877                rule = { method: rule };
     878            }
     879
     880            var message = this.findDefined(
     881                    this.customMessage( element.name, rule.method ),
     882                    this.customDataMessage( element, rule.method ),
     883
     884                    // 'title' is never undefined, so handle empty string as undefined
     885                    !this.settings.ignoreTitle && element.title || undefined,
     886                    $.validator.messages[ rule.method ],
     887                    "<strong>Warning: No message defined for " + element.name + "</strong>"
     888                ),
    689889                theregex = /\$?\{(\d+)\}/g;
    690890            if ( typeof message === "function" ) {
     
    693893                message = $.validator.format( message.replace( theregex, "{$1}" ), rule.parameters );
    694894            }
    695             this.errorList.push({
     895
     896            return message;
     897        },
     898
     899        formatAndAdd: function( element, rule ) {
     900            var message = this.defaultMessage( element, rule );
     901
     902            this.errorList.push( {
    696903                message: message,
    697904                element: element,
    698905                method: rule.method
    699             });
     906            } );
    700907
    701908            this.errorMap[ element.name ] = message;
     
    742949
    743950        invalidElements: function() {
    744             return $( this.errorList ).map(function() {
     951            return $( this.errorList ).map( function() {
    745952                return this.element;
    746             });
     953            } );
    747954        },
    748955
    749956        showLabel: function( element, message ) {
    750             var place, group, errorID,
     957            var place, group, errorID, v,
    751958                error = this.errorsFor( element ),
    752959                elementID = this.idOrName( element ),
    753960                describedBy = $( element ).attr( "aria-describedby" );
     961
    754962            if ( error.length ) {
    755                 // refresh error/success class
     963
     964                // Refresh error/success class
    756965                error.removeClass( this.settings.validClass ).addClass( this.settings.errorClass );
    757                 // replace message on existing label
    758                 error.html( message );
     966
     967                // Replace message on existing label
     968                if ( this.settings && this.settings.escapeHtml ) {
     969                    error.text( message || "" );
     970                } else {
     971                    error.html( message || "" );
     972                }
    759973            } else {
    760                 // create error element
     974
     975                // Create error element
    761976                error = $( "<" + this.settings.errorElement + ">" )
    762977                    .attr( "id", elementID + "-error" )
    763                     .addClass( this.settings.errorClass )
    764                     .html( message || "" );
     978                    .addClass( this.settings.errorClass );
     979
     980                if ( this.settings && this.settings.escapeHtml ) {
     981                    error.text( message || "" );
     982                } else {
     983                    error.html( message || "" );
     984                }
    765985
    766986                // Maintain reference to the element to be placed into the DOM
    767987                place = error;
    768988                if ( this.settings.wrapper ) {
    769                     // make sure the element is visible, even in IE
     989
     990                    // Make sure the element is visible, even in IE
    770991                    // actually showing the wrapped element is handled elsewhere
    771992                    place = error.hide().show().wrap( "<" + this.settings.wrapper + "/>" ).parent();
     
    774995                    this.labelContainer.append( place );
    775996                } else if ( this.settings.errorPlacement ) {
    776                     this.settings.errorPlacement( place, $( element ) );
     997                    this.settings.errorPlacement.call( this, place, $( element ) );
    777998                } else {
    778999                    place.insertAfter( element );
     
    7811002                // Link error back to the element
    7821003                if ( error.is( "label" ) ) {
     1004
    7831005                    // If the error is a label, then associate using 'for'
    7841006                    error.attr( "for", elementID );
    785                 } else if ( error.parents( "label[for='" + elementID + "']" ).length === 0 ) {
     1007
    7861008                    // If the element is not a child of an associated label, then it's necessary
    7871009                    // to explicitly apply aria-describedby
    788 
    789                     errorID = error.attr( "id" ).replace( /(:|\.|\[|\])/g, "\\$1");
     1010                } else if ( error.parents( "label[for='" + this.escapeCssMeta( elementID ) + "']" ).length === 0 ) {
     1011                    errorID = error.attr( "id" );
     1012
    7901013                    // Respect existing non-error aria-describedby
    7911014                    if ( !describedBy ) {
    7921015                        describedBy = errorID;
    793                     } else if ( !describedBy.match( new RegExp( "\\b" + errorID + "\\b" ) ) ) {
     1016                    } else if ( !describedBy.match( new RegExp( "\\b" + this.escapeCssMeta( errorID ) + "\\b" ) ) ) {
     1017
    7941018                        // Add to end of list if not already present
    7951019                        describedBy += " " + errorID;
     
    8001024                    group = this.groups[ element.name ];
    8011025                    if ( group ) {
    802                         $.each( this.groups, function( name, testgroup ) {
     1026                        v = this;
     1027                        $.each( v.groups, function( name, testgroup ) {
    8031028                            if ( testgroup === group ) {
    804                                 $( "[name='" + name + "']", this.currentForm )
     1029                                $( "[name='" + v.escapeCssMeta( name ) + "']", v.currentForm )
    8051030                                    .attr( "aria-describedby", error.attr( "id" ) );
    8061031                            }
    807                         });
     1032                        } );
    8081033                    }
    8091034                }
     
    8211046
    8221047        errorsFor: function( element ) {
    823             var name = this.idOrName( element ),
     1048            var name = this.escapeCssMeta( this.idOrName( element ) ),
    8241049                describer = $( element ).attr( "aria-describedby" ),
    8251050                selector = "label[for='" + name + "'], label[for='" + name + "'] *";
    8261051
    827             // aria-describedby should directly reference the error element
     1052            // 'aria-describedby' should directly reference the error element
    8281053            if ( describer ) {
    829                 selector = selector + ", #" + describer.replace( /\s+/g, ", #" );
    830             }
     1054                selector = selector + ", #" + this.escapeCssMeta( describer )
     1055                    .replace( /\s+/g, ", #" );
     1056            }
     1057
    8311058            return this
    8321059                .errors()
     
    8341061        },
    8351062
     1063        // See https://api.jquery.com/category/selectors/, for CSS
     1064        // meta-characters that should be escaped in order to be used with JQuery
     1065        // as a literal part of a name/id or any selector.
     1066        escapeCssMeta: function( string ) {
     1067            if ( string === undefined ) {
     1068                return "";
     1069            }
     1070
     1071            return string.replace( /([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g, "\\$1" );
     1072        },
     1073
    8361074        idOrName: function( element ) {
    8371075            return this.groups[ element.name ] || ( this.checkable( element ) ? element.name : element.id || element.name );
     
    8541092
    8551093        findByName: function( name ) {
    856             return $( this.currentForm ).find( "[name='" + name + "']" );
     1094            return $( this.currentForm ).find( "[name='" + this.escapeCssMeta( name ) + "']" );
    8571095        },
    8581096
     
    8701108
    8711109        depend: function( param, element ) {
    872             return this.dependTypes[typeof param] ? this.dependTypes[typeof param]( param, element ) : true;
     1110            return this.dependTypes[ typeof param ] ? this.dependTypes[ typeof param ]( param, element ) : true;
    8731111        },
    8741112
     
    8901128        },
    8911129
     1130        elementAjaxPort: function( element ) {
     1131            return "validate" + element.name;
     1132        },
     1133
    8921134        startRequest: function( element ) {
    8931135            if ( !this.pending[ element.name ] ) {
    8941136                this.pendingRequest++;
     1137                $( element ).addClass( this.settings.pendingClass );
    8951138                this.pending[ element.name ] = true;
    8961139            }
     
    8991142        stopRequest: function( element, valid ) {
    9001143            this.pendingRequest--;
    901             // sometimes synchronization fails, make sure pendingRequest is never < 0
     1144
     1145            // Sometimes synchronization fails, make sure pendingRequest is never < 0
    9021146            if ( this.pendingRequest < 0 ) {
    9031147                this.pendingRequest = 0;
    9041148            }
    9051149            delete this.pending[ element.name ];
    906             if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() ) {
    907                 $( this.currentForm ).submit();
     1150            $( element ).removeClass( this.settings.pendingClass );
     1151            if ( valid && this.pendingRequest === 0 && this.formSubmitted && this.form() && this.pendingRequest === 0 ) {
     1152                $( this.currentForm ).trigger( "submit" );
     1153
     1154                // Remove the hidden input that was used as a replacement for the
     1155                // missing submit button. The hidden input is added by `handle()`
     1156                // to ensure that the value of the used submit button is passed on
     1157                // for scripted submits triggered by this method
     1158                if ( this.submitButton ) {
     1159                    $( "input:hidden[name='" + this.submitButton.name + "']", this.currentForm ).remove();
     1160                }
     1161
    9081162                this.formSubmitted = false;
    909             } else if (!valid && this.pendingRequest === 0 && this.formSubmitted ) {
    910                 $( this.currentForm ).triggerHandler( "invalid-form", [ this ]);
     1163            } else if ( !valid && this.pendingRequest === 0 && this.formSubmitted ) {
     1164                $( this.currentForm ).triggerHandler( "invalid-form", [ this ] );
    9111165                this.formSubmitted = false;
    9121166            }
    9131167        },
    9141168
    915         previousValue: function( element ) {
     1169        abortRequest: function( element ) {
     1170            var port;
     1171
     1172            if ( this.pending[ element.name ] ) {
     1173                port = this.elementAjaxPort( element );
     1174                $.ajaxAbort( port );
     1175
     1176                this.pendingRequest--;
     1177
     1178                // Sometimes synchronization fails, make sure pendingRequest is never < 0
     1179                if ( this.pendingRequest < 0 ) {
     1180                    this.pendingRequest = 0;
     1181                }
     1182
     1183                delete this.pending[ element.name ];
     1184                $( element ).removeClass( this.settings.pendingClass );
     1185            }
     1186        },
     1187
     1188        previousValue: function( element, method ) {
     1189            method = typeof method === "string" && method || "remote";
     1190
    9161191            return $.data( element, "previousValue" ) || $.data( element, "previousValue", {
    9171192                old: null,
    9181193                valid: true,
    919                 message: this.defaultMessage( element, "remote" )
    920             });
     1194                message: this.defaultMessage( element, { method: method } )
     1195            } );
     1196        },
     1197
     1198        // Cleans up all forms and elements, removes validator-specific events
     1199        destroy: function() {
     1200            this.resetForm();
     1201
     1202            $( this.currentForm )
     1203                .off( ".validate" )
     1204                .removeData( "validator" )
     1205                .find( ".validate-equalTo-blur" )
     1206                    .off( ".validate-equalTo" )
     1207                    .removeClass( "validate-equalTo-blur" )
     1208                .find( ".validate-lessThan-blur" )
     1209                    .off( ".validate-lessThan" )
     1210                    .removeClass( "validate-lessThan-blur" )
     1211                .find( ".validate-lessThanEqual-blur" )
     1212                    .off( ".validate-lessThanEqual" )
     1213                    .removeClass( "validate-lessThanEqual-blur" )
     1214                .find( ".validate-greaterThanEqual-blur" )
     1215                    .off( ".validate-greaterThanEqual" )
     1216                    .removeClass( "validate-greaterThanEqual-blur" )
     1217                .find( ".validate-greaterThan-blur" )
     1218                    .off( ".validate-greaterThan" )
     1219                    .removeClass( "validate-greaterThan-blur" );
    9211220        }
    9221221
     
    9491248            $.each( classes.split( " " ), function() {
    9501249                if ( this in $.validator.classRuleSettings ) {
    951                     $.extend( rules, $.validator.classRuleSettings[ this ]);
    952                 }
    953             });
     1250                    $.extend( rules, $.validator.classRuleSettings[ this ] );
     1251                }
     1252            } );
    9541253        }
    9551254        return rules;
     1255    },
     1256
     1257    normalizeAttributeRule: function( rules, type, method, value ) {
     1258
     1259        // Convert the value to a number for number inputs, and for text for backwards compability
     1260        // allows type="date" and others to be compared as strings
     1261        if ( /min|max|step/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
     1262            value = Number( value );
     1263
     1264            // Support Opera Mini, which returns NaN for undefined minlength
     1265            if ( isNaN( value ) ) {
     1266                value = undefined;
     1267            }
     1268        }
     1269
     1270        if ( value || value === 0 ) {
     1271            rules[ method ] = value;
     1272        } else if ( type === method && type !== "range" ) {
     1273
     1274            // Exception: the jquery validate 'range' method
     1275            // does not test for the html5 'range' type
     1276            rules[ type === "date" ? "dateISO" : method ] = true;
     1277        }
    9561278    },
    9571279
     
    9641286        for ( method in $.validator.methods ) {
    9651287
    966             // support for <input required> in both html5 and older browsers
     1288            // Support for <input required> in both html5 and older browsers
    9671289            if ( method === "required" ) {
    9681290                value = element.getAttribute( method );
     1291
    9691292                // Some browsers return an empty string for the required attribute
    9701293                // and non-HTML5 browsers might have required="" markup
     
    9721295                    value = true;
    9731296                }
    974                 // force non-HTML5 browsers to return bool
     1297
     1298                // Force non-HTML5 browsers to return bool
    9751299                value = !!value;
    9761300            } else {
     
    9781302            }
    9791303
    980             // convert the value to a number for number inputs, and for text for backwards compability
    981             // allows type="date" and others to be compared as strings
    982             if ( /min|max/.test( method ) && ( type === null || /number|range|text/.test( type ) ) ) {
    983                 value = Number( value );
    984             }
    985 
    986             if ( value || value === 0 ) {
    987                 rules[ method ] = value;
    988             } else if ( type === method && type !== "range" ) {
    989                 // exception: the jquery validate 'range' method
    990                 // does not test for the html5 'range' type
    991                 rules[ method ] = true;
    992             }
    993         }
    994 
    995         // maxlength may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
     1304            this.normalizeAttributeRule( rules, type, method, value );
     1305        }
     1306
     1307        // 'maxlength' may be returned as -1, 2147483647 ( IE ) and 524288 ( safari ) for text inputs
    9961308        if ( rules.maxlength && /-1|2147483647|524288/.test( rules.maxlength ) ) {
    9971309            delete rules.maxlength;
     
    10021314
    10031315    dataRules: function( element ) {
    1004         var method, value,
    1005             rules = {}, $element = $( element );
     1316        var rules = {},
     1317            $element = $( element ),
     1318            type = element.getAttribute( "type" ),
     1319            method, value;
     1320
    10061321        for ( method in $.validator.methods ) {
    10071322            value = $element.data( "rule" + method.charAt( 0 ).toUpperCase() + method.substring( 1 ).toLowerCase() );
    1008             if ( value !== undefined ) {
    1009                 rules[ method ] = value;
    1010             }
     1323
     1324            // Cast empty attributes like `data-rule-required` to `true`
     1325            if ( value === "" ) {
     1326                value = true;
     1327            }
     1328
     1329            this.normalizeAttributeRule( rules, type, method, value );
    10111330        }
    10121331        return rules;
     
    10241343
    10251344    normalizeRules: function( rules, element ) {
    1026         // handle dependency check
     1345
     1346        // Handle dependency check
    10271347        $.each( rules, function( prop, val ) {
    1028             // ignore rule when param is explicitly false, eg. required:false
     1348
     1349            // Ignore rule when param is explicitly false, eg. required:false
    10291350            if ( val === false ) {
    10301351                delete rules[ prop ];
     
    10441365                    rules[ prop ] = val.param !== undefined ? val.param : true;
    10451366                } else {
     1367                    $.data( element.form, "validator" ).resetElements( $( element ) );
    10461368                    delete rules[ prop ];
    10471369                }
    10481370            }
    1049         });
    1050 
    1051         // evaluate parameters
     1371        } );
     1372
     1373        // Evaluate parameters
    10521374        $.each( rules, function( rule, parameter ) {
    1053             rules[ rule ] = $.isFunction( parameter ) ? parameter( element ) : parameter;
    1054         });
    1055 
    1056         // clean number parameters
    1057         $.each([ "minlength", "maxlength" ], function() {
     1375            rules[ rule ] = typeof parameter === "function" && rule !== "normalizer" ? parameter( element ) : parameter;
     1376        } );
     1377
     1378        // Clean number parameters
     1379        $.each( [ "minlength", "maxlength" ], function() {
    10581380            if ( rules[ this ] ) {
    10591381                rules[ this ] = Number( rules[ this ] );
    10601382            }
    1061         });
    1062         $.each([ "rangelength", "range" ], function() {
     1383        } );
     1384        $.each( [ "rangelength", "range" ], function() {
    10631385            var parts;
    10641386            if ( rules[ this ] ) {
    1065                 if ( $.isArray( rules[ this ] ) ) {
    1066                     rules[ this ] = [ Number( rules[ this ][ 0 ]), Number( rules[ this ][ 1 ] ) ];
     1387                if ( Array.isArray( rules[ this ] ) ) {
     1388                    rules[ this ] = [ Number( rules[ this ][ 0 ] ), Number( rules[ this ][ 1 ] ) ];
    10671389                } else if ( typeof rules[ this ] === "string" ) {
    1068                     parts = rules[ this ].replace(/[\[\]]/g, "" ).split( /[\s,]+/ );
    1069                     rules[ this ] = [ Number( parts[ 0 ]), Number( parts[ 1 ] ) ];
    1070                 }
    1071             }
    1072         });
     1390                    parts = rules[ this ].replace( /[\[\]]/g, "" ).split( /[\s,]+/ );
     1391                    rules[ this ] = [ Number( parts[ 0 ] ), Number( parts[ 1 ] ) ];
     1392                }
     1393            }
     1394        } );
    10731395
    10741396        if ( $.validator.autoCreateRanges ) {
    1075             // auto-create ranges
     1397
     1398            // Auto-create ranges
    10761399            if ( rules.min != null && rules.max != null ) {
    10771400                rules.range = [ rules.min, rules.max ];
     
    10951418            $.each( data.split( /\s/ ), function() {
    10961419                transformed[ this ] = true;
    1097             });
     1420            } );
    10981421            data = transformed;
    10991422        }
     
    11011424    },
    11021425
    1103     // http://jqueryvalidation.org/jQuery.validator.addMethod/
     1426    // https://jqueryvalidation.org/jQuery.validator.addMethod/
    11041427    addMethod: function( name, method, message ) {
    11051428        $.validator.methods[ name ] = method;
     
    11101433    },
    11111434
     1435    // https://jqueryvalidation.org/jQuery.validator.methods/
    11121436    methods: {
    11131437
    1114         // http://jqueryvalidation.org/required-method/
     1438        // https://jqueryvalidation.org/required-method/
    11151439        required: function( value, element, param ) {
    1116             // check if dependency is met
     1440
     1441            // Check if dependency is met
    11171442            if ( !this.depend( param, element ) ) {
    11181443                return "dependency-mismatch";
    11191444            }
    11201445            if ( element.nodeName.toLowerCase() === "select" ) {
    1121                 // could be an array for select-multiple or a string, both are fine this way
     1446
     1447                // Could be an array for select-multiple or a string, both are fine this way
    11221448                var val = $( element ).val();
    11231449                return val && val.length > 0;
     
    11261452                return this.getLength( value, element ) > 0;
    11271453            }
    1128             return $.trim( value ).length > 0;
    1129         },
    1130 
    1131         // http://jqueryvalidation.org/email-method/
     1454            return value !== undefined && value !== null && value.length > 0;
     1455        },
     1456
     1457        // https://jqueryvalidation.org/email-method/
    11321458        email: function( value, element ) {
    1133             // From http://www.whatwg.org/specs/web-apps/current-work/multipage/states-of-the-type-attribute.html#e-mail-state-%28type=email%29
     1459
     1460            // From https://html.spec.whatwg.org/multipage/forms.html#valid-e-mail-address
    11341461            // Retrieved 2014-01-14
    11351462            // If you have a problem with this implementation, report a bug against the above spec
     
    11381465        },
    11391466
    1140         // http://jqueryvalidation.org/url-method/
     1467        // https://jqueryvalidation.org/url-method/
    11411468        url: function( value, element ) {
    1142             // contributed by Scott Gonzalez: http://projects.scottsplayground.com/iri/
    1143             return this.optional( element ) || /^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test( value );
    1144         },
    1145 
    1146         // http://jqueryvalidation.org/date-method/
    1147         date: function( value, element ) {
    1148             return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
    1149         },
    1150 
    1151         // http://jqueryvalidation.org/dateISO-method/
     1469
     1470            // Copyright (c) 2010-2013 Diego Perini, MIT licensed
     1471            // https://gist.github.com/dperini/729294
     1472            // see also https://mathiasbynens.be/demo/url-regex
     1473            // modified to allow protocol-relative URLs
     1474            return this.optional( element ) || /^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test( value );
     1475        },
     1476
     1477        // https://jqueryvalidation.org/date-method/
     1478        date: ( function() {
     1479            var called = false;
     1480
     1481            return function( value, element ) {
     1482                if ( !called ) {
     1483                    called = true;
     1484                    if ( this.settings.debug && window.console ) {
     1485                        console.warn(
     1486                            "The `date` method is deprecated and will be removed in version '2.0.0'.\n" +
     1487                            "Please don't use it, since it relies on the Date constructor, which\n" +
     1488                            "behaves very differently across browsers and locales. Use `dateISO`\n" +
     1489                            "instead or one of the locale specific methods in `localizations/`\n" +
     1490                            "and `additional-methods.js`."
     1491                        );
     1492                    }
     1493                }
     1494
     1495                return this.optional( element ) || !/Invalid|NaN/.test( new Date( value ).toString() );
     1496            };
     1497        }() ),
     1498
     1499        // https://jqueryvalidation.org/dateISO-method/
    11521500        dateISO: function( value, element ) {
    11531501            return this.optional( element ) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test( value );
    11541502        },
    11551503
    1156         // http://jqueryvalidation.org/number-method/
     1504        // https://jqueryvalidation.org/number-method/
    11571505        number: function( value, element ) {
    1158             return this.optional( element ) || /^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test( value );
    1159         },
    1160 
    1161         // http://jqueryvalidation.org/digits-method/
     1506            return this.optional( element ) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test( value );
     1507        },
     1508
     1509        // https://jqueryvalidation.org/digits-method/
    11621510        digits: function( value, element ) {
    11631511            return this.optional( element ) || /^\d+$/.test( value );
    11641512        },
    11651513
    1166         // http://jqueryvalidation.org/creditcard-method/
    1167         // based on http://en.wikipedia.org/wiki/Luhn/
    1168         creditcard: function( value, element ) {
     1514        // https://jqueryvalidation.org/minlength-method/
     1515        minlength: function( value, element, param ) {
     1516            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
     1517            return this.optional( element ) || length >= param;
     1518        },
     1519
     1520        // https://jqueryvalidation.org/maxlength-method/
     1521        maxlength: function( value, element, param ) {
     1522            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
     1523            return this.optional( element ) || length <= param;
     1524        },
     1525
     1526        // https://jqueryvalidation.org/rangelength-method/
     1527        rangelength: function( value, element, param ) {
     1528            var length = Array.isArray( value ) ? value.length : this.getLength( value, element );
     1529            return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
     1530        },
     1531
     1532        // https://jqueryvalidation.org/min-method/
     1533        min: function( value, element, param ) {
     1534            return this.optional( element ) || value >= param;
     1535        },
     1536
     1537        // https://jqueryvalidation.org/max-method/
     1538        max: function( value, element, param ) {
     1539            return this.optional( element ) || value <= param;
     1540        },
     1541
     1542        // https://jqueryvalidation.org/range-method/
     1543        range: function( value, element, param ) {
     1544            return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
     1545        },
     1546
     1547        // https://jqueryvalidation.org/step-method/
     1548        step: function( value, element, param ) {
     1549            var type = $( element ).attr( "type" ),
     1550                errorMessage = "Step attribute on input type " + type + " is not supported.",
     1551                supportedTypes = [ "text", "number", "range" ],
     1552                re = new RegExp( "\\b" + type + "\\b" ),
     1553                notSupported = type && !re.test( supportedTypes.join() ),
     1554                decimalPlaces = function( num ) {
     1555                    var match = ( "" + num ).match( /(?:\.(\d+))?$/ );
     1556                    if ( !match ) {
     1557                        return 0;
     1558                    }
     1559
     1560                    // Number of digits right of decimal point.
     1561                    return match[ 1 ] ? match[ 1 ].length : 0;
     1562                },
     1563                toInt = function( num ) {
     1564                    return Math.round( num * Math.pow( 10, decimals ) );
     1565                },
     1566                valid = true,
     1567                decimals;
     1568
     1569            // Works only for text, number and range input types
     1570            // TODO find a way to support input types date, datetime, datetime-local, month, time and week
     1571            if ( notSupported ) {
     1572                throw new Error( errorMessage );
     1573            }
     1574
     1575            decimals = decimalPlaces( param );
     1576
     1577            // Value can't have too many decimals
     1578            if ( decimalPlaces( value ) > decimals || toInt( value ) % toInt( param ) !== 0 ) {
     1579                valid = false;
     1580            }
     1581
     1582            return this.optional( element ) || valid;
     1583        },
     1584
     1585        // https://jqueryvalidation.org/equalTo-method/
     1586        equalTo: function( value, element, param ) {
     1587
     1588            // Bind to the blur event of the target in order to revalidate whenever the target field is updated
     1589            var target = $( param );
     1590            if ( this.settings.onfocusout && target.not( ".validate-equalTo-blur" ).length ) {
     1591                target.addClass( "validate-equalTo-blur" ).on( "blur.validate-equalTo", function() {
     1592                    $( element ).valid();
     1593                } );
     1594            }
     1595            return value === target.val();
     1596        },
     1597
     1598        // https://jqueryvalidation.org/remote-method/
     1599        remote: function( value, element, param, method ) {
    11691600            if ( this.optional( element ) ) {
    11701601                return "dependency-mismatch";
    11711602            }
    1172             // accept only spaces, digits and dashes
    1173             if ( /[^0-9 \-]+/.test( value ) ) {
    1174                 return false;
    1175             }
    1176             var nCheck = 0,
    1177                 nDigit = 0,
    1178                 bEven = false,
    1179                 n, cDigit;
    1180 
    1181             value = value.replace( /\D/g, "" );
    1182 
    1183             // Basing min and max length on
    1184             // http://developer.ean.com/general_info/Valid_Credit_Card_Types
    1185             if ( value.length < 13 || value.length > 19 ) {
    1186                 return false;
    1187             }
    1188 
    1189             for ( n = value.length - 1; n >= 0; n--) {
    1190                 cDigit = value.charAt( n );
    1191                 nDigit = parseInt( cDigit, 10 );
    1192                 if ( bEven ) {
    1193                     if ( ( nDigit *= 2 ) > 9 ) {
    1194                         nDigit -= 9;
    1195                     }
    1196                 }
    1197                 nCheck += nDigit;
    1198                 bEven = !bEven;
    1199             }
    1200 
    1201             return ( nCheck % 10 ) === 0;
    1202         },
    1203 
    1204         // http://jqueryvalidation.org/minlength-method/
    1205         minlength: function( value, element, param ) {
    1206             var length = $.isArray( value ) ? value.length : this.getLength( value, element );
    1207             return this.optional( element ) || length >= param;
    1208         },
    1209 
    1210         // http://jqueryvalidation.org/maxlength-method/
    1211         maxlength: function( value, element, param ) {
    1212             var length = $.isArray( value ) ? value.length : this.getLength( value, element );
    1213             return this.optional( element ) || length <= param;
    1214         },
    1215 
    1216         // http://jqueryvalidation.org/rangelength-method/
    1217         rangelength: function( value, element, param ) {
    1218             var length = $.isArray( value ) ? value.length : this.getLength( value, element );
    1219             return this.optional( element ) || ( length >= param[ 0 ] && length <= param[ 1 ] );
    1220         },
    1221 
    1222         // http://jqueryvalidation.org/min-method/
    1223         min: function( value, element, param ) {
    1224             return this.optional( element ) || value >= param;
    1225         },
    1226 
    1227         // http://jqueryvalidation.org/max-method/
    1228         max: function( value, element, param ) {
    1229             return this.optional( element ) || value <= param;
    1230         },
    1231 
    1232         // http://jqueryvalidation.org/range-method/
    1233         range: function( value, element, param ) {
    1234             return this.optional( element ) || ( value >= param[ 0 ] && value <= param[ 1 ] );
    1235         },
    1236 
    1237         // http://jqueryvalidation.org/equalTo-method/
    1238         equalTo: function( value, element, param ) {
    1239             // bind to the blur event of the target in order to revalidate whenever the target field is updated
    1240             // TODO find a way to bind the event just once, avoiding the unbind-rebind overhead
    1241             var target = $( param );
    1242             if ( this.settings.onfocusout ) {
    1243                 target.unbind( ".validate-equalTo" ).bind( "blur.validate-equalTo", function() {
    1244                     $( element ).valid();
    1245                 });
    1246             }
    1247             return value === target.val();
    1248         },
    1249 
    1250         // http://jqueryvalidation.org/remote-method/
    1251         remote: function( value, element, param ) {
    1252             if ( this.optional( element ) ) {
    1253                 return "dependency-mismatch";
    1254             }
    1255 
    1256             var previous = this.previousValue( element ),
    1257                 validator, data;
    1258 
    1259             if (!this.settings.messages[ element.name ] ) {
     1603
     1604            method = typeof method === "string" && method || "remote";
     1605
     1606            var previous = this.previousValue( element, method ),
     1607                validator, data, optionDataString;
     1608
     1609            if ( !this.settings.messages[ element.name ] ) {
    12601610                this.settings.messages[ element.name ] = {};
    12611611            }
    1262             previous.originalMessage = this.settings.messages[ element.name ].remote;
    1263             this.settings.messages[ element.name ].remote = previous.message;
     1612            previous.originalMessage = previous.originalMessage || this.settings.messages[ element.name ][ method ];
     1613            this.settings.messages[ element.name ][ method ] = previous.message;
    12641614
    12651615            param = typeof param === "string" && { url: param } || param;
    1266 
    1267             if ( previous.old === value ) {
     1616            optionDataString = $.param( $.extend( { data: value }, param.data ) );
     1617            if ( previous.valid !== null && previous.old === optionDataString ) {
    12681618                return previous.valid;
    12691619            }
    12701620
    1271             previous.old = value;
     1621            previous.old = optionDataString;
     1622            previous.valid = null;
    12721623            validator = this;
    12731624            this.startRequest( element );
     
    12751626            data[ element.name ] = value;
    12761627            $.ajax( $.extend( true, {
    1277                 url: param,
    12781628                mode: "abort",
    1279                 port: "validate" + element.name,
     1629                port: this.elementAjaxPort( element ),
    12801630                dataType: "json",
    12811631                data: data,
     
    12851635                        errors, message, submitted;
    12861636
    1287                     validator.settings.messages[ element.name ].remote = previous.originalMessage;
     1637                    validator.settings.messages[ element.name ][ method ] = previous.originalMessage;
    12881638                    if ( valid ) {
    12891639                        submitted = validator.formSubmitted;
    1290                         validator.prepareElement( element );
     1640                        validator.toHide = validator.errorsFor( element );
    12911641                        validator.formSubmitted = submitted;
    12921642                        validator.successList.push( element );
    1293                         delete validator.invalid[ element.name ];
     1643                        validator.invalid[ element.name ] = false;
    12941644                        validator.showErrors();
    12951645                    } else {
    12961646                        errors = {};
    1297                         message = response || validator.defaultMessage( element, "remote" );
    1298                         errors[ element.name ] = previous.message = $.isFunction( message ) ? message( value ) : message;
     1647                        message = response || validator.defaultMessage( element, { method: method, parameters: value } );
     1648                        errors[ element.name ] = previous.message = message;
    12991649                        validator.invalid[ element.name ] = true;
    13001650                        validator.showErrors( errors );
     
    13061656            return "pending";
    13071657        }
    1308 
    13091658    }
    13101659
    1311 });
    1312 
    1313 $.format = function deprecated() {
    1314     throw "$.format has been deprecated. Please use $.validator.format instead.";
    1315 };
    1316 
    1317 // ajax mode: abort
     1660} );
     1661
     1662// Ajax mode: abort
    13181663// usage: $.ajax({ mode: "abort"[, port: "uniqueport"]});
     1664//        $.ajaxAbort( port );
    13191665// if mode:"abort" is used, the previous request on that port (port can be undefined) is aborted via XMLHttpRequest.abort()
    13201666
    13211667var pendingRequests = {},
    13221668    ajax;
     1669
    13231670// Use a prefilter if available (1.5+)
    13241671if ( $.ajaxPrefilter ) {
    1325     $.ajaxPrefilter(function( settings, _, xhr ) {
     1672    $.ajaxPrefilter( function( settings, _, xhr ) {
    13261673        var port = settings.port;
    13271674        if ( settings.mode === "abort" ) {
    1328             if ( pendingRequests[port] ) {
    1329                 pendingRequests[port].abort();
    1330             }
    1331             pendingRequests[port] = xhr;
    1332         }
    1333     });
     1675            $.ajaxAbort( port );
     1676            pendingRequests[ port ] = xhr;
     1677        }
     1678    } );
    13341679} else {
     1680
    13351681    // Proxy ajax
    13361682    ajax = $.ajax;
     
    13391685            port = ( "port" in settings ? settings : $.ajaxSettings ).port;
    13401686        if ( mode === "abort" ) {
    1341             if ( pendingRequests[port] ) {
    1342                 pendingRequests[port].abort();
    1343             }
    1344             pendingRequests[port] = ajax.apply(this, arguments);
    1345             return pendingRequests[port];
    1346         }
    1347         return ajax.apply(this, arguments);
     1687            $.ajaxAbort( port );
     1688            pendingRequests[ port ] = ajax.apply( this, arguments );
     1689            return pendingRequests[ port ];
     1690        }
     1691        return ajax.apply( this, arguments );
    13481692    };
    13491693}
    13501694
    1351 // provides delegate(type: String, delegate: Selector, handler: Callback) plugin for easier event delegation
    1352 // handler is only called when $(event.target).is(delegate), in the scope of the jquery-object for event.target
    1353 
    1354 $.extend($.fn, {
    1355     validateDelegate: function( delegate, type, handler ) {
    1356         return this.bind(type, function( event ) {
    1357             var target = $(event.target);
    1358             if ( target.is(delegate) ) {
    1359                 return handler.apply(target, arguments);
    1360             }
    1361         });
     1695// Abort the previous request without sending a new one
     1696$.ajaxAbort = function( port ) {
     1697    if ( pendingRequests[ port ] ) {
     1698        pendingRequests[ port ].abort();
     1699        delete pendingRequests[ port ];
    13621700    }
    1363 });
    1364 
     1701};
     1702return $;
    13651703}));
  • weight-loss-tracker/trunk/assets/js/libraries/jquery.validate.min.js

    r3145588 r3158785  
    1 /**
    2  * selectize.js (v0.13.6)
    3  * Copyright (c) 2013–2015 Brian Reavis & contributors
    4  * Copyright (c) 2020-2022 Selectize Team & contributors
    5  *
    6  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
    7  * file except in compliance with the License. You may obtain a copy of the License at:
    8  * http://www.apache.org/licenses/LICENSE-2.0
    9  *
    10  * Unless required by applicable law or agreed to in writing, software distributed under
    11  * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
    12  * ANY KIND, either express or implied. See the License for the specific language
    13  * governing permissions and limitations under the License.
    14  *
    15  * @author Brian Reavis <brian@thirdroute.com>
    16  * @author Ris Adams <selectize@risadams.com>
    17  */
    18 
    19 /*jshint curly:false */
    20 /*jshint browser:true */
    21 !function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.validateDelegate(":submit","click",function(b){c.settings.submitHandler&&(c.submitButton=b.target),a(b.target).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(b.target).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.submit(function(b){function d(){var d,e;return c.settings.submitHandler?(c.submitButton&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),e=c.settings.submitHandler.call(c,c.currentForm,b),c.submitButton&&d.remove(),void 0!==e?e:!1):!0}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c;return a(this[0]).is("form")?b=this.validate().form():(b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b})),b},removeAttrs:function(b){var c={},d=this;return a.each(b.split(/\s/),function(a,b){c[b]=d.attr(b),d.removeAttr(b)}),c},rules:function(b,c){var d,e,f,g,h,i,j=this[0];if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(b,c){i[c]=f[c],delete f[c],"required"===c&&a(j).removeAttr("aria-required")}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g),a(j).attr("aria-required","true")),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}),a.extend(a.expr[":"],{blank:function(b){return!a.trim(""+a(b).val())},filled:function(b){return!!a.trim(""+a(b).val())},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(a,b){(9!==b.which||""!==this.elementValue(a))&&(a.name in this.submitted||a===this.lastElement)&&this.element(a)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date ( ISO ).",number:"Please enter a valid number.",digits:"Please enter only digits.",creditcard:"Please enter a valid credit card number.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c=a.data(this[0].form,"validator"),d="on"+b.type.replace(/^validate/,""),e=c.settings;e[d]&&!this.is(e.ignore)&&e[d].call(c,this[0],b)}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){d[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)}),a(this.currentForm).validateDelegate(":text, [type='password'], [type='file'], select, textarea, [type='number'], [type='search'] ,[type='tel'], [type='url'], [type='email'], [type='datetime'], [type='date'], [type='month'], [type='week'], [type='time'], [type='datetime-local'], [type='range'], [type='color'], [type='radio'], [type='checkbox']","focusin focusout keyup",b).validateDelegate("select, option, [type='radio'], [type='checkbox']","click",b),this.settings.invalidHandler&&a(this.currentForm).bind("invalid-form.validate",this.settings.invalidHandler),a(this.currentForm).find("[required], [data-rule-required], .required").attr("aria-required","true")},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c=this.clean(b),d=this.validationTargetFor(c),e=!0;return this.lastElement=d,void 0===d?delete this.invalid[c.name]:(this.prepareElement(d),this.currentElements=a(d),e=this.check(d)!==!1,e?delete this.invalid[d.name]:this.invalid[d.name]=!0),a(b).attr("aria-invalid",!e),this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),e},showErrors:function(b){if(b){a.extend(this.errorMap,b),this.errorList=[];for(var c in b)this.errorList.push({message:b[c],element:this.findByName(c)[0]});this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.submitted={},this.lastElement=null,this.prepareForm(),this.hideErrors(),this.elements().removeClass(this.settings.errorClass).removeData("previousValue").removeAttr("aria-invalid")},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").focus().trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={};return a(this.currentForm).find("input, select, textarea").not(":submit, :reset, :image, [disabled], [readonly]").not(this.settings.ignore).filter(function(){return!this.name&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),this.name in c||!b.objectLength(a(this).rules())?!1:(c[this.name]=!0,!0)})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},reset:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([]),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d=a(b),e=b.type;return"radio"===e||"checkbox"===e?a("input[name='"+b.name+"']:checked").val():"number"===e&&"undefined"!=typeof b.validity?b.validity.badInput?!1:d.val():(c=d.val(),"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f=a(b).rules(),g=a.map(f,function(a,b){return b}).length,h=!1,i=this.elementValue(b);for(d in f){e={method:d,parameters:f[d]};try{if(c=a.validator.methods[d].call(this,i,b,e.parameters),"dependency-mismatch"===c&&1===g){h=!0;continue}if(h=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(j){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",j),j}}if(!h)return this.objectLength(f)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a];return void 0},defaultMessage:function(b,c){return this.findDefined(this.customMessage(b.name,c),this.customDataMessage(b,c),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c],"<strong>Warning: No message defined for "+b.name+"</strong>")},formatAndAdd:function(b,c){var d=this.defaultMessage(b,c.method),e=/\$?\{(\d+)\}/g;"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),this.errorList.push({message:d,element:b,method:c.method}),this.errorMap[b.name]=d,this.submitted[b.name]=d},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g=this.errorsFor(b),h=this.idOrName(b),i=a(b).attr("aria-describedby");g.length?(g.removeClass(this.settings.validClass).addClass(this.settings.errorClass),g.html(c)):(g=a("<"+this.settings.errorElement+">").attr("id",h+"-error").addClass(this.settings.errorClass).html(c||""),d=g,this.settings.wrapper&&(d=g.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement(d,a(b)):d.insertAfter(b),g.is("label")?g.attr("for",h):0===g.parents("label[for='"+h+"']").length&&(f=g.attr("id").replace(/(:|\.|\[|\])/g,"\\$1"),i?i.match(new RegExp("\\b"+f+"\\b"))||(i+=" "+f):i=f,a(b).attr("aria-describedby",i),e=this.groups[b.name],e&&a.each(this.groups,function(b,c){c===e&&a("[name='"+b+"']",this.currentForm).attr("aria-describedby",g.attr("id"))}))),!c&&this.settings.success&&(g.text(""),"string"==typeof this.settings.success?g.addClass(this.settings.success):this.settings.success(g,b)),this.toShow=this.toShow.add(g)},errorsFor:function(b){var c=this.idOrName(b),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+d.replace(/\s+/g,", #")),this.errors().filter(e)},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+b+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return this.dependTypes[typeof a]?this.dependTypes[typeof a](a,b):!0},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},startRequest:function(a){this.pending[a.name]||(this.pendingRequest++,this.pending[a.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],c&&0===this.pendingRequest&&this.formSubmitted&&this.form()?(a(this.currentForm).submit(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},previousValue:function(b){return a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,"remote")})}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),/min|max/.test(c)&&(null===g||/number|range|text/.test(g))&&(d=Number(d)),d||0===d?e[c]=d:g===c&&"range"!==g&&(e[c]=!0);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b);for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),void 0!==d&&(e[c]=d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0!==e.param?e.param:!0:delete b[d]}}),a.each(b,function(d,e){b[d]=a.isFunction(e)?e(c):e}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var c;b[this]&&(a.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(c=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(c[0]),Number(c[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:a.trim(b).length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(https?|s?ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(a)},date:function(a,b){return this.optional(b)||!/Invalid|NaN/.test(new Date(a).toString())},dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^-?(?:\d+|\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},creditcard:function(a,b){if(this.optional(b))return"dependency-mismatch";if(/[^0-9 \-]+/.test(a))return!1;var c,d,e=0,f=0,g=!1;if(a=a.replace(/\D/g,""),a.length<13||a.length>19)return!1;for(c=a.length-1;c>=0;c--)d=a.charAt(c),f=parseInt(d,10),g&&(f*=2)>9&&(f-=9),e+=f,g=!g;return e%10===0},minlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d},maxlength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||d>=e},rangelength:function(b,c,d){var e=a.isArray(b)?b.length:this.getLength(b,c);return this.optional(c)||e>=d[0]&&e<=d[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||c>=a},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.unbind(".validate-equalTo").bind("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d){if(this.optional(c))return"dependency-mismatch";var e,f,g=this.previousValue(c);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),g.originalMessage=this.settings.messages[c.name].remote,this.settings.messages[c.name].remote=g.message,d="string"==typeof d&&{url:d}||d,g.old===b?g.valid:(g.old=b,e=this,this.startRequest(c),f={},f[c.name]=b,a.ajax(a.extend(!0,{url:d,mode:"abort",port:"validate"+c.name,dataType:"json",data:f,context:e.currentForm,success:function(d){var f,h,i,j=d===!0||"true"===d;e.settings.messages[c.name].remote=g.originalMessage,j?(i=e.formSubmitted,e.prepareElement(c),e.formSubmitted=i,e.successList.push(c),delete e.invalid[c.name],e.showErrors()):(f={},h=d||e.defaultMessage(c,"remote"),f[c.name]=g.message=a.isFunction(h)?h(b):h,e.invalid[c.name]=!0,e.showErrors(f)),g.valid=j,e.stopRequest(c,j)}},d)),"pending")}}}),a.format=function(){throw"$.format has been deprecated. Please use $.validator.format instead."};var b,c={};a.ajaxPrefilter?a.ajaxPrefilter(function(a,b,d){var e=a.port;"abort"===a.mode&&(c[e]&&c[e].abort(),c[e]=d)}):(b=a.ajax,a.ajax=function(d){var e=("mode"in d?d:a.ajaxSettings).mode,f=("port"in d?d:a.ajaxSettings).port;return"abort"===e?(c[f]&&c[f].abort(),c[f]=b.apply(this,arguments),c[f]):b.apply(this,arguments)}),a.extend(a.fn,{validateDelegate:function(b,c,d){return this.bind(c,function(c){var e=a(c.target);return e.is(b)?d.apply(e,arguments):void 0})}})});
     1/*! jQuery Validation Plugin - v1.21.0 - 7/17/2024
     2 * https://jqueryvalidation.org/
     3 * Copyright (c) 2024 Jörn Zaefferer; Licensed MIT */
     4!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(jQuery)}(function(a){a.extend(a.fn,{validate:function(b){if(!this.length)return void(b&&b.debug&&window.console&&console.warn("Nothing selected, can't validate, returning nothing."));var c=a.data(this[0],"validator");return c?c:(this.attr("novalidate","novalidate"),c=new a.validator(b,this[0]),a.data(this[0],"validator",c),c.settings.onsubmit&&(this.on("click.validate",":submit",function(b){c.submitButton=b.currentTarget,a(this).hasClass("cancel")&&(c.cancelSubmit=!0),void 0!==a(this).attr("formnovalidate")&&(c.cancelSubmit=!0)}),this.on("submit.validate",function(b){function d(){var d,e;return c.submitButton&&(c.settings.submitHandler||c.formSubmitted)&&(d=a("<input type='hidden'/>").attr("name",c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)),!(c.settings.submitHandler&&!c.settings.debug)||(e=c.settings.submitHandler.call(c,c.currentForm,b),d&&d.remove(),void 0!==e&&e)}return c.settings.debug&&b.preventDefault(),c.cancelSubmit?(c.cancelSubmit=!1,d()):c.form()?c.pendingRequest?(c.formSubmitted=!0,!1):d():(c.focusInvalid(),!1)})),c)},valid:function(){var b,c,d;return a(this[0]).is("form")?b=this.validate().form():(d=[],b=!0,c=a(this[0].form).validate(),this.each(function(){b=c.element(this)&&b,b||(d=d.concat(c.errorList))}),c.errorList=d),b},rules:function(b,c){var d,e,f,g,h,i,j=this[0],k="undefined"!=typeof this.attr("contenteditable")&&"false"!==this.attr("contenteditable");if(null!=j&&(!j.form&&k&&(j.form=this.closest("form")[0],j.name=this.attr("name")),null!=j.form)){if(b)switch(d=a.data(j.form,"validator").settings,e=d.rules,f=a.validator.staticRules(j),b){case"add":a.extend(f,a.validator.normalizeRule(c)),delete f.messages,e[j.name]=f,c.messages&&(d.messages[j.name]=a.extend(d.messages[j.name],c.messages));break;case"remove":return c?(i={},a.each(c.split(/\s/),function(a,b){i[b]=f[b],delete f[b]}),i):(delete e[j.name],f)}return g=a.validator.normalizeRules(a.extend({},a.validator.classRules(j),a.validator.attributeRules(j),a.validator.dataRules(j),a.validator.staticRules(j)),j),g.required&&(h=g.required,delete g.required,g=a.extend({required:h},g)),g.remote&&(h=g.remote,delete g.remote,g=a.extend(g,{remote:h})),g}}});var b=function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")};a.extend(a.expr.pseudos||a.expr[":"],{blank:function(c){return!b(""+a(c).val())},filled:function(c){var d=a(c).val();return null!==d&&!!b(""+d)},unchecked:function(b){return!a(b).prop("checked")}}),a.validator=function(b,c){this.settings=a.extend(!0,{},a.validator.defaults,b),this.currentForm=c,this.init()},a.validator.format=function(b,c){return 1===arguments.length?function(){var c=a.makeArray(arguments);return c.unshift(b),a.validator.format.apply(this,c)}:void 0===c?b:(arguments.length>2&&c.constructor!==Array&&(c=a.makeArray(arguments).slice(1)),c.constructor!==Array&&(c=[c]),a.each(c,function(a,c){b=b.replace(new RegExp("\\{"+a+"\\}","g"),function(){return c})}),b)},a.extend(a.validator,{defaults:{messages:{},groups:{},rules:{},errorClass:"error",pendingClass:"pending",validClass:"valid",errorElement:"label",focusCleanup:!1,focusInvalid:!0,errorContainer:a([]),errorLabelContainer:a([]),onsubmit:!0,ignore:":hidden",ignoreTitle:!1,customElements:[],onfocusin:function(a){this.lastActive=a,this.settings.focusCleanup&&(this.settings.unhighlight&&this.settings.unhighlight.call(this,a,this.settings.errorClass,this.settings.validClass),this.hideThese(this.errorsFor(a)))},onfocusout:function(a){this.checkable(a)||!(a.name in this.submitted)&&this.optional(a)||this.element(a)},onkeyup:function(b,c){var d=[16,17,18,20,35,36,37,38,39,40,45,144,225];9===c.which&&""===this.elementValue(b)||a.inArray(c.keyCode,d)!==-1||(b.name in this.submitted||b.name in this.invalid)&&this.element(b)},onclick:function(a){a.name in this.submitted?this.element(a):a.parentNode.name in this.submitted&&this.element(a.parentNode)},highlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).addClass(c).removeClass(d):a(b).addClass(c).removeClass(d)},unhighlight:function(b,c,d){"radio"===b.type?this.findByName(b.name).removeClass(c).addClass(d):a(b).removeClass(c).addClass(d)}},setDefaults:function(b){a.extend(a.validator.defaults,b)},messages:{required:"This field is required.",remote:"Please fix this field.",email:"Please enter a valid email address.",url:"Please enter a valid URL.",date:"Please enter a valid date.",dateISO:"Please enter a valid date (ISO).",number:"Please enter a valid number.",digits:"Please enter only digits.",equalTo:"Please enter the same value again.",maxlength:a.validator.format("Please enter no more than {0} characters."),minlength:a.validator.format("Please enter at least {0} characters."),rangelength:a.validator.format("Please enter a value between {0} and {1} characters long."),range:a.validator.format("Please enter a value between {0} and {1}."),max:a.validator.format("Please enter a value less than or equal to {0}."),min:a.validator.format("Please enter a value greater than or equal to {0}."),step:a.validator.format("Please enter a multiple of {0}.")},autoCreateRanges:!1,prototype:{init:function(){function b(b){var c="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");if(!this.form&&c&&(this.form=a(this).closest("form")[0],this.name=a(this).attr("name")),d===this.form){var e=a.data(this.form,"validator"),f="on"+b.type.replace(/^validate/,""),g=e.settings;g[f]&&!a(this).is(g.ignore)&&g[f].call(e,this,b)}}this.labelContainer=a(this.settings.errorLabelContainer),this.errorContext=this.labelContainer.length&&this.labelContainer||a(this.currentForm),this.containers=a(this.settings.errorContainer).add(this.settings.errorLabelContainer),this.submitted={},this.valueCache={},this.pendingRequest=0,this.pending={},this.invalid={},this.reset();var c,d=this.currentForm,e=this.groups={};a.each(this.settings.groups,function(b,c){"string"==typeof c&&(c=c.split(/\s/)),a.each(c,function(a,c){e[c]=b})}),c=this.settings.rules,a.each(c,function(b,d){c[b]=a.validator.normalizeRule(d)});var f=[":text","[type='password']","[type='file']","select","textarea","[type='number']","[type='search']","[type='tel']","[type='url']","[type='email']","[type='datetime']","[type='date']","[type='month']","[type='week']","[type='time']","[type='datetime-local']","[type='range']","[type='color']","[type='radio']","[type='checkbox']","[contenteditable]","[type='button']"],g=["select","option","[type='radio']","[type='checkbox']"];a(this.currentForm).on("focusin.validate focusout.validate keyup.validate",f.concat(this.settings.customElements).join(", "),b).on("click.validate",g.concat(this.settings.customElements).join(", "),b),this.settings.invalidHandler&&a(this.currentForm).on("invalid-form.validate",this.settings.invalidHandler)},form:function(){return this.checkForm(),a.extend(this.submitted,this.errorMap),this.invalid=a.extend({},this.errorMap),this.valid()||a(this.currentForm).triggerHandler("invalid-form",[this]),this.showErrors(),this.valid()},checkForm:function(){this.prepareForm();for(var a=0,b=this.currentElements=this.elements();b[a];a++)this.check(b[a]);return this.valid()},element:function(b){var c,d,e=this.clean(b),f=this.validationTargetFor(e),g=this,h=!0;return void 0===f?delete this.invalid[e.name]:(this.prepareElement(f),this.currentElements=a(f),d=this.groups[f.name],d&&a.each(this.groups,function(a,b){b===d&&a!==f.name&&(e=g.validationTargetFor(g.clean(g.findByName(a))),e&&e.name in g.invalid&&(g.currentElements.push(e),h=g.check(e)&&h))}),c=this.check(f)!==!1,h=h&&c,c?this.invalid[f.name]=!1:this.invalid[f.name]=!0,this.numberOfInvalids()||(this.toHide=this.toHide.add(this.containers)),this.showErrors(),a(b).attr("aria-invalid",!c)),h},showErrors:function(b){if(b){var c=this;a.extend(this.errorMap,b),this.errorList=a.map(this.errorMap,function(a,b){return{message:a,element:c.findByName(b)[0]}}),this.successList=a.grep(this.successList,function(a){return!(a.name in b)})}this.settings.showErrors?this.settings.showErrors.call(this,this.errorMap,this.errorList):this.defaultShowErrors()},resetForm:function(){a.fn.resetForm&&a(this.currentForm).resetForm(),this.invalid={},this.submitted={},this.prepareForm(),this.hideErrors();var b=this.elements().removeData("previousValue").removeAttr("aria-invalid");this.resetElements(b)},resetElements:function(a){var b;if(this.settings.unhighlight)for(b=0;a[b];b++)this.settings.unhighlight.call(this,a[b],this.settings.errorClass,""),this.findByName(a[b].name).removeClass(this.settings.validClass);else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass)},numberOfInvalids:function(){return this.objectLength(this.invalid)},objectLength:function(a){var b,c=0;for(b in a)void 0!==a[b]&&null!==a[b]&&a[b]!==!1&&c++;return c},hideErrors:function(){this.hideThese(this.toHide)},hideThese:function(a){a.not(this.containers).text(""),this.addWrapper(a).hide()},valid:function(){return 0===this.size()},size:function(){return this.errorList.length},focusInvalid:function(){if(this.settings.focusInvalid)try{a(this.findLastActive()||this.errorList.length&&this.errorList[0].element||[]).filter(":visible").trigger("focus").trigger("focusin")}catch(b){}},findLastActive:function(){var b=this.lastActive;return b&&1===a.grep(this.errorList,function(a){return a.element.name===b.name}).length&&b},elements:function(){var b=this,c={},d=["input","select","textarea","[contenteditable]"];return a(this.currentForm).find(d.concat(this.settings.customElements).join(", ")).not(":submit, :reset, :image, :disabled").not(this.settings.ignore).filter(function(){var d=this.name||a(this).attr("name"),e="undefined"!=typeof a(this).attr("contenteditable")&&"false"!==a(this).attr("contenteditable");return!d&&b.settings.debug&&window.console&&console.error("%o has no name assigned",this),e&&(this.form=a(this).closest("form")[0],this.name=d),this.form===b.currentForm&&(!(d in c||!b.objectLength(a(this).rules()))&&(c[d]=!0,!0))})},clean:function(b){return a(b)[0]},errors:function(){var b=this.settings.errorClass.split(" ").join(".");return a(this.settings.errorElement+"."+b,this.errorContext)},resetInternals:function(){this.successList=[],this.errorList=[],this.errorMap={},this.toShow=a([]),this.toHide=a([])},reset:function(){this.resetInternals(),this.currentElements=a([])},prepareForm:function(){this.reset(),this.toHide=this.errors().add(this.containers)},prepareElement:function(a){this.reset(),this.toHide=this.errorsFor(a)},elementValue:function(b){var c,d,e=a(b),f=b.type,g="undefined"!=typeof e.attr("contenteditable")&&"false"!==e.attr("contenteditable");return"radio"===f||"checkbox"===f?this.findByName(b.name).filter(":checked").val():"number"===f&&"undefined"!=typeof b.validity?b.validity.badInput?"NaN":e.val():(c=g?e.text():e.val(),"file"===f?"C:\\fakepath\\"===c.substr(0,12)?c.substr(12):(d=c.lastIndexOf("/"),d>=0?c.substr(d+1):(d=c.lastIndexOf("\\"),d>=0?c.substr(d+1):c)):"string"==typeof c?c.replace(/\r/g,""):c)},check:function(b){b=this.validationTargetFor(this.clean(b));var c,d,e,f,g=a(b).rules(),h=a.map(g,function(a,b){return b}).length,i=!1,j=this.elementValue(b);this.abortRequest(b),"function"==typeof g.normalizer?f=g.normalizer:"function"==typeof this.settings.normalizer&&(f=this.settings.normalizer),f&&(j=f.call(b,j),delete g.normalizer);for(d in g){e={method:d,parameters:g[d]};try{if(c=a.validator.methods[d].call(this,j,b,e.parameters),"dependency-mismatch"===c&&1===h){i=!0;continue}if(i=!1,"pending"===c)return void(this.toHide=this.toHide.not(this.errorsFor(b)));if(!c)return this.formatAndAdd(b,e),!1}catch(k){throw this.settings.debug&&window.console&&console.log("Exception occurred when checking element "+b.id+", check the '"+e.method+"' method.",k),k instanceof TypeError&&(k.message+=".  Exception occurred when checking element "+b.id+", check the '"+e.method+"' method."),k}}if(!i)return this.objectLength(g)&&this.successList.push(b),!0},customDataMessage:function(b,c){return a(b).data("msg"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase())||a(b).data("msg")},customMessage:function(a,b){var c=this.settings.messages[a];return c&&(c.constructor===String?c:c[b])},findDefined:function(){for(var a=0;a<arguments.length;a++)if(void 0!==arguments[a])return arguments[a]},defaultMessage:function(b,c){"string"==typeof c&&(c={method:c});var d=this.findDefined(this.customMessage(b.name,c.method),this.customDataMessage(b,c.method),!this.settings.ignoreTitle&&b.title||void 0,a.validator.messages[c.method],"<strong>Warning: No message defined for "+b.name+"</strong>"),e=/\$?\{(\d+)\}/g;return"function"==typeof d?d=d.call(this,c.parameters,b):e.test(d)&&(d=a.validator.format(d.replace(e,"{$1}"),c.parameters)),d},formatAndAdd:function(a,b){var c=this.defaultMessage(a,b);this.errorList.push({message:c,element:a,method:b.method}),this.errorMap[a.name]=c,this.submitted[a.name]=c},addWrapper:function(a){return this.settings.wrapper&&(a=a.add(a.parent(this.settings.wrapper))),a},defaultShowErrors:function(){var a,b,c;for(a=0;this.errorList[a];a++)c=this.errorList[a],this.settings.highlight&&this.settings.highlight.call(this,c.element,this.settings.errorClass,this.settings.validClass),this.showLabel(c.element,c.message);if(this.errorList.length&&(this.toShow=this.toShow.add(this.containers)),this.settings.success)for(a=0;this.successList[a];a++)this.showLabel(this.successList[a]);if(this.settings.unhighlight)for(a=0,b=this.validElements();b[a];a++)this.settings.unhighlight.call(this,b[a],this.settings.errorClass,this.settings.validClass);this.toHide=this.toHide.not(this.toShow),this.hideErrors(),this.addWrapper(this.toShow).show()},validElements:function(){return this.currentElements.not(this.invalidElements())},invalidElements:function(){return a(this.errorList).map(function(){return this.element})},showLabel:function(b,c){var d,e,f,g,h=this.errorsFor(b),i=this.idOrName(b),j=a(b).attr("aria-describedby");h.length?(h.removeClass(this.settings.validClass).addClass(this.settings.errorClass),this.settings&&this.settings.escapeHtml?h.text(c||""):h.html(c||"")):(h=a("<"+this.settings.errorElement+">").attr("id",i+"-error").addClass(this.settings.errorClass),this.settings&&this.settings.escapeHtml?h.text(c||""):h.html(c||""),d=h,this.settings.wrapper&&(d=h.hide().show().wrap("<"+this.settings.wrapper+"/>").parent()),this.labelContainer.length?this.labelContainer.append(d):this.settings.errorPlacement?this.settings.errorPlacement.call(this,d,a(b)):d.insertAfter(b),h.is("label")?h.attr("for",i):0===h.parents("label[for='"+this.escapeCssMeta(i)+"']").length&&(f=h.attr("id"),j?j.match(new RegExp("\\b"+this.escapeCssMeta(f)+"\\b"))||(j+=" "+f):j=f,a(b).attr("aria-describedby",j),e=this.groups[b.name],e&&(g=this,a.each(g.groups,function(b,c){c===e&&a("[name='"+g.escapeCssMeta(b)+"']",g.currentForm).attr("aria-describedby",h.attr("id"))})))),!c&&this.settings.success&&(h.text(""),"string"==typeof this.settings.success?h.addClass(this.settings.success):this.settings.success(h,b)),this.toShow=this.toShow.add(h)},errorsFor:function(b){var c=this.escapeCssMeta(this.idOrName(b)),d=a(b).attr("aria-describedby"),e="label[for='"+c+"'], label[for='"+c+"'] *";return d&&(e=e+", #"+this.escapeCssMeta(d).replace(/\s+/g,", #")),this.errors().filter(e)},escapeCssMeta:function(a){return void 0===a?"":a.replace(/([\\!"#$%&'()*+,./:;<=>?@\[\]^`{|}~])/g,"\\$1")},idOrName:function(a){return this.groups[a.name]||(this.checkable(a)?a.name:a.id||a.name)},validationTargetFor:function(b){return this.checkable(b)&&(b=this.findByName(b.name)),a(b).not(this.settings.ignore)[0]},checkable:function(a){return/radio|checkbox/i.test(a.type)},findByName:function(b){return a(this.currentForm).find("[name='"+this.escapeCssMeta(b)+"']")},getLength:function(b,c){switch(c.nodeName.toLowerCase()){case"select":return a("option:selected",c).length;case"input":if(this.checkable(c))return this.findByName(c.name).filter(":checked").length}return b.length},depend:function(a,b){return!this.dependTypes[typeof a]||this.dependTypes[typeof a](a,b)},dependTypes:{"boolean":function(a){return a},string:function(b,c){return!!a(b,c.form).length},"function":function(a,b){return a(b)}},optional:function(b){var c=this.elementValue(b);return!a.validator.methods.required.call(this,c,b)&&"dependency-mismatch"},elementAjaxPort:function(a){return"validate"+a.name},startRequest:function(b){this.pending[b.name]||(this.pendingRequest++,a(b).addClass(this.settings.pendingClass),this.pending[b.name]=!0)},stopRequest:function(b,c){this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass),c&&0===this.pendingRequest&&this.formSubmitted&&this.form()&&0===this.pendingRequest?(a(this.currentForm).trigger("submit"),this.submitButton&&a("input:hidden[name='"+this.submitButton.name+"']",this.currentForm).remove(),this.formSubmitted=!1):!c&&0===this.pendingRequest&&this.formSubmitted&&(a(this.currentForm).triggerHandler("invalid-form",[this]),this.formSubmitted=!1)},abortRequest:function(b){var c;this.pending[b.name]&&(c=this.elementAjaxPort(b),a.ajaxAbort(c),this.pendingRequest--,this.pendingRequest<0&&(this.pendingRequest=0),delete this.pending[b.name],a(b).removeClass(this.settings.pendingClass))},previousValue:function(b,c){return c="string"==typeof c&&c||"remote",a.data(b,"previousValue")||a.data(b,"previousValue",{old:null,valid:!0,message:this.defaultMessage(b,{method:c})})},destroy:function(){this.resetForm(),a(this.currentForm).off(".validate").removeData("validator").find(".validate-equalTo-blur").off(".validate-equalTo").removeClass("validate-equalTo-blur").find(".validate-lessThan-blur").off(".validate-lessThan").removeClass("validate-lessThan-blur").find(".validate-lessThanEqual-blur").off(".validate-lessThanEqual").removeClass("validate-lessThanEqual-blur").find(".validate-greaterThanEqual-blur").off(".validate-greaterThanEqual").removeClass("validate-greaterThanEqual-blur").find(".validate-greaterThan-blur").off(".validate-greaterThan").removeClass("validate-greaterThan-blur")}},classRuleSettings:{required:{required:!0},email:{email:!0},url:{url:!0},date:{date:!0},dateISO:{dateISO:!0},number:{number:!0},digits:{digits:!0},creditcard:{creditcard:!0}},addClassRules:function(b,c){b.constructor===String?this.classRuleSettings[b]=c:a.extend(this.classRuleSettings,b)},classRules:function(b){var c={},d=a(b).attr("class");return d&&a.each(d.split(" "),function(){this in a.validator.classRuleSettings&&a.extend(c,a.validator.classRuleSettings[this])}),c},normalizeAttributeRule:function(a,b,c,d){/min|max|step/.test(c)&&(null===b||/number|range|text/.test(b))&&(d=Number(d),isNaN(d)&&(d=void 0)),d||0===d?a[c]=d:b===c&&"range"!==b&&(a["date"===b?"dateISO":c]=!0)},attributeRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)"required"===c?(d=b.getAttribute(c),""===d&&(d=!0),d=!!d):d=f.attr(c),this.normalizeAttributeRule(e,g,c,d);return e.maxlength&&/-1|2147483647|524288/.test(e.maxlength)&&delete e.maxlength,e},dataRules:function(b){var c,d,e={},f=a(b),g=b.getAttribute("type");for(c in a.validator.methods)d=f.data("rule"+c.charAt(0).toUpperCase()+c.substring(1).toLowerCase()),""===d&&(d=!0),this.normalizeAttributeRule(e,g,c,d);return e},staticRules:function(b){var c={},d=a.data(b.form,"validator");return d.settings.rules&&(c=a.validator.normalizeRule(d.settings.rules[b.name])||{}),c},normalizeRules:function(b,c){return a.each(b,function(d,e){if(e===!1)return void delete b[d];if(e.param||e.depends){var f=!0;switch(typeof e.depends){case"string":f=!!a(e.depends,c.form).length;break;case"function":f=e.depends.call(c,c)}f?b[d]=void 0===e.param||e.param:(a.data(c.form,"validator").resetElements(a(c)),delete b[d])}}),a.each(b,function(a,d){b[a]="function"==typeof d&&"normalizer"!==a?d(c):d}),a.each(["minlength","maxlength"],function(){b[this]&&(b[this]=Number(b[this]))}),a.each(["rangelength","range"],function(){var a;b[this]&&(Array.isArray(b[this])?b[this]=[Number(b[this][0]),Number(b[this][1])]:"string"==typeof b[this]&&(a=b[this].replace(/[\[\]]/g,"").split(/[\s,]+/),b[this]=[Number(a[0]),Number(a[1])]))}),a.validator.autoCreateRanges&&(null!=b.min&&null!=b.max&&(b.range=[b.min,b.max],delete b.min,delete b.max),null!=b.minlength&&null!=b.maxlength&&(b.rangelength=[b.minlength,b.maxlength],delete b.minlength,delete b.maxlength)),b},normalizeRule:function(b){if("string"==typeof b){var c={};a.each(b.split(/\s/),function(){c[this]=!0}),b=c}return b},addMethod:function(b,c,d){a.validator.methods[b]=c,a.validator.messages[b]=void 0!==d?d:a.validator.messages[b],c.length<3&&a.validator.addClassRules(b,a.validator.normalizeRule(b))},methods:{required:function(b,c,d){if(!this.depend(d,c))return"dependency-mismatch";if("select"===c.nodeName.toLowerCase()){var e=a(c).val();return e&&e.length>0}return this.checkable(c)?this.getLength(b,c)>0:void 0!==b&&null!==b&&b.length>0},email:function(a,b){return this.optional(b)||/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(a)},url:function(a,b){return this.optional(b)||/^(?:(?:(?:https?|ftp):)?\/\/)(?:(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})+(?::(?:[^\]\[?\/<~#`!@$^&*()+=}|:";',>{ ]|%[0-9A-Fa-f]{2})*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i.test(a)},date:function(){var a=!1;return function(b,c){return a||(a=!0,this.settings.debug&&window.console&&console.warn("The `date` method is deprecated and will be removed in version '2.0.0'.\nPlease don't use it, since it relies on the Date constructor, which\nbehaves very differently across browsers and locales. Use `dateISO`\ninstead or one of the locale specific methods in `localizations/`\nand `additional-methods.js`.")),this.optional(c)||!/Invalid|NaN/.test(new Date(b).toString())}}(),dateISO:function(a,b){return this.optional(b)||/^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a)},number:function(a,b){return this.optional(b)||/^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:-?\.\d+)?$/.test(a)},digits:function(a,b){return this.optional(b)||/^\d+$/.test(a)},minlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c},maxlength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d<=c},rangelength:function(a,b,c){var d=Array.isArray(a)?a.length:this.getLength(a,b);return this.optional(b)||d>=c[0]&&d<=c[1]},min:function(a,b,c){return this.optional(b)||a>=c},max:function(a,b,c){return this.optional(b)||a<=c},range:function(a,b,c){return this.optional(b)||a>=c[0]&&a<=c[1]},step:function(b,c,d){var e,f=a(c).attr("type"),g="Step attribute on input type "+f+" is not supported.",h=["text","number","range"],i=new RegExp("\\b"+f+"\\b"),j=f&&!i.test(h.join()),k=function(a){var b=(""+a).match(/(?:\.(\d+))?$/);return b&&b[1]?b[1].length:0},l=function(a){return Math.round(a*Math.pow(10,e))},m=!0;if(j)throw new Error(g);return e=k(d),(k(b)>e||l(b)%l(d)!==0)&&(m=!1),this.optional(c)||m},equalTo:function(b,c,d){var e=a(d);return this.settings.onfocusout&&e.not(".validate-equalTo-blur").length&&e.addClass("validate-equalTo-blur").on("blur.validate-equalTo",function(){a(c).valid()}),b===e.val()},remote:function(b,c,d,e){if(this.optional(c))return"dependency-mismatch";e="string"==typeof e&&e||"remote";var f,g,h,i=this.previousValue(c,e);return this.settings.messages[c.name]||(this.settings.messages[c.name]={}),i.originalMessage=i.originalMessage||this.settings.messages[c.name][e],this.settings.messages[c.name][e]=i.message,d="string"==typeof d&&{url:d}||d,h=a.param(a.extend({data:b},d.data)),null!==i.valid&&i.old===h?i.valid:(i.old=h,i.valid=null,f=this,this.startRequest(c),g={},g[c.name]=b,a.ajax(a.extend(!0,{mode:"abort",port:this.elementAjaxPort(c),dataType:"json",data:g,context:f.currentForm,success:function(a){var d,g,h,j=a===!0||"true"===a;f.settings.messages[c.name][e]=i.originalMessage,j?(h=f.formSubmitted,f.toHide=f.errorsFor(c),f.formSubmitted=h,f.successList.push(c),f.invalid[c.name]=!1,f.showErrors()):(d={},g=a||f.defaultMessage(c,{method:e,parameters:b}),d[c.name]=i.message=g,f.invalid[c.name]=!0,f.showErrors(d)),i.valid=j,f.stopRequest(c,j)}},d)),"pending")}}});var c,d={};return a.ajaxPrefilter?a.ajaxPrefilter(function(b,c,e){var f=b.port;"abort"===b.mode&&(a.ajaxAbort(f),d[f]=e)}):(c=a.ajax,a.ajax=function(b){var e=("mode"in b?b:a.ajaxSettings).mode,f=("port"in b?b:a.ajaxSettings).port;return"abort"===e?(a.ajaxAbort(f),d[f]=c.apply(this,arguments),d[f]):c.apply(this,arguments)}),a.ajaxAbort=function(a){d[a]&&(d[a].abort(),delete d[a])},a});
  • weight-loss-tracker/trunk/includes/core.php

    r3145588 r3158785  
    3333                    'user-id'                           => $user_id,
    3434                    'current-url'                       => apply_filters( 'wlt_current_url', get_permalink() ),
    35                     'photos-enabled'                    => ( ws_ls_meta_fields_photo_any_enabled( true ) ) ? 'true' : 'false',
     35                    'photos-enabled'                    => ws_ls_meta_fields_photo_any_enabled( false ) ? 'true' : 'false',
    3636                    'date-picker-locale'                => ws_ls_config_js_datapicker_locale(),
    3737                    'in-admin'                          => ( is_admin() ) ? 'true' : 'false',
  • weight-loss-tracker/trunk/pro-features/plus/meta-fields/functions.php

    r3145588 r3158785  
    590590        // Show Add button
    591591        $html .= sprintf('<div class="ws-ls-cell ws-ls-photo-select">
    592                                 <input type="file" data-msg="%6$s \'%7$s\'." name="%1$s" id="%8$s" tabindex="%2$s" data-rule-accept="png|jpeg|jpg" class="ws-ls-hide ws-ls-input-file ws-ls-meta-fields-photo" %5$s data-required="%4$s" />
     592                                <input type="file" data-msg="%6$s \'%7$s\'." name="%1$s" id="%8$s" tabindex="%2$s"data-rule-accept="image/jpeg,image/pjpeg,image/png"
     593                                    class="ws-ls-hide ws-ls-input-file ws-ls-meta-fields-photo" %5$s data-required="%4$s" />
    593594                                <label for="%8$s" class="ws-ls-button">
    594595                                    <svg xmlns="http://www.w3.org/2000/svg" width="20" height="17" viewBox="0 0 20 17"><path d="M10 0l-5.2 4.9h3.3v5.1h3.8v-5.1h3.3l-5.2-4.9zm9.3 11.5l-3.2-2.1h-2l3.4 2.6h-3.5c-.1 0-.2.1-.2.1l-.8 2.3h-6l-.8-2.2c-.1-.1-.1-.2-.2-.2h-3.6l3.4-2.6h-2l-3.2 2.1c-.4.3-.7 1-.6 1.5l.6 3.1c.1.5.7.9 1.2.9h16.3c.6 0 1.1-.4 1.3-.9l.6-3.1c.1-.5-.2-1.2-.7-1.5z"/></svg>
  • weight-loss-tracker/trunk/readme.txt

    r3154754 r3158785  
    44Requires at least: 6.0
    55Tested up to: 6.5
    6 Stable tag: 10.13
     6Stable tag: 10.14
    77Requires PHP: 7.4
    88License: GPLv2 or later
     
    170170
    171171== Changelog ==
     172
     173= 10.14 =
     174
     175* Bug fix: Fixed an issue where photo uploads weren't allowed when "hide from shortcodes" was selected.
    172176
    173177= 10.13 =
  • weight-loss-tracker/trunk/weight-loss-tracker.php

    r3154754 r3158785  
    66 * Plugin Name:         Weight Tracker
    77 * Description:         Allow your users to track their weight, body measurements, photos and other pieces of custom data. Display in charts, tables, shortcodes and widgets. Manage their data, issue awards, email notifications, etc! Provide advanced data on Body Mass Index (BMI), Basal Metabolic Rate (BMR), Calorie intake, Harris Benedict Formula, Macronutrients Calculator and more.
    8  * Version:             10.13
     8 * Version:             10.14
    99 * Requires at least:   6.0
    1010 * Tested up to:        6.5
     
    1818 */
    1919
    20 define( 'WE_LS_CURRENT_VERSION', '10.13' );
     20define( 'WE_LS_CURRENT_VERSION', '10.14' );
    2121define( 'WS_LS_ABSPATH', plugin_dir_path( __FILE__ ) );
    2222define( 'WS_LS_BASE_URL', plugin_dir_url( __FILE__ ) );
Note: See TracChangeset for help on using the changeset viewer.