1/** 2 * FormValidation (https://formvalidation.io), v1.10.0 (2236098) 3 * The best validation library for JavaScript 4 * (c) 2013 - 2021 Nguyen Huu Phuoc <[email protected]> 5 */ 6 7(function (global, factory) { 8 typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : 9 typeof define === 'function' && define.amd ? define(['exports'], factory) : 10 (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.FormValidation = {})); 11})(this, (function (exports) { 'use strict'; 12 13 function t$15(t) { 14 var e = t.length; 15 var l = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [0, 2, 4, 6, 8, 1, 3, 5, 7, 9]]; 16 var n = 0; 17 var r = 0; 18 19 while (e--) { 20 r += l[n][parseInt(t.charAt(e), 10)]; 21 n = 1 - n; 22 } 23 24 return r % 10 === 0 && r > 0; 25 } 26 27 function t$14(t) { 28 var e = t.length; 29 var n = 5; 30 31 for (var r = 0; r < e; r++) { 32 n = ((n || 10) * 2 % 11 + parseInt(t.charAt(r), 10)) % 10; 33 } 34 35 return n === 1; 36 } 37 38 function t$13(t) { 39 var e = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 40 var n = t.length; 41 var o = e.length; 42 var l = Math.floor(o / 2); 43 44 for (var r = 0; r < n; r++) { 45 l = ((l || o) * 2 % (o + 1) + e.indexOf(t.charAt(r))) % o; 46 } 47 48 return l === 1; 49 } 50 51 function t$12(t) { 52 var e = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 2, 3, 4, 0, 6, 7, 8, 9, 5], [2, 3, 4, 0, 1, 7, 8, 9, 5, 6], [3, 4, 0, 1, 2, 8, 9, 5, 6, 7], [4, 0, 1, 2, 3, 9, 5, 6, 7, 8], [5, 9, 8, 7, 6, 0, 4, 3, 2, 1], [6, 5, 9, 8, 7, 1, 0, 4, 3, 2], [7, 6, 5, 9, 8, 2, 1, 0, 4, 3], [8, 7, 6, 5, 9, 3, 2, 1, 0, 4], [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]]; 53 var n = [[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [1, 5, 7, 6, 2, 8, 3, 0, 9, 4], [5, 8, 0, 3, 7, 9, 6, 1, 4, 2], [8, 9, 1, 6, 0, 4, 3, 5, 2, 7], [9, 4, 5, 3, 1, 2, 6, 8, 7, 0], [4, 2, 8, 6, 5, 7, 3, 9, 0, 1], [2, 7, 9, 3, 8, 0, 6, 4, 1, 5], [7, 0, 4, 6, 9, 1, 3, 2, 5, 8]]; 54 var o = t.reverse(); 55 var r = 0; 56 57 for (var _t = 0; _t < o.length; _t++) { 58 r = e[r][n[_t % 8][o[_t]]]; 59 } 60 61 return r === 0; 62 } 63 64 var index$3 = { 65 luhn: t$15, 66 mod11And10: t$14, 67 mod37And36: t$13, 68 verhoeff: t$12 69 }; 70 71 function _classCallCheck(instance, Constructor) { 72 if (!(instance instanceof Constructor)) { 73 throw new TypeError("Cannot call a class as a function"); 74 } 75 } 76 77 function _defineProperties(target, props) { 78 for (var i = 0; i < props.length; i++) { 79 var descriptor = props[i]; 80 descriptor.enumerable = descriptor.enumerable || false; 81 descriptor.configurable = true; 82 if ("value" in descriptor) descriptor.writable = true; 83 Object.defineProperty(target, descriptor.key, descriptor); 84 } 85 } 86 87 function _createClass(Constructor, protoProps, staticProps) { 88 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 89 if (staticProps) _defineProperties(Constructor, staticProps); 90 Object.defineProperty(Constructor, "prototype", { 91 writable: false 92 }); 93 return Constructor; 94 } 95 96 function _defineProperty(obj, key, value) { 97 if (key in obj) { 98 Object.defineProperty(obj, key, { 99 value: value, 100 enumerable: true, 101 configurable: true, 102 writable: true 103 }); 104 } else { 105 obj[key] = value; 106 } 107 108 return obj; 109 } 110 111 function _inherits(subClass, superClass) { 112 if (typeof superClass !== "function" && superClass !== null) { 113 throw new TypeError("Super expression must either be null or a function"); 114 } 115 116 subClass.prototype = Object.create(superClass && superClass.prototype, { 117 constructor: { 118 value: subClass, 119 writable: true, 120 configurable: true 121 } 122 }); 123 Object.defineProperty(subClass, "prototype", { 124 writable: false 125 }); 126 if (superClass) _setPrototypeOf(subClass, superClass); 127 } 128 129 function _getPrototypeOf(o) { 130 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { 131 return o.__proto__ || Object.getPrototypeOf(o); 132 };
133 return _getPrototypeOf(o); 134 } 135 136 function _setPrototypeOf(o, p) { 137 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { 138 o.__proto__ = p; 139 return o; 140 }; 141 return _setPrototypeOf(o, p); 142 } 143 144 function _isNativeReflectConstruct() { 145 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 146 if (Reflect.construct.sham) return false; 147 if (typeof Proxy === "function") return true; 148 149 try { 150 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 151 return true; 152 } catch (e) { 153 return false; 154 } 155 } 156 157 function _assertThisInitialized(self) { 158 if (self === void 0) { 159 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 160 } 161 162 return self; 163 } 164 165 function _possibleConstructorReturn(self, call) { 166 if (call && (typeof call === "object" || typeof call === "function")) { 167 return call; 168 } else if (call !== void 0) { 169 throw new TypeError("Derived constructors may only return object or undefined"); 170 } 171 172 return _assertThisInitialized(self); 173 } 174 175 function _createSuper(Derived) { 176 var hasNativeReflectConstruct = _isNativeReflectConstruct(); 177 178 return function _createSuperInternal() { 179 var Super = _getPrototypeOf(Derived), 180 result; 181 182 if (hasNativeReflectConstruct) { 183 var NewTarget = _getPrototypeOf(this).constructor; 184 185 result = Reflect.construct(Super, arguments, NewTarget); 186 } else { 187 result = Super.apply(this, arguments); 188 } 189 190 return _possibleConstructorReturn(this, result); 191 }; 192 } 193 194 function _unsupportedIterableToArray(o, minLen) { 195 if (!o) return; 196 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 197 var n = Object.prototype.toString.call(o).slice(8, -1); 198 if (n === "Object" && o.constructor) n = o.constructor.name; 199 if (n === "Map" || n === "Set") return Array.from(o); 200 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 201 } 202 203 function _arrayLikeToArray(arr, len) { 204 if (len == null || len > arr.length) len = arr.length; 205 206 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 207 208 return arr2; 209 } 210 211 function _createForOfIteratorHelper(o, allowArrayLike) { 212 var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; 213 214 if (!it) { 215 if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { 216 if (it) o = it; 217 var i = 0; 218 219 var F = function () {}; 220 221 return { 222 s: F, 223 n: function () { 224 if (i >= o.length) return { 225 done: true 226 }; 227 return { 228 done: false, 229 value: o[i++] 230 }; 231 }, 232 e: function (e) { 233 throw e; 234 }, 235 f: F 236 }; 237 } 238 239 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 240 } 241 242 var normalCompletion = true, 243 didErr = false, 244 err; 245 return { 246 s: function () { 247 it = it.call(o); 248 }, 249 n: function () { 250 var step = it.next(); 251 normalCompletion = step.done; 252 return step; 253 }, 254 e: function (e) { 255 didErr = true; 256 err = e; 257 }, 258 f: function () { 259 try { 260 if (!normalCompletion && it.return != null) it.return(); 261 } finally { 262 if (didErr) throw err; 263 } 264 } 265 }; 266 } 267 268 function s$a() { 269 return { 270 fns: {}, 271 clear: function clear() { 272 this.fns = {}; 273 }, 274 emit: function emit(s) { 275 for (var _len = arguments.length, f = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 276 f[_key - 1] = arguments[_key]; 277 } 278 279 (this.fns[s] || []).map(function (s) { 280 return s.apply(s, f); 281 }); 282 }, 283 off: function off(s, f) { 284 if (this.fns[s]) { 285 var n = this.fns[s].indexOf(f); 286 287 if (n >= 0) { 288 this.fns[s].splice(n, 1); 289 } 290 } 291 }, 292 on: function on(s, f) { 293 (this.fns[s] = this.fns[s] || []).push(f); 294 } 295 }; 296 } 297 298 function t$11() { 299 return { 300 filters: {}, 301 add: function add(t, e) { 302 (this.filters[t] = this.filters[t] || []).push(e); 303 }, 304 clear: function clear() { 305 this.filters = {}; 306 }, 307 execute: function execute(t, e, i) { 308 if (!this.filters[t] || !this.filters[t].length) { 309 return e; 310 } 311 312 var s = e; 313 var r = this.filters[t]; 314 var l = r.length; 315 316 for (var _t = 0; _t < l; _t++) { 317 s = r[_t].apply(s, i); 318 } 319 320 return s; 321 }, 322 remove: function remove(t, e) { 323 if (this.filters[t]) { 324 this.filters[t] = this.filters[t].filter(function (t) { 325 return t !== e; 326 }); 327 } 328 } 329 }; 330 } 331 332 function e$H(e, t, r, n) { 333 var o = (r.getAttribute("type") || "").toLowerCase(); 334 var c = r.tagName.toLowerCase(); 335 336 if (c === "textarea") { 337 return r.value; 338 } 339 340 if (c === "select") { 341 var _e = r; 342 var _t = _e.selectedIndex; 343 return _t >= 0 ? _e.options.item(_t).value : ""; 344 } 345 346 if (c === "input") { 347 if ("radio" === o || "checkbox" === o) { 348 var _e2 = n.filter(function (e) { 349 return e.checked; 350 }).length; 351 return _e2 === 0 ? "" : _e2 + ""; 352 } else { 353 return r.value; 354 } 355 } 356 357 return ""; 358 } 359 360 function r$d(r, e) { 361 var t = Array.isArray(e) ? e : [e]; 362 var a = r; 363 t.forEach(function (r) { 364 a = a.replace("%s", r); 365 }); 366 return a; 367 } 368 369 function s$9() { 370 var s = function s(e) { 371 return parseFloat("".concat(e).replace(",", ".")); 372 }; 373 374 return { 375 validate: function validate(a) { 376 var t = a.value; 377 378 if (t === "") { 379 return { 380 valid: true 381 }; 382 } 383 384 var n = Object.assign({}, { 385 inclusive: true, 386 message: "" 387 }, a.options); 388 var l = s(n.min); 389 var o = s(n.max); 390 return n.inclusive ? { 391 message: r$d(a.l10n ? n.message || a.l10n.between["default"] : n.message, ["".concat(l), "".concat(o)]), 392 valid: parseFloat(t) >= l && parseFloat(t) <= o 393 } : { 394 message: r$d(a.l10n ? n.message || a.l10n.between.notInclusive : n.message, ["".concat(l), "".concat(o)]), 395 valid: parseFloat(t) > l && parseFloat(t) < o 396 }; 397 } 398 }; 399 } 400 401 function t$10() { 402 return { 403 validate: function validate(t) { 404 return { 405 valid: true 406 }; 407 } 408 }; 409 } 410 411 function t$$(t, n) { 412 if ("function" === typeof t) { 413 return t.apply(this, n); 414 } else if ("string" === typeof t) { 415 var e = t; 416 417 if ("()" === e.substring(e.length - 2)) { 418 e = e.substring(0, e.length - 2); 419 } 420 421 var i = e.split("."); 422 var o = i.pop(); 423 var f = window; 424 425 var _iterator = _createForOfIteratorHelper(i), 426 _step; 427
428 try { 429 for (_iterator.s(); !(_step = _iterator.n()).done;) { 430 var _t = _step.value; 431 f = f[_t]; 432 } 433 } catch (err) { 434 _iterator.e(err); 435 } finally { 436 _iterator.f(); 437 } 438 439 return typeof f[o] === "undefined" ? null : f[o].apply(this, n); 440 } 441 } 442 443 function o$4() { 444 return { 445 validate: function validate(o) { 446 var l = t$$(o.options.callback, [o]); 447 return "boolean" === typeof l ? { 448 valid: l 449 } : l; 450 } 451 }; 452 } 453 454 function t$_() { 455 return { 456 validate: function validate(t) { 457 var o = "select" === t.element.tagName.toLowerCase() ? t.element.querySelectorAll("option:checked").length : t.elements.filter(function (e) { 458 return e.checked; 459 }).length; 460 var s = t.options.min ? "".concat(t.options.min) : ""; 461 var n = t.options.max ? "".concat(t.options.max) : ""; 462 var a = t.l10n ? t.options.message || t.l10n.choice["default"] : t.options.message; 463 var l = !(s && o < parseInt(s, 10) || n && o > parseInt(n, 10)); 464 465 switch (true) { 466 case !!s && !!n: 467 a = r$d(t.l10n ? t.l10n.choice.between : t.options.message, [s, n]); 468 break; 469 470 case !!s: 471 a = r$d(t.l10n ? t.l10n.choice.more : t.options.message, s); 472 break; 473 474 case !!n: 475 a = r$d(t.l10n ? t.l10n.choice.less : t.options.message, n); 476 break; 477 } 478 479 return { 480 message: a, 481 valid: l 482 }; 483 } 484 }; 485 } 486 487 var t$Z = { 488 AMERICAN_EXPRESS: { 489 length: [15], 490 prefix: ["34", "37"] 491 }, 492 DANKORT: { 493 length: [16], 494 prefix: ["5019"] 495 }, 496 DINERS_CLUB: { 497 length: [14], 498 prefix: ["300", "301", "302", "303", "304", "305", "36"] 499 }, 500 DINERS_CLUB_US: { 501 length: [16], 502 prefix: ["54", "55"] 503 }, 504 DISCOVER: { 505 length: [16], 506 prefix: ["6011", "622126", "622127", "622128", "622129", "62213", "62214", "62215", "62216", "62217", "62218", "62219", "6222", "6223", "6224", "6225", "6226", "6227", "6228", "62290", "62291", "622920", "622921", "622922", "622923", "622924", "622925", "644", "645", "646", "647", "648", "649", "65"] 507 }, 508 ELO: { 509 length: [16], 510 prefix: ["4011", "4312", "4389", "4514", "4573", "4576", "5041", "5066", "5067", "509", "6277", "6362", "6363", "650", "6516", "6550"] 511 }, 512 FORBRUGSFORENINGEN: { 513 length: [16], 514 prefix: ["600722"] 515 }, 516 JCB: { 517 length: [16], 518 prefix: ["3528", "3529", "353", "354", "355", "356", "357", "358"] 519 }, 520 LASER: { 521 length: [16, 17, 18, 19], 522 prefix: ["6304", "6706", "6771", "6709"] 523 }, 524 MAESTRO: { 525 length: [12, 13, 14, 15, 16, 17, 18, 19], 526 prefix: ["5018", "5020", "5038", "5868", "6304", "6759", "6761", "6762", "6763", "6764", "6765", "6766"] 527 }, 528 MASTERCARD: { 529 length: [16], 530 prefix: ["51", "52", "53", "54", "55"] 531 }, 532 SOLO: { 533 length: [16, 18, 19], 534 prefix: ["6334", "6767"] 535 }, 536 UNIONPAY: { 537 length: [16, 17, 18, 19], 538 prefix: ["622126", "622127", "622128", "622129", "62213", "62214", "62215", "62216", "62217", "62218", "62219", "6222", "6223", "6224", "6225", "6226", "6227", "6228", "62290", "62291", "622920", "622921", "622922", "622923", "622924", "622925"] 539 }, 540 VISA: { 541 length: [16], 542 prefix: ["4"] 543 }, 544 VISA_ELECTRON: { 545 length: [16], 546 prefix: ["4026", "417500", "4405", "4508", "4844", "4913", "4917"] 547 } 548 }; 549 function l$2() { 550 return { 551 validate: function validate(l) { 552 if (l.value === "") { 553 return { 554 meta: { 555 type: null 556 }, 557 valid: true 558 }; 559 } 560 561 if (/[^0-9-\s]+/.test(l.value)) { 562 return { 563 meta: { 564 type: null 565 }, 566 valid: false 567 }; 568 } 569 570 var r = l.value.replace(/\D/g, ""); 571 572 if (!t$15(r)) { 573 return { 574 meta: { 575 type: null 576 }, 577 valid: false 578 }; 579 } 580 581 for (var _i = 0, _Object$keys = Object.keys(t$Z); _i < _Object$keys.length; _i++) { 582 var _e = _Object$keys[_i]; 583 584 for (var n in t$Z[_e].prefix) { 585 if (l.value.substr(0, t$Z[_e].prefix[n].length) === t$Z[_e].prefix[n] && t$Z[_e].length.indexOf(r.length) !== -1) { 586 return { 587 meta: { 588 type: _e 589 }, 590 valid: true 591 }; 592 } 593 } 594 } 595 596 return { 597 meta: { 598 type: null 599 }, 600 valid: false 601 }; 602 } 603 }; 604 } 605 606 function t$Y(t, e, n, r) { 607 if (isNaN(t) || isNaN(e) || isNaN(n)) { 608 return false;
609 } 610 611 if (t < 1e3 || t > 9999 || e <= 0 || e > 12) { 612 return false; 613 } 614 615 var s = [31, t % 400 === 0 || t % 100 !== 0 && t % 4 === 0 ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; 616 617 if (n <= 0 || n > s[e - 1]) { 618 return false; 619 } 620 621 if (r === true) { 622 var _r = new Date(); 623 624 var _s = _r.getFullYear(); 625 626 var a = _r.getMonth(); 627 628 var u = _r.getDate(); 629 630 return t < _s || t === _s && e - 1 < a || t === _s && e - 1 === a && n < u; 631 } 632 633 return true; 634 } 635 636 function n$1() { 637 var n = function n(t, e, _n) { 638 var s = e.indexOf("YYYY"); 639 var a = e.indexOf("MM"); 640 var l = e.indexOf("DD"); 641 642 if (s === -1 || a === -1 || l === -1) { 643 return null; 644 } 645 646 var o = t.split(" "); 647 var r = o[0].split(_n); 648 649 if (r.length < 3) { 650 return null; 651 } 652 653 var c = new Date(parseInt(r[s], 10), parseInt(r[a], 10) - 1, parseInt(r[l], 10)); 654 655 if (o.length > 1) { 656 var _t = o[1].split(":"); 657 658 c.setHours(_t.length > 0 ? parseInt(_t[0], 10) : 0); 659 c.setMinutes(_t.length > 1 ? parseInt(_t[1], 10) : 0); 660 c.setSeconds(_t.length > 2 ? parseInt(_t[2], 10) : 0); 661 } 662 663 return c; 664 }; 665 666 var s = function s(t, e) { 667 var n = e.replace(/Y/g, "y").replace(/M/g, "m").replace(/D/g, "d").replace(/:m/g, ":M").replace(/:mm/g, ":MM").replace(/:S/, ":s").replace(/:SS/, ":ss"); 668 var s = t.getDate(); 669 var a = s < 10 ? "0".concat(s) : s; 670 var l = t.getMonth() + 1; 671 var o = l < 10 ? "0".concat(l) : l; 672 var r = "".concat(t.getFullYear()).substr(2); 673 var c = t.getFullYear(); 674 var i = t.getHours() % 12 || 12; 675 var g = i < 10 ? "0".concat(i) : i; 676 var u = t.getHours(); 677 var m = u < 10 ? "0".concat(u) : u; 678 var d = t.getMinutes(); 679 var f = d < 10 ? "0".concat(d) : d; 680 var p = t.getSeconds(); 681 var h = p < 10 ? "0".concat(p) : p; 682 var $ = { 683 H: "".concat(u), 684 HH: "".concat(m), 685 M: "".concat(d), 686 MM: "".concat(f), 687 d: "".concat(s), 688 dd: "".concat(a), 689 h: "".concat(i), 690 hh: "".concat(g), 691 m: "".concat(l), 692 mm: "".concat(o), 693 s: "".concat(p), 694 ss: "".concat(h), 695 yy: "".concat(r), 696 yyyy: "".concat(c) 697 }; 698 return n.replace(/d{1,4}|m{1,4}|yy(?:yy)?|([HhMs])\1?|"[^"]*"|'[^']*'/g, function (t) { 699 return $[t] ? $[t] : t.slice(1, t.length - 1); 700 }); 701 }; 702 703 return { 704 validate: function validate(a) { 705 if (a.value === "") { 706 return { 707 meta: { 708 date: null 709 }, 710 valid: true 711 }; 712 } 713 714 var l = Object.assign({}, { 715 format: a.element && a.element.getAttribute("type") === "date" ? "YYYY-MM-DD" : "MM/DD/YYYY", 716 message: "" 717 }, a.options); 718 var o = a.l10n ? a.l10n.date["default"] : l.message; 719 var r = { 720 message: "".concat(o), 721 meta: { 722 date: null 723 }, 724 valid: false 725 }; 726 var c = l.format.split(" "); 727 var i = c.length > 1 ? c[1] : null; 728 var g = c.length > 2 ? c[2] : null; 729 var u = a.value.split(" "); 730 var m = u[0]; 731 var d = u.length > 1 ? u[1] : null; 732 733 if (c.length !== u.length) { 734 return r; 735 } 736 737 var f = l.separator || (m.indexOf("/") !== -1 ? "/" : m.indexOf("-") !== -1 ? "-" : m.indexOf(".") !== -1 ? "." : "/"); 738 739 if (f === null || m.indexOf(f) === -1) { 740 return r; 741 } 742 743 var p = m.split(f); 744 var h = c[0].split(f); 745 746 if (p.length !== h.length) { 747 return r; 748 } 749 750 var $ = p[h.indexOf("YYYY")]; 751 var M = p[h.indexOf("MM")]; 752 var Y = p[h.indexOf("DD")]; 753 754 if (!/^\d+$/.test($) || !/^\d+$/.test(M) || !/^\d+$/.test(Y) || $.length > 4 || M.length > 2 || Y.length > 2) { 755 return r; 756 } 757 758 var D = parseInt($, 10); 759 var x = parseInt(M, 10); 760 var y = parseInt(Y, 10); 761 762 if (!t$Y(D, x, y)) { 763 return r; 764 } 765 766 var I = new Date(D, x - 1, y); 767 768 if (i) { 769 var _t2 = d.split(":"); 770 771 if (i.split(":").length !== _t2.length) { 772 return r; 773 } 774 775 var _e = _t2.length > 0 ? _t2[0].length <= 2 && /^\d+$/.test(_t2[0]) ? parseInt(_t2[0], 10) : -1 : 0; 776 777 var _n2 = _t2.length > 1 ? _t2[1].length <= 2 && /^\d+$/.test(_t2[1]) ? parseInt(_t2[1], 10) : -1 : 0; 778 779 var _s = _t2.length > 2 ? _t2[2].length <= 2 && /^\d+$/.test(_t2[2]) ? parseInt(_t2[2], 10) : -1 : 0; 780 781 if (_e === -1 || _n2 === -1 || _s === -1) { 782 return r; 783 } 784 785 if (_s < 0 || _s > 60) { 786 return r; 787 } 788 789 if (_e < 0 || _e >= 24 || g && _e > 12) { 790 return r; 791 } 792 793 if (_n2 < 0 || _n2 > 59) { 794 return r; 795 } 796 797 I.setHours(_e); 798 I.setMinutes(_n2); 799 I.setSeconds(_s); 800 } 801 802 var O = typeof l.min === "function" ? l.min() : l.min; 803 var v = O instanceof Date ? O : O ? n(O, h, f) : I; 804 var H = typeof l.max === "function" ? l.max() : l.max; 805 var T = H instanceof Date ? H : H ? n(H, h, f) : I; 806 var S = O instanceof Date ? s(v, l.format) : O; 807 var b = H instanceof Date ? s(T, l.format) : H; 808 809 switch (true) { 810 case !!S && !b: 811 return { 812 message: r$d(a.l10n ? a.l10n.date.min : o, S), 813 meta: { 814 date: I 815 }, 816 valid: I.getTime() >= v.getTime() 817 }; 818 819 case !!b && !S: 820 return { 821 message: r$d(a.l10n ? a.l10n.date.max : o, b), 822 meta: { 823 date: I 824 }, 825 valid: I.getTime() <= T.getTime() 826 }; 827 828 case !!b && !!S: 829 return { 830 message: r$d(a.l10n ? a.l10n.date.range : o, [S, b]), 831 meta: { 832 date: I 833 }, 834 valid: I.getTime() <= T.getTime() && I.getTime() >= v.getTime() 835 }; 836 837 default: 838 return { 839 message: "".concat(o), 840 meta: { 841 date: I 842 }, 843 valid: true 844 }; 845 } 846 } 847 }; 848 } 849 850 function o$3() { 851 return { 852 validate: function validate(o) { 853 var t = "function" === typeof o.options.compare ? o.options.compare.call(this) : o.options.compare; 854 return { 855 valid: t === "" || o.value !== t 856 }; 857 } 858 }; 859 } 860 861 function e$G() { 862 return { 863 validate: function validate(e) { 864 return { 865 valid: e.value === "" || /^\d+$/.test(e.value) 866 }; 867 } 868 }; 869 } 870 871 function t$X() { 872 var t = function t(_t3, e) { 873 var s = _t3.split(/"/); 874 875 var l = s.length; 876 var n = []; 877 var r = ""; 878 879 for (var _t = 0; _t < l; _t++) { 880 if (_t % 2 === 0) { 881 var _l = s[_t].split(e); 882 883 var a = _l.length; 884 885 if (a === 1) { 886 r += _l[0]; 887 } else { 888 n.push(r + _l[0]); 889 890 for (var _t2 = 1; _t2 < a - 1; _t2++) { 891 n.push(_l[_t2]); 892 } 893 894 r = _l[a - 1]; 895 } 896 } else { 897 r += '"' + s[_t]; 898 899 if (_t < l - 1) { 900 r += '"'; 901 } 902 } 903 } 904 905 n.push(r); 906 return n; 907 }; 908 909 return { 910 validate: function validate(e) { 911 if (e.value === "") { 912 return { 913 valid: true 914 }; 915 } 916 917 var s = Object.assign({}, { 918 multiple: false, 919 separator: /[,;]/ 920 }, e.options); 921 var l = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@[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])?)*$/; 922 var n = s.multiple === true || "".concat(s.multiple) === "true"; 923 924 if (n) { 925 var _n = s.separator || /[,;]/; 926 927 var r = t(e.value, _n); 928 var a = r.length; 929 930 for (var _t4 = 0; _t4 < a; _t4++) { 931 if (!l.test(r[_t4])) { 932 return { 933 valid: false 934 }; 935 } 936 } 937 938 return { 939 valid: true 940 }; 941 } else { 942 return { 943 valid: l.test(e.value) 944 }; 945 } 946 } 947 }; 948 } 949 950 function e$F() { 951 return { 952 validate: function validate(e) { 953 if (e.value === "") { 954 return { 955 valid: true 956 }; 957 } 958 959 var t; 960 var i = e.options.extension ? e.options.extension.toLowerCase().split(",") : null; 961 var s = e.options.type ? e.options.type.toLowerCase().split(",") : null; 962 var n = window["File"] && window["FileList"] && window["FileReader"]; 963 964 if (n) { 965 var _n = e.element.files; 966 var o = _n.length; 967 var a = 0; 968 969 if (e.options.maxFiles && o > parseInt("".concat(e.options.maxFiles), 10)) { 970 return { 971 meta: { 972 error: "INVALID_MAX_FILES" 973 }, 974 valid: false 975 }; 976 } 977 978 if (e.options.minFiles && o < parseInt("".concat(e.options.minFiles), 10)) { 979 return { 980 meta: { 981 error: "INVALID_MIN_FILES" 982 }, 983 valid: false 984 }; 985 } 986 987 var r = {}; 988 989 for (var l = 0; l < o; l++) { 990 a += _n[l].size; 991 t = _n[l].name.substr(_n[l].name.lastIndexOf(".") + 1); 992 r = { 993 ext: t, 994 file: _n[l], 995 size: _n[l].size, 996 type: _n[l].type 997 }; 998 999 if (e.options.minSize && _n[l].size < parseInt("".concat(e.options.minSize), 10)) { 1000 return { 1001 meta: Object.assign({}, { 1002 error: "INVALID_MIN_SIZE" 1003 }, r), 1004 valid: false 1005 }; 1006 } 1007 1008 if (e.options.maxSize && _n[l].size > parseInt("".concat(e.options.maxSize), 10)) { 1009 return { 1010 meta: Object.assign({}, { 1011 error: "INVALID_MAX_SIZE" 1012 }, r), 1013 valid: false 1014 }; 1015 } 1016 1017 if (i && i.indexOf(t.toLowerCase()) === -1) { 1018 return { 1019 meta: Object.assign({}, { 1020 error: "INVALID_EXTENSION" 1021 }, r), 1022 valid: false 1023 }; 1024 } 1025
1026 if (_n[l].type && s && s.indexOf(_n[l].type.toLowerCase()) === -1) { 1027 return { 1028 meta: Object.assign({}, { 1029 error: "INVALID_TYPE" 1030 }, r), 1031 valid: false 1032 }; 1033 } 1034 } 1035 1036 if (e.options.maxTotalSize && a > parseInt("".concat(e.options.maxTotalSize), 10)) { 1037 return { 1038 meta: Object.assign({}, { 1039 error: "INVALID_MAX_TOTAL_SIZE", 1040 totalSize: a 1041 }, r), 1042 valid: false 1043 }; 1044 } 1045 1046 if (e.options.minTotalSize && a < parseInt("".concat(e.options.minTotalSize), 10)) { 1047 return { 1048 meta: Object.assign({}, { 1049 error: "INVALID_MIN_TOTAL_SIZE", 1050 totalSize: a 1051 }, r), 1052 valid: false 1053 }; 1054 } 1055 } else { 1056 t = e.value.substr(e.value.lastIndexOf(".") + 1); 1057 1058 if (i && i.indexOf(t.toLowerCase()) === -1) { 1059 return { 1060 meta: { 1061 error: "INVALID_EXTENSION", 1062 ext: t 1063 }, 1064 valid: false 1065 }; 1066 } 1067 } 1068 1069 return { 1070 valid: true 1071 }; 1072 } 1073 }; 1074 } 1075 1076 function a$7() { 1077 return { 1078 validate: function validate(a) { 1079 if (a.value === "") { 1080 return { 1081 valid: true 1082 }; 1083 } 1084 1085 var s = Object.assign({}, { 1086 inclusive: true, 1087 message: "" 1088 }, a.options); 1089 var t = parseFloat("".concat(s.min).replace(",", ".")); 1090 return s.inclusive ? { 1091 message: r$d(a.l10n ? s.message || a.l10n.greaterThan["default"] : s.message, "".concat(t)), 1092 valid: parseFloat(a.value) >= t 1093 } : { 1094 message: r$d(a.l10n ? s.message || a.l10n.greaterThan.notInclusive : s.message, "".concat(t)), 1095 valid: parseFloat(a.value) > t 1096 }; 1097 } 1098 }; 1099 } 1100 1101 function o$2() { 1102 return { 1103 validate: function validate(o) { 1104 var t = "function" === typeof o.options.compare ? o.options.compare.call(this) : o.options.compare; 1105 return { 1106 valid: t === "" || o.value === t 1107 }; 1108 } 1109 }; 1110 } 1111 1112 function a$6() { 1113 return { 1114 validate: function validate(a) { 1115 if (a.value === "") { 1116 return { 1117 valid: true 1118 }; 1119 } 1120 1121 var e = Object.assign({}, { 1122 decimalSeparator: ".", 1123 thousandsSeparator: "" 1124 }, a.options); 1125 var t = e.decimalSeparator === "." ? "\\." : e.decimalSeparator; 1126 var r = e.thousandsSeparator === "." ? "\\." : e.thousandsSeparator; 1127 var o = new RegExp("^-?[0-9]{1,3}(".concat(r, "[0-9]{3})*(").concat(t, "[0-9]+)?$")); 1128 var n = new RegExp(r, "g"); 1129 var s = "".concat(a.value); 1130 1131 if (!o.test(s)) { 1132 return { 1133 valid: false 1134 }; 1135 } 1136 1137 if (r) { 1138 s = s.replace(n, ""); 1139 } 1140 1141 if (t) { 1142 s = s.replace(t, "."); 1143 } 1144 1145 var i = parseFloat(s); 1146 return { 1147 valid: !isNaN(i) && isFinite(i) && Math.floor(i) === i 1148 }; 1149 } 1150 }; 1151 } 1152 1153 function d() { 1154 return { 1155 validate: function validate(d) { 1156 if (d.value === "") { 1157 return { 1158 valid: true 1159 }; 1160 } 1161 1162 var a = Object.assign({}, { 1163 ipv4: true, 1164 ipv6: true 1165 }, d.options); 1166 var e = /^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([0-9]|[1-2][0-9]|3[0-2]))?$/; 1167 var s = /^\s*((([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}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*(\/(\d|\d\d|1[0-1]\d|12[0-8]))?$/; 1168 1169 switch (true) { 1170 case a.ipv4 && !a.ipv6: 1171 return { 1172 message: d.l10n ? a.message || d.l10n.ip.ipv4 : a.message, 1173 valid: e.test(d.value) 1174 }; 1175 1176 case !a.ipv4 && a.ipv6: 1177 return { 1178 message: d.l10n ? a.message || d.l10n.ip.ipv6 : a.message, 1179 valid: s.test(d.value) 1180 }; 1181 1182 case a.ipv4 && a.ipv6: 1183 default: 1184 return { 1185 message: d.l10n ? a.message || d.l10n.ip["default"] : a.message, 1186 valid: e.test(d.value) || s.test(d.value) 1187 }; 1188 } 1189 } 1190 }; 1191 } 1192 1193 function s$8() { 1194 return { 1195 validate: function validate(s) { 1196 if (s.value === "") { 1197 return { 1198 valid: true 1199 }; 1200 } 1201 1202 var a = Object.assign({}, { 1203 inclusive: true, 1204 message: "" 1205 }, s.options); 1206 var l = parseFloat("".concat(a.max).replace(",", ".")); 1207 return a.inclusive ? { 1208 message: r$d(s.l10n ? a.message || s.l10n.lessThan["default"] : a.message, "".concat(l)), 1209 valid: parseFloat(s.value) <= l 1210 } : { 1211 message: r$d(s.l10n ? a.message || s.l10n.lessThan.notInclusive : a.message, "".concat(l)), 1212 valid: parseFloat(s.value) < l 1213 }; 1214 } 1215 }; 1216 } 1217 1218 function t$W() { 1219 return { 1220 validate: function validate(t) { 1221 var n = !!t.options && !!t.options.trim; 1222 var o = t.value; 1223 return { 1224 valid: !n && o !== "" || n && o !== "" && o.trim() !== "" 1225 }; 1226 } 1227 }; 1228 } 1229 1230 function a$5() { 1231 return { 1232 validate: function validate(a) { 1233 if (a.value === "") { 1234 return { 1235 valid: true 1236 }; 1237 } 1238 1239 var e = Object.assign({}, { 1240 decimalSeparator: ".", 1241 thousandsSeparator: "" 1242 }, a.options); 1243 var t = "".concat(a.value); 1244 1245 if (t.substr(0, 1) === e.decimalSeparator) { 1246 t = "0".concat(e.decimalSeparator).concat(t.substr(1)); 1247 } else if (t.substr(0, 2) === "-".concat(e.decimalSeparator)) { 1248 t = "-0".concat(e.decimalSeparator).concat(t.substr(2)); 1249 } 1250 1251 var r = e.decimalSeparator === "." ? "\\." : e.decimalSeparator; 1252 var s = e.thousandsSeparator === "." ? "\\." : e.thousandsSeparator; 1253 var i = new RegExp("^-?[0-9]{1,3}(".concat(s, "[0-9]{3})*(").concat(r, "[0-9]+)?$")); 1254 var o = new RegExp(s, "g"); 1255 1256 if (!i.test(t)) { 1257 return { 1258 valid: false 1259 }; 1260 } 1261 1262 if (s) { 1263 t = t.replace(o, ""); 1264 } 1265 1266 if (r) { 1267 t = t.replace(r, "."); 1268 } 1269 1270 var l = parseFloat(t); 1271 return { 1272 valid: !isNaN(l) && isFinite(l) 1273 }; 1274 } 1275 }; 1276 } 1277 1278 function r$c() { 1279 return { 1280 validate: function validate(r) { 1281 return t$$(r.options.promise, [r]); 1282 } 1283 }; 1284 } 1285 1286 function e$E() { 1287 return { 1288 validate: function validate(e) { 1289 if (e.value === "") { 1290 return { 1291 valid: true 1292 }; 1293 } 1294 1295 var t = e.options.regexp; 1296 1297 if (t instanceof RegExp) { 1298 return { 1299 valid: t.test(e.value) 1300 }; 1301 } else { 1302 var n = t.toString(); 1303 var o = e.options.flags ? new RegExp(n, e.options.flags) : new RegExp(n); 1304 return { 1305 valid: o.test(e.value) 1306 }; 1307 } 1308 } 1309 }; 1310 } 1311 1312 var e$D = function e(_e) { 1313 return Array(_e).fill("").map(function (e) { 1314 return Math.random().toString(36).charAt(2); 1315 }).join(""); 1316 }; 1317 1318 function t$V(t, n) { 1319 var o = function o(e) { 1320 return Object.keys(e).map(function (t) { 1321 return "".concat(encodeURIComponent(t), "=").concat(encodeURIComponent(e[t])); 1322 }).join("&"); 1323 }; 1324 1325 return new Promise(function (s, a) { 1326 var r = Object.assign({}, {
1327 crossDomain: false, 1328 headers: {}, 1329 method: "GET", 1330 params: {} 1331 }, n); 1332 var d = Object.keys(r.params).map(function (e) { 1333 return "".concat(encodeURIComponent(e), "=").concat(encodeURIComponent(r.params[e])); 1334 }).join("&"); 1335 var c = t.indexOf("?"); 1336 var i = "GET" === r.method ? "".concat(t).concat(c ? "?" : "&").concat(d) : t; 1337 1338 if (r.crossDomain) { 1339 var _t = document.createElement("script"); 1340 1341 var _n = "___FormValidationFetch_".concat(e$D(12), "___"); 1342 1343 window[_n] = function (e) { 1344 delete window[_n]; 1345 s(e); 1346 }; 1347 1348 _t.src = "".concat(i).concat(c ? "&" : "?", "callback=").concat(_n); 1349 _t.async = true; 1350 1351 _t.addEventListener("load", function () { 1352 _t.parentNode.removeChild(_t); 1353 }); 1354 1355 _t.addEventListener("error", function () { 1356 return a; 1357 }); 1358 1359 document.head.appendChild(_t); 1360 } else { 1361 var _e2 = new XMLHttpRequest(); 1362 1363 _e2.open(r.method, i); 1364 1365 _e2.setRequestHeader("X-Requested-With", "XMLHttpRequest"); 1366 1367 if ("POST" === r.method) { 1368 _e2.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 1369 } 1370 1371 Object.keys(r.headers).forEach(function (t) { 1372 return _e2.setRequestHeader(t, r.headers[t]); 1373 }); 1374 1375 _e2.addEventListener("load", function () { 1376 s(JSON.parse(this.responseText)); 1377 }); 1378 1379 _e2.addEventListener("error", function () { 1380 return a; 1381 }); 1382 1383 _e2.send(o(r.params)); 1384 } 1385 }); 1386 } 1387 1388 function a$4() { 1389 var a = { 1390 crossDomain: false, 1391 data: {}, 1392 headers: {}, 1393 method: "GET", 1394 validKey: "valid" 1395 }; 1396 return { 1397 validate: function validate(t) { 1398 if (t.value === "") { 1399 return Promise.resolve({ 1400 valid: true 1401 }); 1402 } 1403 1404 var s = Object.assign({}, a, t.options); 1405 var r = s.data; 1406 1407 if ("function" === typeof s.data) { 1408 r = s.data.call(this, t); 1409 } 1410 1411 if ("string" === typeof r) { 1412 r = JSON.parse(r); 1413 } 1414 1415 r[s.name || t.field] = t.value; 1416 var o = "function" === typeof s.url ? s.url.call(this, t) : s.url; 1417 return t$V(o, { 1418 crossDomain: s.crossDomain, 1419 headers: s.headers, 1420 method: s.method, 1421 params: r 1422 }).then(function (e) { 1423 return Promise.resolve({ 1424 message: e["message"], 1425 meta: e, 1426 valid: "".concat(e[s.validKey]) === "true" 1427 }); 1428 })["catch"](function (e) { 1429 return Promise.reject({ 1430 valid: false 1431 }); 1432 }); 1433 } 1434 }; 1435 } 1436 1437 function e$C() { 1438 return { 1439 validate: function validate(e) { 1440 if (e.value === "") { 1441 return { 1442 valid: true 1443 }; 1444 } 1445 1446 var a = Object.assign({}, { 1447 "case": "lower" 1448 }, e.options); 1449 var s = (a["case"] || "lower").toLowerCase(); 1450 return { 1451 message: a.message || (e.l10n ? "upper" === s ? e.l10n.stringCase.upper : e.l10n.stringCase["default"] : a.message), 1452 valid: "upper" === s ? e.value === e.value.toUpperCase() : e.value === e.value.toLowerCase() 1453 }; 1454 } 1455 }; 1456 } 1457 1458 function t$U() { 1459 var t = function t(e) { 1460 var t = e.length; 1461 1462 for (var s = e.length - 1; s >= 0; s--) { 1463 var n = e.charCodeAt(s); 1464 1465 if (n > 127 && n <= 2047) { 1466 t++; 1467 } else if (n > 2047 && n <= 65535) { 1468 t += 2; 1469 } 1470 1471 if (n >= 56320 && n <= 57343) { 1472 s--; 1473 } 1474 } 1475 1476 return "".concat(t); 1477 }; 1478 1479 return { 1480 validate: function validate(s) { 1481 var n = Object.assign({}, { 1482 message: "", 1483 trim: false, 1484 utf8Bytes: false 1485 }, s.options); 1486 var a = n.trim === true || "".concat(n.trim) === "true" ? s.value.trim() : s.value; 1487 1488 if (a === "") { 1489 return { 1490 valid: true 1491 }; 1492 } 1493 1494 var r = n.min ? "".concat(n.min) : ""; 1495 var l = n.max ? "".concat(n.max) : ""; 1496 var i = n.utf8Bytes ? t(a) : a.length; 1497 var g = true; 1498 var m = s.l10n ? n.message || s.l10n.stringLength["default"] : n.message; 1499 1500 if (r && i < parseInt(r, 10) || l && i > parseInt(l, 10)) { 1501 g = false;
1502 } 1503 1504 switch (true) { 1505 case !!r && !!l: 1506 m = r$d(s.l10n ? n.message || s.l10n.stringLength.between : n.message, [r, l]); 1507 break; 1508 1509 case !!r: 1510 m = r$d(s.l10n ? n.message || s.l10n.stringLength.more : n.message, "".concat(parseInt(r, 10))); 1511 break; 1512 1513 case !!l: 1514 m = r$d(s.l10n ? n.message || s.l10n.stringLength.less : n.message, "".concat(parseInt(l, 10))); 1515 break; 1516 } 1517 1518 return { 1519 message: m, 1520 valid: g 1521 }; 1522 } 1523 }; 1524 } 1525 1526 function t$T() { 1527 var t = { 1528 allowEmptyProtocol: false, 1529 allowLocal: false, 1530 protocol: "http, https, ftp" 1531 }; 1532 return { 1533 validate: function validate(o) { 1534 if (o.value === "") { 1535 return { 1536 valid: true 1537 }; 1538 } 1539 1540 var a = Object.assign({}, t, o.options); 1541 var l = a.allowLocal === true || "".concat(a.allowLocal) === "true"; 1542 var f = a.allowEmptyProtocol === true || "".concat(a.allowEmptyProtocol) === "true"; 1543 var u = a.protocol.split(",").join("|").replace(/\s/g, ""); 1544 var e = new RegExp("^" + "(?:(?:" + u + ")://)" + (f ? "?" : "") + "(?:\\S+(?::\\S*)?@)?" + "(?:" + (l ? "" : "(?!(?: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,}))" + (l ? "?" : "") + ")" + "(?::\\d{2,5})?" + "(?:/[^\\s]*)?$", "i"); 1545 return { 1546 valid: e.test(o.value) 1547 }; 1548 } 1549 }; 1550 } 1551 1552 function a$3() { 1553 return { 1554 validate: function validate(a) { 1555 return { 1556 valid: a.value === "" || /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/.test(a.value) 1557 }; 1558 } 1559 }; 1560 } 1561 1562 function a$2() { 1563 return { 1564 validate: function validate(a) { 1565 return { 1566 valid: a.value === "" || /^[a-zA-Z]{6}[a-zA-Z0-9]{2}([a-zA-Z0-9]{3})?$/.test(a.value) 1567 }; 1568 } 1569 }; 1570 } 1571 1572 function e$B() { 1573 var e = ["hex", "rgb", "rgba", "hsl", "hsla", "keyword"]; 1574 var a = ["aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige", "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown", "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue", "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod", "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen", "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen", "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet", "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick", "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite", "gold", "goldenrod", "gray", "green", "greenyellow", "grey", "honeydew", "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender", "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral", "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink", "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey", "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta", "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple", "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise", "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin", "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered", "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred", "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue", "purple", "red", "rosybrown", "royalblue", "saddlebrown", "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue", "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan", "teal", "thistle", "tomato", "transparent", "turquoise", "violet", "wheat", "white", "whitesmoke", "yellow", "yellowgreen"]; 1575 1576 var r = function r(e) { 1577 return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(e); 1578 }; 1579 1580 var l = function l(e) { 1581 return /^hsl\((\s*(-?\d+)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*)\)$/.test(e); 1582 }; 1583 1584 var s = function s(e) { 1585 return /^hsla\((\s*(-?\d+)\s*,)(\s*(\b(0?\d{1,2}|100)\b%)\s*,){2}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/.test(e); 1586 }; 1587 1588 var t = function t(e) { 1589 return a.indexOf(e) >= 0; 1590 }; 1591 1592 var i = function i(e) { 1593 return /^rgb\((\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*,){2}(\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*)\)$/.test(e) || /^rgb\((\s*(\b(0?\d{1,2}|100)\b%)\s*,){2}(\s*(\b(0?\d{1,2}|100)\b%)\s*)\)$/.test(e); 1594 }; 1595 1596 var o = function o(e) { 1597 return /^rgba\((\s*(\b([01]?\d{1,2}|2[0-4]\d|25[0-5])\b)\s*,){3}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/.test(e) || /^rgba\((\s*(\b(0?\d{1,2}|100)\b%)\s*,){3}(\s*(0?(\.\d+)?|1(\.0+)?)\s*)\)$/.test(e); 1598 }; 1599 1600 return { 1601 validate: function validate(a) { 1602 if (a.value === "") { 1603 return { 1604 valid: true 1605 }; 1606 } 1607 1608 var n = typeof a.options.type === "string" ? a.options.type.toString().replace(/s/g, "").split(",") : a.options.type || e; 1609 1610 var _iterator = _createForOfIteratorHelper(n), 1611 _step; 1612 1613 try { 1614 for (_iterator.s();
1614 !(_step = _iterator.n()).done;) { 1615 var d = _step.value; 1616 1617 var _n = d.toLowerCase(); 1618 1619 if (e.indexOf(_n) === -1) { 1620 continue; 1621 } 1622 1623 var g = true; 1624 1625 switch (_n) { 1626 case "hex": 1627 g = r(a.value); 1628 break; 1629 1630 case "hsl": 1631 g = l(a.value); 1632 break; 1633 1634 case "hsla": 1635 g = s(a.value); 1636 break; 1637 1638 case "keyword": 1639 g = t(a.value); 1640 break; 1641 1642 case "rgb": 1643 g = i(a.value); 1644 break; 1645 1646 case "rgba": 1647 g = o(a.value); 1648 break; 1649 } 1650 1651 if (g) { 1652 return { 1653 valid: true 1654 }; 1655 } 1656 } 1657 } catch (err) { 1658 _iterator.e(err); 1659 } finally { 1660 _iterator.f(); 1661 } 1662 1663 return { 1664 valid: false 1665 }; 1666 } 1667 }; 1668 } 1669 1670 function t$S() { 1671 return { 1672 validate: function validate(t) { 1673 if (t.value === "") { 1674 return { 1675 valid: true 1676 }; 1677 } 1678 1679 var e = t.value.toUpperCase(); 1680 1681 if (!/^[0123456789ABCDEFGHJKLMNPQRSTUVWXYZ*@#]{9}$/.test(e)) { 1682 return { 1683 valid: false 1684 }; 1685 } 1686 1687 var r = e.split(""); 1688 var a = r.pop(); 1689 var n = r.map(function (t) { 1690 var e = t.charCodeAt(0); 1691 1692 switch (true) { 1693 case t === "*": 1694 return 36; 1695 1696 case t === "@": 1697 return 37; 1698 1699 case t === "#": 1700 return 38; 1701 1702 case e >= "A".charCodeAt(0) && e <= "Z".charCodeAt(0): 1703 return e - "A".charCodeAt(0) + 10; 1704 1705 default: 1706 return parseInt(t, 10); 1707 } 1708 }); 1709 var c = n.map(function (t, e) { 1710 var r = e % 2 === 0 ? t : 2 * t; 1711 return Math.floor(r / 10) + r % 10; 1712 }).reduce(function (t, e) { 1713 return t + e; 1714 }, 0); 1715 var o = (10 - c % 10) % 10; 1716 return { 1717 valid: a === "".concat(o) 1718 }; 1719 } 1720 }; 1721 } 1722 1723 function e$A() { 1724 return { 1725 validate: function validate(e) { 1726 if (e.value === "") { 1727 return { 1728 valid: true 1729 }; 1730 } 1731 1732 if (!/^(\d{8}|\d{12}|\d{13}|\d{14})$/.test(e.value)) { 1733 return { 1734 valid: false 1735 }; 1736 } 1737 1738 var t = e.value.length; 1739 var a = 0; 1740 var l = t === 8 ? [3, 1] : [1, 3]; 1741 1742 for (var r = 0; r < t - 1; r++) { 1743 a += parseInt(e.value.charAt(r), 10) * l[r % 2]; 1744 } 1745 1746 a = (10 - a % 10) % 10; 1747 return { 1748 valid: "".concat(a) === e.value.charAt(t - 1) 1749 }; 1750 } 1751 }; 1752 } 1753 1754 function e$z() { 1755 var e = { 1756 ANDOVER: ["10", "12"], 1757 ATLANTA: ["60", "67"], 1758 AUSTIN: ["50", "53"], 1759 BROOKHAVEN: ["01", "02", "03", "04", "05", "06", "11", "13", "14", "16", "21", "22", "23", "25", "34", "51", "52", "54", "55", "56", "57", "58", "59", "65"], 1760 CINCINNATI: ["30", "32", "35", "36", "37", "38", "61"], 1761 FRESNO: ["15", "24"], 1762 INTERNET: ["20", "26", "27", "45", "46", "47"], 1763 KANSAS_CITY: ["40", "44"], 1764 MEMPHIS: ["94", "95"], 1765 OGDEN: ["80", "90"], 1766 PHILADELPHIA: ["33", "39", "41", "42", "43", "48", "62", "63", "64", "66", "68", "71", "72", "73", "74", "75", "76", "77", "81", "82", "83", "84", "85", "86", "87", "88", "91", "92", "93", "98", "99"], 1767 SMALL_BUSINESS_ADMINISTRATION: ["31"] 1768 }; 1769 return { 1770 validate: function validate(t) { 1771 if (t.value === "") { 1772 return { 1773 meta: null, 1774 valid: true 1775 }; 1776 } 1777 1778 if (!/^[0-9]{2}-?[0-9]{7}$/.test(t.value)) { 1779 return { 1780 meta: null, 1781 valid: false 1782 }; 1783 } 1784 1785 var a = "".concat(t.value.substr(0, 2)); 1786 1787 for (var _t in e) { 1788 if (e[_t].indexOf(a) !== -1) { 1789 return { 1790 meta: { 1791 campus: _t 1792 }, 1793 valid: true 1794 }; 1795 } 1796 } 1797 1798 return { 1799 meta: null, 1800 valid: false 1801 }; 1802 } 1803 }; 1804 } 1805 1806 function r$b() { 1807 return { 1808 validate: function validate(r) { 1809 if (r.value === "") { 1810 return { 1811 valid: true 1812 }; 1813 } 1814 1815 var t = r.value.toUpperCase(); 1816 1817 if (!/^[GRID:]*([0-9A-Z]{2})[-\s]*([0-9A-Z]{5})[-\s]*([0-9A-Z]{10})[-\s]*([0-9A-Z]{1})$/g.test(t)) { 1818 return { 1819 valid: false 1820 }; 1821 } 1822 1823 t = t.replace(/\s/g, "").replace(/-/g, ""); 1824 1825 if ("GRID:" === t.substr(0, 5)) { 1826 t = t.substr(5); 1827 } 1828 1829 return { 1830 valid: t$13(t) 1831 }; 1832 } 1833 }; 1834 } 1835 1836 function e$y() { 1837 return { 1838 validate: function validate(e) { 1839 return { 1840 valid: e.value === "" || /^[0-9a-fA-F]+$/.test(e.value) 1841 }; 1842 } 1843 }; 1844 } 1845 1846 function Z() { 1847 var Z = { 1848 AD: "AD[0-9]{2}[0-9]{4}[0-9]{4}[A-Z0-9]{12}", 1849 AE: "AE[0-9]{2}[0-9]{3}[0-9]{16}", 1850 AL: "AL[0-9]{2}[0-9]{8}[A-Z0-9]{16}", 1851 AO: "AO[0-9]{2}[0-9]{21}", 1852 AT: "AT[0-9]{2}[0-9]{5}[0-9]{11}", 1853 AZ: "AZ[0-9]{2}[A-Z]{4}[A-Z0-9]{20}", 1854 BA: "BA[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{8}[0-9]{2}", 1855 BE: "BE[0-9]{2}[0-9]{3}[0-9]{7}
1855[0-9]{2}", 1856 BF: "BF[0-9]{2}[0-9]{23}", 1857 BG: "BG[0-9]{2}[A-Z]{4}[0-9]{4}[0-9]{2}[A-Z0-9]{8}", 1858 BH: "BH[0-9]{2}[A-Z]{4}[A-Z0-9]{14}", 1859 BI: "BI[0-9]{2}[0-9]{12}", 1860 BJ: "BJ[0-9]{2}[A-Z]{1}[0-9]{23}", 1861 BR: "BR[0-9]{2}[0-9]{8}[0-9]{5}[0-9]{10}[A-Z][A-Z0-9]", 1862 CH: "CH[0-9]{2}[0-9]{5}[A-Z0-9]{12}", 1863 CI: "CI[0-9]{2}[A-Z]{1}[0-9]{23}", 1864 CM: "CM[0-9]{2}[0-9]{23}", 1865 CR: "CR[0-9]{2}[0-9][0-9]{3}[0-9]{14}", 1866 CV: "CV[0-9]{2}[0-9]{21}", 1867 CY: "CY[0-9]{2}[0-9]{3}[0-9]{5}[A-Z0-9]{16}", 1868 CZ: "CZ[0-9]{2}[0-9]{20}", 1869 DE: "DE[0-9]{2}[0-9]{8}[0-9]{10}", 1870 DK: "DK[0-9]{2}[0-9]{14}", 1871 DO: "DO[0-9]{2}[A-Z0-9]{4}[0-9]{20}", 1872 DZ: "DZ[0-9]{2}[0-9]{20}", 1873 EE: "EE[0-9]{2}[0-9]{2}[0-9]{2}[0-9]{11}[0-9]{1}", 1874 ES: "ES[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{1}[0-9]{1}[0-9]{10}", 1875 FI: "FI[0-9]{2}[0-9]{6}[0-9]{7}[0-9]{1}", 1876 FO: "FO[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}", 1877 FR: "FR[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}", 1878 GB: "GB[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}", 1879 GE: "GE[0-9]{2}[A-Z]{2}[0-9]{16}", 1880 GI: "GI[0-9]{2}[A-Z]{4}[A-Z0-9]{15}", 1881 GL: "GL[0-9]{2}[0-9]{4}[0-9]{9}[0-9]{1}", 1882 GR: "GR[0-9]{2}[0-9]{3}[0-9]{4}[A-Z0-9]{16}", 1883 GT: "GT[0-9]{2}[A-Z0-9]{4}[A-Z0-9]{20}", 1884 HR: "HR[0-9]{2}[0-9]{7}[0-9]{10}", 1885 HU: "HU[0-9]{2}[0-9]{3}[0-9]{4}[0-9]{1}[0-9]{15}[0-9]{1}", 1886 IE: "IE[0-9]{2}[A-Z]{4}[0-9]{6}[0-9]{8}", 1887 IL: "IL[0-9]{2}[0-9]{3}[0-9]{3}[0-9]{13}", 1888 IR: "IR[0-9]{2}[0-9]{22}", 1889 IS: "IS[0-9]{2}[0-9]{4}[0-9]{2}[0-9]{6}[0-9]{10}", 1890 IT: "IT[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}", 1891 JO: "JO[0-9]{2}[A-Z]{4}[0-9]{4}[0]{8}[A-Z0-9]{10}", 1892 KW: "KW[0-9]{2}[A-Z]{4}[0-9]{22}", 1893 KZ: "KZ[0-9]{2}[0-9]{3}[A-Z0-9]{13}", 1894 LB: "LB[0-9]{2}[0-9]{4}[A-Z0-9]{20}", 1895 LI: "LI[0-9]{2}[0-9]{5}[A-Z0-9]{12}", 1896 LT: "LT[0-9]{2}[0-9]{5}[0-9]{11}", 1897 LU: "LU[0-9]{2}[0-9]{3}[A-Z0-9]{13}", 1898 LV: "LV[0-9]{2}[A-Z]{4}[A-Z0-9]{13}", 1899 MC: "MC[0-9]{2}[0-9]{5}[0-9]{5}[A-Z0-9]{11}[0-9]{2}", 1900 MD: "MD[0-9]{2}[A-Z0-9]{20}", 1901 ME: "ME[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}", 1902 MG: "MG[0-9]{2}[0-9]{23}", 1903 MK: "MK[0-9]{2}[0-9]{3}[A-Z0-9]{10}[0-9]{2}", 1904 ML: "ML[0-9]{2}[A-Z]{1}[0-9]{23}", 1905 MR: "MR13[0-9]{5}[0-9]{5}[0-9]{11}[0-9]{2}", 1906 MT: "MT[0-9]{2}[A-Z]{4}[0-9]{5}[A-Z0-9]{18}", 1907 MU: "MU[0-9]{2}[A-Z]{4}[0-9]{2}[0-9]{2}[0-9]{12}[0-9]{3}[A-Z]{3}", 1908 MZ: "MZ[0-9]{2}[0-9]{21}", 1909 NL: "NL[0-9]{2}[A-Z]{4}[0-9]{10}", 1910 NO: "NO[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{1}", 1911 PK: "PK[0-9]{2}[A-Z]{4}[A-Z0-9]{16}", 1912 PL: "PL[0-9]{2}[0-9]{8}[0-9]{16}", 1913 PS: "PS[0-9]{2}[A-Z]{4}[A-Z0-9]{21}", 1914 PT: "PT[0-9]{2}[0-9]{4}[0-9]{4}[0-9]{11}[0-9]{2}", 1915 QA: "QA[0-9]{2}[A-Z]{4}[A-Z0-9]{21}", 1916 RO: "RO[0-9]{2}[A-Z]{4}[A-Z0-9]{16}", 1917 RS: "RS[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}", 1918 SA: "SA[0-9]{2}[0-9]{2}[A-Z0-9]{18}", 1919 SE: "SE[0-9]{2}[0-9]{3}[0-9]{16}[0-9]{1}", 1920 SI: "SI[0-9]{2}[0-9]{5}[0-9]{8}[0-9]{2}", 1921 SK: "SK[0-9]{2}[0-9]{4}[0-9]{6}[0-9]{10}", 1922 SM: "SM[0-9]{2}[A-Z]{1}[0-9]{5}[0-9]{5}[A-Z0-9]{12}", 1923 SN: "SN[0-9]{2}[A-Z]{1}[0-9]{23}", 1924 TL: "TL38[0-9]{3}[0-9]{14}[0-9]{2}", 1925 TN: "TN59[0-9]{2}[0-9]{3}[0-9]{13}[0-9]{2}", 1926 TR: "TR[0-9]{2}[0-9]{5}[A-Z0-9]{1}[A-Z0-9]{16}", 1927 VG: "VG[0-9]{2}[A-Z]{4}[0-9]{16}", 1928 XK: "XK[0-9]{2}[0-9]{4}[0-9]{10}[0-9]{2}" 1929 }; 1930 var e = ["AT", "BE", "BG", "CH", "CY", "CZ", "DE", "DK", "EE", "ES", "FI", "FR", "GB", "GI", "GR", "HR", "HU", "IE", "IS", "IT", "LI", "LT", "LU", "LV", "MC", "MT", "NL", "NO", "PL", "PT", "RO", "SE", "SI", "SK", "SM"]; 1931 return { 1932 validate: function validate(s) { 1933 if (s.value === "") { 1934 return { 1935 valid: true 1936 }; 1937 } 1938 1939 var t = Object.assign({}, { 1940 message: "" 1941 }, s.options); 1942 var a = s.value.replace(/[^a-zA-Z0-9]/g, "").toUpperCase(); 1943 var r = t.country || a.substr(0, 2); 1944 1945 if (!Z[r]) { 1946 return { 1947 message: t.message, 1948 valid: false 1949 }; 1950 } 1951 1952 if (t.sepa !== undefined) { 1953 var _A = e.indexOf(r) !== -1; 1954 1955 if ((t.sepa === "true" || t.sepa === true) && !_A || (t.sepa === "fal
1955se" || t.sepa === false) && _A) { 1956 return { 1957 message: t.message, 1958 valid: false 1959 }; 1960 } 1961 } 1962 1963 var n = r$d(s.l10n ? t.message || s.l10n.iban.country : t.message, s.l10n ? s.l10n.iban.countries[r] : r); 1964 1965 if (!new RegExp("^".concat(Z[r], "$")).test(s.value)) { 1966 return { 1967 message: n, 1968 valid: false 1969 }; 1970 } 1971 1972 a = "".concat(a.substr(4)).concat(a.substr(0, 4)); 1973 a = a.split("").map(function (A) { 1974 var Z = A.charCodeAt(0); 1975 return Z >= "A".charCodeAt(0) && Z <= "Z".charCodeAt(0) ? Z - "A".charCodeAt(0) + 10 : A; 1976 }).join(""); 1977 var I = parseInt(a.substr(0, 1), 10); 1978 var L = a.length; 1979 1980 for (var _A2 = 1; _A2 < L; ++_A2) { 1981 I = (I * 10 + parseInt(a.substr(_A2, 1), 10)) % 97; 1982 } 1983 1984 return { 1985 message: n, 1986 valid: I === 1 1987 }; 1988 } 1989 }; 1990 } 1991 1992 function t$R(t) { 1993 var e = t.replace(/\./g, ""); 1994 return { 1995 meta: {}, 1996 valid: /^\d{7,8}$/.test(e) 1997 }; 1998 } 1999 2000 function t$Q(t, r) { 2001 if (!/^\d{13}$/.test(t)) { 2002 return false; 2003 } 2004 2005 var e = parseInt(t.substr(0, 2), 10); 2006 var s = parseInt(t.substr(2, 2), 10); 2007 var n = parseInt(t.substr(7, 2), 10); 2008 var a = parseInt(t.substr(12, 1), 10); 2009 2010 if (e > 31 || s > 12) { 2011 return false; 2012 } 2013 2014 var u = 0; 2015 2016 for (var _r = 0; _r < 6; _r++) { 2017 u += (7 - _r) * (parseInt(t.charAt(_r), 10) + parseInt(t.charAt(_r + 6), 10)); 2018 } 2019 2020 u = 11 - u % 11; 2021 2022 if (u === 10 || u === 11) { 2023 u = 0; 2024 } 2025 2026 if (u !== a) { 2027 return false; 2028 } 2029 2030 switch (r.toUpperCase()) { 2031 case "BA": 2032 return 10 <= n && n <= 19; 2033 2034 case "MK": 2035 return 41 <= n && n <= 49; 2036 2037 case "ME": 2038 return 20 <= n && n <= 29; 2039 2040 case "RS": 2041 return 70 <= n && n <= 99; 2042 2043 case "SI": 2044 return 50 <= n && n <= 59; 2045 2046 default: 2047 return true; 2048 } 2049 } 2050 2051 function r$a(r) { 2052 return { 2053 meta: {}, 2054 valid: t$Q(r, "BA") 2055 }; 2056 } 2057 2058 function e$x(e) { 2059 if (!/^\d{10}$/.test(e) && !/^\d{6}\s\d{3}\s\d{1}$/.test(e)) { 2060 return { 2061 meta: {}, 2062 valid: false 2063 }; 2064 } 2065 2066 var s = e.replace(/\s/g, ""); 2067 var r = parseInt(s.substr(0, 2), 10) + 1900; 2068 var a = parseInt(s.substr(2, 2), 10); 2069 var l = parseInt(s.substr(4, 2), 10); 2070 2071 if (a > 40) { 2072 r += 100; 2073 a -= 40; 2074 } else if (a > 20) { 2075 r -= 100; 2076 a -= 20; 2077 } 2078 2079 if (!t$Y(r, a, l)) { 2080 return { 2081 meta: {}, 2082 valid: false 2083 }; 2084 } 2085 2086 var i = 0; 2087 var n = [2, 4, 8, 5, 10, 9, 7, 3, 6]; 2088 2089 for (var _t = 0; _t < 9; _t++) { 2090 i += parseInt(s.charAt(_t), 10) * n[_t]; 2091 } 2092 2093 i = i % 11 % 10; 2094 return { 2095 meta: {}, 2096 valid: "".concat(i) === s.substr(9, 1) 2097 }; 2098 } 2099 2100 function t$P(t) { 2101 var e = t.replace(/\D/g, ""); 2102 2103 if (!/^\d{11}$/.test(e) || /^1{11}|2{11}|3{11}|4{11}|5{11}|6{11}|7{11}|8{11}|9{11}|0{11}$/.test(e)) { 2104 return { 2105 meta: {}, 2106 valid: false 2107 }; 2108 } 2109 2110 var a = 0; 2111 var r; 2112 2113 for (r = 0; r < 9; r++) { 2114 a += (10 - r) * parseInt(e.charAt(r), 10); 2115 } 2116 2117 a = 11 - a % 11; 2118 2119 if (a === 10 || a === 11) { 2120 a = 0; 2121 } 2122 2123 if ("".concat(a) !== e.charAt(9)) { 2124 return { 2125 meta: {}, 2126 valid: false 2127 }; 2128 } 2129 2130 var f = 0; 2131 2132 for (r = 0; r < 10; r++) { 2133 f += (11 - r) * parseInt(e.charAt(r), 10); 2134 } 2135 2136 f = 11 - f % 11; 2137 2138 if (f === 10 || f === 11) { 2139 f = 0; 2140 } 2141 2142 return { 2143 meta: {}, 2144 valid: "".concat(f) === e.charAt(10) 2145 }; 2146 } 2147 2148 function t$O(t) { 2149 if (!/^756[.]{0,1}[0-9]{4}[.]{0,1}[0-9]{4}[.]{0,1}[0-9]{2}$/.test(t)) { 2150 return { 2151 meta: {}, 2152 valid: false 2153 }; 2154 } 2155 2156 var e = t.replace(/\D/g, "").substr(3); 2157 var r = e.length; 2158 var a = r === 8 ? [3, 1] : [1, 3]; 2159 var n = 0; 2160 2161 for (var _t = 0; _t < r - 1; _t++) { 2162 n += parseInt(e.charAt(_t), 10) * a[_t % 2]; 2163 } 2164 2165 n = 10 - n % 10; 2166 return { 2167 meta: {}, 2168 valid: "".concat(n) === e.charAt(r - 1) 2169 }; 2170 } 2171 2172 function e$w(e) { 2173 if (!/^\d{7,8}[-]{0,1}[0-9K]$/i.test(e)) { 2174 return { 2175 meta: {}, 2176 valid: false 2177 }; 2178 } 2179 2180 var t = e.replace(/-/g, ""); 2181 2182 while (t.length < 9) { 2183 t = "0".concat(t); 2184 } 2185 2186 var l = [3, 2, 7, 6, 5, 4, 3, 2]; 2187 var a = 0; 2188 2189 for (var _e = 0; _e < 8; _e++) { 2190 a += parseInt(t.charAt(_e), 10) * l[_e]; 2191 } 2192 2193 a = 11 - a % 11; 2194 var r = "".concat(a); 2195 2196 if (a === 11) { 2197 r = "0"; 2198 } else if (a === 10) { 2199 r = "K"; 2200 } 2201 2202 return { 2203 meta: {}, 2204 valid: r === t.charAt(8).toUpperCase() 2205 }; 2206 } 2207 2208 function r$9(r) { 2209 var s = r.trim(); 2210 2211 if (!/^\d{15}$/.test(s) && !/^\d{17}[\dXx]{1}$/.test(s)) { 2212 return { 2213 meta: {}, 2214 valid: false 2215 }; 2216 } 2217 2218 var e = { 2219 11: { 2220 0: [0], 2221 1: [[0, 9], [11, 17]], 2222 2: [0, 28, 29] 2223 }, 2224 12: { 2225 0: [0], 2226 1: [[0, 16]], 2227 2: [0, 21, 23, 25] 2228 }, 2229 13: { 2230 0: [0], 2231 1: [[0, 5], 7, 8, 21, [23, 33], [81, 85]], 2232 2: [[0, 5], [7, 9], [23, 25], 27, 29, 30, 81, 83], 2233 3: [[0, 4], [21, 24]], 2234 4: [[0, 4], 6, 21, [23, 35], 81], 2235 5: [[0, 3], [21, 35], 81, 82], 2236 6: [[0, 4], [21, 38], [81, 84]], 2237 7: [[0, 3], 5, 6, [21, 33]], 2238 8: [[0, 4], [21, 28]], 2239 9: [[0, 3], [21, 30], [81, 84]], 2240 10: [[0, 3], [22, 26], 28, 81, 82], 2241 11: [[0, 2], [21, 28], 81, 82] 2242 }, 2243 14: { 2244 0: [0], 2245 1: [0, 1, [5, 10], [21, 23], 81], 2246 2: [[0, 3], 11, 12, [21, 27]], 2247 3: [[0, 3], 11, 21, 22], 2248 4: [[0, 2], 11, 21, [23, 31], 81], 2249 5: [[0, 2], 21, 22, 24, 25, 81], 2250 6: [[0, 3], [21, 24]], 2251 7: [[0, 2], [21, 29], 81], 2252 8: [[0, 2], [21, 30], 81, 82], 2253 9: [[0, 2], [21, 32], 81], 2254 10: [[0, 2], [21, 34], 81, 82], 2255 11: [[0, 2], [21, 30], 81, 82], 2256 23: [[0, 3], 22, 23, [25, 30], 32, 33] 2257 }, 2258 15: { 2259 0: [0], 2260 1: [[0, 5], [21, 25]], 2261 2: [[0, 7], [21, 23]], 2262 3: [[0, 4]], 2263 4: [[0, 4], [21, 26], [28, 30]], 2264 5: [[0, 2], [21, 26], 81], 2265 6: [[0, 2], [21, 27]], 2266 7: [[0, 3], [21, 27], [81, 85]], 2267 8: [[0, 2], [21, 26]], 2268 9: [[0, 2], [21, 29], 81], 2269 22: [[0, 2], [21, 24]], 2270 25: [[0, 2], [22, 31]], 2271 26: [[0, 2], [24, 27], [29, 32], 34], 2272 28: [0, 1, [22, 27]], 2273 29: [0, [21, 23]] 2274 }, 2275 21: { 2276 0: [0], 2277 1: [[0, 6], [11, 14], [22, 24], 81], 2278 2: [[0, 4], [11, 13], 24, [81, 83]], 2279 3: [[0, 4], 11, 21, 23, 81], 2280 4: [[0, 4], 11, [21, 23]], 2281 5: [[0, 5], 21, 22], 2282 6: [[0, 4], 24, 81, 82], 2283 7: [[0, 3], 11, 26, 27, 81, 82], 2284 8: [[0, 4], 11, 81, 82], 2285 9: [[0, 5], 11, 21, 22], 2286 10: [[0, 5], 11, 21, 81], 2287 11: [[0, 3], 21, 22], 2288 12: [[0, 2], 4, 21, 23, 24, 81, 82], 2289 13: [[0, 3], 21, 22, 24, 81, 82], 2290 14: [[0, 4], 21, 22, 81] 2291 }, 2292 22: { 2293 0: [0], 2294 1: [[0, 6], 12, 22, [81, 83]], 2295 2: [[0, 4], 11, 21, [81, 84]], 2296 3: [[0, 3], 22, 23, 81, 82], 2297 4: [[0, 3], 21, 22], 2298 5: [[0, 3], 21, 23, 24, 81, 82], 2299 6: [[0, 2], 4, 5, [21, 23], 25, 81], 2300 7: [[0, 2], [21, 24], 81], 2301 8: [[0, 2], 21, 22, 81, 82], 2302 24: [[0, 6], 24, 26] 2303 }, 2304 23: { 2305 0: [0], 2306 1: [[0, 12], 21, [23, 29], [81, 84]], 2307 2: [[0, 8], 21, [23, 25], 27, [29, 31], 81], 2308 3: [[0, 7], 21, 81, 82], 2309 4: [[0, 7], 21, 22], 2310 5: [[0, 3], 5, 6, [21, 24]], 2311 6: [[0, 6], [21, 24]], 2312 7: [[0, 16], 22, 81], 2313 8: [[0, 5], 11, 22, 26, 28, 33, 81, 82], 2314 9: [[0, 4], 21], 2315 10: [[0, 5], 24, 25, 81, [83, 85]], 2316 11: [[0, 2], 21, 23, 24, 81, 82], 2317 12: [[0, 2], [21, 26], [81, 83]], 2318 27: [[0, 4], [21, 23]] 2319 }, 2320 31: { 2321 0: [0], 2322 1: [0, 1, [3, 10], [12, 20]], 2323 2: [0, 30] 2324 }, 2325 32: { 2326 0: [0], 2327 1: [[0, 7], 11, [13, 18], 24, 25], 2328 2: [[0, 6], 11, 81, 82], 2329 3: [[0, 5], 11, 12, [21, 24], 81, 82], 2330 4: [[0, 2], 4, 5, 11, 12, 81, 82], 2331 5: [[0, 9], [81, 85]], 2332 6: [[0, 2], 11, 12, 21, 23, [81, 84]], 2333 7: [0, 1, 3, 5, 6, [21, 24]], 2334 8: [[0, 4], 11, 26, [29, 31]], 2335 9: [[0, 3], [21, 25], 28, 81, 82], 2336 10: [[0, 3], 11, 12, 23, 81, 84, 88], 2337 11: [[0, 2], 11, 12, [81, 83]], 2338 12: [[0, 4], [81, 84]], 2339 13: [[0, 2], 11, [21, 24]] 2340 }, 2341 33: { 2342 0: [0], 2343 1: [[0, 6], [8, 10], 22, 27, 82, 83, 85], 2344 2: [0, 1, [3, 6], 11, 12, 25, 26, [81, 83]], 2345 3: [[0, 4], 22, 24, [26, 29], 81, 82], 2346 4: [[0, 2], 11, 21, 24, [81, 83]], 2347 5: [[0, 3], [21, 23]], 2348 6: [[0, 2], 21, 24, [81, 83]], 2349 7: [[0, 3], 23, 26, 27, [81, 84]], 2350 8: [[0, 3], 22, 24, 25, 81], 2351 9: [[0, 3], 21, 22], 2352 10: [[0, 4], [21, 24], 81, 82], 2353 11: [[0, 2], [21, 27], 81] 2354 }, 2355 34: { 2356 0: [0], 2357 1: [[0, 4], 11, [21, 24], 81], 2358 2: [[0, 4], 7, 8, [21, 23], 25], 2359 3: [[0, 4], 11, [21, 23]], 2360 4: [[0, 6], 21], 2361 5: [[0, 4], 6, [21, 23]], 2362 6: [[0, 4], 21], 2363 7: [[0, 3], 11, 21], 2364 8: [[0, 3], 11, [22, 28], 81], 2365 10: [[0, 4], [21, 24]], 2366 11: [[0, 3], 22, [24, 26], 81, 82], 2367 12: [[0, 4], 21, 22, 25, 26, 82], 2368 13: [[0, 2], [21, 24]], 2369 14: [[0, 2], [21, 24]], 2370 15: [[0, 3], [21, 25]], 2371 16: [[0, 2], [21, 23]], 2372 17: [[0, 2], [21, 23]], 2373 18: [[0, 2], [21, 25], 81] 2374 }, 2375 35: { 2376 0: [0], 2377 1: [[0, 5], 11, [21, 25], 28, 81, 82], 2378 2: [[0, 6], [11, 13]], 2379 3: [[0, 5], 22], 2380 4: [[0, 3], 21, [23, 30], 81], 2381 5: [[0, 5], 21, [24, 27], [81, 83]], 2382 6: [[0, 3], [22, 29], 81], 2383 7: [[0, 2], [21, 25], [81, 84]], 2384 8: [[0, 2], [21, 25], 81], 2385 9: [[0, 2], [21, 26], 81, 82] 2386 }, 2387 36: { 2388 0: [0], 2389 1: [[0, 5], 11, [21, 24]], 2390 2: [[0, 3], 22, 81], 2391 3: [[0, 2], 13, [21, 23]], 2392 4: [[0, 3], 21, [23, 30], 81, 82], 2393 5: [[0, 2], 21], 2394 6: [[0, 2], 22, 81], 2395 7: [[0, 2], [21, 35], 81, 82], 2396 8: [[0, 3], [21, 30], 81], 2397 9: [[0, 2], [21, 26], [81, 83]], 2398 10: [[0, 2], [21, 30]], 2399 11: [[0, 2], [21, 30], 81] 2400 }, 2401 37: { 2402 0: [0], 2403 1: [[0, 5], 12, 13, [24, 26], 81], 2404 2: [[0, 3], 5, [11, 14], [81, 85]], 2405 3: [[0, 6], [21, 23]], 2406 4: [[0, 6], 81], 2407 5: [[0, 3], [21, 23]], 2408 6: [[0, 2], [11, 13], 34, [81, 87]], 2409 7: [[0, 5], 24, 25, [81, 86]], 2410 8: [[0, 2], 11, [26, 32], [81, 83]], 2411 9: [[0, 3], 11, 21, 23, 82, 83], 2412 10: [[0, 2], [81, 83]], 2413 11: [[0, 3], 21, 22], 2414 12: [[0, 3]], 2415 13: [[0, 2], 11, 12, [21, 29]], 2416 14: [[0, 2], [21, 28], 81, 82], 2417 15: [[0, 2], [21, 26], 81], 2418 16: [[0, 2], [21, 26]], 2419 17: [[0, 2], [21, 28]] 2420 }, 2421 41: { 2422 0: [0], 2423 1: [[0, 6], 8, 22, [81, 85]], 2424 2: [[0, 5], 11, [21, 25]], 2425 3: [[0, 7], 11, [22, 29], 81], 2426 4: [[0, 4], 11, [21, 23], 25, 81, 82], 2427 5: [[0, 3], 5, 6, 22, 23, 26, 27, 81], 2428 6: [[0, 3], 11, 21, 22], 2429 7: [[0, 4], 11, 21, [24, 28], 81, 82], 2430 8: [[0, 4], 11, [21, 23], 25, [81, 83]], 2431 9: [[0, 2], 22, 23, [26, 28]], 2432 10: [[0, 2], [23, 25], 81, 82], 2433 11: [[0, 4], [21, 23]], 2434 12: [[0, 2], 21, 22, 24, 81, 82], 2435 13: [[0, 3], [21, 30], 81], 2436 14: [[0, 3], [21, 26], 81], 2437 15: [[0, 3], [21, 28]], 2438 16: [[0, 2], [21, 28], 81], 2439 17: [[0, 2], [21, 29]], 2440 90: [0, 1] 2441 }, 2442 42: { 2443 0: [0], 2444 1: [[0, 7], [11, 17]], 2445 2: [[0, 5], 22, 81], 2446 3: [[0, 3], [21, 25], 81], 2447 5: [[0, 6], [25, 29], [81, 83]], 2448 6: [[0, 2], 6, 7, [24, 26], [82, 84]], 2449 7: [[0, 4]], 2450 8: [[0, 2], 4, 21, 22, 81], 2451 9: [[0, 2], [21, 23], 81, 82, 84], 2452 10: [[0, 3], [22, 24], 81, 83, 87], 2453 11: [[0, 2], [21, 27], 81, 82], 2454 12: [[0, 2], [21, 24], 81], 2455 13: [[0, 3], 21, 81], 2456 28: [[0, 2], 22, 23, [25, 28]], 2457 90: [0, [4, 6], 21] 2458 }, 2459 43: { 2460 0: [0], 2461 1: [[0, 5], 11, 12, 21, 22, 24, 81], 2462 2: [[0, 4], 11, 21, [23, 25], 81], 2463 3: [[0, 2], 4, 21, 81, 82], 2464 4: [0, 1, [5, 8], 12, [21, 24], 26, 81, 82], 2465 5: [[0, 3], 11, [21, 25], [27, 29], 81], 2466 6: [[0, 3], 11, 21, 23, 24, 26, 81, 82], 2467 7: [[0, 3], [21, 26], 81], 2468 8: [[0, 2], 11, 21, 22], 2469 9: [[0, 3], [21, 23], 81], 2470 10: [[0, 3], [21, 28], 81], 2471 11: [[0, 3], [21, 29]], 2472 12: [[0, 2], [21, 30], 81], 2473 13: [[0, 2], 21, 22, 81, 82], 2474 31: [0, 1, [22, 27], 30] 2475 }, 2476 44: { 2477 0: [0], 2478 1: [[0, 7], [11, 16], 83, 84], 2479 2: [[0, 5], 21, 22, 24, 29, 32, 33, 81, 82], 2480 3: [0, 1, [3, 8]], 2481 4: [[0, 4]], 2482 5: [0, 1, [6, 15], 23, 82, 83], 2483 6: [0, 1, [4, 8]], 2484 7: [0, 1, [3, 5], 81, [83, 85]], 2485 8: [[0, 4], 11, 23, 25, [81, 83]], 2486 9: [[0, 3], 23, [81, 83]], 2487 12: [[0, 3], [23, 26], 83, 84], 2488 13: [[0, 3], [22, 24], 81], 2489 14: [[0, 2], [21, 24], 26, 27, 81], 2490 15: [[0, 2], 21, 23, 81], 2491 16: [[0, 2], [21, 25]], 2492 17: [[0, 2], 21, 23, 81], 2493 18: [[0, 3], 21, 23, [25, 27], 81, 82], 2494 19: [0], 2495 20: [0], 2496 51: [[0, 3], 21, 22], 2497 52: [[0, 3], 21, 22, 24, 81], 2498 53: [[0, 2], [21, 23], 81] 2499 }, 2500 45: { 2501 0: [0], 2502 1: [[0, 9], [21, 27]], 2503 2: [[0, 5], [21, 26]], 2504 3: [[0, 5], 11, 12, [21, 32]], 2505 4: [0, 1, [3, 6], 11, [21, 23], 81], 2506 5: [[0, 3], 12, 21], 2507 6: [[0, 3], 21, 81], 2508 7: [[0, 3], 21, 22], 2509 8: [[0, 4], 21, 81], 2510 9: [[0, 3], [21, 24], 81], 2511 10: [[0, 2], [21, 31]], 2512 11: [[0, 2], [21, 23]], 2513 12: [[0, 2], [21, 29], 81], 2514 13: [[0, 2], [21, 24], 81], 2515 14: [[0, 2], [21, 25], 81] 2516 }, 2517 46: { 2518 0: [0], 2519 1: [0, 1, [5, 8]], 2520 2: [0, 1], 2521 3: [0, [21, 23]], 2522 90: [[0, 3], [5, 7], [21, 39]] 2523 }, 2524 50: { 2525 0: [0], 2526 1: [[0, 19]], 2527 2: [0, [22, 38], [40, 43]], 2528 3: [0, [81, 84]] 2529 }, 2530 51: { 2531 0: [0], 2532 1: [0, 1, [4, 8], [12, 15], [21, 24], 29, 31, 32, [81, 84]], 2533 3: [[0, 4], 11, 21, 22], 2534 4: [[0, 3], 11, 21, 22], 2535 5: [[0, 4], 21, 22, 24, 25], 2536 6: [0, 1, 3, 23, 26, [81, 83]], 2537 7: [0, 1, 3, 4, [22, 27], 81], 2538 8: [[0, 2], 11, 12, [21, 24]], 2539 9: [[0, 4], [21, 23]], 2540 10: [[0, 2], 11, 24, 25, 28], 2541 11: [[0, 2], [11, 13], 23, 24, 26, 29, 32, 33, 81], 2542 13: [[0, 4], [21, 25], 81], 2543 14: [[0, 2], [21, 25]], 2544 15: [[0, 3], [21, 29]], 2545 16: [[0, 3], [21, 23], 81], 2546 17: [[0, 3], [21, 25], 81], 2547 18: [[0, 3], [21, 27]], 2548 19: [[0, 3], [21, 23]], 2549 20: [[0, 2], 21, 22, 81], 2550 32: [0, [21, 33]], 2551 33: [0, [21, 38]], 2552 34: [0, 1, [22, 37]] 2553 }, 2554 52: { 2555 0: [0], 2556 1: [[0, 3], [11, 15], [21, 23], 81], 2557 2: [0, 1, 3, 21, 22], 2558 3: [[0, 3], [21, 30], 81, 82], 2559 4: [[0, 2], [21, 25]], 2560 5: [[0, 2], [21, 27]], 2561 6: [[0, 3], [21, 28]], 2562 22: [0, 1, [22, 30]], 2563 23: [0, 1, [22, 28]], 2564 24: [0, 1, [22, 28]], 2565 26: [0, 1, [22, 36]], 2566 27: [[0, 2], 22, 23, [25, 32]] 2567 }, 2568 53: { 2569 0: [0], 2570 1: [[0, 3], [11, 14], 21, 22, [24, 29], 81], 2571 3: [[0, 2], [21, 26], 28, 81], 2572 4: [[0, 2], [21, 28]], 2573 5: [[0, 2], [21, 24]], 2574 6: [[0, 2], [21, 30]], 2575 7: [[0, 2], [21, 24]], 2576 8: [[0, 2], [21, 29]], 2577 9: [[0, 2], [21, 27]], 2578 23: [0, 1, [22, 29], 31], 2579 25: [[0, 4], [22, 32]], 2580 26: [0, 1, [21, 28]], 2581 27: [0, 1, [22, 30]], 2582 28: [0, 1, 22, 23], 2583 29: [0, 1, [22, 32]], 2584 31: [0, 2, 3, [22, 24]], 2585 34:
2585 [0, [21, 23]], 2586 33: [0, 21, [23, 25]], 2587 35: [0, [21, 28]] 2588 }, 2589 54: { 2590 0: [0], 2591 1: [[0, 2], [21, 27]], 2592 21: [0, [21, 29], 32, 33], 2593 22: [0, [21, 29], [31, 33]], 2594 23: [0, 1, [22, 38]], 2595 24: [0, [21, 31]], 2596 25: [0, [21, 27]], 2597 26: [0, [21, 27]] 2598 }, 2599 61: { 2600 0: [0], 2601 1: [[0, 4], [11, 16], 22, [24, 26]], 2602 2: [[0, 4], 22], 2603 3: [[0, 4], [21, 24], [26, 31]], 2604 4: [[0, 4], [22, 31], 81], 2605 5: [[0, 2], [21, 28], 81, 82], 2606 6: [[0, 2], [21, 32]], 2607 7: [[0, 2], [21, 30]], 2608 8: [[0, 2], [21, 31]], 2609 9: [[0, 2], [21, 29]], 2610 10: [[0, 2], [21, 26]] 2611 }, 2612 62: { 2613 0: [0], 2614 1: [[0, 5], 11, [21, 23]], 2615 2: [0, 1], 2616 3: [[0, 2], 21], 2617 4: [[0, 3], [21, 23]], 2618 5: [[0, 3], [21, 25]], 2619 6: [[0, 2], [21, 23]], 2620 7: [[0, 2], [21, 25]], 2621 8: [[0, 2], [21, 26]], 2622 9: [[0, 2], [21, 24], 81, 82], 2623 10: [[0, 2], [21, 27]], 2624 11: [[0, 2], [21, 26]], 2625 12: [[0, 2], [21, 28]], 2626 24: [0, 21, [24, 29]], 2627 26: [0, 21, [23, 30]], 2628 29: [0, 1, [21, 27]], 2629 30: [0, 1, [21, 27]] 2630 }, 2631 63: { 2632 0: [0], 2633 1: [[0, 5], [21, 23]], 2634 2: [0, 2, [21, 25]], 2635 21: [0, [21, 23], [26, 28]], 2636 22: [0, [21, 24]], 2637 23: [0, [21, 24]], 2638 25: [0, [21, 25]], 2639 26: [0, [21, 26]], 2640 27: [0, 1, [21, 26]], 2641 28: [[0, 2], [21, 23]] 2642 }, 2643 64: { 2644 0: [0], 2645 1: [0, 1, [4, 6], 21, 22, 81], 2646 2: [[0, 3], 5, [21, 23]], 2647 3: [[0, 3], [21, 24], 81], 2648 4: [[0, 2], [21, 25]], 2649 5: [[0, 2], 21, 22] 2650 }, 2651 65: { 2652 0: [0], 2653 1: [[0, 9], 21], 2654 2: [[0, 5]], 2655 21: [0, 1, 22, 23], 2656 22: [0, 1, 22, 23], 2657 23: [[0, 3], [23, 25], 27, 28], 2658 28: [0, 1, [22, 29]], 2659 29: [0, 1, [22, 29]], 2660 30: [0, 1, [22, 24]], 2661 31: [0, 1, [21, 31]], 2662 32: [0, 1, [21, 27]], 2663 40: [0, 2, 3, [21, 28]], 2664 42: [[0, 2], 21, [23, 26]], 2665 43: [0, 1, [21, 26]], 2666 90: [[0, 4]], 2667 27: [[0, 2], 22, 23] 2668 }, 2669 71: { 2670 0: [0] 2671 }, 2672 81: { 2673 0: [0] 2674 }, 2675 82: { 2676 0: [0] 2677 } 2678 }; 2679 var a = parseInt(s.substr(0, 2), 10); 2680 var n = parseInt(s.substr(2, 2), 10); 2681 var l = parseInt(s.substr(4, 2), 10); 2682 2683 if (!e[a] || !e[a][n]) { 2684 return { 2685 meta: {}, 2686 valid: false 2687 }; 2688 } 2689 2690 var i = false; 2691 var u = e[a][n]; 2692 var o; 2693 2694 for (o = 0; o < u.length; o++) { 2695 if (Array.isArray(u[o]) && u[o][0] <= l && l <= u[o][1] || !Array.isArray(u[o]) && l === u[o]) { 2696 i = true; 2697 break; 2698 } 2699 } 2700 2701 if (!i) { 2702 return { 2703 meta: {}, 2704 valid: false 2705 }; 2706 } 2707 2708 var f; 2709 2710 if (s.length === 18) { 2711 f = s.substr(6, 8); 2712 } else { 2713 f = "19".concat(s.substr(6, 6)); 2714 } 2715 2716 var c = parseInt(f.substr(0, 4), 10); 2717 var p = parseInt(f.substr(4, 2), 10); 2718 var d = parseInt(f.substr(6, 2), 10); 2719 2720 if (!t$Y(c, p, d)) { 2721 return { 2722 meta: {}, 2723 valid: false 2724 }; 2725 } 2726 2727 if (s.length === 18) { 2728 var _t = [7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2]; 2729 var _r = 0; 2730 2731 for (o = 0; o < 17; o++) { 2732 _r += parseInt(s.charAt(o), 10) * _t[o]; 2733 } 2734 2735 _r = (12 - _r % 11) % 11; 2736 2737 var _e = s.charAt(17).toUpperCase() !== "X" ? parseInt(s.charAt(17), 10) : 10; 2738 2739 return { 2740 meta: {}, 2741 valid: _e === _r 2742 }; 2743 } 2744 2745 return { 2746 meta: {}, 2747 valid: true 2748 }; 2749 } 2750 2751 function t$N(t) { 2752 var e = t.replace(/\./g, "").replace("-", ""); 2753 2754 if (!/^\d{8,16}$/.test(e)) { 2755 return { 2756 meta: {}, 2757 valid: false 2758 }; 2759 } 2760 2761 var r = e.length; 2762 var a = [3, 7, 13, 17, 19, 23, 29, 37, 41, 43, 47, 53, 59, 67, 71]; 2763 var l = 0; 2764 2765 for (var _t = r - 2; _t >= 0; _t--) { 2766 l += parseInt(e.charAt(_t), 10) * a[_t]; 2767 } 2768 2769 l = l % 11; 2770 2771 if (l >= 2) { 2772 l = 11 - l; 2773 } 2774 2775 return { 2776 meta: {}, 2777 valid: "".concat(l) === e.substr(r - 1) 2778 }; 2779 } 2780 2781 function e$v(e) { 2782 if (!/^\d{9,10}$/.test(e)) { 2783 return { 2784 meta: {}, 2785 valid: false 2786 }; 2787 } 2788 2789 var r = 1900 + parseInt(e.substr(0, 2), 10); 2790 var s = parseInt(e.substr(2, 2), 10) % 50 % 20; 2791 var a = parseInt(e.substr(4, 2), 10); 2792 2793 if (e.length === 9) { 2794 if (r >= 1980) { 2795 r -= 100; 2796 } 2797 2798 if (r > 1953) { 2799 return { 2800 meta: {}, 2801 valid: false 2802 }; 2803 } 2804 } else if (r < 1954) { 2805 r += 100; 2806 } 2807 2808 if (!t$Y(r, s, a)) { 2809 return { 2810 meta: {}, 2811 valid: false 2812 }; 2813 } 2814 2815 if (e.length === 10) { 2816 var _t = parseInt(e.substr(0, 9), 10) % 11; 2817 2818 if (r < 1985) { 2819 _t = _t % 10; 2820 } 2821 2822 return { 2823 meta: {}, 2824 valid: "".concat(_t) === e.substr(9, 1) 2825 }; 2826 } 2827 2828 return { 2829 meta: {}, 2830 valid: true 2831 }; 2832 } 2833 2834 function e$u(e) { 2835 if (!/^[0-9]{6}[-]{0,1}[0-9]{4}$/.test(e)) { 2836 return { 2837 meta: {}, 2838 valid: false 2839 }; 2840 } 2841 2842 var a = e.replace(/-/g, ""); 2843 var r = parseInt(a.substr(0, 2), 10); 2844 var s = parseInt(a.substr(2, 2), 10); 2845 var n = parseInt(a.substr(4, 2), 10); 2846 2847 switch (true) { 2848 case "5678".indexOf(a.charAt(6)) !== -1 && n >= 58: 2849 n += 1800; 2850 break; 2851 2852 case "0123".indexOf(a.charAt(6)) !== -1: 2853 case "49".indexOf(a.charAt(6)) !== -1 && n >= 37: 2854 n += 1900; 2855 break; 2856 2857 default: 2858 n += 2e3; 2859 break; 2860 } 2861 2862 return { 2863 meta: {}, 2864 valid: t$Y(n, s, r) 2865 }; 2866 } 2867 2868 function t$M(t) { 2869 var e = /^[0-9]{8}[-]{0,1}[A-HJ-NP-TV-Z]$/.test(t); 2870 var s = /^[XYZ][-]{0,1}[0-9]{7}[-]{0,1}[A-HJ-NP-TV-Z]$/.test(t); 2871 var n = /^[A-HNPQS][-]{0,1}[0-9]{7}[-]{0,1}[0-9A-J]$/.test(t); 2872 2873 if (!e && !s && !n) { 2874 return { 2875 meta: {}, 2876 valid: false 2877 }; 2878 } 2879 2880 var r = t.replace(/-/g, ""); 2881 var l; 2882 var a; 2883 var f = true; 2884 2885 if (e || s) { 2886 a = "DNI"; 2887 2888 var _t = "XYZ".indexOf(r.charAt(0)); 2889 2890 if (_t !== -1) { 2891 r = _t + r.substr(1) + ""; 2892 a = "NIE"; 2893 } 2894 2895 l = parseInt(r.substr(0, 8), 10); 2896 l = "TRWAGMYFPDXBNJZSQVHLCKE"[l % 23]; 2897 return { 2898 meta: { 2899 type: a 2900 }, 2901 valid: l === r.substr(8, 1) 2902 }; 2903 } else { 2904 l = r.substr(1, 7); 2905 a = "CIF"; 2906 var _t2 = r[0]; 2907 2908 var _e = r.substr(-1); 2909 2910 var _s = 0; 2911 2912 for (var _t3 = 0; _t3 < l.length; _t3++) { 2913 if (_t3 % 2 !== 0) { 2914 _s += parseInt(l[_t3], 10); 2915 } else { 2916 var _e2 = "" + parseInt(l[_t3], 10) * 2; 2917 2918 _s += parseInt(_e2[0], 10); 2919 2920 if (_e2.length === 2) { 2921 _s += parseInt(_e2[1], 10); 2922 } 2923 } 2924 } 2925 2926 var _n = _s - Math.floor(_s / 10) * 10; 2927 2928 if (_n !== 0) { 2929 _n = 10 - _n; 2930 } 2931 2932 if ("KQS".indexOf(_t2) !== -1) { 2933 f = _e === "JABCDEFGHI"[_n]; 2934 } else if ("ABEH".indexOf(_t2) !== -1) { 2935 f = _e === "" + _n; 2936 } else { 2937 f = _e === "" + _n || _e === "JABCDEFGHI"[_n]; 2938 } 2939 2940 return { 2941 meta: { 2942 type: a 2943 }, 2944 valid: f 2945 }; 2946 } 2947 } 2948 2949 function s$7(s) { 2950 if (!/^[0-9]{6}[-+A][0-9]{3}[0-9ABCDEFHJKLMNPRSTUVWXY]$/.test(s)) { 2951 return { 2952 meta: {}, 2953 valid: false 2954 }; 2955 } 2956 2957 var r = parseInt(s.substr(0, 2), 10); 2958 var a = parseInt(s.substr(2, 2), 10); 2959 var e = parseInt(s.substr(4, 2), 10); 2960 var n = { 2961 "+": 1800, 2962 "-": 1900, 2963 A: 2e3 2964 }; 2965 e = n[s.charAt(6)] + e; 2966 2967 if (!t$Y(e, a, r)) { 2968 return { 2969 meta: {}, 2970 valid: false 2971 }; 2972 } 2973 2974 var u = parseInt(s.substr(7, 3), 10); 2975 2976 if (u < 2) { 2977 return { 2978 meta: {}, 2979 valid: false 2980 }; 2981 } 2982 2983 var i = parseInt(s.substr(0, 6) + s.substr(7, 3) + "", 10); 2984 return { 2985 meta: {}, 2986 valid: "0123456789ABCDEFHJKLMNPRSTUVWXY".charAt(i % 31) === s.charAt(10) 2987 }; 2988 } 2989 2990 function t$L(t) { 2991 var s = t.toUpperCase(); 2992 2993 if (!/^(1|2)\d{2}\d{2}(\d{2}|\d[A-Z]|\d{3})\d{2,3}\d{3}\d{2}$/.test(s)) { 2994 return { 2995 meta: {}, 2996 valid: false 2997 }; 2998 } 2999 3000 var e = s.substr(5, 2); 3001 3002 switch (true) { 3003 case /^\d{2}$/.test(e): 3004 s = t; 3005 break; 3006 3007 case e === "2A": 3008 s = "".concat(t.substr(0, 5), "19").concat(t.substr(7)); 3009 break; 3010 3011 case e === "2B": 3012 s = "".concat(t.substr(0, 5), "18").concat(t.substr(7)); 3013 break; 3014 3015 default: 3016 return { 3017 meta: {}, 3018 valid: false 3019 }; 3020 } 3021 3022 var r = 97 - parseInt(s.substr(0, 13), 10) % 97; 3023 var a = r < 10 ? "0".concat(r) : "".concat(r); 3024 return { 3025 meta: {}, 3026 valid: a === s.substr(13) 3027 }; 3028 } 3029 3030 function t$K(t) { 3031 var e = t.toUpperCase(); 3032 3033 if (!/^[A-MP-Z]{1,2}[0-9]{6}[0-9A]$/.test(e)) { 3034 return { 3035 meta: {}, 3036 valid: false 3037 }; 3038 } 3039 3040 var s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 3041 var n = e.charAt(0); 3042 var r = e.charAt(1); 3043 var a = 0; 3044 var c = e; 3045 3046 if (/^[A-Z]$/.test(r)) { 3047 a += 9 * (10 + s.indexOf(n)); 3048 a += 8 * (10 + s.indexOf(r)); 3049 c = e.substr(2); 3050 } else { 3051 a += 9 * 36; 3052 a += 8 * (10 + s.indexOf(n)); 3053 c = e.substr(1); 3054 } 3055 3056 var o = c.length; 3057 3058 for (var _t = 0; _t < o - 1; _t++) { 3059 a += (7 - _t) * parseInt(c.charAt(_t), 10); 3060 } 3061 3062 var f = a % 11; 3063 var l = f === 0 ? "0" : 11 - f === 10 ? "A" : "".concat(11 - f); 3064 return { 3065 meta: {}, 3066 valid: l === c.charAt(o - 1) 3067 }; 3068 } 3069 3070 function o$1(o) { 3071 return { 3072 meta: {}, 3073 valid: /^[0-9]{11}$/.test(o) && t$14(o) 3074 }; 3075 } 3076 3077 function e$t(e) { 3078 if (!/^[2-9]\d{11}$/.test(e)) { 3079 return { 3080 meta: {}, 3081 valid: false 3082 }; 3083 } 3084 3085 var r = e.split("").map(function (t) { 3086 return parseInt(t, 10); 3087 }); 3088 return { 3089 meta: {}, 3090 valid: t$12(r) 3091 }; 3092 } 3093 3094 function t$J(t) { 3095 if (!/^\d{7}[A-W][AHWTX]?$/.test(t)) { 3096 return { 3097 meta: {}, 3098 valid: false 3099 }; 3100 } 3101 3102 var r = function r(t) { 3103 var r = t; 3104 3105 while (r.length < 7) { 3106 r = "0".concat(r); 3107 } 3108 3109 var e = "WABCDEFGHIJKLMNOPQRSTUV"; 3110 var s = 0; 3111 3112 for (var _t = 0; _t < 7; _t++) { 3113 s += parseInt(r.charAt(_t), 10) * (8 - _t); 3114 } 3115 3116 s += 9 * e.indexOf(r.substr(7)); 3117 return e[s % 23]; 3118 }; 3119 3120 var e = t.length === 9 && ("A" === t.charAt(8) || "H" === t.charAt(8)) ? t.charAt(7) === r(t.substr(0, 7) + t.substr(8) + "") : t.charAt(7) === r(t.substr(0, 7)); 3121 return { 3122 meta: {}, 3123 valid: e 3124 }; 3125 } 3126 3127 function e$s(e) { 3128 if (!/^\d{1,9}$/.test(e)) { 3129 return { 3130 meta: {}, 3131 valid: false 3132 }; 3133 } 3134 3135 return { 3136 meta: {}, 3137 valid: t$15(e) 3138 }; 3139 } 3140 3141 function e$r(e) { 3142 if (!/^[0-9]{6}[-]{0,1}[0-9]{4}$/.test(e)) { 3143 return { 3144 meta: {}, 3145 valid: false 3146 }; 3147 } 3148 3149 var r = e.replace(/-/g, ""); 3150 var s = parseInt(r.substr(0, 2), 10); 3151 var a = parseInt(r.substr(2, 2), 10); 3152 var n = parseInt(r.substr(4, 2), 10); 3153 var l = parseInt(r.charAt(9), 10); 3154 n = l === 9 ? 1900 + n : (20 + l) * 100 + n; 3155 3156 if (!t$Y(n, a, s, true)) { 3157 return { 3158 meta: {}, 3159 valid: false 3160 }; 3161 } 3162 3163 var c = [3, 2, 7, 6, 5, 4, 3, 2]; 3164 var i = 0; 3165 3166 for (var _t = 0; _t < 8; _t++) { 3167 i += parseInt(r.charAt(_t), 10) * c[_t]; 3168 } 3169 3170 i = 11 - i % 11; 3171 return { 3172 meta: {}, 3173 valid: "".concat(i) === r.charAt(8) 3174 }; 3175 } 3176 3177 function e$q(e) { 3178 var a = e.replace("-", ""); 3179 3180 if (!/^\d{13}$/.test(a)) { 3181 return { 3182 meta: {}, 3183 valid: false 3184 }; 3185 } 3186 3187 var s = a.charAt(6); 3188 var r = parseInt(a.substr(0, 2), 10); 3189 var c = parseInt(a.substr(2, 2), 10); 3190 var n = parseInt(a.substr(4, 2), 10); 3191 3192 switch (s) { 3193 case "1": 3194 case "2": 3195 case "5": 3196 case "6": 3197 r += 1900; 3198 break; 3199 3200 case "3": 3201 case "4": 3202 case "7": 3203 case "8": 3204 r += 2e3; 3205 break; 3206 3207 default: 3208 r += 1800; 3209 break; 3210 } 3211
3212 if (!t$Y(r, c, n)) { 3213 return { 3214 meta: {}, 3215 valid: false 3216 }; 3217 } 3218 3219 var l = [2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5]; 3220 var o = a.length; 3221 var i = 0; 3222 3223 for (var _t = 0; _t < o - 1; _t++) { 3224 i += l[_t] * parseInt(a.charAt(_t), 10); 3225 } 3226 3227 var u = (11 - i % 11) % 10; 3228 return { 3229 meta: {}, 3230 valid: "".concat(u) === a.charAt(o - 1) 3231 }; 3232 } 3233 3234 function r$8(r) { 3235 if (!/^[0-9]{11}$/.test(r)) { 3236 return { 3237 meta: {}, 3238 valid: false 3239 }; 3240 } 3241 3242 var e = parseInt(r.charAt(0), 10); 3243 var a = parseInt(r.substr(1, 2), 10); 3244 var s = parseInt(r.substr(3, 2), 10); 3245 var n = parseInt(r.substr(5, 2), 10); 3246 var i = e % 2 === 0 ? 17 + e / 2 : 17 + (e + 1) / 2; 3247 a = i * 100 + a; 3248 3249 if (!t$Y(a, s, n, true)) { 3250 return { 3251 meta: {}, 3252 valid: false 3253 }; 3254 } 3255 3256 var l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1]; 3257 var f = 0; 3258 var u; 3259 3260 for (u = 0; u < 10; u++) { 3261 f += parseInt(r.charAt(u), 10) * l[u]; 3262 } 3263 3264 f = f % 11; 3265 3266 if (f !== 10) { 3267 return { 3268 meta: {}, 3269 valid: "".concat(f) === r.charAt(10) 3270 }; 3271 } 3272 3273 f = 0; 3274 l = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3]; 3275 3276 for (u = 0; u < 10; u++) { 3277 f += parseInt(r.charAt(u), 10) * l[u]; 3278 } 3279 3280 f = f % 11; 3281 3282 if (f === 10) { 3283 f = 0; 3284 } 3285 3286 return { 3287 meta: {}, 3288 valid: "".concat(f) === r.charAt(10) 3289 }; 3290 } 3291 3292 function e$p(e) { 3293 if (!/^[0-9]{6}[-]{0,1}[0-9]{5}$/.test(e)) { 3294 return { 3295 meta: {}, 3296 valid: false 3297 }; 3298 } 3299 3300 var r = e.replace(/\D/g, ""); 3301 var a = parseInt(r.substr(0, 2), 10); 3302 var s = parseInt(r.substr(2, 2), 10); 3303 var n = parseInt(r.substr(4, 2), 10); 3304 n = n + 1800 + parseInt(r.charAt(6), 10) * 100; 3305 3306 if (!t$Y(n, s, a, true)) { 3307 return { 3308 meta: {}, 3309 valid: false 3310 }; 3311 } 3312 3313 var l = 0; 3314 var i = [10, 5, 8, 4, 2, 1, 6, 3, 7, 9]; 3315 3316 for (var _t = 0; _t < 10; _t++) { 3317 l += parseInt(r.charAt(_t), 10) * i[_t]; 3318 } 3319 3320 l = (l + 1) % 11 % 10; 3321 return { 3322 meta: {}, 3323 valid: "".concat(l) === r.charAt(10) 3324 }; 3325 } 3326 3327 function r$7(r) { 3328 return { 3329 meta: {}, 3330 valid: t$Q(r, "ME") 3331 }; 3332 } 3333 3334 function r$6(r) { 3335 return { 3336 meta: {}, 3337 valid: t$Q(r, "MK") 3338 }; 3339 } 3340 3341 function O(O) { 3342 var t = O.toUpperCase(); 3343 3344 if (!/^[A-Z]{4}\d{6}[A-Z]{6}[0-9A-Z]\d$/.test(t)) { 3345 return { 3346 meta: {}, 3347 valid: false 3348 }; 3349 } 3350 3351 var C = ["BACA", "BAKA", "BUEI", "BUEY", "CACA", "CACO", "CAGA", "CAGO", "CAKA", "CAKO", "COGE", "COGI", "COJA", "COJE", "COJI", "COJO", "COLA", "CULO", "FALO", "FETO", "GETA", "GUEI", "GUEY", "JETA", "JOTO", "KACA", "KACO", "KAGA", "KAGO", "KAKA", "KAKO", "KOGE", "KOGI", "KOJA", "KOJE", "KOJI", "KOJO", "KOLA", "KULO", "LILO", "LOCA", "LOCO", "LOKA", "LOKO", "MAME", "MAMO", "MEAR", "MEAS", "MEON", "MIAR", "MION", "MOCO", "MOKO", "MULA", "MULO", "NACA", "NACO", "PEDA", "PEDO", "PENE", "PIPI", "PITO", "POPO", "PUTA", "PUTO", "QULO", "RATA", "ROBA", "ROBE", "ROBO", "RUIN", "SENO", "TETA", "VACA", "VAGA", "VAGO", "VAKA", "VUEI", "VUEY", "WUEI", "WUEY"]; 3352 var e = t.substr(0, 4); 3353 3354 if (C.indexOf(e) >= 0) { 3355 return { 3356 meta: {}, 3357 valid: false 3358 }; 3359 } 3360 3361 var s = parseInt(t.substr(4, 2), 10); 3362 var r = parseInt(t.substr(6, 2), 10); 3363 var a = parseInt(t.substr(6, 2), 10); 3364 3365 if (/^[0-9]$/.test(t.charAt(16))) { 3366 s += 1900; 3367 } else { 3368 s += 2e3; 3369 } 3370 3371 if (!t$Y(s, r, a)) { 3372 return { 3373 meta: {}, 3374 valid: false 3375 }; 3376 } 3377 3378 var E = t.charAt(10); 3379 3380 if (E !== "H" && E !== "M") { 3381 return { 3382 meta: {}, 3383 valid: false 3384 }; 3385 } 3386 3387 var n = t.substr(11, 2); 3388 var K = ["AS", "BC", "BS", "CC", "CH", "CL", "CM", "CS", "DF", "DG", "GR", "GT", "HG", "JC", "MC", "MN", "MS", "NE", "NL", "NT", "OC", "PL", "QR", "QT", "SL", "SP", "SR", "TC", "TL", "TS", "VZ", "YN", "ZS"]; 3389 3390 if (K.indexOf(n) === -1) { 3391 return { 3392 meta: {}, 3393 valid: false 3394 }; 3395 } 3396 3397 var i = "0123456789ABCDEFGHIJKLMN&OPQRSTUVWXYZ"; 3398 var L = 0; 3399 var l = t.length; 3400 3401 for (var _A = 0; _A < l - 1; _A++) { 3402 L += (18 - _A) * i.indexOf(t.charAt(_A)); 3403 } 3404 3405 L = (10 - L % 10) % 10; 3406 return { 3407 meta: {}, 3408 valid: "".concat(L) === t.charAt(l - 1) 3409 }; 3410 } 3411 3412 function s$6(s) { 3413 if (!/^\d{12}$/.test(s)) { 3414 return { 3415 meta: {}, 3416 valid: false 3417 }; 3418 } 3419 3420 var e = parseInt(s.substr(0, 2), 10); 3421 var r = parseInt(s.substr(2, 2), 10); 3422 var a = parseInt(s.substr(4, 2), 10); 3423 3424 if (!t$Y(e + 1900, r, a) && !t$Y(e + 2e3, r, a)) { 3425 return { 3426 meta: {}, 3427 valid: false 3428 }; 3429 } 3430 3431 var n = s.substr(6, 2); 3432 var i = ["17", "18", "19", "20", "69", "70", "73", "80", "81", "94", "95", "96", "97"]; 3433 return { 3434 meta: {}, 3435 valid: i.indexOf(n) === -1 3436 }; 3437 } 3438 3439 function e$o(e) { 3440 if (e.length < 8) { 3441 return { 3442 meta: {}, 3443 valid: false 3444 }; 3445 } 3446 3447 var t = e; 3448 3449 if (t.length === 8) { 3450 t = "0".concat(t); 3451 } 3452 3453 if (!/^[0-9]{4}[.]{0,1}[0-9]{2}[.]{0,1}[0-9]{3}$/.test(t)) { 3454 return { 3455 meta: {}, 3456 valid: false 3457 }; 3458 } 3459 3460 t = t.replace(/\./g, ""); 3461 3462 if (parseInt(t, 10) === 0) { 3463 return { 3464 meta: {}, 3465 valid: false 3466 }; 3467 } 3468 3469 var a = 0; 3470 var l = t.length; 3471 3472 for (var _e = 0; _e < l - 1; _e++) { 3473 a += (9 - _e) * parseInt(t.charAt(_e), 10); 3474 } 3475 3476 a = a % 11; 3477 3478 if (a === 10) { 3479 a = 0; 3480 } 3481 3482 return { 3483 meta: {}, 3484 valid: "".concat(a) === t.charAt(l - 1) 3485 }; 3486 } 3487 3488 function t$I(t) { 3489 if (!/^\d{11}$/.test(t)) { 3490 return { 3491 meta: {}, 3492 valid: false 3493 }; 3494 } 3495 3496 var r = function r(t) { 3497 var r = [3, 7, 6, 1, 8, 9, 4, 5, 2]; 3498 var e = 0; 3499 3500 for (var n = 0; n < 9; n++) { 3501 e += r[n] * parseInt(t.charAt(n), 10); 3502 } 3503 3504 return 11 - e % 11; 3505 }; 3506 3507 var e = function e(t) { 3508 var r = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]; 3509 var e = 0; 3510 3511 for (var n = 0; n < 10; n++) { 3512 e += r[n] * parseInt(t.charAt(n), 10); 3513 } 3514 3515 return 11 - e % 11; 3516 }; 3517 3518 return { 3519 meta: {}, 3520 valid: "".concat(r(t)) === t.substr(-2, 1) && "".concat(e(t)) === t.substr(-1) 3521 }; 3522 } 3523 3524 function t$H(t) { 3525 if (!/^\d{8}[0-9A-Z]*$/.test(t)) { 3526 return { 3527 meta: {}, 3528 valid: false 3529 }; 3530 } 3531 3532 if (t.length === 8) { 3533 return { 3534 meta: {}, 3535 valid: true 3536 }; 3537 } 3538 3539 var e = [3, 2, 7, 6, 5, 4, 3, 2]; 3540 var r = 0; 3541 3542 for (var _a = 0; _a < 8; _a++) { 3543 r += e[_a] * parseInt(t.charAt(_a), 10); 3544 } 3545 3546 var a = r % 11; 3547 var n = [6, 5, 4, 3, 2, 1, 1, 0, 9, 8, 7][a]; 3548 var c = "KJIHGFEDCBA".charAt(a); 3549 return { 3550 meta: {}, 3551 valid: t.charAt(8) === "".concat(n) || t.charAt(8) === c 3552 }; 3553 } 3554 3555 function t$G(t) { 3556 if (!/^[0-9]{11}$/.test(t)) { 3557 return { 3558 meta: {}, 3559 valid: false 3560 }; 3561 } 3562 3563 var e = 0; 3564 var a = t.length; 3565 var r = [1, 3, 7, 9, 1, 3, 7, 9, 1, 3, 7]; 3566 3567 for (var n = 0; n < a - 1; n++) { 3568 e += r[n] * parseInt(t.charAt(n), 10); 3569 } 3570 3571 e = e % 10; 3572 3573 if (e === 0) { 3574 e = 10; 3575 } 3576 3577 e = 10 - e; 3578 return { 3579 meta: {}, 3580 valid: "".concat(e) === t.charAt(a - 1) 3581 }; 3582 } 3583 3584 function e$n(e) { 3585 if (!/^[0-9]{13}$/.test(e)) { 3586 return { 3587 meta: {}, 3588 valid: false 3589 }; 3590 } 3591 3592 var a = parseInt(e.charAt(0), 10); 3593 3594 if (a === 0 || a === 7 || a === 8) { 3595 return { 3596 meta: {}, 3597 valid: false 3598 }; 3599 } 3600 3601 var r = parseInt(e.substr(1, 2), 10); 3602 var s = parseInt(e.substr(3, 2), 10); 3603 var n = parseInt(e.substr(5, 2), 10); 3604 var i = { 3605 1: 1900, 3606 2: 1900, 3607 3: 1800, 3608 4: 1800, 3609 5: 2e3, 3610 6: 2e3 3611 }; 3612 3613 if (n > 31 && s > 12) { 3614 return { 3615 meta: {}, 3616 valid: false 3617 }; 3618 } 3619 3620 if (a !== 9) { 3621 r = i[a + ""] + r; 3622 3623 if (!t$Y(r, s, n)) { 3624 return { 3625 meta: {}, 3626 valid: false 3627 }; 3628 } 3629 } 3630 3631 var l = 0; 3632 var f = [2, 7, 9, 1, 4, 6, 3, 5, 8, 2, 7, 9]; 3633 var o = e.length; 3634 3635 for (var _t = 0; _t < o - 1; _t++) { 3636 l += parseInt(e.charAt(_t), 10) * f[_t]; 3637 } 3638 3639 l = l % 11; 3640 3641 if (l === 10) { 3642 l = 1; 3643 } 3644 3645 return { 3646 meta: {}, 3647 valid: "".concat(l) === e.charAt(o - 1) 3648 }; 3649 } 3650 3651 function r$5(r) { 3652 return { 3653 meta: {}, 3654 valid: t$Q(r, "RS") 3655 }; 3656 } 3657 3658 function r$4(r) { 3659 if (!/^[0-9]{10}$/.test(r) && !/^[0-9]{6}[-|+][0-9]{4}$/.test(r)) { 3660 return { 3661 meta: {}, 3662 valid: false 3663 }; 3664 } 3665 3666 var e = r.replace(/[^0-9]/g, ""); 3667 var a = parseInt(e.substr(0, 2), 10) + 1900; 3668 var n = parseInt(e.substr(2, 2), 10); 3669 var i = parseInt(e.substr(4, 2), 10); 3670 3671 if (!t$Y(a, n, i)) { 3672 return { 3673 meta: {}, 3674 valid: false 3675 }; 3676 } 3677 3678 return { 3679 meta: {}, 3680 valid: t$15(e) 3681 }; 3682 } 3683 3684 function r$3(r) { 3685 return { 3686 meta: {}, 3687 valid: t$Q(r, "SI") 3688 }; 3689 } 3690 3691 function t$F(t) { 3692 return { 3693 meta: {}, 3694 valid: /^\d{5}$/.test(t) 3695 }; 3696 } 3697 3698 function t$E(t) { 3699 if (t.length !== 13) { 3700 return { 3701 meta: {}, 3702 valid: false 3703 }; 3704 } 3705 3706 var e = 0; 3707 3708 for (var a = 0; a < 12; a++) { 3709 e += parseInt(t.charAt(a), 10) * (13 - a); 3710 } 3711 3712 return { 3713 meta: {}, 3714 valid: (11 - e % 11) % 10 === parseInt(t.charAt(12), 10) 3715 }; 3716 } 3717 3718 function t$D(t) { 3719 if (t.length !== 11) { 3720 return { 3721 meta: {}, 3722 valid: false 3723 }; 3724 } 3725 3726 var e = 0; 3727 3728 for (var a = 0; a < 10; a++) { 3729 e += parseInt(t.charAt(a), 10); 3730 } 3731 3732 return { 3733 meta: {}, 3734 valid: e % 10 === parseInt(t.charAt(10), 10) 3735 }; 3736 } 3737 3738 function t$C(t) { 3739 var e = t.toUpperCase(); 3740 3741 if (!/^[A-Z][12][0-9]{8}$/.test(e)) { 3742 return { 3743 meta: {}, 3744 valid: false 3745 }; 3746 } 3747 3748 var a = e.length; 3749 var n = "ABCDEFGHJKLMNPQRSTUVXYWZIO"; 3750 var r = n.indexOf(e.charAt(0)) + 10; 3751 var o = Math.floor(r / 10) + r % 10 * (a - 1); 3752 var s = 0; 3753 3754 for (var _t = 1; _t < a - 1; _t++) { 3755 s += parseInt(e.charAt(_t), 10) * (a - 1 - _t); 3756 } 3757 3758 return { 3759 meta: {}, 3760 valid: (o + s + parseInt(e.charAt(a - 1), 10)) % 10 === 0 3761 }; 3762 } 3763 3764 function t$B(t) { 3765 if (!/^\d{8}$/.test(t)) { 3766 return { 3767 meta: {}, 3768 valid: false 3769 }; 3770 } 3771 3772 var e = [2, 9, 8, 7, 6, 3, 4]; 3773 var a = 0; 3774 3775 for (var r = 0; r < 7; r++) { 3776 a += parseInt(t.charAt(r), 10) * e[r]; 3777 } 3778 3779 a = a % 10; 3780 3781 if (a > 0) { 3782 a = 10 - a; 3783 } 3784 3785 return { 3786 meta: {}, 3787 valid: "".concat(a) === t.charAt(7) 3788 }; 3789 } 3790 3791 function r$2(r) { 3792 if (!/^[0-9]{10}[0|1][8|9][0-9]$/.test(r)) { 3793 return { 3794 meta: {}, 3795 valid: false 3796 }; 3797 } 3798 3799 var s = parseInt(r.substr(0, 2), 10); 3800 var a = new Date().getFullYear() % 100; 3801 var l = parseInt(r.substr(2, 2), 10); 3802 var n = parseInt(r.substr(4, 2), 10); 3803 s = s >= a ? s + 1900 : s + 2e3; 3804 3805 if (!t$Y(s, l, n)) { 3806 return { 3807 meta: {}, 3808 valid: false 3809 }; 3810 } 3811 3812 return { 3813 meta: {}, 3814 valid: t$15(r) 3815 }; 3816 } 3817 3818 function F() { 3819 var F = ["AR", "BA", "BG", "BR", "CH", "CL", "CN", "CO", "CZ", "DK", "EE", "ES", "FI", "FR", "HK", "HR", "ID", "IE", "IL", "IS", "KR", "LT", "LV", "ME", "MK", "MX", "MY", "NL", "NO", "PE", "PL", "RO", "RS", "SE", "SI", "SK", "SM", "TH", "TR", "TW", "UY", "ZA"]; 3820 return { 3821 validate: function validate(P) { 3822 if (P.value === "") { 3823 return { 3824 valid: true 3825 }; 3826 } 3827 3828 var Y = Object.assign({}, { 3829 message: "" 3830 }, P.options); 3831 var Z = P.value.substr(0, 2); 3832 3833 if ("function" === typeof Y.country) { 3834 Z = Y.country.call(this); 3835 } else { 3836 Z = Y.country; 3837 } 3838 3839 if (F.indexOf(Z) === -1) { 3840 return { 3841 valid: true 3842 }; 3843 } 3844 3845 var G = { 3846 meta: {}, 3847 valid: true 3848 }; 3849 3850 switch (Z.toLowerCase()) { 3851 case "ar": 3852 G = t$R(P.value); 3853 break; 3854 3855 case "ba": 3856 G = r$a(P.value); 3857 break; 3858 3859 case "bg": 3860 G = e$x(P.value); 3861 break; 3862 3863 case "br": 3864 G = t$P(P.value); 3865 break; 3866 3867 case "ch": 3868 G = t$O(P.value); 3869 break; 3870 3871 case "cl": 3872 G = e$w(P.value); 3873 break; 3874 3875 case "cn": 3876 G = r$9(P.value); 3877 break; 3878 3879 case "co": 3880 G = t$N(P.value); 3881 break; 3882 3883 case "cz": 3884 G = e$v(P.value); 3885 break; 3886 3887 case "dk": 3888 G = e$u(P.value); 3889 break; 3890 3891 case "ee": 3892 G = r$8(P.value); 3893 break; 3894 3895 case "es": 3896 G = t$M(P.value); 3897 break; 3898 3899 case "fi": 3900 G = s$7(P.value); 3901 break; 3902 3903 case "fr": 3904 G = t$L(P.value); 3905 break; 3906 3907 case "hk": 3908 G = t$K(P.value); 3909 break; 3910 3911 case "hr": 3912 G = o$1(P.value); 3913 break; 3914 3915 case "id": 3916 G = e$t(P.value); 3917 break; 3918 3919 case "ie": 3920 G = t$J(P.value); 3921 break; 3922 3923 case "il": 3924 G = e$s(P.value); 3925 break; 3926 3927 case "is": 3928 G = e$r(P.value); 3929 break; 3930 3931 case "kr": 3932 G = e$q(P.value); 3933 break; 3934 3935 case "lt": 3936 G = r$8(P.value); 3937 break; 3938 3939 case "lv": 3940 G = e$p(P.value); 3941 break; 3942 3943 case "me": 3944 G = r$7(P.value); 3945 break; 3946 3947 case "mk": 3948 G = r$6(P.value); 3949 break; 3950 3951 case "mx": 3952 G = O(P.value); 3953 break; 3954 3955 case "my": 3956 G = s$6(P.value); 3957 break; 3958 3959 case "nl": 3960 G = e$o(P.value); 3961 break; 3962 3963 case "no": 3964 G = t$I(P.value); 3965 break; 3966 3967 case "pe": 3968 G = t$H(P.value); 3969 break; 3970 3971 case "pl": 3972 G = t$G(P.value); 3973 break; 3974 3975 case "ro": 3976 G = e$n(P.value); 3977 break; 3978 3979 case "rs": 3980 G = r$5(P.value); 3981 break; 3982 3983 case "se": 3984 G = r$4(P.value); 3985 break; 3986 3987 case "si": 3988 G = r$3(P.value); 3989 break; 3990 3991 case "sk": 3992 G = e$v(P.value); 3993 break; 3994 3995 case "sm": 3996 G = t$F(P.value); 3997 break; 3998 3999 case "th": 4000 G = t$E(P.value); 4001 break; 4002 4003 case "tr": 4004 G = t$D(P.value); 4005 break; 4006 4007 case "tw": 4008 G = t$C(P.value); 4009 break; 4010 4011 case "uy": 4012 G = t$B(P.value); 4013 break; 4014 4015 case "za": 4016 G = r$2(P.value); 4017 break; 4018 } 4019 4020 var V = r$d(P.l10n && P.l10n.id ? Y.message || P.l10n.id.country : Y.message, P.l10n && P.l10n.id && P.l10n.id.countries ? P.l10n.id.countries[Z.toUpperCase()] : Z.toUpperCase()); 4021 return Object.assign({}, { 4022 message: V 4023 }, G); 4024 } 4025 }; 4026 } 4027 4028 function t$A() { 4029 return { 4030 validate: function validate(t) { 4031 if (t.value === "") { 4032 return { 4033 valid: true 4034 }; 4035 } 4036 4037 switch (true) { 4038 case /^\d{15}$/.test(t.value): 4039 case /^\d{2}-\d{6}-\d{6}-\d{1}$/.test(t.value): 4040 case /^\d{2}\s\d{6}\s\d{6}\s\d{1}$/.test(t.value): 4041 return { 4042 valid: t$15(t.value.replace(/[^0-9]/g, "")) 4043 }; 4044 4045 case /^\d{14}$/.test(t.value): 4046 case /^\d{16}$/.test(t.value): 4047 case /^\d{2}-\d{6}-\d{6}(|-\d{2})$/.test(t.value): 4048 case /^\d{2}\s\d{6}\s\d{6}(|\s\d{2})$/.test(t.value): 4049 return { 4050 valid: true 4051 }; 4052 4053 default: 4054 return { 4055 valid: false 4056 }; 4057 } 4058 } 4059 }; 4060 } 4061 4062 function e$m() { 4063 return { 4064 validate: function validate
4064(e) { 4065 if (e.value === "") { 4066 return { 4067 valid: true 4068 }; 4069 } 4070 4071 if (!/^IMO \d{7}$/i.test(e.value)) { 4072 return { 4073 valid: false 4074 }; 4075 } 4076 4077 var t = e.value.replace(/^.*(\d{7})$/, "$1"); 4078 var r = 0; 4079 4080 for (var _e = 6; _e >= 1; _e--) { 4081 r += parseInt(t.slice(6 - _e, -_e), 10) * (_e + 1); 4082 } 4083 4084 return { 4085 valid: r % 10 === parseInt(t.charAt(6), 10) 4086 }; 4087 } 4088 }; 4089 } 4090 4091 function e$l() { 4092 return { 4093 validate: function validate(e) { 4094 if (e.value === "") { 4095 return { 4096 meta: { 4097 type: null 4098 }, 4099 valid: true 4100 }; 4101 } 4102 4103 var t; 4104 4105 switch (true) { 4106 case /^\d{9}[\dX]$/.test(e.value): 4107 case e.value.length === 13 && /^(\d+)-(\d+)-(\d+)-([\dX])$/.test(e.value): 4108 case e.value.length === 13 && /^(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(e.value): 4109 t = "ISBN10"; 4110 break; 4111 4112 case /^(978|979)\d{9}[\dX]$/.test(e.value): 4113 case e.value.length === 17 && /^(978|979)-(\d+)-(\d+)-(\d+)-([\dX])$/.test(e.value): 4114 case e.value.length === 17 && /^(978|979)\s(\d+)\s(\d+)\s(\d+)\s([\dX])$/.test(e.value): 4115 t = "ISBN13"; 4116 break; 4117 4118 default: 4119 return { 4120 meta: { 4121 type: null 4122 }, 4123 valid: false 4124 }; 4125 } 4126 4127 var a = e.value.replace(/[^0-9X]/gi, "").split(""); 4128 var l = a.length; 4129 var s = 0; 4130 var d; 4131 var u; 4132 4133 switch (t) { 4134 case "ISBN10": 4135 s = 0; 4136 4137 for (d = 0; d < l - 1; d++) { 4138 s += parseInt(a[d], 10) * (10 - d); 4139 } 4140 4141 u = 11 - s % 11; 4142 4143 if (u === 11) { 4144 u = 0; 4145 } else if (u === 10) { 4146 u = "X"; 4147 } 4148 4149 return { 4150 meta: { 4151 type: t 4152 }, 4153 valid: "".concat(u) === a[l - 1] 4154 }; 4155 4156 case "ISBN13": 4157 s = 0; 4158 4159 for (d = 0; d < l - 1; d++) { 4160 s += d % 2 === 0 ? parseInt(a[d], 10) : parseInt(a[d], 10) * 3; 4161 } 4162 4163 u = 10 - s % 10; 4164 4165 if (u === 10) { 4166 u = "0"; 4167 } 4168 4169 return { 4170 meta: { 4171 type: t 4172 }, 4173 valid: "".concat(u) === a[l - 1] 4174 }; 4175 } 4176 } 4177 }; 4178 } 4179 4180 function M() { 4181 var M = "AF|AX|AL|DZ|AS|AD|AO|AI|AQ|AG|AR|AM|AW|AU|AT|AZ|BS|BH|BD|BB|BY|BE|BZ|BJ|BM|BT|BO|BQ|BA|BW|" + "BV|BR|IO|BN|BG|BF|BI|KH|CM|CA|CV|KY|CF|TD|CL|CN|CX|CC|CO|KM|CG|CD|CK|CR|CI|HR|CU|CW|CY|CZ|DK|DJ|DM|DO|EC|EG|" + "SV|GQ|ER|EE|ET|FK|FO|FJ|FI|FR|GF|PF|TF|GA|GM|GE|DE|GH|GI|GR|GL|GD|GP|GU|GT|GG|GN|GW|GY|HT|HM|VA|HN|HK|HU|IS|" + "IN|ID|IR|IQ|IE|IM|IL|IT|JM|JP|JE|JO|KZ|KE|KI|KP|KR|KW|KG|LA|LV|LB|LS|LR|LY|LI|LT|LU|MO|MK|MG|MW|MY|MV|ML|MT|" + "MH|MQ|MR|MU|YT|MX|FM|MD|MC|MN|ME|MS|MA|MZ|MM|NA|NR|NP|NL|NC|NZ|NI|NE|NG|NU|NF|MP|NO|OM|PK|PW|PS|PA|PG|PY|PE|" + "PH|PN|PL|PT|PR|QA|RE|RO|RU|RW|BL|SH|KN|LC|MF|PM|VC|WS|SM|ST|SA|SN|RS|SC|SL|SG|SX|SK|SI|SB|SO|ZA|GS|SS|ES|LK|" + "SD|SR|SJ|SZ|SE|CH|SY|TW|TJ|TZ|TH|TL|TG|TK|TO|TT|TN|TR|TM|TC|TV|UG|UA|AE|GB|US|UM|UY|UZ|VU|VE|VN|VG|VI|WF|EH|" + "YE|ZM|ZW"; 4182 return { 4183 validate: function validate(t) { 4184 if (t.value === "") { 4185 return { 4186 valid: true 4187 }; 4188 } 4189 4190 var S = t.value.toUpperCase(); 4191 var A = new RegExp("^(" + M + ")[0-9A-Z]{10}$"); 4192 4193 if (!A.test(t.value)) { 4194 return { 4195 valid: false 4196 }; 4197 } 4198 4199 var G = S.length; 4200 var C = ""; 4201 var T; 4202 4203 for (T = 0; T < G - 1; T++) {
4204 var _M = S.charCodeAt(T); 4205 4206 C += _M > 57 ? (_M - 55).toString() : S.charAt(T); 4207 } 4208 4209 var e = ""; 4210 var B = C.length; 4211 var E = B % 2 !== 0 ? 0 : 1; 4212 4213 for (T = 0; T < B; T++) { 4214 e += parseInt(C[T], 10) * (T % 2 === E ? 2 : 1) + ""; 4215 } 4216 4217 var N = 0; 4218 4219 for (T = 0; T < e.length; T++) { 4220 N += parseInt(e.charAt(T), 10); 4221 } 4222 4223 N = (10 - N % 10) % 10; 4224 return { 4225 valid: "".concat(N) === S.charAt(G - 1) 4226 }; 4227 } 4228 }; 4229 } 4230 4231 function e$k() { 4232 return { 4233 validate: function validate(e) { 4234 if (e.value === "") { 4235 return { 4236 meta: null, 4237 valid: true 4238 }; 4239 } 4240 4241 var t; 4242 4243 switch (true) { 4244 case /^M\d{9}$/.test(e.value): 4245 case /^M-\d{4}-\d{4}-\d{1}$/.test(e.value): 4246 case /^M\s\d{4}\s\d{4}\s\d{1}$/.test(e.value): 4247 t = "ISMN10"; 4248 break; 4249 4250 case /^9790\d{9}$/.test(e.value): 4251 case /^979-0-\d{4}-\d{4}-\d{1}$/.test(e.value): 4252 case /^979\s0\s\d{4}\s\d{4}\s\d{1}$/.test(e.value): 4253 t = "ISMN13"; 4254 break; 4255 4256 default: 4257 return { 4258 meta: null, 4259 valid: false 4260 }; 4261 } 4262 4263 var a = e.value; 4264 4265 if ("ISMN10" === t) { 4266 a = "9790".concat(a.substr(1)); 4267 } 4268 4269 a = a.replace(/[^0-9]/gi, ""); 4270 var s = 0; 4271 var l = a.length; 4272 var d = [1, 3]; 4273 4274 for (var _e = 0; _e < l - 1; _e++) { 4275 s += parseInt(a.charAt(_e), 10) * d[_e % 2]; 4276 } 4277 4278 s = (10 - s % 10) % 10; 4279 return { 4280 meta: { 4281 type: t 4282 }, 4283 valid: "".concat(s) === a.charAt(l - 1) 4284 }; 4285 } 4286 }; 4287 } 4288 4289 function e$j() { 4290 return { 4291 validate: function validate(e) { 4292 if (e.value === "") { 4293 return { 4294 valid: true 4295 }; 4296 } 4297 4298 if (!/^\d{4}-\d{3}[\dX]$/.test(e.value)) { 4299 return { 4300 valid: false 4301 }; 4302 } 4303 4304 var t = e.value.replace(/[^0-9X]/gi, "").split(""); 4305 var l = t.length; 4306 var r = 0; 4307 4308 if (t[7] === "X") { 4309 t[7] = "10"; 4310 } 4311 4312 for (var _e = 0; _e < l; _e++) { 4313 r += parseInt(t[_e], 10) * (8 - _e); 4314 } 4315 4316 return { 4317 valid: r % 11 === 0 4318 }; 4319 } 4320 }; 4321 } 4322 4323 function a$1() { 4324 return { 4325 validate: function validate(a) { 4326 return { 4327 valid: a.value === "" || /^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$/.test(a.value) || /^([0-9A-Fa-f]{4}\.){2}([0-9A-Fa-f]{4})$/.test(a.value) 4328 }; 4329 } 4330 }; 4331 } 4332 4333 function e$i() { 4334 return { 4335 validate: function validate(e) { 4336 if (e.value === "") { 4337 return { 4338 valid: true 4339 }; 4340 } 4341 4342 var r = e.value; 4343 4344 if (/^[0-9A-F]{15}$/i.test(r) || /^[0-9A-F]{2}[- ][0-9A-F]{6}[- ][0-9A-F]{6}[- ][0-9A-F]$/i.test(r) || /^\d{19}$/.test(r) || /^\d{5}[- ]\d{5}[- ]\d{4}[- ]\d{4}[- ]\d$/.test(r)) { 4345 var _e = r.charAt(r.length - 1).toUpperCase(); 4346 4347 r = r.replace(/[- ]/g, ""); 4348 4349 if (r.match(/^\d*$/i)) { 4350 return { 4351 valid: t$15(r) 4352 }; 4353 } 4354 4355 r = r.slice(0, -1); 4356 var a = ""; 4357 var i; 4358 4359 for (i = 1; i <= 13; i += 2) { 4360 a += (parseInt(r.charAt(i), 16) * 2).toString(16); 4361 } 4362 4363 var l = 0; 4364 4365 for (i = 0; i < a.length; i++) { 4366 l += parseInt(a.charAt(i), 16); 4367 } 4368 4369 return { 4370 valid: l % 10 === 0 ? _e === "0" : _e === ((Math.floor((l + 10) / 10) * 10 - l) * 2).toString(16).toUpperCase() 4371 }; 4372 } 4373 4374 if (/^[0-9A-F]{14}$/i.test(r) || /^[0-9A-F]{2}[- ][0-9A-F]{6}[- ][0-9A-F]{6}$/i.test(r) || /^\d{18}$/.test(r) || /^\d{5}[- ]\d{5}[- ]\d{4}[- ]\d{4}$/.test(r)) { 4375 return { 4376 valid: true 4377 }; 4378 } 4379 4380 return { 4381 valid: false 4382 }; 4383 } 4384 }; 4385 } 4386 4387 function e$h() { 4388 var e = ["AE", "BG", "BR", "CN", "CZ", "DE", "DK", "ES", "FR", "GB", "IN", "MA", "NL", "PK", "RO", "RU", "SK", "TH", "US", "VE"]; 4389 return { 4390 validate: function validate(t) { 4391 if (t.value === "") { 4392 return { 4393 valid: true 4394 }; 4395 } 4396 4397 var a = Object.assign({}, { 4398 message: "" 4399 }, t.options); 4400 var d = t.value.trim(); 4401 var r = d.substr(0, 2); 4402 4403 if ("function" === typeof a.country) {
4404 r = a.country.call(this); 4405 } else { 4406 r = a.country; 4407 } 4408 4409 if (!r || e.indexOf(r.toUpperCase()) === -1) { 4410 return { 4411 valid: true 4412 }; 4413 } 4414 4415 var c = true; 4416 4417 switch (r.toUpperCase()) { 4418 case "AE": 4419 c = /^(((\+|00)?971[\s.-]?(\(0\)[\s.-]?)?|0)(\(5(0|2|5|6)\)|5(0|2|5|6)|2|3|4|6|7|9)|60)([\s.-]?[0-9]){7}$/.test(d); 4420 break; 4421 4422 case "BG": 4423 c = /^(0|359|00)(((700|900)[0-9]{5}|((800)[0-9]{5}|(800)[0-9]{4}))|(87|88|89)([0-9]{7})|((2[0-9]{7})|(([3-9][0-9])(([0-9]{6})|([0-9]{5})))))$/.test(d.replace(/\+|\s|-|\/|\(|\)/gi, "")); 4424 break; 4425 4426 case "BR": 4427 c = /^(([\d]{4}[-.\s]{1}[\d]{2,3}[-.\s]{1}[\d]{2}[-.\s]{1}[\d]{2})|([\d]{4}[-.\s]{1}[\d]{3}[-.\s]{1}[\d]{4})|((\(?\+?[0-9]{2}\)?\s?)?(\(?\d{2}\)?\s?)?\d{4,5}[-.\s]?\d{4}))$/.test(d); 4428 break; 4429 4430 case "CN": 4431 c = /^((00|\+)?(86(?:-| )))?((\d{11})|(\d{3}[- ]{1}\d{4}[- ]{1}\d{4})|((\d{2,4}[- ]){1}(\d{7,8}|(\d{3,4}[- ]{1}\d{4}))([- ]{1}\d{1,4})?))$/.test(d); 4432 break; 4433 4434 case "CZ": 4435 c = /^(((00)([- ]?)|\+)(420)([- ]?))?((\d{3})([- ]?)){2}(\d{3})$/.test(d); 4436 break; 4437 4438 case "DE": 4439 c = /^(((((((00|\+)49[ \-/]?)|0)[1-9][0-9]{1,4})[ \-/]?)|((((00|\+)49\()|\(0)[1-9][0-9]{1,4}\)[ \-/]?))[0-9]{1,7}([ \-/]?[0-9]{1,5})?)$/.test(d); 4440 break; 4441 4442 case "DK": 4443 c = /^(\+45|0045|\(45\))?\s?[2-9](\s?\d){7}$/.test(d); 4444 break; 4445 4446 case "ES": 4447 c = /^(?:(?:(?:\+|00)34\D?))?(?:5|6|7|8|9)(?:\d\D?){8}$/.test(d); 4448 break; 4449 4450 case "FR": 4451 c = /^(?:(?:(?:\+|00)33[ ]?(?:\(0\)[ ]?)?)|0){1}[1-9]{1}([ .-]?)(?:\d{2}\1?){3}\d{2}$/.test(d); 4452 break; 4453 4454 case "GB": 4455 c = /^\(?(?:(?:0(?:0|11)\)?[\s-]?\(?|\+)44\)?[\s-]?\(?(?:0\)?[\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}|8(?:00[\s-]?11[\s-]?11|45[\s-]?46[\s-]?4\d))(?:(?:[\s-]?(?:x|ext\.?\s?|#)\d+)?)$/.test(d); 4456 break; 4457 4458 case "IN": 4459 c = /((\+?)((0[ -]+)*|(91 )*)(\d{12}|\d{10}))|\d{5}([- ]*)\d{6}/.test(d); 4460 break; 4461 4462 case "MA": 4463 c = /^(?:(?:(?:\+|00)212[\s]?(?:[\s]?\(0\)[\s]?)?)|0){1}(?:5[\s.-]?[2-3]|6[\s.-]?[13-9]){1}[0-9]{1}(?:[\s.-]?\d{2}){3}$/.test(d); 4464 break; 4465 4466 case "NL": 4467 c = /^((\+|00(\s|\s?-\s?)?)31(\s|\s?-\s?)?(\(0\)[-\s]?)?|0)[1-9]((\s|\s?-\s?)?[0-9])((\s|\s?-\s?)?[0-9])((\s|\s?-\s?)?[0-9])\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]\s?[0-9]$/gm.test(d); 4468 break; 4469 4470 case "PK": 4471 c = /^0?3[0-9]{2}[0-9]{7}$/.test(d); 4472 break; 4473 4474 case "RO": 4475 c = /^(\+4|)?(07[0-8]{1}[0-9]{1}|02[0-9]{2}|03[0-9]{2}){1}?(\s|\.|-)?([0-9]{3}(\s|\.|-|)){2}$/g.test(d); 4476 break; 4477 4478 case "RU": 4479 c = /^((8|\+7|007)[-./ ]?)?([(/.]?\d{3}[)/.]?[-./ ]?)?[\d\-./ ]{7,10}$/g.test(d); 4480 break; 4481 4482 case "SK": 4483 c = /^(((00)([- ]?)|\+)(421)([- ]?))?((\d{3})([- ]?)){2}(\d{3})$/.test(d); 4484 break; 4485 4486 case "TH": 4487 c = /^0\(?([6|8-9]{2})*-([0-9]{3})*-([0-9]{4})$/.test(d); 4488 break; 4489 4490 case "VE": 4491 c = /^0(?:2(?:12|4[0-9]|5[1-9]|6[0-9]|7[0-8]|8[1-35-8]|9[1-5]|3[45789])|4(?:1[246]|2[46]))\d{7}$/.test(d); 4492 break; 4493 4494 case "US": 4495 default: 4496 c = /^(?:(1-?)|(\+1 ?))?\(?\d{3}\)?[-.\s]?\d{3}[-.\s]?\d{4}$/.test(d); 4497 break; 4498 } 4499 4500 return { 4501 message: r$d(t.l10n && t.l10n.phone ? a.message || t.l10n.phone.country : a.message, t.l10n && t.l10n.phone && t.l10n.phone.countries ? t.l10n.phone.countries[r] : r), 4502 valid: c 4503 }; 4504 } 4505 }; 4506 } 4507 4508 function e$g() { 4509 return { 4510 validate: function validate(e) { 4511 if (e.value === "") { 4512 return { 4513 valid: true 4514 }; 4515 } 4516 4517 if (!/^\d{9}$/.test(e.value)) { 4518 return { 4519 valid: false 4520 }; 4521 } 4522 4523 var t = 0; 4524 4525 for (var a = 0; a < e.value.length; a += 3) { 4526 t += parseInt(e.value.charAt(a), 10) * 3 + parseInt(e.value.charAt(a + 1), 10) * 7 + parseInt(e.value.charAt(a + 2), 10); 4527 } 4528 4529 return { 4530 valid: t !== 0 && t % 10 === 0 4531 }; 4532 } 4533 }; 4534 } 4535 4536 function t$z() { 4537 return { 4538 validate: function validate(t) { 4539 if (t.value === "") { 4540 return { 4541 valid: true 4542 }; 4543 } 4544 4545 var e = t.value.toUpperCase(); 4546 4547 if (!/^[0-9A-Z]{7}$/.test(e)) { 4548 return { 4549 valid: false 4550 }; 4551 } 4552 4553 var r = [1, 3, 1, 7, 3, 9, 1]; 4554 var a = e.length; 4555 var l = 0; 4556 4557 for (var _t = 0; _t < a - 1; _t++) { 4558 l += r[_t] * parseInt(e.charAt(_t), 36); 4559 } 4560 4561 l = (10 - l % 10) % 10; 4562 return { 4563 valid: "".concat(l) === e.charAt(a - 1) 4564 }; 4565 } 4566 }; 4567 } 4568 4569 function e$f() { 4570 return { 4571 validate: function validate(e) { 4572 return { 4573 valid: e.value === "" || /^\d{9}$/.test(e.value) && t$15(e.value) 4574 }; 4575 } 4576 }; 4577 } 4578 4579 function e$e() { 4580 return { 4581 validate: function validate(e) { 4582 if (e.value === "") { 4583 return { 4584 valid: true 4585 }; 4586 } 4587 4588 var t = e.value.length; 4589 var l = 0; 4590 var r; 4591 4592 for (var a = 0; a < t; a++) { 4593 r = parseInt(e.value.charAt(a), 10); 4594 4595 if (a % 2 === 0) { 4596 r = r * 2; 4597 4598 if (r > 9) { 4599 r -= 9; 4600 } 4601 } 4602 4603 l += r; 4604 } 4605 4606 return { 4607 valid: l % 10 === 0 4608 }; 4609 } 4610 }; 4611 } 4612 4613 function e$d() { 4614 var e = function e(t, _e) { 4615 var s = Math.pow(10, _e); 4616 var a = t * s; 4617 var n; 4618 4619 switch (true) { 4620 case a === 0: 4621 n = 0; 4622 break; 4623 4624 case a > 0: 4625 n = 1; 4626 break; 4627 4628 case a < 0: 4629 n = -1; 4630 break; 4631 } 4632 4633 var r = a % 1 === .5 * n; 4634 return r ? (Math.floor(a) + (n > 0 ? 1 : 0)) / s : Math.round(a) / s; 4635 }; 4636 4637 var s = function s(t, _s) { 4638 if (_s === 0) { 4639 return 1; 4640 } 4641 4642 var a = "".concat(t).split("."); 4643 var n = "".concat(_s).split("."); 4644 var r = (a.length === 1 ? 0 : a[1].length) + (n.length === 1 ? 0 : n[1].length); 4645 return e(t - _s * Math.floor(t / _s), r); 4646 }; 4647 4648 return { 4649 validate: function validate(e) { 4650 if (e.value === "") { 4651 return { 4652 valid: true 4653 }; 4654 } 4655 4656 var a = parseFloat(e.value); 4657 4658 if (isNaN(a) || !isFinite(a)) { 4659 return { 4660 valid: false 4661 }; 4662 } 4663 4664 var n = Object.assign({}, { 4665 baseValue: 0, 4666 message: "", 4667 step: 1 4668 }, e.options); 4669 var r = s(a - n.baseValue, n.step); 4670 return { 4671 message: r$d(e.l10n ? n.message || e.l10n.step["default"] : n.message, "".concat(n.step)), 4672 valid: r === 0 || r === n.step 4673 }; 4674 } 4675 }; 4676 } 4677 4678 function s$5() { 4679 return { 4680 validate: function validate(s) { 4681 if (s.value === "") { 4682 return { 4683 valid: true 4684 }; 4685 } 4686 4687 var A = Object.assign({}, { 4688 message: "" 4689 }, s.options); 4690 var i = { 4691 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i, 4692 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 4693 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 4694 all: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i 4695 }; 4696 var n = A.version ? "".concat(A.version) : "all"; 4697 return { 4698 message: A.version ? r$d(s.l10n ? A.message || s.l10n.uuid.version : A.message, A.version) : s.l10n ? s.l10n.uuid["default"] : A.message, 4699 valid: null === i[n] ? true : i[n].test(s.value) 4700 }; 4701 } 4702 }; 4703 } 4704 4705 function t$y(t) { 4706 var e = t.replace("-", ""); 4707 4708 if (/^AR[0-9]{11}$/.test(e)) { 4709 e = e.substr(2); 4710 } 4711 4712 if (!/^[0-9]{11}$/.test(e)) { 4713 return { 4714 meta: {}, 4715 valid: false 4716 }; 4717 } 4718 4719 var r = [5, 4, 3, 2, 7, 6, 5, 4, 3, 2]; 4720 var a = 0; 4721 4722 for (var _t = 0; _t < 10; _t++) { 4723 a += parseInt(e.charAt(_t), 10) * r[_t]; 4724 } 4725 4726 a = 11 - a % 11; 4727 4728 if (a === 11) { 4729 a = 0; 4730 } 4731 4732 return { 4733 meta: {}, 4734 valid: "".concat(a) === e.substr(10) 4735 }; 4736 } 4737 4738 function t$x(t) { 4739 var e = t; 4740 4741 if (/^ATU[0-9]{8}$/.test(e)) { 4742 e = e.substr(2); 4743 } 4744 4745 if (!/^U[0-9]{8}$/.test(e)) { 4746 return { 4747 meta: {}, 4748 valid: false 4749 }; 4750 } 4751 4752 e = e.substr(1); 4753 var r = [1, 2, 1, 2, 1, 2, 1]; 4754 var s = 0; 4755 var a = 0; 4756 4757 for (var _t = 0; _t < 7; _t++) { 4758 a = parseInt(e.charAt(_t), 10) * r[_t]; 4759 4760 if (a > 9) { 4761 a = Math.floor(a / 10) + a % 10; 4762 } 4763 4764 s += a; 4765 } 4766 4767 s = 10 - (s + 4) % 10; 4768 4769 if (s === 10) { 4770 s = 0; 4771 } 4772 4773 return { 4774 meta: {}, 4775 valid: "".concat(s) === e.substr(7, 1) 4776 }; 4777 } 4778 4779 function t$w(t) { 4780 var e = t; 4781 4782 if (/^BE[0]?[0-9]{9}$/.test(e)) { 4783 e = e.substr(2); 4784 } 4785 4786 if (!/^[0]?[0-9]{9}$/.test(e)) { 4787 return { 4788 meta: {}, 4789 valid: false 4790 }; 4791 } 4792 4793 if (e.length === 9) { 4794 e = "0".concat(e); 4795 } 4796 4797 if (e.substr(1, 1) === "0") { 4798 return { 4799 meta: {}, 4800 valid: false 4801 }; 4802 } 4803 4804 var s = parseInt(e.substr(0, 8), 10) + parseInt(e.substr(8, 2), 10); 4805 return { 4806 meta: {}, 4807 valid: s % 97 === 0 4808 }; 4809 } 4810 4811 function r$1(r) { 4812 var e = r; 4813 4814 if (/^BG[0-9]{9,10}$/.test(e)) { 4815 e = e.substr(2); 4816 } 4817 4818 if (!/^[0-9]{9,10}$/.test(e)) { 4819 return { 4820 meta: {}, 4821 valid: false 4822 }; 4823 } 4824 4825 var s = 0; 4826 var n = 0; 4827 4828 if (e.length === 9) { 4829 for (n = 0; n < 8; n++) { 4830 s += parseInt(e.charAt(n), 10) * (n + 1); 4831 } 4832 4833 s = s % 11; 4834 4835 if (s === 10) { 4836 s = 0; 4837 4838 for (n = 0; n < 8; n++) { 4839 s += parseInt(e.charAt(n), 10) * (n + 3); 4840 } 4841 4842 s = s % 11; 4843 } 4844 4845 s = s % 10; 4846 return { 4847 meta: {}, 4848 valid: "".concat(s) === e.substr(8) 4849 }; 4850 } else { 4851 var _r = function _r(r) { 4852 var e = parseInt(r.substr(0, 2), 10) + 1900; 4853 var s = parseInt(r.substr(2, 2), 10); 4854 var n = parseInt(r.substr(4, 2), 10); 4855 4856 if (s > 40) { 4857 e += 100; 4858 s -= 40; 4859 } else if (s > 20) { 4860 e -= 100; 4861 s -= 20; 4862 } 4863 4864 if (!t$Y(e, s, n)) { 4865 return false;
4866 } 4867 4868 var a = [2, 4, 8, 5, 10, 9, 7, 3, 6]; 4869 var l = 0; 4870 4871 for (var _t = 0; _t < 9; _t++) { 4872 l += parseInt(r.charAt(_t), 10) * a[_t]; 4873 } 4874 4875 l = l % 11 % 10; 4876 return "".concat(l) === r.substr(9, 1); 4877 }; 4878 4879 var _s = function _s(t) { 4880 var r = [21, 19, 17, 13, 11, 9, 7, 3, 1]; 4881 var e = 0; 4882 4883 for (var _s2 = 0; _s2 < 9; _s2++) { 4884 e += parseInt(t.charAt(_s2), 10) * r[_s2]; 4885 } 4886 4887 e = e % 10; 4888 return "".concat(e) === t.substr(9, 1); 4889 }; 4890 4891 var _n = function _n(t) { 4892 var r = [4, 3, 2, 7, 6, 5, 4, 3, 2]; 4893 var e = 0; 4894 4895 for (var _s3 = 0; _s3 < 9; _s3++) { 4896 e += parseInt(t.charAt(_s3), 10) * r[_s3]; 4897 } 4898 4899 e = 11 - e % 11; 4900 4901 if (e === 10) { 4902 return false; 4903 } 4904 4905 if (e === 11) { 4906 e = 0; 4907 } 4908 4909 return "".concat(e) === t.substr(9, 1); 4910 }; 4911 4912 return { 4913 meta: {}, 4914 valid: _r(e) || _s(e) || _n(e) 4915 }; 4916 } 4917 } 4918 4919 function t$v(t) { 4920 if (t === "") { 4921 return { 4922 meta: {}, 4923 valid: true 4924 }; 4925 } 4926 4927 var e = t.replace(/[^\d]+/g, ""); 4928 4929 if (e === "" || e.length !== 14) { 4930 return { 4931 meta: {}, 4932 valid: false 4933 }; 4934 } 4935 4936 if (e === "00000000000000" || e === "11111111111111" || e === "22222222222222" || e === "33333333333333" || e === "44444444444444" || e === "55555555555555" || e === "66666666666666" || e === "77777777777777" || e === "88888888888888" || e === "99999999999999") { 4937 return { 4938 meta: {}, 4939 valid: false 4940 }; 4941 } 4942 4943 var r = e.length - 2; 4944 var a = e.substring(0, r); 4945 var l = e.substring(r); 4946 var n = 0; 4947 var i = r - 7; 4948 var s; 4949 4950 for (s = r; s >= 1; s--) { 4951 n += parseInt(a.charAt(r - s), 10) * i--; 4952 4953 if (i < 2) { 4954 i = 9; 4955 } 4956 } 4957 4958 var f = n % 11 < 2 ? 0 : 11 - n % 11; 4959 4960 if (f !== parseInt(l.charAt(0), 10)) { 4961 return { 4962 meta: {}, 4963 valid: false 4964 }; 4965 } 4966 4967 r = r + 1; 4968 a = e.substring(0, r); 4969 n = 0; 4970 i = r - 7; 4971 4972 for (s = r; s >= 1; s--) { 4973 n += parseInt(a.charAt(r - s), 10) * i--; 4974 4975 if (i < 2) { 4976 i = 9; 4977 } 4978 } 4979 4980 f = n % 11 < 2 ? 0 : 11 - n % 11; 4981 return { 4982 meta: {}, 4983 valid: f === parseInt(l.charAt(1), 10) 4984 }; 4985 } 4986 4987 function t$u(t) { 4988 var e = t; 4989 4990 if (/^CHE[0-9]{9}(MWST|TVA|IVA|TPV)?$/.test(e)) { 4991 e = e.substr(2); 4992 } 4993 4994 if (!/^E[0-9]{9}(MWST|TVA|IVA|TPV)?$/.test(e)) { 4995 return { 4996 meta: {}, 4997 valid: false 4998 }; 4999 } 5000 5001 e = e.substr(1); 5002 var r = [5, 4, 3, 2, 7, 6, 5, 4]; 5003 var s = 0; 5004 5005 for (var _t = 0; _t < 8; _t++) { 5006 s += parseInt(e.charAt(_t), 10) * r[_t]; 5007 } 5008 5009 s = 11 - s % 11; 5010 5011 if (s === 10) { 5012 return { 5013 meta: {}, 5014 valid: false 5015 }; 5016 } 5017 5018 if (s === 11) { 5019 s = 0; 5020 } 5021 5022 return { 5023 meta: {}, 5024 valid: "".concat(s) === e.substr(8, 1) 5025 }; 5026 } 5027 5028 function t$t(t) { 5029 var e = t; 5030 5031 if (/^CY[0-5|9][0-9]{7}[A-Z]$/.test(e)) { 5032 e = e.substr(2); 5033 } 5034 5035 if (!/^[0-5|9][0-9]{7}[A-Z]$/.test(e)) { 5036 return { 5037 meta: {}, 5038 valid: false 5039 }; 5040 } 5041 5042 if (e.substr(0, 2) === "12") { 5043 return { 5044 meta: {}, 5045 valid: false 5046 }; 5047 } 5048 5049 var r = 0; 5050 var s = { 5051 0: 1, 5052 1: 0, 5053 2: 5, 5054 3: 7, 5055 4: 9, 5056 5: 13, 5057 6: 15, 5058 7: 17, 5059 8: 19, 5060 9: 21 5061 }; 5062 5063 for (var _t = 0; _t < 8; _t++) { 5064 var a = parseInt(e.charAt(_t), 10); 5065 5066 if (_t % 2 === 0) { 5067 a = s["".concat(a)]; 5068 } 5069 5070 r += a; 5071 } 5072 5073 return { 5074 meta: {}, 5075 valid: "".concat("ABCDEFGHIJKLMNOPQRSTUVWXYZ"[r % 26]) === e.substr(8, 1) 5076 }; 5077 } 5078 5079 function e$c(e) { 5080 var r = e; 5081 5082 if (/^CZ[0-9]{8,10}$/.test(r)) { 5083 r = r.substr(2); 5084 } 5085 5086 if (!/^[0-9]{8,10}$/.test(r)) { 5087 return { 5088 meta: {}, 5089 valid: false 5090 }; 5091 } 5092 5093 var a = 0; 5094 var s = 0; 5095 5096 if (r.length === 8) { 5097 if ("".concat(r.charAt(0)) === "9") { 5098 return { 5099 meta: {}, 5100 valid: false 5101 }; 5102 } 5103 5104 a = 0; 5105 5106 for (s = 0; s < 7; s++) { 5107 a += parseInt(r.charAt(s), 10) * (8 - s); 5108 } 5109 5110 a = 11 - a % 11; 5111 5112 if (a === 10) { 5113 a = 0; 5114 } 5115 5116 if (a === 11) { 5117 a = 1; 5118 } 5119 5120 return { 5121 meta: {}, 5122 valid: "".concat(a) === r.substr(7, 1) 5123 }; 5124 } else if (r.length === 9 && "".concat(r.charAt(0)) === "6") { 5125 a = 0; 5126 5127 for (s = 0; s < 7; s++) { 5128 a += parseInt(r.charAt(s + 1), 10) * (8 - s); 5129 } 5130 5131 a = 11 - a % 11; 5132 5133 if (a === 10) { 5134 a = 0; 5135 } 5136 5137 if (a === 11) { 5138 a = 1; 5139 } 5140 5141 a = [8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 10][a - 1]; 5142 return { 5143 meta: {}, 5144 valid: "".concat(a) === r.substr(8, 1) 5145 }; 5146 } else if (r.length === 9 || r.length === 10) { 5147 var _e = 1900 + parseInt(r.substr(0, 2), 10); 5148 5149 var _a = parseInt(r.substr(2, 2), 10) % 50 % 20; 5150 5151 var _s = parseInt(r.substr(4, 2), 10); 5152 5153 if (r.length === 9) { 5154 if (_e >= 1980) { 5155 _e -= 100; 5156 } 5157 5158 if (_e > 1953) { 5159 return { 5160 meta: {}, 5161 valid: false 5162 }; 5163 } 5164 } else if (_e < 1954) { 5165 _e += 100; 5166 } 5167 5168 if (!t$Y(_e, _a, _s)) { 5169 return { 5170 meta: {}, 5171 valid: false 5172 }; 5173 } 5174 5175 if (r.length === 10) { 5176 var _t = parseInt(r.substr(0, 9), 10) % 11; 5177 5178 if (_e < 1985) { 5179 _t = _t % 10; 5180 } 5181 5182 return { 5183 meta: {}, 5184 valid: "".concat(_t) === r.substr(9, 1) 5185 }; 5186 } 5187 5188 return { 5189 meta: {}, 5190 valid: true 5191 }; 5192 } 5193 5194 return { 5195 meta: {}, 5196 valid: false 5197 }; 5198 } 5199 5200 function e$b(e) { 5201 var r = e; 5202 5203 if (/^DE[0-9]{9}$/.test(r)) { 5204 r = r.substr(2); 5205 } 5206 5207 if (!/^[0-9]{9}$/.test(r)) { 5208 return { 5209 meta: {}, 5210 valid: false 5211 }; 5212 } 5213 5214 return { 5215 meta: {}, 5216 valid: t$14(r) 5217 }; 5218 } 5219 5220 function t$s(t) { 5221 var e = t; 5222 5223 if (/^DK[0-9]{8}$/.test(e)) { 5224 e = e.substr(2); 5225 } 5226 5227 if (!/^[0-9]{8}$/.test(e)) { 5228 return { 5229 meta: {}, 5230 valid: false 5231 }; 5232 } 5233 5234 var r = 0; 5235 var a = [2, 7, 6, 5, 4, 3, 2, 1]; 5236 5237 for (var _t = 0; _t < 8; _t++) { 5238 r += parseInt(e.charAt(_t), 10) * a[_t]; 5239 } 5240 5241 return { 5242 meta: {}, 5243 valid: r % 11 === 0 5244 }; 5245 } 5246 5247 function t$r(t) { 5248 var e = t; 5249 5250 if (/^EE[0-9]{9}$/.test(e)) { 5251 e = e.substr(2); 5252 } 5253 5254 if (!/^[0-9]{9}$/.test(e)) { 5255 return { 5256 meta: {}, 5257 valid: false 5258 }; 5259 } 5260 5261 var r = 0; 5262 var a = [3, 7, 1, 3, 7, 1, 3, 7, 1]; 5263 5264 for (var _t = 0; _t < 9; _t++) { 5265 r += parseInt(e.charAt(_t), 10) * a[_t]; 5266 } 5267 5268 return { 5269 meta: {}, 5270 valid: r % 10 === 0 5271 }; 5272 } 5273 5274 function t$q(t) { 5275 var e = t; 5276 5277 if (/^ES[0-9A-Z][0-9]{7}
5277[0-9A-Z]$/.test(e)) { 5278 e = e.substr(2); 5279 } 5280 5281 if (!/^[0-9A-Z][0-9]{7}[0-9A-Z]$/.test(e)) { 5282 return { 5283 meta: {}, 5284 valid: false 5285 }; 5286 } 5287 5288 var s = function s(t) { 5289 var e = parseInt(t.substr(0, 8), 10); 5290 return "".concat("TRWAGMYFPDXBNJZSQVHLCKE"[e % 23]) === t.substr(8, 1); 5291 }; 5292 5293 var r = function r(t) { 5294 var e = ["XYZ".indexOf(t.charAt(0)), t.substr(1)].join(""); 5295 var s = "TRWAGMYFPDXBNJZSQVHLCKE"[parseInt(e, 10) % 23]; 5296 return "".concat(s) === t.substr(8, 1); 5297 }; 5298 5299 var n = function n(t) { 5300 var e = t.charAt(0); 5301 var s; 5302 5303 if ("KLM".indexOf(e) !== -1) { 5304 s = parseInt(t.substr(1, 8), 10); 5305 s = "TRWAGMYFPDXBNJZSQVHLCKE"[s % 23]; 5306 return "".concat(s) === t.substr(8, 1); 5307 } else if ("ABCDEFGHJNPQRSUVW".indexOf(e) !== -1) { 5308 var _e = [2, 1, 2, 1, 2, 1, 2]; 5309 var _s = 0; 5310 var _r = 0; 5311 5312 for (var _n = 0; _n < 7; _n++) { 5313 _r = parseInt(t.charAt(_n + 1), 10) * _e[_n]; 5314 5315 if (_r > 9) { 5316 _r = Math.floor(_r / 10) + _r % 10; 5317 } 5318 5319 _s += _r; 5320 } 5321 5322 _s = 10 - _s % 10; 5323 5324 if (_s === 10) { 5325 _s = 0; 5326 } 5327 5328 return "".concat(_s) === t.substr(8, 1) || "JABCDEFGHI"[_s] === t.substr(8, 1); 5329 } 5330 5331 return false; 5332 }; 5333 5334 var a = e.charAt(0); 5335 5336 if (/^[0-9]$/.test(a)) { 5337 return { 5338 meta: { 5339 type: "DNI" 5340 }, 5341 valid: s(e) 5342 }; 5343 } else if (/^[XYZ]$/.test(a)) { 5344 return { 5345 meta: { 5346 type: "NIE" 5347 }, 5348 valid: r(e) 5349 }; 5350 } else { 5351 return { 5352 meta: { 5353 type: "CIF" 5354 }, 5355 valid: n(e) 5356 }; 5357 } 5358 } 5359 5360 function t$p(t) { 5361 var e = t; 5362 5363 if (/^FI[0-9]{8}$/.test(e)) { 5364 e = e.substr(2); 5365 } 5366 5367 if (!/^[0-9]{8}$/.test(e)) { 5368 return { 5369 meta: {}, 5370 valid: false 5371 }; 5372 } 5373 5374 var r = [7, 9, 10, 5, 8, 4, 2, 1]; 5375 var a = 0; 5376 5377 for (var _t = 0; _t < 8; _t++) { 5378 a += parseInt(e.charAt(_t), 10) * r[_t]; 5379 } 5380 5381 return { 5382 meta: {}, 5383 valid: a % 11 === 0 5384 }; 5385 } 5386 5387 function e$a(e) { 5388 var r = e; 5389 5390 if (/^FR[0-9A-Z]{2}[0-9]{9}$/.test(r)) { 5391 r = r.substr(2); 5392 } 5393 5394 if (!/^[0-9A-Z]{2}[0-9]{9}$/.test(r)) { 5395 return { 5396 meta: {}, 5397 valid: false 5398 }; 5399 } 5400 5401 if (r.substr(2, 4) !== "000") { 5402 return { 5403 meta: {}, 5404 valid: t$15(r.substr(2)) 5405 }; 5406 } 5407 5408 if (/^[0-9]{2}$/.test(r.substr(0, 2))) { 5409 return { 5410 meta: {}, 5411 valid: r.substr(0, 2) === "".concat(parseInt(r.substr(2) + "12", 10) % 97) 5412 }; 5413 } else { 5414 var _t = "0123456789ABCDEFGHJKLMNPQRSTUVWXYZ"; 5415 5416 var _e; 5417 5418 if (/^[0-9]$/.test(r.charAt(0))) { 5419 _e = _t.indexOf(r.charAt(0)) * 24 + _t.indexOf(r.charAt(1)) - 10; 5420 } else { 5421 _e = _t.indexOf(r.charAt(0)) * 34 + _t.indexOf(r.charAt(1)) - 100; 5422 } 5423 5424 return { 5425 meta: {}, 5426 valid: (parseInt(r.substr(2), 10) + 1 + Math.floor(_e / 11)) % 11 === _e % 11 5427 }; 5428 } 5429 } 5430 5431 function t$o(t) { 5432 var s = t; 5433 5434 if (/^GB[0-9]{9}$/.test(s) || /^GB[0-9]{12}$/.test(s) || /^GBGD[0-9]{3}$/.test(s) || /^GBHA[0-9]{3}$/.test(s) || /^GB(GD|HA)8888[0-9]{5}$/.test(s)) { 5435 s = s.substr(2); 5436 } 5437 5438 if (!/^[0-9]{9}$/.test(s) && !/^[0-9]{12}$/.test(s) && !/^GD[0-9]{3}$/.test(s) && !/^HA[0-9]{3}$/.test(s) && !/^(GD|HA)8888[0-9]{5}$/.test(s)) { 5439 return { 5440 meta: {}, 5441 valid: false 5442 }; 5443 } 5444 5445 var e = s.length; 5446 5447 if (e === 5) { 5448 var _t = s.substr(0, 2); 5449 5450 var _e = parseInt(s.substr(2), 10); 5451 5452 return { 5453 meta: {}, 5454 valid: "GD" === _t && _e < 500 || "HA" === _t && _e >= 500 5455 }; 5456 } else if (e === 11 && ("GD8888" === s.substr(0, 6) || "HA8888" === s.substr(0, 6))) { 5457 if ("GD" === s.substr(0, 2) && parseInt(s.substr(6, 3), 10) >= 500 || "HA" === s.substr(0, 2) && parseInt(s.substr(6, 3), 10) < 500) { 5458 return { 5459 meta: {}, 5460 valid: false 5461 }; 5462 } 5463 5464 return { 5465 meta: {}, 5466 valid: parseInt(s.substr(6, 3), 10) % 97 === parseInt(s.substr(9, 2), 10) 5467 }; 5468 } else if (e === 9 || e === 12) { 5469 var _t2 = [8, 7, 6, 5, 4, 3, 2, 10, 1]; 5470 var _e2 = 0; 5471 5472 for (var _r = 0; _r < 9; _r++) { 5473 _e2 += parseInt(s.charAt(_r), 10) * _t2[_r]; 5474 } 5475 5476 _e2 = _e2 % 97; 5477 var r = parseInt(s.substr(0, 3), 10) >= 100 ? _e2 === 0 || _e2 === 42 || _e2 === 55 : _e2 === 0; 5478 return { 5479 meta: {}, 5480 valid: r 5481 }; 5482 } 5483 5484 return { 5485 meta: {}, 5486 valid: true 5487 }; 5488 } 5489 5490 function t$n(t) { 5491 var e = t; 5492 5493 if (/^(GR|EL)[0-9]{9}$/.test(e)) { 5494 e = e.substr(2); 5495 } 5496 5497 if (!/^[0-9]{9}$/.test(e)) { 5498 return { 5499 meta: {}, 5500 valid: false 5501 }; 5502 } 5503 5504 if (e.length === 8) { 5505 e = "0".concat(e); 5506 } 5507 5508 var r = [256, 128, 64, 32, 16, 8, 4, 2]; 5509 var s = 0; 5510 5511 for (var _t = 0; _t < 8; _t++) { 5512 s += parseInt(e.charAt(_t), 10) * r[_t]; 5513 } 5514 5515 s = s % 11 % 10; 5516 return { 5517 meta: {}, 5518 valid: "".concat(s) === e.substr(8, 1) 5519 }; 5520 } 5521 5522 function e$9(e) { 5523 var r = e; 5524 5525 if (/^HR[0-9]{11}$/.test(r)) { 5526 r = r.substr(2); 5527 } 5528 5529 if (!/^[0-9]{11}$/.test(r)) { 5530 return { 5531 meta: {}, 5532 valid: false 5533 }; 5534 } 5535 5536 return { 5537 meta: {}, 5538 valid: t$14(r) 5539 }; 5540 } 5541 5542 function t$m(t) { 5543 var e = t; 5544 5545 if (/^HU[0-9]{8}$/.test(e)) { 5546 e = e.substr(2); 5547 } 5548 5549 if (!/^[0-9]{8}$/.test(e)) { 5550 return { 5551 meta: {}, 5552 valid: false 5553 }; 5554 } 5555 5556 var r = [9, 7, 3, 1, 9, 7, 3, 1]; 5557 var a = 0; 5558 5559 for (var _t = 0; _t < 8; _t++) { 5560 a += parseInt(e.charAt(_t), 10) * r[_t]; 5561 } 5562 5563 return { 5564 meta: {}, 5565 valid: a % 10 === 0 5566 }; 5567 } 5568 5569 function t$l(t) { 5570 var e = t; 5571 5572 if (/^IE[0-9][0-9A-Z*+][0-9]{5}[A-Z]{1,2}$/.test(e)) { 5573 e = e.substr(2); 5574 } 5575 5576 if (!/^[0-9][0-9A-Z*+][0-9]{5}[A-Z]{1,2}$/.test(e)) { 5577 return { 5578 meta: {}, 5579 valid: false 5580 }; 5581 } 5582 5583 var r = function r(t) { 5584 var e = t; 5585 5586 while (e.length < 7) { 5587 e = "0".concat(e); 5588 } 5589 5590 var r = "WABCDEFGHIJKLMNOPQRSTUV"; 5591 var s = 0; 5592 5593 for (var _t = 0; _t < 7; _t++) { 5594 s += parseInt(e.charAt(_t), 10) * (8 - _t); 5595 } 5596 5597 s += 9 * r.indexOf(e.substr(7)); 5598 return r[s % 23]; 5599 }; 5600 5601 if (/^[0-9]+$/.test(e.substr(0, 7))) { 5602 return { 5603 meta: {}, 5604 valid: e.charAt(7) === r("".concat(e.substr(0, 7)).concat(e.substr(8))) 5605 }; 5606 } else if ("ABCDEFGHIJKLMNOPQRSTUVWXYZ+*".indexOf(e.charAt(1)) !== -1) { 5607 return { 5608 meta: {}, 5609 valid: e.charAt(7) === r("".concat(e.substr(2, 5)).concat(e.substr(0, 1))) 5610 }; 5611 } 5612 5613 return { 5614 meta: {}, 5615 valid: true 5616 }; 5617 } 5618 5619 function t$k(t) { 5620 var e = t; 5621 5622 if (/^IS[0-9]{5,6}$/.test(e)) { 5623 e = e.substr(2); 5624 } 5625 5626 return { 5627 meta: {}, 5628 valid: /^[0-9]{5,6}$/.test(e) 5629 }; 5630 } 5631 5632 function e$8(e) { 5633 var r = e; 5634 5635 if (/^IT[0-9]{11}$/.test(r)) { 5636 r = r.substr(2); 5637 } 5638 5639 if (!/^[0-9]{11}$/.test(r)) { 5640 return { 5641 meta: {}, 5642 valid: false 5643 }; 5644 } 5645 5646 if (parseInt(r.substr(0, 7), 10) === 0) { 5647 return { 5648 meta: {}, 5649 valid: false 5650 }; 5651 } 5652 5653 var a = parseInt(r.substr(7, 3), 10); 5654 5655 if (a < 1 || a > 201 && a !== 999 && a !== 888) { 5656 return { 5657 meta: {}, 5658 valid: false 5659 }; 5660 } 5661 5662 return { 5663 meta: {}, 5664 valid: t$15(r) 5665 }; 5666 } 5667 5668 function t$j(t) { 5669 var e = t; 5670
5671 if (/^LT([0-9]{7}1[0-9]|[0-9]{10}1[0-9])$/.test(e)) { 5672 e = e.substr(2); 5673 } 5674 5675 if (!/^([0-9]{7}1[0-9]|[0-9]{10}1[0-9])$/.test(e)) { 5676 return { 5677 meta: {}, 5678 valid: false 5679 }; 5680 } 5681 5682 var r = e.length; 5683 var a = 0; 5684 var l; 5685 5686 for (l = 0; l < r - 1; l++) { 5687 a += parseInt(e.charAt(l), 10) * (1 + l % 9); 5688 } 5689 5690 var f = a % 11; 5691 5692 if (f === 10) { 5693 a = 0; 5694 5695 for (l = 0; l < r - 1; l++) { 5696 a += parseInt(e.charAt(l), 10) * (1 + (l + 2) % 9); 5697 } 5698 } 5699 5700 f = f % 11 % 10; 5701 return { 5702 meta: {}, 5703 valid: "".concat(f) === e.charAt(r - 1) 5704 }; 5705 } 5706 5707 function t$i(t) { 5708 var e = t; 5709 5710 if (/^LU[0-9]{8}$/.test(e)) { 5711 e = e.substr(2); 5712 } 5713 5714 if (!/^[0-9]{8}$/.test(e)) { 5715 return { 5716 meta: {}, 5717 valid: false 5718 }; 5719 } 5720 5721 return { 5722 meta: {}, 5723 valid: "".concat(parseInt(e.substr(0, 6), 10) % 89) === e.substr(6, 2) 5724 }; 5725 } 5726 5727 function e$7(e) { 5728 var r = e; 5729 5730 if (/^LV[0-9]{11}$/.test(r)) { 5731 r = r.substr(2); 5732 } 5733 5734 if (!/^[0-9]{11}$/.test(r)) { 5735 return { 5736 meta: {}, 5737 valid: false 5738 }; 5739 } 5740 5741 var s = parseInt(r.charAt(0), 10); 5742 var a = r.length; 5743 var n = 0; 5744 var l = []; 5745 var i; 5746 5747 if (s > 3) { 5748 n = 0; 5749 l = [9, 1, 4, 8, 3, 10, 2, 5, 7, 6, 1]; 5750 5751 for (i = 0; i < a; i++) { 5752 n += parseInt(r.charAt(i), 10) * l[i]; 5753 } 5754 5755 n = n % 11; 5756 return { 5757 meta: {}, 5758 valid: n === 3 5759 }; 5760 } else { 5761 var _e = parseInt(r.substr(0, 2), 10); 5762 5763 var _s = parseInt(r.substr(2, 2), 10); 5764 5765 var f = parseInt(r.substr(4, 2), 10); 5766 f = f + 1800 + parseInt(r.charAt(6), 10) * 100; 5767 5768 if (!t$Y(f, _s, _e)) { 5769 return { 5770 meta: {}, 5771 valid: false 5772 }; 5773 } 5774 5775 n = 0; 5776 l = [10, 5, 8, 4, 2, 1, 6, 3, 7, 9]; 5777 5778 for (i = 0; i < a - 1; i++) { 5779 n += parseInt(r.charAt(i), 10) * l[i]; 5780 } 5781 5782 n = (n + 1) % 11 % 10; 5783 return { 5784 meta: {}, 5785 valid: "".concat(n) === r.charAt(a - 1) 5786 }; 5787 } 5788 } 5789 5790 function t$h(t) { 5791 var e = t; 5792 5793 if (/^MT[0-9]{8}$/.test(e)) { 5794 e = e.substr(2); 5795 } 5796 5797 if (!/^[0-9]{8}$/.test(e)) { 5798 return { 5799 meta: {}, 5800 valid: false 5801 }; 5802 } 5803 5804 var r = [3, 4, 6, 7, 8, 9, 10, 1]; 5805 var a = 0; 5806 5807 for (var _t = 0; _t < 8; _t++) { 5808 a += parseInt(e.charAt(_t), 10) * r[_t]; 5809 } 5810 5811 return { 5812 meta: {}, 5813 valid: a % 37 === 0 5814 }; 5815 } 5816 5817 function t$g(t) { 5818 return t.split("").map(function (t) { 5819 var n = t.charCodeAt(0); 5820 return n >= 65 && n <= 90 ? n - 55 : t; 5821 }).join("").split("").map(function (t) { 5822 return parseInt(t, 10); 5823 }); 5824 } 5825 5826 function n(n) { 5827 var e = t$g(n); 5828 var r = 0; 5829 var o = e.length; 5830 5831 for (var _t = 0; _t < o - 1; ++_t) { 5832 r = (r + e[_t]) * 10 % 97; 5833 } 5834 5835 r += e[o - 1]; 5836 return r % 97 === 1; 5837 } 5838 5839 function e$6(e) { 5840 var i = e; 5841 5842 if (/^NL[0-9]{9}B[0-9]{2}$/.test(i)) { 5843 i = i.substr(2); 5844 } 5845 5846 if (!/^[0-9]{9}B[0-9]{2}$/.test(i)) { 5847 return { 5848 meta: {}, 5849 valid: false 5850 }; 5851 } 5852 5853 var o = i.substr(0, 9); 5854 return { 5855 meta: {}, 5856 valid: e$o(o).valid || n("NL".concat(i)) 5857 }; 5858 } 5859 5860 function t$f(t) { 5861 var e = t; 5862 5863 if (/^NO[0-9]{9}$/.test(e)) { 5864 e = e.substr(2); 5865 } 5866 5867 if (!/^[0-9]{9}$/.test(e)) { 5868 return { 5869 meta: {}, 5870 valid: false 5871 }; 5872 } 5873 5874 var r = [3, 2, 7, 6, 5, 4, 3, 2]; 5875 var s = 0; 5876 5877 for (var _t = 0; _t < 8; _t++) { 5878 s += parseInt(e.charAt(_t), 10) * r[_t]; 5879 } 5880 5881 s = 11 - s % 11; 5882 5883 if (s === 11) { 5884 s = 0; 5885 } 5886 5887 return { 5888 meta: {}, 5889 valid: "".concat(s) === e.substr(8, 1) 5890 }; 5891 } 5892 5893 function t$e(t) { 5894 var e = t; 5895 5896 if (/^PL[0-9]{10}$/.test(e)) { 5897 e = e.substr(2); 5898 } 5899 5900 if (!/^[0-9]{10}$/.test(e)) { 5901 return { 5902 meta: {}, 5903 valid: false 5904 }; 5905 } 5906 5907 var r = [6, 5, 7, 2, 3, 4, 5, 6, 7, -1]; 5908 var a = 0; 5909 5910 for (var _t = 0; _t < 10; _t++) { 5911 a += parseInt(e.charAt(_t), 10) * r[_t]; 5912 } 5913 5914 return { 5915 meta: {}, 5916 valid: a % 11 === 0 5917 }; 5918 } 5919 5920 function t$d(t) { 5921 var e = t; 5922 5923 if (/^PT[0-9]{9}$/.test(e)) { 5924 e = e.substr(2); 5925 } 5926 5927 if (!/^[0-9]{9}$/.test(e)) { 5928 return { 5929 meta: {}, 5930 valid: false 5931 }; 5932 } 5933 5934 var r = [9, 8, 7, 6, 5, 4, 3, 2]; 5935 var s = 0; 5936 5937 for (var _t = 0; _t < 8; _t++) { 5938 s += parseInt(e.charAt(_t), 10) * r[_t]; 5939 } 5940 5941 s = 11 - s % 11; 5942 5943 if (s > 9) { 5944 s = 0; 5945 } 5946 5947 return { 5948 meta: {}, 5949 valid: "".concat(s) === e.substr(8, 1) 5950 }; 5951 } 5952 5953 function t$c(t) { 5954 var e = t; 5955 5956 if (/^RO[1-9][0-9]{1,9}$/.test(e)) { 5957 e = e.substr(2); 5958 } 5959 5960 if (!/^[1-9][0-9]{1,9}$/.test(e)) { 5961 return { 5962 meta: {}, 5963 valid: false 5964 }; 5965 } 5966 5967 var s = e.length; 5968 var r = [7, 5, 3, 2, 1, 7, 5, 3, 2].slice(10 - s); 5969 var l = 0; 5970 5971 for (var _t = 0; _t < s - 1; _t++) { 5972 l += parseInt(e.charAt(_t), 10) * r[_t]; 5973 } 5974 5975 l = 10 * l % 11 % 10; 5976 return { 5977 meta: {}, 5978 valid: "".concat(l) === e.substr(s - 1, 1) 5979 }; 5980 } 5981 5982 function t$b(t) { 5983 var e = t; 5984 5985 if (/^RS[0-9]{9}$/.test(e)) { 5986 e = e.substr(2); 5987 } 5988 5989 if (!/^[0-9]{9}$/.test(e)) { 5990 return { 5991 meta: {}, 5992 valid: false 5993 }; 5994 } 5995 5996 var r = 10; 5997 var a = 0; 5998 5999 for (var _t = 0; _t < 8; _t++) { 6000 a = (parseInt(e.charAt(_t), 10) + r) % 10; 6001 6002 if (a === 0) { 6003 a = 10; 6004 } 6005 6006 r = 2 * a % 11; 6007 } 6008 6009 return { 6010 meta: {}, 6011 valid: (r + parseInt(e.substr(8, 1), 10)) % 10 === 1 6012 }; 6013 } 6014 6015 function t$a(t) { 6016 var e = t; 6017 6018 if (/^RU([0-9]{10}|[0-9]{12})$/.test(e)) { 6019 e = e.substr(2); 6020 } 6021 6022 if (!/^([0-9]{10}|[0-9]{12})$/.test(e)) { 6023 return { 6024 meta: {}, 6025 valid: false 6026 }; 6027 } 6028 6029 var r = 0; 6030 6031 if (e.length === 10) {
6032 var _t = [2, 4, 10, 3, 5, 9, 4, 6, 8, 0]; 6033 var s = 0; 6034 6035 for (r = 0; r < 10; r++) { 6036 s += parseInt(e.charAt(r), 10) * _t[r]; 6037 } 6038 6039 s = s % 11; 6040 6041 if (s > 9) { 6042 s = s % 10; 6043 } 6044 6045 return { 6046 meta: {}, 6047 valid: "".concat(s) === e.substr(9, 1) 6048 }; 6049 } else if (e.length === 12) { 6050 var _t2 = [7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0]; 6051 var _s = [3, 7, 2, 4, 10, 3, 5, 9, 4, 6, 8, 0]; 6052 var a = 0; 6053 var l = 0; 6054 6055 for (r = 0; r < 11; r++) { 6056 a += parseInt(e.charAt(r), 10) * _t2[r]; 6057 l += parseInt(e.charAt(r), 10) * _s[r]; 6058 } 6059 6060 a = a % 11; 6061 6062 if (a > 9) { 6063 a = a % 10; 6064 } 6065 6066 l = l % 11; 6067 6068 if (l > 9) { 6069 l = l % 10; 6070 } 6071 6072 return { 6073 meta: {}, 6074 valid: "".concat(a) === e.substr(10, 1) && "".concat(l) === e.substr(11, 1) 6075 }; 6076 } 6077 6078 return { 6079 meta: {}, 6080 valid: true 6081 }; 6082 } 6083 6084 function e$5(e) { 6085 var r = e; 6086 6087 if (/^SE[0-9]{10}01$/.test(r)) { 6088 r = r.substr(2); 6089 } 6090 6091 if (!/^[0-9]{10}01$/.test(r)) { 6092 return { 6093 meta: {}, 6094 valid: false 6095 }; 6096 } 6097 6098 r = r.substr(0, 10); 6099 return { 6100 meta: {}, 6101 valid: t$15(r) 6102 }; 6103 } 6104 6105 function t$9(t) { 6106 var e = t.match(/^(SI)?([1-9][0-9]{7})$/); 6107 6108 if (!e) { 6109 return { 6110 meta: {}, 6111 valid: false 6112 }; 6113 } 6114 6115 var r = e[1] ? t.substr(2) : t; 6116 var a = [8, 7, 6, 5, 4, 3, 2]; 6117 var s = 0; 6118 6119 for (var _t = 0; _t < 7; _t++) { 6120 s += parseInt(r.charAt(_t), 10) * a[_t]; 6121 } 6122 6123 s = 11 - s % 11; 6124 6125 if (s === 10) { 6126 s = 0; 6127 } 6128 6129 return { 6130 meta: {}, 6131 valid: "".concat(s) === r.substr(7, 1) 6132 }; 6133 } 6134 6135 function t$8(t) { 6136 var e = t; 6137 6138 if (/^SK[1-9][0-9][(2-4)|(6-9)][0-9]{7}$/.test(e)) { 6139 e = e.substr(2); 6140 } 6141 6142 if (!/^[1-9][0-9][(2-4)|(6-9)][0-9]{7}$/.test(e)) { 6143 return { 6144 meta: {}, 6145 valid: false 6146 }; 6147 } 6148 6149 return { 6150 meta: {}, 6151 valid: parseInt(e, 10) % 11 === 0 6152 }; 6153 } 6154 6155 function t$7(t) { 6156 var e = t; 6157 6158 if (/^VE[VEJPG][0-9]{9}$/.test(e)) { 6159 e = e.substr(2); 6160 } 6161 6162 if (!/^[VEJPG][0-9]{9}$/.test(e)) { 6163 return { 6164 meta: {}, 6165 valid: false 6166 }; 6167 } 6168 6169 var r = { 6170 E: 8, 6171 G: 20, 6172 J: 12, 6173 P: 16, 6174 V: 4 6175 }; 6176 var s = [3, 2, 7, 6, 5, 4, 3, 2]; 6177 var a = r[e.charAt(0)]; 6178 6179 for (var _t = 0; _t < 8; _t++) { 6180 a += parseInt(e.charAt(_t + 1), 10) * s[_t]; 6181 } 6182 6183 a = 11 - a % 11; 6184 6185 if (a === 11 || a === 10) { 6186 a = 0; 6187 } 6188 6189 return { 6190 meta: {}, 6191 valid: "".concat(a) === e.substr(9, 1) 6192 }; 6193 } 6194 6195 function t$6(t) { 6196 var e = t; 6197 6198 if (/^ZA4[0-9]{9}$/.test(e)) { 6199 e = e.substr(2); 6200 } 6201 6202 return { 6203 meta: {}, 6204 valid: /^4[0-9]{9}$/.test(e) 6205 }; 6206 } 6207 6208 function x() { 6209 var x = ["AR", "AT", "BE", "BG", "BR", "CH", "CY", "CZ", "DE", "DK", "EE", "EL", "ES", "FI", "FR", "GB", "GR", "HR", "HU", "IE", "IS", "IT", "LT", "LU", "LV", "MT", "NL", "NO", "PL", "PT", "RO", "RU", "RS", "SE", "SK", "SI", "VE", "ZA"]; 6210 return { 6211 validate: function validate(D) { 6212 var F = D.value; 6213 6214 if (F === "") { 6215 return { 6216 valid: true 6217 }; 6218 } 6219 6220 var K = Object.assign({}, { 6221 message: "" 6222 }, D.options); 6223 var N = F.substr(0, 2); 6224 6225 if ("function" === typeof K.country) { 6226 N = K.country.call(this); 6227 } else { 6228 N = K.country; 6229 } 6230 6231 if (x.indexOf(N) === -1) { 6232 return { 6233 valid: true 6234 }; 6235 } 6236 6237 var P = { 6238 meta: {}, 6239 valid: true 6240 }; 6241 6242 switch (N.toLowerCase()) { 6243 case "ar": 6244 P = t$y(F); 6245 break; 6246 6247 case "at": 6248 P = t$x(F); 6249 break; 6250 6251 case "be": 6252 P = t$w(F); 6253 break; 6254 6255 case "bg": 6256 P = r$1(F); 6257 break; 6258 6259 case "br": 6260 P = t$v(F); 6261 break; 6262 6263 case "ch": 6264 P = t$u(F); 6265 break; 6266 6267 case "cy": 6268 P = t$t(F); 6269 break; 6270 6271 case "cz": 6272 P = e$c(F); 6273 break; 6274 6275 case "de": 6276 P = e$b(F); 6277 break; 6278 6279 case "dk": 6280 P = t$s(F); 6281 break; 6282 6283 case "ee": 6284 P = t$r(F); 6285 break; 6286 6287 case "el": 6288 P = t$n(F); 6289 break; 6290 6291 case "es": 6292 P = t$q(F); 6293 break; 6294 6295 case "fi":
6296 P = t$p(F); 6297 break; 6298 6299 case "fr": 6300 P = e$a(F); 6301 break; 6302 6303 case "gb": 6304 P = t$o(F); 6305 break; 6306 6307 case "gr": 6308 P = t$n(F); 6309 break; 6310 6311 case "hr": 6312 P = e$9(F); 6313 break; 6314 6315 case "hu": 6316 P = t$m(F); 6317 break; 6318 6319 case "ie": 6320 P = t$l(F); 6321 break; 6322 6323 case "is": 6324 P = t$k(F); 6325 break; 6326 6327 case "it": 6328 P = e$8(F); 6329 break; 6330 6331 case "lt": 6332 P = t$j(F); 6333 break; 6334 6335 case "lu": 6336 P = t$i(F); 6337 break; 6338 6339 case "lv": 6340 P = e$7(F); 6341 break; 6342 6343 case "mt": 6344 P = t$h(F); 6345 break; 6346 6347 case "nl": 6348 P = e$6(F); 6349 break; 6350 6351 case "no": 6352 P = t$f(F); 6353 break; 6354 6355 case "pl": 6356 P = t$e(F); 6357 break; 6358 6359 case "pt": 6360 P = t$d(F); 6361 break; 6362 6363 case "ro": 6364 P = t$c(F); 6365 break; 6366 6367 case "rs": 6368 P = t$b(F); 6369 break; 6370 6371 case "ru": 6372 P = t$a(F); 6373 break; 6374 6375 case "se": 6376 P = e$5(F); 6377 break; 6378 6379 case "si": 6380 P = t$9(F); 6381 break; 6382 6383 case "sk": 6384 P = t$8(F); 6385 break; 6386 6387 case "ve":
6388 P = t$7(F); 6389 break; 6390 6391 case "za": 6392 P = t$6(F); 6393 break; 6394 } 6395 6396 var Z = r$d(D.l10n && D.l10n.vat ? K.message || D.l10n.vat.country : K.message, D.l10n && D.l10n.vat && D.l10n.vat.countries ? D.l10n.vat.countries[N.toUpperCase()] : N.toUpperCase()); 6397 return Object.assign({}, { 6398 message: Z 6399 }, P); 6400 } 6401 }; 6402 } 6403 6404 function t$5() { 6405 return { 6406 validate: function validate(t) { 6407 if (t.value === "") { 6408 return { 6409 valid: true 6410 }; 6411 } 6412 6413 if (!/^[a-hj-npr-z0-9]{8}[0-9xX][a-hj-npr-z0-9]{8}$/i.test(t.value)) { 6414 return { 6415 valid: false 6416 }; 6417 } 6418 6419 var e = t.value.toUpperCase(); 6420 var r = { 6421 A: 1, 6422 B: 2, 6423 C: 3, 6424 D: 4, 6425 E: 5, 6426 F: 6, 6427 G: 7, 6428 H: 8, 6429 J: 1, 6430 K: 2, 6431 L: 3, 6432 M: 4, 6433 N: 5, 6434 P: 7, 6435 R: 9, 6436 S: 2, 6437 T: 3, 6438 U: 4, 6439 V: 5, 6440 W: 6, 6441 X: 7, 6442 Y: 8, 6443 Z: 9, 6444 0: 0, 6445 1: 1, 6446 2: 2, 6447 3: 3, 6448 4: 4, 6449 5: 5, 6450 6: 6, 6451 7: 7, 6452 8: 8, 6453 9: 9 6454 }; 6455 var a = [8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2]; 6456 var l = e.length; 6457 var n = 0; 6458 6459 for (var _t = 0; _t < l; _t++) { 6460 n += r["".concat(e.charAt(_t))] * a[_t]; 6461 } 6462 6463 var u = "".concat(n % 11); 6464 6465 if (u === "10") { 6466 u = "X"; 6467 } 6468 6469 return { 6470 valid: u === e.charAt(8) 6471 }; 6472 } 6473 }; 6474 } 6475 6476 function s$4() { 6477 var s = ["AT", "BG", "BR", "CA", "CH", "CZ", "DE", "DK", "ES", "FR", "GB", "IE", "IN", "IT", "MA", "NL", "PL", "PT", "RO", "RU", "SE", "SG", "SK", "US"]; 6478 6479 var a = function a(e) { 6480 var s = "[ABCDEFGHIJKLMNOPRSTUWYZ]"; 6481 var a = "[ABCDEFGHKLMNOPQRSTUVWXY]"; 6482 var t = "[ABCDEFGHJKPMNRSTUVWXY]"; 6483 var r = "[ABEHMNPRVWXY]"; 6484 var u = "[ABDEFGHJLNPQRSTUWXYZ]"; 6485 var c = [new RegExp("^(".concat(s, "{1}").concat(a, "?[0-9]{1,2})(\\s*)([0-9]{1}").concat(u, "{2})$"), "i"), new RegExp("^(".concat(s, "{1}[0-9]{1}").concat(t, "{1})(\\s*)([0-9]{1}").concat(u, "{2})$"), "i"), new RegExp("^(".concat(s, "{1}").concat(a, "{1}?[0-9]{1}").concat(r, "{1})(\\s*)([0-9]{1}").concat(u, "{2})$"), "i"), new RegExp("^(BF1)(\\s*)([0-6]{1}[ABDEFGHJLNPQRST]{1}[ABDEFGHJLNPQRSTUWZYZ]{1})$", "i"), /^(GIR)(\s*)(0AA)$/i, /^(BFPO)(\s*)([0-9]{1,4})$/i, /^(BFPO)(\s*)(c\/o\s*[0-9]{1,3})$/i, /^([A-Z]{4}
6485)(\s*)(1ZZ)$/i, /^(AI-2640)$/i]; 6486 6487 for (var _i = 0, _c = c; _i < _c.length; _i++) { 6488 var _s = _c[_i]; 6489 6490 if (_s.test(e)) { 6491 return true; 6492 } 6493 } 6494 6495 return false; 6496 }; 6497 6498 return { 6499 validate: function validate(t) { 6500 var r = Object.assign({}, { 6501 message: "" 6502 }, t.options); 6503 6504 if (t.value === "" || !r.country) { 6505 return { 6506 valid: true 6507 }; 6508 } 6509 6510 var u = t.value.substr(0, 2); 6511 6512 if ("function" === typeof r.country) { 6513 u = r.country.call(this); 6514 } else { 6515 u = r.country; 6516 } 6517 6518 if (!u || s.indexOf(u.toUpperCase()) === -1) { 6519 return { 6520 valid: true 6521 }; 6522 } 6523 6524 var c = false; 6525 u = u.toUpperCase(); 6526 6527 switch (u) { 6528 case "AT": 6529 c = /^([1-9]{1})(\d{3})$/.test(t.value); 6530 break; 6531 6532 case "BG": 6533 c = /^([1-9]{1}[0-9]{3})$/.test(t.value); 6534 break; 6535 6536 case "BR": 6537 c = /^(\d{2})([.]?)(\d{3})([-]?)(\d{3})$/.test(t.value); 6538 break; 6539 6540 case "CA": 6541 c = /^(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|X|Y){1}[0-9]{1}(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|W|X|Y|Z){1}\s?[0-9]{1}(?:A|B|C|E|G|H|J|K|L|M|N|P|R|S|T|V|W|X|Y|Z){1}[0-9]{1}$/i.test(t.value); 6542 break; 6543 6544 case "CH": 6545 c = /^([1-9]{1})(\d{3})$/.test(t.value); 6546 break; 6547 6548 case "CZ": 6549 c = /^(\d{3})([ ]?)(\d{2})$/.test(t.value); 6550 break; 6551 6552 case "DE": 6553 c = /^(?!01000|99999)(0[1-9]\d{3}|[1-9]\d{4})$/.test(t.value); 6554 break; 6555 6556 case "DK": 6557 c = /^(DK(-|\s)?)?\d{4}$/i.test(t.value); 6558 break; 6559 6560 case "ES": 6561 c = /^(?:0[1-9]|[1-4][0-9]|5[0-2])\d{3}$/.test(t.value); 6562 break; 6563 6564 case "FR": 6565 c = /^[0-9]{5}$/i.test(t.value); 6566 break; 6567 6568 case "GB": 6569 c = a(t.value); 6570 break; 6571 6572 case "IN": 6573 c = /^\d{3}\s?\d{3}$/.test(t.value); 6574 break; 6575 6576 case "IE": 6577 c = /^(D6W|[ACDEFHKNPRTVWXY]\d{2})\s[0-9ACDEFHKNPRTVWXY]{4}$/.test(t.value); 6578 break; 6579 6580 case "IT": 6581 c = /^(I-|IT-)?\d{5}$/i.test(t.value); 6582 break; 6583 6584 case "MA": 6585 c = /^[1-9][0-9]{4}$/i.test(t.value); 6586 break; 6587 6588 case "NL": 6589 c = /^[1-9][0-9]{3} ?(?!sa|sd|ss)[a-z]{2}$/i.test(t.value); 6590 break; 6591 6592 case "PL": 6593 c = /^[0-9]{2}-[0-9]{3}$/.test(t.value); 6594 break; 6595 6596 case "PT": 6597 c = /^[1-9]\d{3}-\d{3}$/.test(t.value); 6598 break; 6599 6600 case "RO": 6601 c = /^(0[1-8]{1}|[1-9]{1}[0-5]{1})?[0-9]{4}$/i.test(t.value); 6602 break; 6603 6604 case "RU": 6605 c = /^[0-9]{6}$/i.test(t.value); 6606 break; 6607 6608 case "SE": 6609 c = /^(S-)?\d{3}\s?\d{2}$/i.test(t.value); 6610 break; 6611 6612 case "SG": 6613 c = /^([0][1-9]|[1-6][0-9]|[7]([0-3]|[5-9])|[8][0-2])(\d{4})$/i.test(t.value); 6614 break; 6615 6616 case "SK": 6617 c = /^(\d{3})([ ]?)(\d{2})$/.test(t.value); 6618 break; 6619 6620 case "US": 6621 default: 6622 c = /^\d{4,5}([-]?\d{4})?$/.test(t.value); 6623 break; 6624 } 6625 6626 return { 6627 message: r$d(t.l10n && t.l10n.zipCode ? r.message || t.l10n.zipCode.country : r.message, t.l10n && t.l10n.zipCode && t.l10n.zipCode.countries ? t.l10n.zipCode.countries[u] : u), 6628 valid: c 6629 }; 6630 } 6631 }; 6632 } 6633 6634 var s$3 = { 6635 between: s$9, 6636 blank: t$10, 6637 callback: o$4, 6638 choice: t$_, 6639 creditCard: l$2, 6640 date: n$1, 6641 different: o$3, 6642 digits: e$G, 6643 emailAddress: t$X, 6644 file: e$F, 6645 greaterThan: a$7, 6646 identical: o$2, 6647 integer: a$6, 6648 ip: d, 6649 lessThan: s$8, 6650 notEmpty: t$W, 6651 numeric: a$5, 6652 promise: r$c, 6653 regexp: e$E, 6654 remote: a$4, 6655 stringCase: e$C, 6656 stringLength: t$U, 6657 uri: t$T, 6658 base64: a$3, 6659 bic: a$2, 6660 color: e$B, 6661 cusip: t$S, 6662 ean: e$A, 6663 ein: e$z, 6664 grid: r$b, 6665 hex: e$y, 6666 iban: Z, 6667 id: F, 6668 imei: t$A, 6669 imo: e$m, 6670 isbn: e$l, 6671 isin: M, 6672 ismn: e$k, 6673 issn: e$j, 6674 mac: a$1, 6675 meid: e$i, 6676 phone: e$h, 6677 rtn: e$g, 6678 sedol: t$z, 6679 siren: e$f, 6680 siret: e$e, 6681 step: e$d, 6682 uuid: s$5, 6683 vat: x, 6684 vin: t$5, 6685 zipCode: s$4 6686 }; 6687 6688 var l$1 = /*#__PURE__*/function () { 6689 function l(i, s) { 6690 _classCallCheck(this, l); 6691 6692 this.elements = {}; 6693 this.ee = s$a(); 6694 this.filter = t$11(); 6695 this.plugins = {}; 6696 this.results = new Map(); 6697 this.validators = {}; 6698 this.form = i; 6699 this.fields = s; 6700 } 6701 6702 _createClass(l, [{ 6703 key: "on", 6704 value: function on(e, t) { 6705 this.ee.on(e, t); 6706 return this; 6707 } 6708 }, {
6709 key: "off", 6710 value: function off(e, t) { 6711 this.ee.off(e, t); 6712 return this; 6713 } 6714 }, { 6715 key: "emit", 6716 value: function emit(e) { 6717 var _this$ee; 6718 6719 for (var _len = arguments.length, t = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 6720 t[_key - 1] = arguments[_key]; 6721 } 6722 6723 (_this$ee = this.ee).emit.apply(_this$ee, [e].concat(t)); 6724 6725 return this; 6726 } 6727 }, { 6728 key: "registerPlugin", 6729 value: function registerPlugin(e, t) { 6730 if (this.plugins[e]) { 6731 throw new Error("The plguin ".concat(e, " is registered")); 6732 } 6733 6734 t.setCore(this); 6735 t.install(); 6736 this.plugins[e] = t; 6737 return this; 6738 } 6739 }, { 6740 key: "deregisterPlugin", 6741 value: function deregisterPlugin(e) { 6742 var t = this.plugins[e]; 6743 6744 if (t) { 6745 t.uninstall(); 6746 } 6747 6748 delete this.plugins[e]; 6749 return this; 6750 } 6751 }, { 6752 key: "registerValidator", 6753 value: function registerValidator(e, t) { 6754 if (this.validators[e]) { 6755 throw new Error("The validator ".concat(e, " is registered")); 6756 } 6757 6758 this.validators[e] = t; 6759 return this; 6760 } 6761 }, { 6762 key: "registerFilter", 6763 value: function registerFilter(e, t) { 6764 this.filter.add(e, t); 6765 return this; 6766 } 6767 }, { 6768 key: "deregisterFilter", 6769 value: function deregisterFilter(e, t) { 6770 this.filter.remove(e, t); 6771 return this; 6772 } 6773 }, { 6774 key: "executeFilter", 6775 value: function executeFilter(e, t, i) { 6776 return this.filter.execute(e, t, i); 6777 } 6778 }, { 6779 key: "addField", 6780 value: function addField(e, t) { 6781 var i = Object.assign({}, { 6782 selector: "", 6783 validators: {} 6784 }, t); 6785 this.fields[e] = this.fields[e] ? { 6786 selector: i.selector || this.fields[e].selector, 6787 validators: Object.assign({}, this.fields[e].validators, i.validators) 6788 } : i; 6789 this.elements[e] = this.queryElements(e); 6790 this.emit("core.field.added", { 6791 elements: this.elements[e], 6792 field: e, 6793 options: this.fields[e] 6794 }); 6795 return this; 6796 } 6797 }, { 6798 key: "removeField", 6799 value: function removeField(e) { 6800 if (!this.fields[e]) { 6801 throw new Error("The field ".concat(e, " validators are not defined. Please ensure the field is added first")); 6802 } 6803 6804 var t = this.elements[e]; 6805 var i = this.fields[e]; 6806 delete this.elements[e]; 6807 delete this.fields[e]; 6808 this.emit("core.field.removed", { 6809 elements: t, 6810 field: e, 6811 options: i 6812 }); 6813 return this; 6814 } 6815 }, { 6816 key: "validate", 6817 value: function validate() { 6818 var _this = this; 6819 6820 this.emit("core.form.validating", { 6821 formValidation: this 6822 }); 6823 return this.filter.execute("validate-pre", Promise.resolve(), []).then(function () { 6824 return Promise.all(Object.keys(_this.fields).map(function (e) { 6825 return _this.validateField(e); 6826 })).then(function (e) { 6827 switch (true) { 6828 case e.indexOf("Invalid") !== -1: 6829 _this.emit("core.form.invalid", { 6830 formValidation: _this 6831 }); 6832 6833 return Promise.resolve("Invalid"); 6834 6835 case e.indexOf("NotValidated") !== -1: 6836 _this.emit("core.form.notvalidated", { 6837 formValidation: _this 6838 }); 6839 6840 return Promise.resolve("NotValidated"); 6841 6842 default: 6843 _this.emit("core.form.valid", { 6844 formValidation: _this 6845 }); 6846 6847 return Promise.resolve("Valid"); 6848 } 6849 }); 6850 }); 6851 } 6852 }, { 6853 key: "validateField", 6854 value: function validateField(e) { 6855 var _this2 = this; 6856 6857 var t = this.results.get(e); 6858 6859 if (t === "Valid" || t === "Invalid") { 6860 return Promise.resolve(t); 6861 } 6862
6863 this.emit("core.field.validating", e); 6864 var i = this.elements[e]; 6865 6866 if (i.length === 0) { 6867 this.emit("core.field.valid", e); 6868 return Promise.resolve("Valid"); 6869 } 6870 6871 var s = i[0].getAttribute("type"); 6872 6873 if ("radio" === s || "checkbox" === s || i.length === 1) { 6874 return this.validateElement(e, i[0]); 6875 } else { 6876 return Promise.all(i.map(function (t) { 6877 return _this2.validateElement(e, t); 6878 })).then(function (t) { 6879 switch (true) { 6880 case t.indexOf("Invalid") !== -1: 6881 _this2.emit("core.field.invalid", e); 6882 6883 _this2.results.set(e, "Invalid"); 6884 6885 return Promise.resolve("Invalid"); 6886 6887 case t.indexOf("NotValidated") !== -1: 6888 _this2.emit("core.field.notvalidated", e); 6889 6890 _this2.results["delete"](e); 6891 6892 return Promise.resolve("NotValidated"); 6893 6894 default: 6895 _this2.emit("core.field.valid", e); 6896 6897 _this2.results.set(e, "Valid"); 6898 6899 return Promise.resolve("Valid"); 6900 } 6901 }); 6902 } 6903 } 6904 }, { 6905 key: "validateElement", 6906 value: function validateElement(e, t) { 6907 var _this3 = this; 6908 6909 this.results["delete"](e); 6910 var i = this.elements[e]; 6911 var s = this.filter.execute("element-ignored", false, [e, t, i]); 6912 6913 if (s) { 6914 this.emit("core.element.ignored", { 6915 element: t, 6916 elements: i, 6917 field: e 6918 }); 6919 return Promise.resolve("Ignored"); 6920 } 6921 6922 var _l = this.fields[e].validators; 6923 this.emit("core.element.validating", { 6924 element: t, 6925 elements: i, 6926 field: e 6927 }); 6928 var r = Object.keys(_l).map(function (i) { 6929 return function () { 6930 return _this3.executeValidator(e, t, i, _l[i]); 6931 }; 6932 }); 6933 return this.waterfall(r).then(function (s) { 6934 var _l2 = s.indexOf("Invalid") === -1; 6935 6936 _this3.emit("core.element.validated", { 6937 element: t, 6938 elements: i, 6939 field: e, 6940 valid: _l2 6941 }); 6942 6943 var r = t.getAttribute("type"); 6944 6945 if ("radio" === r || "checkbox" === r || i.length === 1) { 6946 _this3.emit(_l2 ? "core.field.valid" : "core.field.invalid", e); 6947 } 6948 6949 return Promise.resolve(_l2 ? "Valid" : "Invalid"); 6950 })["catch"](function (s) { 6951 _this3.emit("core.element.notvalidated", { 6952 element: t, 6953 elements: i, 6954 field: e 6955 }); 6956 6957 return Promise.resolve(s); 6958 }); 6959 } 6960 }, { 6961 key: "executeValidator", 6962 value: function executeValidator(e, t, i, s) { 6963 var _this4 = this; 6964 6965 var _l3 = this.elements[e]; 6966 var r = this.filter.execute("validator-name", i, [i, e]); 6967 s.message = this.filter.execute("validator-message", s.message, [this.locale, e, r]); 6968 6969 if (!this.validators[r] || s.enabled === false) { 6970 this.emit("core.validator.validated", { 6971 element: t, 6972 elements: _l3, 6973 field: e, 6974 result: this.normalizeResult(e, r, { 6975 valid: true 6976 }), 6977 validator: r 6978 }); 6979 return Promise.resolve("Valid"); 6980 } 6981 6982 var a = this.validators[r]; 6983 var d = this.getElementValue(e, t, r); 6984 var o = this.filter.execute("field-should-validate", true, [e, t, d, i]); 6985 6986 if (!o) { 6987 this.emit("core.validator.notvalidated", { 6988 element: t, 6989 elements: _l3, 6990 field: e, 6991 validator: i 6992 }); 6993 return Promise.resolve("NotValidated"); 6994 } 6995 6996 this.emit("core.validator.validating", { 6997 element: t, 6998 elements: _l3, 6999 field: e, 7000 validator: i 7001 }); 7002 var n = a().validate({ 7003 element: t, 7004 elements: _l3, 7005 field: e, 7006 l10n: this.localization, 7007 options: s, 7008 value: d 7009 }); 7010 var h = "function" === typeof n["then"]; 7011 7012 if (h) { 7013 return n.then(function (s) { 7014 var r = _this4.normalizeResult(e, i, s); 7015 7016 _this4.emit("core.validator.validated", { 7017 element: t, 7018 elements: _l3, 7019 field: e, 7020 result: r, 7021 validator: i 7022 }); 7023 7024 return r.valid ? "Valid" : "Invalid"; 7025 }); 7026 } else { 7027 var _s = this.normalizeResult(e, i, n); 7028
7029 this.emit("core.validator.validated", { 7030 element: t, 7031 elements: _l3, 7032 field: e, 7033 result: _s, 7034 validator: i 7035 }); 7036 return Promise.resolve(_s.valid ? "Valid" : "Invalid"); 7037 } 7038 } 7039 }, { 7040 key: "getElementValue", 7041 value: function getElementValue(e, t, s) { 7042 var _l4 = e$H(this.form, e, t, this.elements[e]); 7043 7044 return this.filter.execute("field-value", _l4, [_l4, e, t, s]); 7045 } 7046 }, { 7047 key: "getElements", 7048 value: function getElements(e) { 7049 return this.elements[e]; 7050 } 7051 }, { 7052 key: "getFields", 7053 value: function getFields() { 7054 return this.fields; 7055 } 7056 }, { 7057 key: "getFormElement", 7058 value: function getFormElement() { 7059 return this.form; 7060 } 7061 }, { 7062 key: "getLocale", 7063 value: function getLocale() { 7064 return this.locale; 7065 } 7066 }, { 7067 key: "getPlugin", 7068 value: function getPlugin(e) { 7069 return this.plugins[e]; 7070 } 7071 }, { 7072 key: "updateFieldStatus", 7073 value: function updateFieldStatus(e, t, i) { 7074 var _this5 = this; 7075 7076 var s = this.elements[e]; 7077 7078 var _l5 = s[0].getAttribute("type"); 7079 7080 var r = "radio" === _l5 || "checkbox" === _l5 ? [s[0]] : s; 7081 r.forEach(function (s) { 7082 return _this5.updateElementStatus(e, s, t, i); 7083 }); 7084 7085 if (!i) { 7086 switch (t) { 7087 case "NotValidated": 7088 this.emit("core.field.notvalidated", e); 7089 this.results["delete"](e); 7090 break; 7091 7092 case "Validating": 7093 this.emit("core.field.validating", e); 7094 this.results["delete"](e); 7095 break; 7096 7097 case "Valid": 7098 this.emit("core.field.valid", e); 7099 this.results.set(e, "Valid"); 7100 break; 7101 7102 case "Invalid": 7103 this.emit("core.field.invalid", e); 7104 this.results.set(e, "Invalid"); 7105 break; 7106 } 7107 } else if (t === "Invalid") { 7108 this.emit("core.field.invalid", e); 7109 this.results.set(e, "Invalid"); 7110 } 7111 7112 return this; 7113 } 7114 }, { 7115 key: "updateElementStatus", 7116 value: function updateElementStatus(e, t, i, s) { 7117 var _this6 = this; 7118 7119 var _l6 = this.elements[e]; 7120 var r = this.fields[e].validators; 7121 var a = s ? [s] : Object.keys(r); 7122 7123 switch (i) { 7124 case "NotValidated": 7125 a.forEach(function (i) { 7126 return _this6.emit("core.validator.notvalidated", { 7127 element: t, 7128 elements: _l6, 7129 field: e, 7130 validator: i 7131 }); 7132 }); 7133 this.emit("core.element.notvalidated", { 7134 element: t, 7135 elements: _l6, 7136 field: e 7137 }); 7138 break; 7139 7140 case "Validating": 7141 a.forEach(function (i) { 7142 return _this6.emit("core.validator.validating", { 7143 element: t, 7144 elements: _l6, 7145 field: e, 7146 validator: i 7147 }); 7148 }); 7149 this.emit("core.element.validating", { 7150 element: t, 7151 elements: _l6, 7152 field: e 7153 }); 7154 break; 7155 7156 case "Valid": 7157 a.forEach(function (i) { 7158 return _this6.emit("core.validator.validated", { 7159 element: t, 7160 elements: _l6, 7161 field: e, 7162 result: { 7163 message: r[i].message, 7164 valid: true 7165 }, 7166 validator: i 7167 }); 7168 }); 7169 this.emit("core.element.validated", { 7170 element: t, 7171 elements: _l6, 7172 field: e, 7173 valid: true 7174 }); 7175 break; 7176 7177 case "Invalid": 7178 a.forEach(function (i) { 7179 return _this6.emit("core.validator.validated", { 7180 element: t, 7181 elements: _l6, 7182 field: e, 7183 result: { 7184 message: r[i].message, 7185 valid: false 7186 }, 7187 validator: i 7188 }); 7189 });
7190 this.emit("core.element.validated", { 7191 element: t, 7192 elements: _l6, 7193 field: e, 7194 valid: false 7195 }); 7196 break; 7197 } 7198 7199 return this; 7200 } 7201 }, { 7202 key: "resetForm", 7203 value: function resetForm(e) { 7204 var _this7 = this; 7205 7206 Object.keys(this.fields).forEach(function (t) { 7207 return _this7.resetField(t, e); 7208 }); 7209 this.emit("core.form.reset", { 7210 formValidation: this, 7211 reset: e 7212 }); 7213 return this; 7214 } 7215 }, { 7216 key: "resetField", 7217 value: function resetField(e, t) { 7218 if (t) { 7219 var _t = this.elements[e]; 7220 7221 var _i = _t[0].getAttribute("type"); 7222 7223 _t.forEach(function (e) { 7224 if ("radio" === _i || "checkbox" === _i) { 7225 e.removeAttribute("selected"); 7226 e.removeAttribute("checked"); 7227 e.checked = false; 7228 } else { 7229 e.setAttribute("value", ""); 7230 7231 if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) { 7232 e.value = ""; 7233 } 7234 } 7235 }); 7236 } 7237 7238 this.updateFieldStatus(e, "NotValidated"); 7239 this.emit("core.field.reset", { 7240 field: e, 7241 reset: t 7242 }); 7243 return this; 7244 } 7245 }, { 7246 key: "revalidateField", 7247 value: function revalidateField(e) { 7248 if (!this.fields[e]) { 7249 return Promise.resolve("Ignored"); 7250 } 7251 7252 this.updateFieldStatus(e, "NotValidated"); 7253 return this.validateField(e); 7254 } 7255 }, { 7256 key: "disableValidator", 7257 value: function disableValidator(e, t) { 7258 if (!this.fields[e]) { 7259 return this; 7260 } 7261 7262 var i = this.elements[e]; 7263 this.toggleValidator(false, e, t); 7264 this.emit("core.validator.disabled", { 7265 elements: i, 7266 field: e, 7267 formValidation: this, 7268 validator: t 7269 }); 7270 return this; 7271 } 7272 }, { 7273 key: "enableValidator", 7274 value: function enableValidator(e, t) { 7275 if (!this.fields[e]) { 7276 return this; 7277 } 7278 7279 var i = this.elements[e]; 7280 this.toggleValidator(true, e, t); 7281 this.emit("core.validator.enabled", { 7282 elements: i, 7283 field: e, 7284 formValidation: this, 7285 validator: t 7286 }); 7287 return this; 7288 } 7289 }, { 7290 key: "updateValidatorOption", 7291 value: function updateValidatorOption(e, t, i, s) { 7292 if (this.fields[e] && this.fields[e].validators && this.fields[e].validators[t]) { 7293 this.fields[e].validators[t][i] = s; 7294 } 7295 7296 return this; 7297 } 7298 }, { 7299 key: "setFieldOptions", 7300 value: function setFieldOptions(e, t) { 7301 this.fields[e] = t; 7302 return this; 7303 } 7304 }, { 7305 key: "destroy", 7306 value: function destroy() { 7307 var _this8 = this; 7308 7309 Object.keys(this.plugins).forEach(function (e) { 7310 return _this8.plugins[e].uninstall(); 7311 }); 7312 this.ee.clear(); 7313 this.filter.clear(); 7314 this.results.clear(); 7315 this.plugins = {}; 7316 return this; 7317 } 7318 }, { 7319 key: "setLocale", 7320 value: function setLocale(e, t) { 7321 this.locale = e; 7322 this.localization = t; 7323 return this; 7324 } 7325 }, { 7326 key: "waterfall", 7327 value: function waterfall(e) { 7328 return e.reduce(function (e, t) { 7329 return e.then(function (e) { 7330 return t().then(function (t) { 7331 e.push(t); 7332 return e; 7333 }); 7334 }); 7335 }, Promise.resolve([])); 7336 } 7337 }, { 7338 key: "queryElements", 7339 value: function queryElements(e) { 7340 var t = this.fields[e].selector ? "#" === this.fields[e].selector.charAt(0) ? "[id=\"".concat(this.fields[e].selector.substring(1), "\"]") : this.fields[e].selector : "[name=\"".concat(e, "\"]"); 7341 return [].slice.call(this.form.querySelectorAll(t)); 7342 } 7343 }, { 7344 key: "normalizeResult", 7345 value: function normalizeResult(e, t, i) { 7346 var s = this.fields[e].validators[t]; 7347 return Object.assign({}, i, { 7348 message: i.message || (s ? s.message : "") || (this.localization && this.localization[t] && this.localization[t]["default"] ? this.localization[t]["default"] : "") || "The field ".concat(e, " is not val
7348id") 7349 }); 7350 } 7351 }, { 7352 key: "toggleValidator", 7353 value: function toggleValidator(e, t, i) { 7354 var _this9 = this; 7355 7356 var s = this.fields[t].validators; 7357 7358 if (i && s && s[i]) { 7359 this.fields[t].validators[i].enabled = e; 7360 } else if (!i) { 7361 Object.keys(s).forEach(function (i) { 7362 return _this9.fields[t].validators[i].enabled = e; 7363 }); 7364 } 7365 7366 return this.updateFieldStatus(t, "NotValidated", i); 7367 } 7368 }]); 7369 7370 return l; 7371 }(); 7372 7373 function r(e, t) { 7374 var i = Object.assign({}, { 7375 fields: {}, 7376 locale: "en_US", 7377 plugins: {}, 7378 init: function init(e) {} 7379 }, t); 7380 var r = new l$1(e, i.fields); 7381 r.setLocale(i.locale, i.localization); 7382 Object.keys(i.plugins).forEach(function (e) { 7383 return r.registerPlugin(e, i.plugins[e]); 7384 }); 7385 Object.keys(s$3).forEach(function (e) { 7386 return r.registerValidator(e, s$3[e]); 7387 }); 7388 i.init(r); 7389 Object.keys(i.fields).forEach(function (e) { 7390 return r.addField(e, i.fields[e]); 7391 }); 7392 return r; 7393 } 7394 7395 var t$4 = /*#__PURE__*/function () { 7396 function t(_t) { 7397 _classCallCheck(this, t); 7398 7399 this.opts = _t; 7400 } 7401 7402 _createClass(t, [{ 7403 key: "setCore", 7404 value: function setCore(_t2) { 7405 this.core = _t2; 7406 return this; 7407 } 7408 }, { 7409 key: "install", 7410 value: function install() {} 7411 }, { 7412 key: "uninstall", 7413 value: function uninstall() {} 7414 }]); 7415 7416 return t; 7417 }(); 7418 7419 var index$2 = { 7420 getFieldValue: e$H 7421 }; 7422 7423 var e$4 = /*#__PURE__*/function (_t) { 7424 _inherits(e, _t); 7425 7426 var _super = _createSuper(e); 7427 7428 function e(t) { 7429 var _this; 7430 7431 _classCallCheck(this, e); 7432 7433 _this = _super.call(this, t); 7434 _this.opts = t || {}; 7435 _this.validatorNameFilter = _this.getValidatorName.bind(_assertThisInitialized(_this)); 7436 return _this; 7437 } 7438 7439 _createClass(e, [{ 7440 key: "install", 7441 value: function install() { 7442 this.core.registerFilter("validator-name", this.validatorNameFilter); 7443 } 7444 }, { 7445 key: "uninstall", 7446 value: function uninstall() { 7447 this.core.deregisterFilter("validator-name", this.validatorNameFilter); 7448 } 7449 }, { 7450 key: "getValidatorName", 7451 value: function getValidatorName(t, _e) { 7452 return this.opts[t] || t; 7453 } 7454 }]); 7455 7456 return e; 7457 }(t$4); 7458 7459 var i$3 = /*#__PURE__*/function (_e) { 7460 _inherits(i, _e); 7461 7462 var _super = _createSuper(i); 7463 7464 function i() { 7465 var _this; 7466 7467 _classCallCheck(this, i); 7468 7469 _this = _super.call(this, {}); 7470 _this.elementValidatedHandler = _this.onElementValidated.bind(_assertThisInitialized(_this)); 7471 _this.fieldValidHandler = _this.onFieldValid.bind(_assertThisInitialized(_this)); 7472 _this.fieldInvalidHandler = _this.onFieldInvalid.bind(_assertThisInitialized(_this)); 7473 _this.messageDisplayedHandler = _this.onMessageDisplayed.bind(_assertThisInitialized(_this)); 7474 return _this; 7475 } 7476 7477 _createClass(i, [{ 7478 key: "install", 7479 value: function install() { 7480 this.core.on("core.field.valid", this.fieldValidHandler).on("core.field.invalid", this.fieldInvalidHandler).on("core.element.validated", this.elementValidatedHandler).on("plugins.message.displayed", this.messageDisplayedHandler); 7481 } 7482 }, { 7483 key: "uninstall", 7484 value: function uninstall() { 7485 this.core.off("core.field.valid", this.fieldValidHandler).off("core.field.invalid", this.fieldInvalidHandler).off("core.element.validated", this.elementValidatedHandler).off("plugins.message.displayed", this.messageDisplayedHandler); 7486 } 7487 }, { 7488 key: "onElementValidated", 7489 value: function onElementValidated(e) { 7490 if (e.valid) { 7491 e.element.setAttribute("aria-invalid", "false"); 7492 e.element.removeAttribute("aria-describedby"); 7493 } 7494 } 7495 }, { 7496 key: "onFieldValid", 7497 value: function onFieldValid(e) { 7498 var _i = this.core.getElements(e); 7499 7500 if (_i) { 7501 _i.forEach(function (e) { 7502 e.setAttribute("aria-invalid", "false"); 7503 e.removeAttribute("aria-describedby"); 7504 }); 7505 } 7506 } 7507 }, {
7508 key: "onFieldInvalid", 7509 value: function onFieldInvalid(e) { 7510 var _i2 = this.core.getElements(e); 7511 7512 if (_i2) { 7513 _i2.forEach(function (e) { 7514 return e.setAttribute("aria-invalid", "true"); 7515 }); 7516 } 7517 } 7518 }, { 7519 key: "onMessageDisplayed", 7520 value: function onMessageDisplayed(e) { 7521 e.messageElement.setAttribute("role", "alert"); 7522 e.messageElement.setAttribute("aria-hidden", "false"); 7523 7524 var _i3 = this.core.getElements(e.field); 7525 7526 var t = _i3.indexOf(e.element); 7527 7528 var l = "js-fv-".concat(e.field, "-").concat(t, "-").concat(Date.now(), "-message"); 7529 e.messageElement.setAttribute("id", l); 7530 e.element.setAttribute("aria-describedby", l); 7531 var a = e.element.getAttribute("type"); 7532 7533 if ("radio" === a || "checkbox" === a) { 7534 _i3.forEach(function (e) { 7535 return e.setAttribute("aria-describedby", l); 7536 }); 7537 } 7538 } 7539 }]); 7540 7541 return i; 7542 }(t$4); 7543 7544 var t$3 = /*#__PURE__*/function (_e) { 7545 _inherits(t, _e); 7546 7547 var _super = _createSuper(t); 7548 7549 function t(e) { 7550 var _this; 7551 7552 _classCallCheck(this, t); 7553 7554 _this = _super.call(this, e); 7555 _this.addedFields = new Map(); 7556 _this.opts = Object.assign({}, { 7557 html5Input: false, 7558 pluginPrefix: "data-fvp-", 7559 prefix: "data-fv-" 7560 }, e); 7561 _this.fieldAddedHandler = _this.onFieldAdded.bind(_assertThisInitialized(_this)); 7562 _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_assertThisInitialized(_this)); 7563 return _this; 7564 } 7565 7566 _createClass(t, [{ 7567 key: "install", 7568 value: function install() { 7569 var _this2 = this; 7570 7571 this.parsePlugins(); 7572 var e = this.parseOptions(); 7573 Object.keys(e).forEach(function (_t) { 7574 if (!_this2.addedFields.has(_t)) { 7575 _this2.addedFields.set(_t, true); 7576 } 7577 7578 _this2.core.addField(_t, e[_t]); 7579 }); 7580 this.core.on("core.field.added", this.fieldAddedHandler).on("core.field.removed", this.fieldRemovedHandler); 7581 } 7582 }, { 7583 key: "uninstall", 7584 value: function uninstall() { 7585 this.addedFields.clear(); 7586 this.core.off("core.field.added", this.fieldAddedHandler).off("core.field.removed", this.fieldRemovedHandler); 7587 } 7588 }, { 7589 key: "onFieldAdded", 7590 value: function onFieldAdded(e) { 7591 var _this3 = this; 7592 7593 var _t2 = e.elements; 7594 7595 if (!_t2 || _t2.length === 0 || this.addedFields.has(e.field)) { 7596 return; 7597 } 7598 7599 this.addedFields.set(e.field, true); 7600 7601 _t2.forEach(function (_t3) { 7602 var s = _this3.parseElement(_t3); 7603 7604 if (!_this3.isEmptyOption(s)) { 7605 var _t12 = { 7606 selector: e.options.selector, 7607 validators: Object.assign({}, e.options.validators || {}, s.validators) 7608 }; 7609 7610 _this3.core.setFieldOptions(e.field, _t12); 7611 } 7612 }); 7613 } 7614 }, { 7615 key: "onFieldRemoved", 7616 value: function onFieldRemoved(e) { 7617 if (e.field && this.addedFields.has(e.field)) { 7618 this.addedFields["delete"](e.field); 7619 } 7620 } 7621 }, { 7622 key: "parseOptions", 7623 value: function parseOptions() { 7624 var _this4 = this; 7625 7626 var e = this.opts.prefix; 7627 var _t5 = {}; 7628 var s = this.core.getFields(); 7629 var a = this.core.getFormElement(); 7630 var i = [].slice.call(a.querySelectorAll("[name], [".concat(e, "field]"))); 7631 i.forEach(function (s) { 7632 var a = _this4.parseElement(s); 7633 7634 if (!_this4.isEmptyOption(a)) { 7635 var _i = s.getAttribute("name") || s.getAttribute("".concat(e, "field")); 7636 7637 _t5[_i] = Object.assign({}, _t5[_i], a); 7638 } 7639 }); 7640 Object.keys(_t5).forEach(function (e) { 7641 Object.keys(_t5[e].validators).forEach(function (a) { 7642 _t5[e].validators[a].enabled = _t5[e].validators[a].enabled || false; 7643 7644 if (s[e] && s[e].validators && s[e].validators[a]) { 7645 Object.assign(_t5[e].validators[a], s[e].validators[a]); 7646 } 7647 }); 7648 }); 7649 return Object.assign({}, s, _t5); 7650 } 7651 }, {
7652 key: "createPluginInstance", 7653 value: function createPluginInstance(e, _t6) { 7654 var s = e.split("."); 7655 var a = window || this; 7656 7657 for (var _e2 = 0, _t13 = s.length; _e2 < _t13; _e2++) { 7658 a = a[s[_e2]]; 7659 } 7660 7661 if (typeof a !== "function") { 7662 throw new Error("the plugin ".concat(e, " doesn't exist")); 7663 } 7664 7665 return new a(_t6); 7666 } 7667 }, { 7668 key: "parsePlugins", 7669 value: function parsePlugins() { 7670 var _this5 = this; 7671 7672 var e = this.core.getFormElement(); 7673 7674 var _t8 = new RegExp("^".concat(this.opts.pluginPrefix, "([a-z0-9-]+)(___)*([a-z0-9-]+)*$")); 7675 7676 var s = e.attributes.length; 7677 var a = {}; 7678 7679 for (var i = 0; i < s; i++) { 7680 var _s = e.attributes[i].name; 7681 var n = e.attributes[i].value; 7682 7683 var r = _t8.exec(_s); 7684 7685 if (r && r.length === 4) { 7686 var _e3 = this.toCamelCase(r[1]); 7687 7688 a[_e3] = Object.assign({}, r[3] ? _defineProperty({}, this.toCamelCase(r[3]), n) : { 7689 enabled: "" === n || "true" === n 7690 }, a[_e3]); 7691 } 7692 } 7693 7694 Object.keys(a).forEach(function (e) { 7695 var _t9 = a[e]; 7696 var s = _t9["enabled"]; 7697 var i = _t9["class"]; 7698 7699 if (s && i) { 7700 delete _t9["enabled"]; 7701 delete _t9["clazz"]; 7702 7703 var _s2 = _this5.createPluginInstance(i, _t9); 7704 7705 _this5.core.registerPlugin(e, _s2); 7706 } 7707 }); 7708 } 7709 }, { 7710 key: "isEmptyOption", 7711 value: function isEmptyOption(e) { 7712 var _t10 = e.validators; 7713 return Object.keys(_t10).length === 0 && _t10.constructor === Object; 7714 } 7715 }, { 7716 key: "parseElement", 7717 value: function parseElement(e) { 7718 var _t11 = new RegExp("^".concat(this.opts.prefix, "([a-z0-9-]+)(___)*([a-z0-9-]+)*$")); 7719 7720 var s = e.attributes.length; 7721 var a = {}; 7722 var i = e.getAttribute("type"); 7723 7724 for (var n = 0; n < s; n++) { 7725 var _s3 = e.attributes[n].name; 7726 var r = e.attributes[n].value; 7727 7728 if (this.opts.html5Input) { 7729 switch (true) { 7730 case "minlength" === _s3: 7731 a["stringLength"] = Object.assign({}, { 7732 enabled: true, 7733 min: parseInt(r, 10) 7734 }, a["stringLength"]); 7735 break; 7736 7737 case "maxlength" === _s3: 7738 a["stringLength"] = Object.assign({}, { 7739 enabled: true, 7740 max: parseInt(r, 10) 7741 }, a["stringLength"]); 7742 break; 7743 7744 case "pattern" === _s3: 7745 a["regexp"] = Object.assign({}, { 7746 enabled: true, 7747 regexp: r 7748 }, a["regexp"]); 7749 break; 7750 7751 case "required" === _s3: 7752 a["notEmpty"] = Object.assign({}, { 7753 enabled: true 7754 }, a["notEmpty"]); 7755 break; 7756 7757 case "type" === _s3 && "color" === r: 7758 a["color"] = Object.assign({}, { 7759 enabled: true, 7760 type: "hex" 7761 }, a["color"]); 7762 break; 7763 7764 case "type" === _s3 && "email" === r: 7765 a["emailAddress"] = Object.assign({}, { 7766 enabled: true 7767 }, a["emailAddress"]); 7768 break; 7769 7770 case "type" === _s3 && "url" === r: 7771 a["uri"] = Object.assign({}, { 7772 enabled: true 7773 }, a["uri"]); 7774 break; 7775 7776 case "type" === _s3 && "range" === r: 7777 a["between"] = Object.assign({}, { 7778 enabled: true, 7779 max: parseFloat(e.getAttribute("max")), 7780 min: parseFloat(e.getAttribute("min")) 7781 }, a["between"]); 7782 break; 7783 7784 case "min" === _s3 && i !== "date" && i !== "range": 7785 a["greaterThan"] = Object.assign({}, { 7786 enabled: true, 7787 min: parseFloat(r) 7788 }, a["greaterThan"]); 7789 break; 7790 7791 case "max" === _s3 && i !== "date" && i !== "range": 7792 a["lessThan"] = Object.assign({}, { 7793 enabled: true, 7794 max: parseFloat(r) 7795 }, a["lessThan"]); 7796 break; 7797 } 7798 } 7799 7800 var l = _t11.exec(_s3); 7801 7802 if (l && l.length === 4) { 7803 var _e4 = this.toCamelCase(l[1]); 7804 7805 a[_e4] = Object.assign({}, l[3] ? _defineProperty({}, this.toCamelCase(l[3]), this.normalizeValue(r)) : { 7806 enabled: "" === r || "true" === r 7807 }, a[_e4]); 7808 } 7809 } 7810 7811 return { 7812 validators: a 7813 }; 7814 } 7815 }, {
7816 key: "normalizeValue", 7817 value: function normalizeValue(e) { 7818 return e === "true" ? true : e === "false" ? false : e; 7819 } 7820 }, { 7821 key: "toUpperCase", 7822 value: function toUpperCase(e) { 7823 return e.charAt(1).toUpperCase(); 7824 } 7825 }, { 7826 key: "toCamelCase", 7827 value: function toCamelCase(e) { 7828 return e.replace(/-./g, this.toUpperCase); 7829 } 7830 }]); 7831 7832 return t; 7833 }(t$4); 7834 7835 var o = /*#__PURE__*/function (_t) { 7836 _inherits(o, _t); 7837 7838 var _super = _createSuper(o); 7839 7840 function o() { 7841 var _this; 7842 7843 _classCallCheck(this, o); 7844 7845 _this = _super.call(this, {}); 7846 _this.onValidHandler = _this.onFormValid.bind(_assertThisInitialized(_this)); 7847 return _this; 7848 } 7849 7850 _createClass(o, [{ 7851 key: "install", 7852 value: function install() { 7853 var t = this.core.getFormElement(); 7854 7855 if (t.querySelectorAll('[type="submit"][name="submit"]').length) { 7856 throw new Error("Do not use `submit` for the name attribute of submit button"); 7857 } 7858 7859 this.core.on("core.form.valid", this.onValidHandler); 7860 } 7861 }, { 7862 key: "uninstall", 7863 value: function uninstall() { 7864 this.core.off("core.form.valid", this.onValidHandler); 7865 } 7866 }, { 7867 key: "onFormValid", 7868 value: function onFormValid() { 7869 var t = this.core.getFormElement(); 7870 7871 if (t instanceof HTMLFormElement) { 7872 t.submit(); 7873 } 7874 } 7875 }]); 7876 7877 return o; 7878 }(t$4); 7879 7880 var e$3 = /*#__PURE__*/function (_t) { 7881 _inherits(e, _t); 7882 7883 var _super = _createSuper(e); 7884 7885 function e(t) { 7886 var _this; 7887 7888 _classCallCheck(this, e); 7889 7890 _this = _super.call(this, t); 7891 _this.opts = t || {}; 7892 _this.triggerExecutedHandler = _this.onTriggerExecuted.bind(_assertThisInitialized(_this)); 7893 return _this; 7894 } 7895 7896 _createClass(e, [{ 7897 key: "install", 7898 value: function install() { 7899 this.core.on("plugins.trigger.executed", this.triggerExecutedHandler); 7900 } 7901 }, { 7902 key: "uninstall", 7903 value: function uninstall() { 7904 this.core.off("plugins.trigger.executed", this.triggerExecutedHandler); 7905 } 7906 }, { 7907 key: "onTriggerExecuted", 7908 value: function onTriggerExecuted(t) { 7909 if (this.opts[t.field]) { 7910 var _e3 = this.opts[t.field].split(" "); 7911 7912 var _iterator = _createForOfIteratorHelper(_e3), 7913 _step; 7914 7915 try { 7916 for (_iterator.s(); !(_step = _iterator.n()).done;) { 7917 var _t2 = _step.value; 7918 7919 var _e4 = _t2.trim(); 7920 7921 if (this.opts[_e4]) { 7922 this.core.revalidateField(_e4); 7923 } 7924 } 7925 } catch (err) { 7926 _iterator.e(err); 7927 } finally { 7928 _iterator.f(); 7929 } 7930 } 7931 } 7932 }]); 7933 7934 return e; 7935 }(t$4); 7936 7937 var e$2 = /*#__PURE__*/function (_t) { 7938 _inherits(e, _t); 7939 7940 var _super = _createSuper(e); 7941 7942 function e(t) { 7943 var _this; 7944 7945 _classCallCheck(this, e); 7946 7947 _this = _super.call(this, t); 7948 _this.opts = Object.assign({}, { 7949 excluded: e.defaultIgnore 7950 }, t); 7951 _this.ignoreValidationFilter = _this.ignoreValidation.bind(_assertThisInitialized(_this)); 7952 return _this; 7953 } 7954 7955 _createClass(e, [{ 7956 key: "install", 7957 value: function install() { 7958 this.core.registerFilter("element-ignored", this.ignoreValidationFilter); 7959 } 7960 }, { 7961 key: "uninstall", 7962 value: function uninstall() { 7963 this.core.deregisterFilter("element-ignored", this.ignoreValidationFilter); 7964 } 7965 }, { 7966 key: "ignoreValidation", 7967 value: function ignoreValidation(t, _e2, i) { 7968 return this.opts.excluded.apply(this, [t, _e2, i]); 7969 } 7970 }], [{ 7971 key: "defaultIgnore", 7972 value: function defaultIgnore(t, _e, i) { 7973 var r = !!(_e.offsetWidth || _e.offsetHeight || _e.getClientRects().length); 7974 7975 var n = _e.getAttribute("disabled"); 7976 7977 return n === "" || n === "disabled" || _e.getAttribute("type") === "hidden" || !r; 7978 } 7979 }]); 7980 7981 return e; 7982 }(t$4); 7983 7984 var t$2 = /*#__PURE__*/function (_e) { 7985 _inherits(t, _e); 7986 7987 var _super = _createSuper(t); 7988 7989 function t(e) { 7990 var _this; 7991 7992 _classCallCheck(this, t); 7993 7994 _this = _super.call(this, e); 7995 _this.statuses = new Map(); 7996 _this.opts = Object.assign({}, { 7997 onStatusChanged: function onStatusChanged() {} 7998 }, e); 7999 _this.elementValidatingHandler = _this.onElementValidating.bind(_assertThisInitialized(_this)); 8000 _this.elementValidatedHandler = _this.onElementValidated.bind(_assertThisInitialized(_this)); 8001 _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_assertThisInitialized(_this));
8002 _this.elementIgnoredHandler = _this.onElementIgnored.bind(_assertThisInitialized(_this)); 8003 _this.fieldAddedHandler = _this.onFieldAdded.bind(_assertThisInitialized(_this)); 8004 _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_assertThisInitialized(_this)); 8005 return _this; 8006 } 8007 8008 _createClass(t, [{ 8009 key: "install", 8010 value: function install() { 8011 this.core.on("core.element.validating", this.elementValidatingHandler).on("core.element.validated", this.elementValidatedHandler).on("core.element.notvalidated", this.elementNotValidatedHandler).on("core.element.ignored", this.elementIgnoredHandler).on("core.field.added", this.fieldAddedHandler).on("core.field.removed", this.fieldRemovedHandler); 8012 } 8013 }, { 8014 key: "uninstall", 8015 value: function uninstall() { 8016 this.statuses.clear(); 8017 this.core.off("core.element.validating", this.elementValidatingHandler).off("core.element.validated", this.elementValidatedHandler).off("core.element.notvalidated", this.elementNotValidatedHandler).off("core.element.ignored", this.elementIgnoredHandler).off("core.field.added", this.fieldAddedHandler).off("core.field.removed", this.fieldRemovedHandler); 8018 } 8019 }, { 8020 key: "areFieldsValid", 8021 value: function areFieldsValid() { 8022 return Array.from(this.statuses.values()).every(function (e) { 8023 return e === "Valid" || e === "NotValidated" || e === "Ignored"; 8024 }); 8025 } 8026 }, { 8027 key: "getStatuses", 8028 value: function getStatuses() { 8029 return this.statuses; 8030 } 8031 }, { 8032 key: "onFieldAdded", 8033 value: function onFieldAdded(e) { 8034 this.statuses.set(e.field, "NotValidated"); 8035 } 8036 }, { 8037 key: "onFieldRemoved", 8038 value: function onFieldRemoved(e) { 8039 if (this.statuses.has(e.field)) { 8040 this.statuses["delete"](e.field); 8041 } 8042 8043 this.opts.onStatusChanged(this.areFieldsValid()); 8044 } 8045 }, { 8046 key: "onElementValidating", 8047 value: function onElementValidating(e) { 8048 this.statuses.set(e.field, "Validating"); 8049 this.opts.onStatusChanged(false); 8050 } 8051 }, { 8052 key: "onElementValidated", 8053 value: function onElementValidated(e) { 8054 this.statuses.set(e.field, e.valid ? "Valid" : "Invalid"); 8055 8056 if (e.valid) { 8057 this.opts.onStatusChanged(this.areFieldsValid()); 8058 } else { 8059 this.opts.onStatusChanged(false); 8060 } 8061 } 8062 }, { 8063 key: "onElementNotValidated", 8064 value: function onElementNotValidated(e) { 8065 this.statuses.set(e.field, "NotValidated"); 8066 this.opts.onStatusChanged(false); 8067 } 8068 }, { 8069 key: "onElementIgnored", 8070 value: function onElementIgnored(e) { 8071 this.statuses.set(e.field, "Ignored"); 8072 this.opts.onStatusChanged(this.areFieldsValid()); 8073 } 8074 }]); 8075 8076 return t; 8077 }(t$4); 8078 8079 function s$2(s, a) { 8080 a.split(" ").forEach(function (a) { 8081 if (s.classList) { 8082 s.classList.add(a); 8083 } else if (" ".concat(s.className, " ").indexOf(" ".concat(a, " "))) { 8084 s.className += " ".concat(a); 8085 } 8086 }); 8087 } 8088 8089 function a(s, a) { 8090 a.split(" ").forEach(function (a) { 8091 s.classList ? s.classList.remove(a) : s.className = s.className.replace(a, ""); 8092 }); 8093 } 8094 8095 function c(c, e) { 8096 var t = []; 8097 var f = []; 8098 Object.keys(e).forEach(function (s) { 8099 if (s) { 8100 e[s] ? t.push(s) : f.push(s); 8101 } 8102 }); 8103 f.forEach(function (s) { 8104 return a(c, s); 8105 }); 8106 t.forEach(function (a) { 8107 return s$2(c, a); 8108 }); 8109 } 8110 8111 function e$1(e, t) { 8112 var l = e.matches || e.webkitMatchesSelector || e["mozMatchesSelector"] || e["msMatchesSelector"]; 8113 8114 if (l) { 8115 return l.call(e, t); 8116 } 8117 8118 var c = [].slice.call(e.parentElement.querySelectorAll(t)); 8119 return c.indexOf(e) >= 0; 8120 } 8121 8122 function t$1(t, l) { 8123 var c = t; 8124 8125 while (c) { 8126 if (e$1(c, l)) { 8127 break; 8128 } 8129 8130 c = c.parentElement; 8131 } 8132 8133 return c; 8134 } 8135 8136 var s$1 = /*#__PURE__*/function (_e) { 8137 _inherits(s, _e); 8138 8139 var _super = _createSuper(s); 8140 8141 function s(e) { 8142 var _this; 8143 8144 _classCallCheck(this, s); 8145 8146 _this = _super.call(this, e); 8147 _this.useDefaultContainer = false;
8148 _this.messages = new Map(); 8149 _this.defaultContainer = document.createElement("div"); 8150 _this.useDefaultContainer = !e || !e.container; 8151 _this.opts = Object.assign({}, { 8152 container: function container(e, t) { 8153 return _this.defaultContainer; 8154 } 8155 }, e); 8156 _this.elementIgnoredHandler = _this.onElementIgnored.bind(_assertThisInitialized(_this)); 8157 _this.fieldAddedHandler = _this.onFieldAdded.bind(_assertThisInitialized(_this)); 8158 _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_assertThisInitialized(_this)); 8159 _this.validatorValidatedHandler = _this.onValidatorValidated.bind(_assertThisInitialized(_this)); 8160 _this.validatorNotValidatedHandler = _this.onValidatorNotValidated.bind(_assertThisInitialized(_this)); 8161 return _this; 8162 } 8163 8164 _createClass(s, [{ 8165 key: "install", 8166 value: function install() { 8167 if (this.useDefaultContainer) { 8168 this.core.getFormElement().appendChild(this.defaultContainer); 8169 } 8170 8171 this.core.on("core.element.ignored", this.elementIgnoredHandler).on("core.field.added", this.fieldAddedHandler).on("core.field.removed", this.fieldRemovedHandler).on("core.validator.validated", this.validatorValidatedHandler).on("core.validator.notvalidated", this.validatorNotValidatedHandler); 8172 } 8173 }, { 8174 key: "uninstall", 8175 value: function uninstall() { 8176 if (this.useDefaultContainer) { 8177 this.core.getFormElement().removeChild(this.defaultContainer); 8178 } 8179 8180 this.messages.forEach(function (e) { 8181 return e.parentNode.removeChild(e); 8182 }); 8183 this.messages.clear(); 8184 this.core.off("core.element.ignored", this.elementIgnoredHandler).off("core.field.added", this.fieldAddedHandler).off("core.field.removed", this.fieldRemovedHandler).off("core.validator.validated", this.validatorValidatedHandler).off("core.validator.notvalidated", this.validatorNotValidatedHandler); 8185 } 8186 }, { 8187 key: "onFieldAdded", 8188 value: function onFieldAdded(e) { 8189 var _this2 = this; 8190 8191 var t = e.elements; 8192 8193 if (t) { 8194 t.forEach(function (e) { 8195 var t = _this2.messages.get(e); 8196 8197 if (t) { 8198 t.parentNode.removeChild(t); 8199 8200 _this2.messages["delete"](e); 8201 } 8202 }); 8203 this.prepareFieldContainer(e.field, t); 8204 } 8205 } 8206 }, { 8207 key: "onFieldRemoved", 8208 value: function onFieldRemoved(e) { 8209 var _this3 = this; 8210 8211 if (!e.elements.length || !e.field) { 8212 return; 8213 } 8214 8215 var t = e.elements[0].getAttribute("type"); 8216 8217 var _s2 = "radio" === t || "checkbox" === t ? [e.elements[0]] : e.elements; 8218 8219 _s2.forEach(function (e) { 8220 if (_this3.messages.has(e)) { 8221 var _t = _this3.messages.get(e); 8222 8223 _t.parentNode.removeChild(_t); 8224 8225 _this3.messages["delete"](e); 8226 } 8227 }); 8228 } 8229 }, { 8230 key: "prepareFieldContainer", 8231 value: function prepareFieldContainer(e, t) { 8232 var _this4 = this; 8233 8234 if (t.length) { 8235 var _s12 = t[0].getAttribute("type"); 8236 8237 if ("radio" === _s12 || "checkbox" === _s12) { 8238 this.prepareElementContainer(e, t[0], t); 8239 } else { 8240 t.forEach(function (_s4) { 8241 return _this4.prepareElementContainer(e, _s4, t); 8242 }); 8243 } 8244 } 8245 } 8246 }, { 8247 key: "prepareElementContainer", 8248 value: function prepareElementContainer(e, _s5, i) { 8249 var a; 8250 8251 if ("string" === typeof this.opts.container) { 8252 var _e2 = "#" === this.opts.container.charAt(0) ? "[id=\"".concat(this.opts.container.substring(1), "\"]") : this.opts.container; 8253 8254 a = this.core.getFormElement().querySelector(_e2); 8255 } else { 8256 a = this.opts.container(e, _s5); 8257 } 8258 8259 var l = document.createElement("div"); 8260 a.appendChild(l); 8261 c(l, { 8262 "fv-plugins-message-container": true 8263 }); 8264 this.core.emit("plugins.message.placed", { 8265 element: _s5,
8266 elements: i, 8267 field: e, 8268 messageElement: l 8269 }); 8270 this.messages.set(_s5, l); 8271 } 8272 }, { 8273 key: "getMessage", 8274 value: function getMessage(e) { 8275 return typeof e.message === "string" ? e.message : e.message[this.core.getLocale()]; 8276 } 8277 }, { 8278 key: "onValidatorValidated", 8279 value: function onValidatorValidated(e) { 8280 var _s6 = e.elements; 8281 var i = e.element.getAttribute("type"); 8282 var a = ("radio" === i || "checkbox" === i) && _s6.length > 0 ? _s6[0] : e.element; 8283 8284 if (this.messages.has(a)) { 8285 var _s13 = this.messages.get(a); 8286 8287 var _i = _s13.querySelector("[data-field=\"".concat(e.field, "\"][data-validator=\"").concat(e.validator, "\"]")); 8288 8289 if (!_i && !e.result.valid) { 8290 var _i2 = document.createElement("div"); 8291 8292 _i2.innerHTML = this.getMessage(e.result); 8293 8294 _i2.setAttribute("data-field", e.field); 8295 8296 _i2.setAttribute("data-validator", e.validator); 8297 8298 if (this.opts.clazz) { 8299 c(_i2, _defineProperty({}, this.opts.clazz, true)); 8300 } 8301 8302 _s13.appendChild(_i2); 8303 8304 this.core.emit("plugins.message.displayed", { 8305 element: e.element, 8306 field: e.field, 8307 message: e.result.message, 8308 messageElement: _i2, 8309 meta: e.result.meta, 8310 validator: e.validator 8311 }); 8312 } else if (_i && !e.result.valid) { 8313 _i.innerHTML = this.getMessage(e.result); 8314 this.core.emit("plugins.message.displayed", { 8315 element: e.element, 8316 field: e.field, 8317 message: e.result.message, 8318 messageElement: _i, 8319 meta: e.result.meta, 8320 validator: e.validator 8321 }); 8322 } else if (_i && e.result.valid) { 8323 _s13.removeChild(_i); 8324 } 8325 } 8326 } 8327 }, { 8328 key: "onValidatorNotValidated", 8329 value: function onValidatorNotValidated(e) { 8330 var t = e.elements; 8331 8332 var _s8 = e.element.getAttribute("type"); 8333 8334 var i = "radio" === _s8 || "checkbox" === _s8 ? t[0] : e.element; 8335 8336 if (this.messages.has(i)) { 8337 var _t3 = this.messages.get(i); 8338 8339 var _s14 = _t3.querySelector("[data-field=\"".concat(e.field, "\"][data-validator=\"").concat(e.validator, "\"]")); 8340 8341 if (_s14) { 8342 _t3.removeChild(_s14); 8343 } 8344 } 8345 } 8346 }, { 8347 key: "onElementIgnored", 8348 value: function onElementIgnored(e) { 8349 var t = e.elements; 8350 8351 var _s10 = e.element.getAttribute("type"); 8352 8353 var i = "radio" === _s10 || "checkbox" === _s10 ? t[0] : e.element; 8354 8355 if (this.messages.has(i)) { 8356 var _t4 = this.messages.get(i); 8357 8358 var _s15 = [].slice.call(_t4.querySelectorAll("[data-field=\"".concat(e.field, "\"]"))); 8359 8360 _s15.forEach(function (e) { 8361 _t4.removeChild(e); 8362 }); 8363 } 8364 } 8365 }], [{ 8366 key: "getClosestContainer", 8367 value: function getClosestContainer(e, t, _s) { 8368 var i = e; 8369 8370 while (i) { 8371 if (i === t) { 8372 break; 8373 } 8374 8375 i = i.parentElement; 8376 8377 if (_s.test(i.className)) { 8378 break; 8379 } 8380 } 8381 8382 return i; 8383 } 8384 }]); 8385 8386 return s; 8387 }(t$4); 8388 8389 var l = /*#__PURE__*/function (_e) { 8390 _inherits(l, _e); 8391 8392 var _super = _createSuper(l); 8393 8394 function l(e) { 8395 var _this; 8396 8397 _classCallCheck(this, l); 8398 8399 _this = _super.call(this, e); 8400 _this.results = new Map(); 8401 _this.containers = new Map(); 8402 _this.MESSAGE_PLUGIN = "___frameworkMessage"; 8403 _this.opts = Object.assign({}, { 8404 defaultMessageContainer: true, 8405 eleInvalidClass: "", 8406 eleValidClass: "", 8407 rowClasses: "", 8408 rowValidatingClass: "" 8409 }, e); 8410 _this.elementIgnoredHandler = _this.onElementIgnored.bind(_assertThisInitialized(_this)); 8411 _this.elementValidatingHandler = _this.onElementValidating.bind(_assertThisInitialized(_this)); 8412 _this.elementValidatedHandler = _this.onElementValidated.bind(_assertThisInitialized(_this)); 8413 _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_assertThisInitialized(_this)); 8414 _this.iconPlacedHandler = _this.onIconPlaced.bind(_assertThisInitialized(_this)); 8415 _this.fieldAddedHandler = _this.onFieldAdded.bind(_assertThisInitialized(_this)); 8416 _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_assertThisInitialized(_this)); 8417 _this.messagePlacedHandler = _this.onMessagePlaced.bind(_assertThisInitialized(_this)); 8418 return _this; 8419 } 8420 8421 _createClass(l, [{ 8422 key: "install", 8423 value: function install() { 8424 var _t, 8425 _this2 = this; 8426 8427 c(this.core.getFormElement(), (_t = {}, _defineProperty(_t, this.opts.formClass, true), _defineProperty(_t, "fv-plugins-framework", true), _t)); 8428 this.core.on("core.element.ignored", this.elementIgnoredH
8428andler).on("core.element.validating", this.elementValidatingHandler).on("core.element.validated", this.elementValidatedHandler).on("core.element.notvalidated", this.elementNotValidatedHandler).on("plugins.icon.placed", this.iconPlacedHandler).on("core.field.added", this.fieldAddedHandler).on("core.field.removed", this.fieldRemovedHandler); 8429 8430 if (this.opts.defaultMessageContainer) { 8431 this.core.registerPlugin(this.MESSAGE_PLUGIN, new s$1({ 8432 clazz: this.opts.messageClass, 8433 container: function container(e, t) { 8434 var _l = "string" === typeof _this2.opts.rowSelector ? _this2.opts.rowSelector : _this2.opts.rowSelector(e, t); 8435 8436 var a = t$1(t, _l); 8437 return s$1.getClosestContainer(t, a, _this2.opts.rowPattern); 8438 } 8439 })); 8440 this.core.on("plugins.message.placed", this.messagePlacedHandler); 8441 } 8442 } 8443 }, { 8444 key: "uninstall", 8445 value: function uninstall() { 8446 var _t2; 8447 8448 this.results.clear(); 8449 this.containers.clear(); 8450 c(this.core.getFormElement(), (_t2 = {}, _defineProperty(_t2, this.opts.formClass, false), _defineProperty(_t2, "fv-plugins-framework", false), _t2)); 8451 this.core.off("core.element.ignored", this.elementIgnoredHandler).off("core.element.validating", this.elementValidatingHandler).off("core.element.validated", this.elementValidatedHandler).off("core.element.notvalidated", this.elementNotValidatedHandler).off("plugins.icon.placed", this.iconPlacedHandler).off("core.field.added", this.fieldAddedHandler).off("core.field.removed", this.fieldRemovedHandler); 8452 8453 if (this.opts.defaultMessageContainer) { 8454 this.core.deregisterPlugin(this.MESSAGE_PLUGIN); 8455 this.core.off("plugins.message.placed", this.messagePlacedHandler); 8456 } 8457 } 8458 }, { 8459 key: "onIconPlaced", 8460 value: function onIconPlaced(e) {} 8461 }, { 8462 key: "onMessagePlaced", 8463 value: function onMessagePlaced(e) {} 8464 }, { 8465 key: "onFieldAdded", 8466 value: function onFieldAdded(e) { 8467 var _this3 = this; 8468 8469 var s = e.elements; 8470 8471 if (s) { 8472 s.forEach(function (e) { 8473 var s = _this3.containers.get(e); 8474 8475 if (s) { 8476 var _t3; 8477 8478 c(s, (_t3 = {}, _defineProperty(_t3, _this3.opts.rowInvalidClass, false), _defineProperty(_t3, _this3.opts.rowValidatingClass, false), _defineProperty(_t3, _this3.opts.rowValidClass, false), _defineProperty(_t3, "fv-plugins-icon-container", false), _t3)); 8479 8480 _this3.containers["delete"](e); 8481 } 8482 }); 8483 this.prepareFieldContainer(e.field, s); 8484 } 8485 } 8486 }, { 8487 key: "onFieldRemoved", 8488 value: function onFieldRemoved(e) { 8489 var _this4 = this; 8490 8491 e.elements.forEach(function (e) { 8492 var s = _this4.containers.get(e); 8493 8494 if (s) { 8495 var _t4; 8496 8497 c(s, (_t4 = {}, _defineProperty(_t4, _this4.opts.rowInvalidClass, false), _defineProperty(_t4, _this4.opts.rowValidatingClass, false), _defineProperty(_t4, _this4.opts.rowValidClass, false), _t4)); 8498 } 8499 }); 8500 } 8501 }, { 8502 key: "prepareFieldContainer", 8503 value: function prepareFieldContainer(e, t) { 8504 var _this5 = this; 8505 8506 if (t.length) { 8507 var _s = t[0].getAttribute("type"); 8508 8509 if ("radio" === _s || "checkbox" === _s) { 8510 this.prepareElementContainer(e, t[0]); 8511 } else { 8512 t.forEach(function (t) { 8513 return _this5.prepareElementContainer(e, t); 8514 }); 8515 } 8516 } 8517 } 8518 }, { 8519 key: "prepareElementContainer", 8520 value: function prepareElementContainer(e, i) { 8521 var _l2 = "string" === typeof this.opts.rowSelector ? this.opts.rowSelector : this.opts.rowSelector(e, i); 8522 8523 var a = t$1(i, _l2); 8524 8525 if (a !== i) { 8526 var _t5; 8527 8528 c(a, (_t5 = {}, _defineProperty(_t5, this.opts.rowClasses, true), _defineProperty(_t5, "fv-plugins-icon-container", true), _t5)); 8529 this.containers.set(i, a); 8530 } 8531 } 8532 }, {
8533 key: "onElementValidating", 8534 value: function onElementValidating(e) { 8535 var s = e.elements; 8536 var i = e.element.getAttribute("type"); 8537 8538 var _l3 = "radio" === i || "checkbox" === i ? s[0] : e.element; 8539 8540 var a = this.containers.get(_l3); 8541 8542 if (a) { 8543 var _t6; 8544 8545 c(a, (_t6 = {}, _defineProperty(_t6, this.opts.rowInvalidClass, false), _defineProperty(_t6, this.opts.rowValidatingClass, true), _defineProperty(_t6, this.opts.rowValidClass, false), _t6)); 8546 } 8547 } 8548 }, { 8549 key: "onElementNotValidated", 8550 value: function onElementNotValidated(e) { 8551 this.removeClasses(e.element, e.elements); 8552 } 8553 }, { 8554 key: "onElementIgnored", 8555 value: function onElementIgnored(e) { 8556 this.removeClasses(e.element, e.elements); 8557 } 8558 }, { 8559 key: "removeClasses", 8560 value: function removeClasses(e, s) { 8561 var _this6 = this; 8562 8563 var i = e.getAttribute("type"); 8564 8565 var _l4 = "radio" === i || "checkbox" === i ? s[0] : e; 8566 8567 s.forEach(function (e) { 8568 var _t7; 8569 8570 c(e, (_t7 = {}, _defineProperty(_t7, _this6.opts.eleValidClass, false), _defineProperty(_t7, _this6.opts.eleInvalidClass, false), _t7)); 8571 }); 8572 var a = this.containers.get(_l4); 8573 8574 if (a) { 8575 var _t8; 8576 8577 c(a, (_t8 = {}, _defineProperty(_t8, this.opts.rowInvalidClass, false), _defineProperty(_t8, this.opts.rowValidatingClass, false), _defineProperty(_t8, this.opts.rowValidClass, false), _t8)); 8578 } 8579 } 8580 }, { 8581 key: "onElementValidated", 8582 value: function onElementValidated(e) { 8583 var _this7 = this; 8584 8585 var s = e.elements; 8586 var i = e.element.getAttribute("type"); 8587 8588 var _l5 = "radio" === i || "checkbox" === i ? s[0] : e.element; 8589 8590 s.forEach(function (s) { 8591 var _t9; 8592 8593 c(s, (_t9 = {}, _defineProperty(_t9, _this7.opts.eleValidClass, e.valid), _defineProperty(_t9, _this7.opts.eleInvalidClass, !e.valid), _t9)); 8594 }); 8595 var a = this.containers.get(_l5); 8596 8597 if (a) { 8598 if (!e.valid) { 8599 var _t10; 8600 8601 this.results.set(_l5, false); 8602 c(a, (_t10 = {}, _defineProperty(_t10, this.opts.rowInvalidClass, true), _defineProperty(_t10, this.opts.rowValidatingClass, false), _defineProperty(_t10, this.opts.rowValidClass, false), _t10)); 8603 } else { 8604 this.results["delete"](_l5); 8605 var _e2 = true; 8606 this.containers.forEach(function (t, s) { 8607 if (t === a && _this7.results.get(s) === false) { 8608 _e2 = false; 8609 } 8610 }); 8611 8612 if (_e2) { 8613 var _t11; 8614 8615 c(a, (_t11 = {}, _defineProperty(_t11, this.opts.rowInvalidClass, false), _defineProperty(_t11, this.opts.rowValidatingClass, false), _defineProperty(_t11, this.opts.rowValidClass, true), _t11)); 8616 } 8617 } 8618 } 8619 } 8620 }]); 8621 8622 return l; 8623 }(t$4); 8624 8625 var i$2 = /*#__PURE__*/function (_e) { 8626 _inherits(i, _e); 8627 8628 var _super = _createSuper(i); 8629 8630 function i(e) { 8631 var _this; 8632 8633 _classCallCheck(this, i); 8634 8635 _this = _super.call(this, e); 8636 _this.icons = new Map(); 8637 _this.opts = Object.assign({}, { 8638 invalid: "fv-plugins-icon--invalid", 8639 onPlaced: function onPlaced() {}, 8640 onSet: function onSet() {}, 8641 valid: "fv-plugins-icon--valid", 8642 validating: "fv-plugins-icon--validating" 8643 }, e); 8644 _this.elementValidatingHandler = _this.onElementValidating.bind(_assertThisInitialized(_this)); 8645 _this.elementValidatedHandler = _this.onElementValidated.bind(_assertThisInitialized(_this)); 8646 _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_assertThisInitialized(_this)); 8647 _this.elementIgnoredHandler = _this.onElementIgnored.bind(_assertThisInitialized(_this)); 8648 _this.fieldAddedHandler = _this.onFieldAdded.bind(_assertThisInitialized(_this)); 8649 return _this; 8650 } 8651 8652 _createClass(i, [{ 8653 key: "install", 8654 value: function install() { 8655 this.core.on("core.element.validating", this.elementValidatingHandler).on("core.element.validated", this.elementValidatedHandler).on("core.element.notvalidated", this.elementNotValidatedHandler).on("core.element.ignored", this.elementIgnoredH
8655andler).on("core.field.added", this.fieldAddedHandler); 8656 } 8657 }, { 8658 key: "uninstall", 8659 value: function uninstall() { 8660 this.icons.forEach(function (e) { 8661 return e.parentNode.removeChild(e); 8662 }); 8663 this.icons.clear(); 8664 this.core.off("core.element.validating", this.elementValidatingHandler).off("core.element.validated", this.elementValidatedHandler).off("core.element.notvalidated", this.elementNotValidatedHandler).off("core.element.ignored", this.elementIgnoredHandler).off("core.field.added", this.fieldAddedHandler); 8665 } 8666 }, { 8667 key: "onFieldAdded", 8668 value: function onFieldAdded(e) { 8669 var _this2 = this; 8670 8671 var t = e.elements; 8672 8673 if (t) { 8674 t.forEach(function (e) { 8675 var t = _this2.icons.get(e); 8676 8677 if (t) { 8678 t.parentNode.removeChild(t); 8679 8680 _this2.icons["delete"](e); 8681 } 8682 }); 8683 this.prepareFieldIcon(e.field, t); 8684 } 8685 } 8686 }, { 8687 key: "prepareFieldIcon", 8688 value: function prepareFieldIcon(e, t) { 8689 var _this3 = this; 8690 8691 if (t.length) { 8692 var _i8 = t[0].getAttribute("type"); 8693 8694 if ("radio" === _i8 || "checkbox" === _i8) { 8695 this.prepareElementIcon(e, t[0]); 8696 } else { 8697 t.forEach(function (t) { 8698 return _this3.prepareElementIcon(e, t); 8699 }); 8700 } 8701 } 8702 } 8703 }, { 8704 key: "prepareElementIcon", 8705 value: function prepareElementIcon(e, _i2) { 8706 var n = document.createElement("i"); 8707 n.setAttribute("data-field", e); 8708 8709 _i2.parentNode.insertBefore(n, _i2.nextSibling); 8710 8711 c(n, { 8712 "fv-plugins-icon": true 8713 }); 8714 var l = { 8715 classes: { 8716 invalid: this.opts.invalid, 8717 valid: this.opts.valid, 8718 validating: this.opts.validating 8719 }, 8720 element: _i2, 8721 field: e, 8722 iconElement: n 8723 }; 8724 this.core.emit("plugins.icon.placed", l); 8725 this.opts.onPlaced(l); 8726 this.icons.set(_i2, n); 8727 } 8728 }, { 8729 key: "onElementValidating", 8730 value: function onElementValidating(e) { 8731 var _this$setClasses; 8732 8733 var t = this.setClasses(e.field, e.element, e.elements, (_this$setClasses = {}, _defineProperty(_this$setClasses, this.opts.invalid, false), _defineProperty(_this$setClasses, this.opts.valid, false), _defineProperty(_this$setClasses, this.opts.validating, true), _this$setClasses)); 8734 var _i3 = { 8735 element: e.element, 8736 field: e.field, 8737 iconElement: t, 8738 status: "Validating" 8739 }; 8740 this.core.emit("plugins.icon.set", _i3); 8741 this.opts.onSet(_i3); 8742 } 8743 }, { 8744 key: "onElementValidated", 8745 value: function onElementValidated(e) { 8746 var _this$setClasses2; 8747 8748 var t = this.setClasses(e.field, e.element, e.elements, (_this$setClasses2 = {}, _defineProperty(_this$setClasses2, this.opts.invalid, !e.valid), _defineProperty(_this$setClasses2, this.opts.valid, e.valid), _defineProperty(_this$setClasses2, this.opts.validating, false), _this$setClasses2)); 8749 var _i4 = { 8750 element: e.element, 8751 field: e.field, 8752 iconElement: t, 8753 status: e.valid ? "Valid" : "Invalid" 8754 }; 8755 this.core.emit("plugins.icon.set", _i4); 8756 this.opts.onSet(_i4); 8757 } 8758 }, { 8759 key: "onElementNotValidated", 8760 value: function onElementNotValidated(e) { 8761 var _this$setClasses3; 8762 8763 var t = this.setClasses(e.field, e.element, e.elements, (_this$setClasses3 = {}, _defineProperty(_this$setClasses3, this.opts.invalid, false), _defineProperty(_this$setClasses3, this.opts.valid, false), _defineProperty(_this$setClasses3, this.opts.validating, false), _this$setClasses3)); 8764 var _i5 = { 8765 element: e.element, 8766 field: e.field, 8767 iconElement: t, 8768 status: "NotValidated" 8769 }; 8770 this.core.emit("plugins.icon.set", _i5); 8771 this.opts.onSet(_i5); 8772 } 8773 }, {
8774 key: "onElementIgnored", 8775 value: function onElementIgnored(e) { 8776 var _this$setClasses4; 8777 8778 var t = this.setClasses(e.field, e.element, e.elements, (_this$setClasses4 = {}, _defineProperty(_this$setClasses4, this.opts.invalid, false), _defineProperty(_this$setClasses4, this.opts.valid, false), _defineProperty(_this$setClasses4, this.opts.validating, false), _this$setClasses4)); 8779 var _i6 = { 8780 element: e.element, 8781 field: e.field, 8782 iconElement: t, 8783 status: "Ignored" 8784 }; 8785 this.core.emit("plugins.icon.set", _i6); 8786 this.opts.onSet(_i6); 8787 } 8788 }, { 8789 key: "setClasses", 8790 value: function setClasses(e, _i7, n, l) { 8791 var s = _i7.getAttribute("type"); 8792 8793 var d = "radio" === s || "checkbox" === s ? n[0] : _i7; 8794 8795 if (this.icons.has(d)) { 8796 var _e2 = this.icons.get(d); 8797 8798 c(_e2, l); 8799 return _e2; 8800 } else { 8801 return null; 8802 } 8803 } 8804 }]); 8805 8806 return i; 8807 }(t$4); 8808 8809 var i$1 = /*#__PURE__*/function (_e) { 8810 _inherits(i, _e); 8811 8812 var _super = _createSuper(i); 8813 8814 function i(e) { 8815 var _this; 8816 8817 _classCallCheck(this, i); 8818 8819 _this = _super.call(this, e); 8820 _this.invalidFields = new Map(); 8821 _this.opts = Object.assign({}, { 8822 enabled: true 8823 }, e); 8824 _this.validatorHandler = _this.onValidatorValidated.bind(_assertThisInitialized(_this)); 8825 _this.shouldValidateFilter = _this.shouldValidate.bind(_assertThisInitialized(_this)); 8826 _this.fieldAddedHandler = _this.onFieldAdded.bind(_assertThisInitialized(_this)); 8827 _this.elementNotValidatedHandler = _this.onElementNotValidated.bind(_assertThisInitialized(_this)); 8828 _this.elementValidatingHandler = _this.onElementValidating.bind(_assertThisInitialized(_this)); 8829 return _this; 8830 } 8831 8832 _createClass(i, [{ 8833 key: "install", 8834 value: function install() { 8835 this.core.on("core.validator.validated", this.validatorHandler).on("core.field.added", this.fieldAddedHandler).on("core.element.notvalidated", this.elementNotValidatedHandler).on("core.element.validating", this.elementValidatingHandler).registerFilter("field-should-validate", this.shouldValidateFilter); 8836 } 8837 }, { 8838 key: "uninstall", 8839 value: function uninstall() { 8840 this.invalidFields.clear(); 8841 this.core.off("core.validator.validated", this.validatorHandler).off("core.field.added", this.fieldAddedHandler).off("core.element.notvalidated", this.elementNotValidatedHandler).off("core.element.validating", this.elementValidatingHandler).deregisterFilter("field-should-validate", this.shouldValidateFilter); 8842 } 8843 }, { 8844 key: "shouldValidate", 8845 value: function shouldValidate(e, _i, t, l) { 8846 var d = (this.opts.enabled === true || this.opts.enabled[e] === true) && this.invalidFields.has(_i) && !!this.invalidFields.get(_i).length && this.invalidFields.get(_i).indexOf(l) === -1; 8847 return !d; 8848 } 8849 }, { 8850 key: "onValidatorValidated", 8851 value: function onValidatorValidated(e) { 8852 var _i2 = this.invalidFields.has(e.element) ? this.invalidFields.get(e.element) : []; 8853 8854 var t = _i2.indexOf(e.validator); 8855 8856 if (e.result.valid && t >= 0) { 8857 _i2.splice(t, 1); 8858 } else if (!e.result.valid && t === -1) { 8859 _i2.push(e.validator); 8860 } 8861 8862 this.invalidFields.set(e.element, _i2); 8863 } 8864 }, { 8865 key: "onFieldAdded", 8866 value: function onFieldAdded(e) { 8867 if (e.elements) { 8868 this.clearInvalidFields(e.elements); 8869 } 8870 } 8871 }, { 8872 key: "onElementNotValidated", 8873 value: function onElementNotValidated(e) { 8874 this.clearInvalidFields(e.elements); 8875 } 8876 }, { 8877 key: "onElementValidating", 8878 value: function onElementValidating(e) { 8879 this.clearInvalidFields(e.elements); 8880 } 8881 }, { 8882 key: "clearInvalidFields", 8883 value: function clearInvalidFields(e) { 8884 var _this2 = this; 8885 8886 e.forEach(function (e) { 8887 return _this2.invalidFields["delete"](e); 8888 }); 8889 } 8890 }]); 8891 8892 return i; 8893 }(t$4); 8894 8895 var e = /*#__PURE__*/function (_t) { 8896 _inherits(e, _t); 8897 8898 var _super = _createSuper(e); 8899 8900 function e(t) { 8901 var _this; 8902 8903 _classCallCheck(this, e); 8904 8905 _this = _super.call(this, t); 8906 _this.isFormValid = false;
8907 _this.opts = Object.assign({}, { 8908 aspNetButton: false, 8909 buttons: function buttons(t) { 8910 return [].slice.call(t.querySelectorAll('[type="submit"]:not([formnovalidate])')); 8911 } 8912 }, t); 8913 _this.submitHandler = _this.handleSubmitEvent.bind(_assertThisInitialized(_this)); 8914 _this.buttonClickHandler = _this.handleClickEvent.bind(_assertThisInitialized(_this)); 8915 return _this; 8916 } 8917 8918 _createClass(e, [{ 8919 key: "install", 8920 value: function install() { 8921 var _this2 = this; 8922 8923 if (!(this.core.getFormElement() instanceof HTMLFormElement)) { 8924 return; 8925 } 8926 8927 var t = this.core.getFormElement(); 8928 this.submitButtons = this.opts.buttons(t); 8929 t.setAttribute("novalidate", "novalidate"); 8930 t.addEventListener("submit", this.submitHandler); 8931 this.hiddenClickedEle = document.createElement("input"); 8932 this.hiddenClickedEle.setAttribute("type", "hidden"); 8933 t.appendChild(this.hiddenClickedEle); 8934 this.submitButtons.forEach(function (t) { 8935 t.addEventListener("click", _this2.buttonClickHandler); 8936 }); 8937 } 8938 }, { 8939 key: "uninstall", 8940 value: function uninstall() { 8941 var _this3 = this; 8942 8943 var t = this.core.getFormElement(); 8944 8945 if (t instanceof HTMLFormElement) { 8946 t.removeEventListener("submit", this.submitHandler); 8947 } 8948 8949 this.submitButtons.forEach(function (t) { 8950 t.removeEventListener("click", _this3.buttonClickHandler); 8951 }); 8952 this.hiddenClickedEle.parentElement.removeChild(this.hiddenClickedEle); 8953 } 8954 }, { 8955 key: "handleSubmitEvent", 8956 value: function handleSubmitEvent(t) { 8957 this.validateForm(t); 8958 } 8959 }, { 8960 key: "handleClickEvent", 8961 value: function handleClickEvent(t) { 8962 var _e = t.currentTarget; 8963 8964 if (_e instanceof HTMLElement) { 8965 if (this.opts.aspNetButton && this.isFormValid === true) ; else { 8966 var _e3 = this.core.getFormElement(); 8967 8968 _e3.removeEventListener("submit", this.submitHandler); 8969 8970 this.clickedButton = t.target; 8971 var i = this.clickedButton.getAttribute("name"); 8972 var s = this.clickedButton.getAttribute("value"); 8973 8974 if (i && s) { 8975 this.hiddenClickedEle.setAttribute("name", i); 8976 this.hiddenClickedEle.setAttribute("value", s); 8977 } 8978 8979 this.validateForm(t); 8980 } 8981 } 8982 } 8983 }, { 8984 key: "validateForm", 8985 value: function validateForm(t) { 8986 var _this4 = this; 8987 8988 t.preventDefault(); 8989 this.core.validate().then(function (t) { 8990 if (t === "Valid" && _this4.opts.aspNetButton && !_this4.isFormValid && _this4.clickedButton) { 8991 _this4.isFormValid = true; 8992 8993 _this4.clickedButton.removeEventListener("click", _this4.buttonClickHandler); 8994 8995 _this4.clickedButton.click(); 8996 } 8997 }); 8998 } 8999 }]); 9000 9001 return e; 9002 }(t$4); 9003 9004 var i = /*#__PURE__*/function (_t) { 9005 _inherits(i, _t); 9006 9007 var _super = _createSuper(i); 9008 9009 function i(t) { 9010 var _this; 9011 9012 _classCallCheck(this, i); 9013 9014 _this = _super.call(this, t); 9015 _this.messages = new Map(); 9016 _this.opts = Object.assign({}, { 9017 placement: "top", 9018 trigger: "click" 9019 }, t); 9020 _this.iconPlacedHandler = _this.onIconPlaced.bind(_assertThisInitialized(_this)); 9021 _this.validatorValidatedHandler = _this.onValidatorValidated.bind(_assertThisInitialized(_this)); 9022 _this.elementValidatedHandler = _this.onElementValidated.bind(_assertThisInitialized(_this)); 9023 _this.documentClickHandler = _this.onDocumentClicked.bind(_assertThisInitialized(_this)); 9024 return _this; 9025 } 9026 9027 _createClass(i, [{ 9028 key: "install", 9029 value: function install() { 9030 this.tip = document.createElement("div"); 9031 c(this.tip, _defineProperty({ 9032 "fv-plugins-tooltip": true 9033 }, "fv-plugins-tooltip--".concat(this.opts.placement), true)); 9034 document.body.appendChild(this.tip); 9035 this.core.on("plugins.icon.placed", this.iconPlacedHandler).on("core.validator.validated", this.validatorValidatedHandler).on("core.element.validated", this.elementValidatedHandler); 9036 9037 if ("click" === this.opts.trigger) { 9038 document.addEventListener("click", this.documentClickHandler); 9039 } 9040 } 9041 }, {
9042 key: "uninstall", 9043 value: function uninstall() { 9044 this.messages.clear(); 9045 document.body.removeChild(this.tip); 9046 this.core.off("plugins.icon.placed", this.iconPlacedHandler).off("core.validator.validated", this.validatorValidatedHandler).off("core.element.validated", this.elementValidatedHandler); 9047 9048 if ("click" === this.opts.trigger) { 9049 document.removeEventListener("click", this.documentClickHandler); 9050 } 9051 } 9052 }, { 9053 key: "onIconPlaced", 9054 value: function onIconPlaced(t) { 9055 var _this2 = this; 9056 9057 c(t.iconElement, { 9058 "fv-plugins-tooltip-icon": true 9059 }); 9060 9061 switch (this.opts.trigger) { 9062 case "hover": 9063 t.iconElement.addEventListener("mouseenter", function (e) { 9064 return _this2.show(t.element, e); 9065 }); 9066 t.iconElement.addEventListener("mouseleave", function (t) { 9067 return _this2.hide(); 9068 }); 9069 break; 9070 9071 case "click": 9072 default: 9073 t.iconElement.addEventListener("click", function (e) { 9074 return _this2.show(t.element, e); 9075 }); 9076 break; 9077 } 9078 } 9079 }, { 9080 key: "onValidatorValidated", 9081 value: function onValidatorValidated(t) { 9082 if (!t.result.valid) { 9083 var _e2 = t.elements; 9084 9085 var _i4 = t.element.getAttribute("type"); 9086 9087 var s = "radio" === _i4 || "checkbox" === _i4 ? _e2[0] : t.element; 9088 var o = typeof t.result.message === "string" ? t.result.message : t.result.message[this.core.getLocale()]; 9089 this.messages.set(s, o); 9090 } 9091 } 9092 }, { 9093 key: "onElementValidated", 9094 value: function onElementValidated(t) { 9095 if (t.valid) { 9096 var _e3 = t.elements; 9097 9098 var _i5 = t.element.getAttribute("type"); 9099 9100 var s = "radio" === _i5 || "checkbox" === _i5 ? _e3[0] : t.element; 9101 this.messages["delete"](s); 9102 } 9103 } 9104 }, { 9105 key: "onDocumentClicked", 9106 value: function onDocumentClicked(t) { 9107 this.hide(); 9108 } 9109 }, { 9110 key: "show", 9111 value: function show(t, _i3) { 9112 _i3.preventDefault(); 9113 9114 _i3.stopPropagation(); 9115 9116 if (!this.messages.has(t)) { 9117 return; 9118 } 9119 9120 c(this.tip, { 9121 "fv-plugins-tooltip--hide": false 9122 }); 9123 this.tip.innerHTML = "<div class=\"fv-plugins-tooltip__content\">".concat(this.messages.get(t), "</div>"); 9124 var s = _i3.target; 9125 var o = s.getBoundingClientRect(); 9126 9127 var _this$tip$getBounding = this.tip.getBoundingClientRect(), 9128 l = _this$tip$getBounding.height, 9129 n = _this$tip$getBounding.width; 9130 9131 var a = 0; 9132 var d = 0; 9133 9134 switch (this.opts.placement) { 9135 case "bottom": 9136 a = o.top + o.height; 9137 d = o.left + o.width / 2 - n / 2; 9138 break; 9139 9140 case "bottom-left": 9141 a = o.top + o.height; 9142 d = o.left; 9143 break; 9144 9145 case "bottom-right": 9146 a = o.top + o.height; 9147 d = o.left + o.width - n; 9148 break; 9149 9150 case "left": 9151 a = o.top + o.height / 2 - l / 2; 9152 d = o.left - n; 9153 break; 9154 9155 case "right": 9156 a = o.top + o.height / 2 - l / 2; 9157 d = o.left + o.width; 9158 break; 9159 9160 case "top-left": 9161 a = o.top - l; 9162 d = o.left; 9163 break; 9164 9165 case "top-right": 9166 a = o.top - l; 9167 d = o.left + o.width - n; 9168 break; 9169 9170 case "top": 9171 default: 9172 a = o.top - l; 9173 d = o.left + o.width / 2 - n / 2; 9174 break; 9175 } 9176 9177 var c$1 = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0; 9178 var r = window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0; 9179 a = a + c$1; 9180 d = d + r; 9181 this.tip.setAttribute("style", "top: ".concat(a, "px; left: ").concat(d, "px")); 9182 } 9183 }, {
9184 key: "hide", 9185 value: function hide() { 9186 c(this.tip, { 9187 "fv-plugins-tooltip--hide": true 9188 }); 9189 } 9190 }]); 9191 9192 return i; 9193 }(t$4); 9194 9195 var t = /*#__PURE__*/function (_e) { 9196 _inherits(t, _e); 9197 9198 var _super = _createSuper(t); 9199 9200 function t(e) { 9201 var _this; 9202 9203 _classCallCheck(this, t); 9204 9205 _this = _super.call(this, e); 9206 _this.handlers = []; 9207 _this.timers = new Map(); 9208 9209 var _t = document.createElement("div"); 9210 9211 _this.defaultEvent = !("oninput" in _t) ? "keyup" : "input"; 9212 _this.opts = Object.assign({}, { 9213 delay: 0, 9214 event: _this.defaultEvent, 9215 threshold: 0 9216 }, e); 9217 _this.fieldAddedHandler = _this.onFieldAdded.bind(_assertThisInitialized(_this)); 9218 _this.fieldRemovedHandler = _this.onFieldRemoved.bind(_assertThisInitialized(_this)); 9219 return _this; 9220 } 9221 9222 _createClass(t, [{ 9223 key: "install", 9224 value: function install() { 9225 this.core.on("core.field.added", this.fieldAddedHandler).on("core.field.removed", this.fieldRemovedHandler); 9226 } 9227 }, { 9228 key: "uninstall", 9229 value: function uninstall() { 9230 this.handlers.forEach(function (e) { 9231 return e.element.removeEventListener(e.event, e.handler); 9232 }); 9233 this.handlers = []; 9234 this.timers.forEach(function (e) { 9235 return window.clearTimeout(e); 9236 }); 9237 this.timers.clear(); 9238 this.core.off("core.field.added", this.fieldAddedHandler).off("core.field.removed", this.fieldRemovedHandler); 9239 } 9240 }, { 9241 key: "prepareHandler", 9242 value: function prepareHandler(e, _t2) { 9243 var _this2 = this; 9244 9245 _t2.forEach(function (_t3) { 9246 var i = []; 9247 9248 if (!!_this2.opts.event && _this2.opts.event[e] === false) { 9249 i = []; 9250 } else if (!!_this2.opts.event && !!_this2.opts.event[e] && typeof _this2.opts.event[e] !== "function") { 9251 i = _this2.opts.event[e].split(" "); 9252 } else if ("string" === typeof _this2.opts.event && _this2.opts.event !== _this2.defaultEvent) { 9253 i = _this2.opts.event.split(" "); 9254 } else { 9255 var _e2 = _t3.getAttribute("type"); 9256 9257 var s = _t3.tagName.toLowerCase(); 9258 9259 var n = "radio" === _e2 || "checkbox" === _e2 || "file" === _e2 || "select" === s ? "change" : _this2.ieVersion >= 10 && _t3.getAttribute("placeholder") ? "keyup" : _this2.defaultEvent; 9260 i = [n]; 9261 } 9262 9263 i.forEach(function (i) { 9264 var s = function s(i) { 9265 return _this2.handleEvent(i, e, _t3); 9266 }; 9267 9268 _this2.handlers.push({ 9269 element: _t3, 9270 event: i, 9271 field: e, 9272 handler: s 9273 }); 9274 9275 _t3.addEventListener(i, s); 9276 }); 9277 }); 9278 } 9279 }, { 9280 key: "handleEvent", 9281 value: function handleEvent(e, _t4, i) { 9282 var _this3 = this; 9283 9284 if (this.exceedThreshold(_t4, i) && this.core.executeFilter("plugins-trigger-should-validate", true, [_t4, i])) { 9285 var s = function s() { 9286 return _this3.core.validateElement(_t4, i).then(function (s) { 9287 _this3.core.emit("plugins.trigger.executed", { 9288 element: i, 9289 event: e, 9290 field: _t4 9291 }); 9292 }); 9293 }; 9294 9295 var n = this.opts.delay[_t4] || this.opts.delay; 9296 9297 if (n === 0) { 9298 s(); 9299 } else { 9300 var _e3 = this.timers.get(i); 9301 9302 if (_e3) { 9303 window.clearTimeout(_e3); 9304 } 9305 9306 this.timers.set(i, window.setTimeout(s, n * 1e3)); 9307 } 9308 } 9309 } 9310 }, { 9311 key: "onFieldAdded", 9312 value: function onFieldAdded(e) { 9313 this.handlers.filter(function (_t5) { 9314 return _t5.field === e.field; 9315 }
9315).forEach(function (e) { 9316 return e.element.removeEventListener(e.event, e.handler); 9317 }); 9318 this.prepareHandler(e.field, e.elements); 9319 } 9320 }, { 9321 key: "onFieldRemoved", 9322 value: function onFieldRemoved(e) { 9323 this.handlers.filter(function (_t6) { 9324 return _t6.field === e.field && e.elements.indexOf(_t6.element) >= 0; 9325 }).forEach(function (e) { 9326 return e.element.removeEventListener(e.event, e.handler); 9327 }); 9328 } 9329 }, { 9330 key: "exceedThreshold", 9331 value: function exceedThreshold(e, _t7) { 9332 var i = this.opts.threshold[e] === 0 || this.opts.threshold === 0 ? false : this.opts.threshold[e] || this.opts.threshold; 9333 9334 if (!i) { 9335 return true; 9336 } 9337 9338 var s = _t7.getAttribute("type"); 9339 9340 if (["button", "checkbox", "file", "hidden", "image", "radio", "reset", "submit"].indexOf(s) !== -1) { 9341 return true; 9342 } 9343 9344 var n = this.core.getElementValue(e, _t7); 9345 return n.length >= i; 9346 } 9347 }]); 9348 9349 return t; 9350 }(t$4); 9351 9352 var index$1 = { 9353 Alias: e$4, 9354 Aria: i$3, 9355 Declarative: t$3, 9356 DefaultSubmit: o, 9357 Dependency: e$3, 9358 Excluded: e$2, 9359 FieldStatus: t$2, 9360 Framework: l, 9361 Icon: i$2, 9362 Message: s$1, 9363 Sequence: i$1, 9364 SubmitButton: e, 9365 Tooltip: i, 9366 Trigger: t 9367 }; 9368 9369 function s(s, t) { 9370 return s.classList ? s.classList.contains(t) : new RegExp("(^| )".concat(t, "( |$)"), "gi").test(s.className); 9371 } 9372 9373 var index = { 9374 call: t$$, 9375 classSet: c, 9376 closest: t$1, 9377 fetch: t$V, 9378 format: r$d, 9379 hasClass: s, 9380 isValidDate: t$Y 9381 }; 9382 9383 var p = {}; 9384 9385 exports.Plugin = t$4; 9386 exports.algorithms = index$3; 9387 exports.filters = index$2; 9388 exports.formValidation = r; 9389 exports.locales = p; 9390 exports.plugins = index$1; 9391 exports.utils = index; 9392 exports.validators = s$3; 9393 9394 Object.defineProperty(exports, '__esModule', { value: true }); 9395 9396}));
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.