{"version":3,"file":"react-phone-number-input-input.js","sources":["../node_modules/input-format/modules/helpers.js","../node_modules/input-format/modules/template formatter.js","../node_modules/input-format/modules/close braces.js","../node_modules/input-format/modules/dom.js","../node_modules/input-format/modules/input control.js","../node_modules/input-format/modules/parse.js","../node_modules/input-format/modules/edit.js","../node_modules/input-format/modules/format.js","../node_modules/input-format/modules/react/Input.js","../node_modules/libphonenumber-js/es6/ParseError.js","../node_modules/libphonenumber-js/es6/constants.js","../node_modules/libphonenumber-js/es6/util.js","../node_modules/libphonenumber-js/es6/tools/semver-compare.js","../node_modules/libphonenumber-js/es6/metadata.js","../node_modules/libphonenumber-js/es6/extension.js","../node_modules/libphonenumber-js/es6/isViablePhoneNumber.js","../node_modules/libphonenumber-js/es6/parseDigits.js","../node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js","../node_modules/libphonenumber-js/es6/getNumberType_.js","../node_modules/libphonenumber-js/es6/isPossibleNumber_.js","../node_modules/libphonenumber-js/es6/IDD.js","../node_modules/libphonenumber-js/es6/RFC3966.js","../node_modules/libphonenumber-js/es6/format_.js","../node_modules/libphonenumber-js/es6/PhoneNumber.js","../node_modules/libphonenumber-js/es6/validate_.js","../node_modules/libphonenumber-js/es6/parse_.js","../node_modules/libphonenumber-js/es6/parsePhoneNumber_.js","../node_modules/libphonenumber-js/es6/parsePhoneNumber.js","../node_modules/libphonenumber-js/es6/parsePhoneNumberFromString_.js","../node_modules/libphonenumber-js/es6/parsePhoneNumberFromString.js","../node_modules/libphonenumber-js/es6/AsYouType.js","../node_modules/libphonenumber-js/es6/getCountries.js","../modules/inputValuePrefix.js","../modules/InputSmart.js","../modules/InputBasic.js","../node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js","../modules/libphonenumber/formatPhoneNumber.js","../modules/libphonenumber/isValidPhoneNumber.js","../modules/libphonenumber/isPossiblePhoneNumber.js","../modules/PhoneInput.js","../input/index.js"],"sourcesContent":["// Counts all occurences of a symbol in a string\nexport function count_occurences(symbol, string) {\n var count = 0; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes)\n // but template placeholder characters don't fall into that range\n // so skipping such miscellaneous \"exotic\" characters\n // won't matter here for just counting placeholder character occurrences.\n\n for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n\n if (character === symbol) {\n count++;\n }\n }\n\n return count;\n}\n//# sourceMappingURL=helpers.js.map","import { count_occurences } from './helpers';\nimport close_braces from './close braces'; // Takes a `template` where character placeholders\n// are denoted by 'x'es (e.g. 'x (xxx) xxx-xx-xx').\n//\n// Returns a function which takes `value` characters\n// and returns the `template` filled with those characters.\n// If the `template` can only be partially filled\n// then it is cut off.\n//\n// If `should_close_braces` is `true`,\n// then it will also make sure all dangling braces are closed,\n// e.g. \"8 (8\" -> \"8 (8 )\" (iPhone style phone number input).\n//\n\nexport default function (template) {\n var placeholder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'x';\n var should_close_braces = arguments.length > 2 ? arguments[2] : undefined;\n\n if (!template) {\n return function (value) {\n return {\n text: value\n };\n };\n }\n\n var characters_in_template = count_occurences(placeholder, template);\n return function (value) {\n if (!value) {\n return {\n text: '',\n template: template\n };\n }\n\n var value_character_index = 0;\n var filled_in_template = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes)\n // but template placeholder characters don't fall into that range\n // and appending UTF-8 characters to a string in parts still works.\n\n for (var _iterator = template.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n\n if (character !== placeholder) {\n filled_in_template += character;\n continue;\n }\n\n filled_in_template += value[value_character_index];\n value_character_index++; // If the last available value character has been filled in,\n // then return the filled in template\n // (either trim the right part or retain it,\n // if no more character placeholders in there)\n\n if (value_character_index === value.length) {\n // If there are more character placeholders\n // in the right part of the template\n // then simply trim it.\n if (value.length < characters_in_template) {\n break;\n }\n }\n }\n\n if (should_close_braces) {\n filled_in_template = close_braces(filled_in_template, template);\n }\n\n return {\n text: filled_in_template,\n template: template\n };\n };\n}\n//# sourceMappingURL=template formatter.js.map","import { count_occurences } from './helpers';\nexport default function close_braces(retained_template, template) {\n var placeholder = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'x';\n var empty_placeholder = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : ' ';\n var cut_before = retained_template.length;\n var opening_braces = count_occurences('(', retained_template);\n var closing_braces = count_occurences(')', retained_template);\n var dangling_braces = opening_braces - closing_braces;\n\n while (dangling_braces > 0 && cut_before < template.length) {\n retained_template += template[cut_before].replace(placeholder, empty_placeholder);\n\n if (template[cut_before] === ')') {\n dangling_braces--;\n }\n\n cut_before++;\n }\n\n return retained_template;\n}\n//# sourceMappingURL=close braces.js.map","// Gets selection bounds\nexport function getSelection(element) {\n // If no selection, return nothing\n if (element.selectionStart === element.selectionEnd) {\n return;\n }\n\n return {\n start: element.selectionStart,\n end: element.selectionEnd\n };\n} // Key codes\n\nexport var Keys = {\n Backspace: 8,\n Delete: 46\n}; // Finds out the operation to be intercepted and performed\n// based on the key down event `keyCode`.\n\nexport function getOperation(event) {\n switch (event.keyCode) {\n case Keys.Backspace:\n return 'Backspace';\n\n case Keys.Delete:\n return 'Delete';\n }\n} // Gets caret position\n\nexport function getCaretPosition(element) {\n return element.selectionStart;\n} // Sets caret position\n\nexport function setCaretPosition(element, caret_position) {\n // Sanity check\n if (caret_position === undefined) {\n return;\n } // Set caret position.\n // There has been an issue with caret positioning on Android devices.\n // https://github.com/catamphetamine/input-format/issues/2\n // I was revisiting this issue and looked for similar issues in other libraries.\n // For example, there's [`text-mask`](https://github.com/text-mask/text-mask) library.\n // They've had exactly the same issue when the caret seemingly refused to be repositioned programmatically.\n // The symptoms were the same: whenever the caret passed through a non-digit character of a mask (a whitespace, a bracket, a dash, etc), it looked as if it placed itself one character before its correct position.\n // https://github.com/text-mask/text-mask/issues/300\n // They seem to have found a basic fix for it: calling `input.setSelectionRange()` in a timeout rather than instantly for Android devices.\n // https://github.com/text-mask/text-mask/pull/400/files\n // I've implemented the same workaround here.\n\n\n if (isAndroid()) {\n setTimeout(function () {\n return element.setSelectionRange(caret_position, caret_position);\n }, 0);\n } else {\n element.setSelectionRange(caret_position, caret_position);\n }\n}\n\nfunction isAndroid() {\n // `navigator` is not defined when running mocha tests.\n if (typeof navigator !== 'undefined') {\n return ANDROID_USER_AGENT_REG_EXP.test(navigator.userAgent);\n }\n}\n\nvar ANDROID_USER_AGENT_REG_EXP = /Android/i;\n//# sourceMappingURL=dom.js.map","import edit from './edit';\nimport parse from './parse';\nimport format from './format';\nimport { getOperation, getSelection, getCaretPosition, setCaretPosition } from './dom';\nexport function onCut(event, input, _parse, _format, on_change) {\n // The actual cut hasn't happened just yet hence the timeout.\n setTimeout(function () {\n return format_input_text(input, _parse, _format, undefined, on_change);\n }, 0);\n}\nexport function onPaste(event, input, _parse, _format, on_change) {\n var selection = getSelection(input); // If selection is made,\n // just erase the selected text\n // prior to pasting\n\n if (selection) {\n erase_selection(input, selection);\n }\n\n format_input_text(input, _parse, _format, undefined, on_change);\n}\nexport function onChange(event, input, _parse, _format, on_change) {\n format_input_text(input, _parse, _format, undefined, on_change);\n} // Intercepts \"Delete\" and \"Backspace\" keys.\n// (hitting \"Delete\" or \"Backspace\" at any caret\n// position should always result in rasing a digit)\n\nexport function onKeyDown(event, input, _parse, _format, on_change) {\n var operation = getOperation(event);\n\n switch (operation) {\n case 'Delete':\n case 'Backspace':\n // Intercept this operation and perform it manually.\n event.preventDefault();\n var selection = getSelection(input); // If selection is made,\n // just erase the selected text,\n // and don't apply any more operations to it.\n\n if (selection) {\n erase_selection(input, selection);\n return format_input_text(input, _parse, _format, undefined, on_change);\n } // Else, perform the (character erasing) operation manually\n\n\n return format_input_text(input, _parse, _format, operation, on_change);\n\n default: // Will be handled when `onChange` fires.\n\n }\n}\n/**\r\n * Erases the selected text inside an ``.\r\n * @param {DOMElement} input\r\n * @param {Selection} selection\r\n */\n\nfunction erase_selection(input, selection) {\n var text = input.value;\n text = text.slice(0, selection.start) + text.slice(selection.end);\n input.value = text;\n setCaretPosition(input, selection.start);\n}\n/**\r\n * Parses and re-formats `` textual value.\r\n * E.g. when a user enters something into the ``\r\n * that raw input must first be parsed and the re-formatted properly.\r\n * Is called either after some user input (e.g. entered a character, pasted something)\r\n * or after the user performed an `operation` (e.g. \"Backspace\", \"Delete\").\r\n * @param {DOMElement} input\r\n * @param {Function} parse\r\n * @param {Function} format\r\n * @param {string} [operation] - The operation that triggered `` textual value change. E.g. \"Backspace\", \"Delete\".\r\n * @param {Function} onChange\r\n */\n\n\nfunction format_input_text(input, _parse, _format, operation, on_change) {\n // Parse `` textual value.\n // Get `value` and `caret` position.\n var _parse2 = parse(input.value, getCaretPosition(input), _parse),\n value = _parse2.value,\n caret = _parse2.caret; // If a user performed an operation (e.g. \"Backspace\", \"Delete\")\n // then apply that operation and get new `value` and `caret` position.\n\n\n if (operation) {\n var operation_applied = edit(value, caret, operation);\n value = operation_applied.value;\n caret = operation_applied.caret;\n } // Format the `value`.\n // (and reposition the caret accordingly)\n\n\n var formatted = format(value, caret, _format);\n var text = formatted.text;\n caret = formatted.caret; // Set `` textual value manually\n // to prevent React from resetting the caret position\n // later inside subsequent `render()`.\n // Doesn't work for custom `inputComponent`s for some reason.\n\n input.value = text; // Position the caret properly.\n\n setCaretPosition(input, caret); // `` textual value may have changed,\n // so the parsed `value` may have changed too.\n // The `value` didn't neccessarily change\n // but it might have.\n\n on_change(value);\n}\n//# sourceMappingURL=input control.js.map","// Parses the `text`.\n//\n// Returns `{ value, caret }` where `caret` is\n// the caret position inside `value`\n// corresponding to the `caret_position` inside `text`.\n//\n// The `text` is parsed by feeding each character sequentially to\n// `parse_character(character, value)` function\n// and appending the result (if it's not `undefined`) to `value`.\n//\n// Example:\n//\n// `text` is `8 (800) 555-35-35`,\n// `caret_position` is `4` (before the first `0`).\n// `parse_character` is `(character, value) =>\n// if (character >= '0' && character <= '9') { return character }`.\n//\n// then `parse()` outputs `{ value: '88005553535', caret: 2 }`.\n//\nexport default function parse(text, caret_position, parse_character) {\n var value = '';\n var focused_input_character_index = 0;\n var index = 0;\n\n while (index < text.length) {\n var character = parse_character(text[index], value);\n\n if (character !== undefined) {\n value += character;\n\n if (caret_position !== undefined) {\n if (caret_position === index) {\n focused_input_character_index = value.length - 1;\n } else if (caret_position > index) {\n focused_input_character_index = value.length;\n }\n }\n }\n\n index++;\n } // If caret position wasn't specified\n\n\n if (caret_position === undefined) {\n // Then set caret position to \"after the last input character\"\n focused_input_character_index = value.length;\n }\n\n var result = {\n value: value,\n caret: focused_input_character_index\n };\n return result;\n}\n//# sourceMappingURL=parse.js.map","// Edits text `value` (if `operation` is passed) and repositions the `caret` if needed.\n//\n// Example:\n//\n// value - '88005553535'\n// caret - 2 // starting from 0; is positioned before the first zero\n// operation - 'Backspace'\n//\n// Returns\n// {\n// \tvalue: '8005553535'\n// \tcaret: 1\n// }\n//\n// Currently supports just 'Delete' and 'Backspace' operations\n//\nexport default function edit(value, caret, operation) {\n switch (operation) {\n case 'Backspace':\n // If there exists the previous character,\n // then erase it and reposition the caret.\n if (caret > 0) {\n // Remove the previous character\n value = value.slice(0, caret - 1) + value.slice(caret); // Position the caret where the previous (erased) character was\n\n caret--;\n }\n\n break;\n\n case 'Delete':\n // Remove current digit (if any)\n value = value.slice(0, caret) + value.slice(caret + 1);\n break;\n }\n\n return {\n value: value,\n caret: caret\n };\n}\n//# sourceMappingURL=edit.js.map","import template_formatter from './template formatter'; // Formats `value` value preserving `caret` at the same character.\n//\n// `{ value, caret }` attribute is the result of `parse()` function call.\n//\n// Returns `{ text, caret }` where the new `caret` is the caret position\n// inside `text` text corresponding to the original `caret` position inside `value`.\n//\n// `formatter(value)` is a function returning `{ text, template }`.\n//\n// `text` is the `value` value formatted using `template`.\n// It may either cut off the non-filled right part of the `template`\n// or it may fill the non-filled character placeholders\n// in the right part of the `template` with `spacer`\n// which is a space (' ') character by default.\n//\n// `template` is the template used to format the `value`.\n// It can be either a full-length template or a partial template.\n//\n// `formatter` can also be a string — a `template`\n// where character placeholders are denoted by 'x'es.\n// In this case `formatter` function is automatically created.\n//\n// Example:\n//\n// `value` is '880',\n// `caret` is `2` (before the first `0`)\n//\n// `formatter` is `'880' =>\n// { text: '8 (80 )', template: 'x (xxx) xxx-xx-xx' }`\n//\n// The result is `{ text: '8 (80 )', caret: 4 }`.\n//\n\nexport default function format(value, caret, formatter) {\n if (typeof formatter === 'string') {\n formatter = template_formatter(formatter);\n }\n\n var _ref = formatter(value) || {},\n text = _ref.text,\n template = _ref.template;\n\n if (text === undefined) {\n text = value;\n }\n\n if (template) {\n if (caret === undefined) {\n caret = text.length;\n } else {\n var index = 0;\n var found = false;\n var possibly_last_input_character_index = -1;\n\n while (index < text.length && index < template.length) {\n // Character placeholder found\n if (text[index] !== template[index]) {\n if (caret === 0) {\n found = true;\n caret = index;\n break;\n }\n\n possibly_last_input_character_index = index;\n caret--;\n }\n\n index++;\n } // If the caret was positioned after last input character,\n // then the text caret index is just after the last input character.\n\n\n if (!found) {\n caret = possibly_last_input_character_index + 1;\n }\n }\n }\n\n return {\n text: text,\n caret: caret\n };\n}\n//# sourceMappingURL=format.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n// This is just `./ReactInput.js` rewritten in Hooks.\nimport React, { useCallback, useRef } from 'react';\nimport PropTypes from 'prop-types';\nimport { onChange as onInputChange, onCut as onInputCut, onPaste as onInputPaste, onKeyDown as onInputKeyDown } from '../input control'; // Usage:\n//\n// this.setState({ phone })}\n// \tparse={character => character}\n// \tformat={value => ({ text: value, template: 'xxxxxxxx' })}/>\n//\n\nfunction Input(_ref, ref) {\n var value = _ref.value,\n parse = _ref.parse,\n format = _ref.format,\n InputComponent = _ref.inputComponent,\n onChange = _ref.onChange,\n onCut = _ref.onCut,\n onPaste = _ref.onPaste,\n onKeyDown = _ref.onKeyDown,\n rest = _objectWithoutProperties(_ref, [\"value\", \"parse\", \"format\", \"inputComponent\", \"onChange\", \"onCut\", \"onPaste\", \"onKeyDown\"]);\n\n var ownRef = useRef();\n ref = ref || ownRef;\n\n var _onChange = useCallback(function (event) {\n return onInputChange(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange]);\n\n var _onPaste = useCallback(function (event) {\n if (onPaste) {\n onPaste(event);\n }\n\n return onInputPaste(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange, onPaste]);\n\n var _onCut = useCallback(function (event) {\n if (onCut) {\n onCut(event);\n }\n\n return onInputCut(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange, onCut]);\n\n var _onKeyDown = useCallback(function (event) {\n if (onKeyDown) {\n onKeyDown(event);\n }\n\n return onInputKeyDown(event, ref.current, parse, format, onChange);\n }, [ref, parse, format, onChange, onKeyDown]);\n\n return React.createElement(InputComponent, _extends({}, rest, {\n ref: ref,\n value: format(isEmptyValue(value) ? '' : value).text,\n onKeyDown: _onKeyDown,\n onChange: _onChange,\n onPaste: _onPaste,\n onCut: _onCut\n }));\n}\n\nInput = React.forwardRef(Input);\nInput.propTypes = {\n // Parses a single characher of `` text.\n parse: PropTypes.func.isRequired,\n // Formats `value` into `` text.\n format: PropTypes.func.isRequired,\n // Renders `` by default.\n inputComponent: PropTypes.elementType.isRequired,\n // `` `type` attribute.\n type: PropTypes.string.isRequired,\n // Is parsed from text.\n value: PropTypes.string,\n // This handler is called each time `` text is changed.\n onChange: PropTypes.func.isRequired,\n // Passthrough\n onKeyDown: PropTypes.func,\n onCut: PropTypes.func,\n onPaste: PropTypes.func\n};\nInput.defaultProps = {\n // Renders `` by default.\n inputComponent: 'input',\n // `` `type` attribute.\n type: 'text'\n};\nexport default Input;\n\nfunction isEmptyValue(value) {\n return value === undefined || value === null;\n}\n//# sourceMappingURL=Input.js.map","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\n// https://stackoverflow.com/a/46971044/970769\nvar ParseError = function ParseError(code) {\n _classCallCheck(this, ParseError);\n\n this.name = this.constructor.name;\n this.message = code;\n this.stack = new Error(code).stack;\n};\n\nexport { ParseError as default };\nParseError.prototype = Object.create(Error.prototype);\nParseError.prototype.constructor = ParseError;\n//# sourceMappingURL=ParseError.js.map","// The minimum length of the national significant number.\nexport var MIN_LENGTH_FOR_NSN = 2; // The ITU says the maximum length should be 15,\n// but one can find longer numbers in Germany.\n\nexport var MAX_LENGTH_FOR_NSN = 17; // The maximum length of the country calling code.\n\nexport var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers\n// (ascii, fullwidth, arabic-indic, and eastern arabic digits).\n\nexport var VALID_DIGITS = \"0-9\\uFF10-\\uFF19\\u0660-\\u0669\\u06F0-\\u06F9\"; // `DASHES` will be right after the opening square bracket of the \"character class\"\n\nvar DASHES = \"-\\u2010-\\u2015\\u2212\\u30FC\\uFF0D\";\nvar SLASHES = \"\\uFF0F/\";\nvar DOTS = \"\\uFF0E.\";\nexport var WHITESPACE = \" \\xA0\\xAD\\u200B\\u2060\\u3000\";\nvar BRACKETS = \"()\\uFF08\\uFF09\\uFF3B\\uFF3D\\\\[\\\\]\"; // export const OPENING_BRACKETS = '(\\uFF08\\uFF3B\\\\\\['\n\nvar TILDES = \"~\\u2053\\u223C\\uFF5E\"; // Regular expression of acceptable punctuation found in phone numbers. This\n// excludes punctuation found as a leading character only. This consists of dash\n// characters, white space characters, full stops, slashes, square brackets,\n// parentheses and tildes. Full-width variants are also present.\n\nexport var VALID_PUNCTUATION = \"\".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);\nexport var PLUS_CHARS = \"+\\uFF0B\"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')\n//# sourceMappingURL=constants.js.map","/**\r\n * Checks whether the entire input sequence can be matched\r\n * against the regular expression.\r\n * @return {boolean}\r\n */\nexport function matchesEntirely(text, regular_expression) {\n // If assigning the `''` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n text = text || '';\n return new RegExp('^(?:' + regular_expression + ')$').test(text);\n}\n/**\r\n * Merges two arrays.\r\n * @param {*} a\r\n * @param {*} b\r\n * @return {*}\r\n */\n\nexport function mergeArrays(a, b) {\n var merged = a.slice();\n\n for (var _iterator = b, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var element = _ref;\n\n if (a.indexOf(element) < 0) {\n merged.push(element);\n }\n }\n\n return merged.sort(function (a, b) {\n return a - b;\n }); // ES6 version, requires Set polyfill.\n // let merged = new Set(a)\n // for (const element of b)\n // {\n // \tmerged.add(i)\n // }\n // return Array.from(merged).sort((a, b) => a - b)\n}\n//# sourceMappingURL=util.js.map","// Copy-pasted from:\n// https://github.com/substack/semver-compare/blob/master/index.js\n//\n// Inlining this function because some users reported issues with\n// importing from `semver-compare` in a browser with ES6 \"native\" modules.\n//\n// Fixes `semver-compare` not being able to compare versions with alpha/beta/etc \"tags\".\n// https://github.com/catamphetamine/libphonenumber-js/issues/381\nexport default function (a, b) {\n a = a.split('-');\n b = b.split('-');\n var pa = a[0].split('.');\n var pb = b[0].split('.');\n\n for (var i = 0; i < 3; i++) {\n var na = Number(pa[i]);\n var nb = Number(pb[i]);\n if (na > nb) return 1;\n if (nb > na) return -1;\n if (!isNaN(na) && isNaN(nb)) return 1;\n if (isNaN(na) && !isNaN(nb)) return -1;\n }\n\n if (a[1] && b[1]) {\n return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;\n }\n\n return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;\n}\n//# sourceMappingURL=semver-compare.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _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); return Constructor; }\n\nimport compare from './tools/semver-compare'; // 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. ';\n/**\r\n * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md\r\n */\n\nvar Metadata =\n/*#__PURE__*/\nfunction () {\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\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 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 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 this.selectNumberingPlan(null, 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 =\n/*#__PURE__*/\nfunction () {\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 }\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n if (this.v1 || this.v2) return;\n return this.metadata[1];\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 }\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 =\n/*#__PURE__*/\nfunction () {\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()); // Previously, `FIRST_GROUP_ONLY_PREFIX_PATTERN` check was instead done via:\n // // Check that national prefix formatting rule is not a \"dummy\" one.\n // this.nationalPrefixFormattingRule() !== '$1' &&\n // // Check that national prefix formatting rule actually has national prefix digit(s).\n // // Filters out cases like \"($1)\".\n // // Is used in place of `libphonenumber`'s `FIRST_GROUP_ONLY_PREFIX_PATTERN_` regexp.\n // /\\d/.test(this.nationalPrefixFormattingRule().replace('$1', ''))\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 =\n/*#__PURE__*/\nfunction () {\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\n // `country_calling_codes` in `1.0.18`.\n\n\n if (!is_object(metadata) || !is_object(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(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(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 is_object = function is_object(_) {\n return _typeof(_) === 'object';\n}; // Babel transforms `typeof` into some \"branches\"\n// so istanbul will show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\n\nvar type_of = function type_of(_) {\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[country] !== undefined;\n}\n\nfunction setVersion(metadata) {\n this.v1 = !metadata.version;\n this.v2 = metadata.version !== undefined && compare(metadata.version, V3) === -1;\n this.v3 = metadata.version !== undefined && compare(metadata.version, V4) === -1;\n this.v4 = metadata.version !== undefined; // && compare(metadata.version, V5) === -1\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","import { VALID_DIGITS } from './constants'; // The RFC 3966 format for extensions.\n\nvar RFC3966_EXTN_PREFIX = ';ext='; // Pattern to capture digits used in an extension.\n// Places a maximum length of '7' for an extension.\n\nvar CAPTURING_EXTN_DIGITS = '([' + VALID_DIGITS + ']{1,7})';\n/**\r\n * Regexp of all possible ways to write extensions, for use when parsing. This\r\n * will be run as a case-insensitive regexp match. Wide character versions are\r\n * also provided after each ASCII version. There are three regular expressions\r\n * here. The first covers RFC 3966 format, where the extension is added using\r\n * ';ext='. The second more generic one starts with optional white space and\r\n * ends with an optional full stop (.), followed by zero or more spaces/tabs\r\n * /commas and then the numbers themselves. The other one covers the special\r\n * case of American numbers where the extension is written with a hash at the\r\n * end, such as '- 503#'. Note that the only capturing groups should be around\r\n * the digits that you want to capture as part of the extension, or else parsing\r\n * will fail! We allow two options for representing the accented o - the\r\n * character itself, and one in the unicode decomposed form with the combining\r\n * acute accent.\r\n */\n\nfunction create_extension_pattern(purpose) {\n // One-character symbols that can be used to indicate an extension.\n var single_extension_characters = \"x\\uFF58#\\uFF03~\\uFF5E\";\n\n switch (purpose) {\n // For parsing, we are slightly more lenient in our interpretation than for matching. Here we\n // allow \"comma\" and \"semicolon\" as possible extension indicators. When matching, these are\n case 'parsing':\n single_extension_characters = ',;' + single_extension_characters;\n }\n\n return RFC3966_EXTN_PREFIX + CAPTURING_EXTN_DIGITS + '|' + \"[ \\xA0\\\\t,]*\" + \"(?:e?xt(?:ensi(?:o\\u0301?|\\xF3))?n?|\\uFF45?\\uFF58\\uFF54\\uFF4E?|\" + // \"доб.\"\n \"\\u0434\\u043E\\u0431|\" + '[' + single_extension_characters + \"]|int|anexo|\\uFF49\\uFF4E\\uFF54)\" + \"[:\\\\.\\uFF0E]?[ \\xA0\\\\t,-]*\" + CAPTURING_EXTN_DIGITS + '#?|' + '[- ]+([' + VALID_DIGITS + ']{1,5})#';\n}\n/**\r\n * Regexp of all possible ways to write extensions, for use when parsing. This\r\n * will be run as a case-insensitive regexp match. Wide character versions are\r\n * also provided after each ASCII version. There are three regular expressions\r\n * here. The first covers RFC 3966 format, where the extension is added using\r\n * ';ext='. The second more generic one starts with optional white space and\r\n * ends with an optional full stop (.), followed by zero or more spaces/tabs\r\n * /commas and then the numbers themselves. The other one covers the special\r\n * case of American numbers where the extension is written with a hash at the\r\n * end, such as '- 503#'. Note that the only capturing groups should be around\r\n * the digits that you want to capture as part of the extension, or else parsing\r\n * will fail! We allow two options for representing the accented o - the\r\n * character itself, and one in the unicode decomposed form with the combining\r\n * acute accent.\r\n */\n\n\nexport var EXTN_PATTERNS_FOR_PARSING = create_extension_pattern('parsing');\nexport var EXTN_PATTERNS_FOR_MATCHING = create_extension_pattern('matching'); // Regexp of all known extension prefixes used by different regions followed by\n// 1 or more valid digits, for use when parsing.\n\nvar EXTN_PATTERN = new RegExp('(?:' + EXTN_PATTERNS_FOR_PARSING + ')$', 'i'); // Strips any extension (as in, the part of the number dialled after the call is\n// connected, usually indicated with extn, ext, x or similar) from the end of\n// the number, and returns it.\n\nexport function extractExtension(number) {\n var start = number.search(EXTN_PATTERN);\n\n if (start < 0) {\n return {};\n } // If we find a potential extension, and the number preceding this is a viable\n // number, we assume it is an extension.\n\n\n var number_without_extension = number.slice(0, start);\n var matches = number.match(EXTN_PATTERN);\n var i = 1;\n\n while (i < matches.length) {\n if (matches[i] != null && matches[i].length > 0) {\n return {\n number: number_without_extension,\n ext: matches[i]\n };\n }\n\n i++;\n }\n}\n//# sourceMappingURL=extension.js.map","import { MIN_LENGTH_FOR_NSN, VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from './constants';\nimport { EXTN_PATTERNS_FOR_PARSING } from './extension'; // Regular expression of viable phone numbers. This is location independent.\n// Checks we have at least three leading digits, and only valid punctuation,\n// alpha characters and digits in the phone number. Does not include extension\n// data. The symbol 'x' is allowed here as valid punctuation since it is often\n// used as a placeholder for carrier codes, for example in Brazilian phone\n// numbers. We also allow multiple '+' characters at the start.\n//\n// Corresponds to the following:\n// [digits]{minLengthNsn}|\n// plus_sign*\n// (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*\n//\n// The first reg-ex is to allow short numbers (two digits long) to be parsed if\n// they are entered as \"15\" etc, but only if there is no punctuation in them.\n// The second expression restricts the number of digits to three or more, but\n// then allows them to be in international form, and to have alpha-characters\n// and punctuation. We split up the two reg-exes here and combine them when\n// creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it\n// with ^ and append $ to each branch.\n//\n// \"Note VALID_PUNCTUATION starts with a -,\n// so must be the first in the range\" (c) Google devs.\n// (wtf did they mean by saying that; probably nothing)\n//\n\nvar MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}'; //\n// And this is the second reg-exp:\n// (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)\n//\n\nvar VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*'; // The combined regular expression for valid phone numbers:\n//\n\nvar VALID_PHONE_NUMBER_PATTERN = new RegExp( // Either a short two-digit-only phone number\n'^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' + // Or a longer fully parsed phone number (min 3 characters)\n'^' + VALID_PHONE_NUMBER + // Phone number extensions\n'(?:' + EXTN_PATTERNS_FOR_PARSING + ')?' + '$', 'i'); // Checks to see if the string of characters could possibly be a phone number at\n// all. At the moment, checks to see that the string begins with at least 2\n// digits, ignoring any punctuation commonly found in phone numbers. This method\n// does not require the number to be normalized in advance - but does assume\n// that leading non-number symbols have been removed, such as by the method\n// `extract_possible_number`.\n//\n\nexport default function isViablePhoneNumber(number) {\n return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);\n}\n//# sourceMappingURL=isViablePhoneNumber.js.map","// These mappings map a character (key) to a specific digit that should\n// replace it for normalization purposes. Non-European digits that\n// may be used in phone numbers are mapped to a European equivalent.\n//\n// E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\n//\nexport var DIGITS = {\n '0': '0',\n '1': '1',\n '2': '2',\n '3': '3',\n '4': '4',\n '5': '5',\n '6': '6',\n '7': '7',\n '8': '8',\n '9': '9',\n \"\\uFF10\": '0',\n // Fullwidth digit 0\n \"\\uFF11\": '1',\n // Fullwidth digit 1\n \"\\uFF12\": '2',\n // Fullwidth digit 2\n \"\\uFF13\": '3',\n // Fullwidth digit 3\n \"\\uFF14\": '4',\n // Fullwidth digit 4\n \"\\uFF15\": '5',\n // Fullwidth digit 5\n \"\\uFF16\": '6',\n // Fullwidth digit 6\n \"\\uFF17\": '7',\n // Fullwidth digit 7\n \"\\uFF18\": '8',\n // Fullwidth digit 8\n \"\\uFF19\": '9',\n // Fullwidth digit 9\n \"\\u0660\": '0',\n // Arabic-indic digit 0\n \"\\u0661\": '1',\n // Arabic-indic digit 1\n \"\\u0662\": '2',\n // Arabic-indic digit 2\n \"\\u0663\": '3',\n // Arabic-indic digit 3\n \"\\u0664\": '4',\n // Arabic-indic digit 4\n \"\\u0665\": '5',\n // Arabic-indic digit 5\n \"\\u0666\": '6',\n // Arabic-indic digit 6\n \"\\u0667\": '7',\n // Arabic-indic digit 7\n \"\\u0668\": '8',\n // Arabic-indic digit 8\n \"\\u0669\": '9',\n // Arabic-indic digit 9\n \"\\u06F0\": '0',\n // Eastern-Arabic digit 0\n \"\\u06F1\": '1',\n // Eastern-Arabic digit 1\n \"\\u06F2\": '2',\n // Eastern-Arabic digit 2\n \"\\u06F3\": '3',\n // Eastern-Arabic digit 3\n \"\\u06F4\": '4',\n // Eastern-Arabic digit 4\n \"\\u06F5\": '5',\n // Eastern-Arabic digit 5\n \"\\u06F6\": '6',\n // Eastern-Arabic digit 6\n \"\\u06F7\": '7',\n // Eastern-Arabic digit 7\n \"\\u06F8\": '8',\n // Eastern-Arabic digit 8\n \"\\u06F9\": '9' // Eastern-Arabic digit 9\n\n};\nexport function parseDigit(character) {\n return DIGITS[character];\n}\n/**\r\n * Parses phone number digits from a string.\r\n * Drops all punctuation leaving only digits.\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * parseDigits('8 (800) 555')\r\n * // Outputs '8800555'.\r\n * ```\r\n */\n\nexport default function parseDigits(string) {\n var result = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n\n for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n var digit = parseDigit(character);\n\n if (digit) {\n result += digit;\n }\n }\n\n return result;\n}\n//# sourceMappingURL=parseDigits.js.map","import { parseDigit } from './parseDigits';\n/**\r\n * Parses phone number characters from a string.\r\n * Drops all punctuation leaving only digits and the leading `+` sign (if any).\r\n * Also converts wide-ascii and arabic-indic numerals to conventional numerals.\r\n * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.\r\n * @param {string} string\r\n * @return {string}\r\n * @example\r\n * ```js\r\n * // Outputs '8800555'.\r\n * parseIncompletePhoneNumber('8 (800) 555')\r\n * // Outputs '+7800555'.\r\n * parseIncompletePhoneNumber('+7 800 555')\r\n * ```\r\n */\n\nexport default function parseIncompletePhoneNumber(string) {\n var result = ''; // Using `.split('')` here instead of normal `for ... of`\n // because the importing application doesn't neccessarily include an ES6 polyfill.\n // The `.split('')` approach discards \"exotic\" UTF-8 characters\n // (the ones consisting of four bytes) but digits\n // (including non-European ones) don't fall into that range\n // so such \"exotic\" characters would be discarded anyway.\n\n for (var _iterator = string.split(''), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var character = _ref;\n result += parsePhoneNumberCharacter(character, result) || '';\n }\n\n return result;\n}\n/**\r\n * `input-format` `parse()` function.\r\n * https://gitlab.com/catamphetamine/input-format\r\n * @param {string} character - Yet another character from raw input string.\r\n * @param {string} value - The value parsed so far.\r\n * @param {object} meta - Optional custom use-case-specific metadata.\r\n * @return {string?} The parsed character.\r\n */\n\nexport function parsePhoneNumberCharacter(character, value) {\n // Only allow a leading `+`.\n if (character === '+') {\n // If this `+` is not the first parsed character\n // then discard it.\n if (value) {\n return;\n }\n\n return '+';\n } // Allow digits.\n\n\n return parseDigit(character);\n}\n//# sourceMappingURL=parseIncompletePhoneNumber.js.map","import Metadata from './metadata';\nimport { matchesEntirely, mergeArrays } from './util';\nvar NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc)\n\nexport default function getNumberType(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {}; // When `parse()` returned `{}`\n // meaning that the phone number is not a valid one.\n\n if (!input.country) {\n return;\n }\n\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(input.country, input.countryCallingCode);\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function:\n // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835\n // Is this national number even valid for this country\n\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {\n return;\n } // Is it fixed line number\n\n\n if (is_of_type(nationalNumber, 'FIXED_LINE', metadata)) {\n // Because duplicate regular expressions are removed\n // to reduce metadata size, if \"mobile\" pattern is \"\"\n // then it means it was removed due to being a duplicate of the fixed-line pattern.\n //\n if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {\n return 'FIXED_LINE_OR_MOBILE';\n } // v1 metadata.\n // Legacy.\n // Deprecated.\n\n\n if (!metadata.type('MOBILE')) {\n return 'FIXED_LINE_OR_MOBILE';\n } // Check if the number happens to qualify as both fixed line and mobile.\n // (no such country in the minimal metadata set)\n\n /* istanbul ignore if */\n\n\n if (is_of_type(nationalNumber, 'MOBILE', metadata)) {\n return 'FIXED_LINE_OR_MOBILE';\n }\n\n return 'FIXED_LINE';\n }\n\n for (var _i = 0, _NON_FIXED_LINE_PHONE = NON_FIXED_LINE_PHONE_TYPES; _i < _NON_FIXED_LINE_PHONE.length; _i++) {\n var _type = _NON_FIXED_LINE_PHONE[_i];\n\n if (is_of_type(nationalNumber, _type, metadata)) {\n return _type;\n }\n }\n}\nexport function is_of_type(nationalNumber, type, metadata) {\n type = metadata.type(type);\n\n if (!type || !type.pattern()) {\n return false;\n } // Check if any possible number lengths are present;\n // if so, we use them to avoid checking\n // the validation pattern if they don't match.\n // If they are absent, this means they match\n // the general description, which we have\n // already checked before a specific number type.\n\n\n if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {\n return false;\n }\n\n return matchesEntirely(nationalNumber, type.pattern());\n} // Should only be called for the \"new\" metadata which has \"possible lengths\".\n\nexport function checkNumberLengthForType(nationalNumber, type, metadata) {\n var type_info = metadata.type(type); // There should always be \"\" set for every type element.\n // This is declared in the XML schema.\n // For size efficiency, where a sub-description (e.g. fixed-line)\n // has the same \"\" as the \"general description\", this is missing,\n // so we fall back to the \"general description\". Where no numbers of the type\n // exist at all, there is one possible length (-1) which is guaranteed\n // not to match the length of any real phone number.\n\n var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()\n // Metadata before version `1.0.18` didn't contain `possible_lengths`.\n\n if (!possible_lengths) {\n return 'IS_POSSIBLE';\n }\n\n if (type === 'FIXED_LINE_OR_MOBILE') {\n // No such country in metadata.\n\n /* istanbul ignore next */\n if (!metadata.type('FIXED_LINE')) {\n // The rare case has been encountered where no fixedLine data is available\n // (true for some non-geographic entities), so we just check mobile.\n return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata);\n }\n\n var mobile_type = metadata.type('MOBILE');\n\n if (mobile_type) {\n // Merge the mobile data in if there was any. \"Concat\" creates a new\n // array, it doesn't edit possible_lengths in place, so we don't need a copy.\n // Note that when adding the possible lengths from mobile, we have\n // to again check they aren't empty since if they are this indicates\n // they are the same as the general desc and should be obtained from there.\n possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and\n // re-sort (duplicates are okay). Sorting isn't so expensive because\n // the lists are very small.\n // if (local_lengths)\n // {\n // \tlocal_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())\n // }\n // else\n // {\n // \tlocal_lengths = mobile_type.possibleLengthsLocal()\n // }\n }\n } // If the type doesn't exist then return 'INVALID_LENGTH'.\n else if (type && !type_info) {\n return 'INVALID_LENGTH';\n }\n\n var actual_length = nationalNumber.length; // In `libphonenumber-js` all \"local-only\" formats are dropped for simplicity.\n // // This is safe because there is never an overlap beween the possible lengths\n // // and the local-only lengths; this is checked at build time.\n // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)\n // {\n // \treturn 'IS_POSSIBLE_LOCAL_ONLY'\n // }\n\n var minimum_length = possible_lengths[0];\n\n if (minimum_length === actual_length) {\n return 'IS_POSSIBLE';\n }\n\n if (minimum_length > actual_length) {\n return 'TOO_SHORT';\n }\n\n if (possible_lengths[possible_lengths.length - 1] < actual_length) {\n return 'TOO_LONG';\n } // We skip the first element since we've already checked it.\n\n\n return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';\n}\n//# sourceMappingURL=getNumberType_.js.map","import Metadata from './metadata';\nimport { checkNumberLengthForType } from './getNumberType_';\nexport default function isPossiblePhoneNumber(input, options, metadata) {\n /* istanbul ignore if */\n if (options === undefined) {\n options = {};\n }\n\n metadata = new Metadata(metadata);\n\n if (options.v2) {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n\n metadata.chooseCountryByCountryCallingCode(input.countryCallingCode);\n } else {\n if (!input.phone) {\n return false;\n }\n\n if (input.country) {\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n\n metadata.country(input.country);\n } else {\n if (!input.countryCallingCode) {\n throw new Error('Invalid phone number object passed');\n }\n\n metadata.chooseCountryByCountryCallingCode(input.countryCallingCode);\n }\n }\n\n if (metadata.possibleLengths()) {\n return isPossibleNumber(input.phone || input.nationalNumber, undefined, metadata);\n } else {\n // There was a bug between `1.7.35` and `1.7.37` where \"possible_lengths\"\n // were missing for \"non-geographical\" numbering plans.\n // Just assume the number is possible in such cases:\n // it's unlikely that anyone generated their custom metadata\n // in that short period of time (one day).\n // This code can be removed in some future major version update.\n if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {\n // \"Non-geographic entities\" did't have `possibleLengths`\n // due to a bug in metadata generation process.\n return true;\n } else {\n throw new Error('Missing \"possibleLengths\" in metadata. Perhaps the metadata has been generated before v1.0.18.');\n }\n }\n}\nexport function isPossibleNumber(nationalNumber, isInternational, metadata) {\n switch (checkNumberLengthForType(nationalNumber, undefined, metadata)) {\n case 'IS_POSSIBLE':\n return true;\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // \treturn !isInternational\n\n default:\n return false;\n }\n}\n//# sourceMappingURL=isPossibleNumber_.js.map","import Metadata from './metadata';\nimport { VALID_DIGITS } from './constants';\nvar CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');\n/**\r\n * Pattern that makes it easy to distinguish whether a region has a single\r\n * international dialing prefix or not. If a region has a single international\r\n * prefix (e.g. 011 in USA), it will be represented as a string that contains\r\n * a sequence of ASCII digits, and possibly a tilde, which signals waiting for\r\n * the tone. If there are multiple available international prefixes in a\r\n * region, they will be represented as a regex string that always contains one\r\n * or more characters that are not ASCII digits or a tilde.\r\n */\n\nvar SINGLE_IDD_PREFIX = /^[\\d]+(?:[~\\u2053\\u223C\\uFF5E][\\d]+)?$/; // For regions that have multiple IDD prefixes\n// a preferred IDD prefix is returned.\n\nexport function getIDDPrefix(country, callingCode, metadata) {\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n\n if (SINGLE_IDD_PREFIX.test(countryMetadata.IDDPrefix())) {\n return countryMetadata.IDDPrefix();\n }\n\n return countryMetadata.defaultIDDPrefix();\n}\nexport function stripIDDPrefix(number, country, callingCode, metadata) {\n if (!country) {\n return;\n } // Check if the number is IDD-prefixed.\n\n\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());\n\n if (number.search(IDDPrefixPattern) !== 0) {\n return;\n } // Strip IDD prefix.\n\n\n number = number.slice(number.match(IDDPrefixPattern)[0].length); // Some kind of a weird edge case.\n // No explanation from Google given.\n\n var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);\n /* istanbul ignore next */\n\n if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {\n if (matchedGroups[1] === '0') {\n return;\n }\n }\n\n return number;\n}\n//# sourceMappingURL=IDD.js.map","function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport isViablePhoneNumber from './isViablePhoneNumber'; // https://www.ietf.org/rfc/rfc3966.txt\n\n/**\r\n * @param {string} text - Phone URI (RFC 3966).\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\n\nexport function parseRFC3966(text) {\n var number;\n var ext; // Replace \"tel:\" with \"tel=\" for parsing convenience.\n\n text = text.replace(/^tel:/, 'tel=');\n\n for (var _iterator = text.split(';'), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var part = _ref;\n\n var _part$split = part.split('='),\n _part$split2 = _slicedToArray(_part$split, 2),\n name = _part$split2[0],\n value = _part$split2[1];\n\n switch (name) {\n case 'tel':\n number = value;\n break;\n\n case 'ext':\n ext = value;\n break;\n\n case 'phone-context':\n // Only \"country contexts\" are supported.\n // \"Domain contexts\" are ignored.\n if (value[0] === '+') {\n number = value + number;\n }\n\n break;\n }\n } // If the phone number is not viable, then abort.\n\n\n if (!isViablePhoneNumber(number)) {\n return {};\n }\n\n var result = {\n number: number\n };\n\n if (ext) {\n result.ext = ext;\n }\n\n return result;\n}\n/**\r\n * @param {object} - `{ ?number, ?extension }`.\r\n * @return {string} Phone URI (RFC 3966).\r\n */\n\nexport function formatRFC3966(_ref2) {\n var number = _ref2.number,\n ext = _ref2.ext;\n\n if (!number) {\n return '';\n }\n\n if (number[0] !== '+') {\n throw new Error(\"\\\"formatRFC3966()\\\" expects \\\"number\\\" to be in E.164 format.\");\n }\n\n return \"tel:\".concat(number).concat(ext ? ';ext=' + ext : '');\n}\n//# sourceMappingURL=RFC3966.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\nimport { VALID_PUNCTUATION } from './constants';\nimport { matchesEntirely } from './util';\nimport Metadata from './metadata';\nimport { getIDDPrefix } from './IDD';\nimport { formatRFC3966 } from './RFC3966';\nvar DEFAULT_OPTIONS = {\n formatExtension: function formatExtension(formattedNumber, extension, metadata) {\n return \"\".concat(formattedNumber).concat(metadata.ext()).concat(extension);\n } // Formats a phone number\n //\n // Example use cases:\n //\n // ```js\n // formatNumber('8005553535', 'RU', 'INTERNATIONAL')\n // formatNumber('8005553535', 'RU', 'INTERNATIONAL', metadata)\n // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL')\n // formatNumber({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', metadata)\n // formatNumber('+78005553535', 'NATIONAL')\n // formatNumber('+78005553535', 'NATIONAL', metadata)\n // ```\n //\n\n};\nexport default function formatNumber(input, format, options, metadata) {\n // Apply default options.\n if (options) {\n options = _objectSpread({}, DEFAULT_OPTIONS, options);\n } else {\n options = DEFAULT_OPTIONS;\n }\n\n metadata = new Metadata(metadata);\n\n if (input.country && input.country !== '001') {\n // Validate `input.country`.\n if (!metadata.hasCountry(input.country)) {\n throw new Error(\"Unknown country: \".concat(input.country));\n }\n\n metadata.country(input.country);\n } else if (input.countryCallingCode) {\n metadata.chooseCountryByCountryCallingCode(input.countryCallingCode);\n } else return input.phone || '';\n\n var countryCallingCode = metadata.countryCallingCode();\n var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s\n // but Babel has a bug and it says \"duplicate variable declaration\".\n\n var number;\n\n switch (format) {\n case 'NATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return '';\n }\n\n number = formatNationalNumber(nationalNumber, 'NATIONAL', metadata, options);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n\n case 'INTERNATIONAL':\n // Legacy argument support.\n // (`{ country: ..., phone: '' }`)\n if (!nationalNumber) {\n return \"+\".concat(countryCallingCode);\n }\n\n number = formatNationalNumber(nationalNumber, 'INTERNATIONAL', metadata, options);\n number = \"+\".concat(countryCallingCode, \" \").concat(number);\n return addExtension(number, input.ext, metadata, options.formatExtension);\n\n case 'E.164':\n // `E.164` doesn't define \"phone number extensions\".\n return \"+\".concat(countryCallingCode).concat(nationalNumber);\n\n case 'RFC3966':\n return formatRFC3966({\n number: \"+\".concat(countryCallingCode).concat(nationalNumber),\n ext: input.ext\n });\n\n case 'IDD':\n if (!options.fromCountry) {\n return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')\n }\n\n var IDDPrefix = getIDDPrefix(options.fromCountry, undefined, metadata.metadata);\n\n if (!IDDPrefix) {\n return;\n }\n\n if (options.humanReadable) {\n var formattedForSameCountryCallingCode = countryCallingCode && formatIDDSameCountryCallingCodeNumber(nationalNumber, metadata.countryCallingCode(), options.fromCountry, metadata, options);\n\n if (formattedForSameCountryCallingCode) {\n number = formattedForSameCountryCallingCode;\n } else {\n number = \"\".concat(IDDPrefix, \" \").concat(countryCallingCode, \" \").concat(formatNationalNumber(nationalNumber, 'INTERNATIONAL', metadata, options));\n }\n\n return addExtension(number, input.ext, metadata, options.formatExtension);\n }\n\n return \"\".concat(IDDPrefix).concat(countryCallingCode).concat(nationalNumber);\n\n default:\n throw new Error(\"Unknown \\\"format\\\" argument passed to \\\"formatNumber()\\\": \\\"\".concat(format, \"\\\"\"));\n }\n} // This was originally set to $1 but there are some countries for which the\n// first group is not used in the national pattern (e.g. Argentina) so the $1\n// group does not match correctly. Therefore, we use \\d, so that the first\n// group actually used in the pattern will be matched.\n\nexport var FIRST_GROUP_PATTERN = /(\\$\\d)/;\nexport function formatNationalNumberUsingFormat(number, format, useInternationalSeparator, useNationalPrefixFormattingRule, metadata) {\n var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalSeparator ? format.internationalFormat() : useNationalPrefixFormattingRule && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());\n\n if (useInternationalSeparator) {\n return applyInternationalSeparatorStyle(formattedNumber);\n }\n\n return formattedNumber;\n}\n\nfunction formatNationalNumber(number, formatAs, metadata, options) {\n var format = chooseFormatForNumber(metadata.formats(), number);\n\n if (!format) {\n return number;\n }\n\n return formatNationalNumberUsingFormat(number, format, formatAs === 'INTERNATIONAL', format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options.nationalPrefix === false ? false : true, metadata);\n}\n\nfunction chooseFormatForNumber(availableFormats, nationalNnumber) {\n for (var _iterator = availableFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var format = _ref;\n\n // Validate leading digits\n if (format.leadingDigitsPatterns().length > 0) {\n // The last leading_digits_pattern is used here, as it is the most detailed\n var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format\n\n if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {\n continue;\n }\n } // Check that the national number matches the phone number format regular expression\n\n\n if (matchesEntirely(nationalNnumber, format.pattern())) {\n return format;\n }\n }\n} // Removes brackets and replaces dashes with spaces.\n//\n// E.g. \"(999) 111-22-33\" -> \"999 111 22 33\"\n//\n// For some reason Google's metadata contains ``s with brackets and dashes.\n// Meanwhile, there's no single opinion about using punctuation in international phone numbers.\n//\n// For example, Google's `` for USA is `+1 213-373-4253`.\n// And here's a quote from WikiPedia's \"North American Numbering Plan\" page:\n// https://en.wikipedia.org/wiki/North_American_Numbering_Plan\n//\n// \"The country calling code for all countries participating in the NANP is 1.\n// In international format, an NANP number should be listed as +1 301 555 01 00,\n// where 301 is an area code (Maryland).\"\n//\n// I personally prefer the international format without any punctuation.\n// For example, brackets are remnants of the old age, meaning that the\n// phone number part in brackets (so called \"area code\") can be omitted\n// if dialing within the same \"area\".\n// And hyphens were clearly introduced for splitting local numbers into memorizable groups.\n// For example, remembering \"5553535\" is difficult but \"555-35-35\" is much simpler.\n// Imagine a man taking a bus from home to work and seeing an ad with a phone number.\n// He has a couple of seconds to memorize that number until it passes by.\n// If it were spaces instead of hyphens the man wouldn't necessarily get it,\n// but with hyphens instead of spaces the grouping is more explicit.\n// I personally think that hyphens introduce visual clutter,\n// so I prefer replacing them with spaces in international numbers.\n// In the modern age all output is done on displays where spaces are clearly distinguishable\n// so hyphens can be safely replaced with spaces without losing any legibility.\n//\n\n\nexport function applyInternationalSeparatorStyle(local) {\n return local.replace(new RegExp(\"[\".concat(VALID_PUNCTUATION, \"]+\"), 'g'), ' ').trim();\n}\n\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\n return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;\n}\n\nfunction formatIDDSameCountryCallingCodeNumber(number, toCountryCallingCode, fromCountry, toCountryMetadata, options) {\n var fromCountryMetadata = new Metadata(toCountryMetadata.metadata);\n fromCountryMetadata.country(fromCountry); // If calling within the same country calling code.\n\n if (toCountryCallingCode === fromCountryMetadata.countryCallingCode()) {\n // For NANPA regions, return the national format for these regions\n // but prefix it with the country calling code.\n if (toCountryCallingCode === '1') {\n return toCountryCallingCode + ' ' + formatNationalNumber(number, 'NATIONAL', toCountryMetadata, options);\n } // If regions share a country calling code, the country calling code need\n // not be dialled. This also applies when dialling within a region, so this\n // if clause covers both these cases. Technically this is the case for\n // dialling from La Reunion to other overseas departments of France (French\n // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover\n // this edge case for now and for those cases return the version including\n // country calling code. Details here:\n // http://www.petitfute.com/voyage/225-info-pratiques-reunion\n //\n\n\n return formatNationalNumber(number, 'NATIONAL', toCountryMetadata, options);\n }\n}\n//# sourceMappingURL=format_.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return 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); return Constructor; }\n\nimport Metadata from './metadata';\nimport isPossibleNumber from './isPossibleNumber_';\nimport isValidNumber from './validate_';\nimport isValidNumberForRegion from './isValidNumberForRegion_';\nimport getNumberType from './getNumberType_';\nimport formatNumber from './format_';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar PhoneNumber =\n/*#__PURE__*/\nfunction () {\n function PhoneNumber(countryCallingCode, nationalNumber, metadata) {\n _classCallCheck(this, PhoneNumber);\n\n if (!countryCallingCode) {\n throw new TypeError('`country` or `countryCallingCode` not passed');\n }\n\n if (!nationalNumber) {\n throw new TypeError('`nationalNumber` not passed');\n }\n\n var _metadata = new Metadata(metadata); // If country code is passed then derive `countryCallingCode` from it.\n // Also store the country code as `.country`.\n\n\n if (isCountryCode(countryCallingCode)) {\n this.country = countryCallingCode;\n\n _metadata.country(countryCallingCode);\n\n countryCallingCode = _metadata.countryCallingCode();\n } else {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (_metadata.isNonGeographicCallingCode(countryCallingCode)) {\n this.country = '001';\n }\n }\n }\n\n this.countryCallingCode = countryCallingCode;\n this.nationalNumber = nationalNumber;\n this.number = '+' + this.countryCallingCode + this.nationalNumber;\n this.metadata = metadata;\n }\n\n _createClass(PhoneNumber, [{\n key: \"isPossible\",\n value: function isPossible() {\n return isPossibleNumber(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"isValid\",\n value: function isValid() {\n return isValidNumber(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"isNonGeographic\",\n value: function isNonGeographic() {\n var metadata = new Metadata(this.metadata);\n return metadata.isNonGeographicCallingCode(this.countryCallingCode);\n }\n }, {\n key: \"isEqual\",\n value: function isEqual(phoneNumber) {\n return this.number === phoneNumber.number && this.ext === phoneNumber.ext;\n } // // Is just an alias for `this.isValid() && this.country === country`.\n // // https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\n // isValidForRegion(country) {\n // \treturn isValidNumberForRegion(this, country, { v2: true }, this.metadata)\n // }\n\n }, {\n key: \"getType\",\n value: function getType() {\n return getNumberType(this, {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"format\",\n value: function format(_format, options) {\n return formatNumber(this, _format, options ? _objectSpread({}, options, {\n v2: true\n }) : {\n v2: true\n }, this.metadata);\n }\n }, {\n key: \"formatNational\",\n value: function formatNational(options) {\n return this.format('NATIONAL', options);\n }\n }, {\n key: \"formatInternational\",\n value: function formatInternational(options) {\n return this.format('INTERNATIONAL', options);\n }\n }, {\n key: \"getURI\",\n value: function getURI(options) {\n return this.format('RFC3966', options);\n }\n }]);\n\n return PhoneNumber;\n}();\n\nexport { PhoneNumber as default };\n\nvar isCountryCode = function isCountryCode(value) {\n return /^[A-Z]{2}$/.test(value);\n};\n//# sourceMappingURL=PhoneNumber.js.map","import Metadata from './metadata';\nimport { matchesEntirely } from './util';\nimport getNumberType from './getNumberType_';\n/**\r\n * Checks if a given phone number is valid.\r\n *\r\n * If the `number` is a string, it will be parsed to an object,\r\n * but only if it contains only valid phone number characters (including punctuation).\r\n * If the `number` is an object, it is used as is.\r\n *\r\n * The optional `defaultCountry` argument is the default country.\r\n * I.e. it does not restrict to just that country,\r\n * e.g. in those cases where several countries share\r\n * the same phone numbering rules (NANPA, Britain, etc).\r\n * For example, even though the number `07624 369230`\r\n * belongs to the Isle of Man (\"IM\" country code)\r\n * calling `isValidNumber('07624369230', 'GB', metadata)`\r\n * still returns `true` because the country is not restricted to `GB`,\r\n * it's just that `GB` is the default one for the phone numbering rules.\r\n * For restricting the country see `isValidNumberForRegion()`\r\n * though restricting a country might not be a good idea.\r\n * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion\r\n *\r\n * Examples:\r\n *\r\n * ```js\r\n * isValidNumber('+78005553535', metadata)\r\n * isValidNumber('8005553535', 'RU', metadata)\r\n * isValidNumber('88005553535', 'RU', metadata)\r\n * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)\r\n * ```\r\n */\n\nexport default function isValidNumber(input, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n metadata = new Metadata(metadata); // This is just to support `isValidNumber({})`\n // for cases when `parseNumber()` returns `{}`.\n\n if (!input.country) {\n return false;\n }\n\n metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for\n // distinguishing different countries having the same `countryCallingCode`.\n\n if (metadata.hasTypes()) {\n return getNumberType(input, options, metadata.metadata) !== undefined;\n } // If there are no type regexps for this country in metadata then use\n // `nationalNumberPattern` as a \"better than nothing\" replacement.\n\n\n var national_number = options.v2 ? input.nationalNumber : input.phone;\n return matchesEntirely(national_number, metadata.nationalNumberPattern());\n}\n//# sourceMappingURL=validate_.js.map","// This is a port of Google Android `libphonenumber`'s\n// `phonenumberutil.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/commits/master/javascript/i18n/phonenumbers/phonenumberutil.js\nimport { VALID_DIGITS, PLUS_CHARS, MIN_LENGTH_FOR_NSN, MAX_LENGTH_FOR_NSN, MAX_LENGTH_COUNTRY_CODE } from './constants';\nimport { matchesEntirely } from './util';\nimport ParseError from './ParseError';\nimport Metadata from './metadata';\nimport isViablePhoneNumber from './isViablePhoneNumber';\nimport { extractExtension } from './extension';\nimport parseIncompletePhoneNumber from './parseIncompletePhoneNumber';\nimport getCountryCallingCode from './getCountryCallingCode';\nimport getNumberType, { checkNumberLengthForType } from './getNumberType_';\nimport { isPossibleNumber } from './isPossibleNumber_';\nimport { stripIDDPrefix } from './IDD';\nimport { parseRFC3966 } from './RFC3966';\nimport PhoneNumber from './PhoneNumber'; // We don't allow input strings for parsing to be longer than 250 chars.\n// This prevents malicious input from consuming CPU.\n\nvar MAX_INPUT_STRING_LENGTH = 250; // This consists of the plus symbol, digits, and arabic-indic digits.\n\nvar PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']'); // Regular expression of trailing characters that we want to remove.\n\nvar AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + ']+$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false; // `options`:\n// {\n// country:\n// {\n// restrict - (a two-letter country code)\n// the phone number must be in this country\n//\n// default - (a two-letter country code)\n// default country to use for phone number parsing and validation\n// (if no country code could be derived from the phone number)\n// }\n// }\n//\n// Returns `{ country, number }`\n//\n// Example use cases:\n//\n// ```js\n// parse('8 (800) 555-35-35', 'RU')\n// parse('8 (800) 555-35-35', 'RU', metadata)\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } })\n// parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)\n// parse('+7 800 555 35 35')\n// parse('+7 800 555 35 35', metadata)\n// ```\n//\n\nexport default function parse(text, options, metadata) {\n // If assigning the `{}` default value is moved to the arguments above,\n // code coverage would decrease for some weird reason.\n options = options || {};\n metadata = new Metadata(metadata); // Validate `defaultCountry`.\n\n if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n\n throw new Error(\"Unknown country: \".concat(options.defaultCountry));\n } // Parse the phone number.\n\n\n var _parseInput = parseInput(text, options.v2),\n formattedPhoneNumber = _parseInput.number,\n ext = _parseInput.ext; // If the phone number is not viable then return nothing.\n\n\n if (!formattedPhoneNumber) {\n if (options.v2) {\n throw new ParseError('NOT_A_NUMBER');\n }\n\n return {};\n }\n\n var _parsePhoneNumber = parsePhoneNumber(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata),\n country = _parsePhoneNumber.country,\n nationalNumber = _parsePhoneNumber.nationalNumber,\n countryCallingCode = _parsePhoneNumber.countryCallingCode,\n carrierCode = _parsePhoneNumber.carrierCode;\n\n if (!metadata.hasSelectedNumberingPlan()) {\n if (options.v2) {\n throw new ParseError('INVALID_COUNTRY');\n }\n\n return {};\n } // Validate national (significant) number length.\n\n\n if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {\n // Won't throw here because the regexp already demands length > 1.\n\n /* istanbul ignore if */\n if (options.v2) {\n throw new ParseError('TOO_SHORT');\n } // Google's demo just throws an error in this case.\n\n\n return {};\n } // Validate national (significant) number length.\n //\n // A sidenote:\n //\n // They say that sometimes national (significant) numbers\n // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).\n // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36\n // Such numbers will just be discarded.\n //\n\n\n if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {\n if (options.v2) {\n throw new ParseError('TOO_LONG');\n } // Google's demo just throws an error in this case.\n\n\n return {};\n }\n\n if (options.v2) {\n var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);\n\n if (country) {\n phoneNumber.country = country;\n }\n\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n }\n\n if (ext) {\n phoneNumber.ext = ext;\n }\n\n return phoneNumber;\n } // Check if national phone number pattern matches the number.\n // National number pattern is different for each country,\n // even for those ones which are part of the \"NANPA\" group.\n\n\n var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;\n\n if (!options.extended) {\n return valid ? result(country, nationalNumber, ext) : {};\n }\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n carrierCode: carrierCode,\n valid: valid,\n possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, countryCallingCode !== undefined, metadata) ? true : false,\n phone: nationalNumber,\n ext: ext\n };\n}\n/**\r\n * Extracts a formatted phone number from text.\r\n * Doesn't guarantee that the extracted phone number\r\n * is a valid phone number (for example, doesn't validate its length).\r\n * @param {string} text\r\n * @param {boolean} throwOnError — By default, it won't throw if the text is too long.\r\n * @return {string}\r\n * @example\r\n * // Returns \"(213) 373-4253\".\r\n * extractFormattedPhoneNumber(\"Call (213) 373-4253 for assistance.\")\r\n */\n\nexport function extractFormattedPhoneNumber(text, throwOnError) {\n if (!text) {\n return;\n }\n\n if (text.length > MAX_INPUT_STRING_LENGTH) {\n if (throwOnError) {\n throw new ParseError('TOO_LONG');\n }\n\n return;\n } // Attempt to extract a possible number from the string passed in\n\n\n var startsAt = text.search(PHONE_NUMBER_START_PATTERN);\n\n if (startsAt < 0) {\n return;\n }\n\n return text // Trim everything to the left of the phone number\n .slice(startsAt) // Remove trailing non-numerical characters\n .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');\n}\n/**\r\n * Strips any national prefix (such as 0, 1) present in a\r\n * (possibly incomplete) number provided.\r\n * \"Carrier codes\" are only used in Colombia and Brazil,\r\n * and only when dialing within those countries from a mobile phone to a fixed line number.\r\n * Sometimes it won't actually strip national prefix\r\n * and will instead prepend some digits to the `number`:\r\n * for example, when number `2345678` is passed with `VI` country selected,\r\n * it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\r\n * @param {string} number — National number digits.\r\n * @param {object} metadata — Metadata with country selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\n\nexport function stripNationalPrefixAndCarrierCode(number, metadata) {\n if (number && metadata.nationalPrefixForParsing()) {\n // See METADATA.md for the description of\n // `national_prefix_for_parsing` and `national_prefix_transform_rule`.\n // Attempt to parse the first digits as a national prefix.\n var prefixPattern = new RegExp('^(?:' + metadata.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode; // If a \"capturing group\" didn't match\n // then its element in `prefixMatch[]` array will be `undefined`.\n\n var capturedGroupsCount = prefixMatch.length - 1;\n\n if (metadata.nationalPrefixTransformRule() && capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount]) {\n nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // Carrier code is the last captured group,\n // but only when there's more than one captured group.\n\n if (capturedGroupsCount > 1 && prefixMatch[capturedGroupsCount]) {\n carrierCode = prefixMatch[1];\n }\n } // If it's a simple-enough case then just\n // strip the national prefix from the number.\n else {\n // National prefix is the whole substring matched by\n // the `national_prefix_for_parsing` regexp.\n var nationalPrefix = prefixMatch[0];\n nationalNumber = number.slice(nationalPrefix.length); // Carrier code is the last captured group.\n\n if (capturedGroupsCount > 0) {\n carrierCode = prefixMatch[1];\n }\n } // We require that the national (significant) number remaining after\n // stripping the national prefix and carrier code be long enough\n // to be a possible length for the region. Otherwise, we don't do\n // the stripping, since the original number could be a valid number.\n // For example, in some countries (Russia, Belarus) the same digit\n // could be both a national prefix and a leading digit of a valid\n // national phone number, like `8` is the national prefix for Russia\n // and `800 555 35 35` is a valid national (significant) number.\n\n\n if (matchesEntirely(number, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {// Don't strip national prefix or carrier code.\n } else {\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n }\n }\n }\n\n return {\n nationalNumber: number\n };\n}\nexport function findCountryCode(callingCode, nationalPhoneNumber, metadata) {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n return '001';\n }\n } // Is always non-empty, because `callingCode` is always valid\n\n\n var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);\n\n if (!possibleCountries) {\n return;\n } // If there's just one country corresponding to the country code,\n // then just return it, without further phone number digits validation.\n\n\n if (possibleCountries.length === 1) {\n return possibleCountries[0];\n }\n\n return _findCountryCode(possibleCountries, nationalPhoneNumber, metadata.metadata);\n} // Changes `metadata` `country`.\n\nfunction _findCountryCode(possibleCountries, nationalPhoneNumber, metadata) {\n metadata = new Metadata(metadata);\n\n for (var _iterator = possibleCountries, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var country = _ref;\n metadata.country(country); // Leading digits check would be the simplest one\n\n if (metadata.leadingDigits()) {\n if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {\n return country;\n }\n } // Else perform full validation with all of those\n // fixed-line/mobile/etc regular expressions.\n else if (getNumberType({\n phone: nationalPhoneNumber,\n country: country\n }, undefined, metadata.metadata)) {\n return country;\n }\n }\n}\n/**\r\n * @param {string} text - Input.\r\n * @return {object} `{ ?number, ?ext }`.\r\n */\n\n\nfunction parseInput(text, v2) {\n // Parse RFC 3966 phone number URI.\n if (text && text.indexOf('tel:') === 0) {\n return parseRFC3966(text);\n }\n\n var number = extractFormattedPhoneNumber(text, v2); // If the phone number is not viable, then abort.\n\n if (!number || !isViablePhoneNumber(number)) {\n return {};\n } // Attempt to parse extension first, since it doesn't require region-specific\n // data and we want to have the non-normalised number here.\n\n\n var withExtensionStripped = extractExtension(number);\n\n if (withExtensionStripped.ext) {\n return withExtensionStripped;\n }\n\n return {\n number: number\n };\n}\n/**\r\n * Creates `parse()` result object.\r\n */\n\n\nfunction result(country, nationalNumber, ext) {\n var result = {\n country: country,\n phone: nationalNumber\n };\n\n if (ext) {\n result.ext = ext;\n }\n\n return result;\n}\n/**\r\n * Parses a viable phone number.\r\n * @param {string} formattedPhoneNumber — Example: \"(213) 373-4253\".\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {Metadata} metadata\r\n * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.\r\n */\n\n\nfunction parsePhoneNumber(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {\n // Extract calling code from phone number.\n var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number; // Choose a country by `countryCallingCode`.\n\n\n var country;\n\n if (countryCallingCode) {\n metadata.chooseCountryByCountryCallingCode(countryCallingCode);\n } // If `formattedPhoneNumber` is in \"national\" format\n // then `number` is defined and `countryCallingCode` isn't.\n else if (number && (defaultCountry || defaultCallingCode)) {\n metadata.selectNumberingPlan(defaultCountry, defaultCallingCode);\n\n if (defaultCountry) {\n country = defaultCountry;\n } else {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(defaultCallingCode)) {\n country = '001';\n }\n }\n }\n\n countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata);\n } else return {};\n\n if (!number) {\n return {\n countryCallingCode: countryCallingCode\n };\n }\n\n var _stripNationalPrefixA = stripNationalPrefixAndCarrierCodeFromCompleteNumber(parseIncompletePhoneNumber(number), metadata),\n nationalNumber = _stripNationalPrefixA.nationalNumber,\n carrierCode = _stripNationalPrefixA.carrierCode; // Sometimes there are several countries\n // corresponding to the same country phone code\n // (e.g. NANPA countries all having `1` country phone code).\n // Therefore, to reliably determine the exact country,\n // national (significant) number should have been parsed first.\n //\n // When `metadata.json` is generated, all \"ambiguous\" country phone codes\n // get their countries populated with the full set of\n // \"phone number type\" regular expressions.\n //\n\n\n var exactCountry = findCountryCode(countryCallingCode, nationalNumber, metadata);\n\n if (exactCountry) {\n country = exactCountry;\n /* istanbul ignore if */\n\n if (exactCountry === '001') {// Can't happen with `USE_NON_GEOGRAPHIC_COUNTRY_CODE` being `false`.\n // If `USE_NON_GEOGRAPHIC_COUNTRY_CODE` is set to `true` for some reason,\n // then remove the \"istanbul ignore if\".\n } else {\n metadata.country(country);\n }\n }\n\n return {\n country: country,\n countryCallingCode: countryCallingCode,\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {Metadata} metadata — Metadata with a phone numbering plan selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\n\n\nexport function stripNationalPrefixAndCarrierCodeFromCompleteNumber(number, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _stripNationalPrefixA2 = stripNationalPrefixAndCarrierCode(parseIncompletePhoneNumber(number), metadata),\n nationalNumber = _stripNationalPrefixA2.nationalNumber,\n carrierCode = _stripNationalPrefixA2.carrierCode; // If a national prefix has been extracted, check to see\n // if the resultant number isn't too short.\n\n\n if (nationalNumber.length !== number.length + (carrierCode ? carrierCode.length : 0)) {\n // If not using legacy generated metadata (before version `1.0.18`)\n // then it has \"possible lengths\", so use those to validate the number length.\n if (metadata.possibleLengths()) {\n // \"We require that the NSN remaining after stripping the national prefix and\n // carrier code be long enough to be a possible length for the region.\n // Otherwise, we don't do the stripping, since the original number could be\n // a valid short number.\"\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n switch (checkNumberLengthForType(nationalNumber, undefined, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n/**\r\n * Converts a phone number digits (possibly with a `+`)\r\n * into a calling code and the rest phone number digits.\r\n * The \"rest phone number digits\" could include\r\n * a national prefix, carrier code, and national\r\n * (significant) number.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Default country.\r\n * @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic).\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`\r\n * @example\r\n * // Returns `{ countryCallingCode: \"1\", number: \"2133734253\" }`.\r\n * extractCountryCallingCode('2133734253', 'US', null, metadata)\r\n * extractCountryCallingCode('2133734253', null, '1', metadata)\r\n * extractCountryCallingCode('+12133734253', null, null, metadata)\r\n * extractCountryCallingCode('+12133734253', 'RU', null, metadata)\r\n */\n\nexport function extractCountryCallingCode(number, country, callingCode, metadata) {\n if (!number) {\n return {};\n } // If this is not an international phone number,\n // then either extract an \"IDD\" prefix, or extract a\n // country calling code from a number by autocorrecting it\n // by prepending a leading `+` in cases when it starts\n // with the country calling code.\n // https://wikitravel.org/en/International_dialling_prefix\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n\n\n if (number[0] !== '+') {\n // Convert an \"out-of-country\" dialing phone number\n // to a proper international phone number.\n var numberWithoutIDD = stripIDDPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n\n if (numberWithoutIDD && numberWithoutIDD !== number) {\n number = '+' + numberWithoutIDD;\n } else {\n // Check to see if the number starts with the country calling code\n // for the default country. If so, we remove the country calling code,\n // and do some checks on the validity of the number before and after.\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (country || callingCode) {\n var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),\n countryCallingCode = _extractCountryCallin2.countryCallingCode,\n shorterNumber = _extractCountryCallin2.number;\n\n if (countryCallingCode) {\n return {\n countryCallingCode: countryCallingCode,\n number: shorterNumber\n };\n }\n }\n\n return {\n number: number\n };\n }\n } // Fast abortion: country codes do not begin with a '0'\n\n\n if (number[1] === '0') {\n return {};\n }\n\n metadata = new Metadata(metadata); // The thing with country phone codes\n // is that they are orthogonal to each other\n // i.e. there's no such country phone code A\n // for which country phone code B exists\n // where B starts with A.\n // Therefore, while scanning digits,\n // if a valid country code is found,\n // that means that it is the country code.\n //\n\n var i = 2;\n\n while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n var _countryCallingCode = number.slice(1, i);\n\n if (metadata.hasCallingCode(_countryCallingCode)) {\n metadata.selectNumberingPlan(undefined, _countryCallingCode);\n return {\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n\n i++;\n }\n\n return {};\n}\n/**\r\n * Sometimes some people incorrectly input international phone numbers\r\n * without the leading `+`. This function corrects such input.\r\n * @param {string} number — Phone number digits.\r\n * @param {string?} country\r\n * @param {string?} callingCode\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`.\r\n */\n\nexport function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) {\n var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode;\n\n if (number.indexOf(countryCallingCode) === 0) {\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(country, callingCode);\n var possibleShorterNumber = number.slice(countryCallingCode.length);\n\n var _stripNationalPrefixA3 = stripNationalPrefixAndCarrierCode(possibleShorterNumber, metadata),\n possibleShorterNationalNumber = _stripNationalPrefixA3.nationalNumber;\n\n var _stripNationalPrefixA4 = stripNationalPrefixAndCarrierCode(number, metadata),\n nationalNumber = _stripNationalPrefixA4.nationalNumber; // If the number was not valid before but is valid now,\n // or if it was too long before, we consider the number\n // with the country calling code stripped to be a better result\n // and keep that instead.\n // For example, in Germany (+49), `49` is a valid area code,\n // so if a number starts with `49`, it could be both a valid\n // national German number or an international number without\n // a leading `+`.\n\n\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLengthForType(nationalNumber, undefined, metadata) === 'TOO_LONG') {\n return {\n countryCallingCode: countryCallingCode,\n number: possibleShorterNumber\n };\n }\n }\n\n return {\n number: number\n };\n}\n//# sourceMappingURL=parse_.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport parseNumber from './parse_';\nexport default function parsePhoneNumber(text, options, metadata) {\n return parseNumber(text, _objectSpread({}, options, {\n v2: true\n }), metadata);\n}\n//# sourceMappingURL=parsePhoneNumber_.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nimport parsePhoneNumber_ from './parsePhoneNumber_';\nexport default function parsePhoneNumber() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n\n return parsePhoneNumber_(text, options, metadata);\n}\nexport function normalizeArguments(args) {\n var _Array$prototype$slic = Array.prototype.slice.call(args),\n _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4),\n arg_1 = _Array$prototype$slic2[0],\n arg_2 = _Array$prototype$slic2[1],\n arg_3 = _Array$prototype$slic2[2],\n arg_4 = _Array$prototype$slic2[3];\n\n var text;\n var options;\n var metadata; // If the phone number is passed as a string.\n // `parsePhoneNumber('88005553535', ...)`.\n\n if (typeof arg_1 === 'string') {\n text = arg_1;\n } else throw new TypeError('A text for parsing must be a string.'); // If \"default country\" argument is being passed then move it to `options`.\n // `parsePhoneNumber('88005553535', 'RU', [options], metadata)`.\n\n\n if (!arg_2 || typeof arg_2 === 'string') {\n if (arg_4) {\n options = arg_3;\n metadata = arg_4;\n } else {\n options = undefined;\n metadata = arg_3;\n }\n\n if (arg_2) {\n options = _objectSpread({\n defaultCountry: arg_2\n }, options);\n }\n } // `defaultCountry` is not passed.\n // Example: `parsePhoneNumber('+78005553535', [options], metadata)`.\n else if (isObject(arg_2)) {\n if (arg_3) {\n options = arg_2;\n metadata = arg_3;\n } else {\n metadata = arg_2;\n }\n } else throw new Error(\"Invalid second argument: \".concat(arg_2));\n\n return {\n text: text,\n options: options,\n metadata: metadata\n };\n} // Otherwise istanbul would show this as \"branch not covered\".\n\n/* istanbul ignore next */\n\nvar isObject = function isObject(_) {\n return _typeof(_) === 'object';\n};\n//# sourceMappingURL=parsePhoneNumber.js.map","function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nimport parsePhoneNumber from './parsePhoneNumber_';\nimport ParseError from './ParseError';\nimport { isSupportedCountry } from './metadata';\nexport default function parsePhoneNumberFromString(text, options, metadata) {\n // Validate `defaultCountry`.\n if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) {\n options = _objectSpread({}, options, {\n defaultCountry: undefined\n });\n } // Parse phone number.\n\n\n try {\n return parsePhoneNumber(text, options, metadata);\n } catch (error) {\n /* istanbul ignore else */\n if (error instanceof ParseError) {//\n } else {\n throw error;\n }\n }\n}\n//# sourceMappingURL=parsePhoneNumberFromString_.js.map","import { normalizeArguments } from './parsePhoneNumber';\nimport parsePhoneNumberFromString_ from './parsePhoneNumberFromString_';\nexport default function parsePhoneNumberFromString() {\n var _normalizeArguments = normalizeArguments(arguments),\n text = _normalizeArguments.text,\n options = _normalizeArguments.options,\n metadata = _normalizeArguments.metadata;\n\n return parsePhoneNumberFromString_(text, options, metadata);\n}\n//# sourceMappingURL=parsePhoneNumberFromString.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _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); return Constructor; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n// This is an enhanced port of Google Android `libphonenumber`'s\n// `asyoutypeformatter.js` of December 31th, 2018.\n//\n// https://github.com/googlei18n/libphonenumber/blob/8d21a365061de2ba0675c878a710a7b24f74d2ae/javascript/i18n/phonenumbers/asyoutypeformatter.js\n//\n// Simplified: does not differentiate between \"local-only\" numbers\n// and \"internationally dialable\" numbers.\n// For example, doesn't include changes like this:\n// https://github.com/googlei18n/libphonenumber/commit/865da605da12b01053c4f053310bac7c5fbb7935\nimport Metadata from './metadata';\nimport PhoneNumber from './PhoneNumber';\nimport { VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from './constants';\nimport { matchesEntirely } from './util';\nimport { extractCountryCallingCode as _extractCountryCallingCode, findCountryCode, stripNationalPrefixAndCarrierCode, stripNationalPrefixAndCarrierCodeFromCompleteNumber, extractCountryCallingCodeFromInternationalNumberWithoutPlusSign } from './parse_';\nimport { FIRST_GROUP_PATTERN, formatNationalNumberUsingFormat, applyInternationalSeparatorStyle } from './format_';\nimport { stripIDDPrefix } from './IDD';\nimport { checkNumberLengthForType } from './getNumberType_';\nimport parseDigits from './parseDigits'; // Used in phone number format template creation.\n// Could be any digit, I guess.\n\nvar DUMMY_DIGIT = '9'; // I don't know why is it exactly `15`\n\nvar LONGEST_NATIONAL_PHONE_NUMBER_LENGTH = 15; // Create a phone number consisting only of the digit 9 that matches the\n// `number_pattern` by applying the pattern to the \"longest phone number\" string.\n\nvar LONGEST_DUMMY_PHONE_NUMBER = repeat(DUMMY_DIGIT, LONGEST_NATIONAL_PHONE_NUMBER_LENGTH); // The digits that have not been entered yet will be represented by a \\u2008,\n// the punctuation space.\n\nexport var DIGIT_PLACEHOLDER = 'x'; // '\\u2008' (punctuation space)\n\nvar DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER); // A set of characters that, if found in a national prefix formatting rules, are an indicator to\n// us that we should separate the national prefix from the number when formatting.\n\nvar NATIONAL_PREFIX_SEPARATORS_PATTERN = /[- ]/; // Deprecated: Google has removed some formatting pattern related code from their repo.\n// https://github.com/googlei18n/libphonenumber/commit/a395b4fef3caf57c4bc5f082e1152a4d2bd0ba4c\n// \"We no longer have numbers in formatting matching patterns, only \\d.\"\n// Because this library supports generating custom metadata\n// some users may still be using old metadata so the relevant\n// code seems to stay until some next major version update.\n\nvar SUPPORT_LEGACY_FORMATTING_PATTERNS = true; // A pattern that is used to match character classes in regular expressions.\n// An example of a character class is \"[1-4]\".\n\nvar CREATE_CHARACTER_CLASS_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function () {\n return /\\[([^\\[\\]])*\\]/g;\n}; // Any digit in a regular expression that actually denotes a digit. For\n// example, in the regular expression \"80[0-2]\\d{6,10}\", the first 2 digits\n// (8 and 0) are standalone digits, but the rest are not.\n// Two look-aheads are needed because the number following \\\\d could be a\n// two-digit number, since the phone number can be as long as 15 digits.\n\n\nvar CREATE_STANDALONE_DIGIT_PATTERN = SUPPORT_LEGACY_FORMATTING_PATTERNS && function () {\n return /\\d(?=[^,}][^,}])/g;\n}; // A pattern that is used to determine if a `format` is eligible\n// to be used by the \"as you type formatter\".\n// It is eligible when the `format` contains groups of the dollar sign\n// followed by a single digit, separated by valid phone number punctuation.\n// This prevents invalid punctuation (such as the star sign in Israeli star numbers)\n// getting into the output of the \"as you type formatter\".\n\n\nvar ELIGIBLE_FORMAT_PATTERN = new RegExp('^' + '[' + VALID_PUNCTUATION + ']*' + '(\\\\$\\\\d[' + VALID_PUNCTUATION + ']*)+' + '$'); // This is the minimum length of the leading digits of a phone number\n// to guarantee the first \"leading digits pattern\" for a phone number format\n// to be preemptive.\n\nvar MIN_LEADING_DIGITS_LENGTH = 3;\nvar VALID_FORMATTED_PHONE_NUMBER_PART = '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+';\nvar VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN = new RegExp('^' + VALID_FORMATTED_PHONE_NUMBER_PART + '$', 'i');\nvar VALID_PHONE_NUMBER = '(?:' + '[' + PLUS_CHARS + ']' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*' + '|' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + ')';\nvar AFTER_PHONE_NUMBER_DIGITS_END_PATTERN = new RegExp('[^' + VALID_PUNCTUATION + VALID_DIGITS + ']+' + '.*' + '$');\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar AsYouType =\n/*#__PURE__*/\nfunction () {\n // Not setting `options` to a constructor argument\n // not to break backwards compatibility\n // for older versions of the library.\n\n /**\r\n * @param {(string|object)?} [optionsOrDefaultCountry] - The default country used for parsing non-international phone numbers. Can also be an `options` object.\r\n * @param {Object} metadata\r\n */\n function AsYouType(optionsOrDefaultCountry, metadata) {\n _classCallCheck(this, AsYouType);\n\n _defineProperty(this, \"options\", {});\n\n this.metadata = new Metadata(metadata); // Set `defaultCountry` and `defaultCallingCode` options.\n\n var defaultCountry;\n var defaultCallingCode; // Turns out `null` also has type \"object\". Weird.\n\n if (optionsOrDefaultCountry) {\n if (_typeof(optionsOrDefaultCountry) === 'object') {\n defaultCountry = optionsOrDefaultCountry.defaultCountry;\n defaultCallingCode = optionsOrDefaultCountry.defaultCallingCode;\n } else {\n defaultCountry = optionsOrDefaultCountry;\n }\n }\n\n if (defaultCountry && this.metadata.hasCountry(defaultCountry)) {\n this.defaultCountry = defaultCountry;\n }\n\n if (defaultCallingCode) {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\n this.defaultCountry = '001';\n }\n }\n\n this.defaultCallingCode = defaultCallingCode;\n } // Reset.\n\n\n this.reset();\n }\n\n _createClass(AsYouType, [{\n key: \"reset\",\n value: function reset() {\n this.formattedOutput = '';\n this.international = false;\n this.internationalPrefix = undefined;\n this.countryCallingCode = undefined;\n this.digits = '';\n this.nationalNumberDigits = '';\n this.nationalPrefix = '';\n this.carrierCode = '';\n this.setCountry(this.defaultCountry, this.defaultCallingCode);\n return this;\n }\n }, {\n key: \"resetFormat\",\n value: function resetFormat() {\n this.chosenFormat = undefined;\n this.template = undefined;\n this.populatedNationalNumberTemplate = undefined;\n this.populatedNationalNumberTemplatePosition = -1;\n }\n /**\r\n * Returns `true` if the phone number is being input in international format.\r\n * In other words, returns `true` if and only if the parsed phone number starts with a `\"+\"`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isInternational\",\n value: function isInternational() {\n return this.international;\n }\n /**\r\n * Returns the \"country calling code\" part of the phone number.\r\n * Returns `undefined` if the number is not being input in international format.\r\n * Returns \"country calling code\" for \"non-geographic\" phone numbering plans too.\r\n * @return {string} [countryCallingCode]\r\n */\n\n }, {\n key: \"getCountryCallingCode\",\n value: function getCountryCallingCode() {\n return this.countryCallingCode;\n }\n /**\r\n * Returns a two-letter country code of the phone number.\r\n * Returns `undefined` for \"non-geographic\" phone numbering plans.\r\n * Returns `undefined` if no phone number has been input yet.\r\n * @return {string} [country]\r\n */\n\n }, {\n key: \"getCountry\",\n value: function getCountry() {\n // If no digits have been input yet,\n // then `this.country` is the `defaultCountry`.\n // Won't return the `defaultCountry` in such case.\n if (!this.digits) {\n return;\n }\n\n var countryCode = this.country;\n /* istanbul ignore if */\n\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (this.country === '001') {\n countryCode = undefined;\n }\n }\n\n return countryCode;\n }\n }, {\n key: \"setCountry\",\n value: function setCountry(country, callingCode) {\n this.country = country;\n this.metadata.selectNumberingPlan(country, callingCode);\n\n if (this.metadata.hasSelectedNumberingPlan()) {\n this.initializePhoneNumberFormatsForCountry();\n } else {\n this.matchingFormats = [];\n }\n\n this.resetFormat();\n }\n /**\r\n * Inputs \"next\" phone number characters.\r\n * @param {string} text\r\n * @return {string} Formatted phone number characters that have been input so far.\r\n */\n\n }, {\n key: \"input\",\n value: function input(text) {\n var formattedDigits = this.extractFormattedDigits(text); // If the extracted phone number part\n // can possibly be a part of some valid phone number\n // then parse phone number characters from a formatted phone number.\n\n if (VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN.test(formattedDigits)) {\n this.formattedOutput = this.getFullNumber(this.inputDigits(parseDigits(formattedDigits)) || this.getNonFormattedNationalNumber());\n }\n\n return this.formattedOutput;\n }\n /**\r\n * Extracts formatted phone number digits from text (if there're any).\r\n * @param {string} text\r\n * @return {string}\r\n */\n\n }, {\n key: \"extractFormattedDigits\",\n value: function extractFormattedDigits(text) {\n // Extract a formatted phone number part from text.\n var extractedNumber = extractFormattedPhoneNumber(text) || ''; // Trim a `+`.\n\n if (extractedNumber[0] === '+') {\n // Trim the `+`.\n extractedNumber = extractedNumber.slice('+'.length);\n\n if (this.digits) {// If an out of position `+` is detected\n // (or a second `+`) then just ignore it.\n } else {\n this.formattedOutput = '+';\n this.startInternationalNumber();\n }\n }\n\n return extractedNumber;\n }\n }, {\n key: \"startInternationalNumber\",\n value: function startInternationalNumber() {\n // Prepend the `+` to parsed input.\n this.international = true; // If a default country was set then reset it\n // because an explicitly international phone\n // number is being entered.\n\n this.setCountry();\n }\n /**\r\n * Inputs \"next\" phone number digits.\r\n * @param {string} digits\r\n * @return {string} [formattedNumber] Formatted national phone number (if it can be formatted at this stage). Returning `undefined` means \"don't format the national phone number at this stage\".\r\n */\n\n }, {\n key: \"inputDigits\",\n value: function inputDigits(nextDigits) {\n // Some users input their phone number in \"out-of-country\"\n // dialing format instead of using the leading `+`.\n // https://github.com/catamphetamine/libphonenumber-js/issues/185\n // Detect such numbers.\n if (!this.digits) {\n var numberWithoutIDD = stripIDDPrefix(nextDigits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);\n\n if (numberWithoutIDD && numberWithoutIDD !== nextDigits) {\n // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n this.internationalPrefix = nextDigits.slice(0, nextDigits.length - numberWithoutIDD.length);\n nextDigits = numberWithoutIDD;\n this.startInternationalNumber();\n }\n } // Append phone number digits.\n\n\n this.digits += nextDigits; // Try to format the parsed input\n\n if (this.isInternational()) {\n if (this.countryCallingCode) {\n this.nationalNumberDigits += nextDigits; // `this.country` could be `undefined`, for example, when there is\n // ambiguity in a form of several different countries,\n // each corresponding to the same country phone code\n // (e.g. NANPA: USA, Canada, etc), and there's not enough digits\n // to reliably determine the country the phone number belongs to.\n // Therefore, in cases of such ambiguity, each time something is input,\n // try to determine the country (if it hasn't been determined yet).\n\n if (!this.country || this.isCountryCallingCodeAmbiguous()) {\n this.determineTheCountry();\n }\n } else {\n // Extract country calling code from the digits entered so far.\n // There must be some digits in order to extract anything from them.\n //\n // If one looks at country phone codes\n // then they can notice that no one country phone code\n // is ever a (leftmost) substring of another country phone code.\n // So if a valid country code is extracted so far\n // then it means that this is the country code.\n //\n // If no country phone code could be extracted so far,\n // then don't format the phone number.\n //\n if (!this.extractCountryCallingCode()) {\n // Don't format the phone number.\n return;\n } // Possibly extract a national prefix.\n // Some people incorrectly input national prefix\n // in an international phone number.\n // For example, some people write British phone numbers as `+44(0)...`.\n // Also, mobile phone numbers in Mexico are supposed to be dialled\n // internationally using a `15` national prefix.\n //\n // https://www.mexperience.com/dialing-cell-phones-in-mexico/\n //\n // \"Dialing a Mexican cell phone from abroad\n // When you are calling a cell phone number in Mexico from outside Mexico,\n // it’s necessary to dial an additional “1” after Mexico’s country code\n // (which is “52”) and before the area code.\n // You also ignore the 045, and simply dial the area code and the\n // cell phone’s number.\n //\n // If you don’t add the “1”, you’ll receive a recorded announcement\n // asking you to redial using it.\n //\n // For example, if you are calling from the USA to a cell phone\n // in Mexico City, you would dial +52 – 1 – 55 – 1234 5678.\n // (Note that this is different to calling a land line in Mexico City\n // from abroad, where the number dialed would be +52 – 55 – 1234 5678)\".\n //\n\n\n this.nationalNumberDigits = this.digits.slice(this.countryCallingCode.length); // this.extractNationalPrefix()\n //\n // Determine the country from country calling code and national number.\n\n this.determineTheCountry();\n }\n } else {\n this.nationalNumberDigits += nextDigits; // If `defaultCallingCode` is set,\n // see if the `country` could be derived.\n\n if (!this.country) {\n this.determineTheCountry();\n } // Some national prefixes are substrings of other national prefixes\n // (for the same country), therefore try to extract national prefix each time\n // because a longer national prefix might be available at some point in time.\n\n\n var previousNationalPrefix = this.nationalPrefix;\n this.nationalNumberDigits = this.nationalPrefix + this.nationalNumberDigits; // Re-extract national prefix.\n\n this.extractNationalPrefix(); // If another national prefix has been extracted.\n\n if (this.nationalPrefix !== previousNationalPrefix) {\n // National number has changed\n // (due to another national prefix been extracted)\n // therefore national number has changed\n // therefore reset all previous formatting data.\n // (and leading digits matching state)\n this.initializePhoneNumberFormatsForCountry();\n this.resetFormat();\n }\n }\n\n if (this.nationalNumberDigits) {\n // Match the available formats by the currently available leading digits.\n this.matchFormats(this.nationalNumberDigits);\n } // Format the phone number (given the next digits)\n\n\n return this.formatNationalNumberWithNextDigits(nextDigits);\n }\n }, {\n key: \"formatNationalNumberWithNextDigits\",\n value: function formatNationalNumberWithNextDigits(nextDigits) {\n // See if the phone number digits can be formatted as a complete phone number.\n // If not, use the results from `formatNextNationalNumberDigits()`,\n // which formats based on the chosen formatting pattern.\n // Attempting to format complete phone number first is how it's done\n // in Google's `libphonenumber`.\n var formattedNumber = this.attemptToFormatCompletePhoneNumber(); // Just because a phone number doesn't have a suitable format\n // that doesn't mean that the phone number is invalid,\n // because phone number formats only format phone numbers,\n // they don't validate them and some (rare) phone numbers\n // are meant to stay non-formatted.\n\n if (formattedNumber) {\n return formattedNumber;\n } // Format the next phone number digits\n // using the previously chosen phone number format.\n //\n // This is done here because if `attemptToFormatCompletePhoneNumber`\n // was placed before this call then the `template`\n // wouldn't reflect the situation correctly (and would therefore be inconsistent)\n //\n\n\n var previouslyChosenFormat = this.chosenFormat; // Choose a format from the list of matching ones.\n\n var newlyChosenFormat = this.chooseFormat();\n\n if (newlyChosenFormat) {\n if (newlyChosenFormat === previouslyChosenFormat) {\n // If could format the next (current) digit\n // using the previously chosen phone number format\n // then return the formatted number so far.\n //\n // If no new phone number format could be chosen,\n // and couldn't format the supplied national number\n // using the previously chosen phone number pattern,\n // then return `undefined`.\n //\n return this.formatNextNationalNumberDigits(nextDigits);\n } else {\n // If a more appropriate phone number format\n // has been chosen for these \"leading digits\",\n // then format the national phone number (so far)\n // using the newly selected format.\n //\n // Will return `undefined` if it couldn't format\n // the supplied national number\n // using the selected phone number pattern.\n //\n return this.reformatNationalNumber();\n }\n }\n }\n }, {\n key: \"chooseFormat\",\n value: function chooseFormat() {\n // When there are multiple available formats, the formatter uses the first\n // format where a formatting template could be created.\n for (var _iterator = this.matchingFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref = _i.value;\n }\n\n var format = _ref;\n\n // If this format is currently being used\n // and is still possible, then stick to it.\n if (this.chosenFormat === format) {\n break;\n }\n\n if (!this.createFormattingTemplate(format)) {\n continue;\n }\n\n this.chosenFormat = format; // With a new formatting template, the matched position\n // using the old template needs to be reset.\n\n this.populatedNationalNumberTemplatePosition = -1;\n break;\n }\n\n if (!this.chosenFormat) {\n // No format matches the national phone number entered.\n this.resetFormat();\n }\n\n return this.chosenFormat;\n } // Formats each digit of the national phone number (so far)\n // using the selected format.\n\n }, {\n key: \"reformatNationalNumber\",\n value: function reformatNationalNumber() {\n return this.formatNextNationalNumberDigits(this.nationalPrefix + this.nationalNumberDigits);\n }\n }, {\n key: \"initializePhoneNumberFormatsForCountry\",\n value: function initializePhoneNumberFormatsForCountry() {\n // Get all \"eligible\" phone number formats for this country\n this.matchingFormats = this.metadata.formats().filter(function (format) {\n // Compared to `libphonenumber`'s code, the two \"Discard a few formats\n // that we know are not relevant based on the presence of the national prefix\"\n // checks have changed: the first one has been moved to `.matchFormats()`,\n // and the second one doesn't apply to this library because it doesn't deal with\n // \"incomplete\" phone numbers (for example, phone numbers, entered without \"area code\").\n return ELIGIBLE_FORMAT_PATTERN.test(format.internationalFormat());\n });\n }\n }, {\n key: \"matchFormats\",\n value: function matchFormats(leadingDigits) {\n var _this = this;\n\n // \"leading digits\" pattern list starts with a\n // \"leading digits\" pattern fitting a maximum of 3 leading digits.\n // So, after a user inputs 3 digits of a national (significant) phone number\n // this national (significant) number can already be formatted.\n // The next \"leading digits\" pattern is for 4 leading digits max,\n // and the \"leading digits\" pattern after it is for 5 leading digits max, etc.\n // This implementation is different from Google's\n // in that it searches for a fitting format\n // even if the user has entered less than\n // `MIN_LEADING_DIGITS_LENGTH` digits of a national number.\n // Because some leading digit patterns already match for a single first digit.\n var leadingDigitsPatternIndex = leadingDigits.length - MIN_LEADING_DIGITS_LENGTH;\n\n if (leadingDigitsPatternIndex < 0) {\n leadingDigitsPatternIndex = 0;\n }\n\n this.matchingFormats = this.matchingFormats.filter(function (format) {\n // If national prefix is mandatory for this phone number format\n // and the user didn't input the national prefix\n // then this phone number format isn't suitable.\n if (!_this.isInternational() && !_this.nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) {\n return false;\n }\n\n var leadingDigitsPatternsCount = format.leadingDigitsPatterns().length; // If this format is not restricted to a certain\n // leading digits pattern then it fits.\n\n if (leadingDigitsPatternsCount === 0) {\n return true;\n } // Start excluding any non-matching formats only when the\n // national number entered so far is at least 3 digits long,\n // otherwise format matching would give false negatives.\n // For example, when the digits entered so far are `2`\n // and the leading digits pattern is `21` –\n // it's quite obvious in this case that the format could be the one\n // but due to the absence of further digits it would give false negative.\n\n\n if (leadingDigits.length < MIN_LEADING_DIGITS_LENGTH) {\n return true;\n } // If at least `MIN_LEADING_DIGITS_LENGTH` digits of a national number are available\n // then format matching starts narrowing down the list of possible formats\n // (only previously matched formats are considered for next digits).\n\n\n leadingDigitsPatternIndex = Math.min(leadingDigitsPatternIndex, leadingDigitsPatternsCount - 1);\n var leadingDigitsPattern = format.leadingDigitsPatterns()[leadingDigitsPatternIndex]; // Brackets are required for `^` to be applied to\n // all or-ed (`|`) parts, not just the first one.\n\n return new RegExp(\"^(\".concat(leadingDigitsPattern, \")\")).test(leadingDigits);\n }); // If there was a phone number format chosen\n // and it no longer holds given the new leading digits then reset it.\n // The test for this `if` condition is marked as:\n // \"Reset a chosen format when it no longer holds given the new leading digits\".\n // To construct a valid test case for this one can find a country\n // in `PhoneNumberMetadata.xml` yielding one format for 3 ``\n // and yielding another format for 4 `` (Australia in this case).\n\n if (this.chosenFormat && this.matchingFormats.indexOf(this.chosenFormat) === -1) {\n this.resetFormat();\n }\n }\n }, {\n key: \"getSeparatorAfterNationalPrefix\",\n value: function getSeparatorAfterNationalPrefix(format) {\n if (this.metadata.countryCallingCode() === '1') {\n return ' ';\n }\n\n if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) {\n return ' ';\n }\n\n return '';\n } // This is in accordance to how Google's `libphonenumber` does it.\n // \"Check to see if there is an exact pattern match for these digits.\n // If so, we should use this instead of any other formatting template\n // whose `leadingDigitsPattern` also matches the input.\"\n\n }, {\n key: \"attemptToFormatCompletePhoneNumber\",\n value: function attemptToFormatCompletePhoneNumber() {\n for (var _iterator2 = this.matchingFormats, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray2) {\n if (_i2 >= _iterator2.length) break;\n _ref2 = _iterator2[_i2++];\n } else {\n _i2 = _iterator2.next();\n if (_i2.done) break;\n _ref2 = _i2.value;\n }\n\n var format = _ref2;\n var matcher = new RegExp(\"^(?:\".concat(format.pattern(), \")$\"));\n\n if (!matcher.test(this.nationalNumberDigits)) {\n continue;\n } // Here, national number is formatted without \"national prefix\n // formatting rule\", because otherwise there'd be a bug\n // when \"area code\" is \"duplicated\" during input:\n // https://github.com/catamphetamine/libphonenumber-js/issues/318\n\n\n var formattedNationalNumber = formatNationalNumberUsingFormat(this.nationalNumberDigits, format, this.isInternational(), false, // Don't prepend national prefix (it will be prepended manually).\n this.metadata); // Check if this `format` preserves all digits.\n // This is how it's done in Google's `libphonenumber`.\n // Also, it fixes the bug when \"area code\" is \"duplicated\" during input:\n // https://github.com/catamphetamine/libphonenumber-js/issues/318\n //\n // \"Check that we didn't remove nor add any extra digits when we matched\n // this formatting pattern. This usually happens after we entered the last\n // digit during AYTF. Eg: In case of MX, we swallow mobile token (1) when\n // formatted but AYTF should retain all the number entered and not change\n // in order to match a format (of same leading digits and length) display\n // in that way.\"\n // \"If it's the same (i.e entered number and format is same), then it's\n // safe to return this in formatted number as nothing is lost / added.\"\n // Otherwise, don't use this format.\n // https://github.com/google/libphonenumber/commit/3e7c1f04f5e7200f87fb131e6f85c6e99d60f510#diff-9149457fa9f5d608a11bb975c6ef4bc5\n // https://github.com/google/libphonenumber/commit/3ac88c7106e7dcb553bcc794b15f19185928a1c6#diff-2dcb77e833422ee304da348b905cde0b\n //\n\n if (parseDigits(formattedNationalNumber) !== this.nationalNumberDigits) {\n continue;\n } // Prepend national prefix (if any).\n\n\n if (this.nationalPrefix) {\n // Here, national number is formatted with \"national prefix\n // formatting rule\". The reason is that \"national prefix\n // formatting rule\" often adds parentheses, and while Google's\n // `libphonenumber` dismisses those preferring simply prepending\n // national prefix followed by a \" \" character, this library\n // looks if the national prefix could be formatted better.\n var formattedNationalNumberWithNationalPrefix = formatNationalNumberUsingFormat(this.nationalNumberDigits, format, this.isInternational(), true, // Prepend national prefix.\n this.metadata);\n\n if (parseDigits(formattedNationalNumberWithNationalPrefix) === this.nationalPrefix + this.nationalNumberDigits) {\n formattedNationalNumber = formattedNationalNumberWithNationalPrefix;\n } else {\n formattedNationalNumber = this.nationalPrefix + this.getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;\n }\n } // formats national number (probably) without national prefix.\n // Formatting a national number with national prefix could result in\n // bugs when \"area code\" is \"duplicated\" during input:\n // https://github.com/catamphetamine/libphonenumber-js/issues/318\n // The \"are all digits preserved\" check fixes that type of bug.\n // To leave the formatter in a consistent state\n\n\n this.resetFormat();\n this.chosenFormat = format; // Set `this.template` and `this.populatedNationalNumberTemplate`.\n\n /* istanbul ignore else */\n\n if (this.createFormattingTemplate(format)) {\n // Populate `this.populatedNationalNumberTemplate` with phone number digits.\n this.reformatNationalNumber();\n } else {\n // If the formatting template couldn't be created for a format,\n // create it manually from the formatted phone number.\n // This case doesn't ever happen with the current metadata.\n this.template = this.getFullNumber(formattedNationalNumber).replace(/[\\d\\+]/g, DIGIT_PLACEHOLDER);\n this.populatedNationalNumberTemplate = formattedNationalNumber;\n this.populatedNationalNumberTemplatePosition = this.populatedNationalNumberTemplate.length - 1;\n }\n\n return formattedNationalNumber;\n }\n }\n }, {\n key: \"getInternationalPrefix\",\n value: function getInternationalPrefix(options) {\n return this.internationalPrefix ? options && options.spacing === false ? this.internationalPrefix : this.internationalPrefix + ' ' : '+';\n } // Prepends `+CountryCode ` in case of an international phone number\n\n }, {\n key: \"getFullNumber\",\n value: function getFullNumber(formattedNationalNumber) {\n if (this.isInternational()) {\n var prefix = this.getInternationalPrefix();\n\n if (!this.countryCallingCode) {\n return \"\".concat(prefix).concat(this.digits);\n }\n\n if (!formattedNationalNumber) {\n return \"\".concat(prefix).concat(this.countryCallingCode);\n }\n\n return \"\".concat(prefix).concat(this.countryCallingCode, \" \").concat(formattedNationalNumber);\n }\n\n return formattedNationalNumber;\n }\n }, {\n key: \"getNonFormattedNationalNumber\",\n value: function getNonFormattedNationalNumber() {\n return this.nationalPrefix + (this.nationalPrefix && this.nationalNumberDigits && this.getSeparatorAfterNationalPrefix()) + this.nationalNumberDigits;\n } // Extracts the country calling code from the beginning\n // of the entered `national_number` (so far),\n // and places the remaining input into the `national_number`.\n\n }, {\n key: \"extractCountryCallingCode\",\n value: function extractCountryCallingCode() {\n var _extractCountryCallin = _extractCountryCallingCode('+' + this.digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n\n if (!countryCallingCode) {\n return;\n }\n\n this.nationalNumberDigits = number;\n this.countryCallingCode = countryCallingCode;\n this.metadata.chooseCountryByCountryCallingCode(countryCallingCode);\n this.initializePhoneNumberFormatsForCountry();\n this.resetFormat();\n return this.metadata.hasSelectedNumberingPlan();\n }\n }, {\n key: \"extractNationalPrefix\",\n value: function extractNationalPrefix() {\n this.nationalPrefix = '';\n\n if (!this.metadata.hasSelectedNumberingPlan()) {\n return;\n } // Only strip national prefixes for non-international phone numbers\n // because national prefixes can't be present in international phone numbers.\n // While `parseNumber()` is forgiving is such cases, `AsYouType` is not.\n\n\n var _stripNationalPrefixA = stripNationalPrefixAndCarrierCode(this.nationalNumberDigits, this.metadata),\n nationalNumber = _stripNationalPrefixA.nationalNumber,\n carrierCode = _stripNationalPrefixA.carrierCode; // Sometimes `stripNationalPrefixAndCarrierCode()` won't actually\n // strip national prefix and will instead prepend some digits to the `number`:\n // for example, when number `2345678` is passed with `VI` country selected,\n // it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\n // So check if the `nationalNumber` is actually at the end of `this.nationalNumberDigits`.\n\n\n if (nationalNumber) {\n var index = this.nationalNumberDigits.indexOf(nationalNumber);\n\n if (index < 0 || index !== this.nationalNumberDigits.length - nationalNumber.length) {\n return;\n }\n }\n\n if (carrierCode) {\n this.carrierCode = carrierCode;\n }\n\n this.nationalPrefix = this.nationalNumberDigits.slice(0, this.nationalNumberDigits.length - nationalNumber.length);\n this.nationalNumberDigits = nationalNumber;\n return this.nationalPrefix;\n } // isPossibleNumber(number) {\n // \tswitch (checkNumberLengthForType(number, undefined, this.metadata)) {\n // \t\tcase 'IS_POSSIBLE':\n // \t\t\treturn true\n // \t\t// case 'IS_POSSIBLE_LOCAL_ONLY':\n // \t\t// \treturn !this.isInternational()\n // \t\tdefault:\n // \t\t\treturn false\n // \t}\n // }\n\n }, {\n key: \"isCountryCallingCodeAmbiguous\",\n value: function isCountryCallingCodeAmbiguous() {\n var countryCodes = this.metadata.getCountryCodesForCallingCode(this.countryCallingCode);\n return countryCodes && countryCodes.length > 1;\n }\n }, {\n key: \"createFormattingTemplate\",\n value: function createFormattingTemplate(format) {\n // The formatter doesn't format numbers when numberPattern contains '|', e.g.\n // (20|3)\\d{4}. In those cases we quickly return.\n // (Though there's no such format in current metadata)\n\n /* istanbul ignore if */\n if (SUPPORT_LEGACY_FORMATTING_PATTERNS && format.pattern().indexOf('|') >= 0) {\n return;\n } // Get formatting template for this phone number format\n\n\n var template = this.getTemplateForNumberFormatPattern(format, this.nationalPrefix); // If the national number entered is too long\n // for any phone number format, then abort.\n\n if (!template) {\n return;\n }\n\n this.template = template;\n this.populatedNationalNumberTemplate = template; // For convenience, the public `.template` property\n // contains the whole international number\n // if the phone number being input is international:\n // 'x' for the '+' sign, 'x'es for the country phone code,\n // a spacebar and then the template for the formatted national number.\n\n if (this.isInternational()) {\n this.template = this.getInternationalPrefix().replace(/[\\d\\+]/g, DIGIT_PLACEHOLDER) + repeat(DIGIT_PLACEHOLDER, this.countryCallingCode.length) + ' ' + template;\n }\n\n return this.template;\n }\n /**\r\n * Generates formatting template for a national phone number,\r\n * optionally containing a national prefix, for a format.\r\n * @param {Format} format\r\n * @param {string} nationalPrefix\r\n * @return {string}\r\n */\n\n }, {\n key: \"getTemplateForNumberFormatPattern\",\n value: function getTemplateForNumberFormatPattern(format, nationalPrefix) {\n var pattern = format.pattern();\n /* istanbul ignore else */\n\n if (SUPPORT_LEGACY_FORMATTING_PATTERNS) {\n pattern = pattern // Replace anything in the form of [..] with \\d\n .replace(CREATE_CHARACTER_CLASS_PATTERN(), '\\\\d') // Replace any standalone digit (not the one in `{}`) with \\d\n .replace(CREATE_STANDALONE_DIGIT_PATTERN(), '\\\\d');\n } // Generate a dummy national number (consisting of `9`s)\n // that fits this format's `pattern`.\n //\n // This match will always succeed,\n // because the \"longest dummy phone number\"\n // has enough length to accomodate any possible\n // national phone number format pattern.\n //\n\n\n var digits = LONGEST_DUMMY_PHONE_NUMBER.match(pattern)[0]; // If the national number entered is too long\n // for any phone number format, then abort.\n\n if (this.nationalNumberDigits.length > digits.length) {\n return;\n } // Get a formatting template which can be used to efficiently format\n // a partial number where digits are added one by one.\n // Below `strictPattern` is used for the\n // regular expression (with `^` and `$`).\n // This wasn't originally in Google's `libphonenumber`\n // and I guess they don't really need it\n // because they're not using \"templates\" to format phone numbers\n // but I added `strictPattern` after encountering\n // South Korean phone number formatting bug.\n //\n // Non-strict regular expression bug demonstration:\n //\n // this.nationalNumberDigits : `111111111` (9 digits)\n //\n // pattern : (\\d{2})(\\d{3,4})(\\d{4})\n // format : `$1 $2 $3`\n // digits : `9999999999` (10 digits)\n //\n // '9999999999'.replace(new RegExp(/(\\d{2})(\\d{3,4})(\\d{4})/g), '$1 $2 $3') = \"99 9999 9999\"\n //\n // template : xx xxxx xxxx\n //\n // But the correct template in this case is `xx xxx xxxx`.\n // The template was generated incorrectly because of the\n // `{3,4}` variability in the `pattern`.\n //\n // The fix is, if `this.nationalNumberDigits` has already sufficient length\n // to satisfy the `pattern` completely then `this.nationalNumberDigits`\n // is used instead of `digits`.\n\n\n var strictPattern = new RegExp('^' + pattern + '$');\n var nationalNumberDummyDigits = this.nationalNumberDigits.replace(/\\d/g, DUMMY_DIGIT); // If `this.nationalNumberDigits` has already sufficient length\n // to satisfy the `pattern` completely then use it\n // instead of `digits`.\n\n if (strictPattern.test(nationalNumberDummyDigits)) {\n digits = nationalNumberDummyDigits;\n }\n\n var numberFormat = this.getFormatFormat(format);\n var includesNationalPrefix;\n\n if (nationalPrefix) {\n if (format.nationalPrefixFormattingRule()) {\n var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule());\n\n if (parseDigits(numberFormatWithNationalPrefix) === nationalPrefix + parseDigits(numberFormat)) {\n numberFormat = numberFormatWithNationalPrefix;\n includesNationalPrefix = true;\n var i = nationalPrefix.length;\n\n while (i > 0) {\n numberFormat = numberFormat.replace(/\\d/, DIGIT_PLACEHOLDER);\n i--;\n }\n }\n }\n } // Generate formatting template for this phone number format.\n\n\n var template = digits // Format the dummy phone number according to the format.\n .replace(new RegExp(pattern), numberFormat) // Replace each dummy digit with a DIGIT_PLACEHOLDER.\n .replace(new RegExp(DUMMY_DIGIT, 'g'), DIGIT_PLACEHOLDER);\n\n if (nationalPrefix) {\n if (!includesNationalPrefix) {\n // Prepend national prefix to the template manually.\n template = repeat(DIGIT_PLACEHOLDER, nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;\n }\n }\n\n return template;\n }\n }, {\n key: \"formatNextNationalNumberDigits\",\n value: function formatNextNationalNumberDigits(digits) {\n // Using `.split('')` to iterate through a string here\n // to avoid requiring `Symbol.iterator` polyfill.\n // `.split('')` is generally not safe for Unicode,\n // but in this particular case for `digits` it is safe.\n // for (const digit of digits)\n for (var _iterator3 = digits.split(''), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) {\n var _ref3;\n\n if (_isArray3) {\n if (_i3 >= _iterator3.length) break;\n _ref3 = _iterator3[_i3++];\n } else {\n _i3 = _iterator3.next();\n if (_i3.done) break;\n _ref3 = _i3.value;\n }\n\n var digit = _ref3;\n\n // If there is room for more digits in current `template`,\n // then set the next digit in the `template`,\n // and return the formatted digits so far.\n // If more digits are entered than the current format could handle.\n if (this.populatedNationalNumberTemplate.slice(this.populatedNationalNumberTemplatePosition + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) {\n // Reset the format.\n this.resetFormat();\n return;\n }\n\n this.populatedNationalNumberTemplatePosition = this.populatedNationalNumberTemplate.search(DIGIT_PLACEHOLDER_MATCHER);\n this.populatedNationalNumberTemplate = this.populatedNationalNumberTemplate.replace(DIGIT_PLACEHOLDER_MATCHER, digit);\n } // Return the formatted phone number so far.\n\n\n return cutAndStripNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1); // The old way which was good for `input-format` but is not so good\n // for `react-phone-number-input`'s default input (`InputBasic`).\n // return closeNonPairedParens(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition + 1)\n // \t.replace(new RegExp(DIGIT_PLACEHOLDER, 'g'), ' ')\n }\n }, {\n key: \"getFormatFormat\",\n value: function getFormatFormat(format) {\n if (this.isInternational()) {\n return applyInternationalSeparatorStyle(format.internationalFormat());\n }\n\n return format.format();\n } // Determines the country of the phone number\n // entered so far based on the country phone code\n // and the national phone number.\n\n }, {\n key: \"determineTheCountry\",\n value: function determineTheCountry() {\n this.country = findCountryCode(this.isInternational() ? this.countryCallingCode : this.defaultCallingCode, this.nationalNumberDigits, this.metadata);\n }\n /**\r\n * Returns an instance of `PhoneNumber` class.\r\n * Will return `undefined` if no national (significant) number\r\n * digits have been entered so far, or if no `defaultCountry` has been\r\n * set and the user enters a phone number not in international format.\r\n */\n\n }, {\n key: \"getNumber\",\n value: function getNumber() {\n if (this.isInternational()) {\n if (!this.countryCallingCode) {\n return;\n }\n } else {\n if (!this.country && !this.defaultCallingCode) {\n return;\n }\n }\n\n if (!this.nationalNumberDigits) {\n return undefined;\n }\n\n var countryCode = this.getCountry();\n var callingCode = this.getCountryCallingCode() || this.defaultCallingCode;\n var nationalNumber = this.nationalNumberDigits;\n var carrierCode = this.carrierCode; // When an international number without a leading `+` has been autocorrected,\n // extract country calling code, because normally it's only extracted\n // for international numbers with a leading `+`.\n // Could also just use `parsePhoneNumberFromString()` here\n // instead of hacking around this single case.\n\n if (!this.isInternational() && this.nationalNumberDigits === this.digits) {\n var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(this.digits, countryCode, callingCode, this.metadata.metadata),\n countryCallingCode = _extractCountryCallin2.countryCallingCode,\n number = _extractCountryCallin2.number;\n\n if (countryCallingCode) {\n var _stripNationalPrefixA2 = stripNationalPrefixAndCarrierCodeFromCompleteNumber(number, this.metadata),\n shorterNationalNumber = _stripNationalPrefixA2.nationalNumber,\n newCarrierCode = _stripNationalPrefixA2.carrierCode;\n\n nationalNumber = shorterNationalNumber;\n carrierCode = newCarrierCode;\n }\n }\n\n var phoneNumber = new PhoneNumber(countryCode || callingCode, nationalNumber, this.metadata.metadata);\n\n if (carrierCode) {\n phoneNumber.carrierCode = carrierCode;\n } // Phone number extensions are not supported by \"As You Type\" formatter.\n\n\n return phoneNumber;\n }\n /**\r\n * Returns `true` if the phone number is \"possible\".\r\n * Is just a shortcut for `PhoneNumber.isPossible()`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isPossible\",\n value: function isPossible() {\n var phoneNumber = this.getNumber();\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isPossible();\n }\n /**\r\n * Returns `true` if the phone number is \"valid\".\r\n * Is just a shortcut for `PhoneNumber.isValid()`.\r\n * @return {boolean}\r\n */\n\n }, {\n key: \"isValid\",\n value: function isValid() {\n var phoneNumber = this.getNumber();\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isValid();\n }\n /**\r\n * @deprecated\r\n * This method is used in `react-phone-number-input/source/input-control.js`\r\n * in versions before `3.0.16`.\r\n */\n\n }, {\n key: \"getNationalNumber\",\n value: function getNationalNumber() {\n return this.nationalNumberDigits;\n }\n }, {\n key: \"getNonFormattedTemplate\",\n value: function getNonFormattedTemplate() {\n return this.getFullNumber(this.getNonFormattedNationalNumber()).replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER);\n }\n /**\r\n * Returns formatted phone number template.\r\n * @return {string} [template]\r\n */\n\n }, {\n key: \"getTemplate\",\n value: function getTemplate() {\n if (!this.template) {\n return this.getNonFormattedTemplate();\n }\n\n var index = -1;\n var i = 0;\n\n while (i < (this.isInternational() ? this.getInternationalPrefix({\n spacing: false\n }).length : 0) + this.digits.length) {\n index = this.template.indexOf(DIGIT_PLACEHOLDER, index + 1);\n i++;\n }\n\n return cutAndStripNonPairedParens(this.template, index + 1);\n }\n }]);\n\n return AsYouType;\n}();\n\nexport { AsYouType as default };\nexport function stripNonPairedParens(string) {\n var dangling_braces = [];\n var i = 0;\n\n while (i < string.length) {\n if (string[i] === '(') {\n dangling_braces.push(i);\n } else if (string[i] === ')') {\n dangling_braces.pop();\n }\n\n i++;\n }\n\n var start = 0;\n var cleared_string = '';\n dangling_braces.push(string.length);\n\n for (var _i4 = 0, _dangling_braces = dangling_braces; _i4 < _dangling_braces.length; _i4++) {\n var index = _dangling_braces[_i4];\n cleared_string += string.slice(start, index);\n start = index + 1;\n }\n\n return cleared_string;\n}\nexport function cutAndStripNonPairedParens(string, cutBeforeIndex) {\n if (string[cutBeforeIndex] === ')') {\n cutBeforeIndex++;\n }\n\n return stripNonPairedParens(string.slice(0, cutBeforeIndex));\n}\nexport function closeNonPairedParens(template, cut_before) {\n var retained_template = template.slice(0, cut_before);\n var opening_braces = countOccurences('(', retained_template);\n var closing_braces = countOccurences(')', retained_template);\n var dangling_braces = opening_braces - closing_braces;\n\n while (dangling_braces > 0 && cut_before < template.length) {\n if (template[cut_before] === ')') {\n dangling_braces--;\n }\n\n cut_before++;\n }\n\n return template.slice(0, cut_before);\n} // Counts all occurences of a symbol in a string.\n// Unicode-unsafe (because using `.split()`).\n\nexport function countOccurences(symbol, string) {\n var count = 0; // Using `.split('')` to iterate through a string here\n // to avoid requiring `Symbol.iterator` polyfill.\n // `.split('')` is generally not safe for Unicode,\n // but in this particular case for counting brackets it is safe.\n // for (const character of string)\n\n for (var _iterator4 = string.split(''), _isArray4 = Array.isArray(_iterator4), _i5 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) {\n var _ref4;\n\n if (_isArray4) {\n if (_i5 >= _iterator4.length) break;\n _ref4 = _iterator4[_i5++];\n } else {\n _i5 = _iterator4.next();\n if (_i5.done) break;\n _ref4 = _i5.value;\n }\n\n var character = _ref4;\n\n if (character === symbol) {\n count++;\n }\n }\n\n return count;\n} // Repeats a string (or a symbol) N times.\n// http://stackoverflow.com/questions/202605/repeat-string-javascript\n\nexport function repeat(string, times) {\n if (times < 1) {\n return '';\n }\n\n var result = '';\n\n while (times > 1) {\n if (times & 1) {\n result += string;\n }\n\n times >>= 1;\n string += string;\n }\n\n return result + string;\n}\n/**\r\n * Extracts formatted phone number from text (if there's any).\r\n * @param {string} text\r\n * @return {string} [formattedPhoneNumber]\r\n */\n\nfunction extractFormattedPhoneNumber(text) {\n // Attempt to extract a possible number from the string passed in.\n var startsAt = text.search(VALID_PHONE_NUMBER);\n\n if (startsAt < 0) {\n return;\n } // Trim everything to the left of the phone number.\n\n\n text = text.slice(startsAt); // Trim the `+`.\n\n var hasPlus;\n\n if (text[0] === '+') {\n hasPlus = true;\n text = text.slice('+'.length);\n } // Trim everything to the right of the phone number.\n\n\n text = text.replace(AFTER_PHONE_NUMBER_DIGITS_END_PATTERN, ''); // Re-add the previously trimmed `+`.\n\n if (hasPlus) {\n text = '+' + text;\n }\n\n return text;\n}\n//# sourceMappingURL=AsYouType.js.map","import Metadata from './metadata';\nexport default function getCountries(metadata) {\n return new Metadata(metadata).getCountries();\n}\n//# sourceMappingURL=getCountries.js.map","import { getCountryCallingCode } from 'libphonenumber-js/core';\nexport function getInputValuePrefix(country, international, metadata) {\n return country && international ? \"+\".concat(getCountryCallingCode(country, metadata)) : '';\n}\nexport function removeInputValuePrefix(value, prefix) {\n if (prefix) {\n value = value.slice(prefix.length);\n\n if (value[0] === ' ') {\n value = value.slice(1);\n }\n }\n\n return value;\n}\n//# sourceMappingURL=inputValuePrefix.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport Input from 'input-format/react';\nimport { AsYouType, parsePhoneNumberCharacter } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './inputValuePrefix';\n/**\r\n * This input uses `input-format` library\r\n * for \"smart\" caret positioning.\r\n */\n\nexport function createInput(defaultMetadata) {\n function InputSmart(_ref, ref) {\n var country = _ref.country,\n international = _ref.international,\n metadata = _ref.metadata,\n rest = _objectWithoutProperties(_ref, [\"country\", \"international\", \"metadata\"]);\n\n var format = useCallback(function (value) {\n // \"As you type\" formatter.\n var formatter = new AsYouType(country, metadata);\n var prefix = getInputValuePrefix(country, international, metadata); // Format the number.\n\n var text = formatter.input(prefix + value);\n var template = formatter.getTemplate();\n\n if (prefix) {\n text = removeInputValuePrefix(text, prefix); // `AsYouType.getTemplate()` can be `undefined`.\n\n if (template) {\n template = removeInputValuePrefix(template, prefix);\n }\n }\n\n return {\n text: text,\n template: template\n };\n }, [country, metadata]);\n return React.createElement(Input, _extends({}, rest, {\n ref: ref,\n parse: parsePhoneNumberCharacter,\n format: format\n }));\n }\n\n InputSmart = React.forwardRef(InputSmart);\n InputSmart.propTypes = {\n /**\r\n * A two-letter country code for formatting `value`\r\n * as a national phone number (e.g. `(800) 555 35 35`).\r\n * E.g. \"US\", \"RU\", etc.\r\n * If no `country` is passed then `value`\r\n * is formatted as an international phone number.\r\n * (e.g. `+7 800 555 35 35`)\r\n * Perhaps the `country` property should have been called `defaultCountry`\r\n * because if `value` is an international number then `country` is ignored.\r\n */\n country: PropTypes.string,\n\n /**\r\n * If `country` property is passed along with `international={true}` property\r\n * then the phone number will be input in \"international\" format for that `country`\r\n * (without \"country calling code\").\r\n * For example, if `country=\"US\"` property is passed to \"without country select\" input\r\n * then the phone number will be input in the \"national\" format for `US` (`(213) 373-4253`).\r\n * But if both `country=\"US\"` and `international={true}` properties are passed then\r\n * the phone number will be input in the \"international\" format for `US` (`213 373 4253`)\r\n * (without \"country calling code\" `+1`).\r\n */\n international: PropTypes.bool,\n\n /**\r\n * `libphonenumber-js` metadata.\r\n */\n metadata: PropTypes.object.isRequired\n };\n InputSmart.defaultProps = {\n metadata: defaultMetadata\n };\n return InputSmart;\n}\nexport default createInput();\n//# sourceMappingURL=InputSmart.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport { parseIncompletePhoneNumber, formatIncompletePhoneNumber } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './inputValuePrefix';\nexport function createInput(defaultMetadata) {\n /**\r\n * `InputBasic`'s caret is not as \"smart\" as the default `inputComponent`'s\r\n * but still works good enough. When erasing or inserting digits in the middle\r\n * of a phone number the caret usually jumps to the end: this is the expected\r\n * behaviour and it's the workaround for the [Samsung Galaxy smart caret positioning bug](https://github.com/catamphetamine/react-phone-number-input/issues/75).\r\n */\n function InputBasic(_ref, ref) {\n var value = _ref.value,\n onChange = _ref.onChange,\n country = _ref.country,\n international = _ref.international,\n metadata = _ref.metadata,\n Input = _ref.inputComponent,\n rest = _objectWithoutProperties(_ref, [\"value\", \"onChange\", \"country\", \"international\", \"metadata\", \"inputComponent\"]);\n\n var prefix = getInputValuePrefix(country, international, metadata);\n\n var _onChange = useCallback(function (event) {\n var newValue = parseIncompletePhoneNumber(event.target.value); // By default, if a value is something like `\"(123)\"`\n // then Backspace would only erase the rightmost brace\n // becoming something like `\"(123\"`\n // which would give the same `\"123\"` value\n // which would then be formatted back to `\"(123)\"`\n // and so a user wouldn't be able to erase the phone number.\n // Working around this issue with this simple hack.\n\n if (newValue === value) {\n var newValueFormatted = format(prefix, newValue, country, metadata);\n\n if (newValueFormatted.indexOf(event.target.value) === 0) {\n // Trim the last digit (or plus sign).\n newValue = newValue.slice(0, -1);\n }\n }\n\n onChange(newValue);\n }, [prefix, value, onChange, country, metadata]);\n\n return React.createElement(Input, _extends({}, rest, {\n ref: ref,\n value: format(prefix, value, country, metadata),\n onChange: _onChange\n }));\n }\n\n InputBasic = React.forwardRef(InputBasic);\n InputBasic.propTypes = {\n /**\r\n * The parsed phone number.\r\n * \"Parsed\" not in a sense of \"E.164\"\r\n * but rather in a sense of \"having only\r\n * digits and possibly a leading plus character\".\r\n * Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n */\n value: PropTypes.string.isRequired,\n\n /**\r\n * Updates the `value`.\r\n */\n onChange: PropTypes.func.isRequired,\n\n /**\r\n * A two-letter country code for formatting `value`\r\n * as a national phone number (e.g. `(800) 555 35 35`).\r\n * E.g. \"US\", \"RU\", etc.\r\n * If no `country` is passed then `value`\r\n * is formatted as an international phone number.\r\n * (e.g. `+7 800 555 35 35`)\r\n * Perhaps the `country` property should have been called `defaultCountry`\r\n * because if `value` is an international number then `country` is ignored.\r\n */\n country: PropTypes.string,\n\n /**\r\n * If `country` property is passed along with `international={true}` property\r\n * then the phone number will be input in \"international\" format for that `country`\r\n * (without \"country calling code\").\r\n * For example, if `country=\"US\"` property is passed to \"without country select\" input\r\n * then the phone number will be input in the \"national\" format for `US` (`(213) 373-4253`).\r\n * But if both `country=\"US\"` and `international={true}` properties are passed then\r\n * the phone number will be input in the \"international\" format for `US` (`213 373 4253`)\r\n * (without \"country calling code\" `+1`).\r\n */\n international: PropTypes.bool,\n\n /**\r\n * `libphonenumber-js` metadata.\r\n */\n metadata: PropTypes.object.isRequired,\n\n /**\r\n * The `` component.\r\n */\n inputComponent: PropTypes.elementType.isRequired\n };\n InputBasic.defaultProps = {\n metadata: defaultMetadata,\n inputComponent: 'input'\n };\n return InputBasic;\n}\nexport default createInput();\n\nfunction format(prefix, value, country, metadata) {\n return removeInputValuePrefix(formatIncompletePhoneNumber(prefix + value, country, metadata), prefix);\n}\n//# sourceMappingURL=InputBasic.js.map","import AsYouType from './AsYouType';\n/**\r\n * Formats a (possibly incomplete) phone number.\r\n * The phone number can be either in E.164 format\r\n * or in a form of national number digits.\r\n * @param {string} value - A possibly incomplete phone number. Either in E.164 format or in a form of national number digits.\r\n * @param {string?} country - Two-letter (\"ISO 3166-1 alpha-2\") country code.\r\n * @return {string} Formatted (possibly incomplete) phone number.\r\n */\n\nexport default function formatIncompletePhoneNumber(value, country, metadata) {\n if (!metadata) {\n metadata = country;\n country = undefined;\n }\n\n return new AsYouType(country, metadata).input(value);\n}\n//# sourceMappingURL=formatIncompletePhoneNumber.js.map","function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nimport { parsePhoneNumberFromString } from 'libphonenumber-js/core';\n/**\r\n * Formats a phone number.\r\n * Is a proxy for `libphonenumber-js`'s `.format()` function of a parsed `PhoneNumber`.\r\n * @param {string} value\r\n * @param {string} [format]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\n\nexport default function formatPhoneNumber(value, format, metadata) {\n if (!metadata) {\n if (_typeof(format) === 'object') {\n metadata = format;\n format = 'NATIONAL';\n }\n }\n\n if (!value) {\n return '';\n }\n\n var phoneNumber = parsePhoneNumberFromString(value, metadata);\n\n if (!phoneNumber) {\n return '';\n } // Deprecated.\n // Legacy `format`s.\n\n\n switch (format) {\n case 'National':\n format = 'NATIONAL';\n break;\n\n case 'International':\n format = 'INTERNATIONAL';\n break;\n }\n\n return phoneNumber.format(format);\n}\nexport function formatPhoneNumberIntl(value, metadata) {\n return formatPhoneNumber(value, 'INTERNATIONAL', metadata);\n}\n//# sourceMappingURL=formatPhoneNumber.js.map","import { parsePhoneNumberFromString } from 'libphonenumber-js/core';\nexport default function isValidPhoneNumber(value, metadata) {\n if (!value) {\n return false;\n }\n\n var phoneNumber = parsePhoneNumberFromString(value, metadata);\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isValid();\n}\n//# sourceMappingURL=isValidPhoneNumber.js.map","import { parsePhoneNumberFromString } from 'libphonenumber-js/core';\nexport default function isPossiblePhoneNumber(value, metadata) {\n if (!value) {\n return false;\n }\n\n var phoneNumber = parsePhoneNumberFromString(value, metadata);\n\n if (!phoneNumber) {\n return false;\n }\n\n return phoneNumber.isPossible();\n}\n//# sourceMappingURL=isPossiblePhoneNumber.js.map","function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === \"[object Arguments]\")) { return; } var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nimport React, { useState, useCallback, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport { AsYouType, getCountryCallingCode, parseDigits } from 'libphonenumber-js/core';\nimport InputSmart from './InputSmart';\nimport InputBasic from './InputBasic';\nexport function createInput(defaultMetadata) {\n function PhoneInput(_ref, ref) {\n var country = _ref.country,\n defaultCountry = _ref.defaultCountry,\n useNationalFormatForDefaultCountryValue = _ref.useNationalFormatForDefaultCountryValue,\n value = _ref.value,\n onChange = _ref.onChange,\n metadata = _ref.metadata,\n smartCaret = _ref.smartCaret,\n international = _ref.international,\n rest = _objectWithoutProperties(_ref, [\"country\", \"defaultCountry\", \"useNationalFormatForDefaultCountryValue\", \"value\", \"onChange\", \"metadata\", \"smartCaret\", \"international\"]);\n\n var getInitialParsedInput = function getInitialParsedInput() {\n return getParsedInputForValue(value, country, international, defaultCountry, useNationalFormatForDefaultCountryValue, metadata);\n }; // This is only used to detect `country` property change.\n\n\n var _useState = useState(country),\n _useState2 = _slicedToArray(_useState, 2),\n prevCountry = _useState2[0],\n setPrevCountry = _useState2[1]; // This is only used to detect `defaultCountry` property change.\n\n\n var _useState3 = useState(defaultCountry),\n _useState4 = _slicedToArray(_useState3, 2),\n prevDefaultCountry = _useState4[0],\n setPrevDefaultCountry = _useState4[1]; // `parsedInput` is the `value` passed to the ``.\n\n\n var _useState5 = useState(getInitialParsedInput()),\n _useState6 = _slicedToArray(_useState5, 2),\n parsedInput = _useState6[0],\n setParsedInput = _useState6[1]; // This is only used to detect `value` property changes.\n\n\n var _useState7 = useState(value),\n _useState8 = _slicedToArray(_useState7, 2),\n valueForParsedInput = _useState8[0],\n setValueForParsedInput = _useState8[1]; // If `value` property has been changed externally\n // then re-initialize the component.\n\n\n useEffect(function () {\n if (value !== valueForParsedInput) {\n setValueForParsedInput(value);\n setParsedInput(getInitialParsedInput());\n }\n }, [value]); // If the `country` has been changed then re-initialize the component.\n\n useEffect(function () {\n if (country !== prevCountry) {\n setPrevCountry(country);\n setParsedInput(getInitialParsedInput());\n }\n }, [country]); // If the `defaultCountry` has been changed then re-initialize the component.\n\n useEffect(function () {\n if (defaultCountry !== prevDefaultCountry) {\n setPrevDefaultCountry(defaultCountry);\n setParsedInput(getInitialParsedInput());\n }\n }, [defaultCountry]); // Update the `value` after `valueForParsedInput` has been updated.\n\n useEffect(function () {\n if (valueForParsedInput !== value) {\n onChange(valueForParsedInput);\n }\n }, [valueForParsedInput]);\n var onParsedInputChange = useCallback(function (parsedInput) {\n var value;\n\n if (country) {\n // Won't allow `+` in the beginning\n // when a `country` has been specified.\n if (parsedInput && parsedInput[0] === '+') {\n parsedInput = parsedInput.slice(1);\n }\n } else if (!defaultCountry) {\n // Force a `+` in the beginning of a `value`\n // when no `country` and `defaultCountry` have been specified.\n if (parsedInput && parsedInput[0] !== '+') {\n parsedInput = '+' + parsedInput;\n }\n } // Convert `parsedInput` to `value`.\n\n\n if (parsedInput) {\n var asYouType = new AsYouType(country || defaultCountry, metadata);\n asYouType.input(country && international ? \"+\".concat(getCountryCallingCode(country, metadata)).concat(parsedInput) : parsedInput);\n var phoneNumber = asYouType.getNumber(); // If it's a \"possible\" incomplete phone number.\n\n if (phoneNumber) {\n value = phoneNumber.number;\n }\n }\n\n setParsedInput(parsedInput);\n setValueForParsedInput(value);\n }, [country, international, defaultCountry, metadata, setParsedInput, setValueForParsedInput]);\n var InputComponent = smartCaret ? InputSmart : InputBasic;\n return React.createElement(InputComponent, _extends({}, rest, {\n ref: ref,\n metadata: metadata,\n international: international,\n country: country || defaultCountry,\n value: parsedInput,\n onChange: onParsedInputChange\n }));\n }\n\n PhoneInput = React.forwardRef(PhoneInput);\n PhoneInput.propTypes = {\n /**\r\n * HTML `` `type` attribute.\r\n */\n type: PropTypes.string,\n\n /**\r\n * HTML `` `autocomplete` attribute.\r\n */\n autoComplete: PropTypes.string,\n\n /**\r\n * The phone number (in E.164 format).\r\n * Examples: `undefined`, `\"+12\"`, `\"+12133734253\"`.\r\n */\n value: PropTypes.string,\n\n /**\r\n * Updates the `value`.\r\n */\n onChange: PropTypes.func.isRequired,\n\n /**\r\n * A two-letter country code for formatting `value`\r\n * as a national phone number (example: `(213) 373-4253`),\r\n * or as an international phone number without \"country calling code\"\r\n * if `international` property is passed (example: `213 373 4253`).\r\n * Example: \"US\".\r\n * If no `country` is passed then `value`\r\n * is formatted as an international phone number.\r\n * (example: `+1 213 373 4253`)\r\n */\n country: PropTypes.string,\n\n /**\r\n * A two-letter country code for formatting `value`\r\n * when a user inputs a national phone number (example: `(213) 373-4253`).\r\n * The user can still input a phone number in international format.\r\n * Example: \"US\".\r\n * `country` and `defaultCountry` properties are mutually exclusive.\r\n */\n defaultCountry: PropTypes.string,\n\n /**\r\n * If `country` property is passed along with `international={true}` property\r\n * then the phone number will be input in \"international\" format for that `country`\r\n * (without \"country calling code\").\r\n * For example, if `country=\"US\"` property is passed to \"without country select\" input\r\n * then the phone number will be input in the \"national\" format for `US` (`(213) 373-4253`).\r\n * But if both `country=\"US\"` and `international={true}` properties are passed then\r\n * the phone number will be input in the \"international\" format for `US` (`213 373 4253`)\r\n * (without \"country calling code\" `+1`).\r\n */\n international: PropTypes.bool,\n\n /**\r\n * The `` component.\r\n */\n inputComponent: PropTypes.elementType,\n\n /**\r\n * By default, the caret position is being \"intelligently\" managed\r\n * while a user inputs a phone number.\r\n * This \"smart\" caret behavior can be turned off\r\n * by passing `smartCaret={false}` property.\r\n * This is just an \"escape hatch\" for any possible caret position issues.\r\n */\n // Is `true` by default.\n smartCaret: PropTypes.bool.isRequired,\n\n /**\r\n * When `defaultCountry` is defined and the initial `value` corresponds to `defaultCountry`,\r\n * then the `value` will be formatted as a national phone number by default.\r\n * To format the initial `value` of `defaultCountry` as an international number instead\r\n * set `useNationalFormatForDefaultCountryValue` property to `true`.\r\n */\n useNationalFormatForDefaultCountryValue: PropTypes.bool.isRequired,\n\n /**\r\n * `libphonenumber-js` metadata.\r\n */\n metadata: PropTypes.object.isRequired\n };\n PhoneInput.defaultProps = {\n /**\r\n * HTML `` `type=\"tel\"`.\r\n */\n type: 'tel',\n\n /**\r\n * Remember (and autofill) the value as a phone number.\r\n */\n autoComplete: 'tel',\n\n /**\r\n * Set to `false` to use \"basic\" caret instead of the \"smart\" one.\r\n */\n smartCaret: true,\n\n /**\r\n * Set to `true` to force international phone number format\r\n * (without \"country calling code\") when `country` is specified.\r\n */\n // international: false,\n\n /**\r\n * Prefer national format when formatting E.164 phone number `value`\r\n * corresponding to `defaultCountry`.\r\n */\n useNationalFormatForDefaultCountryValue: true,\n\n /**\r\n * `libphonenumber-js` metadata.\r\n */\n metadata: defaultMetadata\n };\n return PhoneInput;\n}\nexport default createInput();\n/**\r\n * Returns phone number input field value for a E.164 phone number `value`.\r\n * @param {string} [value]\r\n * @param {string} [country]\r\n * @param {boolean} [international]\r\n * @param {string} [defaultCountry]\r\n * @param {boolean} [useNationalFormatForDefaultCountryValue]\r\n * @param {object} metadata\r\n * @return {string}\r\n */\n\nfunction getParsedInputForValue(value, country, international, defaultCountry, useNationalFormatForDefaultCountryValue, metadata) {\n if (!value) {\n return '';\n }\n\n if (!country && !defaultCountry) {\n return value;\n }\n\n var asYouType = new AsYouType(undefined, metadata);\n asYouType.input(value);\n var phoneNumber = asYouType.getNumber();\n\n if (phoneNumber) {\n if (country) {\n if (phoneNumber.country && phoneNumber.country !== country) {\n console.error(\"[react-phone-number-input] Phone number \".concat(value, \" corresponds to country \").concat(phoneNumber.country, \" but \").concat(country, \" was specified instead.\"));\n }\n\n if (international) {\n return phoneNumber.nationalNumber;\n }\n\n return parseDigits(phoneNumber.formatNational());\n } else {\n if (phoneNumber.country && phoneNumber.country === defaultCountry && useNationalFormatForDefaultCountryValue) {\n return parseDigits(phoneNumber.formatNational());\n }\n\n return value;\n }\n } else {\n return '';\n }\n}\n//# sourceMappingURL=PhoneInput.js.map","import metadata from 'libphonenumber-js/metadata.min.json'\r\n\r\nimport {\r\n\tparsePhoneNumber as _parsePhoneNumber,\r\n\tformatPhoneNumber as _formatPhoneNumber,\r\n\tformatPhoneNumberIntl as _formatPhoneNumberIntl,\r\n\tisValidPhoneNumber as _isValidPhoneNumber,\r\n\tisPossiblePhoneNumber as _isPossiblePhoneNumber,\r\n\tgetCountries as _getCountries,\r\n\tgetCountryCallingCode as _getCountryCallingCode\r\n} from '../core/index'\r\n\r\nimport { createInput } from '../modules/PhoneInput'\r\n\r\nfunction call(func, _arguments) {\r\n\tvar args = Array.prototype.slice.call(_arguments)\r\n\targs.push(metadata)\r\n\treturn func.apply(this, args)\r\n}\r\n\r\nexport default createInput(metadata)\r\n\r\nexport function parsePhoneNumber() {\r\n\treturn call(_parsePhoneNumber, arguments)\r\n}\r\n\r\nexport function formatPhoneNumber() {\r\n\treturn call(_formatPhoneNumber, arguments)\r\n}\r\n\r\nexport function formatPhoneNumberIntl() {\r\n\treturn call(_formatPhoneNumberIntl, arguments)\r\n}\r\n\r\nexport function isValidPhoneNumber() {\r\n\treturn call(_isValidPhoneNumber, arguments)\r\n}\r\n\r\nexport function isPossiblePhoneNumber() {\r\n\treturn call(_isPossiblePhoneNumber, arguments)\r\n}\r\n\r\nexport function getCountries() {\r\n\treturn call(_getCountries, arguments)\r\n}\r\n\r\nexport function getCountryCallingCode() {\r\n\treturn call(_getCountryCallingCode, arguments)\r\n}"],"names":["count_occurences","symbol","string","count","_iterator","split","_isArray","Array","isArray","_i","Symbol","iterator","_ref","length","next","done","value","template","placeholder","arguments","undefined","should_close_braces","text","characters_in_template","value_character_index","filled_in_template","character","retained_template","empty_placeholder","cut_before","dangling_braces","replace","close_braces","getSelection","element","selectionStart","selectionEnd","start","end","Keys","Backspace","Delete","setCaretPosition","caret_position","navigator","ANDROID_USER_AGENT_REG_EXP","test","userAgent","isAndroid","setSelectionRange","setTimeout","onKeyDown","event","input","_parse","_format","on_change","operation","keyCode","getOperation","preventDefault","selection","erase_selection","format_input_text","slice","_parse2","parse_character","focused_input_character_index","index","caret","parse","operation_applied","edit","formatted","formatter","template_formatter","found","possibly_last_input_character_index","format","_extends","Object","assign","target","i","source","key","prototype","hasOwnProperty","call","apply","this","_objectWithoutProperties","excluded","sourceKeys","keys","indexOf","_objectWithoutPropertiesLoose","getOwnPropertySymbols","sourceSymbolKeys","propertyIsEnumerable","Input","ref","InputComponent","inputComponent","onChange","onCut","onPaste","rest","ownRef","useRef","_onChange","useCallback","current","_onPaste","_onCut","_onKeyDown","onInputKeyDown","React","createElement","isEmptyValue","forwardRef","propTypes","PropTypes","func","isRequired","elementType","type","defaultProps","ParseError","code","instance","Constructor","TypeError","_classCallCheck","name","constructor","message","stack","Error","create","MIN_LENGTH_FOR_NSN","MAX_LENGTH_FOR_NSN","MAX_LENGTH_COUNTRY_CODE","VALID_DIGITS","VALID_PUNCTUATION","concat","matchesEntirely","regular_expression","RegExp","a","b","pa","pb","na","Number","nb","isNaN","_typeof","obj","_defineProperties","props","descriptor","enumerable","configurable","writable","defineProperty","_createClass","protoProps","staticProps","V3","V4","Metadata","metadata","is_object","countries","join","type_of","validateMetadata","setVersion","filter","_","countryCode","v1","v2","v3","nonGeographic","nonGeographical","country","getCountryMetadata","callingCode","getCountryCodesForCallingCode","countryCodes","countryCallingCodes","selectNumberingPlan","hasCountry","numberingPlan","NumberingPlan","hasCallingCode","getNumberingPlanMetadata","getCountryCodeForCallingCode","IDDPrefix","defaultIDDPrefix","nationalNumberPattern","possibleLengths","formats","nationalPrefixForParsing","nationalPrefixTransformRule","leadingDigits","hasTypes","_type","ext","country_phone_code_to_countries","country_calling_codes","globalMetadataObject","_this","_getFormats","getDefaultCountryMetadataForRegion","map","Format","_getNationalPrefixFormattingRule","_nationalPrefixForParsing","nationalPrefix","_getNationalPrefixIsOptionalWhenFormatting","types","_type2","getType","Type","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormattingInNationalFormat","usesNationalPrefix","FIRST_GROUP_ONLY_PREFIX_PATTERN","getCountryCallingCode","countryCallingCode","version","compare","v4","RFC3966_EXTN_PREFIX","CAPTURING_EXTN_DIGITS","create_extension_pattern","purpose","single_extension_characters","EXTN_PATTERNS_FOR_PARSING","EXTN_PATTERN","VALID_PHONE_NUMBER_PATTERN","isViablePhoneNumber","number","DIGITS","0","1","2","3","4","5","6","7","8","9","0","1","2","3","4","5","6","7","8","9","٠","١","٢","٣","٤","٥","٦","٧","٨","٩","۰","۱","۲","۳","۴","۵","۶","۷","۸","۹","parseDigit","parseDigits","result","digit","parseIncompletePhoneNumber","parsePhoneNumberCharacter","NON_FIXED_LINE_PHONE_TYPES","getNumberType","options","nationalNumber","phone","is_of_type","pattern","_NON_FIXED_LINE_PHONE","checkNumberLengthForType","type_info","possible_lengths","mobile_type","merged","push","sort","mergeArrays","actual_length","minimum_length","isPossibleNumber","isInternational","CAPTURING_DIGIT_PATTERN","SINGLE_IDD_PREFIX","stripIDDPrefix","countryMetadata","IDDPrefixPattern","search","matchedGroups","match","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","err","_iterableToArrayLimit","_nonIterableRest","_defineProperty","DEFAULT_OPTIONS","formatExtension","formattedNumber","extension","formatNumber","ownKeys","sym","getOwnPropertyDescriptor","forEach","_objectSpread","chooseCountryByCountryCallingCode","addExtension","formatNationalNumber","_ref2","formatRFC3966","fromCountry","getIDDPrefix","humanReadable","formattedForSameCountryCallingCode","toCountryCallingCode","toCountryMetadata","fromCountryMetadata","formatIDDSameCountryCallingCodeNumber","FIRST_GROUP_PATTERN","formatNationalNumberUsingFormat","useInternationalSeparator","useNationalPrefixFormattingRule","internationalFormat","applyInternationalSeparatorStyle","formatAs","availableFormats","nationalNnumber","leadingDigitsPatterns","lastLeadingDigitsPattern","chooseFormatForNumber","local","trim","PhoneNumber","_metadata","isCountryCode","isNonGeographicCallingCode","isValidNumber","phoneNumber","MAX_INPUT_STRING_LENGTH","PHONE_NUMBER_START_PATTERN","AFTER_PHONE_NUMBER_END_PATTERN","defaultCountry","_parseInput","_part$split2","parseRFC3966","throwOnError","startsAt","extractFormattedPhoneNumber","withExtensionStripped","number_without_extension","matches","extractExtension","parseInput","formattedPhoneNumber","_parsePhoneNumber","defaultCallingCode","_extractCountryCallin","extractCountryCallingCode","_stripNationalPrefixA","stripNationalPrefixAndCarrierCodeFromCompleteNumber","carrierCode","exactCountry","findCountryCode","parsePhoneNumber","hasSelectedNumberingPlan","valid","extended","possible","stripNationalPrefixAndCarrierCode","prefixPattern","prefixMatch","exec","capturedGroupsCount","nationalPhoneNumber","possibleCountries","_findCountryCode","_stripNationalPrefixA2","numberWithoutIDD","_extractCountryCallin2","extractCountryCallingCodeFromInternationalNumberWithoutPlusSign","shorterNumber","_countryCallingCode","possibleShorterNumber","possibleShorterNationalNumber","parseNumber","normalizeArguments","args","_Array$prototype$slic2","arg_1","arg_2","arg_3","arg_4","isObject","parsePhoneNumberFromString","isSupportedCountry","error","_normalizeArguments","parsePhoneNumberFromString_","LONGEST_DUMMY_PHONE_NUMBER","repeat","DIGIT_PLACEHOLDER_MATCHER","NATIONAL_PREFIX_SEPARATORS_PATTERN","ELIGIBLE_FORMAT_PATTERN","VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN","VALID_PHONE_NUMBER","AFTER_PHONE_NUMBER_DIGITS_END_PATTERN","AsYouType","optionsOrDefaultCountry","reset","formattedOutput","international","internationalPrefix","digits","nationalNumberDigits","setCountry","chosenFormat","populatedNationalNumberTemplate","populatedNationalNumberTemplatePosition","initializePhoneNumberFormatsForCountry","matchingFormats","resetFormat","formattedDigits","extractFormattedDigits","getFullNumber","inputDigits","getNonFormattedNationalNumber","extractedNumber","hasPlus","startInternationalNumber","nextDigits","isCountryCallingCodeAmbiguous","determineTheCountry","previousNationalPrefix","extractNationalPrefix","matchFormats","formatNationalNumberWithNextDigits","attemptToFormatCompletePhoneNumber","previouslyChosenFormat","newlyChosenFormat","chooseFormat","formatNextNationalNumberDigits","reformatNationalNumber","createFormattingTemplate","leadingDigitsPatternIndex","nationalPrefixIsMandatoryWhenFormattingInNationalFormat","leadingDigitsPatternsCount","Math","min","leadingDigitsPattern","_iterator2","_isArray2","_i2","formattedNationalNumber","formattedNationalNumberWithNationalPrefix","getSeparatorAfterNationalPrefix","spacing","prefix","getInternationalPrefix","_extractCountryCallingCode","getTemplateForNumberFormatPattern","strictPattern","nationalNumberDummyDigits","includesNationalPrefix","numberFormat","getFormatFormat","numberFormatWithNationalPrefix","_iterator3","_isArray3","_i3","_ref3","cutAndStripNonPairedParens","getCountry","getNumber","isPossible","isValid","getNonFormattedTemplate","cutBeforeIndex","pop","cleared_string","_i4","_dangling_braces","stripNonPairedParens","times","getCountries","getInputValuePrefix","removeInputValuePrefix","defaultMetadata","InputSmart","getTemplate","bool","object","createInput","InputBasic","newValue","formatIncompletePhoneNumber","formatPhoneNumber","formatPhoneNumberIntl","isValidPhoneNumber","isPossiblePhoneNumber","toString","PhoneInput","useNationalFormatForDefaultCountryValue","smartCaret","getInitialParsedInput","asYouType","console","formatNational","getParsedInputForValue","_useState2","useState","prevCountry","setPrevCountry","_useState4","prevDefaultCountry","setPrevDefaultCountry","_useState6","parsedInput","setParsedInput","_useState8","valueForParsedInput","setValueForParsedInput","useEffect","onParsedInputChange","autoComplete","_arguments","_formatPhoneNumber","_formatPhoneNumberIntl","_getCountries","_getCountryCallingCode","_isPossiblePhoneNumber","_isValidPhoneNumber"],"mappings":"m+5EACO,SAASA,EAAiBC,EAAQC,GACvC,IAAIC,EAAQ,EAQHC,EAAYF,EAAOG,MAAM,IAAKC,EAAWC,MAAMC,QAAQJ,GAAYK,EAAK,EAAjF,IAAoFL,EAAYE,EAAWF,EAAYA,EAAUM,OAAOC,cAAe,CACrJ,IAAIC,EAEJ,GAAIN,EAAU,CACZ,GAAIG,GAAML,EAAUS,OAAQ,MAC5BD,EAAOR,EAAUK,SACZ,CAEL,IADAA,EAAKL,EAAUU,QACRC,KAAM,MACbH,EAAOH,EAAGO,MAGIJ,IAEEX,GAChBE,IAIJ,OAAOA,ECfM,WAAUc,GACvB,IAAIC,EAAcC,UAAUN,OAAS,QAAsBO,IAAjBD,UAAU,GAAmBA,UAAU,GAAK,IAClFE,EAAsBF,UAAUN,OAAS,EAAIM,UAAU,QAAKC,EAEhE,IAAKH,EACH,OAAO,SAAUD,GACf,MAAO,CACLM,KAAMN,IAKZ,IAAIO,EAAyBvB,EAAiBkB,EAAaD,GAC3D,OAAO,SAAUD,GACf,IAAKA,EACH,MAAO,CACLM,KAAM,GACNL,SAAUA,GAId,IAAIO,EAAwB,EACxBC,EAAqB,GAOhBrB,EAAYa,EAASZ,MAAM,IAAKC,EAAWC,MAAMC,QAAQJ,GAAYK,EAAK,EAAnF,IAAsFL,EAAYE,EAAWF,EAAYA,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