{ "version": 3, "sources": ["../../../../Frontend/node_modules/intl-tel-input/build/js/intlTelInput.js", "../../../../Frontend/node_modules/intl-tel-input/index.js", "../../../../Frontend/node_modules/intl-tel-input/build/js/utils.js", "../../../../Frontend/src/scripts/individual-form.js"], "sourcesContent": ["/*\n * International Telephone Input v18.5.3\n * https://github.com/jackocnr/intl-tel-input.git\n * Licensed under the MIT license\n */\n\n// wrap in UMD\n(function(factory) {\n if (typeof module === \"object\" && module.exports) module.exports = factory(); else window.intlTelInput = factory();\n})(function(undefined) {\n \"use strict\";\n return function() {\n // Array of country objects for the flag dropdown.\n // Here is the criteria for the plugin to support a given country/territory\n // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2\n // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes\n // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png\n // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml\n // Each country array has the following information:\n // [\n // Country name,\n // iso2 code,\n // International dial code,\n // Order (if >1 country with same dial code),\n // Area codes\n // ]\n var allCountries = [ [ \"Afghanistan\", \"af\", \"93\" ], [ \"Albania\", \"al\", \"355\" ], [ \"Algeria\", \"dz\", \"213\" ], [ \"American Samoa\", \"as\", \"1\", 5, [ \"684\" ] ], [ \"Andorra\", \"ad\", \"376\" ], [ \"Angola\", \"ao\", \"244\" ], [ \"Anguilla\", \"ai\", \"1\", 6, [ \"264\" ] ], [ \"Antigua & Barbuda\", \"ag\", \"1\", 7, [ \"268\" ] ], [ \"Argentina\", \"ar\", \"54\" ], [ \"Armenia\", \"am\", \"374\" ], [ \"Aruba\", \"aw\", \"297\" ], [ \"Ascension Island\", \"ac\", \"247\" ], [ \"Australia\", \"au\", \"61\", 0 ], [ \"Austria\", \"at\", \"43\" ], [ \"Azerbaijan\", \"az\", \"994\" ], [ \"Bahamas\", \"bs\", \"1\", 8, [ \"242\" ] ], [ \"Bahrain\", \"bh\", \"973\" ], [ \"Bangladesh\", \"bd\", \"880\" ], [ \"Barbados\", \"bb\", \"1\", 9, [ \"246\" ] ], [ \"Belarus\", \"by\", \"375\" ], [ \"Belgium\", \"be\", \"32\" ], [ \"Belize\", \"bz\", \"501\" ], [ \"Benin\", \"bj\", \"229\" ], [ \"Bermuda\", \"bm\", \"1\", 10, [ \"441\" ] ], [ \"Bhutan\", \"bt\", \"975\" ], [ \"Bolivia\", \"bo\", \"591\" ], [ \"Bosnia & Herzegovina\", \"ba\", \"387\" ], [ \"Botswana\", \"bw\", \"267\" ], [ \"Brazil\", \"br\", \"55\" ], [ \"British Indian Ocean Territory\", \"io\", \"246\" ], [ \"British Virgin Islands\", \"vg\", \"1\", 11, [ \"284\" ] ], [ \"Brunei\", \"bn\", \"673\" ], [ \"Bulgaria\", \"bg\", \"359\" ], [ \"Burkina Faso\", \"bf\", \"226\" ], [ \"Burundi\", \"bi\", \"257\" ], [ \"Cambodia\", \"kh\", \"855\" ], [ \"Cameroon\", \"cm\", \"237\" ], [ \"Canada\", \"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\", \"902\", \"905\" ] ], [ \"Cape Verde\", \"cv\", \"238\" ], [ \"Caribbean Netherlands\", \"bq\", \"599\", 1, [ \"3\", \"4\", \"7\" ] ], [ \"Cayman Islands\", \"ky\", \"1\", 12, [ \"345\" ] ], [ \"Central African Republic\", \"cf\", \"236\" ], [ \"Chad\", \"td\", \"235\" ], [ \"Chile\", \"cl\", \"56\" ], [ \"China\", \"cn\", \"86\" ], [ \"Christmas Island\", \"cx\", \"61\", 2, [ \"89164\" ] ], [ \"Cocos (Keeling) Islands\", \"cc\", \"61\", 1, [ \"89162\" ] ], [ \"Colombia\", \"co\", \"57\" ], [ \"Comoros\", \"km\", \"269\" ], [ \"Congo - Brazzaville\", \"cg\", \"242\" ], [ \"Congo - Kinshasa\", \"cd\", \"243\" ], [ \"Cook Islands\", \"ck\", \"682\" ], [ \"Costa Rica\", \"cr\", \"506\" ], [ \"C\u00F4te d\u2019Ivoire\", \"ci\", \"225\" ], [ \"Croatia\", \"hr\", \"385\" ], [ \"Cuba\", \"cu\", \"53\" ], [ \"Cura\u00E7ao\", \"cw\", \"599\", 0 ], [ \"Cyprus\", \"cy\", \"357\" ], [ \"Czech Republic\", \"cz\", \"420\" ], [ \"Denmark\", \"dk\", \"45\" ], [ \"Djibouti\", \"dj\", \"253\" ], [ \"Dominica\", \"dm\", \"1\", 13, [ \"767\" ] ], [ \"Dominican Republic\", \"do\", \"1\", 2, [ \"809\", \"829\", \"849\" ] ], [ \"Ecuador\", \"ec\", \"593\" ], [ \"Egypt\", \"eg\", \"20\" ], [ \"El Salvador\", \"sv\", \"503\" ], [ \"Equatorial Guinea\", \"gq\", \"240\" ], [ \"Eritrea\", \"er\", \"291\" ], [ \"Estonia\", \"ee\", \"372\" ], [ \"Eswatini\", \"sz\", \"268\" ], [ \"Ethiopia\", \"et\", \"251\" ], [ \"Falkland Islands\", \"fk\", \"500\" ], [ \"Faroe Islands\", \"fo\", \"298\" ], [ \"Fiji\", \"fj\", \"679\" ], [ \"Finland\", \"fi\", \"358\", 0 ], [ \"France\", \"fr\", \"33\" ], [ \"French Guiana\", \"gf\", \"594\" ], [ \"French Polynesia\", \"pf\", \"689\" ], [ \"Gabon\", \"ga\", \"241\" ], [ \"Gambia\", \"gm\", \"220\" ], [ \"Georgia\", \"ge\", \"995\" ], [ \"Germany\", \"de\", \"49\" ], [ \"Ghana\", \"gh\", \"233\" ], [ \"Gibraltar\", \"gi\", \"350\" ], [ \"Greece\", \"gr\", \"30\" ], [ \"Greenland\", \"gl\", \"299\" ], [ \"Grenada\", \"gd\", \"1\", 14, [ \"473\" ] ], [ \"Guadeloupe\", \"gp\", \"590\", 0 ], [ \"Guam\", \"gu\", \"1\", 15, [ \"671\" ] ], [ \"Guatemala\", \"gt\", \"502\" ], [ \"Guernsey\", \"gg\", \"44\", 1, [ \"1481\", \"7781\", \"7839\", \"7911\" ] ], [ \"Guinea\", \"gn\", \"224\" ], [ \"Guinea-Bissau\", \"gw\", \"245\" ], [ \"Guyana\", \"gy\", \"592\" ], [ \"Haiti\", \"ht\", \"509\" ], [ \"Honduras\", \"hn\", \"504\" ], [ \"Hong Kong\", \"hk\", \"852\" ], [ \"Hungary\", \"hu\", \"36\" ], [ \"Iceland\", \"is\", \"354\" ], [ \"India\", \"in\", \"91\" ], [ \"Indonesia\", \"id\", \"62\" ], [ \"Iran\", \"ir\", \"98\" ], [ \"Iraq\", \"iq\", \"964\" ], [ \"Ireland\", \"ie\", \"353\" ], [ \"Isle of Man\", \"im\", \"44\", 2, [ \"1624\", \"74576\", \"7524\", \"7924\", \"7624\" ] ], [ \"Israel\", \"il\", \"972\" ], [ \"Italy\", \"it\", \"39\", 0 ], [ \"Jamaica\", \"jm\", \"1\", 4, [ \"876\", \"658\" ] ], [ \"Japan\", \"jp\", \"81\" ], [ \"Jersey\", \"je\", \"44\", 3, [ \"1534\", \"7509\", \"7700\", \"7797\", \"7829\", \"7937\" ] ], [ \"Jordan\", \"jo\", \"962\" ], [ \"Kazakhstan\", \"kz\", \"7\", 1, [ \"33\", \"7\" ] ], [ \"Kenya\", \"ke\", \"254\" ], [ \"Kiribati\", \"ki\", \"686\" ], [ \"Kosovo\", \"xk\", \"383\" ], [ \"Kuwait\", \"kw\", \"965\" ], [ \"Kyrgyzstan\", \"kg\", \"996\" ], [ \"Laos\", \"la\", \"856\" ], [ \"Latvia\", \"lv\", \"371\" ], [ \"Lebanon\", \"lb\", \"961\" ], [ \"Lesotho\", \"ls\", \"266\" ], [ \"Liberia\", \"lr\", \"231\" ], [ \"Libya\", \"ly\", \"218\" ], [ \"Liechtenstein\", \"li\", \"423\" ], [ \"Lithuania\", \"lt\", \"370\" ], [ \"Luxembourg\", \"lu\", \"352\" ], [ \"Macau\", \"mo\", \"853\" ], [ \"Madagascar\", \"mg\", \"261\" ], [ \"Malawi\", \"mw\", \"265\" ], [ \"Malaysia\", \"my\", \"60\" ], [ \"Maldives\", \"mv\", \"960\" ], [ \"Mali\", \"ml\", \"223\" ], [ \"Malta\", \"mt\", \"356\" ], [ \"Marshall Islands\", \"mh\", \"692\" ], [ \"Martinique\", \"mq\", \"596\" ], [ \"Mauritania\", \"mr\", \"222\" ], [ \"Mauritius\", \"mu\", \"230\" ], [ \"Mayotte\", \"yt\", \"262\", 1, [ \"269\", \"639\" ] ], [ \"Mexico\", \"mx\", \"52\" ], [ \"Micronesia\", \"fm\", \"691\" ], [ \"Moldova\", \"md\", \"373\" ], [ \"Monaco\", \"mc\", \"377\" ], [ \"Mongolia\", \"mn\", \"976\" ], [ \"Montenegro\", \"me\", \"382\" ], [ \"Montserrat\", \"ms\", \"1\", 16, [ \"664\" ] ], [ \"Morocco\", \"ma\", \"212\", 0 ], [ \"Mozambique\", \"mz\", \"258\" ], [ \"Myanmar (Burma)\", \"mm\", \"95\" ], [ \"Namibia\", \"na\", \"264\" ], [ \"Nauru\", \"nr\", \"674\" ], [ \"Nepal\", \"np\", \"977\" ], [ \"Netherlands\", \"nl\", \"31\" ], [ \"New Caledonia\", \"nc\", \"687\" ], [ \"New Zealand\", \"nz\", \"64\" ], [ \"Nicaragua\", \"ni\", \"505\" ], [ \"Niger\", \"ne\", \"227\" ], [ \"Nigeria\", \"ng\", \"234\" ], [ \"Niue\", \"nu\", \"683\" ], [ \"Norfolk Island\", \"nf\", \"672\" ], [ \"North Korea\", \"kp\", \"850\" ], [ \"North Macedonia\", \"mk\", \"389\" ], [ \"Northern Mariana Islands\", \"mp\", \"1\", 17, [ \"670\" ] ], [ \"Norway\", \"no\", \"47\", 0 ], [ \"Oman\", \"om\", \"968\" ], [ \"Pakistan\", \"pk\", \"92\" ], [ \"Palau\", \"pw\", \"680\" ], [ \"Palestine\", \"ps\", \"970\" ], [ \"Panama\", \"pa\", \"507\" ], [ \"Papua New Guinea\", \"pg\", \"675\" ], [ \"Paraguay\", \"py\", \"595\" ], [ \"Peru\", \"pe\", \"51\" ], [ \"Philippines\", \"ph\", \"63\" ], [ \"Poland\", \"pl\", \"48\" ], [ \"Portugal\", \"pt\", \"351\" ], [ \"Puerto Rico\", \"pr\", \"1\", 3, [ \"787\", \"939\" ] ], [ \"Qatar\", \"qa\", \"974\" ], [ \"R\u00E9union\", \"re\", \"262\", 0 ], [ \"Romania\", \"ro\", \"40\" ], [ \"Russia\", \"ru\", \"7\", 0 ], [ \"Rwanda\", \"rw\", \"250\" ], [ \"Samoa\", \"ws\", \"685\" ], [ \"San Marino\", \"sm\", \"378\" ], [ \"S\u00E3o Tom\u00E9 & Pr\u00EDncipe\", \"st\", \"239\" ], [ \"Saudi Arabia\", \"sa\", \"966\" ], [ \"Senegal\", \"sn\", \"221\" ], [ \"Serbia\", \"rs\", \"381\" ], [ \"Seychelles\", \"sc\", \"248\" ], [ \"Sierra Leone\", \"sl\", \"232\" ], [ \"Singapore\", \"sg\", \"65\" ], [ \"Sint Maarten\", \"sx\", \"1\", 21, [ \"721\" ] ], [ \"Slovakia\", \"sk\", \"421\" ], [ \"Slovenia\", \"si\", \"386\" ], [ \"Solomon Islands\", \"sb\", \"677\" ], [ \"Somalia\", \"so\", \"252\" ], [ \"South Africa\", \"za\", \"27\" ], [ \"South Korea\", \"kr\", \"82\" ], [ \"South Sudan\", \"ss\", \"211\" ], [ \"Spain\", \"es\", \"34\" ], [ \"Sri Lanka\", \"lk\", \"94\" ], [ \"St Barth\u00E9lemy\", \"bl\", \"590\", 1 ], [ \"St Helena\", \"sh\", \"290\" ], [ \"St Kitts & Nevis\", \"kn\", \"1\", 18, [ \"869\" ] ], [ \"St Lucia\", \"lc\", \"1\", 19, [ \"758\" ] ], [ \"St Martin\", \"mf\", \"590\", 2 ], [ \"St Pierre & Miquelon\", \"pm\", \"508\" ], [ \"St Vincent & Grenadines\", \"vc\", \"1\", 20, [ \"784\" ] ], [ \"Sudan\", \"sd\", \"249\" ], [ \"Suriname\", \"sr\", \"597\" ], [ \"Svalbard & Jan Mayen\", \"sj\", \"47\", 1, [ \"79\" ] ], [ \"Sweden\", \"se\", \"46\" ], [ \"Switzerland\", \"ch\", \"41\" ], [ \"Syria\", \"sy\", \"963\" ], [ \"Taiwan\", \"tw\", \"886\" ], [ \"Tajikistan\", \"tj\", \"992\" ], [ \"Tanzania\", \"tz\", \"255\" ], [ \"Thailand\", \"th\", \"66\" ], [ \"Timor-Leste\", \"tl\", \"670\" ], [ \"Togo\", \"tg\", \"228\" ], [ \"Tokelau\", \"tk\", \"690\" ], [ \"Tonga\", \"to\", \"676\" ], [ \"Trinidad & Tobago\", \"tt\", \"1\", 22, [ \"868\" ] ], [ \"Tunisia\", \"tn\", \"216\" ], [ \"Turkey\", \"tr\", \"90\" ], [ \"Turkmenistan\", \"tm\", \"993\" ], [ \"Turks & Caicos Islands\", \"tc\", \"1\", 23, [ \"649\" ] ], [ \"Tuvalu\", \"tv\", \"688\" ], [ \"Uganda\", \"ug\", \"256\" ], [ \"Ukraine\", \"ua\", \"380\" ], [ \"United Arab Emirates\", \"ae\", \"971\" ], [ \"United Kingdom\", \"gb\", \"44\", 0 ], [ \"United States\", \"us\", \"1\", 0 ], [ \"Uruguay\", \"uy\", \"598\" ], [ \"US Virgin Islands\", \"vi\", \"1\", 24, [ \"340\" ] ], [ \"Uzbekistan\", \"uz\", \"998\" ], [ \"Vanuatu\", \"vu\", \"678\" ], [ \"Vatican City\", \"va\", \"39\", 1, [ \"06698\" ] ], [ \"Venezuela\", \"ve\", \"58\" ], [ \"Vietnam\", \"vn\", \"84\" ], [ \"Wallis & Futuna\", \"wf\", \"681\" ], [ \"Western Sahara\", \"eh\", \"212\", 1, [ \"5288\", \"5289\" ] ], [ \"Yemen\", \"ye\", \"967\" ], [ \"Zambia\", \"zm\", \"260\" ], [ \"Zimbabwe\", \"zw\", \"263\" ], [ \"\u00C5land Islands\", \"ax\", \"358\", 1, [ \"18\" ] ] ];\n // loop over all of the countries above, restructuring the data to be objects with named keys\n for (var i = 0; i < allCountries.length; i++) {\n var c = allCountries[i];\n allCountries[i] = {\n name: c[0],\n iso2: c[1],\n dialCode: c[2],\n priority: c[3] || 0,\n areaCodes: c[4] || null\n };\n }\n \"use strict\";\n function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? Object(arguments[i]) : {};\n var ownKeys = Object.keys(source);\n if (typeof Object.getOwnPropertySymbols === \"function\") {\n ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n ownKeys.forEach(function(key) {\n _defineProperty(target, key, source[key]);\n });\n }\n return target;\n }\n function _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n }\n function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n }\n function _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n }\n function _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n }\n function _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return typeof key === \"symbol\" ? key : String(key);\n }\n function _toPrimitive(input, hint) {\n if (typeof input !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n }\n var intlTelInputGlobals = {\n getInstance: function getInstance(input) {\n var id = input.getAttribute(\"data-intl-tel-input-id\");\n return window.intlTelInputGlobals.instances[id];\n },\n instances: {},\n // using a global like this allows us to mock it in the tests\n documentReady: function documentReady() {\n return document.readyState === \"complete\";\n }\n };\n if (typeof window === \"object\") {\n window.intlTelInputGlobals = intlTelInputGlobals;\n }\n // these vars persist through all instances of the plugin\n var id = 0;\n var defaults = {\n // whether or not to allow the dropdown\n allowDropdown: true,\n // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry\n // also listen for blur/submit and auto remove dial code if that's all there is\n autoInsertDialCode: false,\n // add a placeholder in the input with an example number for the selected country\n autoPlaceholder: \"polite\",\n // add a country search input at the top of the dropdown\n countrySearch: false,\n // modify the parentClass\n customContainer: \"\",\n // modify the auto placeholder\n customPlaceholder: null,\n // append menu to specified element\n dropdownContainer: null,\n // don't display these countries\n excludeCountries: [],\n // fix the dropdown width to the input width (rather than being as wide as the longest country name)\n fixDropdownWidth: false,\n // format the input value during initialisation and on setNumber\n formatOnDisplay: true,\n // geoIp lookup function\n geoIpLookup: null,\n // inject a hidden input with this name, and on submit, populate it with the result of getNumber\n hiddenInput: \"\",\n // initial country\n initialCountry: \"\",\n // localized country names e.g. { 'de': 'Deutschland' }\n localizedCountries: null,\n // national vs international formatting for numbers e.g. placeholders and displaying existing numbers\n nationalMode: true,\n // display only these countries\n onlyCountries: [],\n // number type to use for placeholders\n placeholderNumberType: \"MOBILE\",\n // the countries at the top of the list. defaults to united states and united kingdom\n preferredCountries: [ \"us\", \"gb\" ],\n // display the country dial code next to the selected flag\n separateDialCode: false,\n // option to hide the flags - must be used with separateDialCode, or allowDropdown=false\n showFlags: true,\n // use full screen popup instead of dropdown for country list\n useFullscreenPopup: typeof navigator !== \"undefined\" && typeof window !== \"undefined\" ? // we cannot just test screen size as some smartphones/website meta tags will report desktop\n // resolutions\n // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'\n /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false,\n // specify the path to the libphonenumber script to enable validation/formatting\n utilsScript: \"\"\n };\n // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes\n var regionlessNanpNumbers = [ \"800\", \"822\", \"833\", \"844\", \"855\", \"866\", \"877\", \"880\", \"881\", \"882\", \"883\", \"884\", \"885\", \"886\", \"887\", \"888\", \"889\" ];\n // utility function to iterate over an object. can't use Object.entries or native forEach because\n // of IE11\n var forEachProp = function forEachProp(obj, callback) {\n var keys = Object.keys(obj);\n for (var i = 0; i < keys.length; i++) {\n callback(keys[i], obj[keys[i]]);\n }\n };\n // run a method on each instance of the plugin\n var forEachInstance = function forEachInstance(method) {\n forEachProp(window.intlTelInputGlobals.instances, function(key) {\n window.intlTelInputGlobals.instances[key][method]();\n });\n };\n // this is our plugin class that we will create an instance of\n // eslint-disable-next-line no-unused-vars\n var Iti = /*#__PURE__*/ function() {\n function Iti(input, options) {\n var _this = this;\n _classCallCheck(this, Iti);\n this.id = id++;\n this.telInput = input;\n this.activeItem = null;\n this.highlightedItem = null;\n // process specified options / defaults\n // alternative to Object.assign, which isn't supported by IE11\n var customOptions = options || {};\n this.options = {};\n forEachProp(defaults, function(key, value) {\n _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value;\n });\n this.hadInitialPlaceholder = Boolean(input.getAttribute(\"placeholder\"));\n }\n _createClass(Iti, [ {\n key: \"_init\",\n value: function _init() {\n var _this2 = this;\n // if showing fullscreen popup, do not fix the width\n if (this.options.useFullscreenPopup) {\n this.options.fixDropdownWidth = false;\n }\n // when search enabled, we must fix the width else it would change with different results\n if (this.options.countrySearch && !this.options.useFullscreenPopup) {\n this.options.fixDropdownWidth = true;\n }\n // if in nationalMode, do not insert dial codes\n if (this.options.nationalMode) {\n this.options.autoInsertDialCode = false;\n }\n // if separateDialCode enabled, do not insert dial codes\n if (this.options.separateDialCode) {\n this.options.autoInsertDialCode = false;\n }\n // force showFlags=true if there's a dropdown and we're not displaying the dial code,\n // as otherwise you just have a down arrow on it's own which doesn't make sense\n var forceShowFlags = this.options.allowDropdown && !this.options.separateDialCode;\n if (!this.options.showFlags && forceShowFlags) {\n this.options.showFlags = true;\n }\n // on mobile, we want a full screen dropdown, so we must append it to the body\n if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {\n this.options.dropdownContainer = document.body;\n }\n // check if input has one parent with RTL\n this.isRTL = !!this.telInput.closest(\"[dir=rtl]\");\n // these promises get resolved when their individual requests complete\n // this way the dev can do something like iti.promise.then(...) to know when all requests are\n // complete\n if (typeof Promise !== \"undefined\") {\n var autoCountryPromise = new Promise(function(resolve, reject) {\n _this2.resolveAutoCountryPromise = resolve;\n _this2.rejectAutoCountryPromise = reject;\n });\n var utilsScriptPromise = new Promise(function(resolve, reject) {\n _this2.resolveUtilsScriptPromise = resolve;\n _this2.rejectUtilsScriptPromise = reject;\n });\n this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]);\n } else {\n // prevent errors when Promise doesn't exist\n this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {};\n this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {};\n }\n // in various situations there could be no country selected initially, but we need to be able\n // to assume this variable exists\n this.selectedCountryData = {};\n // process all the data: onlyCountries, excludeCountries, preferredCountries etc\n this._processCountryData();\n // generate the markup\n this._generateMarkup();\n // set the initial state of the input value and the selected flag\n this._setInitialState();\n // start all of the event listeners: autoInsertDialCode, input keydown, selectedFlag click\n this._initListeners();\n // utils script, and auto country\n this._initRequests();\n }\n }, {\n key: \"_processCountryData\",\n value: function _processCountryData() {\n // process onlyCountries or excludeCountries array if present\n this._processAllCountries();\n // process the countryCodes map\n this._processCountryCodes();\n // process the preferredCountries\n this._processPreferredCountries();\n // translate countries according to localizedCountries option\n if (this.options.localizedCountries) {\n this._translateCountriesByLocale();\n }\n // sort countries by name\n if (this.options.onlyCountries.length || this.options.localizedCountries) {\n this.countries.sort(this._countryNameSort);\n }\n }\n }, {\n key: \"_addCountryCode\",\n value: function _addCountryCode(iso2, countryCode, priority) {\n if (countryCode.length > this.countryCodeMaxLen) {\n this.countryCodeMaxLen = countryCode.length;\n }\n if (!this.countryCodes.hasOwnProperty(countryCode)) {\n this.countryCodes[countryCode] = [];\n }\n // bail if we already have this country for this countryCode\n for (var i = 0; i < this.countryCodes[countryCode].length; i++) {\n if (this.countryCodes[countryCode][i] === iso2) {\n return;\n }\n }\n // check for undefined as 0 is falsy\n var index = priority !== undefined ? priority : this.countryCodes[countryCode].length;\n this.countryCodes[countryCode][index] = iso2;\n }\n }, {\n key: \"_processAllCountries\",\n value: function _processAllCountries() {\n if (this.options.onlyCountries.length) {\n var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) {\n return country.toLowerCase();\n });\n this.countries = allCountries.filter(function(country) {\n return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;\n });\n } else if (this.options.excludeCountries.length) {\n var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) {\n return country.toLowerCase();\n });\n this.countries = allCountries.filter(function(country) {\n return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;\n });\n } else {\n this.countries = allCountries;\n }\n }\n }, {\n key: \"_translateCountriesByLocale\",\n value: function _translateCountriesByLocale() {\n for (var i = 0; i < this.countries.length; i++) {\n var iso = this.countries[i].iso2.toLowerCase();\n if (this.options.localizedCountries.hasOwnProperty(iso)) {\n this.countries[i].name = this.options.localizedCountries[iso];\n }\n }\n }\n }, {\n key: \"_countryNameSort\",\n value: function _countryNameSort(a, b) {\n if (a.name < b.name) {\n return -1;\n }\n if (a.name > b.name) {\n return 1;\n }\n return 0;\n }\n }, {\n key: \"_processCountryCodes\",\n value: function _processCountryCodes() {\n this.countryCodeMaxLen = 0;\n // here we store just dial codes\n this.dialCodes = {};\n // here we store \"country codes\" (both dial codes and their area codes)\n this.countryCodes = {};\n // first: add dial codes\n for (var i = 0; i < this.countries.length; i++) {\n var c = this.countries[i];\n if (!this.dialCodes[c.dialCode]) {\n this.dialCodes[c.dialCode] = true;\n }\n this._addCountryCode(c.iso2, c.dialCode, c.priority);\n }\n // next: add area codes\n // this is a second loop over countries, to make sure we have all of the \"root\" countries\n // already in the map, so that we can access them, as each time we add an area code substring\n // to the map, we also need to include the \"root\" country's code, as that also matches\n for (var _i = 0; _i < this.countries.length; _i++) {\n var _c = this.countries[_i];\n // area codes\n if (_c.areaCodes) {\n var rootCountryCode = this.countryCodes[_c.dialCode][0];\n // for each area code\n for (var j = 0; j < _c.areaCodes.length; j++) {\n var areaCode = _c.areaCodes[j];\n // for each digit in the area code to add all partial matches as well\n for (var k = 1; k < areaCode.length; k++) {\n var partialDialCode = _c.dialCode + areaCode.substr(0, k);\n // start with the root country, as that also matches this dial code\n this._addCountryCode(rootCountryCode, partialDialCode);\n this._addCountryCode(_c.iso2, partialDialCode);\n }\n // add the full area code\n this._addCountryCode(_c.iso2, _c.dialCode + areaCode);\n }\n }\n }\n }\n }, {\n key: \"_processPreferredCountries\",\n value: function _processPreferredCountries() {\n this.preferredCountries = [];\n for (var i = 0; i < this.options.preferredCountries.length; i++) {\n var countryCode = this.options.preferredCountries[i].toLowerCase();\n var countryData = this._getCountryData(countryCode, false, true);\n if (countryData) {\n this.preferredCountries.push(countryData);\n }\n }\n }\n }, {\n key: \"_createEl\",\n value: function _createEl(name, attrs, container) {\n var el = document.createElement(name);\n if (attrs) {\n forEachProp(attrs, function(key, value) {\n return el.setAttribute(key, value);\n });\n }\n if (container) {\n container.appendChild(el);\n }\n return el;\n }\n }, {\n key: \"_generateMarkup\",\n value: function _generateMarkup() {\n this.telInput.classList.add(\"iti__tel-input\");\n // if autocomplete does not exist on the element and its form, then\n // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can\n // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the\n // autocompleted number, which on submit could mean wrong number is saved\n if (!this.telInput.hasAttribute(\"autocomplete\") && !(this.telInput.form && this.telInput.form.hasAttribute(\"autocomplete\"))) {\n this.telInput.setAttribute(\"autocomplete\", \"off\");\n }\n var _this$options = this.options, allowDropdown = _this$options.allowDropdown, separateDialCode = _this$options.separateDialCode, showFlags = _this$options.showFlags, customContainer = _this$options.customContainer, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer, fixDropdownWidth = _this$options.fixDropdownWidth, useFullscreenPopup = _this$options.useFullscreenPopup, countrySearch = _this$options.countrySearch;\n // containers (mostly for positioning)\n var parentClass = \"iti\";\n if (allowDropdown) {\n parentClass += \" iti--allow-dropdown\";\n }\n if (separateDialCode) {\n parentClass += \" iti--separate-dial-code\";\n }\n if (showFlags) {\n parentClass += \" iti--show-flags\";\n }\n if (customContainer) {\n parentClass += \" \".concat(customContainer);\n }\n var wrapper = this._createEl(\"div\", {\n \"class\": parentClass\n });\n this.telInput.parentNode.insertBefore(wrapper, this.telInput);\n // only hide the flagsContainer if allowDropdown, showFlags and separateDialCode are all false\n var showFlagsContainer = allowDropdown || showFlags || separateDialCode;\n if (showFlagsContainer) {\n this.flagsContainer = this._createEl(\"div\", {\n \"class\": \"iti__flag-container\"\n }, wrapper);\n }\n wrapper.appendChild(this.telInput);\n // selected flag (displayed to left of input)\n // using Aria tags for \"Select-Only Combobox Example\"\n // https://www.w3.org/WAI/ARIA/apg/patterns/combobox/examples/combobox-select-only/\n if (showFlagsContainer) {\n this.selectedFlag = this._createEl(\"div\", _objectSpread({\n \"class\": \"iti__selected-flag\"\n }, allowDropdown && {\n role: \"combobox\",\n \"aria-haspopup\": \"listbox\",\n \"aria-controls\": \"iti-\".concat(this.id, \"__country-listbox\"),\n \"aria-expanded\": \"false\",\n \"aria-label\": \"Telephone country code\"\n }), this.flagsContainer);\n }\n if (showFlags) {\n this.selectedFlagInner = this._createEl(\"div\", {\n \"class\": \"iti__flag\"\n }, this.selectedFlag);\n }\n if (this.selectedFlag && this.telInput.disabled) {\n this.selectedFlag.setAttribute(\"aria-disabled\", \"true\");\n }\n if (separateDialCode) {\n this.selectedDialCode = this._createEl(\"div\", {\n \"class\": \"iti__selected-dial-code\"\n }, this.selectedFlag);\n }\n if (allowDropdown) {\n if (!this.telInput.disabled) {\n // make element focusable and tab navigable\n this.selectedFlag.setAttribute(\"tabindex\", \"0\");\n }\n this.dropdownArrow = this._createEl(\"div\", {\n \"class\": \"iti__arrow\"\n }, this.selectedFlag);\n var extraClasses = fixDropdownWidth ? \"\" : \"iti--flexible-dropdown-width\";\n this.dropdownContent = this._createEl(\"div\", {\n \"class\": \"iti__dropdown-content iti__hide \".concat(extraClasses)\n });\n if (countrySearch) {\n this.searchInput = this._createEl(\"input\", {\n type: \"text\",\n \"class\": \"iti__search-input\",\n placeholder: \"Search\"\n }, this.dropdownContent);\n }\n // country list: preferred countries, then divider, then all countries\n this.countryList = this._createEl(\"ul\", {\n \"class\": \"iti__country-list\",\n id: \"iti-\".concat(this.id, \"__country-listbox\"),\n role: \"listbox\",\n \"aria-label\": \"List of countries\"\n }, this.dropdownContent);\n if (this.preferredCountries.length && !countrySearch) {\n this._appendListItems(this.preferredCountries, \"iti__preferred\", true);\n this._createEl(\"li\", {\n \"class\": \"iti__divider\",\n \"aria-hidden\": \"true\"\n }, this.countryList);\n }\n this._appendListItems(this.countries, \"iti__standard\");\n // create dropdownContainer markup\n if (dropdownContainer) {\n var dropdownClasses = \"iti iti--container\";\n if (useFullscreenPopup) {\n dropdownClasses += \" iti--fullscreen-popup\";\n }\n if (countrySearch) {\n dropdownClasses += \" iti--country-search\";\n }\n this.dropdown = this._createEl(\"div\", {\n \"class\": dropdownClasses\n });\n this.dropdown.appendChild(this.dropdownContent);\n } else {\n this.flagsContainer.appendChild(this.dropdownContent);\n }\n }\n if (hiddenInput) {\n var hiddenInputName = hiddenInput;\n var name = this.telInput.getAttribute(\"name\");\n if (name) {\n var i = name.lastIndexOf(\"[\");\n // if input name contains square brackets, then give the hidden input the same name,\n // replacing the contents of the last set of brackets with the given hiddenInput name\n if (i !== -1) {\n hiddenInputName = \"\".concat(name.substr(0, i), \"[\").concat(hiddenInputName, \"]\");\n }\n }\n this.hiddenInput = this._createEl(\"input\", {\n type: \"hidden\",\n name: hiddenInputName\n });\n wrapper.appendChild(this.hiddenInput);\n }\n }\n }, {\n key: \"_appendListItems\",\n value: function _appendListItems(countries, className, preferred) {\n for (var i = 0; i < countries.length; i++) {\n var c = countries[i];\n var idSuffix = preferred ? \"-preferred\" : \"\";\n var listItem = this._createEl(\"li\", {\n id: \"iti-\".concat(this.id, \"__item-\").concat(c.iso2).concat(idSuffix),\n \"class\": \"iti__country \".concat(className),\n tabindex: \"-1\",\n role: \"option\",\n \"data-dial-code\": c.dialCode,\n \"data-country-code\": c.iso2,\n \"aria-selected\": \"false\"\n }, this.countryList);\n // store this for later use e.g. country search filtering\n c.node = listItem;\n var content = \"\";\n // add the flag\n if (this.options.showFlags) {\n content += \"