{"version":3,"sources":["webpack:///./node_modules/libphonenumber-js/es6/constants.js","webpack:///./node_modules/libphonenumber-js/es6/ParseError.js","webpack:///./node_modules/libphonenumber-js/es6/tools/semver-compare.js","webpack:///./node_modules/libphonenumber-js/es6/metadata.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/extension/createExtensionPattern.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/isViablePhoneNumber.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/extension/extractExtension.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/parseDigits.js","webpack:///./node_modules/libphonenumber-js/es6/parseIncompletePhoneNumber.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/checkNumberLength.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/mergeArrays.js","webpack:///./node_modules/libphonenumber-js/es6/isPossibleNumber_.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/RFC3966.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/matchesEntirely.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/getNumberType.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/applyInternationalSeparatorStyle.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/formatNationalNumberUsingFormat.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/getIddPrefix.js","webpack:///./node_modules/libphonenumber-js/es6/format_.js","webpack:///./node_modules/libphonenumber-js/es6/PhoneNumber.js","webpack:///./node_modules/libphonenumber-js/es6/validate_.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js","webpack:///./node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js","webpack:///./node_modules/libphonenumber-js/es6/parse_.js","webpack:///./node_modules/libphonenumber-js/es6/parsePhoneNumber_.js","webpack:///./node_modules/libphonenumber-js/es6/parsePhoneNumber.js","webpack:///./node_modules/libphonenumber-js/es6/parsePhoneNumberFromString_.js","webpack:///./node_modules/libphonenumber-js/es6/parsePhoneNumberFromString.js","webpack:///./node_modules/libphonenumber-js/es6/getCountries.js","webpack:///./node_modules/input-format/modules/helpers.js","webpack:///./node_modules/input-format/modules/closeBraces.js","webpack:///./node_modules/input-format/modules/format.js","webpack:///./node_modules/input-format/modules/templateFormatter.js","webpack:///./node_modules/input-format/modules/dom.js","webpack:///./node_modules/input-format/modules/inputControl.js","webpack:///./node_modules/input-format/modules/parse.js","webpack:///./node_modules/input-format/modules/edit.js","webpack:///./node_modules/input-format/modules/react/Input.js","webpack:///./node_modules/libphonenumber-js/es6/AsYouTypeState.js","webpack:///./node_modules/libphonenumber-js/es6/AsYouTypeFormatter.util.js","webpack:///./node_modules/libphonenumber-js/es6/AsYouTypeFormatter.complete.js","webpack:///./node_modules/libphonenumber-js/es6/AsYouTypeFormatter.js","webpack:///./node_modules/libphonenumber-js/es6/AsYouTypeParser.js","webpack:///./node_modules/libphonenumber-js/es6/AsYouType.js","webpack:///./node_modules/react-phone-number-input/modules/helpers/inputValuePrefix.js","webpack:///./node_modules/react-phone-number-input/modules/InputSmart.js","webpack:///./node_modules/react-phone-number-input/modules/InputBasic.js","webpack:///./node_modules/libphonenumber-js/es6/formatIncompletePhoneNumber.js","webpack:///./node_modules/react-phone-number-input/modules/Flag.js","webpack:///./node_modules/react-phone-number-input/modules/InternationalIcon.js","webpack:///./node_modules/react-phone-number-input/modules/helpers/countries.js","webpack:///./node_modules/react-phone-number-input/modules/CountryIcon.js","webpack:///./node_modules/react-phone-number-input/modules/helpers/getInternationalPhoneNumberPrefix.js","webpack:///./node_modules/react-phone-number-input/modules/helpers/phoneInputHelpers.js","webpack:///./node_modules/react-phone-number-input/modules/helpers/getPhoneInputWithCountryStateUpdateFromNewProps.js","webpack:///./node_modules/react-phone-number-input/modules/PhoneInputWithCountry.js","webpack:///./node_modules/country-flag-icons/modules/unicode.js","webpack:///./node_modules/react-phone-number-input/modules/CountrySelect.js","webpack:///./node_modules/react-phone-number-input/modules/PhoneInputWithCountryDefault.js","webpack:///./node_modules/react-phone-number-input/min/index.js","webpack:///./src/pages/index.tsx","webpack:///./src/images/group-8@3x.png","webpack:///./src/pages/step-1.module.less"],"names":["VALID_PUNCTUATION","concat","ParseError","code","instance","Constructor","TypeError","_classCallCheck","this","name","constructor","message","stack","Error","prototype","Object","create","a","split","b","pa","pb","i","na","Number","nb","isNaN","_typeof","obj","Symbol","iterator","_defineProperties","target","props","length","descriptor","enumerable","configurable","writable","defineProperty","key","_createClass","protoProps","staticProps","CALLING_CODE_REG_EXP","Metadata","metadata","is_object","countries","keys","join","type_of","validateMetadata","setVersion","call","value","filter","_","countryCode","v1","v2","v3","nonGeographic","nonGeographical","country","undefined","getCountryMetadata","callingCode","getCountryCodesForCallingCode","countryCodes","countryCallingCodes","selectNumberingPlan","test","hasCountry","numberingPlan","NumberingPlan","hasCallingCode","getNumberingPlanMetadata","getCountryCodeForCallingCode","IDDPrefix","defaultIDDPrefix","nationalNumberPattern","possibleLengths","formats","nationalPrefixForParsing","nationalPrefixTransformRule","leadingDigits","hasTypes","_type","type","ext","country_phone_code_to_countries","country_calling_codes","globalMetadataObject","_this","_getFormats","getDefaultCountryMetadataForRegion","map","Format","_getNationalPrefixFormattingRule","_nationalPrefixForParsing","nationalPrefix","_getNationalPrefixIsOptionalWhenFormatting","types","_type2","Type","format","_format","nationalPrefixFormattingRule","nationalPrefixIsOptionalWhenFormattingInNationalFormat","usesNationalPrefix","FIRST_GROUP_ONLY_PREFIX_PATTERN","getCountryCallingCode","countryCallingCode","isSupportedCountry","version","v4","maxLength","createExtensionPattern","purpose","possibleSeparatorsBetweenNumberAndExtLabel","possibleSeparatorsNumberExtLabelNoComma","VALID_PHONE_NUMBER_WITH_EXTENSION","VALID_PHONE_NUMBER_PATTERN","RegExp","isViablePhoneNumber","number","EXTN_PATTERN","DIGITS","parseDigit","character","parseDigits","string","result","_iterator","_isArray","Array","isArray","_i","_ref","next","done","digit","parseIncompletePhoneNumber","parsePhoneNumberCharacter","prevParsedCharacters","checkNumberLength","nationalNumber","checkNumberLengthForType","type_info","possible_lengths","mobile_type","merged","slice","element","indexOf","push","sort","mergeArrays","actual_length","minimum_length","isPossibleNumber","_slicedToArray","arr","_arrayWithHoles","_arr","_n","_d","_e","_s","err","_iterableToArrayLimit","_nonIterableRest","matchesEntirely","text","regular_expression","NON_FIXED_LINE_PHONE_TYPES","getNumberType","input","options","phone","isNumberTypeEqualTo","pattern","_NON_FIXED_LINE_PHONE","applyInternationalSeparatorStyle","formattedNumber","replace","trim","FIRST_GROUP_PATTERN","formatNationalNumberUsingFormat","useInternationalFormat","withNationalPrefix","carrierCode","internationalFormat","SINGLE_IDD_PREFIX_REG_EXP","_defineProperty","DEFAULT_OPTIONS","formatExtension","extension","formatNumber","arguments","source","ownKeys","getOwnPropertySymbols","sym","getOwnPropertyDescriptor","forEach","_objectSpread","addExtension","formatNationalNumber","_ref2","formatRFC3966","fromCountry","iddPrefix","countryMetadata","getIddPrefix","formatIDD","formatAs","availableFormats","nationalNnumber","leadingDigitsPatterns","lastLeadingDigitsPattern","search","chooseFormatForNumber","PhoneNumber","_metadata","isCountryCode","isNonGeographicCallingCode","phoneNumber","CAPTURING_DIGIT_PATTERN","stripIddPrefix","IDDPrefixPattern","matchedGroups","match","extractNationalNumberFromPossiblyIncompleteNumber","prefixPattern","prefixMatch","exec","capturedGroupsCount","hasCapturedGroups","prefixBeforeNationalNumber","possiblePositionOfTheFirstCapturedGroup","extractNationalNumber","_extractNationalNumbe","nationalSignificantNumber","shouldExtractNationalPrefix","extractCountryCallingCodeFromInternationalNumberWithoutPlusSign","possibleShorterNumber","possibleShorterNationalNumber","numberWithoutIDD","_extractCountryCallin","shorterNumber","_countryCallingCode","getCountryByCallingCode","nationalPhoneNumber","possibleCountries","selectCountryFromList","PHONE_NUMBER_START_PATTERN","AFTER_PHONE_NUMBER_END_PATTERN","defaultCountry","_parseInput","_part$split2","parseRFC3966","throwOnError","startsAt","extractFormattedPhoneNumber","withExtensionStripped","start","numberWithoutExtension","matches","extractExtension","parseInput","formattedPhoneNumber","_parsePhoneNumber","defaultCallingCode","exactCountry","parsePhoneNumber","hasSelectedNumberingPlan","valid","extended","possible","normalizeArguments","args","_Array$prototype$slic2","arg_1","arg_2","arg_3","arg_4","isObject","parsePhoneNumberFromString","error","_normalizeArguments","getCountries","count_occurences","symbol","count","closeBraces","retained_template","template","placeholder","empty_placeholder","cut_before","opening_braces","closing_braces","dangling_braces","caret","formatter","should_close_braces","characters_in_template","value_character_index","filled_in_template","index","found","possibly_last_input_character_index","getSelection","selectionStart","selectionEnd","end","Keys","setCaretPosition","caret_position","navigator","ANDROID_USER_AGENT_REG_EXP","userAgent","isAndroid","setSelectionRange","setTimeout","event","_parse","on_change","operation","keyCode","getOperation","preventDefault","selection","eraseSelection","formatInputText","_parse2","parse_character","focused_input_character_index","newValueAndCaret","edit","formatted","_extends","assign","hasOwnProperty","apply","_objectWithoutProperties","excluded","sourceKeys","_objectWithoutPropertiesLoose","sourceSymbolKeys","propertyIsEnumerable","ref","parse","InputComponent","inputComponent","onChange","onKeyDown","rest","ownRef","_onChange","current","_onKeyDown","createElement","isEmptyValue","forwardRef","defaultProps","AsYouTypeState","onCountryChange","onCallingCodeChange","properties","_Object$keys","international","missingPlus","digits","resetNationalSignificantNumber","initCountryAndCallingCode","getNationalDigits","nationalSignificantNumberMatchesInput","complexPrefixBeforeNationalSignificantNumber","setCountry","setCallingCode","nextDigits","DIGIT_PLACEHOLDER_MATCHER","repeat","times","cutAndStripNonPairedParens","cutBeforeIndex","pop","cleared_string","_i2","_dangling_braces","stripNonPairedParens","formatCompleteNumber","state","shouldTryNationalPrefixFormattingRule","getSeparatorAfterNationalPrefix","useNationalPrefixFormattingRule","formatNationalNumberWithAndWithoutNationalPrefixFormattingRule","_ref3","formattedNationalNumber","isValidFormattedNationalNumber","LONGEST_DUMMY_PHONE_NUMBER","NATIONAL_PREFIX_SEPARATORS_PATTERN","CREATE_CHARACTER_CLASS_PATTERN","CREATE_STANDALONE_DIGIT_PATTERN","NON_ALTERING_FORMAT_REG_EXP","AsYouTypeFormatter","isNANP","resetFormat","chosenFormat","nationalNumberTemplate","populatedNationalNumberTemplate","populatedNationalNumberTemplatePosition","matchingFormats","narrowDownMatchingFormats","_this2","formattedCompleteNumber","setNationalNumberTemplate","lastIndexOf","formatNationalNumberWithNextDigits","previouslyChosenFormat","newlyChosenFormat","chooseFormat","formatNextNationalNumberDigits","_ref4","_this3","leadingDigitsPatternIndex","formatSuits","formatMatches","nationalPrefixIsMandatoryWhenFormattingInNationalFormat","leadingDigitsPatternsCount","Math","min","leadingDigitsPattern","_this4","_loop2","_isArray2","_iterator2","_ref5","getFormatFormat","createTemplateForFormat","_loop","getTemplateForFormat","_ref6","spacing","internationalPrefix","getInternationalPrefixBeforeCountryCallingCode","getDigitsWithoutInternationalPrefix","_ref7","strictPattern","nationalNumberDummyDigits","nationalPrefixIncludedInTemplate","numberFormat","numberFormatWithNationalPrefix","position","_i3","populateTemplateWithDigits","VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN","AFTER_PHONE_NUMBER_DIGITS_END_PATTERN","COMPLEX_NATIONAL_PREFIX","AsYouTypeParser","onNationalSignificantNumberChange","justLeadingPlus","_extractFormattedDigi","_extractFormattedDigi4","extractedNumber","hasPlus","_extractFormattedDigitsAndPlus","formattedDigits","extractFormattedDigitsAndPlus","_extractFormattedDigi2","startInternationalNumber","inputDigits","hasReceivedThreeLeadingDigits","appendDigits","extractIddPrefix","isWaitingForCountryCallingCode","extractCountryCallingCode","appendNationalSignificantNumberDigits","hasExtractedNationalSignificantNumber","extractNationalSignificantNumber","update","couldPossiblyExtractAnotherNationalSignificantNumber","nationalDigits","setState","onExtractedNationalNumber","prevNationalSignificantNumber","_extractNationalNumbe2","nationalSignificantNumberIndex","extractAnotherNationalSignificantNumber","fixMissingPlus","extractCallingCodeAndNationalSignificantNumber","_extractCountryCallin2","newCallingCode","AsYouType","optionsOrDefaultCountry","_this$getCountryAndCa2","getCountryAndCallingCode","reset","_this$parser$input","parser","formattedOutput","determineTheCountryIfNeeded","reExtractNationalSignificantNumber","getFullNumber","getNonFormattedNumber","getCallingCode","_this$state","isCountryCallingCodeAmbiguous","determineTheCountry","isInternational","prefix","_this$state2","getNonFormattedNationalNumberWithPrefix","_this$state3","getCountry","getNumber","isPossible","isValid","getTemplate","getNonFormattedTemplate","getInputValuePrefix","withCountryCallingCode","removeInputValuePrefix","defaultMetadata","InputSmart","InputBasic","Input","newValue","formatIncompletePhoneNumber","countryName","flags","flagUrl","title","alt","role","src","toLowerCase","aspectRatio","InternationalIcon1x1","InternationalIcon3x2","xmlns","viewBox","className","stroke","fill","strokeWidth","strokeMiterlimit","strokeLinecap","d","x1","y1","x2","y2","isCountrySupportedWithError","console","getSupportedCountries","createCountryIconComponent","FlagComponent","flagComponent","InternationalIcon","internationalIcon","label","_aspectRatio","ONLY_DIGITS_REGEXP","getInternationalPhoneNumberPrefix","getPreSelectedCountry","required","getPhoneDigitsForNewCountry","phoneDigits","prevCountry","newCountry","useNationalFormat","countryCallingCodePrefix","country_calling_code","stripCountryCallingCode","newCountryPrefix","defaultValue","e164","partial_national_significant_number","getNationalSignificantNumberDigits","trimNumber","nationalSignificantNumberPart","overflowDigitsCount","getMaxNumberLength","getCountryForPartialE164Number","partialE164Number","derived_country","getCountryFromPossiblyIncompleteInternationalPhoneNumber","intlPhoneNumberPrefix","couldNumberBelongToCountry","convertInternationalPhoneDigitsToNational","formatNational","compareStrings","locales","String","localeCompare","getInitialPhoneDigits","generateNationalNumberDigits","object","enumerableOnly","symbols","getOwnPropertyDescriptors","defineProperties","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","_assertThisInitialized","self","ReferenceError","_setPrototypeOf","p","_React$PureComponent","PhoneNumberInput_","_possibleConstructorReturn","createRef","_this$props","focusInputOnCountrySelection","newPhoneDigits","getInputRef","focus","hasUserSelectedACountry","_phoneDigits","_this$props2","addInternationalOption","limitMaxLength","countryCallingCodeEditable","_onPhoneDigitsChange","prevPhoneDigits","onPhoneDigitsChange","stateUpdate","forceRerender","isFocused","_onFocus","onFocus","onBlur","_onBlur","countrySelectProps","_this$props3","_value","_international","labels","displayInitialValueAsLocalNumber","initialValueFormat","_this$props4","_defaultCountry","_countries","CountryIcon","subClass","superClass","_inherits","prevProps","newDefaultCountry","newReset","prevDefaultCountry","prevValue","prevReset","_getInitialPhoneDigits","parameters","isNewDefaultCountrySupported","noValueHasBeenEnteredByTheUser","parsedCountry","hasUserSelectedACountryUpdate","supportedCountries","getPhoneInputWithCountryStateUpdateFromNewProps","selectedCountry","prevState","inputRef","generator","dependencies","_this$props5","disabled","autoComplete","style","numberInputProps","smartCaret","CountrySelectComponent","countrySelectComponent","ContainerComponent","containerComponent","countryOptionsOrder","countrySelectOptions","order","optionsOnTop","optionsOnBottom","appendTo","divider","option","splice","sortCountryOptions","countryNames","compareStringsLocales","_compareStrings","unshift","ZZ","getCountrySelectOptions","countryOptions","getSupportedCountryOptions","countrySelectOptionsMemoDependencies","areEqualArrays","countrySelectOptionsMemo","onCountryFocus","onCountryBlur","iconComponent","PureComponent","PhoneNumberInput","any","getRegionalIndicatorSymbol","letter","fromCodePoint","toUpperCase","charCodeAt","CountrySelect","onChange_","getSelectedOption","DIVIDER_STYLE","fontSize","backgroundColor","color","CountrySelectWithIcon","Icon","Arrow","getIconAspectRatio","arrowComponent","unicodeFlags","selectedOption","createPhoneInput","PhoneInputDefault","Onboarding1","TranslationContainer","useContainer","currentLocale","translate","useState","userName","setUserName","validUserName","setValidUserName","errorUserName","setErrorUserName","userEmail","setUserEmail","validEmail","setValidEmail","errorEmail","setErrorEmail","userPhone","setUserPhone","userCountry","setUserCountry","validPhone","setValidPhone","errorPhone","setErrorPhone","loading","setIsLoading","catchYou","setCatchYou","setDefaultCountry","useQueryParam","StringParam","ApiContainer","createLead","setLeadId","validateEmail","getLocationThroughIP","setUtmData","emailRegr","Step","campaign","medium","term","content","userNameIcon","isChecked","showInvalid","userEmailIcon","userPhoneIcon","userNameTitle","styles","stepTitle","userEmailTitle","userPhoneTitle","useEffect","getDefaultCountry","utm_campaign","utm_source","utm_medium","utm_term","utm_content","tailClass","activeError","itemTailActive","itemTailError","itemTailInactative","log","openNotificationWithIcon","description","notification","sendData","realData","contactInfo","email","lang","real","id","navigate","userNameInput","inputStyle","evt","userEmailInput","userPhoneInput","phoneInput","isValidPhonenumber","domoArigatoMrRoboto","lastTailClass","classNames","lastTail","viewWrapper","stepOneWrapper","backBtnAction","stepOne","completedSteps","numberOfSteps","subtile","fieldWrapper","direction","size","icon","mrRoboto","btnWrapper","onClick","loader","testDataWrap","footerImage","FieldImg","lateralImage","testimonyWrapper","innerWrapper","legends","subtitle","separator","subInfo","module","exports"],"mappings":"6dAsBWA,EAAoB,GAAGC,OAXrB,WAWoCA,OAVnC,MAUmDA,OATtD,MASmEA,OARtD,UAQyEA,OAPlF,gBAOmGA,OALrG,QCVb,IAAIC,EAAa,SAASA,EAAWC,IAPrC,SAAyBC,EAAUC,GACjC,KAAMD,aAAoBC,GACxB,MAAM,IAAIC,UAAU,qCAMtBC,CAAgBC,KAAMN,GAEtBM,KAAKC,KAAOD,KAAKE,YAAYD,KAC7BD,KAAKG,QAAUR,EACfK,KAAKI,MAAQ,IAAIC,MAAMV,GAAMS,QAI/BV,EAAWY,UAAYC,OAAOC,OAAOH,MAAMC,YACtBJ,YAAcR,ECTpB,oBACbe,EAAIA,EAAEC,MAAM,KACZC,EAAIA,EAAED,MAAM,KAIZ,IAHA,IAAIE,EAAKH,EAAE,GAAGC,MAAM,KAChBG,EAAKF,EAAE,GAAGD,MAAM,KAEXI,EAAI,EAAGA,EAAI,EAAGA,IAAK,CAC1B,IAAIC,EAAKC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BAAkB,wCAAwC,gBAAkB,wCAAwC,gBAAkB,wCAAwC,gBAAkB,wCAAwC,gBAAkB,wCAAwC,YAAc,oCAAoC,eAAiB,uCAAuC,eAAiB,uCAAuC,eAAiB,uCAAuC,eAAiB,uCAAuC,kBAAoB,0CAA0C,kBAAoB,0CAA0C,kBAAoB,0CAA0C,kBAAoB,0CAA0C,cAAgB,sCAAsC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,iBAAmB,yCAAyC,aAAe,qCAAqC,gBAAkB,wCAAwC,gBAAkB,wCAAwC,gBAAkB,wCAAwC,gBAAkB,wCAAwC,kBAAoB,0CAA0C,gBAAkB,wCAAwC,kBAAoB,0CAA0C,YAAc,oCAAoC,eAAiB,uCAAuC,QAAU,gCAAgC,MAAQ,8BAA8B,QAAU,gCAAgC,aAAe,qCAAqC,eAAiB,uCAAuC,mBAAqB,2CAA2C,cAAgB,sCAAsC,SAAW,iCAAiC,SAAW,iCAAiC,UAAY,kCAAkC,WAAa,mCAAmC,WAAa,mCAAmC,WAAa,mCAAmC,aAAe,qCAAqC,YAAc,oCAAoC,aAAe,qCAAqC,iBAAmB,yCAAyC,aAAe,qCAAqC,UAAY,kCAAkC,cAAgB,sCAAsC,SAAW,iCAAiC,QAAU,gCAAgC,cAAgB,sCAAsC,aAAe,qCAAqC,eAAiB,uCAAuC,WAAa,mCAAmC,QAAU,gCAAgC,SAAW,iCAAiC,UAAY,kCAAkC,QAAU,kC","file":"component---src-pages-index-tsx-03c7b13fe6de11174890.js","sourcesContent":["// 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 + ']+')","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n} // https://stackoverflow.com/a/46971044/970769\n\n\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;","// 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}","function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\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. ';\nvar CALLING_CODE_REG_EXP = /^\\d+$/;\n/**\r\n * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md\r\n */\n\nvar Metadata = /*#__PURE__*/function () {\n function Metadata(metadata) {\n _classCallCheck(this, Metadata);\n\n validateMetadata(metadata);\n this.metadata = metadata;\n setVersion.call(this, metadata);\n }\n\n _createClass(Metadata, [{\n key: \"getCountries\",\n value: function getCountries() {\n return Object.keys(this.metadata.countries).filter(function (_) {\n return _ !== '001';\n });\n }\n }, {\n key: \"getCountryMetadata\",\n value: function getCountryMetadata(countryCode) {\n return this.metadata.countries[countryCode];\n }\n }, {\n key: \"nonGeographic\",\n value: function nonGeographic() {\n if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.\n // It's present in metadata generated from `1.7.35` to `1.7.37`.\n\n return this.metadata.nonGeographic || this.metadata.nonGeographical;\n }\n }, {\n key: \"hasCountry\",\n value: function hasCountry(country) {\n return this.getCountryMetadata(country) !== undefined;\n }\n }, {\n key: \"hasCallingCode\",\n value: function hasCallingCode(callingCode) {\n if (this.getCountryCodesForCallingCode(callingCode)) {\n return true;\n }\n\n if (this.nonGeographic()) {\n if (this.nonGeographic()[callingCode]) {\n return true;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return true;\n }\n }\n }\n }, {\n key: \"isNonGeographicCallingCode\",\n value: function isNonGeographicCallingCode(callingCode) {\n if (this.nonGeographic()) {\n return this.nonGeographic()[callingCode] ? true : false;\n } else {\n return this.getCountryCodesForCallingCode(callingCode) ? false : true;\n }\n } // Deprecated.\n\n }, {\n key: \"country\",\n value: function country(countryCode) {\n return this.selectNumberingPlan(countryCode);\n }\n }, {\n key: \"selectNumberingPlan\",\n value: function selectNumberingPlan(countryCode, callingCode) {\n // Supports just passing `callingCode` as the first argument.\n if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {\n callingCode = countryCode;\n countryCode = null;\n }\n\n if (countryCode && countryCode !== '001') {\n if (!this.hasCountry(countryCode)) {\n throw new Error(\"Unknown country: \".concat(countryCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);\n } else if (callingCode) {\n if (!this.hasCallingCode(callingCode)) {\n throw new Error(\"Unknown calling code: \".concat(callingCode));\n }\n\n this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);\n } else {\n this.numberingPlan = undefined;\n }\n\n return this;\n }\n }, {\n key: \"getCountryCodesForCallingCode\",\n value: function getCountryCodesForCallingCode(callingCode) {\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes) {\n // Metadata before V4 included \"non-geographic entity\" calling codes\n // inside `country_calling_codes` (for example, `\"881\":[\"001\"]`).\n // Now the semantics of `country_calling_codes` has changed:\n // it's specifically for \"countries\" now.\n // Older versions of custom metadata will simply skip parsing\n // \"non-geographic entity\" phone numbers with new versions\n // of this library: it's not considered a bug,\n // because such numbers are extremely rare,\n // and developers extremely rarely use custom metadata.\n if (countryCodes.length === 1 && countryCodes[0].length === 3) {\n return;\n }\n\n return countryCodes;\n }\n }\n }, {\n key: \"getCountryCodeForCallingCode\",\n value: function getCountryCodeForCallingCode(callingCode) {\n var countryCodes = this.getCountryCodesForCallingCode(callingCode);\n\n if (countryCodes) {\n return countryCodes[0];\n }\n }\n }, {\n key: \"getNumberingPlanMetadata\",\n value: function getNumberingPlanMetadata(callingCode) {\n var countryCode = this.getCountryCodeForCallingCode(callingCode);\n\n if (countryCode) {\n return this.getCountryMetadata(countryCode);\n }\n\n if (this.nonGeographic()) {\n var metadata = this.nonGeographic()[callingCode];\n\n if (metadata) {\n return metadata;\n }\n } else {\n // A hacky workaround for old custom metadata (generated before V4).\n var countryCodes = this.countryCallingCodes()[callingCode];\n\n if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {\n return this.metadata.countries['001'];\n }\n }\n } // Deprecated.\n\n }, {\n key: \"countryCallingCode\",\n value: function countryCallingCode() {\n return this.numberingPlan.callingCode();\n } // Deprecated.\n\n }, {\n key: \"IDDPrefix\",\n value: function IDDPrefix() {\n return this.numberingPlan.IDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"defaultIDDPrefix\",\n value: function defaultIDDPrefix() {\n return this.numberingPlan.defaultIDDPrefix();\n } // Deprecated.\n\n }, {\n key: \"nationalNumberPattern\",\n value: function nationalNumberPattern() {\n return this.numberingPlan.nationalNumberPattern();\n } // Deprecated.\n\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n return this.numberingPlan.possibleLengths();\n } // Deprecated.\n\n }, {\n key: \"formats\",\n value: function formats() {\n return this.numberingPlan.formats();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixForParsing\",\n value: function nationalPrefixForParsing() {\n return this.numberingPlan.nationalPrefixForParsing();\n } // Deprecated.\n\n }, {\n key: \"nationalPrefixTransformRule\",\n value: function nationalPrefixTransformRule() {\n return this.numberingPlan.nationalPrefixTransformRule();\n } // Deprecated.\n\n }, {\n key: \"leadingDigits\",\n value: function leadingDigits() {\n return this.numberingPlan.leadingDigits();\n } // Deprecated.\n\n }, {\n key: \"hasTypes\",\n value: function hasTypes() {\n return this.numberingPlan.hasTypes();\n } // Deprecated.\n\n }, {\n key: \"type\",\n value: function type(_type) {\n return this.numberingPlan.type(_type);\n } // Deprecated.\n\n }, {\n key: \"ext\",\n value: function ext() {\n return this.numberingPlan.ext();\n }\n }, {\n key: \"countryCallingCodes\",\n value: function countryCallingCodes() {\n if (this.v1) return this.metadata.country_phone_code_to_countries;\n return this.metadata.country_calling_codes;\n } // Deprecated.\n\n }, {\n key: \"chooseCountryByCountryCallingCode\",\n value: function chooseCountryByCountryCallingCode(callingCode) {\n return this.selectNumberingPlan(callingCode);\n }\n }, {\n key: \"hasSelectedNumberingPlan\",\n value: function hasSelectedNumberingPlan() {\n return this.numberingPlan !== undefined;\n }\n }]);\n\n return Metadata;\n}();\n\nexport { Metadata as default };\n\nvar NumberingPlan = /*#__PURE__*/function () {\n function NumberingPlan(metadata, globalMetadataObject) {\n _classCallCheck(this, NumberingPlan);\n\n this.globalMetadataObject = globalMetadataObject;\n this.metadata = metadata;\n setVersion.call(this, globalMetadataObject.metadata);\n }\n\n _createClass(NumberingPlan, [{\n key: \"callingCode\",\n value: function callingCode() {\n return this.metadata[0];\n } // Formatting information for regions which share\n // a country calling code is contained by only one region\n // for performance reasons. For example, for NANPA region\n // (\"North American Numbering Plan Administration\",\n // which includes USA, Canada, Cayman Islands, Bahamas, etc)\n // it will be contained in the metadata for `US`.\n\n }, {\n key: \"getDefaultCountryMetadataForRegion\",\n value: function getDefaultCountryMetadataForRegion() {\n return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());\n }\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 = /*#__PURE__*/function () {\n function Format(format, metadata) {\n _classCallCheck(this, Format);\n\n this._format = format;\n this.metadata = metadata;\n }\n\n _createClass(Format, [{\n key: \"pattern\",\n value: function pattern() {\n return this._format[0];\n }\n }, {\n key: \"format\",\n value: function format() {\n return this._format[1];\n }\n }, {\n key: \"leadingDigitsPatterns\",\n value: function leadingDigitsPatterns() {\n return this._format[2] || [];\n }\n }, {\n key: \"nationalPrefixFormattingRule\",\n value: function nationalPrefixFormattingRule() {\n return this._format[3] || this.metadata.nationalPrefixFormattingRule();\n }\n }, {\n key: \"nationalPrefixIsOptionalWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {\n return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n }\n }, {\n key: \"nationalPrefixIsMandatoryWhenFormattingInNationalFormat\",\n value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {\n // National prefix is omitted if there's no national prefix formatting rule\n // set for this country, or when the national prefix formatting rule\n // contains no national prefix itself, or when this rule is set but\n // national prefix is optional for this phone number format\n // (and it is not enforced explicitly)\n return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();\n } // Checks whether national prefix formatting rule contains national prefix.\n\n }, {\n key: \"usesNationalPrefix\",\n value: function usesNationalPrefix() {\n return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a \"dummy\" one.\n !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`\n // when `national_prefix_formatting_rule` is not present.\n // So, `true` or `false` are returned explicitly here, so that\n // `0` number isn't returned.\n ? true : false;\n }\n }, {\n key: \"internationalFormat\",\n value: function internationalFormat() {\n return this._format[5] || this.format();\n }\n }]);\n\n return Format;\n}();\n/**\r\n * A pattern that is used to determine if the national prefix formatting rule\r\n * has the first group only, i.e., does not start with the national prefix.\r\n * Note that the pattern explicitly allows for unbalanced parentheses.\r\n */\n\n\nvar FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\\(?\\$1\\)?$/;\n\nvar Type = /*#__PURE__*/function () {\n function Type(type, metadata) {\n _classCallCheck(this, Type);\n\n this.type = type;\n this.metadata = metadata;\n }\n\n _createClass(Type, [{\n key: \"pattern\",\n value: function pattern() {\n if (this.metadata.v1) return this.type;\n return this.type[0];\n }\n }, {\n key: \"possibleLengths\",\n value: function possibleLengths() {\n if (this.metadata.v1) return;\n return this.type[1] || this.metadata.possibleLengths();\n }\n }]);\n\n return Type;\n}();\n\nfunction getType(types, type) {\n switch (type) {\n case 'FIXED_LINE':\n return types[0];\n\n case 'MOBILE':\n return types[1];\n\n case 'TOLL_FREE':\n return types[2];\n\n case 'PREMIUM_RATE':\n return types[3];\n\n case 'PERSONAL_NUMBER':\n return types[4];\n\n case 'VOICEMAIL':\n return types[5];\n\n case 'UAN':\n return types[6];\n\n case 'PAGER':\n return types[7];\n\n case 'VOIP':\n return types[8];\n\n case 'SHARED_COST':\n return types[9];\n }\n}\n\nexport function validateMetadata(metadata) {\n if (!metadata) {\n throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');\n } // `country_phone_code_to_countries` was renamed to\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 var version = metadata.version;\n\n if (typeof version === 'number') {\n this.v1 = version === 1;\n this.v2 = version === 2;\n this.v3 = version === 3;\n this.v4 = version === 4;\n } else {\n if (!version) {\n this.v1 = true;\n } else if (compare(version, V3) === -1) {\n this.v2 = true;\n } else if (compare(version, V4) === -1) {\n this.v3 = true;\n } else {\n this.v4 = true;\n }\n }\n} // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/\n// function isCountryCode(countryCode) {\n// \treturn ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)\n// }","import { VALID_DIGITS } from '../../constants'; // The RFC 3966 format for extensions.\n\nvar RFC3966_EXTN_PREFIX = ';ext=';\n/**\r\n * Helper method for constructing regular expressions for parsing. Creates\r\n * an expression that captures up to max_length digits.\r\n * @return {string} RegEx pattern to capture extension digits.\r\n */\n\nvar getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) {\n return \"([\".concat(VALID_DIGITS, \"]{1,\").concat(maxLength, \"})\");\n};\n/**\r\n * Helper initialiser method to create the regular-expression pattern to match\r\n * extensions.\r\n * Copy-pasted from Google's `libphonenumber`:\r\n * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766\r\n * @return {string} RegEx pattern to capture extensions.\r\n */\n\n\nexport default function createExtensionPattern(purpose) {\n // We cap the maximum length of an extension based on the ambiguity of the way\n // the extension is prefixed. As per ITU, the officially allowed length for\n // extensions is actually 40, but we don't support this since we haven't seen real\n // examples and this introduces many false interpretations as the extension labels\n // are not standardized.\n\n /** @type {string} */\n var extLimitAfterExplicitLabel = '20';\n /** @type {string} */\n\n var extLimitAfterLikelyLabel = '15';\n /** @type {string} */\n\n var extLimitAfterAmbiguousChar = '9';\n /** @type {string} */\n\n var extLimitWhenNotSure = '6';\n /** @type {string} */\n\n var possibleSeparatorsBetweenNumberAndExtLabel = \"[ \\xA0\\\\t,]*\"; // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas.\n\n /** @type {string} */\n\n var possibleCharsAfterExtLabel = \"[:\\\\.\\uFF0E]?[ \\xA0\\\\t,-]*\";\n /** @type {string} */\n\n var optionalExtnSuffix = \"#?\"; // Here the extension is called out in more explicit way, i.e mentioning it obvious\n // patterns like \"ext.\".\n\n /** @type {string} */\n\n var explicitExtLabels = \"(?:e?xt(?:ensi(?:o\\u0301?|\\xF3))?n?|\\uFF45?\\uFF58\\uFF54\\uFF4E?|\\u0434\\u043E\\u0431|anexo)\"; // One-character symbols that can be used to indicate an extension, and less\n // commonly used or more ambiguous extension labels.\n\n /** @type {string} */\n\n var ambiguousExtLabels = \"(?:[x\\uFF58#\\uFF03~\\uFF5E]|int|\\uFF49\\uFF4E\\uFF54)\"; // When extension is not separated clearly.\n\n /** @type {string} */\n\n var ambiguousSeparator = \"[- ]+\"; // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching\n // comma as extension label may have it.\n\n /** @type {string} */\n\n var possibleSeparatorsNumberExtLabelNoComma = \"[ \\xA0\\\\t]*\"; // \",,\" is commonly used for auto dialling the extension when connected. First\n // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do\n // not repeat it here. Semi-colon works in Iphone and Android also to pop up a\n // button with the extension number following.\n\n /** @type {string} */\n\n var autoDiallingAndExtLabelsFound = \"(?:,{2}|;)\";\n /** @type {string} */\n\n var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);\n /** @type {string} */\n\n var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;\n /** @type {string} */\n\n var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;\n /** @type {string} */\n\n var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + \"#\";\n /** @type {string} */\n\n var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;\n /** @type {string} */\n\n var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + \"(?:,)+\" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; // The first regular expression covers RFC 3966 format, where the extension is added\n // using \";ext=\". The second more generic where extension is mentioned with explicit\n // labels like \"ext:\". In both the above cases we allow more numbers in extension than\n // any other extension labels. The third one captures when single character extension\n // labels or less commonly used labels are used. In such cases we capture fewer\n // extension digits in order to reduce the chance of falsely interpreting two\n // numbers beside each other as a number + extension. The fourth one covers the\n // special case of American numbers where the extension is written with a hash\n // at the end, such as \"- 503#\". The fifth one is exclusively for extension\n // autodialling formats which are used when dialling and in this case we accept longer\n // extensions. The last one is more liberal on the number of commas that acts as\n // extension labels, so we have a strict cap on the number of digits in such extensions.\n\n return rfcExtn + \"|\" + explicitExtn + \"|\" + ambiguousExtn + \"|\" + americanStyleExtnWithSuffix + \"|\" + autoDiallingExtn + \"|\" + onlyCommasExtn;\n}","import { MIN_LENGTH_FOR_NSN, VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from '../constants';\nimport createExtensionPattern from './extension/createExtensionPattern'; // 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\nexport var VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*';\nexport var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions\n'(?:' + createExtensionPattern() + ')?'; // 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_WITH_EXTENSION + '$', '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}","import createExtensionPattern from './createExtensionPattern'; // 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('(?:' + createExtensionPattern() + ')$', '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 default 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 numberWithoutExtension = 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]) {\n return {\n number: numberWithoutExtension,\n ext: matches[i]\n };\n }\n\n i++;\n }\n}","// 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}","import { parseDigit } from './helpers/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 * Parses next character while parsing phone number digits (including a `+`)\r\n * from text: discards everything except `+` and digits, and `+` is only allowed\r\n * at the start of a phone number.\r\n * For example, is used in `react-phone-number-input` where it uses\r\n * [`input-format`](https://gitlab.com/catamphetamine/input-format).\r\n * @param {string} character - Yet another character from raw input string.\r\n * @param {string?} prevParsedCharacters - Previous parsed characters.\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, prevParsedCharacters) {\n // Only allow a leading `+`.\n if (character === '+') {\n // If this `+` is not the first parsed character\n // then discard it.\n if (prevParsedCharacters) {\n return;\n }\n\n return '+';\n } // Allow digits.\n\n\n return parseDigit(character);\n}","import mergeArrays from './mergeArrays';\nexport default function checkNumberLength(nationalNumber, metadata) {\n return checkNumberLengthForType(nationalNumber, undefined, metadata);\n} // Checks whether a number is possible for the country based on its length.\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 // \tlocal_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())\n // } else {\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}","/**\r\n * Merges two arrays.\r\n * @param {*} a\r\n * @param {*} b\r\n * @return {*}\r\n */\nexport default 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 // \tmerged.add(i)\n // }\n // return Array.from(merged).sort((a, b) => a - b)\n}","import Metadata from './metadata';\nimport checkNumberLength from './helpers/checkNumberLength';\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.selectNumberingPlan(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.selectNumberingPlan(input.countryCallingCode);\n }\n }\n\n if (metadata.possibleLengths()) {\n return isPossibleNumber(input.phone || input.nationalNumber, 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, metadata) {\n //, isInternational) {\n switch (checkNumberLength(nationalNumber, metadata)) {\n case 'IS_POSSIBLE':\n return true;\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n // \treturn !isInternational\n\n default:\n return false;\n }\n}","function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\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}","/**\r\n * Checks whether the entire input sequence can be matched\r\n * against the regular expression.\r\n * @return {boolean}\r\n */\nexport default 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}","import Metadata from '../metadata';\nimport matchesEntirely from './matchesEntirely';\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 (isNumberTypeEqualTo(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 (isNumberTypeEqualTo(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 (isNumberTypeEqualTo(nationalNumber, type, metadata)) {\n return type;\n }\n }\n}\nexport function isNumberTypeEqualTo(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}","import { VALID_PUNCTUATION } from '../constants'; // 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\nexport default function applyInternationalSeparatorStyle(formattedNumber) {\n return formattedNumber.replace(new RegExp(\"[\".concat(VALID_PUNCTUATION, \"]+\"), 'g'), ' ').trim();\n}","import applyInternationalSeparatorStyle from './applyInternationalSeparatorStyle'; // 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 default function formatNationalNumberUsingFormat(number, format, _ref) {\n var useInternationalFormat = _ref.useInternationalFormat,\n withNationalPrefix = _ref.withNationalPrefix,\n carrierCode = _ref.carrierCode,\n metadata = _ref.metadata;\n var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`,\n // because that one is only used when formatting phone numbers\n // for dialing from a mobile phone, and this is not a dialing library.\n // carrierCode && format.domesticCarrierCodeFormattingRule()\n // \t// First, replace the $CC in the formatting rule with the desired carrier code.\n // \t// Then, replace the $FG in the formatting rule with the first group\n // \t// and the carrier code combined in the appropriate way.\n // \t? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))\n // \t: (\n // \t\twithNationalPrefix && format.nationalPrefixFormattingRule()\n // \t\t\t? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())\n // \t\t\t: format.format()\n // \t)\n withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());\n\n if (useInternationalFormat) {\n return applyInternationalSeparatorStyle(formattedNumber);\n }\n\n return formattedNumber;\n}","import Metadata from '../metadata';\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_REG_EXP = /^[\\d]+(?:[~\\u2053\\u223C\\uFF5E][\\d]+)?$/; // For regions that have multiple IDD prefixes\n// a preferred IDD prefix is returned.\n\nexport default function getIddPrefix(country, callingCode, metadata) {\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n\n if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {\n return countryMetadata.IDDPrefix();\n }\n\n return countryMetadata.defaultIDDPrefix();\n}","function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\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\n\n\nimport matchesEntirely from './helpers/matchesEntirely';\nimport formatNationalNumberUsingFormat from './helpers/formatNationalNumberUsingFormat';\nimport Metadata, { getCountryCallingCode } from './metadata';\nimport getIddPrefix from './helpers/getIddPrefix';\nimport { formatRFC3966 } from './helpers/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.selectNumberingPlan(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, input.carrierCode, '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, null, '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 // For reference, here's Google's IDD formatter:\n // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546\n // Not saying that this IDD formatter replicates it 1:1, but it seems to work.\n // Who would even need to format phone numbers in IDD format anyway?\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 formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);\n return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);\n\n default:\n throw new Error(\"Unknown \\\"format\\\" argument passed to \\\"formatNumber()\\\": \\\"\".concat(format, \"\\\"\"));\n }\n}\n\nfunction formatNationalNumber(number, carrierCode, formatAs, metadata, options) {\n var format = chooseFormatForNumber(metadata.formats(), number);\n\n if (!format) {\n return number;\n }\n\n return formatNationalNumberUsingFormat(number, format, {\n useInternationalFormat: formatAs === 'INTERNATIONAL',\n withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,\n carrierCode: carrierCode,\n metadata: metadata\n });\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; // Validate leading digits\n\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}\n\nfunction addExtension(formattedNumber, ext, metadata, formatExtension) {\n return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;\n}\n\nfunction formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {\n var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code.\n\n if (fromCountryCallingCode === countryCallingCode) {\n var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions\n // but prefix it with the country calling code.\n\n if (countryCallingCode === '1') {\n return countryCallingCode + ' ' + formattedNumber;\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 formattedNumber;\n }\n\n var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);\n\n if (iddPrefix) {\n return \"\".concat(iddPrefix, \" \").concat(countryCallingCode, \" \").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));\n }\n}","function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nimport Metadata from './metadata';\nimport isPossibleNumber from './isPossibleNumber_';\nimport isValidNumber from './validate_';\nimport isValidNumberForRegion from './isValidNumberForRegion_';\nimport getNumberType from './helpers/getNumberType';\nimport formatNumber from './format_';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar PhoneNumber = /*#__PURE__*/function () {\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};","import Metadata from './metadata';\nimport matchesEntirely from './helpers/matchesEntirely';\nimport getNumberType from './helpers/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}","import Metadata from '../metadata';\nimport { VALID_DIGITS } from '../constants';\nvar CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');\nexport default 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); // If there're any digits after an IDD prefix,\n // then those digits are a country calling code.\n // Since no country code starts with a `0`,\n // the code below validates that the next digit (if present) is not `0`.\n\n var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);\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}","/**\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, nationalPrefix: string? carrierCode: string? }`.\r\n */\nexport default function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {\n if (number && metadata.numberingPlan.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.numberingPlan.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule\n // If a `national_prefix_for_parsing` has any \"capturing groups\"\n // then it means that the national (significant) number is equal to\n // those \"capturing groups\" transformed via `national_prefix_transform_rule`,\n // and nothing could be said about the actual national prefix:\n // what is it and was it even there.\n // If a `national_prefix_for_parsing` doesn't have any \"capturing groups\",\n // then everything it matches is a national prefix.\n // To determine whether `national_prefix_for_parsing` matched any\n // \"capturing groups\", the value of the result of calling `.exec()`\n // is looked at, and if it has non-undefined values where there're\n // \"capturing groups\" in the regular expression, then it means\n // that \"capturing groups\" have been matched.\n // It's not possible to tell whether there'll be any \"capturing gropus\"\n // before the matching process, because a `national_prefix_for_parsing`\n // could exhibit both behaviors.\n\n var capturedGroupsCount = prefixMatch.length - 1;\n var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];\n\n if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {\n nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,\n // then carrier code is the second one.\n\n if (capturedGroupsCount > 1) {\n carrierCode = prefixMatch[1];\n }\n } // If there're no \"capturing groups\",\n // or if there're \"capturing groups\" but no\n // `national_prefix_transform_rule`,\n // then just strip the national prefix from the number,\n // and possibly a carrier code.\n // Seems like there could be more.\n else {\n // `prefixBeforeNationalNumber` is the whole substring matched by\n // the `national_prefix_for_parsing` regular expression.\n // There seem to be no guarantees that it's just a national prefix.\n // For example, if there's a carrier code, it's gonna be a\n // part of `prefixBeforeNationalNumber` too.\n var prefixBeforeNationalNumber = prefixMatch[0];\n nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,\n // then carrier code is the first one.\n\n if (hasCapturedGroups) {\n carrierCode = prefixMatch[1];\n }\n } // Tries to guess whether a national prefix was present in the input.\n // This is not something copy-pasted from Google's library:\n // they don't seem to have an equivalent for that.\n // So this isn't an \"officially approved\" way of doing something like that.\n // But since there seems no other existing method, this library uses it.\n\n\n var nationalPrefix;\n\n if (hasCapturedGroups) {\n var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);\n var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.\n // `prefixMatch[0]` is `01115`, and `$1` is `11`,\n // and the rest of the phone number is `23456789`.\n // The national number is transformed via `9$1` to `91123456789`.\n // National prefix `0` is detected being present at the start.\n // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {\n\n if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {\n nationalPrefix = metadata.numberingPlan.nationalPrefix();\n }\n } else {\n nationalPrefix = prefixMatch[0];\n }\n\n return {\n nationalNumber: nationalNumber,\n nationalPrefix: nationalPrefix,\n carrierCode: carrierCode\n };\n }\n }\n\n return {\n nationalNumber: number\n };\n}","import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber';\nimport matchesEntirely from './matchesEntirely';\nimport checkNumberLength from './checkNumberLength';\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\nexport default function extractNationalNumber(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 _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.carrierCode;\n\n if (!shouldExtractNationalPrefix(number, nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n } // If a national prefix has been extracted, check to see\n // if the resultant number isn't too short.\n // Same code in Google's `libphonenumber`:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3291-L3302\n // For some reason, they do this check right after the `national_number_pattern` check\n // this library does in `shouldExtractNationalPrefix()` function.\n // Why is there a second \"resultant\" number validity check?\n // They don't provide an explanation.\n // This library just copies the behavior.\n\n\n if (number.length !== nationalNumber.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 (checkNumberLength(nationalNumber, 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} // In some countries, the same digit could be a national prefix\n// or a leading digit of a valid phone number.\n// For example, in Russia, national prefix is `8`,\n// and also `800 555 35 35` is a valid number\n// in which `8` is not a national prefix, but the first digit\n// of a national (significant) number.\n// Same's with Belarus:\n// `82004910060` is a valid national (significant) number,\n// but `2004910060` is not.\n// To support such cases (to prevent the code from always stripping\n// national prefix), a condition is imposed: a national prefix\n// is not extracted when the original number is \"viable\" and the\n// resultant number is not, a \"viable\" national number being the one\n// that matches `national_number_pattern`.\n\nfunction shouldExtractNationalPrefix(number, nationalSignificantNumber, metadata) {\n // The equivalent in Google's code is:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004\n if (matchesEntirely(number, metadata.nationalNumberPattern()) && !matchesEntirely(nationalSignificantNumber, metadata.nationalNumberPattern())) {\n return false;\n } // Just \"possible\" number check would be more relaxed, so it's not used.\n // if (isPossibleNumber(number, metadata) &&\n // \t!isPossibleNumber(numberWithNationalPrefixExtracted, metadata)) {\n // \treturn false\n // }\n\n\n return true;\n}","import Metadata from '../metadata';\nimport matchesEntirely from './matchesEntirely';\nimport extractNationalNumber from './extractNationalNumber';\nimport checkNumberLength from './checkNumberLength';\nimport getCountryCallingCode from '../getCountryCallingCode';\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 default 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 _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata),\n possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;\n\n var _extractNationalNumbe2 = extractNationalNumber(number, metadata),\n nationalNumber = _extractNationalNumbe2.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()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') {\n return {\n countryCallingCode: countryCallingCode,\n number: possibleShorterNumber\n };\n }\n }\n\n return {\n number: number\n };\n}","import stripIddPrefix from './stripIddPrefix';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './extractCountryCallingCodeFromInternationalNumberWithoutPlusSign';\nimport Metadata from '../metadata';\nimport { MAX_LENGTH_COUNTRY_CODE } from '../constants';\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 default 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 _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n shorterNumber = _extractCountryCallin.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(_countryCallingCode);\n return {\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n\n i++;\n }\n\n return {};\n}","import Metadata from '../metadata';\nimport getNumberType from './getNumberType';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\nexport default function getCountryByCallingCode(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 selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata.metadata);\n}\n\nfunction selectCountryFromList(possibleCountries, nationalPhoneNumber, metadata) {\n // Re-create `metadata` because it will be selecting a `country`.\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}","// 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 } from './constants';\nimport ParseError from './ParseError';\nimport Metadata from './metadata';\nimport isViablePhoneNumber from './helpers/isViablePhoneNumber';\nimport extractExtension from './helpers/extension/extractExtension';\nimport parseIncompletePhoneNumber from './parseIncompletePhoneNumber';\nimport getCountryCallingCode from './getCountryCallingCode';\nimport { isPossibleNumber } from './isPossibleNumber_';\nimport { parseRFC3966 } from './helpers/RFC3966';\nimport PhoneNumber from './PhoneNumber';\nimport matchesEntirely from './helpers/matchesEntirely';\nimport extractCountryCallingCode from './helpers/extractCountryCallingCode';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign';\nimport extractNationalNumber from './helpers/extractNationalNumber';\nimport stripIddPrefix from './helpers/stripIddPrefix';\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode'; // 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// A trailing `#` is sometimes used when writing phone numbers with extensions in US.\n// Example: \"+1 (645) 123 1234-910#\" number has extension \"910\".\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 } // isInternational: countryCallingCode !== undefined\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, 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 * @param {string} text - Input.\r\n * @return {object} `{ ?number, ?ext }`.\r\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.selectNumberingPlan(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 _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata),\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.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 = getCountryByCallingCode(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}","function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport parseNumber from './parse_';\nexport default function parsePhoneNumber(text, options, metadata) {\n return parseNumber(text, _objectSpread({}, options, {\n v2: true\n }), metadata);\n}","function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\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};","function _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n var ownKeys = Object.keys(source);\n\n if (typeof Object.getOwnPropertySymbols === 'function') {\n ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {\n return Object.getOwnPropertyDescriptor(source, sym).enumerable;\n }));\n }\n\n ownKeys.forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\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}","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}","import Metadata from './metadata';\nexport default function getCountries(metadata) {\n return new Metadata(metadata).getCountries();\n}","// 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}","import { count_occurences } from './helpers';\nexport default function closeBraces(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}","import template_formatter from './templateFormatter'; // 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}","import { count_occurences } from './helpers';\nimport close_braces from './closeBraces'; // 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}","// 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;","import edit from './edit';\nimport parse from './parse';\nimport format from './format';\nimport { getOperation, getSelection, getCaretPosition, setCaretPosition } from './dom'; // Deprecated.\n// I don't know why this function exists.\n\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 formatInputText(input, _parse, _format, undefined, on_change);\n }, 0);\n} // Deprecated.\n// I don't know why this function exists.\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 eraseSelection(input, selection);\n }\n\n formatInputText(input, _parse, _format, undefined, on_change);\n}\nexport function onChange(event, input, _parse, _format, on_change) {\n formatInputText(input, _parse, _format, undefined, on_change);\n} // \"Delete\" and \"Backspace\" keys are special\n// in a way that they're not handled by the regular `onChange()` handler\n// and instead are intercepted and re-applied manually.\n// The reason is that normally hitting \"Backspace\" or \"Delete\"\n// results in erasing a character, but that character might be any character,\n// while it would be a better \"user experience\" if it erased not just any character\n// but the closest \"meaningful\" character.\n// For example, if a template is `(xxx) xxx-xxxx`,\n// and the `` value is `(111) 222-3333`,\n// then, if a user begins erasing the `3333` part via \"Backspace\"\n// and reaches the \"-\" character, then it would just erase the \"-\" character.\n// Nothing wrong with that, but it would be a better \"user experience\"\n// if hitting \"Backspace\" at that position would erase the closest \"meaningful\"\n// character, which would be the rightmost `2`.\n// So, what this `onKeyDown()` handler does is it intercepts\n// \"Backspace\" and \"Delete\" keys and re-applies those operations manually\n// following the logic described above.\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 a selection is made, just erase the selected text.\n\n if (selection) {\n eraseSelection(input, selection);\n return formatInputText(input, _parse, _format, undefined, on_change);\n } // Else, perform the (character erasing) operation manually.\n\n\n return formatInputText(input, _parse, _format, operation, on_change);\n\n default: // Will be handled normally as part of the `onChange` handler.\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 eraseSelection(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 formatInputText(input, _parse, _format, operation, on_change) {\n // Parse `` textual value.\n // Get the `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 (\"Backspace\", \"Delete\")\n // then apply that operation and get the new `value` and `caret` position.\n\n\n if (operation) {\n var newValueAndCaret = edit(value, caret, operation);\n value = newValueAndCaret.value;\n caret = newValueAndCaret.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 a 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); // If the `` textual value did change,\n // then the parsed `value` may have changed too.\n\n on_change(value);\n}","// 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}","// 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}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n} // This is just `./ReactInput.js` rewritten in Hooks.\n\n\nimport React, { useCallback, useRef } from 'react';\nimport { onChange as onInputChange, onKeyDown as onInputKeyDown } from '../inputControl'; // 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 onKeyDown = _ref.onKeyDown,\n rest = _objectWithoutProperties(_ref, [\"value\", \"parse\", \"format\", \"inputComponent\", \"onChange\", \"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 _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 }));\n}\n\nInput = React.forwardRef(Input);\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}","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nvar AsYouTypeState = /*#__PURE__*/function () {\n function AsYouTypeState(_ref) {\n var _this = this;\n\n var onCountryChange = _ref.onCountryChange,\n onCallingCodeChange = _ref.onCallingCodeChange;\n\n _classCallCheck(this, AsYouTypeState);\n\n _defineProperty(this, \"update\", function (properties) {\n for (var _i = 0, _Object$keys = Object.keys(properties); _i < _Object$keys.length; _i++) {\n var key = _Object$keys[_i];\n _this[key] = properties[key];\n }\n });\n\n this.onCountryChange = onCountryChange;\n this.onCallingCodeChange = onCallingCodeChange;\n }\n\n _createClass(AsYouTypeState, [{\n key: \"reset\",\n value: function reset(defaultCountry, defaultCallingCode) {\n this.international = false;\n this.IDDPrefix = undefined;\n this.missingPlus = undefined;\n this.callingCode = undefined;\n this.digits = '';\n this.resetNationalSignificantNumber();\n this.initCountryAndCallingCode(defaultCountry, defaultCallingCode);\n }\n }, {\n key: \"resetNationalSignificantNumber\",\n value: function resetNationalSignificantNumber() {\n this.nationalSignificantNumber = this.getNationalDigits();\n this.nationalSignificantNumberMatchesInput = true;\n this.nationalPrefix = undefined;\n this.carrierCode = undefined;\n this.complexPrefixBeforeNationalSignificantNumber = undefined;\n }\n }, {\n key: \"initCountryAndCallingCode\",\n value: function initCountryAndCallingCode(country, callingCode) {\n this.setCountry(country);\n this.setCallingCode(callingCode);\n }\n }, {\n key: \"setCountry\",\n value: function setCountry(country) {\n this.country = country;\n this.onCountryChange(country);\n }\n }, {\n key: \"setCallingCode\",\n value: function setCallingCode(callingCode) {\n this.callingCode = callingCode;\n return this.onCallingCodeChange(this.country, callingCode);\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.initCountryAndCallingCode();\n }\n }, {\n key: \"appendDigits\",\n value: function appendDigits(nextDigits) {\n this.digits += nextDigits;\n }\n }, {\n key: \"appendNationalSignificantNumberDigits\",\n value: function appendNationalSignificantNumberDigits(nextDigits) {\n this.nationalSignificantNumber += nextDigits;\n }\n /**\r\n * Returns the part of `this.digits` that corresponds to the national number.\r\n * Basically, all digits that have been input by the user, except for the\r\n * international prefix and the country calling code part\r\n * (if the number is an international one).\r\n * @return {string}\r\n */\n\n }, {\n key: \"getNationalDigits\",\n value: function getNationalDigits() {\n if (this.international) {\n return this.digits.slice((this.IDDPrefix ? this.IDDPrefix.length : 0) + (this.callingCode ? this.callingCode.length : 0));\n }\n\n return this.digits;\n }\n }, {\n key: \"getDigitsWithoutInternationalPrefix\",\n value: function getDigitsWithoutInternationalPrefix() {\n if (this.international) {\n if (this.IDDPrefix) {\n return this.digits.slice(this.IDDPrefix.length);\n }\n }\n\n return this.digits;\n }\n }]);\n\n return AsYouTypeState;\n}();\n\nexport { AsYouTypeState as default };","// Should be the same as `DIGIT_PLACEHOLDER` in `libphonenumber-metadata-generator`.\nexport var DIGIT_PLACEHOLDER = 'x'; // '\\u2008' (punctuation space)\n\nvar DIGIT_PLACEHOLDER_MATCHER = new RegExp(DIGIT_PLACEHOLDER); // 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 _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} // 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}\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}\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 _i2 = 0, _dangling_braces = dangling_braces; _i2 < _dangling_braces.length; _i2++) {\n var index = _dangling_braces[_i2];\n cleared_string += string.slice(start, index);\n start = index + 1;\n }\n\n return cleared_string;\n}\nexport function populateTemplateWithDigits(template, position, 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 _iterator2 = digits.split(''), _isArray2 = Array.isArray(_iterator2), _i3 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref2;\n\n if (_isArray2) {\n if (_i3 >= _iterator2.length) break;\n _ref2 = _iterator2[_i3++];\n } else {\n _i3 = _iterator2.next();\n if (_i3.done) break;\n _ref2 = _i3.value;\n }\n\n var digit = _ref2; // 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\n if (template.slice(position + 1).search(DIGIT_PLACEHOLDER_MATCHER) < 0) {\n return;\n }\n\n position = template.search(DIGIT_PLACEHOLDER_MATCHER);\n template = template.replace(DIGIT_PLACEHOLDER_MATCHER, digit);\n }\n\n return [template, position];\n}","import checkNumberLength from './helpers/checkNumberLength';\nimport parseDigits from './helpers/parseDigits';\nimport formatNationalNumberUsingFormat from './helpers/formatNationalNumberUsingFormat';\nexport default function formatCompleteNumber(state, format, _ref) {\n var metadata = _ref.metadata,\n shouldTryNationalPrefixFormattingRule = _ref.shouldTryNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix = _ref.getSeparatorAfterNationalPrefix;\n var matcher = new RegExp(\"^(?:\".concat(format.pattern(), \")$\"));\n\n if (matcher.test(state.nationalSignificantNumber)) {\n return formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, {\n metadata: metadata,\n shouldTryNationalPrefixFormattingRule: shouldTryNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix\n });\n }\n}\nexport function canFormatCompleteNumber(nationalSignificantNumber, metadata) {\n return checkNumberLength(nationalSignificantNumber, metadata) === 'IS_POSSIBLE';\n}\n\nfunction formatNationalNumberWithAndWithoutNationalPrefixFormattingRule(state, format, _ref2) {\n var metadata = _ref2.metadata,\n shouldTryNationalPrefixFormattingRule = _ref2.shouldTryNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix = _ref2.getSeparatorAfterNationalPrefix; // `format` has already been checked for `nationalPrefix` requirement.\n\n var nationalSignificantNumber = state.nationalSignificantNumber,\n international = state.international,\n nationalPrefix = state.nationalPrefix,\n carrierCode = state.carrierCode; // Format the number with using `national_prefix_formatting_rule`.\n // If the resulting formatted number is a valid formatted number, then return it.\n //\n // Google's AsYouType formatter is different in a way that it doesn't try\n // to format using the \"national prefix formatting rule\", and instead it\n // simply prepends a national prefix followed by a \" \" character.\n // This code does that too, but as a fallback.\n // The reason is that \"national prefix formatting rule\" may use parentheses,\n // which wouldn't be included has it used the simpler Google's way.\n //\n\n if (shouldTryNationalPrefixFormattingRule(format)) {\n var formattedNumber = formatNationalNumber(state, format, {\n useNationalPrefixFormattingRule: true,\n getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,\n metadata: metadata\n });\n\n if (formattedNumber) {\n return formattedNumber;\n }\n } // Format the number without using `national_prefix_formatting_rule`.\n\n\n return formatNationalNumber(state, format, {\n useNationalPrefixFormattingRule: false,\n getSeparatorAfterNationalPrefix: getSeparatorAfterNationalPrefix,\n metadata: metadata\n });\n}\n\nfunction formatNationalNumber(state, format, _ref3) {\n var metadata = _ref3.metadata,\n useNationalPrefixFormattingRule = _ref3.useNationalPrefixFormattingRule,\n getSeparatorAfterNationalPrefix = _ref3.getSeparatorAfterNationalPrefix;\n var formattedNationalNumber = formatNationalNumberUsingFormat(state.nationalSignificantNumber, format, {\n carrierCode: state.carrierCode,\n useInternationalFormat: state.international,\n withNationalPrefix: useNationalPrefixFormattingRule,\n metadata: metadata\n });\n\n if (!useNationalPrefixFormattingRule) {\n if (state.nationalPrefix) {\n // If a national prefix was extracted, then just prepend it,\n // followed by a \" \" character.\n formattedNationalNumber = state.nationalPrefix + getSeparatorAfterNationalPrefix(format) + formattedNationalNumber;\n } else if (state.complexPrefixBeforeNationalSignificantNumber) {\n formattedNationalNumber = state.complexPrefixBeforeNationalSignificantNumber + ' ' + formattedNationalNumber;\n }\n }\n\n if (isValidFormattedNationalNumber(formattedNationalNumber, state)) {\n return formattedNationalNumber;\n }\n} // Check that the formatted phone number contains exactly\n// the same digits that have been input by the user.\n// For example, when \"0111523456789\" is input for `AR` country,\n// the extracted `this.nationalSignificantNumber` is \"91123456789\",\n// which means that the national part of `this.digits` isn't simply equal to\n// `this.nationalPrefix` + `this.nationalSignificantNumber`.\n//\n// Also, a `format` can add extra digits to the `this.nationalSignificantNumber`\n// being formatted via `metadata[country].national_prefix_transform_rule`.\n// For example, for `VI` country, it prepends `340` to the national number,\n// and if this check hasn't been implemented, then there would be a bug\n// when `340` \"area coude\" is \"duplicated\" during input for `VI` country:\n// https://github.com/catamphetamine/libphonenumber-js/issues/318\n//\n// So, all these \"gotchas\" are filtered out.\n//\n// In the original Google's code, the comments say:\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\nfunction isValidFormattedNationalNumber(formattedNationalNumber, state) {\n return parseDigits(formattedNationalNumber) === state.getNationalDigits();\n}","function _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport { DIGIT_PLACEHOLDER, countOccurences, repeat, cutAndStripNonPairedParens, closeNonPairedParens, stripNonPairedParens, populateTemplateWithDigits } from './AsYouTypeFormatter.util';\nimport formatCompleteNumber, { canFormatCompleteNumber } from './AsYouTypeFormatter.complete';\nimport parseDigits from './helpers/parseDigits';\nexport { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter.util';\nimport { FIRST_GROUP_PATTERN } from './helpers/formatNationalNumberUsingFormat';\nimport { VALID_PUNCTUATION } from './constants';\nimport applyInternationalSeparatorStyle from './helpers/applyInternationalSeparatorStyle'; // 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); // 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 regular expression that is used to determine if a `format` is\n// suitable to be used in the \"as you type formatter\".\n// A `format` is suitable when the resulting formatted number has\n// the same digits as the user has entered.\n//\n// In the simplest case, that would mean that the format\n// doesn't add any additional digits when formatting a number.\n// Google says that it also shouldn't add \"star\" (`*`) characters,\n// like it does in some Israeli formats.\n// Such basic format would only contain \"valid punctuation\"\n// and \"captured group\" identifiers ($1, $2, etc).\n//\n// An example of a format that adds additional digits:\n//\n// Country: `AR` (Argentina).\n// Format:\n// {\n// \"pattern\": \"(\\\\d)(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\n// \"leading_digits_patterns\": [\"91\"],\n// \"national_prefix_formatting_rule\": \"0$1\",\n// \"format\": \"$2 15-$3-$4\",\n// \"international_format\": \"$1 $2 $3-$4\"\n// }\n//\n// In the format above, the `format` adds `15` to the digits when formatting a number.\n// A sidenote: this format actually is suitable because `national_prefix_for_parsing`\n// has previously removed `15` from a national number, so re-adding `15` in `format`\n// doesn't actually result in any extra digits added to user's input.\n// But verifying that would be a complex procedure, so the code chooses a simpler path:\n// it simply filters out all `format`s that contain anything but \"captured group\" ids.\n//\n// This regular expression is called `ELIGIBLE_FORMAT_PATTERN` in Google's\n// `libphonenumber` code.\n//\n\n\nvar NON_ALTERING_FORMAT_REG_EXP = 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;\n\nvar AsYouTypeFormatter = /*#__PURE__*/function () {\n function AsYouTypeFormatter(_ref) {\n var _this = this;\n\n var state = _ref.state,\n metadata = _ref.metadata;\n\n _classCallCheck(this, AsYouTypeFormatter);\n\n _defineProperty(this, \"getSeparatorAfterNationalPrefix\", function (format) {\n // `US` metadata doesn't have a `national_prefix_formatting_rule`,\n // so the `if` condition below doesn't apply to `US`,\n // but in reality there shoudl be a separator\n // between a national prefix and a national (significant) number.\n // So `US` national prefix separator is a \"special\" \"hardcoded\" case.\n if (_this.isNANP) {\n return ' ';\n } // If a `format` has a `national_prefix_formatting_rule`\n // and that rule has a separator after a national prefix,\n // then it means that there should be a separator\n // between a national prefix and a national (significant) number.\n\n\n if (format && format.nationalPrefixFormattingRule() && NATIONAL_PREFIX_SEPARATORS_PATTERN.test(format.nationalPrefixFormattingRule())) {\n return ' ';\n } // At this point, there seems to be no clear evidence that\n // there should be a separator between a national prefix\n // and a national (significant) number. So don't insert one.\n\n\n return '';\n });\n\n _defineProperty(this, \"shouldTryNationalPrefixFormattingRule\", function (format, _ref2) {\n var international = _ref2.international,\n nationalPrefix = _ref2.nationalPrefix;\n\n if (format.nationalPrefixFormattingRule()) {\n // In some countries, `national_prefix_formatting_rule` is `($1)`,\n // so it applies even if the user hasn't input a national prefix.\n // `format.usesNationalPrefix()` detects such cases.\n var usesNationalPrefix = format.usesNationalPrefix();\n\n if (usesNationalPrefix && nationalPrefix || !usesNationalPrefix && !international) {\n return true;\n }\n }\n });\n\n this.metadata = metadata;\n this.resetFormat();\n }\n\n _createClass(AsYouTypeFormatter, [{\n key: \"resetFormat\",\n value: function resetFormat() {\n this.chosenFormat = undefined;\n this.template = undefined;\n this.nationalNumberTemplate = undefined;\n this.populatedNationalNumberTemplate = undefined;\n this.populatedNationalNumberTemplatePosition = -1;\n }\n }, {\n key: \"reset\",\n value: function reset(numberingPlan, state) {\n this.resetFormat();\n\n if (numberingPlan) {\n this.isNANP = numberingPlan.callingCode() === '1';\n this.matchingFormats = numberingPlan.formats();\n\n if (state.nationalSignificantNumber) {\n this.narrowDownMatchingFormats(state);\n }\n } else {\n this.isNANP = undefined;\n this.matchingFormats = [];\n }\n }\n }, {\n key: \"format\",\n value: function format(nextDigits, state) {\n var _this2 = this; // See if the phone number digits can be formatted as a complete phone number.\n // If not, use the results from `formatNationalNumberWithNextDigits()`,\n // which formats based on the chosen formatting pattern.\n //\n // Attempting to format complete phone number first is how it's done\n // in Google's `libphonenumber`, so this library just follows it.\n // Google's `libphonenumber` code doesn't explain in detail why does it\n // attempt to format digits as a complete phone number\n // instead of just going with a previoulsy (or newly) chosen `format`:\n //\n // \"Checks 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\n if (canFormatCompleteNumber(state.nationalSignificantNumber, this.metadata)) {\n for (var _iterator = this.matchingFormats, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref3;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref3 = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref3 = _i.value;\n }\n\n var format = _ref3;\n var formattedCompleteNumber = formatCompleteNumber(state, format, {\n metadata: this.metadata,\n shouldTryNationalPrefixFormattingRule: function shouldTryNationalPrefixFormattingRule(format) {\n return _this2.shouldTryNationalPrefixFormattingRule(format, {\n international: state.international,\n nationalPrefix: state.nationalPrefix\n });\n },\n getSeparatorAfterNationalPrefix: this.getSeparatorAfterNationalPrefix\n });\n\n if (formattedCompleteNumber) {\n this.resetFormat();\n this.chosenFormat = format;\n this.setNationalNumberTemplate(formattedCompleteNumber.replace(/\\d/g, DIGIT_PLACEHOLDER), state);\n this.populatedNationalNumberTemplate = formattedCompleteNumber; // With a new formatting template, the matched position\n // using the old template needs to be reset.\n\n this.populatedNationalNumberTemplatePosition = this.template.lastIndexOf(DIGIT_PLACEHOLDER);\n return formattedCompleteNumber;\n }\n }\n } // Format the digits as a partial (incomplete) phone number\n // using the previously chosen formatting pattern (or a newly chosen one).\n\n\n return this.formatNationalNumberWithNextDigits(nextDigits, state);\n } // Formats the next phone number digits.\n\n }, {\n key: \"formatNationalNumberWithNextDigits\",\n value: function formatNationalNumberWithNextDigits(nextDigits, state) {\n var previouslyChosenFormat = this.chosenFormat; // Choose a format from the list of matching ones.\n\n var newlyChosenFormat = this.chooseFormat(state);\n\n if (newlyChosenFormat) {\n if (newlyChosenFormat === previouslyChosenFormat) {\n // If it can format the next (current) digits\n // using the previously chosen phone number format\n // then return the updated formatted number.\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 re-format the national phone number part\n // using the newly selected format.\n return this.formatNextNationalNumberDigits(state.getNationalDigits());\n }\n }\n }\n }, {\n key: \"narrowDownMatchingFormats\",\n value: function narrowDownMatchingFormats(_ref4) {\n var _this3 = this;\n\n var nationalSignificantNumber = _ref4.nationalSignificantNumber,\n nationalPrefix = _ref4.nationalPrefix,\n international = _ref4.international;\n var leadingDigits = nationalSignificantNumber; // \"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\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 return _this3.formatSuits(format, international, nationalPrefix) && _this3.formatMatches(format, leadingDigits, leadingDigitsPatternIndex);\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: \"formatSuits\",\n value: function formatSuits(format, international, nationalPrefix) {\n // When a prefix before a national (significant) number is\n // simply a national prefix, then it's parsed as `this.nationalPrefix`.\n // In more complex cases, a prefix before national (significant) number\n // could include a national prefix as well as some \"capturing groups\",\n // and in that case there's no info whether a national prefix has been parsed.\n // If national prefix is not used when formatting a phone number\n // using this format, but a national prefix has been entered by the user,\n // and was extracted, then discard such phone number format.\n // In Google's \"AsYouType\" formatter code, the equivalent would be this part:\n // https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L175-L184\n if (nationalPrefix && !format.usesNationalPrefix() && // !format.domesticCarrierCodeFormattingRule() &&\n !format.nationalPrefixIsOptionalWhenFormattingInNationalFormat()) {\n return false;\n } // If national prefix is mandatory for this phone number format\n // and there're no guarantees that a national prefix is present in user input\n // then discard this phone number format as not suitable.\n // In Google's \"AsYouType\" formatter code, the equivalent would be this part:\n // https://github.com/google/libphonenumber/blob/0a45cfd96e71cad8edb0e162a70fcc8bd9728933/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L185-L193\n\n\n if (!international && !nationalPrefix && format.nationalPrefixIsMandatoryWhenFormattingInNationalFormat()) {\n return false;\n }\n\n return true;\n }\n }, {\n key: \"formatMatches\",\n value: function formatMatches(format, leadingDigits, leadingDigitsPatternIndex) {\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 }\n }, {\n key: \"getFormatFormat\",\n value: function getFormatFormat(format, international) {\n return international ? format.internationalFormat() : format.format();\n }\n }, {\n key: \"chooseFormat\",\n value: function chooseFormat(state) {\n var _this4 = this;\n\n var _loop2 = function _loop2() {\n if (_isArray2) {\n if (_i2 >= _iterator2.length) return \"break\";\n _ref5 = _iterator2[_i2++];\n } else {\n _i2 = _iterator2.next();\n if (_i2.done) return \"break\";\n _ref5 = _i2.value;\n }\n\n var format = _ref5; // If this format is currently being used\n // and is still suitable, then stick to it.\n\n if (_this4.chosenFormat === format) {\n return \"break\";\n } // Sometimes, a formatting rule inserts additional digits in a phone number,\n // and \"as you type\" formatter can't do that: it should only use the digits\n // that the user has input.\n //\n // For example, in Argentina, there's a format for mobile phone numbers:\n //\n // {\n // \"pattern\": \"(\\\\d)(\\\\d{2})(\\\\d{4})(\\\\d{4})\",\n // \"leading_digits_patterns\": [\"91\"],\n // \"national_prefix_formatting_rule\": \"0$1\",\n // \"format\": \"$2 15-$3-$4\",\n // \"international_format\": \"$1 $2 $3-$4\"\n // }\n //\n // In that format, `international_format` is used instead of `format`\n // because `format` inserts `15` in the formatted number,\n // and `AsYouType` formatter should only use the digits\n // the user has actually input, without adding any extra digits.\n // In this case, it wouldn't make a difference, because the `15`\n // is first stripped when applying `national_prefix_for_parsing`\n // and then re-added when using `format`, so in reality it doesn't\n // add any new digits to the number, but to detect that, the code\n // would have to be more complex: it would have to try formatting\n // the digits using the format and then see if any digits have\n // actually been added or removed, and then, every time a new digit\n // is input, it should re-check whether the chosen format doesn't\n // alter the digits.\n //\n // Google's code doesn't go that far, and so does this library:\n // it simply requires that a `format` doesn't add any additonal\n // digits to user's input.\n //\n // Also, people in general should move from inputting phone numbers\n // in national format (possibly with national prefixes)\n // and use international phone number format instead:\n // it's a logical thing in the modern age of mobile phones,\n // globalization and the internet.\n //\n\n /* istanbul ignore if */\n\n\n if (!NON_ALTERING_FORMAT_REG_EXP.test(_this4.getFormatFormat(format, state.international))) {\n return \"continue\";\n }\n\n if (!_this4.createTemplateForFormat(format, state)) {\n // Remove the format if it can't generate a template.\n _this4.matchingFormats = _this4.matchingFormats.filter(function (_) {\n return _ !== format;\n });\n return \"continue\";\n }\n\n _this4.chosenFormat = format;\n return \"break\";\n }; // When there are multiple available formats, the formatter uses the first\n // format where a formatting template could be created.\n\n\n _loop: for (var _iterator2 = this.matchingFormats.slice(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {\n var _ref5;\n\n var _ret = _loop2();\n\n switch (_ret) {\n case \"break\":\n break _loop;\n\n case \"continue\":\n continue;\n }\n }\n\n if (!this.chosenFormat) {\n // No format matches the national (significant) phone number.\n this.resetFormat();\n }\n\n return this.chosenFormat;\n }\n }, {\n key: \"createTemplateForFormat\",\n value: function createTemplateForFormat(format, state) {\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.getTemplateForFormat(format, state); // If the national number entered is too long\n // for any phone number format, then abort.\n\n if (template) {\n this.setNationalNumberTemplate(template, state);\n return true;\n }\n }\n }, {\n key: \"getInternationalPrefixBeforeCountryCallingCode\",\n value: function getInternationalPrefixBeforeCountryCallingCode(_ref6, options) {\n var IDDPrefix = _ref6.IDDPrefix,\n missingPlus = _ref6.missingPlus;\n\n if (IDDPrefix) {\n return options && options.spacing === false ? IDDPrefix : IDDPrefix + ' ';\n }\n\n if (missingPlus) {\n return '';\n }\n\n return '+';\n }\n }, {\n key: \"getTemplate\",\n value: function getTemplate(state) {\n if (!this.template) {\n return;\n } // `this.template` holds the template for a \"complete\" phone number.\n // The currently entered phone number is most likely not \"complete\",\n // so trim all non-populated digits.\n\n\n var index = -1;\n var i = 0;\n var internationalPrefix = state.international ? this.getInternationalPrefixBeforeCountryCallingCode(state, {\n spacing: false\n }) : '';\n\n while (i < internationalPrefix.length + state.getDigitsWithoutInternationalPrefix().length) {\n index = this.template.indexOf(DIGIT_PLACEHOLDER, index + 1);\n i++;\n }\n\n return cutAndStripNonPairedParens(this.template, index + 1);\n }\n }, {\n key: \"setNationalNumberTemplate\",\n value: function setNationalNumberTemplate(template, state) {\n this.nationalNumberTemplate = template;\n this.populatedNationalNumberTemplate = template; // With a new formatting template, the matched position\n // using the old template needs to be reset.\n\n this.populatedNationalNumberTemplatePosition = -1; // 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 (state.international) {\n this.template = this.getInternationalPrefixBeforeCountryCallingCode(state).replace(/[\\d\\+]/g, DIGIT_PLACEHOLDER) + repeat(DIGIT_PLACEHOLDER, state.callingCode.length) + ' ' + template;\n } else {\n this.template = template;\n }\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: \"getTemplateForFormat\",\n value: function getTemplateForFormat(format, _ref7) {\n var nationalSignificantNumber = _ref7.nationalSignificantNumber,\n international = _ref7.international,\n nationalPrefix = _ref7.nationalPrefix,\n complexPrefixBeforeNationalSignificantNumber = _ref7.complexPrefixBeforeNationalSignificantNumber;\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 (nationalSignificantNumber.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.nationalSignificantNumber : `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.nationalSignificantNumber` has already sufficient length\n // to satisfy the `pattern` completely then `this.nationalSignificantNumber`\n // is used instead of `digits`.\n\n\n var strictPattern = new RegExp('^' + pattern + '$');\n var nationalNumberDummyDigits = nationalSignificantNumber.replace(/\\d/g, DUMMY_DIGIT); // If `this.nationalSignificantNumber` 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, international);\n var nationalPrefixIncludedInTemplate; // If a user did input a national prefix (and that's guaranteed),\n // and if a `format` does have a national prefix formatting rule,\n // then see if that national prefix formatting rule\n // prepends exactly the same national prefix the user has input.\n // If that's the case, then use the `format` with the national prefix formatting rule.\n // Otherwise, use the `format` without the national prefix formatting rule,\n // and prepend a national prefix manually to it.\n\n if (this.shouldTryNationalPrefixFormattingRule(format, {\n international: international,\n nationalPrefix: nationalPrefix\n })) {\n var numberFormatWithNationalPrefix = numberFormat.replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()); // If `national_prefix_formatting_rule` of a `format` simply prepends\n // national prefix at the start of a national (significant) number,\n // then such formatting can be used with `AsYouType` formatter.\n // There seems to be no `else` case: everywhere in metadata,\n // national prefix formatting rule is national prefix + $1,\n // or `($1)`, in which case such format isn't even considered\n // when the user has input a national prefix.\n\n /* istanbul ignore else */\n\n if (parseDigits(format.nationalPrefixFormattingRule()) === (nationalPrefix || '') + parseDigits('$1')) {\n numberFormat = numberFormatWithNationalPrefix;\n nationalPrefixIncludedInTemplate = true; // Replace all digits of the national prefix in the formatting template\n // with `DIGIT_PLACEHOLDER`s.\n\n if (nationalPrefix) {\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); // If a prefix of a national (significant) number is not as simple\n // as just a basic national prefix, then just prepend such prefix\n // before the national (significant) number, optionally spacing\n // the two with a whitespace.\n\n if (!nationalPrefixIncludedInTemplate) {\n if (complexPrefixBeforeNationalSignificantNumber) {\n // Prepend the prefix to the template manually.\n template = repeat(DIGIT_PLACEHOLDER, complexPrefixBeforeNationalSignificantNumber.length) + ' ' + template;\n } else if (nationalPrefix) {\n // Prepend national prefix to the template manually.\n template = repeat(DIGIT_PLACEHOLDER, nationalPrefix.length) + this.getSeparatorAfterNationalPrefix(format) + template;\n }\n }\n\n if (international) {\n template = applyInternationalSeparatorStyle(template);\n }\n\n return template;\n }\n }, {\n key: \"formatNextNationalNumberDigits\",\n value: function formatNextNationalNumberDigits(digits) {\n var result = populateTemplateWithDigits(this.populatedNationalNumberTemplate, this.populatedNationalNumberTemplatePosition, digits);\n\n if (!result) {\n // Reset the format.\n this.resetFormat();\n return;\n }\n\n this.populatedNationalNumberTemplate = result[0];\n this.populatedNationalNumberTemplatePosition = result[1]; // Return the formatted phone number so far.\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\n return AsYouTypeFormatter;\n}();\n\nexport { AsYouTypeFormatter as default };","function _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nimport _extractCountryCallingCode from './helpers/extractCountryCallingCode';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign';\nimport extractNationalNumberFromPossiblyIncompleteNumber from './helpers/extractNationalNumberFromPossiblyIncompleteNumber';\nimport stripIddPrefix from './helpers/stripIddPrefix';\nimport parseDigits from './helpers/parseDigits';\nimport { VALID_DIGITS, VALID_PUNCTUATION, PLUS_CHARS } from './constants';\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 + ']+' + '.*' + '$'); // Tests whether `national_prefix_for_parsing` could match\n// different national prefixes.\n// Matches anything that's not a digit or a square bracket.\n\nvar COMPLEX_NATIONAL_PREFIX = /[^\\d\\[\\]]/;\n\nvar AsYouTypeParser = /*#__PURE__*/function () {\n function AsYouTypeParser(_ref) {\n var defaultCountry = _ref.defaultCountry,\n defaultCallingCode = _ref.defaultCallingCode,\n metadata = _ref.metadata,\n onNationalSignificantNumberChange = _ref.onNationalSignificantNumberChange;\n\n _classCallCheck(this, AsYouTypeParser);\n\n this.defaultCountry = defaultCountry;\n this.defaultCallingCode = defaultCallingCode;\n this.metadata = metadata;\n this.onNationalSignificantNumberChange = onNationalSignificantNumberChange;\n }\n\n _createClass(AsYouTypeParser, [{\n key: \"input\",\n value: function input(text, state) {\n var _extractFormattedDigi = extractFormattedDigitsAndPlus(text),\n _extractFormattedDigi2 = _slicedToArray(_extractFormattedDigi, 2),\n formattedDigits = _extractFormattedDigi2[0],\n hasPlus = _extractFormattedDigi2[1];\n\n var digits = parseDigits(formattedDigits); // Checks for a special case: just a leading `+` has been entered.\n\n var justLeadingPlus;\n\n if (hasPlus) {\n if (!state.digits) {\n state.startInternationalNumber();\n\n if (!digits) {\n justLeadingPlus = true;\n }\n }\n }\n\n if (digits) {\n this.inputDigits(digits, state);\n }\n\n return {\n digits: digits,\n justLeadingPlus: justLeadingPlus\n };\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, state) {\n var digits = state.digits;\n var hasReceivedThreeLeadingDigits = digits.length < 3 && digits.length + nextDigits.length >= 3; // Append phone number digits.\n\n state.appendDigits(nextDigits); // Attempt to extract IDD prefix:\n // Some users input their phone number in international format,\n // but in an \"out-of-country\" dialing format instead of using the leading `+`.\n // https://github.com/catamphetamine/libphonenumber-js/issues/185\n // Detect such numbers as soon as there're at least 3 digits.\n // Google's library attempts to extract IDD prefix at 3 digits,\n // so this library just copies that behavior.\n // I guess that's because the most commot IDD prefixes are\n // `00` (Europe) and `011` (US).\n // There exist really long IDD prefixes too:\n // for example, in Australia the default IDD prefix is `0011`,\n // and it could even be as long as `14880011`.\n // An IDD prefix is extracted here, and then every time when\n // there's a new digit and the number couldn't be formatted.\n\n if (hasReceivedThreeLeadingDigits) {\n this.extractIddPrefix(state);\n }\n\n if (this.isWaitingForCountryCallingCode(state)) {\n if (!this.extractCountryCallingCode(state)) {\n return;\n }\n } else {\n state.appendNationalSignificantNumberDigits(nextDigits);\n } // If a phone number is being input in international format,\n // then it's not valid for it to have a national prefix.\n // Still, some people incorrectly input such numbers with a national prefix.\n // In such cases, only attempt to strip a national prefix if the number becomes too long.\n // (but that is done later, not here)\n\n\n if (!state.international) {\n if (!this.hasExtractedNationalSignificantNumber) {\n this.extractNationalSignificantNumber(state.getNationalDigits(), state.update);\n }\n }\n }\n }, {\n key: \"isWaitingForCountryCallingCode\",\n value: function isWaitingForCountryCallingCode(_ref2) {\n var international = _ref2.international,\n callingCode = _ref2.callingCode;\n return international && !callingCode;\n } // Extracts a country calling code from a number\n // being entered in internatonal format.\n\n }, {\n key: \"extractCountryCallingCode\",\n value: function extractCountryCallingCode(state) {\n var _extractCountryCallin = _extractCountryCallingCode('+' + state.getDigitsWithoutInternationalPrefix(), this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n number = _extractCountryCallin.number;\n\n if (countryCallingCode) {\n state.setCallingCode(countryCallingCode);\n state.update({\n nationalSignificantNumber: number\n });\n return true;\n }\n }\n }, {\n key: \"reset\",\n value: function reset(numberingPlan) {\n if (numberingPlan) {\n this.hasSelectedNumberingPlan = true;\n\n var nationalPrefixForParsing = numberingPlan._nationalPrefixForParsing();\n\n this.couldPossiblyExtractAnotherNationalSignificantNumber = nationalPrefixForParsing && COMPLEX_NATIONAL_PREFIX.test(nationalPrefixForParsing);\n } else {\n this.hasSelectedNumberingPlan = undefined;\n this.couldPossiblyExtractAnotherNationalSignificantNumber = undefined;\n }\n }\n /**\r\n * Extracts a national (significant) number from user input.\r\n * Google's library is different in that it only applies `national_prefix_for_parsing`\r\n * and doesn't apply `national_prefix_transform_rule` after that.\r\n * https://github.com/google/libphonenumber/blob/a3d70b0487875475e6ad659af404943211d26456/java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java#L539\r\n * @return {boolean} [extracted]\r\n */\n\n }, {\n key: \"extractNationalSignificantNumber\",\n value: function extractNationalSignificantNumber(nationalDigits, setState) {\n if (!this.hasSelectedNumberingPlan) {\n return;\n }\n\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),\n nationalPrefix = _extractNationalNumbe.nationalPrefix,\n nationalNumber = _extractNationalNumbe.nationalNumber,\n carrierCode = _extractNationalNumbe.carrierCode;\n\n if (nationalNumber === nationalDigits) {\n return;\n }\n\n this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);\n return true;\n }\n /**\r\n * In Google's code this function is called \"attempt to extract longer NDD\".\r\n * \"Some national prefixes are a substring of others\", they say.\r\n * @return {boolean} [result] — Returns `true` if extracting a national prefix produced different results from what they were.\r\n */\n\n }, {\n key: \"extractAnotherNationalSignificantNumber\",\n value: function extractAnotherNationalSignificantNumber(nationalDigits, prevNationalSignificantNumber, setState) {\n if (!this.hasExtractedNationalSignificantNumber) {\n return this.extractNationalSignificantNumber(nationalDigits, setState);\n }\n\n if (!this.couldPossiblyExtractAnotherNationalSignificantNumber) {\n return;\n }\n\n var _extractNationalNumbe2 = extractNationalNumberFromPossiblyIncompleteNumber(nationalDigits, this.metadata),\n nationalPrefix = _extractNationalNumbe2.nationalPrefix,\n nationalNumber = _extractNationalNumbe2.nationalNumber,\n carrierCode = _extractNationalNumbe2.carrierCode; // If a national prefix has been extracted previously,\n // then it's always extracted as additional digits are added.\n // That's assuming `extractNationalNumberFromPossiblyIncompleteNumber()`\n // doesn't do anything different from what it currently does.\n // So, just in case, here's this check, though it doesn't occur.\n\n /* istanbul ignore if */\n\n\n if (nationalNumber === prevNationalSignificantNumber) {\n return;\n }\n\n this.onExtractedNationalNumber(nationalPrefix, carrierCode, nationalNumber, nationalDigits, setState);\n return true;\n }\n }, {\n key: \"onExtractedNationalNumber\",\n value: function onExtractedNationalNumber(nationalPrefix, carrierCode, nationalSignificantNumber, nationalDigits, setState) {\n var complexPrefixBeforeNationalSignificantNumber;\n var nationalSignificantNumberMatchesInput; // This check also works with empty `this.nationalSignificantNumber`.\n\n var nationalSignificantNumberIndex = nationalDigits.lastIndexOf(nationalSignificantNumber); // If the extracted national (significant) number is the\n // last substring of the `digits`, then it means that it hasn't been altered:\n // no digits have been removed from the national (significant) number\n // while applying `national_prefix_transform_rule`.\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule\n\n if (nationalSignificantNumberIndex >= 0 && nationalSignificantNumberIndex === nationalDigits.length - nationalSignificantNumber.length) {\n nationalSignificantNumberMatchesInput = true; // If a prefix of a national (significant) number is not as simple\n // as just a basic national prefix, then such prefix is stored in\n // `this.complexPrefixBeforeNationalSignificantNumber` property and will be\n // prepended \"as is\" to the national (significant) number to produce\n // a formatted result.\n\n var prefixBeforeNationalNumber = nationalDigits.slice(0, nationalSignificantNumberIndex); // `prefixBeforeNationalNumber` is always non-empty,\n // because `onExtractedNationalNumber()` isn't called\n // when a national (significant) number hasn't been actually \"extracted\":\n // when a national (significant) number is equal to the national part of `digits`,\n // then `onExtractedNationalNumber()` doesn't get called.\n\n if (prefixBeforeNationalNumber !== nationalPrefix) {\n complexPrefixBeforeNationalSignificantNumber = prefixBeforeNationalNumber;\n }\n }\n\n setState({\n nationalPrefix: nationalPrefix,\n carrierCode: carrierCode,\n nationalSignificantNumber: nationalSignificantNumber,\n nationalSignificantNumberMatchesInput: nationalSignificantNumberMatchesInput,\n complexPrefixBeforeNationalSignificantNumber: complexPrefixBeforeNationalSignificantNumber\n }); // `onExtractedNationalNumber()` is only called when\n // the national (significant) number actually did change.\n\n this.hasExtractedNationalSignificantNumber = true;\n this.onNationalSignificantNumberChange();\n }\n }, {\n key: \"reExtractNationalSignificantNumber\",\n value: function reExtractNationalSignificantNumber(state) {\n // Attempt to extract a national prefix.\n //\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 //\n // Also, in some rare cases, it is valid for a national prefix\n // to be a part of an international phone number.\n // For example, mobile phone numbers in Mexico are supposed to be\n // dialled internationally using a `1` national prefix,\n // so the national prefix will be part of an international number.\n //\n // Quote from:\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 // Google's demo output:\n // https://libphonenumber.appspot.com/phonenumberparser?number=%2b5215512345678&country=MX\n //\n if (this.extractAnotherNationalSignificantNumber(state.getNationalDigits(), state.nationalSignificantNumber, state.update)) {\n return true;\n } // If no format matches the phone number, then it could be\n // \"a really long IDD\" (quote from a comment in Google's library).\n // An IDD prefix is first extracted when the user has entered at least 3 digits,\n // and then here — every time when there's a new digit and the number\n // couldn't be formatted.\n // For example, in Australia the default IDD prefix is `0011`,\n // and it could even be as long as `14880011`.\n //\n // Could also check `!hasReceivedThreeLeadingDigits` here\n // to filter out the case when this check duplicates the one\n // already performed when there're 3 leading digits,\n // but it's not a big deal, and in most cases there\n // will be a suitable `format` when there're 3 leading digits.\n //\n\n\n if (this.extractIddPrefix(state)) {\n this.extractCallingCodeAndNationalSignificantNumber(state);\n return true;\n } // Google's AsYouType formatter supports sort of an \"autocorrection\" feature\n // when it \"autocorrects\" numbers that have been input for a country\n // with that country's calling code.\n // Such \"autocorrection\" feature looks weird, but different people have been requesting it:\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n // https://github.com/catamphetamine/libphonenumber-js/issues/375\n // https://github.com/catamphetamine/libphonenumber-js/issues/316\n\n\n if (this.fixMissingPlus(state)) {\n this.extractCallingCodeAndNationalSignificantNumber(state);\n return true;\n }\n }\n }, {\n key: \"extractIddPrefix\",\n value: function extractIddPrefix(state) {\n // An IDD prefix can't be present in a number written with a `+`.\n // Also, don't re-extract an IDD prefix if has already been extracted.\n var international = state.international,\n IDDPrefix = state.IDDPrefix,\n digits = state.digits,\n nationalSignificantNumber = state.nationalSignificantNumber;\n\n if (international || IDDPrefix) {\n return;\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\n\n var numberWithoutIDD = stripIddPrefix(digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata);\n\n if (numberWithoutIDD !== undefined && numberWithoutIDD !== digits) {\n // If an IDD prefix was stripped then convert the IDD-prefixed number\n // to international number for subsequent parsing.\n state.update({\n IDDPrefix: digits.slice(0, digits.length - numberWithoutIDD.length)\n });\n this.startInternationalNumber(state);\n return true;\n }\n }\n }, {\n key: \"fixMissingPlus\",\n value: function fixMissingPlus(state) {\n if (!state.international) {\n var _extractCountryCallin2 = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(state.digits, this.defaultCountry, this.defaultCallingCode, this.metadata.metadata),\n newCallingCode = _extractCountryCallin2.countryCallingCode,\n number = _extractCountryCallin2.number;\n\n if (newCallingCode) {\n state.update({\n missingPlus: true\n });\n this.startInternationalNumber(state);\n return true;\n }\n }\n }\n }, {\n key: \"startInternationalNumber\",\n value: function startInternationalNumber(state) {\n state.startInternationalNumber(); // If a national (significant) number has been extracted before, reset it.\n\n if (state.nationalSignificantNumber) {\n state.resetNationalSignificantNumber();\n this.onNationalSignificantNumberChange();\n this.hasExtractedNationalSignificantNumber = undefined;\n }\n }\n }, {\n key: \"extractCallingCodeAndNationalSignificantNumber\",\n value: function extractCallingCodeAndNationalSignificantNumber(state) {\n if (this.extractCountryCallingCode(state)) {\n // `this.extractCallingCode()` is currently called when the number\n // couldn't be formatted during the standard procedure.\n // Normally, the national prefix would be re-extracted\n // for an international number if such number couldn't be formatted,\n // but since it's already not able to be formatted,\n // there won't be yet another retry, so also extract national prefix here.\n this.extractNationalSignificantNumber(state.getNationalDigits(), state.update);\n }\n }\n }]);\n\n return AsYouTypeParser;\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\n\nexport { AsYouTypeParser as default };\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/**\r\n * Extracts formatted phone number digits (and a `+`) from text (if there're any).\r\n * @param {string} text\r\n * @return {any[]}\r\n */\n\n\nfunction _extractFormattedDigitsAndPlus(text) {\n // Extract a formatted phone number part from text.\n var extractedNumber = extractFormattedPhoneNumber(text) || ''; // Trim a `+`.\n\n if (extractedNumber[0] === '+') {\n return [extractedNumber.slice('+'.length), true];\n }\n\n return [extractedNumber];\n}\n/**\r\n * Extracts formatted phone number digits (and a `+`) from text (if there're any).\r\n * @param {string} text\r\n * @return {any[]}\r\n */\n\n\nexport function extractFormattedDigitsAndPlus(text) {\n var _extractFormattedDigi3 = _extractFormattedDigitsAndPlus(text),\n _extractFormattedDigi4 = _slicedToArray(_extractFormattedDigi3, 2),\n formattedDigits = _extractFormattedDigi4[0],\n hasPlus = _extractFormattedDigi4[1]; // 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\n if (!VALID_FORMATTED_PHONE_NUMBER_PART_PATTERN.test(formattedDigits)) {\n formattedDigits = '';\n }\n\n return [formattedDigits, hasPlus];\n}","function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction _slicedToArray(arr, i) {\n return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();\n}\n\nfunction _nonIterableRest() {\n throw new TypeError(\"Invalid attempt to destructure non-iterable instance\");\n}\n\nfunction _iterableToArrayLimit(arr, i) {\n var _arr = [];\n var _n = true;\n var _d = false;\n var _e = undefined;\n\n try {\n for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {\n _arr.push(_s.value);\n\n if (i && _arr.length === i) break;\n }\n } catch (err) {\n _d = true;\n _e = err;\n } finally {\n try {\n if (!_n && _i[\"return\"] != null) _i[\"return\"]();\n } finally {\n if (_d) throw _e;\n }\n }\n\n return _arr;\n}\n\nfunction _arrayWithHoles(arr) {\n if (Array.isArray(arr)) return arr;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nimport Metadata from './metadata';\nimport PhoneNumber from './PhoneNumber';\nimport AsYouTypeState from './AsYouTypeState';\nimport AsYouTypeFormatter, { DIGIT_PLACEHOLDER } from './AsYouTypeFormatter';\nimport AsYouTypeParser, { extractFormattedDigitsAndPlus } from './AsYouTypeParser';\nimport getCountryByCallingCode from './helpers/getCountryByCallingCode';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\nvar AsYouType = /*#__PURE__*/function () {\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 this.metadata = new Metadata(metadata);\n\n var _this$getCountryAndCa = this.getCountryAndCallingCode(optionsOrDefaultCountry),\n _this$getCountryAndCa2 = _slicedToArray(_this$getCountryAndCa, 2),\n defaultCountry = _this$getCountryAndCa2[0],\n defaultCallingCode = _this$getCountryAndCa2[1];\n\n this.defaultCountry = defaultCountry;\n this.defaultCallingCode = defaultCallingCode;\n this.reset();\n }\n\n _createClass(AsYouType, [{\n key: \"getCountryAndCallingCode\",\n value: function getCountryAndCallingCode(optionsOrDefaultCountry) {\n // Set `defaultCountry` and `defaultCallingCode` options.\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 defaultCountry = undefined;\n }\n\n if (defaultCallingCode) {\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (this.metadata.isNonGeographicCallingCode(defaultCallingCode)) {\n defaultCountry = '001';\n }\n }\n }\n\n return [defaultCountry, defaultCallingCode];\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 _this$parser$input = this.parser.input(text, this.state),\n digits = _this$parser$input.digits,\n justLeadingPlus = _this$parser$input.justLeadingPlus;\n\n if (justLeadingPlus) {\n this.formattedOutput = '+';\n } else if (digits) {\n this.determineTheCountryIfNeeded(); // Match the available formats by the currently available leading digits.\n\n if (this.state.nationalSignificantNumber) {\n this.formatter.narrowDownMatchingFormats(this.state);\n }\n\n var formattedNationalNumber;\n\n if (this.metadata.hasSelectedNumberingPlan()) {\n formattedNationalNumber = this.formatter.format(digits, this.state);\n }\n\n if (formattedNationalNumber === undefined) {\n // See if another national (significant) number could be re-extracted.\n if (this.parser.reExtractNationalSignificantNumber(this.state)) {\n this.determineTheCountryIfNeeded(); // If it could, then re-try formatting the new national (significant) number.\n\n var nationalDigits = this.state.getNationalDigits();\n\n if (nationalDigits) {\n formattedNationalNumber = this.formatter.format(nationalDigits, this.state);\n }\n }\n }\n\n this.formattedOutput = formattedNationalNumber ? this.getFullNumber(formattedNationalNumber) : this.getNonFormattedNumber();\n }\n\n return this.formattedOutput;\n }\n }, {\n key: \"reset\",\n value: function reset() {\n var _this = this;\n\n this.state = new AsYouTypeState({\n onCountryChange: function onCountryChange(country) {\n // Before version `1.6.0`, the official `AsYouType` formatter API\n // included the `.country` property of an `AsYouType` instance.\n // Since that property (along with the others) have been moved to\n // `this.state`, `this.country` property is emulated for compatibility\n // with the old versions.\n _this.country = country;\n },\n onCallingCodeChange: function onCallingCodeChange(country, callingCode) {\n _this.metadata.selectNumberingPlan(country, callingCode);\n\n _this.formatter.reset(_this.metadata.numberingPlan, _this.state);\n\n _this.parser.reset(_this.metadata.numberingPlan);\n }\n });\n this.formatter = new AsYouTypeFormatter({\n state: this.state,\n metadata: this.metadata\n });\n this.parser = new AsYouTypeParser({\n defaultCountry: this.defaultCountry,\n defaultCallingCode: this.defaultCallingCode,\n metadata: this.metadata,\n state: this.state,\n onNationalSignificantNumberChange: function onNationalSignificantNumberChange() {\n _this.determineTheCountryIfNeeded();\n\n _this.formatter.reset(_this.metadata.numberingPlan, _this.state);\n }\n });\n this.state.reset(this.defaultCountry, this.defaultCallingCode);\n this.formattedOutput = '';\n return this;\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.state.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} [callingCode]\r\n */\n\n }, {\n key: \"getCallingCode\",\n value: function getCallingCode() {\n return this.state.callingCode;\n } // A legacy alias.\n\n }, {\n key: \"getCountryCallingCode\",\n value: function getCountryCallingCode() {\n return this.getCallingCode();\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 var _this$state = this.state,\n digits = _this$state.digits,\n country = _this$state.country; // If no digits have been input yet,\n // then `this.country` is the `defaultCountry`.\n // Won't return the `defaultCountry` in such case.\n\n if (!digits) {\n return;\n }\n\n var countryCode = country;\n /* istanbul ignore if */\n\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n // `AsYouType.getCountry()` returns `undefined`\n // for \"non-geographic\" phone numbering plans.\n if (countryCode === '001') {\n countryCode = undefined;\n }\n }\n\n return countryCode;\n }\n }, {\n key: \"determineTheCountryIfNeeded\",\n value: function determineTheCountryIfNeeded() {\n // Suppose a user enters a phone number in international format,\n // and there're several countries corresponding to that country calling code,\n // and a country has been derived from the number, and then\n // a user enters one more digit and the number is no longer\n // valid for the derived country, so the country should be re-derived\n // on every new digit in those cases.\n //\n // If the phone number is being input in national format,\n // then it could be a case when `defaultCountry` wasn't specified\n // when creating `AsYouType` instance, and just `defaultCallingCode` was specified,\n // and that \"calling code\" could correspond to a \"non-geographic entity\",\n // or there could be several countries corresponding to that country calling code.\n // In those cases, `this.country` is `undefined` and should be derived\n // from the number. Again, if country calling code is ambiguous, then\n // `this.country` should be re-derived with each new digit.\n //\n if (!this.state.country || this.isCountryCallingCodeAmbiguous()) {\n this.determineTheCountry();\n }\n } // Prepends `+CountryCode ` in case of an international phone number\n\n }, {\n key: \"getFullNumber\",\n value: function getFullNumber(formattedNationalNumber) {\n var _this2 = this;\n\n if (this.isInternational()) {\n var prefix = function prefix(text) {\n return _this2.formatter.getInternationalPrefixBeforeCountryCallingCode(_this2.state, {\n spacing: text ? true : false\n }) + text;\n };\n\n var callingCode = this.state.callingCode;\n\n if (!callingCode) {\n return prefix(\"\".concat(this.state.getDigitsWithoutInternationalPrefix()));\n }\n\n if (!formattedNationalNumber) {\n return prefix(callingCode);\n }\n\n return prefix(\"\".concat(callingCode, \" \").concat(formattedNationalNumber));\n }\n\n return formattedNationalNumber;\n }\n }, {\n key: \"getNonFormattedNationalNumberWithPrefix\",\n value: function getNonFormattedNationalNumberWithPrefix() {\n var _this$state2 = this.state,\n nationalSignificantNumber = _this$state2.nationalSignificantNumber,\n complexPrefixBeforeNationalSignificantNumber = _this$state2.complexPrefixBeforeNationalSignificantNumber,\n nationalPrefix = _this$state2.nationalPrefix;\n var number = nationalSignificantNumber;\n var prefix = complexPrefixBeforeNationalSignificantNumber || nationalPrefix;\n\n if (prefix) {\n number = prefix + number;\n }\n\n return number;\n }\n }, {\n key: \"getNonFormattedNumber\",\n value: function getNonFormattedNumber() {\n var nationalSignificantNumberMatchesInput = this.state.nationalSignificantNumberMatchesInput;\n return this.getFullNumber(nationalSignificantNumberMatchesInput ? this.getNonFormattedNationalNumberWithPrefix() : this.state.getNationalDigits());\n }\n }, {\n key: \"getNonFormattedTemplate\",\n value: function getNonFormattedTemplate() {\n var number = this.getNonFormattedNumber();\n\n if (number) {\n return number.replace(/[\\+\\d]/g, DIGIT_PLACEHOLDER);\n }\n }\n }, {\n key: \"isCountryCallingCodeAmbiguous\",\n value: function isCountryCallingCodeAmbiguous() {\n var callingCode = this.state.callingCode;\n var countryCodes = this.metadata.getCountryCodesForCallingCode(callingCode);\n return countryCodes && countryCodes.length > 1;\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.state.setCountry(getCountryByCallingCode(this.isInternational() ? this.state.callingCode : this.defaultCallingCode, this.state.nationalSignificantNumber, 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 var _this$state3 = this.state,\n nationalSignificantNumber = _this$state3.nationalSignificantNumber,\n carrierCode = _this$state3.carrierCode;\n\n if (this.isInternational()) {\n if (!this.state.callingCode) {\n return;\n }\n } else {\n if (!this.state.country && !this.defaultCallingCode) {\n return;\n }\n }\n\n if (!nationalSignificantNumber) {\n return;\n }\n\n var countryCode = this.getCountry();\n var callingCode = this.getCountryCallingCode() || this.defaultCallingCode;\n var phoneNumber = new PhoneNumber(countryCode || callingCode, nationalSignificantNumber, 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.state.nationalSignificantNumber;\n }\n /**\r\n * Returns the phone number characters entered by the user.\r\n * @return {string}\r\n */\n\n }, {\n key: \"getChars\",\n value: function getChars() {\n return (this.state.international ? '+' : '') + this.state.digits;\n }\n /**\r\n * Returns the template for the formatted phone number.\r\n * @return {string}\r\n */\n\n }, {\n key: \"getTemplate\",\n value: function getTemplate() {\n return this.formatter.getTemplate(this.state) || this.getNonFormattedTemplate() || '';\n }\n }]);\n\n return AsYouType;\n}();\n\nexport { AsYouType as default };","import { getCountryCallingCode } from 'libphonenumber-js/core';\nexport function getInputValuePrefix(_ref) {\n var country = _ref.country,\n international = _ref.international,\n withCountryCallingCode = _ref.withCountryCallingCode,\n metadata = _ref.metadata;\n return country && international && !withCountryCallingCode ? \"+\".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}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React, { useCallback } from 'react';\nimport Input from 'input-format/react';\nimport { AsYouType, parsePhoneNumberCharacter } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './helpers/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 withCountryCallingCode = _ref.withCountryCallingCode,\n metadata = _ref.metadata,\n rest = _objectWithoutProperties(_ref, [\"country\", \"international\", \"withCountryCallingCode\", \"metadata\"]);\n\n var format = useCallback(function (value) {\n // \"As you type\" formatter.\n var formatter = new AsYouType(country, metadata);\n var prefix = getInputValuePrefix({\n country: country,\n international: international,\n withCountryCallingCode: withCountryCallingCode,\n metadata: metadata\n }); // 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.defaultProps = {\n metadata: defaultMetadata\n };\n return InputSmart;\n}\nexport default createInput();","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React, { useCallback } from 'react';\nimport { parseIncompletePhoneNumber, formatIncompletePhoneNumber } from 'libphonenumber-js/core';\nimport { getInputValuePrefix, removeInputValuePrefix } from './helpers/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 withCountryCallingCode = _ref.withCountryCallingCode,\n metadata = _ref.metadata,\n Input = _ref.inputComponent,\n rest = _objectWithoutProperties(_ref, [\"value\", \"onChange\", \"country\", \"international\", \"withCountryCallingCode\", \"metadata\", \"inputComponent\"]);\n\n var prefix = getInputValuePrefix({\n country: country,\n international: international,\n withCountryCallingCode: withCountryCallingCode,\n metadata: metadata\n });\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.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}","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}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React from 'react';\nimport classNames from 'classnames'; // Default country flag icon.\n// `` is wrapped in a `
` to prevent SVGs from exploding in size in IE 11.\n// https://github.com/catamphetamine/react-phone-number-input/issues/111\n\nexport default function FlagComponent(_ref) {\n var country = _ref.country,\n countryName = _ref.countryName,\n flags = _ref.flags,\n flagUrl = _ref.flagUrl,\n rest = _objectWithoutProperties(_ref, [\"country\", \"countryName\", \"flags\", \"flagUrl\"]);\n\n if (flags && flags[country]) {\n return flags[country]({\n title: countryName\n });\n }\n\n return React.createElement(\"img\", _extends({}, rest, {\n alt: countryName,\n role: countryName ? undefined : \"presentation\",\n src: flagUrl.replace('{XX}', country).replace('{xx}', country.toLowerCase())\n }));\n}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React from 'react';\nexport default function InternationalIcon(_ref) {\n var aspectRatio = _ref.aspectRatio,\n rest = _objectWithoutProperties(_ref, [\"aspectRatio\"]);\n\n if (aspectRatio === 1) {\n return React.createElement(InternationalIcon1x1, rest);\n } else {\n return React.createElement(InternationalIcon3x2, rest);\n }\n}\n\n// 3x2.\n// Using `` in `<svg/>`s:\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\nfunction InternationalIcon3x2(_ref2) {\n var title = _ref2.title,\n rest = _objectWithoutProperties(_ref2, [\"title\"]);\n\n return React.createElement(\"svg\", _extends({}, rest, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 75 50\"\n }), React.createElement(\"title\", null, title), React.createElement(\"g\", {\n className: \"PhoneInputInternationalIconGlobe\",\n stroke: \"currentColor\",\n fill: \"none\",\n strokeWidth: \"2\",\n strokeMiterlimit: \"10\"\n }, React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M47.2,36.1C48.1,36,49,36,50,36c7.4,0,14,1.7,18.5,4.3\"\n }), React.createElement(\"path\", {\n d: \"M68.6,9.6C64.2,12.3,57.5,14,50,14c-7.4,0-14-1.7-18.5-4.3\"\n }), React.createElement(\"line\", {\n x1: \"26\",\n y1: \"25\",\n x2: \"74\",\n y2: \"25\"\n }), React.createElement(\"line\", {\n x1: \"50\",\n y1: \"1\",\n x2: \"50\",\n y2: \"49\"\n }), React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M46.3,48.7c1.2,0.2,2.5,0.3,3.7,0.3c13.3,0,24-10.7,24-24S63.3,1,50,1S26,11.7,26,25c0,2,0.3,3.9,0.7,5.8\"\n }), React.createElement(\"path\", {\n strokeLinecap: \"round\",\n d: \"M46.8,48.2c1,0.6,2.1,0.8,3.2,0.8c6.6,0,12-10.7,12-24S56.6,1,50,1S38,11.7,38,25c0,1.4,0.1,2.7,0.2,4c0,0.1,0,0.2,0,0.2\"\n })), React.createElement(\"path\", {\n className: \"PhoneInputInternationalIconPhone\",\n stroke: \"none\",\n fill: \"currentColor\",\n d: \"M12.4,17.9c2.9-2.9,5.4-4.8,0.3-11.2S4.1,5.2,1.3,8.1C-2,11.4,1.1,23.5,13.1,35.6s24.3,15.2,27.5,11.9c2.8-2.8,7.8-6.3,1.4-11.5s-8.3-2.6-11.2,0.3c-2,2-7.2-2.2-11.7-6.7S10.4,19.9,12.4,17.9z\"\n }));\n}\n\n// 1x1.\n// Using `<title/>` in `<svg/>`s:\n// https://developer.mozilla.org/en-US/docs/Web/SVG/Element/title\nfunction InternationalIcon1x1(_ref3) {\n var title = _ref3.title,\n rest = _objectWithoutProperties(_ref3, [\"title\"]);\n\n return React.createElement(\"svg\", _extends({}, rest, {\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: \"0 0 50 50\"\n }), React.createElement(\"title\", null, title), React.createElement(\"g\", {\n className: \"PhoneInputInternationalIconGlobe\",\n stroke: \"currentColor\",\n fill: \"none\",\n strokeWidth: \"2\",\n strokeLinecap: \"round\"\n }, React.createElement(\"path\", {\n d: \"M8.45,13A21.44,21.44,0,1,1,37.08,41.56\"\n }), React.createElement(\"path\", {\n d: \"M19.36,35.47a36.9,36.9,0,0,1-2.28-13.24C17.08,10.39,21.88.85,27.8.85s10.72,9.54,10.72,21.38c0,6.48-1.44,12.28-3.71,16.21\"\n }), React.createElement(\"path\", {\n d: \"M17.41,33.4A39,39,0,0,1,27.8,32.06c6.62,0,12.55,1.5,16.48,3.86\"\n }), React.createElement(\"path\", {\n d: \"M44.29,8.53c-3.93,2.37-9.86,3.88-16.49,3.88S15.25,10.9,11.31,8.54\"\n }), React.createElement(\"line\", {\n x1: \"27.8\",\n y1: \"0.85\",\n x2: \"27.8\",\n y2: \"34.61\"\n }), React.createElement(\"line\", {\n x1: \"15.2\",\n y1: \"22.23\",\n x2: \"49.15\",\n y2: \"22.23\"\n })), React.createElement(\"path\", {\n className: \"PhoneInputInternationalIconPhone\",\n stroke: \"transparent\",\n fill: \"currentColor\",\n d: \"M9.42,26.64c2.22-2.22,4.15-3.59.22-8.49S3.08,17,.93,19.17c-2.49,2.48-.13,11.74,9,20.89s18.41,11.5,20.89,9c2.15-2.15,5.91-4.77,1-8.71s-6.27-2-8.49.22c-1.55,1.55-5.48-1.69-8.86-5.08S7.87,28.19,9.42,26.64Z\"\n }));\n}","import { isSupportedCountry } from 'libphonenumber-js/core';\nexport { getCountries } from 'libphonenumber-js/core';\n/**\r\n * Sorts country `<select/>` options.\r\n * Can move some country `<select/>` options\r\n * to the top of the list, for example.\r\n * @param {object[]} countryOptions — Country `<select/>` options.\r\n * @param {string[]} [countryOptionsOrder] — Country `<select/>` options order. Example: `[\"US\", \"CA\", \"AU\", \"|\", \"...\"]`.\r\n * @return {object[]}\r\n */\n\nexport function sortCountryOptions(options, order) {\n if (!order) {\n return options;\n }\n\n var optionsOnTop = [];\n var optionsOnBottom = [];\n var appendTo = optionsOnTop;\n\n for (var _iterator = order, _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 (element === '|') {\n appendTo.push({\n divider: true\n });\n } else if (element === '...' || element === '…') {\n appendTo = optionsOnBottom;\n } else {\n (function () {\n var countryCode = void 0;\n\n if (element === '🌐') {\n countryCode = undefined;\n } else {\n countryCode = element;\n } // Find the position of the option.\n\n\n var index = options.indexOf(options.filter(function (option) {\n return option.value === countryCode;\n })[0]); // Get the option.\n\n var option = options[index]; // Remove the option from its default position.\n\n options.splice(index, 1); // Add the option on top.\n\n appendTo.push(option);\n })();\n }\n }\n\n return optionsOnTop.concat(options).concat(optionsOnBottom);\n}\nexport function getSupportedCountryOptions(countryOptions, metadata) {\n if (countryOptions) {\n countryOptions = countryOptions.filter(function (option) {\n switch (option) {\n case '🌐':\n case '|':\n case '...':\n case '…':\n return true;\n\n default:\n return isCountrySupportedWithError(option, metadata);\n }\n });\n\n if (countryOptions.length > 0) {\n return countryOptions;\n }\n }\n}\nexport function isCountrySupportedWithError(country, metadata) {\n if (isSupportedCountry(country, metadata)) {\n return true;\n } else {\n console.error(\"Country not found: \".concat(country));\n return false;\n }\n}\nexport function getSupportedCountries(countries, metadata) {\n if (countries) {\n countries = countries.filter(function (country) {\n return isCountrySupportedWithError(country, metadata);\n });\n\n if (countries.length === 0) {\n countries = undefined;\n }\n }\n\n return countries;\n}","import React from 'react';\nimport classNames from 'classnames';\nimport DefaultInternationalIcon from './InternationalIcon';\nimport Flag from './Flag';\nexport function createCountryIconComponent(_ref) {\n var flags = _ref.flags,\n flagUrl = _ref.flagUrl,\n FlagComponent = _ref.flagComponent,\n InternationalIcon = _ref.internationalIcon;\n\n function CountryIcon(_ref2) {\n var country = _ref2.country,\n label = _ref2.label,\n aspectRatio = _ref2.aspectRatio; // `aspectRatio` is currently a hack for the default \"International\" icon\n // to render it as a square when Unicode flag icons are used.\n // So `aspectRatio` property is only used with the default \"International\" icon.\n\n var _aspectRatio = InternationalIcon === DefaultInternationalIcon ? aspectRatio : undefined;\n\n return React.createElement(\"div\", {\n className: classNames('PhoneInputCountryIcon', {\n 'PhoneInputCountryIcon--square': _aspectRatio === 1,\n 'PhoneInputCountryIcon--border': country\n })\n }, country ? React.createElement(FlagComponent, {\n country: country,\n countryName: label,\n flags: flags,\n flagUrl: flagUrl,\n className: \"PhoneInputCountryIconImg\"\n }) : React.createElement(InternationalIcon, {\n title: label,\n aspectRatio: _aspectRatio,\n className: \"PhoneInputCountryIconImg\"\n }));\n }\n\n return CountryIcon;\n}\nexport default createCountryIconComponent({\n // Must be equal to `defaultProps.flagUrl` in `./PhoneInputWithCountry.js`.\n flagUrl: 'https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg',\n flagComponent: Flag,\n internationalIcon: DefaultInternationalIcon\n});","import { getCountryCallingCode, Metadata } from 'libphonenumber-js/core';\nvar ONLY_DIGITS_REGEXP = /^\\d+$/;\nexport default function getInternationalPhoneNumberPrefix(country, metadata) {\n // Standard international phone number prefix: \"+\" and \"country calling code\".\n var prefix = '+' + getCountryCallingCode(country, metadata); // Get \"leading digits\" for a phone number of the country.\n // If there're \"leading digits\" then they can be part of the prefix too.\n\n metadata = new Metadata(metadata);\n metadata.country(country);\n\n if (metadata.numberingPlan.leadingDigits() && ONLY_DIGITS_REGEXP.test(metadata.numberingPlan.leadingDigits())) {\n prefix += metadata.numberingPlan.leadingDigits();\n }\n\n return prefix;\n}","import { parsePhoneNumberFromString, getCountryCallingCode, AsYouType, Metadata } from 'libphonenumber-js/core';\nimport getInternationalPhoneNumberPrefix from './getInternationalPhoneNumberPrefix';\n/**\r\n * Decides which country should be pre-selected\r\n * when the phone number input component is first mounted.\r\n * @param {object?} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {string?} country - Pre-defined country (two-letter code).\r\n * @param {string[]?} countries - A list of countries available.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string?}\r\n */\n\nexport function getPreSelectedCountry(_ref) {\n var phoneNumber = _ref.phoneNumber,\n defaultCountry = _ref.defaultCountry,\n countries = _ref.countries,\n required = _ref.required,\n metadata = _ref.metadata;\n var country = defaultCountry; // If can get country from E.164 phone number\n // then it overrides the `country` passed (or not passed).\n\n if (phoneNumber && phoneNumber.country) {\n // `country` will be left `undefined` in case of non-detection.\n country = phoneNumber.country;\n } // Only pre-select a country if it's in the available `countries` list.\n\n\n if (countries && countries.indexOf(country) < 0) {\n country = undefined;\n } // If there will be no \"International\" option\n // then some `country` must be selected.\n // It will still be the wrong country though.\n // But still country `<select/>` can't be left in a broken state.\n\n\n if (!country && required && countries && countries.length > 0) {\n country = countries[0];\n }\n\n return country;\n}\n/**\r\n * Generates a sorted list of country `<select/>` options.\r\n * @param {string[]} countries - A list of two-letter (\"ISO 3166-1 alpha-2\") country codes.\r\n * @param {object} labels - Custom country labels. E.g. `{ RU: 'Россия', US: 'США', ... }`.\r\n * @param {boolean} addInternationalOption - Whether should include \"International\" option at the top of the list.\r\n * @return {object[]} A list of objects having shape `{ value : string, label : string }`.\r\n */\n\nexport function getCountrySelectOptions(_ref2) {\n var countries = _ref2.countries,\n countryNames = _ref2.countryNames,\n addInternationalOption = _ref2.addInternationalOption,\n compareStringsLocales = _ref2.compareStringsLocales,\n _compareStrings = _ref2.compareStrings; // Default country name comparator uses `String.localeCompare()`.\n\n if (!_compareStrings) {\n _compareStrings = compareStrings;\n } // Generates a `<Select/>` option for each country.\n\n\n var countrySelectOptions = countries.map(function (country) {\n return {\n value: country,\n // All `locale` country names included in this library\n // include all countries (this is checked at build time).\n // The only case when a country name might be missing\n // is when a developer supplies their own `labels` property.\n // To guard against such cases, a missing country name\n // is substituted by country code.\n label: countryNames[country] || country\n };\n }); // Sort the list of countries alphabetically.\n\n countrySelectOptions.sort(function (a, b) {\n return _compareStrings(a.label, b.label, compareStringsLocales);\n }); // Add the \"International\" option to the country list (if suitable)\n\n if (addInternationalOption) {\n countrySelectOptions.unshift({\n label: countryNames.ZZ\n });\n }\n\n return countrySelectOptions;\n}\n/**\r\n * Parses a E.164 phone number to an instance of `PhoneNumber` class.\r\n * @param {string?} value = E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {object} Object having shape `{ country: string?, countryCallingCode: string, number: string }`. `PhoneNumber`: https://gitlab.com/catamphetamine/libphonenumber-js#phonenumber.\r\n * @example\r\n * parsePhoneNumber('+78005553535')\r\n */\n\nexport function parsePhoneNumber(value, metadata) {\n return parsePhoneNumberFromString(value || '', metadata);\n}\n/**\r\n * Generates national number digits for a parsed phone.\r\n * May prepend national prefix.\r\n * The phone number must be a complete and valid phone number.\r\n * @param {object} phoneNumber - An instance of `PhoneNumber` class.\r\n * @param {object} metadata - `libphonenumber-js` metadata\r\n * @return {string}\r\n * @example\r\n * getNationalNumberDigits({ country: 'RU', phone: '8005553535' })\r\n * // returns '88005553535'\r\n */\n\nexport function generateNationalNumberDigits(phoneNumber) {\n return phoneNumber.formatNational().replace(/\\D/g, '');\n}\n/**\r\n * Migrates parsed `<input/>` `value` for the newly selected `country`.\r\n * @param {string?} phoneDigits - Phone number digits (and `+`) parsed from phone number `<input/>` (it's not the same as the `value` property).\r\n * @param {string?} prevCountry - Previously selected country.\r\n * @param {string?} newCountry - Newly selected country. Can't be same as previously selected country.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @param {boolean} useNationalFormat - whether should attempt to convert from international to national number for the new country.\r\n * @return {string?}\r\n */\n\nexport function getPhoneDigitsForNewCountry(phoneDigits, _ref3) {\n var prevCountry = _ref3.prevCountry,\n newCountry = _ref3.newCountry,\n metadata = _ref3.metadata,\n useNationalFormat = _ref3.useNationalFormat; // If `parsed_input` is empty\n // then no need to migrate anything.\n\n if (!phoneDigits) {\n if (useNationalFormat) {\n return '';\n } else {\n // If `phoneDigits` is empty then set `phoneDigits` to\n // `+{getCountryCallingCode(newCountry)}`.\n return getInternationalPhoneNumberPrefix(newCountry, metadata);\n }\n } // If switching to some country.\n // (from \"International\" or another country)\n // If switching from \"International\" then `phoneDigits` starts with a `+`.\n // Otherwise it may or may not start with a `+`.\n\n\n if (newCountry) {\n // If the phone number was entered in international format\n // then migrate it to the newly selected country.\n // The phone number may be incomplete.\n // The phone number entered not necessarily starts with\n // the previously selected country phone prefix.\n if (phoneDigits[0] === '+') {\n // If the international phone number is for the new country\n // then convert it to local if required.\n if (useNationalFormat) {\n // // If a phone number is being input in international form\n // // and the country can already be derived from it,\n // // and if it is the new country, then format as a national number.\n // const derived_country = getCountryFromPossiblyIncompleteInternationalPhoneNumber(phoneDigits, metadata)\n // if (derived_country === newCountry) {\n // \treturn stripCountryCallingCode(phoneDigits, derived_country, metadata)\n // }\n // Actually, the two countries don't necessarily need to match:\n // the condition could be looser here, because several countries\n // might share the same international phone number format\n // (for example, \"NANPA\" countries like US, Canada, etc).\n // The looser condition would be just \"same nternational phone number format\"\n // which would mean \"same country calling code\" in the context of `libphonenumber-js`.\n if (phoneDigits.indexOf('+' + getCountryCallingCode(newCountry, metadata)) === 0) {\n return stripCountryCallingCode(phoneDigits, newCountry, metadata);\n } // Simply discard the previously entered international phone number,\n // because otherwise any \"smart\" transformation like getting the\n // \"national (significant) number\" part and then prepending the\n // newly selected country's \"country calling code\" to it\n // would just be confusing for a user without being actually useful.\n\n\n return ''; // // Simply strip the leading `+` character\n // // therefore simply converting all digits into a \"local\" phone number.\n // // https://github.com/catamphetamine/react-phone-number-input/issues/287\n // return phoneDigits.slice(1)\n }\n\n if (prevCountry) {\n var newCountryPrefix = getInternationalPhoneNumberPrefix(newCountry, metadata);\n\n if (phoneDigits.indexOf(newCountryPrefix) === 0) {\n return phoneDigits;\n } else {\n return newCountryPrefix;\n }\n } else {\n var defaultValue = getInternationalPhoneNumberPrefix(newCountry, metadata); // If `phoneDigits`'s country calling code part is the same\n // as for the new `country`, then leave `phoneDigits` as is.\n\n if (phoneDigits.indexOf(defaultValue) === 0) {\n return phoneDigits;\n } // If `phoneDigits`'s country calling code part is not the same\n // as for the new `country`, then set `phoneDigits` to\n // `+{getCountryCallingCode(newCountry)}`.\n\n\n return defaultValue;\n } // // If the international phone number already contains\n // // any country calling code then trim the country calling code part.\n // // (that could also be the newly selected country phone code prefix as well)\n // // `phoneDigits` doesn't neccessarily belong to `prevCountry`.\n // // (e.g. if a user enters an international number\n // // not belonging to any of the reduced `countries` list).\n // phoneDigits = stripCountryCallingCode(phoneDigits, prevCountry, metadata)\n // // Prepend country calling code prefix\n // // for the newly selected country.\n // return e164(phoneDigits, newCountry, metadata) || `+${getCountryCallingCode(newCountry, metadata)}`\n\n }\n } // If switching to \"International\" from a country.\n else {\n // If the phone number was entered in national format.\n if (phoneDigits[0] !== '+') {\n // Format the national phone number as an international one.\n // The phone number entered not necessarily even starts with\n // the previously selected country phone prefix.\n // Even if the phone number belongs to whole another country\n // it will still be parsed into some national phone number.\n return e164(phoneDigits, prevCountry, metadata) || '';\n }\n }\n\n return phoneDigits;\n}\n/**\r\n * Converts phone number digits to a (possibly incomplete) E.164 phone number.\r\n * @param {string?} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {[object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\nexport function e164(number, country, metadata) {\n if (!number) {\n return;\n } // If the phone number is being input in international format.\n\n\n if (number[0] === '+') {\n // If it's just the `+` sign then return nothing.\n if (number === '+') {\n return;\n } // If there are any digits then the `value` is returned as is.\n\n\n return number;\n } // For non-international phone numbers\n // an accompanying country code is required.\n\n\n if (!country) {\n return;\n }\n\n var partial_national_significant_number = getNationalSignificantNumberDigits(number, country, metadata);\n\n if (partial_national_significant_number) {\n return \"+\".concat(getCountryCallingCode(country, metadata)).concat(partial_national_significant_number);\n }\n}\n/**\r\n * Trims phone number digits if they exceed the maximum possible length\r\n * for a national (significant) number for the country.\r\n * @param {string} number - A possibly incomplete phone number digits string. Can be a possibly incomplete E.164 phone number.\r\n * @param {string} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} Can be empty.\r\n */\n\nexport function trimNumber(number, country, metadata) {\n var nationalSignificantNumberPart = getNationalSignificantNumberDigits(number, country, metadata);\n\n if (nationalSignificantNumberPart) {\n var overflowDigitsCount = nationalSignificantNumberPart.length - getMaxNumberLength(country, metadata);\n\n if (overflowDigitsCount > 0) {\n return number.slice(0, number.length - overflowDigitsCount);\n }\n }\n\n return number;\n}\n\nfunction getMaxNumberLength(country, metadata) {\n // Get \"possible lengths\" for a phone number of the country.\n metadata = new Metadata(metadata);\n metadata.country(country); // Return the last \"possible length\".\n\n return metadata.numberingPlan.possibleLengths()[metadata.numberingPlan.possibleLengths().length - 1];\n} // If the phone number being input is an international one\n// then tries to derive the country from the phone number.\n// (regardless of whether there's any country currently selected)\n\n/**\r\n * @param {string} partialE164Number - A possibly incomplete E.164 phone number.\r\n * @param {string?} country - Currently selected country.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\n\nexport function getCountryForPartialE164Number(partialE164Number, _ref4) {\n var country = _ref4.country,\n countries = _ref4.countries,\n required = _ref4.required,\n metadata = _ref4.metadata;\n\n if (partialE164Number === '+') {\n // Don't change the currently selected country yet.\n return country;\n }\n\n var derived_country = getCountryFromPossiblyIncompleteInternationalPhoneNumber(partialE164Number, metadata); // If a phone number is being input in international form\n // and the country can already be derived from it,\n // then select that country.\n\n if (derived_country && (!countries || countries.indexOf(derived_country) >= 0)) {\n return derived_country;\n } // If \"International\" country option has not been disabled\n // and the international phone number entered doesn't correspond\n // to the currently selected country then reset the currently selected country.\n else if (country && !required && !couldNumberBelongToCountry(partialE164Number, country, metadata)) {\n return undefined;\n } // Don't change the currently selected country.\n\n\n return country;\n}\n/**\r\n * Parses `<input/>` value. Derives `country` from `input`. Derives an E.164 `value`.\r\n * @param {string?} phoneDigits — Parsed `<input/>` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} prevPhoneDigits — Previous parsed `<input/>` value. Examples: `\"\"`, `\"+\"`, `\"+123\"`, `\"123\"`.\r\n * @param {string?} country - Currently selected country.\r\n * @param {string[]?} countries - A list of available countries. If not passed then \"all countries\" are assumed.\r\n * @param {boolean} international - Set to `true` to force international phone number format (leading `+`). Set to `false` to force \"national\" phone number format. Is `undefined` by default.\r\n * @param {boolean} limitMaxLength — Whether to enable limiting phone number max length.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {object} An object of shape `{ input, country, value }`.\r\n */\n\nexport function onPhoneDigitsChange(phoneDigits, _ref5) {\n var prevPhoneDigits = _ref5.prevPhoneDigits,\n country = _ref5.country,\n defaultCountry = _ref5.defaultCountry,\n countries = _ref5.countries,\n international = _ref5.international,\n limitMaxLength = _ref5.limitMaxLength,\n countryCallingCodeEditable = _ref5.countryCallingCodeEditable,\n metadata = _ref5.metadata;\n\n if (international && countryCallingCodeEditable === false) {\n var prefix = getInternationalPhoneNumberPrefix(country, metadata); // The `<input/>` value must start with the country calling code.\n\n if (phoneDigits.indexOf(prefix) !== 0) {\n // If a user tabs into a phone number input field\n // that is `international` and `withCountryCallingCode`,\n // and then starts inputting local phone number digits,\n // the first digit would get \"swallowed\" without this `appendDigits` fix.\n // https://gitlab.com/catamphetamine/react-phone-number-input/-/issues/43\n if (phoneDigits && phoneDigits[0] !== '+') {\n phoneDigits = prefix + phoneDigits;\n } else {\n phoneDigits = prefix;\n }\n\n return {\n phoneDigits: phoneDigits,\n value: undefined,\n country: country\n };\n }\n } // If `international` property is `false`, then it means\n // \"enforce national-only format during input\",\n // so, if that's the case, then remove all `+` characters,\n // but only if some country is currently selected.\n // (not if \"International\" country is selected).\n\n\n if (international === false && country && phoneDigits && phoneDigits[0] === '+') {\n phoneDigits = convertInternationalPhoneDigitsToNational(phoneDigits, country, metadata);\n } // Trim the input to not exceed the maximum possible number length.\n\n\n if (phoneDigits && country && limitMaxLength) {\n phoneDigits = trimNumber(phoneDigits, country, metadata);\n } // If this `onChange()` event was triggered\n // as a result of selecting \"International\" country,\n // then force-prepend a `+` sign if the phone number\n // `<input/>` value isn't in international format.\n // Also, force-prepend a `+` sign if international\n // phone number input format is set.\n\n\n if (phoneDigits && phoneDigits[0] !== '+' && (!country || international)) {\n phoneDigits = '+' + phoneDigits;\n } // If the previously entered phone number\n // has been entered in international format\n // and the user decides to erase it,\n // then also reset the `country`\n // because it was most likely automatically selected\n // while the user was typing in the phone number\n // in international format.\n // This fixes the issue when a user is presented\n // with a phone number input with no country selected\n // and then types in their local phone number\n // then discovers that the input's messed up\n // (a `+` has been prepended at the start of their input\n // and a random country has been selected),\n // decides to undo it all by erasing everything\n // and then types in their local phone number again\n // resulting in a seemingly correct phone number\n // but in reality that phone number has incorrect country.\n // https://github.com/catamphetamine/react-phone-number-input/issues/273\n\n\n if (!phoneDigits && prevPhoneDigits && prevPhoneDigits[0] === '+') {\n if (international) {\n country = undefined;\n } else {\n country = defaultCountry;\n }\n } // Also resets such \"randomly\" selected country\n // as soon as the user erases the number\n // digit-by-digit up to the leading `+` sign.\n\n\n if (phoneDigits === '+' && prevPhoneDigits && prevPhoneDigits[0] === '+' && prevPhoneDigits.length > '+'.length) {\n country = undefined;\n } // Generate the new `value` property.\n\n\n var value;\n\n if (phoneDigits) {\n if (phoneDigits[0] === '+') {\n if (phoneDigits === '+') {\n value = undefined;\n } else if (country && getInternationalPhoneNumberPrefix(country, metadata).indexOf(phoneDigits) === 0) {\n value = undefined;\n } else {\n value = phoneDigits;\n }\n } else {\n value = e164(phoneDigits, country, metadata);\n }\n } // Derive the country from the phone number.\n // (regardless of whether there's any country currently selected,\n // because there could be several countries corresponding to one country calling code)\n\n\n if (value) {\n country = getCountryForPartialE164Number(value, {\n country: country,\n countries: countries,\n metadata: metadata\n }); // If `international` property is `false`, then it means\n // \"enforce national-only format during input\",\n // so, if that's the case, then remove all `+` characters,\n // but only if some country is currently selected.\n // (not if \"International\" country is selected).\n\n if (international === false && country && phoneDigits && phoneDigits[0] === '+') {\n phoneDigits = convertInternationalPhoneDigitsToNational(phoneDigits, country, metadata); // Re-calculate `value` because `phoneDigits` has changed.\n\n value = e164(phoneDigits, country, metadata);\n }\n }\n\n return {\n phoneDigits: phoneDigits,\n country: country,\n value: value\n };\n}\n\nfunction convertInternationalPhoneDigitsToNational(input, country, metadata) {\n // Handle the case when a user might have pasted\n // a phone number in international format.\n if (input.indexOf(getInternationalPhoneNumberPrefix(country, metadata)) === 0) {\n // Create \"as you type\" formatter.\n var formatter = new AsYouType(country, metadata); // Input partial national phone number.\n\n formatter.input(input); // Return the parsed partial national phone number.\n\n var phoneNumber = formatter.getNumber();\n\n if (phoneNumber) {\n // Transform the number to a national one,\n // and remove all non-digits.\n return phoneNumber.formatNational().replace(/\\D/g, '');\n } else {\n return '';\n }\n } else {\n // Just remove the `+` sign.\n return input.replace(/\\D/g, '');\n }\n}\n/**\r\n * Determines the country for a given (possibly incomplete) E.164 phone number.\r\n * @param {string} number - A possibly incomplete E.164 phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string?}\r\n */\n\n\nexport function getCountryFromPossiblyIncompleteInternationalPhoneNumber(number, metadata) {\n var formatter = new AsYouType(null, metadata);\n formatter.input(number); // // `001` is a special \"non-geograpical entity\" code\n // // in Google's `libphonenumber` library.\n // if (formatter.getCountry() === '001') {\n // \treturn\n // }\n\n return formatter.getCountry();\n}\n/**\r\n * Compares two strings.\r\n * A helper for `Array.sort()`.\r\n * @param {string} a — First string.\r\n * @param {string} b — Second string.\r\n * @param {(string[]|string)} [locales] — The `locales` argument of `String.localeCompare`.\r\n */\n\nexport function compareStrings(a, b, locales) {\n // Use `String.localeCompare` if it's available.\n // https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/String/localeCompare\n // Which means everyone except IE <= 10 and Safari <= 10.\n // `localeCompare()` is available in latest Node.js versions.\n\n /* istanbul ignore else */\n if (String.prototype.localeCompare) {\n return a.localeCompare(b, locales);\n }\n /* istanbul ignore next */\n\n\n return a < b ? -1 : a > b ? 1 : 0;\n}\n/**\r\n * Strips `+${countryCallingCode}` prefix from an E.164 phone number.\r\n * @param {string} number - (possibly incomplete) E.164 phone number.\r\n * @param {string?} country - A possible country for this phone number.\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string}\r\n */\n\nexport function stripCountryCallingCode(number, country, metadata) {\n // Just an optimization, so that it\n // doesn't have to iterate through all country calling codes.\n if (country) {\n var countryCallingCodePrefix = '+' + getCountryCallingCode(country, metadata); // If `country` fits the actual `number`.\n\n if (number.length < countryCallingCodePrefix.length) {\n if (countryCallingCodePrefix.indexOf(number) === 0) {\n return '';\n }\n } else {\n if (number.indexOf(countryCallingCodePrefix) === 0) {\n return number.slice(countryCallingCodePrefix.length);\n }\n }\n } // If `country` doesn't fit the actual `number`.\n // Try all available country calling codes.\n\n\n for (var _i = 0, _Object$keys = Object.keys(metadata.country_calling_codes); _i < _Object$keys.length; _i++) {\n var country_calling_code = _Object$keys[_i];\n\n if (number.indexOf(country_calling_code) === '+'.length) {\n return number.slice('+'.length + country_calling_code.length);\n }\n }\n\n return '';\n}\n/**\r\n * Parses a partially entered national phone number digits\r\n * (or a partially entered E.164 international phone number)\r\n * and returns the national significant number part.\r\n * National significant number returned doesn't come with a national prefix.\r\n * @param {string} number - National number digits. Or possibly incomplete E.164 phone number.\r\n * @param {string?} country\r\n * @param {object} metadata - `libphonenumber-js` metadata.\r\n * @return {string} [result]\r\n */\n\nexport function getNationalSignificantNumberDigits(number, country, metadata) {\n // Create \"as you type\" formatter.\n var formatter = new AsYouType(country, metadata); // Input partial national phone number.\n\n formatter.input(number); // Return the parsed partial national phone number.\n\n var phoneNumber = formatter.getNumber();\n return phoneNumber && phoneNumber.nationalNumber;\n}\n/**\r\n * Checks if a partially entered E.164 phone number could belong to a country.\r\n * @param {string} number\r\n * @param {string} country\r\n * @return {boolean}\r\n */\n\nexport function couldNumberBelongToCountry(number, country, metadata) {\n var intlPhoneNumberPrefix = getInternationalPhoneNumberPrefix(country, metadata);\n var i = 0;\n\n while (i < number.length && i < intlPhoneNumberPrefix.length) {\n if (number[i] !== intlPhoneNumberPrefix[i]) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}\n/**\r\n * Gets initial \"phone digits\" (including `+`, if using international format).\r\n * @return {string} [phoneDigits] Returns `undefined` if there should be no initial \"phone digits\".\r\n */\n\nexport function getInitialPhoneDigits(_ref6) {\n var value = _ref6.value,\n phoneNumber = _ref6.phoneNumber,\n defaultCountry = _ref6.defaultCountry,\n international = _ref6.international,\n useNationalFormat = _ref6.useNationalFormat,\n metadata = _ref6.metadata; // If the `value` (E.164 phone number)\n // belongs to the currently selected country\n // and `useNationalFormat` is `true`\n // then convert `value` (E.164 phone number)\n // to a local phone number digits.\n // E.g. '+78005553535' -> '88005553535'.\n\n if ((international === false || useNationalFormat) && phoneNumber && phoneNumber.country) {\n return generateNationalNumberDigits(phoneNumber);\n } // If `international` property is `true`,\n // meaning \"enforce international phone number format\",\n // then always show country calling code in the input field.\n\n\n if (!value && international && defaultCountry) {\n return getInternationalPhoneNumberPrefix(defaultCountry, metadata);\n }\n\n return value;\n}","function ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport { getInitialPhoneDigits, getCountryForPartialE164Number, parsePhoneNumber } from './phoneInputHelpers';\nimport { isCountrySupportedWithError, getSupportedCountries } from './countries';\nexport default function getPhoneInputWithCountryStateUpdateFromNewProps(props, prevProps, state) {\n var metadata = props.metadata,\n countries = props.countries,\n newDefaultCountry = props.defaultCountry,\n newValue = props.value,\n newReset = props.reset,\n international = props.international,\n displayInitialValueAsLocalNumber = props.displayInitialValueAsLocalNumber,\n initialValueFormat = props.initialValueFormat;\n var prevDefaultCountry = prevProps.defaultCountry,\n prevValue = prevProps.value,\n prevReset = prevProps.reset;\n var country = state.country,\n value = state.value,\n hasUserSelectedACountry = state.hasUserSelectedACountry;\n\n var _getInitialPhoneDigits = function _getInitialPhoneDigits(parameters) {\n return getInitialPhoneDigits(_objectSpread({}, parameters, {\n international: international,\n useNationalFormat: displayInitialValueAsLocalNumber || initialValueFormat === 'national',\n metadata: metadata\n }));\n }; // Some users requested a way to reset the component\n // (both number `<input/>` and country `<select/>`).\n // Whenever `reset` property changes both number `<input/>`\n // and country `<select/>` are reset.\n // It's not implemented as some instance `.reset()` method\n // because `ref` is forwarded to `<input/>`.\n // It's also not replaced with just resetting `country` on\n // external `value` reset, because a user could select a country\n // and then not input any `value`, and so the selected country\n // would be \"stuck\", if not using this `reset` property.\n // https://github.com/catamphetamine/react-phone-number-input/issues/300\n\n\n if (newReset !== prevReset) {\n return {\n phoneDigits: _getInitialPhoneDigits({\n value: undefined,\n defaultCountry: newDefaultCountry\n }),\n value: undefined,\n country: newDefaultCountry,\n hasUserSelectedACountry: undefined\n };\n } // `value` is the value currently shown in the component:\n // it's stored in the component's `state`, and it's not the `value` property.\n // `prevValue` is \"previous `value` property\".\n // `newValue` is \"new `value` property\".\n // If the default country changed\n // (e.g. in case of ajax GeoIP detection after page loaded)\n // then select it, but only if the user hasn't already manually\n // selected a country, and no phone number has been manually entered so far.\n // Because if the user has already started inputting a phone number\n // then they're okay with no country being selected at all (\"International\")\n // and they don't want to be disturbed, don't want their input to be screwed, etc.\n\n\n if (newDefaultCountry !== prevDefaultCountry) {\n var isNewDefaultCountrySupported = !newDefaultCountry || isCountrySupportedWithError(newDefaultCountry, metadata);\n\n var noValueHasBeenEnteredByTheUser = // By default, \"no value has been entered\" means `value` is `undefined`.\n !value || // When `international` is `true`, and some country has been pre-selected,\n // then the `<input/>` contains a pre-filled value of `+${countryCallingCode}${leadingDigits}`,\n // so in case of `international` being `true`, \"the user hasn't entered anything\" situation\n // doesn't just mean `value` is `undefined`, but could also mean `value` is `+${countryCallingCode}`.\n international && value === _getInitialPhoneDigits({\n value: undefined,\n defaultCountry: prevDefaultCountry\n }); // Only update the `defaultCountry` property if no phone number\n // has been entered by the user or pre-set by the application.\n\n\n var noValueHasBeenEntered = !newValue && noValueHasBeenEnteredByTheUser;\n\n if (!hasUserSelectedACountry && isNewDefaultCountrySupported && noValueHasBeenEntered) {\n return {\n country: newDefaultCountry,\n // If `phoneDigits` is empty, then automatically select the new `country`\n // and set `phoneDigits` to `+{getCountryCallingCode(newCountry)}`.\n // The code assumes that \"no phone number has been entered by the user\",\n // and no `value` property has been passed, so the `phoneNumber` parameter\n // of `_getInitialPhoneDigits({ value, phoneNumber, ... })` is `undefined`.\n phoneDigits: _getInitialPhoneDigits({\n value: undefined,\n defaultCountry: newDefaultCountry\n }),\n // `value` is `undefined` and it stays so.\n value: undefined\n };\n }\n } // If a new `value` is set externally.\n // (e.g. as a result of an ajax API request\n // to get user's phone after page loaded)\n // The first part — `newValue !== prevValue` —\n // is basically `props.value !== prevProps.value`\n // so it means \"if value property was changed externally\".\n // The second part — `newValue !== value` —\n // is for ignoring the `getDerivedStateFromProps()` call\n // which happens in `this.onChange()` right after `this.setState()`.\n // If this `getDerivedStateFromProps()` call isn't ignored\n // then the country flag would reset on each input.\n\n\n if (newValue !== prevValue && newValue !== value) {\n var phoneNumber;\n var parsedCountry;\n\n if (newValue) {\n phoneNumber = parsePhoneNumber(newValue, metadata);\n var supportedCountries = getSupportedCountries(countries, metadata);\n\n if (phoneNumber && phoneNumber.country) {\n // Ignore `else` because all countries are supported in metadata.\n\n /* istanbul ignore next */\n if (!supportedCountries || supportedCountries.indexOf(phoneNumber.country) >= 0) {\n parsedCountry = phoneNumber.country;\n }\n } else {\n parsedCountry = getCountryForPartialE164Number(newValue, {\n country: undefined,\n countries: supportedCountries,\n metadata: metadata\n });\n }\n }\n\n var hasUserSelectedACountryUpdate;\n\n if (!newValue) {\n // Reset `hasUserSelectedACountry` flag in `state`.\n hasUserSelectedACountryUpdate = {\n hasUserSelectedACountry: undefined\n };\n }\n\n return _objectSpread({}, hasUserSelectedACountryUpdate, {\n phoneDigits: _getInitialPhoneDigits({\n phoneNumber: phoneNumber,\n value: newValue,\n defaultCountry: newDefaultCountry\n }),\n value: newValue,\n country: newValue ? parsedCountry : newDefaultCountry\n });\n } // `defaultCountry` didn't change.\n // `value` didn't change.\n // `phoneDigits` didn't change, because `value` didn't change.\n //\n // So no need to update state.\n\n}","function _typeof(obj) {\n if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") {\n _typeof = function _typeof(obj) {\n return typeof obj;\n };\n } else {\n _typeof = function _typeof(obj) {\n return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n };\n }\n\n return _typeof(obj);\n}\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n if (enumerableOnly) symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n });\n keys.push.apply(keys, symbols);\n }\n\n return keys;\n}\n\nfunction _objectSpread(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i] != null ? arguments[i] : {};\n\n if (i % 2) {\n ownKeys(Object(source), true).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n });\n } else if (Object.getOwnPropertyDescriptors) {\n Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));\n } else {\n ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n }\n\n return target;\n}\n\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n\n return obj;\n}\n\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport InputSmart from './InputSmart';\nimport InputBasic from './InputBasic';\nimport Flag from './Flag';\nimport InternationalIcon from './InternationalIcon';\nimport { sortCountryOptions, isCountrySupportedWithError, getSupportedCountries, getSupportedCountryOptions, getCountries } from './helpers/countries';\nimport { createCountryIconComponent } from './CountryIcon';\nimport { metadata as metadataPropType, labels as labelsPropType } from './PropTypes';\nimport { getPreSelectedCountry, getCountrySelectOptions, parsePhoneNumber, generateNationalNumberDigits, getPhoneDigitsForNewCountry, getInitialPhoneDigits, onPhoneDigitsChange, e164 } from './helpers/phoneInputHelpers';\nimport getPhoneInputWithCountryStateUpdateFromNewProps from './helpers/getPhoneInputWithCountryStateUpdateFromNewProps';\n\nvar PhoneNumberInput_ = /*#__PURE__*/function (_React$PureComponent) {\n _inherits(PhoneNumberInput_, _React$PureComponent);\n\n function PhoneNumberInput_(props) {\n var _this;\n\n _classCallCheck(this, PhoneNumberInput_);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(PhoneNumberInput_).call(this, props));\n\n _defineProperty(_assertThisInitialized(_this), \"inputRef\", React.createRef());\n\n _defineProperty(_assertThisInitialized(_this), \"isCountrySupportedWithError\", function (country) {\n var metadata = _this.props.metadata;\n return isCountrySupportedWithError(country, metadata);\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryChange\", function (newCountry) {\n var _this$props = _this.props,\n international = _this$props.international,\n metadata = _this$props.metadata,\n onChange = _this$props.onChange,\n focusInputOnCountrySelection = _this$props.focusInputOnCountrySelection;\n var _this$state = _this.state,\n prevPhoneDigits = _this$state.phoneDigits,\n prevCountry = _this$state.country; // After the new `country` has been selected,\n // if the phone number `<input/>` holds any digits\n // then migrate those digits for the new `country`.\n\n var newPhoneDigits = getPhoneDigitsForNewCountry(prevPhoneDigits, {\n prevCountry: prevCountry,\n newCountry: newCountry,\n metadata: metadata,\n // Convert the phone number to \"national\" format\n // when the user changes the selected country by hand.\n useNationalFormat: !international\n });\n var newValue = e164(newPhoneDigits, newCountry, metadata); // Focus phone number `<input/>` upon country selection.\n\n if (focusInputOnCountrySelection) {\n _this.getInputRef().current.focus();\n } // If the user has already manually selected a country\n // then don't override that already selected country\n // if the `defaultCountry` property changes.\n // That's what `hasUserSelectedACountry` flag is for.\n\n\n _this.setState({\n country: newCountry,\n hasUserSelectedACountry: true,\n phoneDigits: newPhoneDigits,\n value: newValue\n }, function () {\n // Update the new `value` property.\n // Doing it after the `state` has been updated\n // because `onChange()` will trigger `getDerivedStateFromProps()`\n // with the new `value` which will be compared to `state.value` there.\n onChange(newValue);\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onChange\", function (_phoneDigits) {\n var _this$props2 = _this.props,\n defaultCountry = _this$props2.defaultCountry,\n onChange = _this$props2.onChange,\n addInternationalOption = _this$props2.addInternationalOption,\n international = _this$props2.international,\n limitMaxLength = _this$props2.limitMaxLength,\n countryCallingCodeEditable = _this$props2.countryCallingCodeEditable,\n metadata = _this$props2.metadata;\n var _this$state2 = _this.state,\n countries = _this$state2.countries,\n prevPhoneDigits = _this$state2.phoneDigits,\n currentlySelectedCountry = _this$state2.country;\n\n var _onPhoneDigitsChange = onPhoneDigitsChange(_phoneDigits, {\n prevPhoneDigits: prevPhoneDigits,\n country: currentlySelectedCountry,\n defaultCountry: defaultCountry,\n countries: countries,\n international: international,\n limitMaxLength: limitMaxLength,\n countryCallingCodeEditable: countryCallingCodeEditable,\n metadata: metadata\n }),\n phoneDigits = _onPhoneDigitsChange.phoneDigits,\n country = _onPhoneDigitsChange.country,\n value = _onPhoneDigitsChange.value;\n\n var stateUpdate = {\n phoneDigits: phoneDigits,\n value: value,\n country: country\n };\n\n if (countryCallingCodeEditable === false) {\n // If it simply did `setState({ phoneDigits: intlPrefix })` here,\n // then it would have no effect when erasing an inital international prefix\n // via Backspace, because `phoneDigits` in `state` wouldn't change\n // as a result, because it was `prefix` and it became `prefix`,\n // so the component wouldn't rerender, and the user would be able\n // to erase the country calling code part, and that part is\n // assumed to be non-eraseable. That's why the component is\n // forcefully rerendered here.\n // https://github.com/catamphetamine/react-phone-number-input/issues/367#issuecomment-721703501\n if (!value && phoneDigits === _this.state.phoneDigits) {\n // Force a re-render of the `<input/>` in order to reset its value.\n stateUpdate.forceRerender = {};\n }\n }\n\n _this.setState(stateUpdate, // Update the new `value` property.\n // Doing it after the `state` has been updated\n // because `onChange()` will trigger `getDerivedStateFromProps()`\n // with the new `value` which will be compared to `state.value` there.\n function () {\n return onChange(value);\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"_onFocus\", function () {\n return _this.setState({\n isFocused: true\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"_onBlur\", function () {\n return _this.setState({\n isFocused: false\n });\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onFocus\", function (event) {\n _this._onFocus();\n\n var onFocus = _this.props.onFocus;\n\n if (onFocus) {\n onFocus(event);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onBlur\", function (event) {\n var onBlur = _this.props.onBlur;\n\n _this._onBlur();\n\n if (onBlur) {\n onBlur(event);\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryFocus\", function (event) {\n _this._onFocus(); // this.setState({ countrySelectFocused: true })\n\n\n var countrySelectProps = _this.props.countrySelectProps;\n\n if (countrySelectProps) {\n var onFocus = countrySelectProps.onFocus;\n\n if (onFocus) {\n onFocus(event);\n }\n }\n });\n\n _defineProperty(_assertThisInitialized(_this), \"onCountryBlur\", function (event) {\n _this._onBlur(); // this.setState({ countrySelectFocused: false })\n\n\n var countrySelectProps = _this.props.countrySelectProps;\n\n if (countrySelectProps) {\n var onBlur = countrySelectProps.onBlur;\n\n if (onBlur) {\n onBlur(event);\n }\n }\n });\n\n var _this$props3 = _this.props,\n _value = _this$props3.value,\n labels = _this$props3.labels,\n _international = _this$props3.international,\n addInternationalOption = _this$props3.addInternationalOption,\n displayInitialValueAsLocalNumber = _this$props3.displayInitialValueAsLocalNumber,\n initialValueFormat = _this$props3.initialValueFormat,\n _metadata = _this$props3.metadata;\n var _this$props4 = _this.props,\n _defaultCountry = _this$props4.defaultCountry,\n _countries = _this$props4.countries; // Validate `defaultCountry`.\n\n if (_defaultCountry) {\n if (!_this.isCountrySupportedWithError(_defaultCountry)) {\n _defaultCountry = undefined;\n }\n } // Validate `countries`.\n\n\n _countries = getSupportedCountries(_countries, _metadata);\n var phoneNumber = parsePhoneNumber(_value, _metadata);\n _this.CountryIcon = createCountryIconComponent(_this.props);\n _this.state = {\n // Workaround for `this.props` inside `getDerivedStateFromProps()`.\n props: _this.props,\n // The country selected.\n country: getPreSelectedCountry({\n phoneNumber: phoneNumber,\n defaultCountry: _defaultCountry,\n countries: _countries || getCountries(_metadata),\n required: !addInternationalOption,\n metadata: _metadata\n }),\n // `countries` are stored in `this.state` because they're filtered.\n // For example, a developer might theoretically pass some unsupported\n // countries as part of the `countries` property, and because of that\n // the component uses `this.state.countries` (which are filtered)\n // instead of `this.props.countries`\n // (which could potentially contain unsupported countries).\n countries: _countries,\n // `phoneDigits` state property holds non-formatted user's input.\n // The reason is that there's no way of finding out\n // in which form should `value` be displayed: international or national.\n // E.g. if `value` is `+78005553535` then it could be input\n // by a user both as `8 (800) 555-35-35` and `+7 800 555 35 35`.\n // Hence storing just `value` is not sufficient for correct formatting.\n // E.g. if a user entered `8 (800) 555-35-35`\n // then value is `+78005553535` and `phoneDigits` are `88005553535`\n // and if a user entered `+7 800 555 35 35`\n // then value is `+78005553535` and `phoneDigits` are `+78005553535`.\n phoneDigits: getInitialPhoneDigits({\n value: _value,\n phoneNumber: phoneNumber,\n defaultCountry: _defaultCountry,\n international: _international,\n useNationalFormat: displayInitialValueAsLocalNumber || initialValueFormat === 'national',\n metadata: _metadata\n }),\n // `value` property is duplicated in state.\n // The reason is that `getDerivedStateFromProps()`\n // needs this `value` to compare to the new `value` property\n // to find out if `phoneDigits` needs updating:\n // If the `value` property was changed externally\n // then it won't be equal to `state.value`\n // in which case `phoneDigits` and `country` should be updated.\n value: _value\n };\n return _this;\n }\n\n _createClass(PhoneNumberInput_, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var onCountryChange = this.props.onCountryChange;\n var defaultCountry = this.props.defaultCountry;\n var selectedCountry = this.state.country;\n\n if (onCountryChange) {\n if (defaultCountry) {\n if (!this.isCountrySupportedWithError(defaultCountry)) {\n defaultCountry = undefined;\n }\n }\n\n if (selectedCountry !== defaultCountry) {\n onCountryChange(selectedCountry);\n }\n }\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(prevProps, prevState) {\n var onCountryChange = this.props.onCountryChange;\n var country = this.state.country; // Call `onCountryChange` when user selects another country.\n\n if (onCountryChange && country !== prevState.country) {\n onCountryChange(country);\n }\n } // A shorthand for not passing `metadata` as a second argument.\n\n }, {\n key: \"getInputRef\",\n value: function getInputRef() {\n var inputRef = this.props.inputRef;\n return inputRef || this.inputRef;\n } // `state` holds previous props as `props`, and also:\n // * `country` — The currently selected country, e.g. `\"RU\"`.\n // * `value` — The currently entered phone number (E.164), e.g. `+78005553535`.\n // * `phoneDigits` — The parsed `<input/>` value, e.g. `8005553535`.\n // (and a couple of other less significant properties)\n\n }, {\n key: \"render\",\n value: function render() {\n var _this$props5 = this.props,\n name = _this$props5.name,\n disabled = _this$props5.disabled,\n autoComplete = _this$props5.autoComplete,\n style = _this$props5.style,\n className = _this$props5.className,\n inputRef = _this$props5.inputRef,\n inputComponent = _this$props5.inputComponent,\n numberInputProps = _this$props5.numberInputProps,\n smartCaret = _this$props5.smartCaret,\n CountrySelectComponent = _this$props5.countrySelectComponent,\n countrySelectProps = _this$props5.countrySelectProps,\n ContainerComponent = _this$props5.containerComponent,\n defaultCountry = _this$props5.defaultCountry,\n countries = _this$props5.countries,\n countryOptionsOrder = _this$props5.countryOptionsOrder,\n labels = _this$props5.labels,\n flags = _this$props5.flags,\n flagComponent = _this$props5.flagComponent,\n flagUrl = _this$props5.flagUrl,\n addInternationalOption = _this$props5.addInternationalOption,\n internationalIcon = _this$props5.internationalIcon,\n displayInitialValueAsLocalNumber = _this$props5.displayInitialValueAsLocalNumber,\n initialValueFormat = _this$props5.initialValueFormat,\n onCountryChange = _this$props5.onCountryChange,\n limitMaxLength = _this$props5.limitMaxLength,\n countryCallingCodeEditable = _this$props5.countryCallingCodeEditable,\n focusInputOnCountrySelection = _this$props5.focusInputOnCountrySelection,\n reset = _this$props5.reset,\n metadata = _this$props5.metadata,\n international = _this$props5.international,\n locales = _this$props5.locales,\n rest = _objectWithoutProperties(_this$props5, [\"name\", \"disabled\", \"autoComplete\", \"style\", \"className\", \"inputRef\", \"inputComponent\", \"numberInputProps\", \"smartCaret\", \"countrySelectComponent\", \"countrySelectProps\", \"containerComponent\", \"defaultCountry\", \"countries\", \"countryOptionsOrder\", \"labels\", \"flags\", \"flagComponent\", \"flagUrl\", \"addInternationalOption\", \"internationalIcon\", \"displayInitialValueAsLocalNumber\", \"initialValueFormat\", \"onCountryChange\", \"limitMaxLength\", \"countryCallingCodeEditable\", \"focusInputOnCountrySelection\", \"reset\", \"metadata\", \"international\", \"locales\"]);\n\n var _this$state3 = this.state,\n country = _this$state3.country,\n phoneDigits = _this$state3.phoneDigits,\n isFocused = _this$state3.isFocused;\n var InputComponent = smartCaret ? InputSmart : InputBasic;\n var countrySelectOptions = useMemoCountrySelectOptions(function () {\n return sortCountryOptions(getCountrySelectOptions({\n countries: countries || getCountries(metadata),\n countryNames: labels,\n addInternationalOption: international && countryCallingCodeEditable === false ? false : addInternationalOption,\n compareStringsLocales: locales // compareStrings\n\n }), getSupportedCountryOptions(countryOptionsOrder, metadata));\n }, [countries, countryOptionsOrder, addInternationalOption, labels, metadata]);\n return React.createElement(ContainerComponent, {\n style: style,\n className: classNames(className, 'PhoneInput', {\n 'PhoneInput--focus': isFocused\n })\n }, React.createElement(CountrySelectComponent, _extends({\n name: name ? \"\".concat(name, \"Country\") : undefined,\n \"aria-label\": labels.country\n }, countrySelectProps, {\n value: country,\n options: countrySelectOptions,\n onChange: this.onCountryChange,\n onFocus: this.onCountryFocus,\n onBlur: this.onCountryBlur,\n disabled: disabled || countrySelectProps && countrySelectProps.disabled,\n iconComponent: this.CountryIcon\n })), React.createElement(InputComponent, _extends({\n ref: this.getInputRef(),\n type: \"tel\",\n autoComplete: autoComplete\n }, numberInputProps, rest, {\n name: name,\n metadata: metadata,\n country: country,\n value: phoneDigits || '',\n onChange: this.onChange,\n onFocus: this.onFocus,\n onBlur: this.onBlur,\n disabled: disabled,\n inputComponent: inputComponent,\n className: classNames('PhoneInputInput', numberInputProps && numberInputProps.className, rest.className)\n })));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(props, state) {\n return _objectSpread({\n // Emulate `prevProps` via `state.props`.\n props: props\n }, getPhoneInputWithCountryStateUpdateFromNewProps(props, state.props, state));\n }\n }]);\n\n return PhoneNumberInput_;\n}(React.PureComponent); // This wrapper is only to `.forwardRef()` to the `<input/>`.\n\n\nvar PhoneNumberInput = React.forwardRef(function (props, ref) {\n return React.createElement(PhoneNumberInput_, _extends({}, props, {\n inputRef: ref\n }));\n});\nPhoneNumberInput.defaultProps = {\n /**\r\n * Remember (and autofill) the value as a phone number.\r\n */\n autoComplete: 'tel',\n\n /**\r\n * Flag icon component.\r\n */\n flagComponent: Flag,\n\n /**\r\n * By default, uses icons from `country-flag-icons` gitlab pages website.\r\n */\n // Must be equal to `flagUrl` in `./CountryIcon.js`.\n flagUrl: 'https://purecatamphetamine.github.io/country-flag-icons/3x2/{XX}.svg',\n\n /**\r\n * Default \"International\" country `<select/>` option icon.\r\n */\n internationalIcon: InternationalIcon,\n\n /**\r\n * Phone number `<input/>` component.\r\n */\n inputComponent: 'input',\n\n /**\r\n * Wrapping `<div/>` component.\r\n */\n containerComponent: 'div',\n\n /**\r\n * Some users requested a way to reset the component:\r\n * both number `<input/>` and country `<select/>`.\r\n * Whenever `reset` property changes both number `<input/>`\r\n * and country `<select/>` are reset.\r\n * It's not implemented as some instance `.reset()` method\r\n * because `ref` is forwarded to `<input/>`.\r\n * It's also not replaced with just resetting `country` on\r\n * external `value` reset, because a user could select a country\r\n * and then not input any `value`, and so the selected country\r\n * would be \"stuck\", if not using this `reset` property.\r\n */\n // https://github.com/catamphetamine/react-phone-number-input/issues/300\n reset: PropTypes.any,\n\n /**\r\n *\r\n */\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 * Whether to add the \"International\" option\r\n * to the list of countries.\r\n */\n addInternationalOption: true,\n\n /**\r\n * If set to `true` the phone number input will get trimmed\r\n * if it exceeds the maximum length for the country.\r\n */\n limitMaxLength: false,\n\n /**\r\n * If set to `false`, and `international` is `true`, then\r\n * users won't be able to erase the \"country calling part\"\r\n * of a phone number in the `<input/>`.\r\n */\n countryCallingCodeEditable: true,\n\n /**\r\n * If set to `false`, will not focus the `<input/>` component\r\n * when the user selects a country from the list of countries.\r\n * This can be used to conform to the Web Content Accessibility Guidelines (WCAG).\r\n * Quote:\r\n * \"On input: Changing the setting of any user interface component\r\n * does not automatically cause a change of context unless the user\r\n * has been advised of the behaviour before using the component.\"\r\n */\n focusInputOnCountrySelection: true\n};\nexport default PhoneNumberInput;\nvar countrySelectOptionsMemo;\nvar countrySelectOptionsMemoDependencies;\n\nfunction useMemoCountrySelectOptions(generator, dependencies) {\n if (!countrySelectOptionsMemoDependencies || !areEqualArrays(dependencies, countrySelectOptionsMemoDependencies)) {\n countrySelectOptionsMemo = generator();\n countrySelectOptionsMemoDependencies = dependencies;\n }\n\n return countrySelectOptionsMemo;\n}\n\nfunction areEqualArrays(a, b) {\n if (a.length !== b.length) {\n return false;\n }\n\n var i = 0;\n\n while (i < a.length) {\n if (a[i] !== b[i]) {\n return false;\n }\n\n i++;\n }\n\n return true;\n}","/**\r\n * Creates Unicode flag from a two-letter ISO country code.\r\n * https://stackoverflow.com/questions/24050671/how-to-put-japan-flag-character-in-a-string\r\n * @param {string} country — A two-letter ISO country code (case-insensitive).\r\n * @return {string}\r\n */\nexport default function getCountryFlag(country) {\n return getRegionalIndicatorSymbol(country[0]) + getRegionalIndicatorSymbol(country[1]);\n}\n/**\r\n * Converts a letter to a Regional Indicator Symbol.\r\n * @param {string} letter\r\n * @return {string}\r\n */\n\nfunction getRegionalIndicatorSymbol(letter) {\n return String.fromCodePoint(0x1F1E6 - 65 + letter.toUpperCase().charCodeAt(0));\n}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nfunction _objectWithoutProperties(source, excluded) {\n if (source == null) return {};\n\n var target = _objectWithoutPropertiesLoose(source, excluded);\n\n var key, i;\n\n if (Object.getOwnPropertySymbols) {\n var sourceSymbolKeys = Object.getOwnPropertySymbols(source);\n\n for (i = 0; i < sourceSymbolKeys.length; i++) {\n key = sourceSymbolKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;\n target[key] = source[key];\n }\n }\n\n return target;\n}\n\nfunction _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}\n\nimport React, { useCallback, useMemo } from 'react';\nimport classNames from 'classnames';\nimport getUnicodeFlagIcon from 'country-flag-icons/unicode';\nexport default function CountrySelect(_ref) {\n var value = _ref.value,\n onChange = _ref.onChange,\n options = _ref.options,\n rest = _objectWithoutProperties(_ref, [\"value\", \"onChange\", \"options\"]);\n\n var onChange_ = useCallback(function (event) {\n var value = event.target.value;\n onChange(value === 'ZZ' ? undefined : value);\n }, [onChange]);\n var selectedOption = useMemo(function () {\n return getSelectedOption(options, value);\n }, [options, value]); // \"ZZ\" means \"International\".\n // (HTML requires each `<option/>` have some string `value`).\n\n return React.createElement(\"select\", _extends({}, rest, {\n value: value || 'ZZ',\n onChange: onChange_\n }), options.map(function (_ref2) {\n var value = _ref2.value,\n label = _ref2.label,\n divider = _ref2.divider;\n return React.createElement(\"option\", {\n key: divider ? '|' : value || 'ZZ',\n value: divider ? '|' : value || 'ZZ',\n disabled: divider ? true : false,\n style: divider ? DIVIDER_STYLE : undefined\n }, label);\n }));\n}\nvar DIVIDER_STYLE = {\n fontSize: '1px',\n backgroundColor: 'currentColor',\n color: 'inherit'\n};\nexport function CountrySelectWithIcon(_ref3) {\n var value = _ref3.value,\n options = _ref3.options,\n className = _ref3.className,\n Icon = _ref3.iconComponent,\n getIconAspectRatio = _ref3.getIconAspectRatio,\n Arrow = _ref3.arrowComponent,\n unicodeFlags = _ref3.unicodeFlags,\n rest = _objectWithoutProperties(_ref3, [\"value\", \"options\", \"className\", \"iconComponent\", \"getIconAspectRatio\", \"arrowComponent\", \"unicodeFlags\"]);\n\n var selectedOption = useMemo(function () {\n return getSelectedOption(options, value);\n }, [options, value]);\n return React.createElement(\"div\", {\n className: \"PhoneInputCountry\"\n }, React.createElement(CountrySelect, _extends({}, rest, {\n value: value,\n options: options,\n className: classNames('PhoneInputCountrySelect', className)\n })), unicodeFlags && value && React.createElement(\"div\", {\n className: \"PhoneInputCountryIconUnicode\"\n }, getUnicodeFlagIcon(value)), !(unicodeFlags && value) && React.createElement(Icon, {\n country: value,\n label: selectedOption && selectedOption.label,\n aspectRatio: unicodeFlags ? 1 : undefined\n }), React.createElement(Arrow, null));\n}\nCountrySelectWithIcon.defaultProps = {\n // Is \"International\" icon square?\n arrowComponent: function arrowComponent() {\n return React.createElement(\"div\", {\n className: \"PhoneInputCountrySelectArrow\"\n });\n }\n};\n\nfunction getSelectedOption(options, value) {\n for (var _iterator = options, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {\n var _ref4;\n\n if (_isArray) {\n if (_i >= _iterator.length) break;\n _ref4 = _iterator[_i++];\n } else {\n _i = _iterator.next();\n if (_i.done) break;\n _ref4 = _i.value;\n }\n\n var option = _ref4;\n\n if (!option.divider && option.value === value) {\n return option;\n }\n }\n}","function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}\n\nimport React from 'react';\nimport labels from '../locale/en.json';\nimport { metadata as metadataPropType, labels as labelsPropType } from './PropTypes';\nimport PhoneInput from './PhoneInputWithCountry';\nimport { CountrySelectWithIcon as CountrySelect } from './CountrySelect';\nexport function createPhoneInput(defaultMetadata) {\n var PhoneInputDefault = React.forwardRef(function (props, ref) {\n return React.createElement(PhoneInput, _extends({\n ref: ref\n }, props));\n });\n PhoneInputDefault.defaultProps = {\n metadata: defaultMetadata,\n labels: labels,\n countrySelectComponent: CountrySelect\n };\n return PhoneInputDefault;\n}\nexport default createPhoneInput();","import metadata from 'libphonenumber-js/metadata.min.json';\nimport { parsePhoneNumber as _parsePhoneNumber, formatPhoneNumber as _formatPhoneNumber, formatPhoneNumberIntl as _formatPhoneNumberIntl, isValidPhoneNumber as _isValidPhoneNumber, isPossiblePhoneNumber as _isPossiblePhoneNumber, getCountries as _getCountries, getCountryCallingCode as _getCountryCallingCode } from '../core/index';\nimport { createPhoneInput } from '../modules/PhoneInputWithCountryDefault';\n\nfunction call(func, _arguments) {\n var args = Array.prototype.slice.call(_arguments);\n args.push(metadata);\n return func.apply(this, args);\n}\n\nexport default createPhoneInput(metadata);\nexport function parsePhoneNumber() {\n return call(_parsePhoneNumber, arguments);\n}\nexport function formatPhoneNumber() {\n return call(_formatPhoneNumber, arguments);\n}\nexport function formatPhoneNumberIntl() {\n return call(_formatPhoneNumberIntl, arguments);\n}\nexport function isValidPhoneNumber() {\n return call(_isValidPhoneNumber, arguments);\n}\nexport function isPossiblePhoneNumber() {\n return call(_isPossiblePhoneNumber, arguments);\n}\nexport function getCountries() {\n return call(_getCountries, arguments);\n}\nexport function getCountryCallingCode() {\n return call(_getCountryCallingCode, arguments);\n}","import React, { createElement, forwardRef, Ref, useCallback, useEffect, useState } from \"react\"\nimport { useQueryParam, StringParam } from \"use-query-params\";\nimport { navigate } from \"gatsby\"\nimport { Input, Button, Steps, notification } from 'antd'\nimport classNames from 'classnames'\n\nimport Layout from \"../components/layout\"\nimport { TranslationContainer, ApiContainer } from \"../containers\"\nimport Header from \"../components/header\"\n\nimport styles from \"./step-1.module.less\"\nimport FieldImg from \"../images/group-8@3x.png\"\nimport loader from \"../images/loader.gif\"\nimport HorizontalStepper from \"../components/horizontal-stepper\"\nimport CustomIcon from \"../components/custom-icon\"\n\nimport 'react-phone-number-input/style.css'\nimport PhoneInput, { getCountries } from 'react-phone-number-input'\n\nconst Onboarding1: React.FC<any> = ({ ...props }) => {\n const { currentLocale, translate } = TranslationContainer.useContainer();\n const [userName, setUserName] = useState<string>('');\n const [validUserName, setValidUserName] = useState<boolean>(false);\n const [errorUserName, setErrorUserName] = useState<boolean>(false);\n const [userEmail, setUserEmail] = useState<string>('');\n const [validEmail, setValidEmail] = useState<boolean>(false);\n const [errorEmail, setErrorEmail] = useState<boolean>(false);\n const [userPhone, setUserPhone] = useState<string>('');\n const [userCountry, setUserCountry] = useState<string>('');\n const [validPhone, setValidPhone] = useState<boolean>(false);\n const [errorPhone, setErrorPhone] = useState<boolean>(false);\n const [loading, setIsLoading] = useState<boolean>(false);\n const [catchYou, setCatchYou] = useState<string>('');\n const [defaultCountry, setDefaultCountry] = useState<string>('');\n const [isMobile, setIsMobile] = useQueryParam(\"mobile\", StringParam);\n const { createLead, setLeadId, validateEmail, getLocationThroughIP, setUtmData } = ApiContainer.useContainer();\n const emailRegr = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$/;\n const { Step } = Steps;\n\n //UTM Query Params\n const [campaign, setCampaign] = useQueryParam(\"utm_campaign\", StringParam);\n\tconst [source, setSource] = useQueryParam(\"utm_source\", StringParam);\n\tconst [medium, setMedium] = useQueryParam(\"utm_medium\", StringParam);\n\tconst [term, setTerm] = useQueryParam(\"utm_term\", StringParam);\n\tconst [content, setContent] = useQueryParam(\"utm_content\", StringParam);\n\n const userNameIcon = createElement('div', {}, <CustomIcon isChecked={validUserName} showInvalid={errorUserName} />);\n const userEmailIcon = createElement('div', {}, <CustomIcon isChecked={validEmail} showInvalid={errorEmail} />);\n const userPhoneIcon = createElement('div', {}, <CustomIcon isChecked={validPhone} showInvalid={errorPhone} />)\n\n const userNameTitle = createElement('div', { className: styles.stepTitle }, translate(\"onboarding.nameTitle\"));\n const userEmailTitle = createElement('div', { className: styles.stepTitle }, translate(\"onboarding.emailTitle\"));\n const userPhoneTitle = createElement('div', { className: styles.stepTitle }, translate(\"onboarding.phoneTitle\"));\n\n useEffect(() => {\n getDefaultCountry();\n const retrievedURLData = {\n\t\t\tutm_campaign: campaign,\n\t\t\tutm_source: source,\n\t\t\tutm_medium: medium,\n\t\t\tutm_term: term,\n\t\t\tutm_content: content,\n\t\t};\n\t\tsetUtmData(retrievedURLData);\n\t}, [])\n\n const navigateToAgrapp = () => {\n navigate('https://www.agrapp.cl/');\n };\n\n const tailClass = (valid: boolean, activeError) => {\n if (valid && !activeError) {\n return styles.itemTailActive;\n } else if (!valid && activeError) {\n return styles.itemTailError;\n } else {\n return styles.itemTailInactative;\n }\n };\n\n const getDefaultCountry = async () => {\n try {\n const result = await getLocationThroughIP();\n const {country} = result;\n setDefaultCountry(country);\n } catch (error) {\n console.log(error);\n }\n };\n\n const isValidPhonenumber = (value: string) => {\n return (/^\\d{7,}$/).test(value.replace(/[\\s()+\\-\\.]|ext/gi, ''));\n };\n\n const openNotificationWithIcon = (type, message?, description?) => {\n notification[type]({\n message: message ? message : translate(\"common.invalidData\"),\n description: description ? description : translate(\"common.invalidDataDescription\"),\n });\n };\n\n const validator = () => {\n let isValid = true;\n if (!validEmail) {\n setErrorEmail(true);\n isValid = false;\n }\n if (!validUserName) {\n setErrorUserName(true);\n isValid = false;\n }\n if (!validPhone) {\n setErrorPhone(true);\n isValid = false;\n }\n if (catchYou != '') {\n isValid = false;\n }\n return isValid;\n };\n\n const sendData = async (realData: boolean) => {\n if (validator()) {\n const contactInfo = {\n name: userName,\n email: userEmail,\n phone: userPhone,\n lang: currentLocale,\n real: realData,\n country: userCountry\n };\n try {\n setIsLoading(true);\n await validateEmail(contactInfo.email);\n const result = await createLead(contactInfo);\n setLeadId(result.id);\n if (realData) {\n navigate('/step-2/');\n } else {\n navigate('/step-3/');\n }\n } catch (error) {\n if (error.name == \"TakenMail\") {\n setErrorEmail(true);\n setValidEmail(false);\n openNotificationWithIcon('error', translate(\"onboarding.yourEmail\"), translate(\"onboarding.takenEmail\"));\n }\n } finally {\n setTimeout(()=>{setIsLoading(false)},1000);\n }\n } else {\n openNotificationWithIcon('error');\n }\n };\n\n const userNameInput = createElement(\n 'div', {\n className: styles.inputStyle\n },\n <Input placeholder={translate(\"onboarding.yourName\")}\n value={userName}\n onChange={(evt) => {\n setValidUserName(evt.target.value != '');\n setErrorUserName(false);\n setUserName(evt.target.value);\n }} />\n );\n\n const userEmailInput = createElement(\n 'div', {\n className: styles.inputStyle\n },\n <Input placeholder={translate(\"onboarding.yourEmail\")}\n value={userEmail}\n type=\"email\"\n onChange={(evt) => {\n setValidEmail(emailRegr.test(evt.target.value));\n setErrorEmail(false);\n setUserEmail(evt.target.value);\n }} />\n );\n\n /*\n onChange={(evt) => {\n setValidPhone(isValidPhonenumber(evt.target.value));\n setErrorPhone(false);\n setUserPhone(evt.target.value.replace(/[\\s()+\\-\\.]|ext/gi, ''));\n }}\n */\n\n const userPhoneInput = createElement(\n 'div', {\n className: styles.phoneInput\n },\n <PhoneInput\n defaultCountry={defaultCountry}\n placeholder={translate(\"onboarding.yourPhone\")}\n value={userPhone}\n onChange={(value) => {\n setValidPhone(isValidPhonenumber(value != undefined ? value : ''));\n setErrorPhone(false);\n setUserPhone(value);\n }}\n onCountryChange={setUserCountry} />\n );\n\n const domoArigatoMrRoboto = createElement(\n 'div', {\n className: styles.inputStyle\n },\n <Input placeholder={translate(\"onboarding.yourPhone\")}\n value={catchYou}\n type=\"text\"\n onChange={(evt) => {\n setCatchYou(evt.target.value);\n }} />\n );\n\n const lastTailClass = classNames(tailClass(validPhone, errorPhone), styles.lastTail);\n\n return (\n <Layout>\n <div className={styles.viewWrapper}>\n <div className={styles.stepOneWrapper}>\n <Header backBtnAction={() => {\n navigateToAgrapp();\n }} />\n <div className={styles.stepOne}>\n <HorizontalStepper\n completedSteps={1}\n numberOfSteps={4} />\n <h1 className={styles.title}>{translate(\"onboarding.startForFree\")}</h1>\n <h4 className={styles.subtile}>{isMobile != null ? translate(\"onboarding.trialPeriodMobile\") : translate(\"onboarding.trialPeriodMobile\")}</h4>\n <div className={styles.fieldWrapper}>\n <Steps direction=\"vertical\" size=\"small\" current={2}>\n <Step className={tailClass(validUserName, errorUserName)} icon={userNameIcon} title={userNameTitle} description={userNameInput} />\n <Step className={tailClass(validEmail, errorEmail)} icon={userEmailIcon} title={userEmailTitle} description={userEmailInput} />\n <Step className={lastTailClass} icon={userPhoneIcon} title={userPhoneTitle} description={userPhoneInput} />\n <Step className={styles.mrRoboto} description={domoArigatoMrRoboto} />\n </Steps>\n </div>\n <div className={styles.btnWrapper}>\n <Button type=\"primary\"\n onClick={() => {\n sendData(true);\n }}>\n {loading ? (<img src={loader} />) : (translate(\"onboarding.continueAndConfigure\"))}\n </Button>\n <a className={styles.testDataWrap}\n onClick={() => {\n sendData(false);\n }}>\n {translate(\"onboarding.createFieldWithTestData\")}\n </a>\n </div>\n <div className={styles.footerImage}>\n <img src={FieldImg} />\n </div>\n </div>\n </div>\n <div className={styles.lateralImage}>\n <div className={styles.testimonyWrapper}>\n <div className={styles.innerWrapper}>\n <div className={styles.legends}>\n <div className={styles.title}>\n {translate(\"onboarding.costControl\")}\n </div>\n <div className={styles.subtitle}>\n {translate(\"onboarding.costInformation\")}\n </div>\n <div className={styles.separator}>\n </div>\n <div className={styles.subInfo}>\n {translate(\"onboarding.allCrops\")}\n </div>\n </div>\n </div>\n </div>\n </div>\n </div>\n </Layout>\n );\n}\n\nexport default Onboarding1\n","module.exports = __webpack_public_path__ + \"static/group-8@3x-427a73879f41e9ada484ddf0516fde88.png\";","// extracted by mini-css-extract-plugin\nmodule.exports = {\"primaryLighten5\":\"step-1-module--primaryLighten5--1xwhh\",\"primaryLighten4\":\"step-1-module--primaryLighten4--1RKi9\",\"primaryLighten3\":\"step-1-module--primaryLighten3--k99Jx\",\"primaryLighten2\":\"step-1-module--primaryLighten2--kkVgu\",\"primaryLighten1\":\"step-1-module--primaryLighten1--2gUB0\",\"primaryBase\":\"step-1-module--primaryBase--fuctf\",\"primaryDarken1\":\"step-1-module--primaryDarken1--sBV1X\",\"primaryDarken2\":\"step-1-module--primaryDarken2--3bf9e\",\"primaryDarken3\":\"step-1-module--primaryDarken3--3wWtl\",\"primaryDarken4\":\"step-1-module--primaryDarken4--BLejC\",\"secondaryLighten4\":\"step-1-module--secondaryLighten4--23LoX\",\"secondaryLighten3\":\"step-1-module--secondaryLighten3--8Plj0\",\"secondaryLighten2\":\"step-1-module--secondaryLighten2--1Mjil\",\"secondaryLighten1\":\"step-1-module--secondaryLighten1--26KzO\",\"secondaryBase\":\"step-1-module--secondaryBase--2_21B\",\"secondaryDarken1\":\"step-1-module--secondaryDarken1--1yquo\",\"secondaryDarken2\":\"step-1-module--secondaryDarken2--3wJRx\",\"secondaryDarken3\":\"step-1-module--secondaryDarken3--3JHNb\",\"secondaryDarken4\":\"step-1-module--secondaryDarken4--giwjx\",\"tertiaryLighten5\":\"step-1-module--tertiaryLighten5--2txWw\",\"tertiaryLighten4\":\"step-1-module--tertiaryLighten4--saWm6\",\"tertiaryLighten3\":\"step-1-module--tertiaryLighten3--UvJet\",\"tertiaryLighten2\":\"step-1-module--tertiaryLighten2--23N-h\",\"tertiaryLighten1\":\"step-1-module--tertiaryLighten1--2RAjD\",\"tertiaryBase\":\"step-1-module--tertiaryBase--1QLCa\",\"tertiaryDarken1\":\"step-1-module--tertiaryDarken1--1eUx4\",\"tertiaryDarken2\":\"step-1-module--tertiaryDarken2--1VcwT\",\"tertiaryDarken3\":\"step-1-module--tertiaryDarken3--1gvLi\",\"tertiaryDarken4\":\"step-1-module--tertiaryDarken4--Qzeuk\",\"validationCorrect\":\"step-1-module--validationCorrect---QJUB\",\"validationError\":\"step-1-module--validationError--2X_dF\",\"validationWarning\":\"step-1-module--validationWarning--fFdXw\",\"viewWrapper\":\"step-1-module--viewWrapper--1Fvl5\",\"stepOneWrapper\":\"step-1-module--stepOneWrapper--2C0xJ\",\"stepOne\":\"step-1-module--stepOne--Pg7XQ\",\"title\":\"step-1-module--title--20u23\",\"subtile\":\"step-1-module--subtile--VYmWT\",\"fieldWrapper\":\"step-1-module--fieldWrapper--2Rmcm\",\"itemTailActive\":\"step-1-module--itemTailActive--94kOJ\",\"itemTailInactative\":\"step-1-module--itemTailInactative--Uwwj-\",\"itemTailError\":\"step-1-module--itemTailError--36tuN\",\"lastTail\":\"step-1-module--lastTail--dnqFm\",\"mrRoboto\":\"step-1-module--mrRoboto--3XoRo\",\"stepTitle\":\"step-1-module--stepTitle--2hhIX\",\"inputStyle\":\"step-1-module--inputStyle--3cefk\",\"phoneInput\":\"step-1-module--phoneInput--3zJu_\",\"btnWrapper\":\"step-1-module--btnWrapper--1uoro\",\"testDataWrap\":\"step-1-module--testDataWrap--2juzy\",\"footerImage\":\"step-1-module--footerImage--37TPv\",\"lateralImage\":\"step-1-module--lateralImage--2nZnB\",\"testimonyWrapper\":\"step-1-module--testimonyWrapper--1Qnot\",\"innerWrapper\":\"step-1-module--innerWrapper--2Dnev\",\"testimony\":\"step-1-module--testimony--11LY6\",\"headerWrapper\":\"step-1-module--headerWrapper--2UXp2\",\"subTitle\":\"step-1-module--subTitle--2GJjO\",\"content\":\"step-1-module--content--3PO5l\",\"quotationOpen\":\"step-1-module--quotationOpen--IqQsK\",\"quotatedText\":\"step-1-module--quotatedText--1xATB\",\"quotationClose\":\"step-1-module--quotationClose--1EVLW\",\"chileanMap\":\"step-1-module--chileanMap--_CLLd\",\"legends\":\"step-1-module--legends--288c9\",\"subtitle\":\"step-1-module--subtitle--wMC0g\",\"separator\":\"step-1-module--separator--3x6kY\",\"subInfo\":\"step-1-module--subInfo--3Q022\"};"],"sourceRoot":""}