1/* 2 * International Telephone Input v25.3.1 3 * https://github.com/jackocnr/intl-tel-input.git 4 * Licensed under the MIT license 5 */ 6 7// UMD 8(function (factory) { 9 if (typeof module === 'object' && module.exports) { 10 module.exports = factory(); 11 } else { 12 window.intlTelInput = factory(); 13 } 14})(() => { 15 var factoryOutput = (() => { 16 var L = Object.defineProperty; 17 var H = Object.getOwnPropertyDescriptor; 18 var O = Object.getOwnPropertyNames; 19 var R = Object.prototype.hasOwnProperty; 20 var F = (l, t) => { 21 for (var e in t) L(l, e, { get: t[e], enumerable: !0 }); 22 }, 23 B = (l, t, e, i) => { 24 if ((t && typeof t == 'object') || typeof t == 'function') 25 for (let n of O(t)) 26 !R.call(l, n) && 27 n !== e && 28 L(l, n, { get: () => t[n], enumerable: !(i = H(t, n)) || i.enumerable }); 29 return l; 30 }; 31 var j = (l) => B(L({}, '__esModule', { value: !0 }), l); 32 var Y = {}; 33 F(Y, { Iti: () => w, default: () => q }); 34 var D = [ 35 ['af', '93'], 36 ['ax', '358', 1], 37 ['al', '355'], 38 ['dz', '213'], 39 ['as', '1', 5, ['684']], 40 ['ad', '376'], 41 ['ao', '244'], 42 ['ai', '1', 6, ['264']], 43 ['ag', '1', 7, ['268']], 44 ['ar', '54'], 45 ['am', '374'], 46 ['aw', '297'], 47 ['ac', '247'], 48 ['au', '61', 0, null, '0'], 49 ['at', '43'], 50 ['az', '994'], 51 ['bs', '1', 8, ['242']], 52 ['bh', '973'], 53 ['bd', '880'], 54 ['bb', '1', 9, ['246']], 55 ['by', '375'], 56 ['be', '32'], 57 ['bz', '501'], 58 ['bj', '229'], 59 ['bm', '1', 10, ['441']], 60 ['bt', '975'], 61 ['bo', '591'], 62 ['ba', '387'], 63 ['bw', '267'], 64 ['br', '55'], 65 ['io', '246'], 66 ['vg', '1', 11, ['284']], 67 ['bn', '673'], 68 ['bg', '359'], 69 ['bf', '226'], 70 ['bi', '257'], 71 ['kh', '855'], 72 ['cm', '237'], 73 [ 74 'ca', 75 '1', 76 1, 77 [ 78 '204', 79 '226', 80 '236', 81 '249', 82 '250', 83 '263', 84 '289', 85 '306', 86 '343', 87 '354', 88 '365', 89 '367', 90 '368', 91 '382', 92 '387', 93 '403', 94 '416', 95 '418', 96 '428', 97 '431', 98 '437', 99 '438', 100 '450', 101 '584', 102 '468', 103 '474', 104 '506', 105 '514', 106 '519', 107 '548', 108 '579', 109 '581', 110 '584', 111 '587', 112 '604', 113 '613', 114 '639', 115 '647', 116 '672', 117 '683', 118 '705', 119 '709', 120 '742', 121 '753', 122 '778', 123 '780', 124 '782', 125 '807', 126 '819', 127 '825', 128 '867', 129 '873', 130 '879', 131 '902', 132 '905', 133 ], 134 ], 135 ['cv', '238'], 136 ['bq', '599', 1, ['3', '4', '7']], 137 ['ky', '1', 12, ['345']], 138 ['cf', '236'], 139 ['td', '235'], 140 ['cl', '56'], 141 ['cn', '86'], 142 ['cx', '61', 2, ['89164'], '0'], 143 ['cc', '61', 1, ['89162'], '0'], 144 ['co', '57'], 145 ['km', '269'], 146 ['cg', '242'], 147 ['cd', '243'], 148 ['ck', '682'], 149 ['cr', '506'], 150 ['ci', '225'], 151 ['hr', '385'], 152 ['cu', '53'], 153 ['cw', '599', 0], 154 ['cy', '357'], 155 ['cz', '420'], 156 ['dk', '45'], 157 ['dj', '253'], 158 ['dm', '1', 13, ['767']], 159 ['do', '1', 2, ['809', '829', '849']], 160 ['ec', '593'], 161 ['eg', '20'], 162 ['sv', '503'], 163 ['gq', '240'], 164 ['er', '291'], 165 ['ee', '372'], 166 ['sz', '268'], 167 ['et', '251'], 168 ['fk', '500'], 169 ['fo', '298'], 170 ['fj', '679'], 171 ['fi', '358', 0], 172 ['fr', '33'], 173 ['gf', '594'], 174 ['pf', '689'], 175 ['ga', '241'], 176 ['gm', '220'], 177 ['ge', '995'], 178 ['de', '49'], 179 ['gh', '233'], 180 ['gi', '350'], 181 ['gr', '30'], 182 ['gl', '299'], 183 ['gd', '1', 14, ['473']], 184 ['gp', '590', 0], 185 ['gu', '1', 15, ['671']], 186 ['gt', '502'], 187 ['gg', '44', 1, ['1481', '7781', '7839', '7911'], '0'], 188 ['gn', '224'], 189 ['gw', '245'], 190 ['gy', '592'], 191 ['ht', '509'], 192 ['hn', '504'], 193 ['hk', '852'], 194 ['hu', '36'], 195 ['is', '354'], 196 ['in', '91'], 197 ['id', '62'], 198 ['ir', '98'], 199 ['iq', '964'], 200 ['ie', '353'], 201 ['im', '44', 2, ['1624', '74576', '7524', '7924', '7624'], '0'], 202 ['il', '972'], 203 ['it', '39', 0], 204 ['jm', '1', 4, ['876', '658']], 205 ['jp', '81'], 206 ['je', '44', 3, ['1534', '7509', '7700', '7797', '7829', '7937'], '0'], 207 ['jo', '962'], 208 ['kz', '7', 1, ['33', '7'], '8'], 209 ['ke', '254'], 210 ['ki', '686'], 211 ['xk', '383'], 212 ['kw', '965'], 213 ['kg', '996'], 214 ['la', '856'], 215 ['lv', '371'], 216 ['lb', '961'], 217 ['ls', '266'], 218 ['lr', '231'], 219 ['ly', '218'], 220 ['li', '423'], 221 ['lt', '370'], 222 ['lu', '352'], 223 ['mo', '853'], 224 ['mg', '261'], 225 ['mw', '265'], 226 ['my', '60'], 227 ['mv', '960'], 228 ['ml', '223'], 229 ['mt', '356'], 230 ['mh', '692'], 231 ['mq', '596'], 232 ['mr', '222'], 233 ['mu', '230'], 234 ['yt', '262', 1, ['269', '639'], '0'], 235 ['mx', '52'], 236 ['fm', '691'], 237 ['md', '373'], 238 ['mc', '377'], 239 ['mn', '976'], 240 ['me', '382'], 241 ['ms', '1', 16, ['664']], 242 ['ma', '212', 0, null, '0'], 243 ['mz', '258'], 244 ['mm', '95'], 245 ['na', '264'],
246 ['nr', '674'], 247 ['np', '977'], 248 ['nl', '31'], 249 ['nc', '687'], 250 ['nz', '64'], 251 ['ni', '505'], 252 ['ne', '227'], 253 ['ng', '234'], 254 ['nu', '683'], 255 ['nf', '672'], 256 ['kp', '850'], 257 ['mk', '389'], 258 ['mp', '1', 17, ['670']], 259 ['no', '47', 0], 260 ['om', '968'], 261 ['pk', '92'], 262 ['pw', '680'], 263 ['ps', '970'], 264 ['pa', '507'], 265 ['pg', '675'], 266 ['py', '595'], 267 ['pe', '51'], 268 ['ph', '63'], 269 ['pl', '48'], 270 ['pt', '351'], 271 ['pr', '1', 3, ['787', '939']], 272 ['qa', '974'], 273 ['re', '262', 0, null, '0'], 274 ['ro', '40'], 275 ['ru', '7', 0, null, '8'], 276 ['rw', '250'], 277 ['ws', '685'], 278 ['sm', '378'], 279 ['st', '239'], 280 ['sa', '966'], 281 ['sn', '221'], 282 ['rs', '381'], 283 ['sc', '248'], 284 ['sl', '232'], 285 ['sg', '65'], 286 ['sx', '1', 21, ['721']], 287 ['sk', '421'], 288 ['si', '386'], 289 ['sb', '677'], 290 ['so', '252'], 291 ['za', '27'], 292 ['kr', '82'], 293 ['ss', '211'], 294 ['es', '34'], 295 ['lk', '94'], 296 ['bl', '590', 1], 297 ['sh', '290'], 298 ['kn', '1', 18, ['869']], 299 ['lc', '1', 19, ['758']], 300 ['mf', '590', 2], 301 ['pm', '508'], 302 ['vc', '1', 20, ['784']], 303 ['sd', '249'], 304 ['sr', '597'], 305 ['sj', '47', 1, ['79']], 306 ['se', '46'], 307 ['ch', '41'], 308 ['sy', '963'], 309 ['tw', '886'], 310 ['tj', '992'], 311 ['tz', '255'], 312 ['th', '66'], 313 ['tl', '670'], 314 ['tg', '228'], 315 ['tk', '690'], 316 ['to', '676'], 317 ['tt', '1', 22, ['868']], 318 ['tn', '216'], 319 ['tr', '90'], 320 ['tm', '993'], 321 ['tc', '1', 23, ['649']], 322 ['tv', '688'], 323 ['ug', '256'], 324 ['ua', '380'], 325 ['ae', '971'], 326 ['gb', '44', 0, null, '0'], 327 ['us', '1', 0], 328 ['uy', '598'], 329 ['vi', '1', 24, ['340']], 330 ['uz', '998'], 331 ['vu', '678'], 332 ['va', '39', 1, ['06698']], 333 ['ve', '58'], 334 ['vn', '84'], 335 ['wf', '681'], 336 ['eh', '212', 1, ['5288', '5289'], '0'], 337 ['ye', '967'], 338 ['zm', '260'], 339 ['zw', '263'], 340 ], 341 N = []; 342 for (let l = 0; l < D.length; l++) { 343 let t = D[l]; 344 N[l] = { 345 name: '', 346 iso2: t[0], 347 dialCode: t[1], 348 priority: t[2] || 0, 349 areaCodes: t[3] || null, 350 nodeById: {}, 351 nationalPrefix: t[4] || null, 352 }; 353 } 354 var f = N; 355 var U = { 356 ad: 'Andorra', 357 ae: 'United Arab Emirates', 358 af: 'Afghanistan', 359 ag: 'Antigua & Barbuda', 360 ai: 'Anguilla', 361 al: 'Albania', 362 am: 'Armenia', 363 ao: 'Angola', 364 ar: 'Argentina', 365 as: 'American Samoa', 366 at: 'Austria', 367 au: 'Australia', 368 aw: 'Aruba', 369 ax: '\xC5land Islands', 370 az: 'Azerbaijan', 371 ba: 'Bosnia & Herzegovina', 372 bb: 'Barbados', 373 bd: 'Bangladesh', 374 be: 'Belgium', 375 bf: 'Burkina Faso', 376 bg: 'Bulgaria', 377 bh: 'Bahrain', 378 bi: 'Burundi', 379 bj: 'Benin', 380 bl: 'St. Barth\xE9lemy', 381 bm: 'Bermuda', 382 bn: 'Brunei', 383 bo: 'Bolivia', 384 bq: 'Caribbean Netherlands', 385 br: 'Brazil', 386 bs: 'Bahamas', 387 bt: 'Bhutan', 388 bw: 'Botswana', 389 by: 'Belarus', 390 bz: 'Belize', 391 ca: 'Canada', 392 cc: 'Cocos (Keeling) Islands', 393 cd: 'Congo - Kinshasa', 394 cf: 'Central African Republic', 395 cg: 'Congo - Brazzaville', 396 ch: 'Switzerland', 397 ci: 'C\xF4te d\u2019Ivoire', 398 ck: 'Cook Islands', 399 cl: 'Chile', 400 cm: 'Cameroon', 401 cn: 'China', 402 co: 'Colombia', 403 cr: 'Costa Rica', 404 cu: 'Cuba', 405 cv: 'Cape Verde', 406 cw: 'Cura\xE7ao', 407 cx: 'Christmas Island', 408 cy: 'Cyprus', 409 cz: 'Czechia', 410 de: 'Germany', 411 dj: 'Djibouti', 412 dk: 'Denmark', 413 dm: 'Dominica', 414 do: 'Dominican Republic', 415 dz: 'Algeria', 416 ec: 'Ecuador', 417 ee: 'Estonia', 418 eg: 'Egypt', 419 eh: 'Western Sahara', 420 er: 'Eritrea', 421 es: 'Spain', 422 et: 'Ethiopia', 423 fi: 'Finland', 424 fj: 'Fiji', 425 fk: 'Falkland Islands', 426 fm: 'Micronesia', 427 fo: 'Faroe Islands', 428 fr: 'France', 429 ga: 'Gabon', 430 gb: 'United Kingdom', 431 gd: 'Grenada', 432 ge: 'Georgia', 433 gf: 'French Guiana', 434 gg: 'Guernsey', 435 gh: 'Ghana', 436 gi: 'Gibraltar', 437 gl: 'Greenland', 438 gm: 'Gambia', 439 gn: 'Guinea', 440 gp: 'Guadeloupe', 441 gq: 'Equatorial Guinea', 442 gr: 'Greece', 443 gt: 'Guatemala', 444 gu: 'Guam', 445 gw: 'Guinea-Bissau', 446 gy: 'Guyana', 447 hk: 'Hong Kong SAR China', 448 hn: 'Honduras', 449 hr: 'Croatia', 450 ht: 'Haiti', 451 hu: 'Hungary', 452 id: 'Indonesia', 453 ie: 'Ireland', 454 il: 'Israel', 455 im: 'Isle of Man', 456 in: 'India', 457 io: 'British Indian Ocean Territory', 458 iq: 'Iraq', 459 ir: 'Iran', 460 is: 'Iceland', 461 it: 'Italy', 462 je: 'Jersey', 463 jm: 'Jamaica', 464 jo: 'Jordan', 465 jp: 'Japan', 466 ke: 'Kenya', 467 kg: 'Kyrgyzstan', 468 kh: 'Cambodia', 469 ki: 'Kiribati', 470 km: 'Comoros', 471 kn: 'St. Kitts & Nevis', 472 kp: 'North Korea', 473 kr: 'South Korea', 474 kw: 'Kuwait', 475 ky: 'Cayman Islands', 476 kz: 'Kazakhstan', 477 la: 'Laos', 478 lb: 'Lebanon', 479 lc: 'St. Lucia', 480 li: 'Liechtenstein', 481 lk: 'Sri Lanka', 482 lr: 'Liberia', 483 ls: 'Lesotho', 484 lt: 'Lithuania', 485 lu: 'Luxembourg', 486 lv: 'Latvia', 487 ly: 'Libya', 488 ma: 'Morocco', 489 mc: 'Monaco', 490 md: 'Moldova', 491 me: 'Montenegro', 492 mf: 'St. Martin', 493 mg: 'Madagascar', 494 mh: 'Marshall Islands', 495 mk: 'North Macedonia', 496 ml: 'Mali', 497 mm: 'Myanmar (Burma)', 498 mn: 'Mongolia', 499 mo: 'Macao SAR China', 500 mp: 'Northern Mariana Islands', 501 mq: 'Martinique', 502 mr: 'Mauritania', 503 ms: 'Montserrat', 504 mt: 'Malta', 505 mu: 'Mauritius', 506 mv: 'Maldives', 507 mw: 'Malawi', 508 mx: 'Mexico', 509 my: 'Malaysia', 510 mz: 'Mozambique', 511 na: 'Namibia', 512 nc: 'New Caledonia', 513 ne: 'Niger', 514 nf: 'Norfolk Island', 515 ng: 'Nigeria', 516 ni: 'Nicaragua', 517 nl: 'Netherlands', 518 no: 'Norway', 519 np: 'Nepal', 520 nr: 'Nauru', 521 nu: 'Niue', 522 nz: 'New Zealand', 523 om: 'Oman', 524 pa: 'Panama', 525 pe: 'Peru', 526 pf: 'French Polynesia', 527 pg: 'Papua New Guinea', 528 ph: 'Philippines', 529 pk: 'Pakistan', 530 pl: 'Poland', 531 pm: 'St. Pierre & Miquelon', 532 pr: 'Puerto Rico', 533 ps: 'Palestinian Territories', 534 pt: 'Portugal', 535 pw: 'Palau', 536 py: 'Paraguay', 537 qa: 'Qatar', 538 re: 'R\xE9union', 539 ro: 'Romania', 540 rs: 'Serbia', 541 ru: 'Russia', 542 rw: 'Rwanda', 543 sa: 'Saudi Arabia', 544 sb: 'Solomon Islands', 545 sc: 'Seychelles', 546 sd: 'Sudan', 547 se: 'Sweden', 548 sg: 'Singapore', 549 sh: 'St. Helena', 550 si: 'Slovenia', 551 sj: 'Svalbard & Jan Mayen', 552 sk: 'Slovakia', 553 sl: 'Sierra Leone', 554 sm: 'San Marino', 555 sn: 'Senegal', 556 so: 'Somalia', 557 sr: 'Suriname',
558 ss: 'South Sudan', 559 st: 'S\xE3o Tom\xE9 & Pr\xEDncipe', 560 sv: 'El Salvador', 561 sx: 'Sint Maarten', 562 sy: 'Syria', 563 sz: 'Eswatini', 564 tc: 'Turks & Caicos Islands', 565 td: 'Chad', 566 tg: 'Togo', 567 th: 'Thailand', 568 tj: 'Tajikistan', 569 tk: 'Tokelau', 570 tl: 'Timor-Leste', 571 tm: 'Turkmenistan', 572 tn: 'Tunisia', 573 to: 'Tonga', 574 tr: 'Turkey', 575 tt: 'Trinidad & Tobago', 576 tv: 'Tuvalu', 577 tw: 'Taiwan', 578 tz: 'Tanzania', 579 ua: 'Ukraine', 580 ug: 'Uganda', 581 us: 'United States', 582 uy: 'Uruguay', 583 uz: 'Uzbekistan', 584 va: 'Vatican City', 585 vc: 'St. Vincent & Grenadines', 586 ve: 'Venezuela', 587 vg: 'British Virgin Islands', 588 vi: 'U.S. Virgin Islands', 589 vn: 'Vietnam', 590 vu: 'Vanuatu', 591 wf: 'Wallis & Futuna', 592 ws: 'Samoa', 593 ye: 'Yemen', 594 yt: 'Mayotte', 595 za: 'South Africa', 596 zm: 'Zambia', 597 zw: 'Zimbabwe', 598 }, 599 A = U; 600 var z = { 601 selectedCountryAriaLabel: 'Selected country', 602 noCountrySelected: 'No country selected', 603 countryListAriaLabel: 'List of countries', 604 searchPlaceholder: 'Search', 605 zeroSearchResults: 'No results found', 606 oneSearchResult: '1 result found', 607 multipleSearchResults: '${count} results found', 608 ac: 'Ascension Island', 609 xk: 'Kosovo', 610 }, 611 S = z; 612 var K = { ...A, ...S }, 613 T = K; 614 for (let l = 0; l < f.length; l++) f[l].name = T[f[l].iso2]; 615 var V = 0, 616 k = { 617 allowDropdown: !0, 618 autoPlaceholder: 'polite', 619 containerClass: '', 620 countryOrder: null, 621 countrySearch: !0, 622 customPlaceholder: null, 623 dropdownContainer: null, 624 excludeCountries: [], 625 fixDropdownWidth: !0, 626 formatAsYouType: !0, 627 formatOnDisplay: !0, 628 geoIpLookup: null, 629 hiddenInput: null, 630 i18n: {}, 631 initialCountry: '', 632 loadUtils: null, 633 nationalMode: !0, 634 onlyCountries: [], 635 placeholderNumberType: 'MOBILE', 636 showFlags: !0, 637 separateDialCode: !1, 638 strictMode: !1, 639 useFullscreenPopup: 640 typeof navigator < 'u' && typeof window < 'u' 641 ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test( 642 navigator.userAgent, 643 ) || window.innerWidth <= 500 644 : !1, 645 validationNumberTypes: ['MOBILE'], 646 }, 647 $ = [ 648 '800', 649 '822', 650 '833', 651 '844', 652 '855', 653 '866', 654 '877', 655 '880', 656 '881', 657 '882', 658 '883', 659 '884', 660 '885', 661 '886', 662 '887', 663 '888', 664 '889', 665 ], 666 I = (l) => l.replace(/\D/g, ''), 667 M = (l = '') => 668 l 669 .normalize('NFD') 670 .replace(/[\u0300-\u036f]/g, '') 671 .toLowerCase(), 672 P = (l) => { 673 let t = I(l); 674 if (t.charAt(0) === '1') { 675 let e = t.substr(1, 3); 676 return $.includes(e); 677 } 678 return !1; 679 }, 680 W = (l, t, e, i) => { 681 if (e === 0 && !i) return 0; 682 let n = 0; 683 for (let s = 0; s < t.length; s++) { 684 if ((/[+0-9]/.test(t[s]) && n++, n === l && !i)) return s + 1; 685 if (i && n === l + 1) return s; 686 } 687 return t.length; 688 }, 689 m = (l, t, e) => { 690 let i = document.createElement(l); 691 return t && Object.entries(t).forEach(([n, s]) => i.setAttribute(n, s)), e && e.appendChild(i), i; 692 }, 693 b = (l, ...t) => { 694 let { instances: e } = r; 695 Object.values(e).forEach((i) => i[l](...t)); 696 }, 697 w = class { 698 constructor(t, e = {}) { 699 (this.id = V++), 700 (this.a = t), 701 (this.c = null),
702 (this.d = Object.assign({}, k, e)), 703 (this.e = !!t.getAttribute('placeholder')); 704 } 705 _init() { 706 this.d.useFullscreenPopup && (this.d.fixDropdownWidth = !1), 707 this.d.onlyCountries.length === 1 && (this.d.initialCountry = this.d.onlyCountries[0]), 708 this.d.separateDialCode && (this.d.nationalMode = !1), 709 this.d.allowDropdown && 710 !this.d.showFlags && 711 !this.d.separateDialCode && 712 (this.d.nationalMode = !1), 713 this.d.useFullscreenPopup && 714 !this.d.dropdownContainer && 715 (this.d.dropdownContainer = document.body), 716 (this.isAndroid = typeof navigator < 'u' ? /Android/i.test(navigator.userAgent) : !1), 717 (this.isRTL = !!this.a.closest('[dir=rtl]')); 718 let t = this.d.allowDropdown || this.d.separateDialCode; 719 (this.showSelectedCountryOnLeft = this.isRTL ? !t : t), 720 this.d.separateDialCode && 721 (this.isRTL 722 ? (this.originalPaddingRight = this.a.style.paddingRight) 723 : (this.originalPaddingLeft = this.a.style.paddingLeft)), 724 (this.d.i18n = { ...T, ...this.d.i18n }); 725 let e = new Promise((n, s) => { 726 (this.h = n), (this.i = s); 727 }), 728 i = new Promise((n, s) => { 729 (this.i0 = n), (this.i1 = s); 730 }); 731 (this.promise = Promise.all([e, i])), 732 (this.s = {}), 733 this._b(), 734 this._f(), 735 this._h(), 736 this._i(), 737 this._i3(); 738 } 739 _b() { 740 this._d(), this._d2(), this._d0(), this._sortCountries(); 741 } 742 _sortCountries() { 743 this.d.countryOrder && (this.d.countryOrder = this.d.countryOrder.map((t) => t.toLowerCase())), 744 this.p.sort((t, e) => { 745 let { countryOrder: i } = this.d; 746 if (i) { 747 let n = i.indexOf(t.iso2), 748 s = i.indexOf(e.iso2), 749 o = n > -1, 750 u = s > -1; 751 if (o || u) return o && u ? n - s : o ? -1 : 1; 752 } 753 return t.name.localeCompare(e.name); 754 }); 755 } 756 _c(t, e, i) { 757 e.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = e.length), 758 this.q.hasOwnProperty(e) || (this.q[e] = []); 759 for (let s = 0; s < this.q[e].length; s++) if (this.q[e][s] === t) return; 760 let n = i !== void 0 ? i : this.q[e].length; 761 this.q[e][n] = t; 762 } 763 _d() { 764 let { onlyCountries: t, excludeCountries: e } = this.d; 765 if (t.length) { 766 let i = t.map((n) => n.toLowerCase()); 767 this.p = f.filter((n) => i.includes(n.iso2)); 768 } else if (e.length) { 769 let i = e.map((n) => n.toLowerCase()); 770 this.p = f.filter((n) => !i.includes(n.iso2)); 771 } else this.p = f; 772 } 773 _d0() { 774 for (let t = 0; t < this.p.length; t++) { 775 let e = this.p[t].iso2.toLowerCase(); 776 this.d.i18n.hasOwnProperty(e) && (this.p[t].name = this.d.i18n[e]); 777 } 778 } 779 _d2() { 780 (this.dialCodes = {}), (this.dialCodeMaxLen = 0), (this.q = {}); 781 for (let t = 0; t < this.p.length; t++) { 782 let e = this.p[t]; 783 this.dialCodes[e.dialCode] || (this.dialCodes[e.dialCode] = !0), 784 this._c(e.iso2, e.dialCode, e.priority); 785 } 786 for (let t = 0; t < this.p.length; t++) { 787 let e = this.p[t]; 788 if (e.areaCodes) { 789 let i = this.q[e.dialCode][0]; 790 for (let n = 0; n < e.areaCodes.length; n++) { 791 let s = e.areaCodes[n]; 792 for (let o = 1; o < s.length; o++) { 793 let u = s.substr(0, o), 794 a = e.dialCode + u; 795 this._c(i, a), this._c(e.iso2, a); 796 } 797 this._c(e.iso2, e.dialCode + s); 798 } 799 } 800 } 801 } 802 _f() { 803 this.a.classList.add('iti__tel-input'), 804 !this.a.hasAttribute('autocomplete') && 805 !(this.a.form && this.a.form.hasAttribute('autocomplete')) && 806 this.a.setAttribute('autocomplete', 'off'); 807 let { 808 allowDropdown: t, 809 separateDialCode: e, 810 showFlags: i, 811 containerClass: n, 812 hiddenInput: s, 813 dropdownContainer: o, 814 fixDropdownWidth: u, 815 useFullscreenPopup: a, 816 countrySearch: h, 817 i18n: d, 818 } = this.d, 819 p = 'iti'; 820 t && (p += ' iti--allow-dropdown'), 821 i && (p += ' iti--show-flags'), 822 n && (p += ` ${n}`), 823 a || (p += ' iti--inline-dropdown'); 824 let c = m('div', { class: p }); 825 if ((this.a.parentNode?.insertBefore(c, this.a), t || i || e)) { 826 (this.k = m('div', { class: 'iti__country-container' }, c)), 827 this.showSelectedCountryOnLeft ? (this.k.style.left = '0px') : (this.k.style.right = '0px'), 828 t 829 ? ((this.selectedCountry = m( 830 'button', 831 { 832 type: 'button', 833 class: 'iti__selected-country', 834 'aria-expanded': 'false', 835 'aria-label': this.d.i18n.selectedCountryAriaLabel, 836 'aria-haspopup': 'true', 837 'aria-controls': `iti-${this.id}__dropdown-content`, 838 role: 'combobox', 839 }, 840 this.k, 841 )), 842 this.a.disabled && this.selectedCountry.setAttribute('disabled', 'true')) 843 : (this.selectedCountry = m('div', { class: 'iti__selected-country' }, this.k)); 844 let g = m('div', { class: 'iti__selected-country-primary' }, this.selectedCountry); 845 if ( 846 ((this.l = m('div', { class: 'iti__flag' }, g)), 847 (this.selectedCountryA11yText = m('span', { class: 'iti__a11y-text' }, this.l)), 848 t && (this.u = m('div', { class: 'iti__arrow', 'aria-hidden': 'true' }, g)), 849 e && (this.t = m('div', { class: 'iti__selected-dial-code' }, this.selectedCountry)), 850 t) 851 ) { 852 let C = u ? '' : 'iti--flexible-dropdown-width'; 853 if ( 854 ((this.dropdownContent = m('div', { 855 id: `iti-${this.id}__dropdown-content`, 856 class: `iti__dropdown-content iti__hide ${C}`, 857 })), 858 h && 859 ((this.searchInput = m( 860 'input', 861 { 862 type: 'text', 863 class: 'iti__search-input', 864 placeholder: d.searchPlaceholder, 865 role: 'combobox', 866 'aria-expanded': 'true', 867 'aria-label': d.searchPlaceholder, 868 'aria-controls': `iti-${this.id}__country-listbox`, 869 'aria-autocomplete': 'list', 870 autocomplete: 'off', 871 }, 872 this.dropdownContent, 873 )), 874 (this.searchResultsA11yText = m( 875 'span', 876 { class: 'iti__a11y-text' }, 877 this.dropdownContent, 878 ))), 879 (this.countryList = m( 880 'ul', 881 { 882 class: 'iti__country-list', 883 id: `iti-${this.id}__country-listbox`, 884 role: 'listbox', 885 'aria-label': d.countryListAriaLabel, 886 }, 887 this.dropdownContent, 888 )), 889 this._g(), 890 h && this._p4(), 891 o) 892 ) { 893 let y = 'iti iti--container'; 894 a ? (y += ' iti--fullscreen-popup') : (y += ' iti--inline-dropdown'), 895 (this.dropdown = m('div', { class: y })), 896 this.dropdown.appendChild(this.dropdownContent); 897 } else this.k.appendChild(this.dropdownContent); 898 } 899 } 900 if ((c.appendChild(this.a), this._updateInputPadding(), s)) { 901 let g = this.a.getAttribute('name') || '', 902 C = s(g); 903 if (C.phone) { 904 let y = this.a.form?.querySelector(`input[name="${C.phone}"]`); 905 y 906 ? (this.hiddenInput = y) 907 : ((this.hiddenInput = m('input', { type: 'hidden', name: C.phone })), 908 c.appendChild(this.hiddenInput)); 909 } 910 if (C.country) { 911 let y = this.a.form?.querySelector(`input[name="${C.country}"]`); 912 y 913 ? (this.hiddenInputCountry = y) 914 : ((this.hiddenInputCountry = m('input', { type: 'hidden', name: C.country })), 915 c.appendChild(this.hiddenInputCountry)); 916 } 917 } 918 } 919 _g() { 920 for (let t = 0; t < this.p.length; t++) { 921 let e = this.p[t], 922 i = t === 0 ? 'iti__highlight' : '', 923 n = m( 924 'li', 925 { 926 id: `iti-${this.id}__item-${e.iso2}`, 927 class: `iti__country ${i}`, 928 tabindex: '-1', 929 role: 'option',
930 'data-dial-code': e.dialCode, 931 'data-country-code': e.iso2, 932 'aria-selected': 'false', 933 }, 934 this.countryList, 935 ); 936 e.nodeById[this.id] = n; 937 let s = ''; 938 this.d.showFlags && (s += `<div class='iti__flag iti__${e.iso2}'></div>`), 939 (s += `<span class='iti__country-name'>${e.name}</span>`), 940 (s += `<span class='iti__dial-code'>+${e.dialCode}</span>`), 941 n.insertAdjacentHTML('beforeend', s); 942 } 943 } 944 _h(t = !1) { 945 let e = this.a.getAttribute('value'), 946 i = this.a.value, 947 s = e && e.charAt(0) === '+' && (!i || i.charAt(0) !== '+') ? e : i, 948 o = this._5(s), 949 u = P(s), 950 { initialCountry: a, geoIpLookup: h } = this.d, 951 d = a === 'auto' && h; 952 if (o && !u) this._v(s); 953 else if (!d || t) { 954 let p = a ? a.toLowerCase() : ''; 955 p && this._y(p, !0) ? this._z(p) : o && u ? this._z('us') : this._z(); 956 } 957 s && this._u(s); 958 } 959 _i() { 960 this._j(), 961 this.d.allowDropdown && this._i2(), 962 (this.hiddenInput || this.hiddenInputCountry) && this.a.form && this._i0(); 963 } 964 _i0() { 965 (this._a14 = () => { 966 this.hiddenInput && (this.hiddenInput.value = this.getNumber()), 967 this.hiddenInputCountry && 968 (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || ''); 969 }), 970 this.a.form?.addEventListener('submit', this._a14); 971 } 972 _i2() { 973 this._a9 = (e) => { 974 this.dropdownContent.classList.contains('iti__hide') ? this.a.focus() : e.preventDefault(); 975 }; 976 let t = this.a.closest('label'); 977 t && t.addEventListener('click', this._a9), 978 (this._a10 = () => { 979 this.dropdownContent.classList.contains('iti__hide') && 980 !this.a.disabled && 981 !this.a.readOnly && 982 this._n(); 983 }), 984 this.selectedCountry.addEventListener('click', this._a10), 985 (this._a11 = (e) => { 986 this.dropdownContent.classList.contains('iti__hide') && 987 ['ArrowUp', 'ArrowDown', ' ', 'Enter'].includes(e.key) && 988 (e.preventDefault(), e.stopPropagation(), this._n()), 989 e.key === 'Tab' && this._2(); 990 }), 991 this.k.addEventListener('keydown', this._a11); 992 } 993 _i3() { 994 let { loadUtils: t, initialCountry: e, geoIpLookup: i } = this.d; 995 t && !r.utils 996 ? ((this._handlePageLoad = () => { 997 window.removeEventListener('load', this._handlePageLoad), 998 r.attachUtils(t)?.catch(() => {}); 999 }), 1000 r.documentReady() 1001 ? this._handlePageLoad() 1002 : window.addEventListener('load', this._handlePageLoad)) 1003 : this.i0(), 1004 e === 'auto' && i && !this.s.iso2 ? this._i4() : this.h(); 1005 } 1006 _i4() { 1007 r.autoCountry 1008 ? this.handleAutoCountry() 1009 : r.startedLoadingAutoCountry || 1010 ((r.startedLoadingAutoCountry = !0), 1011 typeof this.d.geoIpLookup == 'function' && 1012 this.d.geoIpLookup( 1013 (t = '') => { 1014 let e = t.toLowerCase(); 1015 e && this._y(e, !0) 1016 ? ((r.autoCountry = e), setTimeout(() => b('handleAutoCountry'))) 1017 : (this._h(!0), b('rejectAutoCountryPromise')); 1018 }, 1019 () => { 1020 this._h(!0), b('rejectAutoCountryPromise'); 1021 }, 1022 )); 1023 } 1024 _nWithPlus() { 1025 this._n(), (this.searchInput.value = '+'), this._p3('', !0); 1026 } 1027 _j() { 1028 let {
1029 strictMode: t, 1030 formatAsYouType: e, 1031 separateDialCode: i, 1032 formatOnDisplay: n, 1033 allowDropdown: s, 1034 countrySearch: o, 1035 } = this.d, 1036 u = !1; 1037 /\p{L}/u.test(this.a.value) && (u = !0), 1038 (this._a12 = (a) => { 1039 if (this.isAndroid && a?.data === '+' && i && s && o) { 1040 let c = this.a.selectionStart || 0, 1041 g = this.a.value.substring(0, c - 1), 1042 C = this.a.value.substring(c); 1043 (this.a.value = g + C), this._nWithPlus(); 1044 return; 1045 } 1046 this._v(this.a.value) && this._8(); 1047 let h = a?.data && /[^+0-9]/.test(a.data), 1048 d = a?.inputType === 'insertFromPaste' && this.a.value; 1049 h || (d && !t) ? (u = !0) : /[^+0-9]/.test(this.a.value) || (u = !1); 1050 let p = a?.detail && a.detail.isSetNumber && !n; 1051 if (e && !u && !p) { 1052 let c = this.a.selectionStart || 0, 1053 C = this.a.value.substring(0, c).replace(/[^+0-9]/g, '').length, 1054 y = a?.inputType === 'deleteContentForward', 1055 v = this._9(), 1056 _ = W(C, v, c, y); 1057 (this.a.value = v), this.a.setSelectionRange(_, _); 1058 } 1059 }), 1060 this.a.addEventListener('input', this._a12), 1061 (t || i) && 1062 ((this._handleKeydownEvent = (a) => { 1063 if (a.key && a.key.length === 1 && !a.altKey && !a.ctrlKey && !a.metaKey) { 1064 if (i && s && o && a.key === '+') { 1065 a.preventDefault(), this._nWithPlus(); 1066 return; 1067 } 1068 if (t) { 1069 let h = this.a.value, 1070 d = h.charAt(0) === '+', 1071 p = !d && this.a.selectionStart === 0 && a.key === '+', 1072 c = /^[0-9]$/.test(a.key), 1073 g = i ? c : p || c, 1074 C = 1075 h.slice(0, this.a.selectionStart) + 1076 a.key + 1077 h.slice(this.a.selectionEnd), 1078 y = this._6(C), 1079 v = r.utils.getCoreNumber(y, this.s.iso2), 1080 _ = this.maxCoreNumberLength && v.length > this.maxCoreNumberLength, 1081 E = !1; 1082 if (d) { 1083 let x = this.s.iso2; 1084 E = this._getCountryFromNumber(y) !== x; 1085 } 1086 (!g || (_ && !E && !p)) && a.preventDefault(); 1087 } 1088 } 1089 }), 1090 this.a.addEventListener('keydown', this._handleKeydownEvent)); 1091 } 1092 _j2(t) { 1093 let e = parseInt(this.a.getAttribute('maxlength') || '', 10); 1094 return e && t.length > e ? t.substr(0, e) : t; 1095 } 1096 _trigger(t, e = {}) { 1097 let i = new CustomEvent(t, { bubbles: !0, cancelable: !0, detail: e }); 1098 this.a.dispatchEvent(i); 1099 } 1100 _n() { 1101 let { fixDropdownWidth: t, countrySearch: e } = this.d; 1102 if ( 1103 (t && (this.dropdownContent.style.width = `${this.a.offsetWidth}px`), 1104 this.dropdownContent.classList.remove('iti__hide'), 1105 this.selectedCountry.setAttribute('aria-expanded', 'true'), 1106 this._o(), 1107 e) 1108 ) { 1109 let i = this.countryList.firstElementChild; 1110 i && (this._x(i, !1), (this.countryList.scrollTop = 0)), this.searchInput.focus(); 1111 } 1112 this._p(), this.u.classList.add('iti__arrow--up'), this._trigger('open:countrydropdown'); 1113 } 1114 _o() { 1115 if ( 1116 (this.d.dropdownContainer && this.d.dropdownContainer.appendChild(this.dropdown), 1117 !this.d.useFullscreenPopup) 1118 ) { 1119 let t = this.a.getBoundingClientRect(), 1120 e = this.a.offsetHeight; 1121 this.d.dropdownContainer && 1122 ((this.dropdown.style.top = `${t.top + e}px`), 1123 (this.dropdown.style.left = `${t.left}px`), 1124 (this._a4 = () => this._2()), 1125 window.addEventListener('scroll', this._a4)); 1126 } 1127 } 1128 _p() { 1129 (this._a0 = (n) => { 1130 let s = n.target?.closest('.iti__country'); 1131 s && this._x(s, !1); 1132 }), 1133 this.countryList.addEventListener('mouseover', this._a0), 1134 (this._a1 = (n) => { 1135 let s = n.target?.closest('.iti__country'); 1136 s && this._1(s); 1137 }), 1138 this.countryList.addEventListener('click', this._a1); 1139 let t = !0; 1140 (this._a2 = () => { 1141 t || this._2(), (t = !1); 1142 }), 1143 document.documentElement.addEventListener('click', this._a2); 1144 let e = '', 1145 i = null; 1146 if ( 1147 ((this._a3 = (n) => { 1148 ['ArrowUp', 'ArrowDown', 'Enter', 'Escape'].includes(n.key) && 1149 (n.preventDefault(), 1150 n.stopPropagation(), 1151 n.key === 'ArrowUp' || n.key === 'ArrowDown' 1152 ? this._q(n.key) 1153 : n.key === 'Enter' 1154 ? this._r() 1155 : n.key === 'Escape' && this._2()), 1156 !this.d.countrySearch && 1157 /^[a-zA-ZÃ-ÿа-ÑÐ-Я ]$/.test(n.key) && 1158 (n.stopPropagation(), 1159 i && clearTimeout(i), 1160 (e += n.key.toLowerCase()), 1161 this._searchForCountry(e), 1162 (i = setTimeout(() => { 1163 e = ''; 1164 }, 1e3))); 1165 }), 1166 document.addEventListener('keydown', this._a3), 1167 this.d.countrySearch) 1168 ) { 1169 let n = () => { 1170 let o = this.searchInput.value.trim(); 1171 o ? this._p3(o) : this._p3('', !0); 1172 }, 1173 s = null; 1174 (this._a7 = () => { 1175 s && clearTimeout(s), 1176 (s = setTimeout(() => { 1177 n(), (s = null); 1178 }, 100)); 1179 }), 1180 this.searchInput.addEventListener('input', this._a7), 1181 this.searchInput.addEventListener('click', (o) => o.stopPropagation()); 1182 } 1183 } 1184 _searchForCountry(t) { 1185 for (let e = 0; e < this.p.length; e++) { 1186 let i = this.p[e]; 1187 if (i.name.substr(0, t.length).toLowerCase() === t) { 1188 let s = i.nodeById[this.id]; 1189 this._x(s, !1), this._3(s); 1190 break; 1191 } 1192 } 1193 } 1194 _p3(t, e = !1) { 1195 let i = !0; 1196 this.countryList.innerHTML = ''; 1197 let n = M(t); 1198 for (let s = 0; s < this.p.length; s++) { 1199 let o = this.p[s], 1200 u = M(o.name), 1201 a = o.name 1202 .split(/[^a-zA-ZÃ-ÿа-ÑÐ-Я]/) 1203 .map((d) => d[0]) 1204 .join('') 1205 .toLowerCase(), 1206 h = `+${o.dialCode}`; 1207 if (e || u.includes(n) || h.includes(n) || o.iso2.includes(n) || a.includes(n)) { 1208 let d = o.nodeById[this.id]; 1209 d && this.countryList.appendChild(d), i && (this._x(d, !1), (i = !1)); 1210 } 1211 } 1212 i && this._x(null, !1), (this.countryList.scrollTop = 0), this._p4(); 1213 } 1214 _p4() { 1215 let { i18n: t } = this.d, 1216 e = this.countryList.childElementCount, 1217 i; 1218 e === 0 1219 ? (i = t.zeroSearchResults) 1220 : e === 1 1221 ? (i = t.oneSearchResult) 1222 : (i = t.multipleSearchResults.replace('${count}', e.toString())), 1223 (this.searchResultsA11yText.textContent = i); 1224 } 1225 _q(t) { 1226 let e = t === 'ArrowUp' ? this.c?.previousElementSibling : this.c?.nextElementSibling; 1227 !e && 1228 this.countryList.childElementCount > 1 && 1229 (e = t === 'ArrowUp' ? this.countryList.lastElementChild : this.countryList.firstElementChild), 1230 e && (this._3(e), this._x(e, !1)); 1231 } 1232 _r() { 1233 this.c && this._1(this.c); 1234 } 1235 _u(t) { 1236 let e = t; 1237 if (this.d.formatOnDisplay && r.utils && this.s) { 1238 let i = this.d.nationalMode || (e.charAt(0) !== '+' && !this.d.separateDialCode), 1239 { NATIONAL: n, INTERNATIONAL: s } = r.utils.numberFormat, 1240 o = i ? n : s; 1241 e = r.utils.formatNumber(e, this.s.iso2, o); 1242 } 1243 (e = this._7(e)), (this.a.value = e); 1244 } 1245 _v(t) { 1246 let e = this._getCountryFromNumber(t); 1247 return e !== null ? this._z(e) : !1; 1248 } 1249 _ensureHasDialCode(t) { 1250 let { dialCode: e, nationalPrefix: i } = this.s; 1251 if (t.charAt(0) === '+' || !e) return t; 1252 let o = i && t.charAt(0) === i && !this.d.separateDialCode ? t.substring(1) : t; 1253 return `+${e}${o}
1253`; 1254 } 1255 _getCountryFromNumber(t) { 1256 let e = t.indexOf('+'), 1257 i = e ? t.substring(e) : t, 1258 n = this.s.iso2, 1259 s = this.s.dialCode; 1260 i = this._ensureHasDialCode(i); 1261 let o = this._5(i, !0), 1262 u = I(i); 1263 if (o) { 1264 let a = I(o), 1265 h = this.q[a]; 1266 if (!n && this.j && h.includes(this.j)) return this.j; 1267 let d = n && h.includes(n) && (u.length === a.length || !this.s.areaCodes); 1268 if (!(s === '1' && P(u)) && !d) { 1269 for (let c = 0; c < h.length; c++) if (h[c]) return h[c]; 1270 } 1271 } else { 1272 if (i.charAt(0) === '+' && u.length) return ''; 1273 if ((!i || i === '+') && !this.s.iso2) return this.j; 1274 } 1275 return null; 1276 } 1277 _x(t, e) { 1278 let i = this.c; 1279 if ( 1280 (i && (i.classList.remove('iti__highlight'), i.setAttribute('aria-selected', 'false')), 1281 (this.c = t), 1282 this.c) 1283 ) { 1284 this.c.classList.add('iti__highlight'), this.c.setAttribute('aria-selected', 'true'); 1285 let n = this.c.getAttribute('id') || ''; 1286 this.selectedCountry.setAttribute('aria-activedescendant', n), 1287 this.d.countrySearch && this.searchInput.setAttribute('aria-activedescendant', n); 1288 } 1289 e && this.c.focus(); 1290 } 1291 _y(t, e) { 1292 for (let i = 0; i < this.p.length; i++) if (this.p[i].iso2 === t) return this.p[i]; 1293 if (e) return null; 1294 throw new Error(`No country data for '${t}'`); 1295 } 1296 _z(t) { 1297 let { separateDialCode: e, showFlags: i, i18n: n } = this.d, 1298 s = this.s.iso2 ? this.s : {}; 1299 if (((this.s = t ? this._y(t, !1) || {} : {}), this.s.iso2 && (this.j = this.s.iso2), this.l)) { 1300 let o = '', 1301 u = ''; 1302 t && i 1303 ? ((o = `iti__flag iti__${t}`), (u = `${this.s.name} +${this.s.dialCode}`)) 1304 : ((o = 'iti__flag iti__globe'), (u = n.noCountrySelected)), 1305 (this.l.className = o), 1306 (this.selectedCountryA11yText.textContent = u); 1307 } 1308 if ((this._z3(t, e), e)) { 1309 let o = this.s.dialCode ? `+${this.s.dialCode}` : ''; 1310 (this.t.innerHTML = o), this._updateInputPadding(); 1311 } 1312 return this._0(), this._updateMaxLength(), s.iso2 !== t; 1313 } 1314 _updateInputPadding() { 1315 if (this.selectedCountry) { 1316 let e = (this.selectedCountry.offsetWidth || this._z2()) + 6; 1317 this.showSelectedCountryOnLeft 1318 ? (this.a.style.paddingLeft = `${e}px`) 1319 : (this.a.style.paddingRight = `${e}px`); 1320 } 1321 } 1322 _updateMaxLength() { 1323 let { strictMode: t, placeholderNumberType: e, validationNumberTypes: i } = this.d, 1324 { iso2: n } = this.s; 1325 if (t && r.utils) 1326 if (n) { 1327 let s = r.utils.numberType[e], 1328 o = r.utils.getExampleNumber(n, !1, s, !0), 1329 u = o; 1330 for (; r.utils.isPossibleNumber(o, n, i); ) (u = o), (o += '0'); 1331 let a = r.utils.getCoreNumber(u, n); 1332 (this.maxCoreNumberLength = a.length), 1333 n === 'by' && (this.maxCoreNumberLength = a.length + 1); 1334 } else this.maxCoreNumberLength = null; 1335 } 1336 _z3(t = null, e) { 1337 if (!this.selectedCountry) return; 1338 let i; 1339 t && !e ? (i = `${this.s.name}: +${this.s.dialCode}`) : t ? (i = this.s.name) : (i = 'Unknown'), 1340 this.selectedCountry.setAttribute('title', i); 1341 } 1342 _z2() { 1343 if (this.a.parentNode) { 1344 let t = this.a.parentNode.cloneNode(!1); 1345 (t.style.visibility = 'hidden'), document.body.appendChild(t); 1346 let e = this.k.cloneNode(); 1347 t.appendChild(e); 1348 let i = this.selectedCountry.cloneNode(!0); 1349 e.appendChild(i); 1350 let n = i.offsetWidth; 1351 return document.body.removeChild(t), n; 1352 } 1353 return 0; 1354 } 1355 _0() { 1356 let { 1357 autoPlaceholder: t, 1358 placeholderNumberType: e, 1359 nationalMode: i, 1360 customPlaceholder: n, 1361 } = this.d, 1362 s = t === 'aggressive' || (!this.e && t === 'polite'); 1363 if (r.utils && s) { 1364 let o = r.utils.numberType[e], 1365 u = this.s.iso2 ? r.utils.getExampleNumber(this.s.iso2, i, o) : ''; 1366 (u = this._7(u)), 1367 typeof n == 'function' && (u = n(u, this.s)), 1368 this.a.setAttribute('placeholder', u); 1369 } 1370 } 1371 _1(t) { 1372 let e = this._z(t.getAttribute('data-country-code')); 1373 this._2(), this._4(t.getAttribute('data-dial-code')), this.a.focus(), e && this._8(); 1374 } 1375 _2() { 1376 this.dropdownContent.classList.add('iti__hide'), 1377 this.selectedCountry.setAttribute('aria-expanded', 'false'), 1378 this.selectedCountry.removeAttribute('aria-activedescendant'), 1379 this.c && this.c.setAttribute('aria-selected', 'false'), 1380 this.d.countrySearch && this.searchInput.removeAttribute('aria-activedescendant'), 1381 this.u.classList.remove('iti__arrow--up'), 1382 document.removeEventListener('keydown', this._a3), 1383 this.d.countrySearch && this.searchInput.removeEventListener('input', this._a7), 1384 document.documentElement.removeEventListener('click', this._a2), 1385 this.countryList.removeEventListener('mouseover', this._a0), 1386 this.countryList.removeEventListener('click', this._a1), 1387 this.d.dropdownContainer && 1388 (this.d.useFullscreenPopup || window.removeEventListener('scroll', this._a4), 1389 this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), 1390 this._handlePageLoad && window.removeEventListener('load', this._handlePageLoad), 1391 this._trigger('close:countrydropdown'); 1392 } 1393 _3(t) { 1394 let e = this.countryList, 1395 i = document.documentElement.scrollTop, 1396 n = e.offsetHeight, 1397 s = e.getBoundingClientRect().top + i, 1398 o = s + n, 1399 u = t.offsetHeight, 1400 a = t.getBoundingClientRect().top + i, 1401 h = a + u, 1402 d = a - s + e.scrollTop; 1403 if (a < s) e.scrollTop = d; 1404 else if (h > o) { 1405 let p = n - u; 1406 e.scrollTop = d - p; 1407 } 1408 } 1409 _4(t) { 1410 let e = this.a.value, 1411 i = `+${t}`, 1412 n; 1413 if (e.charAt(0) === '+') { 1414 let s = this._5(e); 1415 s ? (n = e.replace(s, i)) : (n = i), (this.a.value = n); 1416 } 1417 } 1418 _5(t, e) { 1419 let i = ''; 1420 if (t.charAt(0) === '+') { 1421 let n = ''; 1422 for (let s = 0; s < t.length; s++) { 1423 let o = t.charAt(s); 1424 if (!isNaN(parseInt(o, 10))) { 1425 if (((n += o), e)) this.q[n] && (i = t.substr(0, s + 1)); 1426 else if (this.dialCodes[n]) { 1427 i = t.substr(0, s + 1); 1428 break; 1429 } 1430 if (n.length === this.dialCodeMaxLen) break; 1431 } 1432 } 1433 } 1434 return i; 1435 } 1436 _6(t) { 1437 let e = t || this.a.value.trim(), 1438 { dialCode: i } = this.s, 1439 n, 1440 s = I(e); 1441 return this.d.separateDialCode && e.charAt(0) !== '+' && i && s ? (n = `+${i}`) : (n = ''), n + e; 1442 } 1443 _7(t) { 1444 let e = t; 1445 if (this.d.separateDialCode) { 1446 let i = this._5(e); 1447 if (i) { 1448 i = `+${this.s.dialCode}`; 1449 let n = e[i.length] === ' ' || e[i.length] === '-' ? i.length + 1 : i.length; 1450 e = e.substr(n); 1451 } 1452 } 1453 return this._j2(e); 1454 } 1455 _8() { 1456 this._trigger('countrychange'); 1457 } 1458 _9() { 1459 let t = this._6(), 1460 e = r.utils ? r.utils.formatNumberAsYouType(t, this.s.iso2) : t, 1461 { dialCode: i } = this.s; 1462 return this.d.separateDialCode && this.a.value.charAt(0) !== '+' && e.includes(`+${i}`) 1463 ? (e.split(`+${i}`)[1] || '').trim() 1464 : e; 1465 } 1466 handleAutoCountry() { 1467 this.d.initialCountry === 'auto' && 1468 r.autoCountry && 1469 ((this.j = r.autoCountry), 1470 this.s.iso2 || this.l.classList.contains('iti__globe') || this.setCountry(this.j), 1471 this.h()); 1472 } 1473 handleUtils() { 1474 r.utils && 1475 (this.a.value && this._u(this.a.value), this.s.iso2 && (this._0(), this._updateMaxLength())), 1476 this.i0(); 1477 } 1478 destroy() { 1479 let { allowDropdown: t, separateDialCode: e } = this.d; 1480 if (t) { 1481 this._2(), 1482 this.selectedCountry.removeEventListener('click', this._a10), 1483 this.k.removeEventListener('keydown', this._a11); 1484 let s = this.a.closest('label'); 1485 s && s.removeEventListener('click', this._a9); 1486 } 1487 let { form: i } = this.a; 1488 this._a14 && i && i.removeEventListener('submit', this._a14), 1489 this.a.removeEventListener('input', this._a12), 1490 this._handleKeydownEvent && this.a.removeEventListener('keydown', this._handleKeydownEvent), 1491 this.a.removeAttribute('data-intl-tel-input-id'), 1492 e && 1493 (this.isRTL 1494 ? (this.a.style.paddingRight = this.originalPaddingRight) 1495 : (this.a.style.paddingLeft = this.originalPaddingLeft)); 1496 let n = this.a.parentNode; 1497 n?.parentNode?.insertBefore(this.a, n), n?.parentNode?.removeChild(n), delete r.instances[this.id]; 1498 } 1499 getExtension() { 1500 return r.utils ? r.utils.getExtension(this._6(), this.s.iso2) : ''; 1501 } 1502 getNumber(t) { 1503 if (r.utils) { 1504 let { iso2: e } = this.s; 1505 return r.utils.formatNumber(this._6(), e, t); 1506 } 1507 return ''; 1508 } 1509 getNumberType() { 1510 return r.utils ? r.utils.getNumberType(this._6(), this.s.iso2) : -99; 1511 } 1512 getSelectedCountryData() { 1513 return this.s; 1514 } 1515 getValidationError() { 1516 if (r.utils) { 1517 let { iso2: t } = this.s; 1518 return r.utils.getValidationError(this._6(), t); 1519 } 1520 return -99; 1521 } 1522 isValidNumber() { 1523 if (!this.s.iso2) return !1; 1524 let t = this._6(), 1525 e = t.search(/\p{L}/u); 1526 if (e > -1) { 1527 let i = t.substring(0, e), 1528 n = this._utilsIsPossibleNumber(i), 1529 s = this._utilsIsPossibleNumber(t); 1530 return n && s; 1531 } 1532 return this._utilsIsPossibleNumber(t); 1533 } 1534 _utilsIsPossibleNumber(t) { 1535 return r.utils ? r.utils.isPossibleNumber(t, this.s.iso2, this.d.validationNumberTypes) : null; 1536 } 1537 isValidNumberPrecise() { 1538 if (!this.s.iso2) return !1; 1539 let t = this._6(), 1540 e = t.search(/\p{L}/u); 1541 if (e > -1) { 1542 let i = t.substring(0, e), 1543 n = this._utilsIsValidNumber(i), 1544 s = this._utilsIsValidNumber(t); 1545 return n && s; 1546 } 1547 return this._utilsIsValidNumber(t); 1548 } 1549 _utilsIsValidNumber(t) { 1550 return r.utils ? r.utils.isValidNumber(t, this.s.iso2, this.d.validationNumberTypes) : null; 1551 } 1552 setCountry(t) { 1553 let e = t?.toLowerCase(), 1554 i = this.s.iso2; 1555 ((t && e !== i) || (!t && i)) && (this._z(e), this._4(this.s.dialCode), this._8()); 1556 } 1557 setNumber(t) { 1558 let e = this._v(t); 1559 this._u(t), e && this._8(), this._trigger('input', { isSetNumber: !0 }); 1560 } 1561 setPlaceholderNumberType(t) { 1562 (this.d.placeholderNumberType = t), this._0(); 1563 } 1564 setDisabled(t) { 1565 (this.a.disabled = t), 1566 t 1567 ? this.selectedCountry.setAttribute('disabled', 'true') 1568 : this.selectedCountry.removeAttribute('disabled'); 1569 } 1570 }, 1571 G = (l) => { 1572 if (!r.utils && !r.startedLoadingUtilsScript) { 1573 let t; 1574 if (typeof l == 'function') 1575 try { 1576 t = Promise.resolve(l()); 1577 } catch (e) { 1578 return Promise.reject(e); 1579 } 1580 else 1581 return Promise.reject( 1582 new TypeError( 1583
1583 `The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof l}`, 1584 ), 1585 ); 1586 return ( 1587 (r.startedLoadingUtilsScript = !0), 1588 t 1589 .then((e) => { 1590 let i = e?.default; 1591 if (!i || typeof i != 'object') 1592 throw new TypeError( 1593 'The loader function passed to attachUtils did not resolve to a module object with utils as its default export.', 1594 ); 1595 return (r.utils = i), b('handleUtils'), !0; 1596 }) 1597 .catch((e) => { 1598 throw (b('rejectUtilsScriptPromise', e), e); 1599 }) 1600 ); 1601 } 1602 return null; 1603 }, 1604 r = Object.assign( 1605 (l, t) => { 1606 let e = new w(l, t); 1607 return ( 1608 e._init(), l.setAttribute('data-intl-tel-input-id', e.id.toString()), (r.instances[e.id] = e), e 1609 ); 1610 }, 1611 { 1612 defaults: k, 1613 documentReady: () => document.readyState === 'complete', 1614 getCountryData: () => f, 1615 getInstance: (l) => { 1616 let t = l.getAttribute('data-intl-tel-input-id'); 1617 return t ? r.instances[t] : null; 1618 }, 1619 instances: {}, 1620 attachUtils: G, 1621 startedLoadingUtilsScript: !1, 1622 startedLoadingAutoCountry: !1, 1623 version: '25.3.1', 1624 }, 1625 ), 1626 q = r; 1627 return j(Y); 1628 })(); 1629 1630 // UMD 1631 return factoryOutput.default; 1632});
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.