From 6cf0e689e477912fd46e503037e07c49dea0a44e Mon Sep 17 00:00:00 2001 From: arthutox Date: Tue, 6 Aug 2024 12:38:47 +0200 Subject: [PATCH] OA-21073: [GEM] Update intl-tel-input to v23.7.3 --- app/assets/javascripts/intl-tel-input.js | 18079 ++++++++++----------- intl-tel-input.gemspec | 2 +- 2 files changed, 9020 insertions(+), 9061 deletions(-) diff --git a/app/assets/javascripts/intl-tel-input.js b/app/assets/javascripts/intl-tel-input.js index bbf8353..25bb371 100644 --- a/app/assets/javascripts/intl-tel-input.js +++ b/app/assets/javascripts/intl-tel-input.js @@ -1,9085 +1,9044 @@ /* - * International Telephone Input v23.6.1 + * International Telephone Input v23.7.3 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ // UMD (function(factory) { - if (typeof module === 'object' && module.exports) { - module.exports = factory(); - } else { - window.intlTelInput = factory(); - } -}(() => { - - var factoryOutput = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/js/intl-tel-input/intlTelInputWithUtils.ts - var intlTelInputWithUtils_exports = {}; - __export(intlTelInputWithUtils_exports, { - default: () => intlTelInputWithUtils_default - }); - - // src/js/intl-tel-input/data.ts - var rawCountryData = [ - [ - "af", - "93" - ], - [ - "al", - "355" - ], - [ - "dz", - "213" - ], - [ - "as", - "1", - 5, - ["684"] - ], - [ - "ad", - "376" - ], - [ - "ao", - "244" - ], - [ - "ai", - "1", - 6, - ["264"] - ], - [ - "ag", - "1", - 7, - ["268"] - ], - [ - "ar", - "54" - ], - [ - "am", - "374" - ], - [ - "aw", - "297" - ], - [ - "ac", - "247" - ], - [ - "au", - "61", - 0 - ], - [ - "at", - "43" - ], - [ - "az", - "994" - ], - [ - "bs", - "1", - 8, - ["242"] - ], - [ - "bh", - "973" - ], - [ - "bd", - "880" - ], - [ - "bb", - "1", - 9, - ["246"] - ], - [ - "by", - "375" - ], - [ - "be", - "32" - ], - [ - "bz", - "501" - ], - [ - "bj", - "229" - ], - [ - "bm", - "1", - 10, - ["441"] - ], - [ - "bt", - "975" - ], - [ - "bo", - "591" - ], - [ - "ba", - "387" - ], - [ - "bw", - "267" - ], - [ - "br", - "55" - ], - [ - "io", - "246" - ], - [ - "vg", - "1", - 11, - ["284"] - ], - [ - "bn", - "673" - ], - [ - "bg", - "359" - ], - [ - "bf", - "226" - ], - [ - "bi", - "257" - ], - [ - "kh", - "855" - ], - [ - "cm", - "237" - ], - [ - "ca", - "1", - 1, - ["204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "879", "902", "905"] - ], - [ - "cv", - "238" - ], - [ - "bq", - "599", - 1, - ["3", "4", "7"] - ], - [ - "ky", - "1", - 12, - ["345"] - ], - [ - "cf", - "236" - ], - [ - "td", - "235" - ], - [ - "cl", - "56" - ], - [ - "cn", - "86" - ], - [ - "cx", - "61", - 2, - ["89164"] - ], - [ - "cc", - "61", - 1, - ["89162"] - ], - [ - "co", - "57" - ], - [ - "km", - "269" - ], - [ - "cg", - "242" - ], - [ - "cd", - "243" - ], - [ - "ck", - "682" - ], - [ - "cr", - "506" - ], - [ - "ci", - "225" - ], - [ - "hr", - "385" - ], - [ - "cu", - "53" - ], - [ - "cw", - "599", - 0 - ], - [ - "cy", - "357" - ], - [ - "cz", - "420" - ], - [ - "dk", - "45" - ], - [ - "dj", - "253" - ], - [ - "dm", - "1", - 13, - ["767"] - ], - [ - "do", - "1", - 2, - ["809", "829", "849"] - ], - [ - "ec", - "593" - ], - [ - "eg", - "20" - ], - [ - "sv", - "503" - ], - [ - "gq", - "240" - ], - [ - "er", - "291" - ], - [ - "ee", - "372" - ], - [ - "sz", - "268" - ], - [ - "et", - "251" - ], - [ - "fk", - "500" - ], - [ - "fo", - "298" - ], - [ - "fj", - "679" - ], - [ - "fi", - "358", - 0 - ], - [ - "fr", - "33" - ], - [ - "gf", - "594" - ], - [ - "pf", - "689" - ], - [ - "ga", - "241" - ], - [ - "gm", - "220" - ], - [ - "ge", - "995" - ], - [ - "de", - "49" - ], - [ - "gh", - "233" - ], - [ - "gi", - "350" - ], - [ - "gr", - "30" - ], - [ - "gl", - "299" - ], - [ - "gd", - "1", - 14, - ["473"] - ], - [ - "gp", - "590", - 0 - ], - [ - "gu", - "1", - 15, - ["671"] - ], - [ - "gt", - "502" - ], - [ - "gg", - "44", - 1, - ["1481", "7781", "7839", "7911"] - ], - [ - "gn", - "224" - ], - [ - "gw", - "245" - ], - [ - "gy", - "592" - ], - [ - "ht", - "509" - ], - [ - "hn", - "504" - ], - [ - "hk", - "852" - ], - [ - "hu", - "36" - ], - [ - "is", - "354" - ], - [ - "in", - "91" - ], - [ - "id", - "62" - ], - [ - "ir", - "98" - ], - [ - "iq", - "964" - ], - [ - "ie", - "353" - ], - [ - "im", - "44", - 2, - ["1624", "74576", "7524", "7924", "7624"] - ], - [ - "il", - "972" - ], - [ - "it", - "39", - 0 - ], - [ - "jm", - "1", - 4, - ["876", "658"] - ], - [ - "jp", - "81" - ], - [ - "je", - "44", - 3, - ["1534", "7509", "7700", "7797", "7829", "7937"] - ], - [ - "jo", - "962" - ], - [ - "kz", - "7", - 1, - ["33", "7"] - ], - [ - "ke", - "254" - ], - [ - "ki", - "686" - ], - [ - "xk", - "383" - ], - [ - "kw", - "965" - ], - [ - "kg", - "996" - ], - [ - "la", - "856" - ], - [ - "lv", - "371" - ], - [ - "lb", - "961" - ], - [ - "ls", - "266" - ], - [ - "lr", - "231" - ], - [ - "ly", - "218" - ], - [ - "li", - "423" - ], - [ - "lt", - "370" - ], - [ - "lu", - "352" - ], - [ - "mo", - "853" - ], - [ - "mg", - "261" - ], - [ - "mw", - "265" - ], - [ - "my", - "60" - ], - [ - "mv", - "960" - ], - [ - "ml", - "223" - ], - [ - "mt", - "356" - ], - [ - "mh", - "692" - ], - [ - "mq", - "596" - ], - [ - "mr", - "222" - ], - [ - "mu", - "230" - ], - [ - "yt", - "262", - 1, - ["269", "639"] - ], - [ - "mx", - "52" - ], - [ - "fm", - "691" - ], - [ - "md", - "373" - ], - [ - "mc", - "377" - ], - [ - "mn", - "976" - ], - [ - "me", - "382" - ], - [ - "ms", - "1", - 16, - ["664"] - ], - [ - "ma", - "212", - 0 - ], - [ - "mz", - "258" - ], - [ - "mm", - "95" - ], - [ - "na", - "264" - ], - [ - "nr", - "674" - ], - [ - "np", - "977" - ], - [ - "nl", - "31" - ], - [ - "nc", - "687" - ], - [ - "nz", - "64" - ], - [ - "ni", - "505" - ], - [ - "ne", - "227" - ], - [ - "ng", - "234" - ], - [ - "nu", - "683" - ], - [ - "nf", - "672" - ], - [ - "kp", - "850" - ], - [ - "mk", - "389" - ], - [ - "mp", - "1", - 17, - ["670"] - ], - [ - "no", - "47", - 0 - ], - [ - "om", - "968" - ], - [ - "pk", - "92" - ], - [ - "pw", - "680" - ], - [ - "ps", - "970" - ], - [ - "pa", - "507" - ], - [ - "pg", - "675" - ], - [ - "py", - "595" - ], - [ - "pe", - "51" - ], - [ - "ph", - "63" - ], - [ - "pl", - "48" - ], - [ - "pt", - "351" - ], - [ - "pr", - "1", - 3, - ["787", "939"] - ], - [ - "qa", - "974" - ], - [ - "re", - "262", - 0 - ], - [ - "ro", - "40" - ], - [ - "ru", - "7", - 0 - ], - [ - "rw", - "250" - ], - [ - "ws", - "685" - ], - [ - "sm", - "378" - ], - [ - "st", - "239" - ], - [ - "sa", - "966" - ], - [ - "sn", - "221" - ], - [ - "rs", - "381" - ], - [ - "sc", - "248" - ], - [ - "sl", - "232" - ], - [ - "sg", - "65" - ], - [ - "sx", - "1", - 21, - ["721"] - ], - [ - "sk", - "421" - ], - [ - "si", - "386" - ], - [ - "sb", - "677" - ], - [ - "so", - "252" - ], - [ - "za", - "27" - ], - [ - "kr", - "82" - ], - [ - "ss", - "211" - ], - [ - "es", - "34" - ], - [ - "lk", - "94" - ], - [ - "bl", - "590", - 1 - ], - [ - "sh", - "290" - ], - [ - "kn", - "1", - 18, - ["869"] - ], - [ - "lc", - "1", - 19, - ["758"] - ], - [ - "mf", - "590", - 2 - ], - [ - "pm", - "508" - ], - [ - "vc", - "1", - 20, - ["784"] - ], - [ - "sd", - "249" - ], - [ - "sr", - "597" - ], - [ - "sj", - "47", - 1, - ["79"] - ], - [ - "se", - "46" - ], - [ - "ch", - "41" - ], - [ - "sy", - "963" - ], - [ - "tw", - "886" - ], - [ - "tj", - "992" - ], - [ - "tz", - "255" - ], - [ - "th", - "66" - ], - [ - "tl", - "670" - ], - [ - "tg", - "228" - ], - [ - "tk", - "690" - ], - [ - "to", - "676" - ], - [ - "tt", - "1", - 22, - ["868"] - ], - [ - "tn", - "216" - ], - [ - "tr", - "90" - ], - [ - "tm", - "993" - ], - [ - "tc", - "1", - 23, - ["649"] - ], - [ - "tv", - "688" - ], - [ - "ug", - "256" - ], - [ - "ua", - "380" - ], - [ - "ae", - "971" - ], - [ - "gb", - "44", - 0 - ], - [ - "us", - "1", - 0 - ], - [ - "uy", - "598" - ], - [ - "vi", - "1", - 24, - ["340"] - ], - [ - "uz", - "998" - ], - [ - "vu", - "678" - ], - [ - "va", - "39", - 1, - ["06698"] - ], - [ - "ve", - "58" - ], - [ - "vn", - "84" - ], - [ - "wf", - "681" - ], - [ - "eh", - "212", - 1, - ["5288", "5289"] - ], - [ - "ye", - "967" - ], - [ - "zm", - "260" - ], - [ - "zw", - "263" - ], - [ - "ax", - "358", - 1, - ["18"] - ] - ]; - var allCountries = []; - for (let i = 0; i < rawCountryData.length; i++) { - const c = rawCountryData[i]; - allCountries[i] = { - name: "", - // this is now populated in the plugin - iso2: c[0], - dialCode: c[1], - priority: c[2] || 0, - areaCodes: c[3] || null, - nodeById: {} - }; - } - var data_default = allCountries; + if (typeof module === 'object' && module.exports) { + module.exports = factory(); + } else { + window.intlTelInput = factory(); + } +}(() => { - // src/js/i18n/en/countries.ts - var countries_default = { - ad: "Andorra", - ae: "United Arab Emirates", - af: "Afghanistan", - ag: "Antigua & Barbuda", - ai: "Anguilla", - al: "Albania", - am: "Armenia", - ao: "Angola", - aq: "Antarctica", - ar: "Argentina", - as: "American Samoa", - at: "Austria", - au: "Australia", - aw: "Aruba", - ax: "\xC5land Islands", - az: "Azerbaijan", - ba: "Bosnia & Herzegovina", - bb: "Barbados", - bd: "Bangladesh", - be: "Belgium", - bf: "Burkina Faso", - bg: "Bulgaria", - bh: "Bahrain", - bi: "Burundi", - bj: "Benin", - bl: "St. Barth\xE9lemy", - bm: "Bermuda", - bn: "Brunei", - bo: "Bolivia", - bq: "Caribbean Netherlands", - br: "Brazil", - bs: "Bahamas", - bt: "Bhutan", - bv: "Bouvet Island", - bw: "Botswana", - by: "Belarus", - bz: "Belize", - ca: "Canada", - cc: "Cocos (Keeling) Islands", - cd: "Congo - Kinshasa", - cf: "Central African Republic", - cg: "Congo - Brazzaville", - ch: "Switzerland", - ci: "C\xF4te d\u2019Ivoire", - ck: "Cook Islands", - cl: "Chile", - cm: "Cameroon", - cn: "China", - co: "Colombia", - cr: "Costa Rica", - cu: "Cuba", - cv: "Cape Verde", - cw: "Cura\xE7ao", - cx: "Christmas Island", - cy: "Cyprus", - cz: "Czechia", - de: "Germany", - dj: "Djibouti", - dk: "Denmark", - dm: "Dominica", - do: "Dominican Republic", - dz: "Algeria", - ec: "Ecuador", - ee: "Estonia", - eg: "Egypt", - eh: "Western Sahara", - er: "Eritrea", - es: "Spain", - et: "Ethiopia", - fi: "Finland", - fj: "Fiji", - fk: "Falkland Islands", - fm: "Micronesia", - fo: "Faroe Islands", - fr: "France", - ga: "Gabon", - gb: "United Kingdom", - gd: "Grenada", - ge: "Georgia", - gf: "French Guiana", - gg: "Guernsey", - gh: "Ghana", - gi: "Gibraltar", - gl: "Greenland", - gm: "Gambia", - gn: "Guinea", - gp: "Guadeloupe", - gq: "Equatorial Guinea", - gr: "Greece", - gs: "South Georgia & South Sandwich Islands", - gt: "Guatemala", - gu: "Guam", - gw: "Guinea-Bissau", - gy: "Guyana", - hk: "Hong Kong SAR China", - hm: "Heard & McDonald Islands", - hn: "Honduras", - hr: "Croatia", - ht: "Haiti", - hu: "Hungary", - id: "Indonesia", - ie: "Ireland", - il: "Israel", - im: "Isle of Man", - in: "India", - io: "British Indian Ocean Territory", - iq: "Iraq", - ir: "Iran", - is: "Iceland", - it: "Italy", - je: "Jersey", - jm: "Jamaica", - jo: "Jordan", - jp: "Japan", - ke: "Kenya", - kg: "Kyrgyzstan", - kh: "Cambodia", - ki: "Kiribati", - km: "Comoros", - kn: "St. Kitts & Nevis", - kp: "North Korea", - kr: "South Korea", - kw: "Kuwait", - ky: "Cayman Islands", - kz: "Kazakhstan", - la: "Laos", - lb: "Lebanon", - lc: "St. Lucia", - li: "Liechtenstein", - lk: "Sri Lanka", - lr: "Liberia", - ls: "Lesotho", - lt: "Lithuania", - lu: "Luxembourg", - lv: "Latvia", - ly: "Libya", - ma: "Morocco", - mc: "Monaco", - md: "Moldova", - me: "Montenegro", - mf: "St. Martin", - mg: "Madagascar", - mh: "Marshall Islands", - mk: "North Macedonia", - ml: "Mali", - mm: "Myanmar (Burma)", - mn: "Mongolia", - mo: "Macao SAR China", - mp: "Northern Mariana Islands", - mq: "Martinique", - mr: "Mauritania", - ms: "Montserrat", - mt: "Malta", - mu: "Mauritius", - mv: "Maldives", - mw: "Malawi", - mx: "Mexico", - my: "Malaysia", - mz: "Mozambique", - na: "Namibia", - nc: "New Caledonia", - ne: "Niger", - nf: "Norfolk Island", - ng: "Nigeria", - ni: "Nicaragua", - nl: "Netherlands", - no: "Norway", - np: "Nepal", - nr: "Nauru", - nu: "Niue", - nz: "New Zealand", - om: "Oman", - pa: "Panama", - pe: "Peru", - pf: "French Polynesia", - pg: "Papua New Guinea", - ph: "Philippines", - pk: "Pakistan", - pl: "Poland", - pm: "St. Pierre & Miquelon", - pn: "Pitcairn Islands", - pr: "Puerto Rico", - ps: "Palestinian Territories", - pt: "Portugal", - pw: "Palau", - py: "Paraguay", - qa: "Qatar", - re: "R\xE9union", - ro: "Romania", - rs: "Serbia", - ru: "Russia", - rw: "Rwanda", - sa: "Saudi Arabia", - sb: "Solomon Islands", - sc: "Seychelles", - sd: "Sudan", - se: "Sweden", - sg: "Singapore", - sh: "St. Helena", - si: "Slovenia", - sj: "Svalbard & Jan Mayen", - sk: "Slovakia", - sl: "Sierra Leone", - sm: "San Marino", - sn: "Senegal", - so: "Somalia", - sr: "Suriname", - ss: "South Sudan", - st: "S\xE3o Tom\xE9 & Pr\xEDncipe", - sv: "El Salvador", - sx: "Sint Maarten", - sy: "Syria", - sz: "Eswatini", - tc: "Turks & Caicos Islands", - td: "Chad", - tf: "French Southern Territories", - tg: "Togo", - th: "Thailand", - tj: "Tajikistan", - tk: "Tokelau", - tl: "Timor-Leste", - tm: "Turkmenistan", - tn: "Tunisia", - to: "Tonga", - tr: "Turkey", - tt: "Trinidad & Tobago", - tv: "Tuvalu", - tw: "Taiwan", - tz: "Tanzania", - ua: "Ukraine", - ug: "Uganda", - um: "U.S. Outlying Islands", - us: "United States", - uy: "Uruguay", - uz: "Uzbekistan", - va: "Vatican City", - vc: "St. Vincent & Grenadines", - ve: "Venezuela", - vg: "British Virgin Islands", - vi: "U.S. Virgin Islands", - vn: "Vietnam", - vu: "Vanuatu", - wf: "Wallis & Futuna", - ws: "Samoa", - ye: "Yemen", - yt: "Mayotte", - za: "South Africa", - zm: "Zambia", - zw: "Zimbabwe" - }; +var factoryOutput = (() => { + var __defProp = Object.defineProperty; + var __getOwnPropDesc = Object.getOwnPropertyDescriptor; + var __getOwnPropNames = Object.getOwnPropertyNames; + var __hasOwnProp = Object.prototype.hasOwnProperty; + var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); + }; + var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; + }; + var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - // src/js/i18n/en/interface.ts - var interface_default = { - selectedCountryAriaLabel: "Selected country", - noCountrySelected: "No country selected", - countryListAriaLabel: "List of countries", - searchPlaceholder: "Search", - zeroSearchResults: "No results found", - oneSearchResult: "1 result found", - multipleSearchResults: "${count} results found", - // additional countries (not supported by country-list library) - ac: "Ascension Island", - xk: "Kosovo" - }; + // src/js/intl-tel-input/intlTelInputWithUtils.ts + var intlTelInputWithUtils_exports = {}; + __export(intlTelInputWithUtils_exports, { + default: () => intlTelInputWithUtils_default + }); + + // src/js/intl-tel-input/data.ts + var rawCountryData = [ + [ + "af", + "93" + ], + [ + "al", + "355" + ], + [ + "dz", + "213" + ], + [ + "as", + "1", + 5, + ["684"] + ], + [ + "ad", + "376" + ], + [ + "ao", + "244" + ], + [ + "ai", + "1", + 6, + ["264"] + ], + [ + "ag", + "1", + 7, + ["268"] + ], + [ + "ar", + "54" + ], + [ + "am", + "374" + ], + [ + "aw", + "297" + ], + [ + "ac", + "247" + ], + [ + "au", + "61", + 0 + ], + [ + "at", + "43" + ], + [ + "az", + "994" + ], + [ + "bs", + "1", + 8, + ["242"] + ], + [ + "bh", + "973" + ], + [ + "bd", + "880" + ], + [ + "bb", + "1", + 9, + ["246"] + ], + [ + "by", + "375" + ], + [ + "be", + "32" + ], + [ + "bz", + "501" + ], + [ + "bj", + "229" + ], + [ + "bm", + "1", + 10, + ["441"] + ], + [ + "bt", + "975" + ], + [ + "bo", + "591" + ], + [ + "ba", + "387" + ], + [ + "bw", + "267" + ], + [ + "br", + "55" + ], + [ + "io", + "246" + ], + [ + "vg", + "1", + 11, + ["284"] + ], + [ + "bn", + "673" + ], + [ + "bg", + "359" + ], + [ + "bf", + "226" + ], + [ + "bi", + "257" + ], + [ + "kh", + "855" + ], + [ + "cm", + "237" + ], + [ + "ca", + "1", + 1, + ["204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "879", "902", "905"] + ], + [ + "cv", + "238" + ], + [ + "bq", + "599", + 1, + ["3", "4", "7"] + ], + [ + "ky", + "1", + 12, + ["345"] + ], + [ + "cf", + "236" + ], + [ + "td", + "235" + ], + [ + "cl", + "56" + ], + [ + "cn", + "86" + ], + [ + "cx", + "61", + 2, + ["89164"] + ], + [ + "cc", + "61", + 1, + ["89162"] + ], + [ + "co", + "57" + ], + [ + "km", + "269" + ], + [ + "cg", + "242" + ], + [ + "cd", + "243" + ], + [ + "ck", + "682" + ], + [ + "cr", + "506" + ], + [ + "ci", + "225" + ], + [ + "hr", + "385" + ], + [ + "cu", + "53" + ], + [ + "cw", + "599", + 0 + ], + [ + "cy", + "357" + ], + [ + "cz", + "420" + ], + [ + "dk", + "45" + ], + [ + "dj", + "253" + ], + [ + "dm", + "1", + 13, + ["767"] + ], + [ + "do", + "1", + 2, + ["809", "829", "849"] + ], + [ + "ec", + "593" + ], + [ + "eg", + "20" + ], + [ + "sv", + "503" + ], + [ + "gq", + "240" + ], + [ + "er", + "291" + ], + [ + "ee", + "372" + ], + [ + "sz", + "268" + ], + [ + "et", + "251" + ], + [ + "fk", + "500" + ], + [ + "fo", + "298" + ], + [ + "fj", + "679" + ], + [ + "fi", + "358", + 0 + ], + [ + "fr", + "33" + ], + [ + "gf", + "594" + ], + [ + "pf", + "689" + ], + [ + "ga", + "241" + ], + [ + "gm", + "220" + ], + [ + "ge", + "995" + ], + [ + "de", + "49" + ], + [ + "gh", + "233" + ], + [ + "gi", + "350" + ], + [ + "gr", + "30" + ], + [ + "gl", + "299" + ], + [ + "gd", + "1", + 14, + ["473"] + ], + [ + "gp", + "590", + 0 + ], + [ + "gu", + "1", + 15, + ["671"] + ], + [ + "gt", + "502" + ], + [ + "gg", + "44", + 1, + ["1481", "7781", "7839", "7911"] + ], + [ + "gn", + "224" + ], + [ + "gw", + "245" + ], + [ + "gy", + "592" + ], + [ + "ht", + "509" + ], + [ + "hn", + "504" + ], + [ + "hk", + "852" + ], + [ + "hu", + "36" + ], + [ + "is", + "354" + ], + [ + "in", + "91" + ], + [ + "id", + "62" + ], + [ + "ir", + "98" + ], + [ + "iq", + "964" + ], + [ + "ie", + "353" + ], + [ + "im", + "44", + 2, + ["1624", "74576", "7524", "7924", "7624"] + ], + [ + "il", + "972" + ], + [ + "it", + "39", + 0 + ], + [ + "jm", + "1", + 4, + ["876", "658"] + ], + [ + "jp", + "81" + ], + [ + "je", + "44", + 3, + ["1534", "7509", "7700", "7797", "7829", "7937"] + ], + [ + "jo", + "962" + ], + [ + "kz", + "7", + 1, + ["33", "7"] + ], + [ + "ke", + "254" + ], + [ + "ki", + "686" + ], + [ + "xk", + "383" + ], + [ + "kw", + "965" + ], + [ + "kg", + "996" + ], + [ + "la", + "856" + ], + [ + "lv", + "371" + ], + [ + "lb", + "961" + ], + [ + "ls", + "266" + ], + [ + "lr", + "231" + ], + [ + "ly", + "218" + ], + [ + "li", + "423" + ], + [ + "lt", + "370" + ], + [ + "lu", + "352" + ], + [ + "mo", + "853" + ], + [ + "mg", + "261" + ], + [ + "mw", + "265" + ], + [ + "my", + "60" + ], + [ + "mv", + "960" + ], + [ + "ml", + "223" + ], + [ + "mt", + "356" + ], + [ + "mh", + "692" + ], + [ + "mq", + "596" + ], + [ + "mr", + "222" + ], + [ + "mu", + "230" + ], + [ + "yt", + "262", + 1, + ["269", "639"] + ], + [ + "mx", + "52" + ], + [ + "fm", + "691" + ], + [ + "md", + "373" + ], + [ + "mc", + "377" + ], + [ + "mn", + "976" + ], + [ + "me", + "382" + ], + [ + "ms", + "1", + 16, + ["664"] + ], + [ + "ma", + "212", + 0 + ], + [ + "mz", + "258" + ], + [ + "mm", + "95" + ], + [ + "na", + "264" + ], + [ + "nr", + "674" + ], + [ + "np", + "977" + ], + [ + "nl", + "31" + ], + [ + "nc", + "687" + ], + [ + "nz", + "64" + ], + [ + "ni", + "505" + ], + [ + "ne", + "227" + ], + [ + "ng", + "234" + ], + [ + "nu", + "683" + ], + [ + "nf", + "672" + ], + [ + "kp", + "850" + ], + [ + "mk", + "389" + ], + [ + "mp", + "1", + 17, + ["670"] + ], + [ + "no", + "47", + 0 + ], + [ + "om", + "968" + ], + [ + "pk", + "92" + ], + [ + "pw", + "680" + ], + [ + "ps", + "970" + ], + [ + "pa", + "507" + ], + [ + "pg", + "675" + ], + [ + "py", + "595" + ], + [ + "pe", + "51" + ], + [ + "ph", + "63" + ], + [ + "pl", + "48" + ], + [ + "pt", + "351" + ], + [ + "pr", + "1", + 3, + ["787", "939"] + ], + [ + "qa", + "974" + ], + [ + "re", + "262", + 0 + ], + [ + "ro", + "40" + ], + [ + "ru", + "7", + 0 + ], + [ + "rw", + "250" + ], + [ + "ws", + "685" + ], + [ + "sm", + "378" + ], + [ + "st", + "239" + ], + [ + "sa", + "966" + ], + [ + "sn", + "221" + ], + [ + "rs", + "381" + ], + [ + "sc", + "248" + ], + [ + "sl", + "232" + ], + [ + "sg", + "65" + ], + [ + "sx", + "1", + 21, + ["721"] + ], + [ + "sk", + "421" + ], + [ + "si", + "386" + ], + [ + "sb", + "677" + ], + [ + "so", + "252" + ], + [ + "za", + "27" + ], + [ + "kr", + "82" + ], + [ + "ss", + "211" + ], + [ + "es", + "34" + ], + [ + "lk", + "94" + ], + [ + "bl", + "590", + 1 + ], + [ + "sh", + "290" + ], + [ + "kn", + "1", + 18, + ["869"] + ], + [ + "lc", + "1", + 19, + ["758"] + ], + [ + "mf", + "590", + 2 + ], + [ + "pm", + "508" + ], + [ + "vc", + "1", + 20, + ["784"] + ], + [ + "sd", + "249" + ], + [ + "sr", + "597" + ], + [ + "sj", + "47", + 1, + ["79"] + ], + [ + "se", + "46" + ], + [ + "ch", + "41" + ], + [ + "sy", + "963" + ], + [ + "tw", + "886" + ], + [ + "tj", + "992" + ], + [ + "tz", + "255" + ], + [ + "th", + "66" + ], + [ + "tl", + "670" + ], + [ + "tg", + "228" + ], + [ + "tk", + "690" + ], + [ + "to", + "676" + ], + [ + "tt", + "1", + 22, + ["868"] + ], + [ + "tn", + "216" + ], + [ + "tr", + "90" + ], + [ + "tm", + "993" + ], + [ + "tc", + "1", + 23, + ["649"] + ], + [ + "tv", + "688" + ], + [ + "ug", + "256" + ], + [ + "ua", + "380" + ], + [ + "ae", + "971" + ], + [ + "gb", + "44", + 0 + ], + [ + "us", + "1", + 0 + ], + [ + "uy", + "598" + ], + [ + "vi", + "1", + 24, + ["340"] + ], + [ + "uz", + "998" + ], + [ + "vu", + "678" + ], + [ + "va", + "39", + 1, + ["06698"] + ], + [ + "ve", + "58" + ], + [ + "vn", + "84" + ], + [ + "wf", + "681" + ], + [ + "eh", + "212", + 1, + ["5288", "5289"] + ], + [ + "ye", + "967" + ], + [ + "zm", + "260" + ], + [ + "zw", + "263" + ], + [ + "ax", + "358", + 1, + ["18"] + ] + ]; + var allCountries = []; + for (let i = 0; i < rawCountryData.length; i++) { + const c = rawCountryData[i]; + allCountries[i] = { + name: "", + // this is now populated in the plugin + iso2: c[0], + dialCode: c[1], + priority: c[2] || 0, + areaCodes: c[3] || null, + nodeById: {} + }; + } + var data_default = allCountries; + + // src/js/i18n/en/countries.ts + var countries_default = { + ad: "Andorra", + ae: "United Arab Emirates", + af: "Afghanistan", + ag: "Antigua & Barbuda", + ai: "Anguilla", + al: "Albania", + am: "Armenia", + ao: "Angola", + aq: "Antarctica", + ar: "Argentina", + as: "American Samoa", + at: "Austria", + au: "Australia", + aw: "Aruba", + ax: "\xC5land Islands", + az: "Azerbaijan", + ba: "Bosnia & Herzegovina", + bb: "Barbados", + bd: "Bangladesh", + be: "Belgium", + bf: "Burkina Faso", + bg: "Bulgaria", + bh: "Bahrain", + bi: "Burundi", + bj: "Benin", + bl: "St. Barth\xE9lemy", + bm: "Bermuda", + bn: "Brunei", + bo: "Bolivia", + bq: "Caribbean Netherlands", + br: "Brazil", + bs: "Bahamas", + bt: "Bhutan", + bv: "Bouvet Island", + bw: "Botswana", + by: "Belarus", + bz: "Belize", + ca: "Canada", + cc: "Cocos (Keeling) Islands", + cd: "Congo - Kinshasa", + cf: "Central African Republic", + cg: "Congo - Brazzaville", + ch: "Switzerland", + ci: "C\xF4te d\u2019Ivoire", + ck: "Cook Islands", + cl: "Chile", + cm: "Cameroon", + cn: "China", + co: "Colombia", + cr: "Costa Rica", + cu: "Cuba", + cv: "Cape Verde", + cw: "Cura\xE7ao", + cx: "Christmas Island", + cy: "Cyprus", + cz: "Czechia", + de: "Germany", + dj: "Djibouti", + dk: "Denmark", + dm: "Dominica", + do: "Dominican Republic", + dz: "Algeria", + ec: "Ecuador", + ee: "Estonia", + eg: "Egypt", + eh: "Western Sahara", + er: "Eritrea", + es: "Spain", + et: "Ethiopia", + fi: "Finland", + fj: "Fiji", + fk: "Falkland Islands", + fm: "Micronesia", + fo: "Faroe Islands", + fr: "France", + ga: "Gabon", + gb: "United Kingdom", + gd: "Grenada", + ge: "Georgia", + gf: "French Guiana", + gg: "Guernsey", + gh: "Ghana", + gi: "Gibraltar", + gl: "Greenland", + gm: "Gambia", + gn: "Guinea", + gp: "Guadeloupe", + gq: "Equatorial Guinea", + gr: "Greece", + gs: "South Georgia & South Sandwich Islands", + gt: "Guatemala", + gu: "Guam", + gw: "Guinea-Bissau", + gy: "Guyana", + hk: "Hong Kong SAR China", + hm: "Heard & McDonald Islands", + hn: "Honduras", + hr: "Croatia", + ht: "Haiti", + hu: "Hungary", + id: "Indonesia", + ie: "Ireland", + il: "Israel", + im: "Isle of Man", + in: "India", + io: "British Indian Ocean Territory", + iq: "Iraq", + ir: "Iran", + is: "Iceland", + it: "Italy", + je: "Jersey", + jm: "Jamaica", + jo: "Jordan", + jp: "Japan", + ke: "Kenya", + kg: "Kyrgyzstan", + kh: "Cambodia", + ki: "Kiribati", + km: "Comoros", + kn: "St. Kitts & Nevis", + kp: "North Korea", + kr: "South Korea", + kw: "Kuwait", + ky: "Cayman Islands", + kz: "Kazakhstan", + la: "Laos", + lb: "Lebanon", + lc: "St. Lucia", + li: "Liechtenstein", + lk: "Sri Lanka", + lr: "Liberia", + ls: "Lesotho", + lt: "Lithuania", + lu: "Luxembourg", + lv: "Latvia", + ly: "Libya", + ma: "Morocco", + mc: "Monaco", + md: "Moldova", + me: "Montenegro", + mf: "St. Martin", + mg: "Madagascar", + mh: "Marshall Islands", + mk: "North Macedonia", + ml: "Mali", + mm: "Myanmar (Burma)", + mn: "Mongolia", + mo: "Macao SAR China", + mp: "Northern Mariana Islands", + mq: "Martinique", + mr: "Mauritania", + ms: "Montserrat", + mt: "Malta", + mu: "Mauritius", + mv: "Maldives", + mw: "Malawi", + mx: "Mexico", + my: "Malaysia", + mz: "Mozambique", + na: "Namibia", + nc: "New Caledonia", + ne: "Niger", + nf: "Norfolk Island", + ng: "Nigeria", + ni: "Nicaragua", + nl: "Netherlands", + no: "Norway", + np: "Nepal", + nr: "Nauru", + nu: "Niue", + nz: "New Zealand", + om: "Oman", + pa: "Panama", + pe: "Peru", + pf: "French Polynesia", + pg: "Papua New Guinea", + ph: "Philippines", + pk: "Pakistan", + pl: "Poland", + pm: "St. Pierre & Miquelon", + pn: "Pitcairn Islands", + pr: "Puerto Rico", + ps: "Palestinian Territories", + pt: "Portugal", + pw: "Palau", + py: "Paraguay", + qa: "Qatar", + re: "R\xE9union", + ro: "Romania", + rs: "Serbia", + ru: "Russia", + rw: "Rwanda", + sa: "Saudi Arabia", + sb: "Solomon Islands", + sc: "Seychelles", + sd: "Sudan", + se: "Sweden", + sg: "Singapore", + sh: "St. Helena", + si: "Slovenia", + sj: "Svalbard & Jan Mayen", + sk: "Slovakia", + sl: "Sierra Leone", + sm: "San Marino", + sn: "Senegal", + so: "Somalia", + sr: "Suriname", + ss: "South Sudan", + st: "S\xE3o Tom\xE9 & Pr\xEDncipe", + sv: "El Salvador", + sx: "Sint Maarten", + sy: "Syria", + sz: "Eswatini", + tc: "Turks & Caicos Islands", + td: "Chad", + tf: "French Southern Territories", + tg: "Togo", + th: "Thailand", + tj: "Tajikistan", + tk: "Tokelau", + tl: "Timor-Leste", + tm: "Turkmenistan", + tn: "Tunisia", + to: "Tonga", + tr: "Turkey", + tt: "Trinidad & Tobago", + tv: "Tuvalu", + tw: "Taiwan", + tz: "Tanzania", + ua: "Ukraine", + ug: "Uganda", + um: "U.S. Outlying Islands", + us: "United States", + uy: "Uruguay", + uz: "Uzbekistan", + va: "Vatican City", + vc: "St. Vincent & Grenadines", + ve: "Venezuela", + vg: "British Virgin Islands", + vi: "U.S. Virgin Islands", + vn: "Vietnam", + vu: "Vanuatu", + wf: "Wallis & Futuna", + ws: "Samoa", + ye: "Yemen", + yt: "Mayotte", + za: "South Africa", + zm: "Zambia", + zw: "Zimbabwe" + }; + + // src/js/i18n/en/interface.ts + var interface_default = { + selectedCountryAriaLabel: "Selected country", + noCountrySelected: "No country selected", + countryListAriaLabel: "List of countries", + searchPlaceholder: "Search", + zeroSearchResults: "No results found", + oneSearchResult: "1 result found", + multipleSearchResults: "${count} results found", + // additional countries (not supported by country-list library) + ac: "Ascension Island", + xk: "Kosovo" + }; - // src/js/i18n/en/index.ts - var en_default = { ...countries_default, ...interface_default }; + // src/js/i18n/en/index.ts + var en_default = { ...countries_default, ...interface_default }; - // src/js/intl-tel-input.ts - for (let i = 0; i < data_default.length; i++) { - data_default[i].name = en_default[data_default[i].iso2]; + // src/js/intl-tel-input.ts + for (let i = 0; i < data_default.length; i++) { + data_default[i].name = en_default[data_default[i].iso2]; + } + var id = 0; + var defaults = { + //* Whether or not to allow the dropdown. + allowDropdown: true, + //* Add a placeholder in the input with an example number for the selected country. + autoPlaceholder: "polite", + //* Modify the parentClass. + containerClass: "", + //* The order of the countries in the dropdown. Defaults to alphabetical. + countryOrder: null, + //* Add a country search input at the top of the dropdown. + countrySearch: true, + //* Modify the auto placeholder. + customPlaceholder: null, + //* Append menu to specified element. + dropdownContainer: null, + //* Don't display these countries. + excludeCountries: [], + //* Fix the dropdown width to the input width (rather than being as wide as the longest country name). + fixDropdownWidth: true, + //* Format the number as the user types + formatAsYouType: true, + //* Format the input value during initialisation and on setNumber. + formatOnDisplay: true, + //* geoIp lookup function. + geoIpLookup: null, + //* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber. + hiddenInput: null, + //* Internationalise the plugin text e.g. search input placeholder, country names. + i18n: {}, + //* Initial country. + initialCountry: "", + //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers. + nationalMode: true, + //* Display only these countries. + onlyCountries: [], + //* Number type to use for placeholders. + placeholderNumberType: "MOBILE", + //* Show flags - for both the selected country, and in the country dropdown + showFlags: true, + //* Display the international dial code next to the selected flag. + separateDialCode: false, + //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length. + strictMode: false, + //* Use full screen popup instead of dropdown for country list. + useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? ( + //* We cannot just test screen size as some smartphones/website meta tags will report desktop resolutions. + //* Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' + /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test( + navigator.userAgent + ) || window.innerWidth <= 500 + ) : false, + //* Specify the path to the libphonenumber script to enable validation/formatting. + utilsScript: "", + //* The number type to enforce during validation. + validationNumberType: "MOBILE" + }; + var regionlessNanpNumbers = [ + "800", + "822", + "833", + "844", + "855", + "866", + "877", + "880", + "881", + "882", + "883", + "884", + "885", + "886", + "887", + "888", + "889" + ]; + var getNumeric = (s) => s.replace(/\D/g, ""); + var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(); + var isRegionlessNanp = (number) => { + const numeric = getNumeric(number); + if (numeric.charAt(0) === "1") { + const areaCode = numeric.substr(1, 3); + return regionlessNanpNumbers.indexOf(areaCode) !== -1; + } + return false; + }; + var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => { + if (prevCaretPos === 0 && !isDeleteForwards) { + return 0; + } + let count = 0; + for (let i = 0; i < formattedValue.length; i++) { + if (/[+0-9]/.test(formattedValue[i])) { + count++; + } + if (count === relevantChars && !isDeleteForwards) { + return i + 1; + } + if (isDeleteForwards && count === relevantChars + 1) { + return i; + } + } + return formattedValue.length; + }; + var createEl = (name, attrs, container) => { + const el = document.createElement(name); + if (attrs) { + Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value)); + } + if (container) { + container.appendChild(el); + } + return el; + }; + var forEachInstance = (method) => { + const { instances } = intlTelInput; + Object.values(instances).forEach((instance) => instance[method]()); + }; + var Iti = class { + constructor(input, customOptions = {}) { + this.id = id++; + this.telInput = input; + this.highlightedItem = null; + this.options = Object.assign({}, defaults, customOptions); + this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder")); + } + //* Can't be private as it's called from intlTelInput convenience wrapper. + _init() { + if (this.options.useFullscreenPopup) { + this.options.fixDropdownWidth = false; + } + if (this.options.separateDialCode) { + this.options.allowDropdown = true; + this.options.nationalMode = false; + this.options.countrySearch = true; + } + if (!this.options.showFlags && !this.options.separateDialCode) { + this.options.nationalMode = false; + } + if (this.options.useFullscreenPopup && !this.options.dropdownContainer) { + this.options.dropdownContainer = document.body; + } + this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false; + this.isRTL = !!this.telInput.closest("[dir=rtl]"); + if (this.options.separateDialCode) { + if (this.isRTL) { + this.originalPaddingRight = this.telInput.style.paddingRight; + } else { + this.originalPaddingLeft = this.telInput.style.paddingLeft; } - var id = 0; - var defaults = { - //* Whether or not to allow the dropdown. - allowDropdown: true, - //* Add a placeholder in the input with an example number for the selected country. - autoPlaceholder: "polite", - //* Modify the parentClass. - containerClass: "", - //* The order of the countries in the dropdown. Defaults to alphabetical. - countryOrder: null, - //* Add a country search input at the top of the dropdown. - countrySearch: true, - //* Modify the auto placeholder. - customPlaceholder: null, - //* Append menu to specified element. - dropdownContainer: null, - //* Don't display these countries. - excludeCountries: [], - //* Fix the dropdown width to the input width (rather than being as wide as the longest country name). - fixDropdownWidth: true, - //* Format the number as the user types - formatAsYouType: true, - //* Format the input value during initialisation and on setNumber. - formatOnDisplay: true, - //* geoIp lookup function. - geoIpLookup: null, - //* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber. - hiddenInput: null, - //* Internationalise the plugin text e.g. search input placeholder, country names. - i18n: {}, - //* Initial country. - initialCountry: "", - //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers. - nationalMode: true, - //* Display only these countries. - onlyCountries: [], - //* Number type to use for placeholders. - placeholderNumberType: "MOBILE", - //* Show flags - for both the selected country, and in the country dropdown - showFlags: true, - //* Display the international dial code next to the selected flag. - separateDialCode: false, - //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length. - strictMode: false, - //* Use full screen popup instead of dropdown for country list. - useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? ( - //* We cannot just test screen size as some smartphones/website meta tags will report desktop resolutions. - //* Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile' - /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test( - navigator.userAgent - ) || window.innerWidth <= 500 - ) : false, - //* Specify the path to the libphonenumber script to enable validation/formatting. - utilsScript: "", - //* The number type to enforce during validation. - validationNumberType: "MOBILE" - }; - var regionlessNanpNumbers = [ - "800", - "822", - "833", - "844", - "855", - "866", - "877", - "880", - "881", - "882", - "883", - "884", - "885", - "886", - "887", - "888", - "889" - ]; - var getNumeric = (s) => s.replace(/\D/g, ""); - var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(); - var isRegionlessNanp = (number) => { - const numeric = getNumeric(number); - if (numeric.charAt(0) === "1") { - const areaCode = numeric.substr(1, 3); - return regionlessNanpNumbers.indexOf(areaCode) !== -1; - } - return false; - }; - var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => { - if (prevCaretPos === 0 && !isDeleteForwards) { - return 0; - } - let count = 0; - for (let i = 0; i < formattedValue.length; i++) { - if (/[+0-9]/.test(formattedValue[i])) { - count++; - } - if (count === relevantChars && !isDeleteForwards) { - return i + 1; - } - if (isDeleteForwards && count === relevantChars + 1) { - return i; - } - } - return formattedValue.length; - }; - var createEl = (name, attrs, container) => { - const el = document.createElement(name); - if (attrs) { - Object.entries(attrs).forEach(([key, value]) => el.setAttribute(key, value)); - } - if (container) { - container.appendChild(el); - } - return el; - }; - var forEachInstance = (method) => { - const { instances } = intlTelInput; - Object.values(instances).forEach((instance) => instance[method]()); - }; - var Iti = class { - constructor(input, customOptions = {}) { - this.id = id++; - this.telInput = input; - this.highlightedItem = null; - this.options = Object.assign({}, defaults, customOptions); - this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder")); - } - //* Can't be private as it's called from intlTelInput convenience wrapper. - _init() { - if (this.options.useFullscreenPopup) { - this.options.fixDropdownWidth = false; - } - if (this.options.separateDialCode) { - this.options.allowDropdown = true; - this.options.nationalMode = false; - this.options.countrySearch = true; - } - if (!this.options.showFlags && !this.options.separateDialCode) { - this.options.nationalMode = false; - } - if (this.options.useFullscreenPopup && !this.options.dropdownContainer) { - this.options.dropdownContainer = document.body; - } - this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false; - this.isRTL = !!this.telInput.closest("[dir=rtl]"); - if (this.options.separateDialCode) { - if (this.isRTL) { - this.originalPaddingRight = this.telInput.style.paddingRight; - } else { - this.originalPaddingLeft = this.telInput.style.paddingLeft; - } - } - this.options.i18n = { ...en_default, ...this.options.i18n }; - const autoCountryPromise = new Promise((resolve, reject) => { - this.resolveAutoCountryPromise = resolve; - this.rejectAutoCountryPromise = reject; - }); - const utilsScriptPromise = new Promise((resolve, reject) => { - this.resolveUtilsScriptPromise = resolve; - this.rejectUtilsScriptPromise = reject; - }); - this.promise = Promise.all([autoCountryPromise, utilsScriptPromise]); - this.selectedCountryData = {}; - this._processCountryData(); - this._generateMarkup(); - this._setInitialState(); - this._initListeners(); - this._initRequests(); - } - //******************** - //* PRIVATE METHODS - //******************** - //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options. - _processCountryData() { - this._processAllCountries(); - this._processDialCodes(); - this._translateCountryNames(); - if (this.options.countryOrder) { - this.options.countryOrder = this.options.countryOrder.map((country) => country.toLowerCase()); - } - this._sortCountries(); - } - _sortCountries() { - this.countries.sort((a, b) => { - const { countryOrder } = this.options; - if (countryOrder) { - const aIndex = countryOrder.indexOf(a.iso2); - const bIndex = countryOrder.indexOf(b.iso2); - const aIndexExists = aIndex > -1; - const bIndexExists = bIndex > -1; - if (aIndexExists || bIndexExists) { - if (aIndexExists && bIndexExists) { - return aIndex - bIndex; - } - return aIndexExists ? -1 : 1; - } - } - if (a.name < b.name) { - return -1; - } - if (a.name > b.name) { - return 1; - } - return 0; - }); - } - //* Add a dial code to this.dialCodeToIso2Map. - _addToDialCodeMap(iso2, dialCode, priority) { - if (dialCode.length > this.dialCodeMaxLen) { - this.dialCodeMaxLen = dialCode.length; - } - if (!this.dialCodeToIso2Map.hasOwnProperty(dialCode)) { - this.dialCodeToIso2Map[dialCode] = []; - } - for (let i = 0; i < this.dialCodeToIso2Map[dialCode].length; i++) { - if (this.dialCodeToIso2Map[dialCode][i] === iso2) { - return; - } - } - const index = priority !== void 0 ? priority : this.dialCodeToIso2Map[dialCode].length; - this.dialCodeToIso2Map[dialCode][index] = iso2; - } - //* Process onlyCountries or excludeCountries array if present. - _processAllCountries() { - const { onlyCountries, excludeCountries } = this.options; - if (onlyCountries.length) { - const lowerCaseOnlyCountries = onlyCountries.map( - (country) => country.toLowerCase() - ); - this.countries = data_default.filter( - (country) => lowerCaseOnlyCountries.indexOf(country.iso2) > -1 - ); - } else if (excludeCountries.length) { - const lowerCaseExcludeCountries = excludeCountries.map( - (country) => country.toLowerCase() - ); - this.countries = data_default.filter( - (country) => lowerCaseExcludeCountries.indexOf(country.iso2) === -1 - ); - } else { - this.countries = data_default; - } - } - //* Translate Countries by object literal provided on config. - _translateCountryNames() { - for (let i = 0; i < this.countries.length; i++) { - const iso2 = this.countries[i].iso2.toLowerCase(); - if (this.options.i18n.hasOwnProperty(iso2)) { - this.countries[i].name = this.options.i18n[iso2]; - } - } - } - //* Generate this.dialCodes and this.dialCodeToIso2Map. - _processDialCodes() { - this.dialCodes = {}; - this.dialCodeMaxLen = 0; - this.dialCodeToIso2Map = {}; - for (let i = 0; i < this.countries.length; i++) { - const c = this.countries[i]; - if (!this.dialCodes[c.dialCode]) { - this.dialCodes[c.dialCode] = true; - } - this._addToDialCodeMap(c.iso2, c.dialCode, c.priority); - } - for (let i = 0; i < this.countries.length; i++) { - const c = this.countries[i]; - if (c.areaCodes) { - const rootIso2Code = this.dialCodeToIso2Map[c.dialCode][0]; - for (let j = 0; j < c.areaCodes.length; j++) { - const areaCode = c.areaCodes[j]; - for (let k = 1; k < areaCode.length; k++) { - const partialDialCode = c.dialCode + areaCode.substr(0, k); - this._addToDialCodeMap(rootIso2Code, partialDialCode); - this._addToDialCodeMap(c.iso2, partialDialCode); - } - this._addToDialCodeMap(c.iso2, c.dialCode + areaCode); - } - } - } - } - //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown. - _generateMarkup() { - this.telInput.classList.add("iti__tel-input"); - if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) { - this.telInput.setAttribute("autocomplete", "off"); - } - const { - allowDropdown, - separateDialCode, - showFlags, - containerClass, - hiddenInput, - dropdownContainer, - fixDropdownWidth, - useFullscreenPopup, - countrySearch, - i18n - } = this.options; - let parentClass = "iti"; - if (allowDropdown) { - parentClass += " iti--allow-dropdown"; - } - if (showFlags) { - parentClass += " iti--show-flags"; - } - if (containerClass) { - parentClass += ` ${containerClass}`; - } - if (!useFullscreenPopup) { - parentClass += " iti--inline-dropdown"; - } - const wrapper = createEl("div", { class: parentClass }); - this.telInput.parentNode?.insertBefore(wrapper, this.telInput); - if (allowDropdown || showFlags) { - this.countryContainer = createEl( - "div", - { class: "iti__country-container" }, - wrapper - ); - if (allowDropdown) { - this.selectedCountry = createEl( - "button", - { - type: "button", - class: "iti__selected-country", - "aria-expanded": "false", - "aria-label": this.options.i18n.selectedCountryAriaLabel, - "aria-haspopup": "true", - "aria-controls": `iti-${this.id}__dropdown-content`, - "role": "combobox" - }, - this.countryContainer - ); - if (this.telInput.disabled) { - this.selectedCountry.setAttribute("disabled", "true"); - } - } else { - this.selectedCountry = createEl( - "div", - { class: "iti__selected-country" }, - this.countryContainer - ); - } - const selectedCountryPrimary = createEl("div", { class: "iti__selected-country-primary" }, this.selectedCountry); - this.selectedCountryInner = createEl("div", null, selectedCountryPrimary); - this.selectedCountryA11yText = createEl( - "span", - { class: "iti__a11y-text" }, - this.selectedCountryInner - ); - if (allowDropdown) { - this.dropdownArrow = createEl( - "div", - { class: "iti__arrow", "aria-hidden": "true" }, - selectedCountryPrimary - ); - } - if (separateDialCode) { - this.selectedDialCode = createEl( - "div", - { class: "iti__selected-dial-code" }, - this.selectedCountry - ); - } - if (allowDropdown) { - const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width"; - this.dropdownContent = createEl("div", { - id: `iti-${this.id}__dropdown-content`, - class: `iti__dropdown-content iti__hide ${extraClasses}` - }); - if (countrySearch) { - this.searchInput = createEl( - "input", - { - type: "text", - class: "iti__search-input", - placeholder: i18n.searchPlaceholder, - role: "combobox", - "aria-expanded": "true", - "aria-label": i18n.searchPlaceholder, - "aria-controls": `iti-${this.id}__country-listbox`, - "aria-autocomplete": "list", - "autocomplete": "off" - }, - this.dropdownContent - ); - this.searchResultsA11yText = createEl( - "span", - { class: "iti__a11y-text" }, - this.dropdownContent - ); - } - this.countryList = createEl( - "ul", - { - class: "iti__country-list", - id: `iti-${this.id}__country-listbox`, - role: "listbox", - "aria-label": i18n.countryListAriaLabel - }, - this.dropdownContent - ); - this._appendListItems(); - if (countrySearch) { - this._updateSearchResultsText(); - } - if (dropdownContainer) { - let dropdownClasses = "iti iti--container"; - if (useFullscreenPopup) { - dropdownClasses += " iti--fullscreen-popup"; - } else { - dropdownClasses += " iti--inline-dropdown"; - } - this.dropdown = createEl("div", { class: dropdownClasses }); - this.dropdown.appendChild(this.dropdownContent); - } else { - this.countryContainer.appendChild(this.dropdownContent); - } - } - } - wrapper.appendChild(this.telInput); - if (hiddenInput) { - const telInputName = this.telInput.getAttribute("name") || ""; - const names = hiddenInput(telInputName); - if (names.phone) { - this.hiddenInput = createEl("input", { - type: "hidden", - name: names.phone - }); - wrapper.appendChild(this.hiddenInput); - } - if (names.country) { - this.hiddenInputCountry = createEl("input", { - type: "hidden", - name: names.country - }); - wrapper.appendChild(this.hiddenInputCountry); - } - } - } - //* For each country: add a country list item
  • to the countryList