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AAShB,GAG7C,IAFAA,EAAW,IAAID,EAASC,IAEXyB,WAAWT,GACtB,OAAOhB,EAASgB,QAAQA,GAASsD,qBAGnC,MAAM,IAAI5C,MAAM,oBAAoBC,OAAOX,GAC7C,CACO,SAASuD,EAAmBvD,EAAShB,GAG1C,OAAOA,EAASO,UAAUiE,eAAexD,EAC3C,CAEA,SAASb,EAAWH,GAClB,IAAIyE,EAAUzE,EAASyE,QAEA,iBAAZA,GACTxE,KAAKU,GAAiB,IAAZ8D,EACVxE,KAAKW,GAAiB,IAAZ6D,EACVxE,KAAKY,GAAiB,IAAZ4D,EACVxE,KAAKyE,GAAiB,IAAZD,GAELA,GAEgC,KAA1B,OAAQA,EArnBd,SAsnBHxE,KAAKW,IAAK,GACyB,KAA1B,OAAQ6D,EArnBd,UAsnBHxE,KAAKY,IAAK,EAEVZ,KAAKyE,IAAK,EANVzE,KAAKU,IAAK,CAShB,C","sources":["webpack://typescript/./node_modules/libphonenumber-js/es6/metadata.js"],"sourcesContent":["function _typeof(obj) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }, _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nimport compare from './tools/semver-compare.js';\nimport isObject from './helpers/isObject.js'; // Added \"possibleLengths\" and renamed\n// \"country_phone_code_to_countries\" to \"country_calling_codes\".\n\nvar V2 = '1.0.18'; // Added \"idd_prefix\" and \"default_idd_prefix\".\n\nvar V3 = '1.2.0'; // Moved `001` country code to \"nonGeographic\" section of metadata.\n\nvar V4 = '1.7.35';\nvar DEFAULT_EXT_PREFIX = ' ext. ';\nvar CALLING_CODE_REG_EXP = /^\\d+$/;\n/**\r\n * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md\r\n */\n\nvar Metadata = /*#__PURE__*/function () {\n function Metadata(metadata) {\n _classCallCheck(this, Metadata);\n\n validateMetadata(metadata);\n this.metadata = metadata;\n setVersion.call(this, metadata);\n }\n\n _createClass(Metadata, [{\n key: \"getCountries\",\n value: function getCountries() {\n return Object.keys(this.metadata.countries).filter(function (_) {\n return _ !== '001';\n });\n }\n }, {\n key: \"getCountryMetadata\",\n value: function getCountryMetadata(countryCode) {\n return this.metadata.countries[countryCode];\n }\n }, {\n key: \"nonGeographic\",\n value: function nonGeographic() {\n if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.\n // It's present in metadata generated from `1.7.35` to `1.7.37`.\n // The test case could be found by searching for \"nonGeographical\".\n\n return this.metadata.nonGeographic || this.metadata.nonGeographical;\n }\n }, {\n key: \"hasCountry\",\n value: function hasCountry(country) {\n return this.getCountryMetadata(country) !== undefined;\n }\n }, {\n key: \"hasCallingCode\",\n value: function hasCallingCode(callingCode) {\n if (this.getCountryCodesForCallingCode(callingCode)) {\n return true;\n }\n\n if (this.nonGeographic()) {\n if (this.nonGeographic()[callingCode]) {\n return true;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return true;\n }\n }\n }\n }, {\n key: \"isNonGeographicCallingCode\",\n value: function isNonGeographicCallingCode(callingCode) {\n if (this.nonGeographic()) {\n return this.nonGeographic()[callingCode] ? true : false;\n } else {\n return this.getCountryCodesForCallingCode(callingCode) ? false : true;\n }\n } // Deprecated.\n\n }, {\n key: \"country\",\n value: function country(countryCode) {\n return this.selectNumberingPlan(countryCode);\n }\n }, {\n key: \"selectNumberingPlan\",\n value: function selectNumberingPlan(countryCode, callingCode) {\n // Supports just passing `callingCode` as the first argument.\n if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {\n callingCode = countryCode;\n countryCode = null;\n }\n\n if (countryCode && countryCode !== '001') {\n if (!this.hasCountry(countryCode)) {\n throw new Error(\"Unknown country: \".concat(countryCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);\n } else if (callingCode) {\n if (!this.hasCallingCode(callingCode)) {\n throw new Error(\"Unknown calling code: \".concat(callingCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);\n } else {\n this.numberingPlan = undefined;\n }\n\n return this;\n }\n }, {\n key: \"getCountryCodesForCallingCode\",\n value: function getCountryCodesForCallingCode(callingCode) {\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes) {\n // Metadata before V4 included \"non-geographic entity\" calling codes\n // inside `country_calling_codes` (for example, `\"881\":[\"001\"]`).\n // Now the semantics of `country_calling_codes` has changed:\n // it's specifically for \"countries\" now.\n // Older versions of custom metadata will simply skip parsing\n // \"non-geographic entity\" phone numbers with new versions\n // of this library: it's not considered a bug,\n // because such numbers are extremely rare,\n // and developers extremely rarely use custom metadata.\n if (countryCodes.length === 1 && countryCodes[0].length === 3) {\n return;\n }\n\n return countryCodes;\n }\n }\n }, {\n key: \"getCountryCodeForCallingCode\",\n value: function getCountryCodeForCallingCode(callingCode) {\n var countryCodes = this.getCountryCodesForCallingCode(callingCode);\n\n if (countryCodes) {\n return countryCodes[0];\n }\n }\n }, {\n key: \"getNumberingPlanMetadata\",\n value: function getNumberingPlanMetadata(callingCode) {\n var countryCode = this.getCountryCodeForCallingCode(callingCode);\n\n if (countryCode) {\n return this.getCountryMetadata(countryCode);\n }\n\n if (this.nonGeographic()) {\n var metadata = this.nonGeographic()[callingCode];\n\n if (metadata) {\n return metadata;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n // In that metadata, there was no concept of \"non-geographic\" metadata\n // so metadata for `001` country code was stored along with other countries.\n // The test case can be found by searching for:\n // \"should work around `nonGeographic` metadata not existing\".\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return this.metadata.countries['001'];\n }\n }\n } // Deprecated.\n\n }, {\n key: \"countryCallingCode\",\n value: function countryCallingCode() {\n return this.numberingPlan.callingCode();\n } // Deprecated.\n\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n return this.numberingPlan.IDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n return this.numberingPlan.defaultIDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n return this.numberingPlan.nationalNumberPattern();\n } // Deprecated.\n\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n return this.numberingPlan.possibleLengths();\n } // Deprecated.\n\n }, {\n key: \"formats\",\n value: function formats() {\n return this.numberingPlan.formats();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n return this.numberingPlan.nationalPrefixForParsing();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.numberingPlan.nationalPrefixTransformRule();\n } // Deprecated.\n\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.numberingPlan.leadingDigits();\n } // Deprecated.\n\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n return this.numberingPlan.hasTypes();\n } // Deprecated.\n\n }, {\n key: \"type\",\n value: function type(_type) {\n return this.numberingPlan.type(_type);\n } // Deprecated.\n\n }, {\n key: \"ext\",\n value: function ext() {\n return this.numberingPlan.ext();\n }\n }, {\n key: \"countryCallingCodes\",\n value: function countryCallingCodes() {\n if (this.v1) return this.metadata.country_phone_code_to_countries;\n return this.metadata.country_calling_codes;\n } // Deprecated.\n\n }, {\n key: \"chooseCountryByCountryCallingCode\",\n value: function chooseCountryByCountryCallingCode(callingCode) {\n return this.selectNumberingPlan(callingCode);\n }\n }, {\n key: \"hasSelectedNumberingPlan\",\n value: function hasSelectedNumberingPlan() {\n return this.numberingPlan !== undefined;\n }\n }]);\n\n return Metadata;\n}();\n\nexport { Metadata as default };\n\nvar NumberingPlan = /*#__PURE__*/function () {\n function NumberingPlan(metadata, globalMetadataObject) {\n _classCallCheck(this, NumberingPlan);\n\n this.globalMetadataObject = globalMetadataObject;\n this.metadata = metadata;\n setVersion.call(this, globalMetadataObject.metadata);\n }\n\n _createClass(NumberingPlan, [{\n key: \"callingCode\",\n value: function callingCode() {\n return this.metadata[0];\n } // Formatting information for regions which share\n // a country calling code is contained by only one region\n // for performance reasons. For example, for NANPA region\n // (\"North American Numbering Plan Administration\",\n // which includes USA, Canada, Cayman Islands, Bahamas, etc)\n // it will be contained in the metadata for `US`.\n\n }, {\n key: \"getDefaultCountryMetadataForRegion\",\n value: function getDefaultCountryMetadataForRegion() {\n return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());\n } // Is always present.\n\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[1];\n } // Is only present when a country supports multiple IDD prefixes.\n\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[12];\n }\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n if (this.v1 || this.v2) return this.metadata[1];\n return this.metadata[2];\n } // \"possible length\" data is always present in Google's metadata.\n\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.v1) return;\n return this.metadata[this.v2 ? 2 : 3];\n }\n }, {\n key: \"_getFormats\",\n value: function _getFormats(metadata) {\n return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];\n } // For countries of the same region (e.g. NANPA)\n // formats are all stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"formats\",\n value: function formats() {\n var _this = this;\n\n var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];\n return formats.map(function (_) {\n return new Format(_, _this);\n });\n }\n }, {\n key: \"nationalPrefix\",\n value: function nationalPrefix() {\n return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];\n }\n }, {\n key: \"_getNationalPrefixFormattingRule\",\n value: function _getNationalPrefixFormattingRule(metadata) {\n return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];\n } // For countries of the same region (e.g. NANPA)\n // national prefix formatting rule is stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());\n }\n }, {\n key: \"_nationalPrefixForParsing\",\n value: function _nationalPrefixForParsing() {\n return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];\n }\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n // If `national_prefix_for_parsing` is not set explicitly,\n // then infer it from `national_prefix` (if any)\n return this._nationalPrefixForParsing() || this.nationalPrefix();\n }\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];\n }\n }, {\n key: \"_getNationalPrefixIsOptionalWhenFormatting\",\n value: function _getNationalPrefixIsOptionalWhenFormatting() {\n return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];\n } // For countries of the same region (e.g. NANPA)\n // \"national prefix is optional when formatting\" flag is\n // stored in the \"main\" country for that region.\n // E.g. \"RU\" and \"KZ\", \"US\" and \"CA\".\n\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());\n }\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];\n }\n }, {\n key: \"types\",\n value: function types() {\n return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];\n }\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n // Versions 1.2.0 - 1.2.4: can be `[]`.\n\n /* istanbul ignore next */\n if (this.types() && this.types().length === 0) {\n return false;\n } // Versions <= 1.2.4: can be `undefined`.\n // Version >= 1.2.5: can be `0`.\n\n\n return !!this.types();\n }\n }, {\n key: \"type\",\n value: function type(_type2) {\n if (this.hasTypes() && getType(this.types(), _type2)) {\n return new Type(getType(this.types(), _type2), this);\n }\n }\n }, {\n key: \"ext\",\n value: function ext() {\n if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;\n return this.metadata[13] || DEFAULT_EXT_PREFIX;\n }\n }]);\n\n return NumberingPlan;\n}();\n\nvar Format = /*#__PURE__*/function () {\n function Format(format, metadata) {\n _classCallCheck(this, Format);\n\n this._format = format;\n this.metadata = metadata;\n }\n\n _createClass(Format, [{\n key: \"pattern\",\n value: function pattern() {\n return this._format[0];\n }\n }, {\n key: \"format\",\n value: function format() {\n return this._format[1];\n }\n }, {\n key: \"leadingDigitsPatterns\",\n value: function leadingDigitsPatterns() {\n return this._format[2] || [];\n }\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._format[3] || this.metadata.nationalPrefixFormattingRule();\n }\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n }\n }, {\n key: \"nationalPrefixIsMandatoryWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {\n // National prefix is omitted if there's no national prefix formatting rule\n // set for this country, or when the national prefix formatting rule\n // contains no national prefix itself, or when this rule is set but\n // national prefix is optional for this phone number format\n // (and it is not enforced explicitly)\n return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n } // Checks whether national prefix formatting rule contains national prefix.\n\n }, {\n key: \"usesNationalPrefix\",\n value: function usesNationalPrefix() {\n return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a \"dummy\" one.\n !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`\n // when `national_prefix_formatting_rule` is not present.\n // So, `true` or `false` are returned explicitly here, so that\n // `0` number isn't returned.\n ? true : false;\n }\n }, {\n key: \"internationalFormat\",\n value: function internationalFormat() {\n return this._format[5] || this.format();\n }\n }]);\n\n return Format;\n}();\n/**\r\n * A pattern that is used to determine if the national prefix formatting rule\r\n * has the first group only, i.e., does not start with the national prefix.\r\n * Note that the pattern explicitly allows for unbalanced parentheses.\r\n */\n\n\nvar FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\\(?\\$1\\)?$/;\n\nvar Type = /*#__PURE__*/function () {\n function Type(type, metadata) {\n _classCallCheck(this, Type);\n\n this.type = type;\n this.metadata = metadata;\n }\n\n _createClass(Type, [{\n key: \"pattern\",\n value: function pattern() {\n if (this.metadata.v1) return this.type;\n return this.type[0];\n }\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.metadata.v1) return;\n return this.type[1] || this.metadata.possibleLengths();\n }\n }]);\n\n return Type;\n}();\n\nfunction getType(types, type) {\n switch (type) {\n case 'FIXED_LINE':\n return types[0];\n\n case 'MOBILE':\n return types[1];\n\n case 'TOLL_FREE':\n return types[2];\n\n case 'PREMIUM_RATE':\n return types[3];\n\n case 'PERSONAL_NUMBER':\n return types[4];\n\n case 'VOICEMAIL':\n return types[5];\n\n case 'UAN':\n return types[6];\n\n case 'PAGER':\n return types[7];\n\n case 'VOIP':\n return types[8];\n\n case 'SHARED_COST':\n return types[9];\n }\n}\n\nexport function validateMetadata(metadata) {\n if (!metadata) {\n throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');\n } // `country_phone_code_to_countries` was renamed to `country_calling_codes` in `1.0.18`.\n // For that reason, it's not used in this detection algorithm.\n // Instead, it detects by `countries: {}` property existence.\n\n\n if (!isObject(metadata) || !isObject(metadata.countries)) {\n throw new Error(\"[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got \".concat(isObject(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + typeOf(metadata) + ': ' + metadata, \".\"));\n }\n} // Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\nvar typeOf = function typeOf(_) {\n return _typeof(_);\n};\n/**\r\n * Returns extension prefix for a country.\r\n * @param {string} country\r\n * @param {object} metadata\r\n * @return {string?}\r\n * @example\r\n * // Returns \" ext. \"\r\n * getExtPrefix(\"US\")\r\n */\n\n\nexport function getExtPrefix(country, metadata) {\n metadata = new Metadata(metadata);\n\n if (metadata.hasCountry(country)) {\n return metadata.country(country).ext();\n }\n\n return DEFAULT_EXT_PREFIX;\n}\n/**\r\n * Returns \"country calling code\" for a country.\r\n * Throws an error if the country doesn't exist or isn't supported by this library.\r\n * @param {string} country\r\n * @param {object} metadata\r\n * @return {string}\r\n * @example\r\n * // Returns \"44\"\r\n * getCountryCallingCode(\"GB\")\r\n */\n\nexport function getCountryCallingCode(country, metadata) {\n metadata = new Metadata(metadata);\n\n if (metadata.hasCountry(country)) {\n return metadata.country(country).countryCallingCode();\n }\n\n throw new Error(\"Unknown country: \".concat(country));\n}\nexport function isSupportedCountry(country, metadata) {\n // metadata = new Metadata(metadata)\n // return metadata.hasCountry(country)\n return metadata.countries.hasOwnProperty(country);\n}\n\nfunction setVersion(metadata) {\n var version = metadata.version;\n\n if (typeof version === 'number') {\n this.v1 = version === 1;\n this.v2 = version === 2;\n this.v3 = version === 3;\n this.v4 = version === 4;\n } else {\n if (!version) {\n this.v1 = true;\n } else if (compare(version, V3) === -1) {\n this.v2 = true;\n } else if (compare(version, V4) === -1) {\n this.v3 = true;\n } else {\n this.v4 = true;\n }\n }\n} // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/\n// function isCountryCode(countryCode) {\n// \treturn ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)\n// }\n//# sourceMappingURL=metadata.js.map"],"names":["_typeof","obj","Symbol","iterator","constructor","prototype","_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","DEFAULT_EXT_PREFIX","CALLING_CODE_REG_EXP","Metadata","metadata","this","validateMetadata","setVersion","call","value","keys","countries","filter","_","countryCode","v1","v2","v3","nonGeographic","nonGeographical","country","undefined","getCountryMetadata","callingCode","getCountryCodesForCallingCode","countryCodes","countryCallingCodes","selectNumberingPlan","test","hasCountry","Error","concat","numberingPlan","NumberingPlan","hasCallingCode","getNumberingPlanMetadata","getCountryCodeForCallingCode","IDDPrefix","defaultIDDPrefix","nationalNumberPattern","possibleLengths","formats","nationalPrefixForParsing","nationalPrefixTransformRule","leadingDigits","hasTypes","_type","type","ext","country_phone_code_to_countries","country_calling_codes","globalMetadataObject","_this","_getFormats","getDefaultCountryMetadataForRegion","map","Format","_getNationalPrefixFormattingRule","_nationalPrefixForParsing","nationalPrefix","_getNationalPrefixIsOptionalWhenFormatting","types","_type2","getType","Type","format","_format","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormattingInNationalFormat","usesNationalPrefix","FIRST_GROUP_ONLY_PREFIX_PATTERN","join","typeOf","getCountryCallingCode","countryCallingCode","isSupportedCountry","hasOwnProperty","version","v4"],"sourceRoot":""}