1/*! jQuery Validation Plugin - v1.19.2 - 5/23/2020 2 * https://jqueryvalidation.org/ 3 * Copyright (c) 2020 Jörn Zaefferer; Licensed MIT */ 4!(function (a) { 5 'function' == typeof define && define.amd 6 ? define(['jquery'], a) 7 : 'object' == typeof module && module.exports 8 ? (module.exports = a(require('jquery'))) 9 : a(jQuery); 10})(function (a) { 11 a.extend(a.fn, { 12 validate: function (b) { 13 if (!this.length) return void (b && b.debug && window.console && console.warn("Nothing selected, can't validate, returning nothing.")); 14 var c = a.data(this[0], 'validator'); 15 return c 16 ? c 17 : (this.attr('novalidate', 'novalidate'), 18 (c = new a.validator(b, this[0])), 19 a.data(this[0], 'validator', c), 20 c.settings.onsubmit && 21 (this.on('click.validate', ':submit', function (b) { 22 (c.submitButton = b.currentTarget), 23 a(this).hasClass('cancel') && (c.cancelSubmit = !0), 24 void 0 !== a(this).attr('formnovalidate') && (c.cancelSubmit = !0); 25 }), 26 this.on('submit.validate', function (b) { 27 function d() { 28 var d, e; 29 return ( 30 c.submitButton && 31 (c.settings.submitHandler || c.formSubmitted) && 32 (d = a("<input type='hidden'/>").attr('name', c.submitButton.name).val(a(c.submitButton).val()).appendTo(c.currentForm)), 33 !(c.settings.submitHandler && !c.settings.debug) || 34 ((e = c.settings.submitHandler.call(c, c.currentForm, b)), d && d.remove(), void 0 !== e && e) 35 ); 36 } 37 return ( 38 c.settings.debug && b.preventDefault(), 39 c.cancelSubmit ? ((c.cancelSubmit = !1), d()) : c.form() ? (c.pendingRequest ? ((c.formSubmitted = !0), !1) : d()) : (c.focusInvalid(), !1) 40 ); 41 })), 42 c); 43 }, 44 valid: function () { 45 var b, c, d; 46 return ( 47 a(this[0]).is('form') 48 ? (b = this.validate().form()) 49 : ((d = []), 50 (b = !0), 51 (c = a(this[0].form).validate()), 52 this.each(function () { 53 (b = c.element(this) && b), b || (d = d.concat(c.errorList)); 54 }), 55 (c.errorList = d)), 56 b 57 ); 58 }, 59 rules: function (b, c) { 60 var d, 61 e, 62 f, 63 g, 64 h, 65 i, 66 j = this[0], 67 k = 'undefined' != typeof this.attr('contenteditable') && 'false' !== this.attr('contenteditable'); 68 if (null != j && (!j.form && k && ((j.form = this.closest('form')[0]), (j.name = this.attr('name'))), null != j.form)) { 69 if (b) 70 switch (((d = a.data(j.form, 'validator').settings), (e = d.rules), (f = a.validator.staticRules(j)), b)) { 71 case 'add': 72 a.extend(f, a.validator.normalizeRule(c)), 73 delete f.messages, 74 (e[j.name] = f), 75 c.messages && (d.messages[j.name] = a.extend(d.messages[j.name], c.messages)); 76 break; 77 case 'remove': 78 return c 79 ? ((i = {}), 80 a.each(c.split(/\s/), function (a, b) { 81 (i[b] = f[b]), delete f[b]; 82 }), 83 i) 84 : (delete e[j.name], f); 85 } 86 return ( 87 (g = a.validator.normalizeRules( 88 a.extend({}, a.validator.classRules(j), a.validator.attributeRules(j), a.validator.dataRules(j), a.validator.staticRules(j)), 89 j, 90 )), 91 g.required && ((h = g.required), delete g.required, (g = a.extend({required: h}, g))), 92 g.remote && ((h = g.remote), delete g.remote, (g = a.extend(g, {remote: h}))), 93 g 94 ); 95 } 96 }, 97 }); 98 var b = function (a) { 99 return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ''); 100 }; 101 a.extend(a.expr.pseudos || a.expr[':'], { 102 blank: function (c) { 103 return !b('' + a(c).val()); 104 }, 105 filled: function (c) { 106 var d = a(c).val(); 107 return null !== d && !!b('' + d); 108 }, 109 unchecked: function (b) { 110 return !a(b).prop('checked'); 111 }, 112 }), 113 (a.validator = function (b, c) { 114 (this.settings = a.extend(!0, {}, a.validator.defaults, b)), (this.currentForm = c), this.init(); 115 }), 116 (a.validator.format = function (b, c) { 117 return 1 === arguments.length 118 ? function () { 119 var c = a.makeArray(arguments); 120 return c.unshift(b), a.validator.format.apply(this, c); 121 } 122 : void 0 === c 123 ? b 124 : (arguments.length > 2 && c.constructor !== Array && (c = a.makeArray(arguments).slice(1)), 125 c.constructor !== Array && (c = [c]), 126 a.each(c, function (a, c) { 127 b = b.replace(new RegExp('\\{' + a + '\\}', 'g'), function () { 128 return c; 129 }); 130 }), 131 b); 132 }),
133 a.extend(a.validator, { 134 defaults: { 135 messages: {}, 136 groups: {}, 137 rules: {}, 138 errorClass: 'error', 139 pendingClass: 'pending', 140 validClass: 'valid', 141 errorElement: 'label', 142 focusCleanup: !1, 143 focusInvalid: !0, 144 errorContainer: a([]), 145 errorLabelContainer: a([]), 146 onsubmit: !0, 147 ignore: ':hidden', 148 ignoreTitle: !1, 149 onfocusin: function (a) { 150 (this.lastActive = a), 151 this.settings.focusCleanup && 152 (this.settings.unhighlight && this.settings.unhighlight.call(this, a, this.settings.errorClass, this.settings.validClass), 153 this.hideThese(this.errorsFor(a))); 154 }, 155 onfocusout: function (a) { 156 this.checkable(a) || (!(a.name in this.submitted) && this.optional(a)) || this.element(a); 157 }, 158 onkeyup: function (b, c) { 159 var d = [16, 17, 18, 20, 35, 36, 37, 38, 39, 40, 45, 144, 225]; 160 (9 === c.which && '' === this.elementValue(b)) || 161 a.inArray(c.keyCode, d) !== -1 || 162 ((b.name in this.submitted || b.name in this.invalid) && this.element(b)); 163 }, 164 onclick: function (a) { 165 a.name in this.submitted ? this.element(a) : a.parentNode.name in this.submitted && this.element(a.parentNode); 166 }, 167 highlight: function (b, c, d) { 168 'radio' === b.type ? this.findByName(b.name).addClass(c).removeClass(d) : a(b).addClass(c).removeClass(d); 169 }, 170 unhighlight: function (b, c, d) { 171 'radio' === b.type ? this.findByName(b.name).removeClass(c).addClass(d) : a(b).removeClass(c).addClass(d); 172 }, 173 }, 174 setDefaults: function (b) { 175 a.extend(a.validator.defaults, b); 176 }, 177 messages: { 178 required: 'This field is required.', 179 remote: 'Please fix this field.', 180 email: 'Please enter a valid email address.', 181 url: 'Please enter a valid URL.', 182 date: 'Please enter a valid date.', 183 dateISO: 'Please enter a valid date (ISO).', 184 number: 'Please enter a valid number.', 185 digits: 'Please enter only digits.', 186 equalTo: 'Please enter the same value again.', 187 maxlength: a.validator.format('Please enter no more than {0} characters.'), 188 minlength: a.validator.format('Please enter at least {0} characters.'), 189 rangelength: a.validator.format('Please enter a value between {0} and {1} characters long.'), 190 range: a.validator.format('Please enter a value between {0} and {1}.'), 191 max: a.validator.format('Please enter a value less than or equal to {0}.'), 192 min: a.validator.format('Please enter a value greater than or equal to {0}.'), 193 step: a.validator.format('Please enter a multiple of {0}.'), 194 }, 195 autoCreateRanges: !1, 196 prototype: { 197 init: function () { 198 function b(b) { 199 var c = 'undefined' != typeof a(this).attr('contenteditable') && 'false' !== a(this).attr('contenteditable'); 200 if ((!this.form && c && ((this.form = a(this).closest('form')[0]), (this.name = a(this).attr('name'))), d === this.form)) { 201 var e = a.data(this.form, 'validator'), 202 f = 'on' + b.type.replace(/^validate/, ''), 203 g = e.settings; 204 g[f] && !a(this).is(g.ignore) && g[f].call(e, this, b); 205 } 206 } 207 (this.labelContainer = a(this.settings.errorLabelContainer)), 208 (this.errorContext = (this.labelContainer.length && this.labelContainer) || a(this.currentForm)), 209 (this.containers = a(this.settings.errorContainer).add(this.settings.errorLabelContainer)), 210 (this.submitted = {}), 211 (this.valueCache = {}), 212 (this.pendingRequest = 0), 213 (this.pending = {}), 214 (this.invalid = {}), 215 this.reset(); 216 var c, 217 d = this.currentForm, 218 e = (this.groups = {}); 219 a.each(this.settings.groups, function (b, c) { 220 'string' == typeof c && (c = c.split(/\s/)), 221 a.each(c, function (a, c) { 222 e[c] = b; 223 }); 224 }), 225 (c = this.settings.rules), 226 a.each(c, function (b, d) { 227 c[b] = a.validator.normalizeRule(d); 228 }), 229 a(this.currentForm) 230 .on(
231 'focusin.validate focusout.validate keyup.validate', 232 ":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']", 233 b, 234 ) 235 .on('click.validate', "select, option, [type='radio'], [type='checkbox']", b), 236 this.settings.invalidHandler && a(this.currentForm).on('invalid-form.validate', this.settings.invalidHandler); 237 }, 238 form: function () { 239 return ( 240 this.checkForm(), 241 a.extend(this.submitted, this.errorMap), 242 (this.invalid = a.extend({}, this.errorMap)), 243 this.valid() || a(this.currentForm).triggerHandler('invalid-form', [this]), 244 this.showErrors(), 245 this.valid() 246 ); 247 }, 248 checkForm: function () { 249 this.prepareForm(); 250 for (var a = 0, b = (this.currentElements = this.elements()); b[a]; a++) this.check(b[a]); 251 return this.valid(); 252 }, 253 element: function (b) { 254 var c, 255 d, 256 e = this.clean(b), 257 f = this.validationTargetFor(e), 258 g = this, 259 h = !0; 260 return ( 261 void 0 === f 262 ? delete this.invalid[e.name] 263 : (this.prepareElement(f), 264 (this.currentElements = a(f)), 265 (d = this.groups[f.name]), 266 d && 267 a.each(this.groups, function (a, b) { 268 b === d && 269 a !== f.name && 270 ((e = g.validationTargetFor(g.clean(g.findByName(a)))), e && e.name in g.invalid && (g.currentElements.push(e), (h = g.check(e) && h))); 271 }), 272 (c = this.check(f) !== !1), 273 (h = h && c), 274 c ? (this.invalid[f.name] = !1) : (this.invalid[f.name] = !0), 275 this.numberOfInvalids() || (this.toHide = this.toHide.add(this.containers)), 276 this.showErrors(), 277 a(b).attr('aria-invalid', !c)), 278 h 279 ); 280 }, 281 showErrors: function (b) { 282 if (b) { 283 var c = this; 284 a.extend(this.errorMap, b), 285 (this.errorList = a.map(this.errorMap, function (a, b) { 286 return {message: a, element: c.findByName(b)[0]}; 287 })), 288 (this.successList = a.grep(this.successList, function (a) { 289 return !(a.name in b); 290 })); 291 } 292 this.settings.showErrors ? this.settings.showErrors.call(this, this.errorMap, this.errorList) : this.defaultShowErrors(); 293 }, 294 resetForm: function () { 295 a.fn.resetForm && a(this.currentForm).resetForm(), (this.invalid = {}), (this.submitted = {}), this.prepareForm(), this.hideErrors(); 296 var b = this.elements().removeData('previousValue').removeAttr('aria-invalid'); 297 this.resetElements(b); 298 }, 299 resetElements: function (a) { 300 var b; 301 if (this.settings.unhighlight) 302 for (b = 0; a[b]; b++) 303 this.settings.unhighlight.call(this, a[b], this.settings.errorClass, ''), this.findByName(a[b].name).removeClass(this.settings.validClass); 304 else a.removeClass(this.settings.errorClass).removeClass(this.settings.validClass); 305 }, 306 numberOfInvalids: function () { 307 return this.objectLength(this.invalid); 308 }, 309 objectLength: function (a) { 310 var b, 311 c = 0; 312 for (b in a) void 0 !== a[b] && null !== a[b] && a[b] !== !1 && c++; 313 return c; 314 }, 315 hideErrors: function () { 316 this.hideThese(this.toHide); 317 }, 318 hideThese: function (a) { 319 a.not(this.containers).text(''), this.addWrapper(a).hide(); 320 }, 321 valid: function () { 322 return 0 === this.size(); 323 }, 324 size: function () { 325 return this.errorList.length; 326 }, 327 focusInvalid: function () { 328 if (this.settings.focusInvalid) 329 try { 330 a(this.findLastActive() || (this.errorList.length && this.errorList[0].element) || []) 331 .filter(':visible') 332 .trigger('focus') 333 .trigger('focusin'); 334 } catch (b) {} 335 }, 336 findLastActive: function () { 337 var b = this.lastActive; 338 return ( 339 b && 340 1 === 341 a.grep(this.errorList, function (a) { 342 return a.element.name === b.name; 343 }).length && 344 b 345 ); 346 }, 347 elements: function () { 348 var b = this, 349 c = {}; 350 return a(this.currentForm) 351 .find('input, select, textarea, [contenteditable]') 352 .not(':submit, :reset, :image, :disabled') 353 .not(this.settings.ignore) 354 .filter(function () { 355 var d = this.name || a(this).attr('name'), 356 e = 'undefined' != typeof a(this).attr('contenteditable') && 'false' !== a(this).attr('contenteditable'); 357 return ( 358 !d && b.settings.debug && window.console && console.error('%o has no name assigned', this), 359 e && ((this.form = a(this).closest('form')[0]), (this.name = d)), 360 this.form === b.currentForm && !(d in c || !b.objectLength(a(this).rules())) && ((c[d] = !0), !0) 361 ); 362 }); 363 }, 364 clean: function (b) { 365 return a(b)[0]; 366 }, 367 errors: function () { 368 var b = this.settings.errorClass.split(' ').join('.'); 369 return a(this.settings.errorElement + '.' + b, this.errorContext); 370 }, 371 resetInternals: function () { 372 (this.successList = []), (this.errorList = []), (this.errorMap = {}), (this.toShow = a([])), (this.toHide = a([])); 373 }, 374 reset: function () { 375 this.resetInternals(), (this.currentElements = a([])); 376 }, 377 prepareForm: function () { 378 this.reset(), (this.toHide = this.errors().add(this.containers
378)); 379 }, 380 prepareElement: function (a) { 381 this.reset(), (this.toHide = this.errorsFor(a)); 382 }, 383 elementValue: function (b) { 384 var c, 385 d, 386 e = a(b), 387 f = b.type, 388 g = 'undefined' != typeof e.attr('contenteditable') && 'false' !== e.attr('contenteditable'); 389 return 'radio' === f || 'checkbox' === f 390 ? this.findByName(b.name).filter(':checked').val() 391 : 'number' === f && 'undefined' != typeof b.validity 392 ? b.validity.badInput 393 ? 'NaN' 394 : e.val() 395 : ((c = g ? e.text() : e.val()), 396 'file' === f 397 ? 'C:\\fakepath\\' === c.substr(0, 12) 398 ? c.substr(12) 399 : ((d = c.lastIndexOf('/')), d >= 0 ? c.substr(d + 1) : ((d = c.lastIndexOf('\\')), d >= 0 ? c.substr(d + 1) : c)) 400 : 'string' == typeof c 401 ? c.replace(/\r/g, '') 402 : c); 403 }, 404 check: function (b) { 405 b = this.validationTargetFor(this.clean(b)); 406 var c, 407 d, 408 e, 409 f, 410 g = a(b).rules(), 411 h = a.map(g, function (a, b) { 412 return b; 413 }).length, 414 i = !1, 415 j = this.elementValue(b); 416 'function' == typeof g.normalizer ? (f = g.normalizer) : 'function' == typeof this.settings.normalizer && (f = this.settings.normalizer), 417 f && ((j = f.call(b, j)), delete g.normalizer); 418 for (d in g) { 419 e = {method: d, parameters: g[d]}; 420 try { 421 if (((c = a.validator.methods[d].call(this, j, b, e.parameters)), 'dependency-mismatch' === c && 1 === h)) { 422 i = !0; 423 continue; 424 } 425 if (((i = !1), 'pending' === c)) return void (this.toHide = this.toHide.not(this.errorsFor(b))); 426 if (!c) return this.formatAndAdd(b, e), !1; 427 } catch (k) { 428 throw ( 429 (this.settings.debug && 430 window.console && 431 console.log('Exception occurred when checking element ' + b.id + ", check the '" + e.method + "' method.", k), 432 k instanceof TypeError && (k.message += '. Exception occurred when checking element ' + b.id + ", check the '" + e.method + "' method."), 433 k) 434 ); 435 } 436 } 437 if (!i) return this.objectLength(g) && this.successList.push(b), !0; 438 }, 439 customDataMessage: function (b, c) { 440 return a(b).data('msg' + c.charAt(0).toUpperCase() + c.substring(1).toLowerCase()) || a(b).data('msg'); 441 }, 442 customMessage: function (a, b) { 443 var c = this.settings.messages[a]; 444 return c && (c.constructor === String ? c : c[b]); 445 }, 446 findDefined: function () { 447 for (var a = 0; a < arguments.length; a++) if (void 0 !== arguments[a]) return arguments[a]; 448 }, 449 defaultMessage: function (b, c) { 450 'string' == typeof c && (c = {method: c}); 451 var d = this.findDefined( 452 this.customMessage(b.name, c.method), 453 this.customDataMessage(b, c.method), 454 (!this.settings.ignoreTitle && b.title) || void 0, 455 a.validator.messages[c.method], 456 '<strong>Warning: No message defined for ' + b.name + '</strong>', 457 ), 458 e = /\$?\{(\d+)\}/g; 459 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; 460 }, 461 formatAndAdd: function (a, b) { 462 var c = this.defaultMessage(a, b); 463 this.errorList.push({message: c, element: a, method: b.method}), (this.errorMap[a.name] = c), (this.submitted[a.name] = c); 464 }, 465 addWrapper: function (a) { 466 return this.settings.wrapper && (a = a.add(a.parent(this.settings.wrapper))), a; 467 }, 468 defaultShowErrors: function () { 469 var a, b, c; 470 for (a = 0; this.errorList[a]; a++) 471 (c = this.errorList[a]), 472 this.settings.highlight && this.settings.highlight.call(this, c.element, this.settings.errorClass, this.settings.val
472idClass), 473 this.showLabel(c.element, c.message); 474 if ((this.errorList.length && (this.toShow = this.toShow.add(this.containers)), this.settings.success)) 475 for (a = 0; this.successList[a]; a++) this.showLabel(this.successList[a]); 476 if (this.settings.unhighlight) 477 for (a = 0, b = this.validElements(); b[a]; a++) this.settings.unhighlight.call(this, b[a], this.settings.errorClass, this.settings.validClass); 478 (this.toHide = this.toHide.not(this.toShow)), this.hideErrors(), this.addWrapper(this.toShow).show(); 479 }, 480 validElements: function () { 481 return this.currentElements.not(this.invalidElements()); 482 }, 483 invalidElements: function () { 484 return a(this.errorList).map(function () { 485 return this.element; 486 }); 487 }, 488 showLabel: function (b, c) { 489 var d, 490 e, 491 f, 492 g, 493 h = this.errorsFor(b), 494 i = this.idOrName(b), 495 j = a(b).attr('aria-describedby'); 496 h.length 497 ? (h.removeClass(this.settings.validClass).addClass(this.settings.errorClass), h.html(c)) 498 : ((h = a('<' + this.settings.errorElement + '>') 499 .attr('id', i + '-error') 500 .addClass(this.settings.errorClass) 501 .html(c || '')), 502 (d = h), 503 this.settings.wrapper && 504 (d = h 505 .hide() 506 .show() 507 .wrap('<' + this.settings.wrapper + '/>') 508 .parent()), 509 this.labelContainer.length 510 ? this.labelContainer.append(d) 511 : this.settings.errorPlacement 512 ? this.settings.errorPlacement.call(this, d, a(b)) 513 : d.insertAfter(b), 514 h.is('label') 515 ? h.attr('for', i) 516 : 0 === h.parents("label[for='" + this.escapeCssMeta(i) + "']").length && 517 ((f = h.attr('id')), 518 j ? j.match(new RegExp('\\b' + this.escapeCssMeta(f) + '\\b')) || (j += ' ' + f) : (j = f), 519 a(b).attr('aria-describedby', j),
520 (e = this.groups[b.name]), 521 e && 522 ((g = this), 523 a.each(g.groups, function (b, c) { 524 c === e && a("[name='" + g.escapeCssMeta(b) + "']", g.currentForm).attr('aria-describedby', h.attr('id')); 525 })))), 526 !c && 527 this.settings.success && 528 (h.text(''), 'string' == typeof this.settings.success ? h.addClass(this.settings.success) : this.settings.success(h, b)), 529 (this.toShow = this.toShow.add(h)); 530 }, 531 errorsFor: function (b) { 532 var c = this.escapeCssMeta(this.idOrName(b)), 533 d = a(b).attr('aria-describedby'), 534 e = "label[for='" + c + "'], label[for='" + c + "'] *"; 535 return d && (e = e + ', #' + this.escapeCssMeta(d).replace(/\s+/g, ', #')), this.errors().filter(e); 536 }, 537 escapeCssMeta: function (a) { 538 return a.replace(/([\\!"#$%&'()*+,.\/:;<=>?@\[\]^`{|}~])/g, '\\$1'); 539 }, 540 idOrName: function (a) { 541 return this.groups[a.name] || (this.checkable(a) ? a.name : a.id || a.name); 542 }, 543 validationTargetFor: function (b) { 544 return this.checkable(b) && (b = this.findByName(b.name)), a(b).not(this.settings.ignore)[0]; 545 }, 546 checkable: function (a) { 547 return /radio|checkbox/i.test(a.type); 548 }, 549 findByName: function (b) { 550 return a(this.currentForm).find("[name='" + this.escapeCssMeta(b) + "']"); 551 }, 552 getLength: function (b, c) { 553 switch (c.nodeName.toLowerCase()) { 554 case 'select': 555 return a('option:selected', c).length; 556 case 'input': 557 if (this.checkable(c)) return this.findByName(c.name).filter(':checked').length; 558 } 559 return b.length; 560 }, 561 depend: function (a, b) { 562 return !this.dependTypes[typeof a] || this.dependTypes[typeof a](a, b); 563 }, 564 dependTypes: { 565 boolean: function (a) { 566 return a; 567 }, 568 string: function (b, c) { 569 return !!a(b, c.form).length; 570 }, 571 function: function (a, b) { 572 return a(b); 573 }, 574 }, 575 optional: function (b) { 576 var c = this.elementValue(b); 577 return !a.validator.methods.required.call(this, c, b) && 'dependency-mismatch'; 578 }, 579 startRequest: function (b) { 580 this.pending[b.name] || (this.pendingRequest++, a(b).addClass(this.settings.pendingClass), (this.pending[b.name] = !0)); 581 }, 582 stopRequest: function (b, c) { 583 this.pendingRequest--, 584 this.pendingRequest < 0 && (this.pendingRequest = 0), 585 delete this.pending[b.name], 586 a(b).removeClass(this.settings.pendingClass), 587 c && 0 === this.pendingRequest && this.formSubmitted && this.form() 588 ? (a(this.currentForm).submit(), 589 this.submitButton && a("input:hidden[name='" + this.submitButton.name + "']", this.currentForm).remove(), 590 (this.formSubmitted = !1)) 591 : !c && 592 0 === this.pendingRequest && 593 this.formSubmitted && 594 (a(this.currentForm).triggerHandler('invalid-form', [this]), (this.formSubmitted = !1)); 595 }, 596 previousValue: function (b, c) { 597 return ( 598 (c = ('string' == typeof c && c) || 'remote'), 599 a.data(b, 'previousValue') || a.data(b, 'previousValue', {old: null, valid: !0, message: this.defaultMessage(b, {method: c})}) 600 ); 601 }, 602 destroy: function () { 603 this.resetForm(), 604 a(this.currentForm) 605 .off('.validate') 606 .removeData('validator') 607 .find('.validate-equalTo-blur') 608 .off('.validate-equalTo') 609 .removeClass('validate-equalTo-blur') 610 .find('.validate-lessThan-blur') 611 .off('.validate-lessThan') 612 .removeClass('validate-lessThan-blur') 613 .find('.validate-lessThanEqual-blur') 614 .off('.validate-lessThanEqual') 615 .removeClass('validate-lessThanEqual-blur') 616 .find('.validate-greaterThanEqual-blur') 617 .off('.validate-greaterThanEqual') 618 .removeClass('validate-greaterThanEqual-blur') 619 .find('.validate-greaterThan-blur') 620 .off('.validate-greaterThan') 621 .removeClass('validate-greaterThan-blur'); 622 }, 623 }, 624 classRuleSettings: { 625 required: {required: !0}, 626 email: {email: !0}, 627 url: {url: !0}, 628 date: {date: !0}, 629 dateISO: {dateISO: !0}, 630 number: {number: !0}, 631 digits: {digits: !0}, 632 creditcard: {creditcard: !0}, 633 }, 634 addClassRules: function (b, c) { 635 b.constructor === String ? (this.classRuleSettings[b] = c) : a.extend(this.classRuleSettings, b); 636 }, 637 classRules: function (b) { 638 var c = {}, 639 d = a(b).attr('class'); 640 return ( 641 d && 642 a.each(d.split(' '), function () { 643 this in a.validator.classRuleSettings && a.extend(c, a.validator.classRuleSettings[this]); 644 }), 645 c 646 ); 647 }, 648 normalizeAttributeRule: function (a, b, c, d) { 649 /min|max|step/.test(c) && (null === b || /number|range|text/.test(b)) && ((d = Number(d)), isNaN(d) && (d = void 0)), 650 d || 0 === d ? (a[c] = d) : b === c && 'range' !== b && (a[c] = !0); 651 }, 652 attributeRules: function (b) { 653 var c, 654 d, 655 e = {}, 656 f = a(b), 657 g = b.getAttribute('type'); 658 for (c in a.validator.methods) 659 'required' === c ? ((d = b.getAttribute(c)), '' === d && (d = !0), (d = !!d)) : (d = f.attr(c)), this.normalizeAttributeRule(e, g, c, d); 660 return e.maxlength && /-1|2147483647|524288/.test(e.maxlength) && delete e.maxlength, e; 661 }, 662 dataRules: function (b) { 663 var c, 664 d, 665 e = {}, 666 f = a(b), 667 g = b.getAttribute('type'); 668 for (c in a.validator.methods) 669 (d = f.data('rule' + c.charAt(0).toUpperCase() + c.substring(1).toLowerCase())), '' === d && (d = !0), this.normalizeAttributeRule(e, g, c, d); 670 return e; 671 }, 672 staticRules: function (b) { 673 var c = {}, 674 d = a.data(b.form, 'validator'); 675 return d.settings.rules && (c = a.validator.normalizeRule(d.settings.rules[b.name]) || {}), c; 676 }, 677 normalizeRules: function (b, c) { 678 return ( 679 a.each(b, function (d, e) { 680 if (e === !1) return void delete b[d]; 681 if (e.param || e.depends) { 682 var f = !0; 683 switch (typeof e.depends) { 684 case 'string': 685 f = !!a(e.depends, c.form).length; 686 break; 687 case 'function': 688 f = e.depends.call(c, c); 689 } 690 f ? (b[d] = void 0 === e.param || e.param) : (a.data(c.form, 'validator').resetElements(a(c)), delete b[d]); 691 } 692 }), 693 a.each(b, function (d, e) {
694 b[d] = a.isFunction(e) && 'normalizer' !== d ? e(c) : e; 695 }), 696 a.each(['minlength', 'maxlength'], function () { 697 b[this] && (b[this] = Number(b[this])); 698 }), 699 a.each(['rangelength', 'range'], function () { 700 var c; 701 b[this] && 702 (a.isArray(b[this]) 703 ? (b[this] = [Number(b[this][0]), Number(b[this][1])]) 704 : 'string' == typeof b[this] && ((c = b[this].replace(/[\[\]]/g, '').split(/[\s,]+/)), (b[this] = [Number(c[0]), Number(c[1])]))); 705 }), 706 a.validator.autoCreateRanges && 707 (null != b.min && null != b.max && ((b.range = [b.min, b.max]), delete b.min, delete b.max), 708 null != b.minlength && null != b.maxlength && ((b.rangelength = [b.minlength, b.maxlength]), delete b.minlength, delete b.maxlength)), 709 b 710 ); 711 }, 712 normalizeRule: function (b) { 713 if ('string' == typeof b) { 714 var c = {}; 715 a.each(b.split(/\s/), function () { 716 c[this] = !0; 717 }), 718 (b = c); 719 } 720 return b; 721 }, 722 addMethod: function (b, c, d) { 723 (a.validator.methods[b] = c), 724 (a.validator.messages[b] = void 0 !== d ? d : a.validator.messages[b]), 725 c.length < 3 && a.validator.addClassRules(b, a.validator.normalizeRule(b)); 726 }, 727 methods: { 728 required: function (b, c, d) { 729 if (!this.depend(d, c)) return 'dependency-mismatch'; 730 if ('select' === c.nodeName.toLowerCase()) { 731 var e = a(c).val(); 732 return e && e.length > 0; 733 } 734 return this.checkable(c) ? this.getLength(b, c) > 0 : void 0 !== b && null !== b && b.length > 0; 735 }, 736 email: function (a, b) { 737 return ( 738 this.optional(b) || 739 /^[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) 740 ); 741 }, 742 url: function (a, b) { 743 return ( 744 this.optional(b) ||
745 /^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?: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-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*(?:\.(?:[a-z\u00a1-\uffff]{2,})).?)(?::\d{2,5})?(?:[\/?#]\S*)?$/i.test( 746 a, 747 ) 748 ); 749 }, 750 date: (function () { 751 var a = !1; 752 return function (b, c) { 753 return ( 754 a || 755 ((a = !0), 756 this.settings.debug && 757 window.console && 758 console.warn( 759 "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`.", 760 )), 761 this.optional(c) || !/Invalid|NaN/.test(new Date(b).toString()) 762 ); 763 }; 764 })(), 765 dateISO: function (a, b) { 766 return this.optional(b) || /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/.test(a); 767 }, 768 number: function (a, b) { 769 return this.optional(b) || /^(?:-?\d+|-?\d{1,3}(?:,\d{3})+)?(?:\.\d+)?$/.test(a); 770 }, 771 digits: function (a, b) { 772 return this.optional(b) || /^\d+$/.test(a); 773 }, 774 minlength: function (b, c, d) { 775 var e = a.isArray(b) ? b.length : this.getLength(b, c); 776 return this.optional(c) || e >= d; 777 }, 778 maxlength: function (b, c, d) { 779 var e = a.isArray(b) ? b.length : this.getLength(b, c); 780 return this.optional(c) || e <= d; 781 }, 782 rangelength: function (b, c, d) { 783 var e = a.isArray(b) ? b.length : this.getLength(b, c); 784 return this.optional(c) || (e >= d[0] && e <= d[1]); 785 }, 786 min: function (a, b, c) { 787 return this.optional(b) || a >= c; 788 }, 789 max: function (a, b, c) { 790 return this.optional(b) || a <= c; 791 }, 792 range: function (a, b, c) { 793 return this.optional(b) || (a >= c[0] && a <= c[1]); 794 }, 795 step: function (b, c, d) { 796 var e, 797 f = a(c).attr('type'), 798 g = 'Step attribute on input type ' + f + ' is not supported.', 799 h = ['text', 'number', 'range'], 800 i = new RegExp('\\b' + f + '\\b'), 801 j = f && !i.test(h.join()), 802 k = function (a) { 803 var b = ('' + a).match(/(?:\.(\d+))?$/); 804 return b && b[1] ? b[1].length : 0; 805 }, 806 l = function (a) { 807 return Math.round(a * Math.pow(10, e)); 808 }, 809 m = !0; 810 if (j) throw new Error(g); 811 return (e = k(d)), (k(b) > e || l(b) % l(d) !== 0) && (m = !1), this.optional(c) || m; 812 }, 813 equalTo: function (b, c, d) { 814 var e = a(d); 815 return ( 816 this.settings.onfocusout && 817 e.not('.validate-equalTo-blur').length && 818 e.addClass('validate-equalTo-blur').on('blur.validate-equalTo', function () { 819 a(c).valid(); 820 }), 821 b === e.val() 822 ); 823 }, 824 remote: function (b, c, d, e) { 825 if (this.optional(c)) return 'dependency-mismatch'; 826 e = ('string' == typeof e && e) || 'remote'; 827 var f, 828 g, 829 h, 830 i = this.previousValue(c, e); 831 return ( 832 this.settings.messages[c.name] || (this.settings.messages[c.name] = {}), 833 (i.originalMessage = i.originalMessage || this.settings.messages[c.name][e]), 834 (this.settings.messages[c.name][e] = i.message), 835 (d = ('string' == typeof d && {url: d}) || d), 836 (h = a.param(a.extend({data: b}, d.data))), 837 i.old === h
838 ? i.valid 839 : ((i.old = h), 840 (f = this), 841 this.startRequest(c), 842 (g = {}), 843 (g[c.name] = b), 844 a.ajax( 845 a.extend( 846 !0, 847 { 848 mode: 'abort', 849 port: 'validate' + c.name, 850 dataType: 'json', 851 data: g, 852 context: f.currentForm, 853 success: function (a) { 854 var d, 855 g, 856 h, 857 j = a === !0 || 'true' === a; 858 (f.settings.messages[c.name][e] = i.originalMessage), 859 j 860 ? ((h = f.formSubmitted), 861 f.resetInternals(), 862 (f.toHide = f.errorsFor(c)), 863 (f.formSubmitted = h), 864 f.successList.push(c), 865 (f.invalid[c.name] = !1), 866 f.showErrors()) 867 : ((d = {}), 868 (g = a || f.defaultMessage(c, {method: e, parameters: b})), 869 (d[c.name] = i.message = g), 870 (f.invalid[c.name] = !0), 871 f.showErrors(d)), 872 (i.valid = j), 873 f.stopRequest(c, j); 874 }, 875 }, 876 d, 877 ), 878 ), 879 'pending') 880 ); 881 }, 882 }, 883 }); 884 var c, 885 d = {}; 886 return ( 887 a.ajaxPrefilter
888 ? a.ajaxPrefilter(function (a, b, c) { 889 var e = a.port; 890 'abort' === a.mode && (d[e] && d[e].abort(), (d[e] = c)); 891 }) 892 : ((c = a.ajax), 893 (a.ajax = function (b) { 894 var e = ('mode' in b ? b : a.ajaxSettings).mode, 895 f = ('port' in b ? b : a.ajaxSettings).port; 896 return 'abort' === e ? (d[f] && d[f].abort(), (d[f] = c.apply(this, arguments)), d[f]) : c.apply(this, arguments); 897 })), 898 a 899 ); 900});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.