Browse Source

JAVA/JS/CPP: libphonenumber v6.0

pull/567/head
Lara Scheidegger 12 years ago
committed by Mihaela Rosca
parent
commit
5891032ffb
43 changed files with 22776 additions and 22635 deletions
  1. +2
    -2
      cpp/CMakeLists.txt
  2. +10710
    -10708
      cpp/src/phonenumbers/lite_metadata.cc
  3. +11557
    -11555
      cpp/src/phonenumbers/metadata.cc
  4. +69
    -56
      cpp/src/phonenumbers/phonenumbermatcher.cc
  5. +1
    -1
      cpp/src/phonenumbers/phonenumberutil.cc
  6. +60
    -5
      cpp/test/phonenumbers/phonenumbermatcher_test.cc
  7. +8
    -97
      cpp/test/phonenumbers/phonenumberutil_test.cc
  8. +1
    -1
      cpp/test/phonenumbers/shortnumberinfo_test.cc
  9. +20
    -0
      debian/changelog
  10. BIN
      java/carrier/src/com/google/i18n/phonenumbers/carrier/data/1684_en
  11. BIN
      java/carrier/src/com/google/i18n/phonenumbers/carrier/data/352_en
  12. BIN
      java/carrier/src/com/google/i18n/phonenumbers/carrier/data/config
  13. +0
    -2
      java/geocoder/src/com/google/i18n/phonenumbers/PhoneNumberToTimeZonesMapper.java
  14. +0
    -2
      java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java
  15. +0
    -2
      java/internal/prefixmapper/test/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMapTest.java
  16. +15
    -7
      java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java
  17. +0
    -2
      java/libphonenumber/src/com/google/i18n/phonenumbers/MetadataManager.java
  18. +0
    -1
      java/libphonenumber/src/com/google/i18n/phonenumbers/NumberParseException.java
  19. +0
    -2
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatch.java
  20. +50
    -51
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java
  21. +1
    -2
      java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java
  22. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS
  23. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BR
  24. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW
  25. BIN
      java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU
  26. +35
    -0
      java/libphonenumber/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java
  27. +0
    -2
      java/libphonenumber/test/com/google/i18n/phonenumbers/ExampleNumbersTest.java
  28. +0
    -2
      java/libphonenumber/test/com/google/i18n/phonenumbers/MetadataManagerTest.java
  29. +0
    -2
      java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberMatchTest.java
  30. +52
    -11
      java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java
  31. +4
    -7
      java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java
  32. +0
    -1
      java/libphonenumber/test/com/google/i18n/phonenumbers/TestMetadataTestCase.java
  33. +15
    -0
      java/release_notes.txt
  34. +20
    -7
      javascript/i18n/phonenumbers/asyoutypeformatter.js
  35. +32
    -0
      javascript/i18n/phonenumbers/asyoutypeformatter_test.js
  36. +78
    -79
      javascript/i18n/phonenumbers/demo-compiled.js
  37. +4
    -4
      javascript/i18n/phonenumbers/metadata.js
  38. +4
    -4
      javascript/i18n/phonenumbers/metadatalite.js
  39. +2
    -2
      javascript/i18n/phonenumbers/phonenumberutil.js
  40. +1
    -1
      javascript/i18n/phonenumbers/phonenumberutil_test.js
  41. +20
    -10
      resources/PhoneNumberMetadata.xml
  42. +7
    -0
      resources/carrier/en/1.txt
  43. +8
    -7
      resources/carrier/en/352.txt

+ 2
- 2
cpp/CMakeLists.txt View File

@ -17,8 +17,8 @@
cmake_minimum_required (VERSION 2.8)
project (libphonenumber)
set (libphonenumber_VERSION_MAJOR 5)
set (libphonenumber_VERSION_MINOR 9)
set (libphonenumber_VERSION_MAJOR 6)
set (libphonenumber_VERSION_MINOR 0)
# Helper functions dealing with finding libraries and programs this library
# depends on.


+ 10710
- 10708
cpp/src/phonenumbers/lite_metadata.cc
File diff suppressed because it is too large
View File


+ 11557
- 11555
cpp/src/phonenumbers/metadata.cc
File diff suppressed because it is too large
View File


+ 69
- 56
cpp/src/phonenumbers/phonenumbermatcher.cc View File

@ -249,11 +249,17 @@ class PhoneNumberMatcherRegExps : public Singleton<PhoneNumberMatcherRegExps> {
// within a phone number. This also checks that there is something inside the
// brackets. Having no brackets at all is also fine.
scoped_ptr<const RegExp> matching_brackets_;
// Matches white-space, which may indicate the end of a phone number and the
// start of something else (such as a neighbouring zip-code). If white-space
// is found, continues to match all characters that are not typically used to
// start a phone number.
scoped_ptr<const RegExp> group_separator_;
// Patterns used to extract phone numbers from a larger phone-number-like
// pattern. These are ordered according to specificity. For example,
// white-space is last since that is frequently used in numbers, not just to
// separate two numbers. We have separate patterns since we don't want to
// break up the phone-number-like text on more than one different kind of
// symbol at one time, although symbols of the same type (e.g. space) can be
// safely grouped together.
//
// Note that if there is a match, we will always check any text found up to
// the first match as well.
scoped_ptr<vector<const RegExp*> > inner_matches_;
scoped_ptr<const RegExp> capture_up_to_second_number_start_pattern_;
scoped_ptr<const RegExp> capturing_ascii_digits_pattern_;
// Compiled reg-ex representing lead_class_;
@ -304,8 +310,7 @@ class PhoneNumberMatcherRegExps : public Singleton<PhoneNumberMatcherRegExps> {
matching_brackets_(regexp_factory_->CreateRegExp(
StrCat(leading_maybe_matched_bracket_, non_parens_, "+",
bracket_pairs_, non_parens_, "*"))),
group_separator_(regexp_factory_->CreateRegExp(
StrCat("\\p{Z}", "[^", lead_class_chars_, "\\p{Nd}]*"))),
inner_matches_(new vector<const RegExp*>()),
capture_up_to_second_number_start_pattern_(
regexp_factory_->CreateRegExp(
PhoneNumberUtil::kCaptureUpToSecondNumberStart)),
@ -316,6 +321,33 @@ class PhoneNumberMatcherRegExps : public Singleton<PhoneNumberMatcherRegExps> {
StrCat("(", opening_punctuation_, lead_limit_,
digit_sequence_, "(?:", punctuation_, digit_sequence_, ")",
block_limit_, optional_extn_pattern_, ")"))) {
inner_matches_->push_back(
// Breaks on the slash - e.g. "651-234-2345/332-445-1234"
regexp_factory_->CreateRegExp("/+(.*)"));
inner_matches_->push_back(
// Note that the bracket here is inside the capturing group, since we
// consider it part of the phone number. Will match a pattern like
// "(650) 223 3345 (754) 223 3321".
regexp_factory_->CreateRegExp("(\\([^(]*)"));
inner_matches_->push_back(
// Breaks on a hyphen - e.g. "12345 - 332-445-1234 is my number." We
// require a space on either side of the hyphen for it to be considered
// a separator.
regexp_factory_->CreateRegExp("(?:\\p{Z}-|-\\p{Z})\\p{Z}*(.+)"));
inner_matches_->push_back(
// Various types of wide hyphens. Note we have decided not to enforce a
// space here, since it's possible that it's supposed to be used to
// break two numbers without spaces, and we haven't seen many instances
// of it used within a number.
regexp_factory_->CreateRegExp(
"[\xE2\x80\x92-\x2D\xE2\x80\x95\xEF\xBC\x8D]" /* "‒-―-" */
"\\p{Z}*(.+)"));
inner_matches_->push_back(
// Breaks on a full stop - e.g. "12345. 332-445-1234 is my number."
regexp_factory_->CreateRegExp("\\.+\\p{Z}*([^.]+)"));
inner_matches_->push_back(
// Breaks on space - e.g. "3324451234 8002341234"
regexp_factory_->CreateRegExp("\\p{Z}+(\\P{Z}+)"));
}
private:
@ -412,7 +444,8 @@ bool PhoneNumberMatcher::ParseAndVerify(const string& candidate, int offset,
DCHECK(match);
// Check the candidate doesn't contain any formatting which would indicate
// that it really isn't a phone number.
if (!reg_exps_->matching_brackets_->FullMatch(candidate)) {
if (!reg_exps_->matching_brackets_->FullMatch(candidate) ||
reg_exps_->pub_pages_->PartialMatch(candidate)) {
return false;
}
@ -557,50 +590,30 @@ bool PhoneNumberMatcher::VerifyAccordingToLeniency(
bool PhoneNumberMatcher::ExtractInnerMatch(const string& candidate, int offset,
PhoneNumberMatch* match) {
DCHECK(match);
// Try removing either the first or last "group" in the number and see if this
// gives a result. We consider white space to be a possible indication of
// the start or end of the phone number.
scoped_ptr<RegExpInput> candidate_input(
reg_exps_->regexp_factory_->CreateInput(candidate));
if (reg_exps_->group_separator_->FindAndConsume(candidate_input.get(),
NULL)) {
// Try the first group by itself.
int group_start_index =
candidate.length() - candidate_input->ToString().length();
string first_group_only = candidate.substr(0, group_start_index);
phone_util_.TrimUnwantedEndChars(&first_group_only);
bool success = ParseAndVerify(first_group_only, offset, match);
if (success) {
return true;
}
--max_tries_;
// Try the rest of the candidate without the first group.
string without_first_group(candidate_input->ToString());
phone_util_.TrimUnwantedEndChars(&without_first_group);
success =
ParseAndVerify(without_first_group, offset + group_start_index, match);
if (success) {
return true;
}
--max_tries_;
if (max_tries_ > 0) {
while (reg_exps_->group_separator_->FindAndConsume(candidate_input.get(),
NULL)) {
// Find the last group.
}
int last_group_start =
candidate.length() - candidate_input->ToString().length();
string without_last_group = candidate.substr(0, last_group_start);
phone_util_.TrimUnwantedEndChars(&without_last_group);
if (without_last_group == first_group_only) {
// If there are only two groups, then the group "without the last group"
// is the same as the first group. In these cases, we don't want to
// re-check the number group, so we exit already.
return false;
for (vector<const RegExp*>::const_iterator regex =
reg_exps_->inner_matches_->begin();
regex != reg_exps_->inner_matches_->end(); regex++) {
scoped_ptr<RegExpInput> candidate_input(
reg_exps_->regexp_factory_->CreateInput(candidate));
bool is_first_match = true;
string group;
while ((*regex)->FindAndConsume(candidate_input.get(), &group) &&
max_tries_ > 0) {
int group_start_index = candidate.length() -
candidate_input->ToString().length() - group.length();
if (is_first_match) {
// We should handle any group before this one too.
string first_group_only = candidate.substr(0, group_start_index);
phone_util_.TrimUnwantedEndChars(&first_group_only);
bool success = ParseAndVerify(first_group_only, offset, match);
if (success) {
return true;
}
--max_tries_;
is_first_match = false;
}
success = ParseAndVerify(without_last_group, offset, match);
phone_util_.TrimUnwantedEndChars(&group);
bool success = ParseAndVerify(group, offset + group_start_index, match);
if (success) {
return true;
}
@ -613,11 +626,11 @@ bool PhoneNumberMatcher::ExtractInnerMatch(const string& candidate, int offset,
bool PhoneNumberMatcher::ExtractMatch(const string& candidate, int offset,
PhoneNumberMatch* match) {
DCHECK(match);
// Skip a match that is more likely a publication page reference or a date.
if (reg_exps_->pub_pages_->PartialMatch(candidate) ||
reg_exps_->slash_separated_dates_->PartialMatch(candidate)) {
// Skip a match that is more likely to be a date.
if (reg_exps_->slash_separated_dates_->PartialMatch(candidate)) {
return false;
}
// Skip potential time-stamps.
if (reg_exps_->time_stamps_->PartialMatch(candidate)) {
scoped_ptr<RegExpInput> following_text(
@ -813,8 +826,8 @@ bool PhoneNumberMatcher::AllNumberGroupsAreExactlyPresent(
const PhoneNumber& phone_number,
const string& normalized_candidate,
const vector<string>& formatted_number_groups) const {
const scoped_ptr<RegExpInput> candidate_number(
reg_exps_->regexp_factory_->CreateInput(normalized_candidate));
const scoped_ptr<RegExpInput> candidate_number(
reg_exps_->regexp_factory_->CreateInput(normalized_candidate));
vector<string> candidate_groups;
string digit_block;
while (reg_exps_->capturing_ascii_digits_pattern_->FindAndConsume(


+ 1
- 1
cpp/src/phonenumbers/phonenumberutil.cc View File

@ -1886,7 +1886,7 @@ PhoneNumberUtil::ErrorType PhoneNumberUtil::ParseHelper(
uint64 number_as_int;
safe_strtou64(normalized_national_number, &number_as_int);
temp_number.set_national_number(number_as_int);
phone_number->MergeFrom(temp_number);
phone_number->Swap(&temp_number);
return NO_PARSING_ERROR;
}


+ 60
- 5
cpp/test/phonenumbers/phonenumbermatcher_test.cc View File

@ -140,6 +140,17 @@ class PhoneNumberMatcherTest : public testing::Test {
}
}
// Asserts that the raw string and expected proto buffer for a match are set
// appropriately.
void AssertMatchProperties(const PhoneNumberMatch& match, const string& text,
const string& number, const string& region_code) {
PhoneNumber expected_result;
phone_util_.Parse(number, region_code, &expected_result);
EXPECT_EQ(expected_result, match.number());
EXPECT_EQ(number, match.raw_string()) << " Wrong number found in " << text;
}
// Asserts that another number can be found in "text" starting at "index", and
// that its corresponding range is [start, end).
void AssertEqualRange(const string& text, int index, int start, int end) {
@ -395,7 +406,8 @@ TEST_F(PhoneNumberMatcherTest, FindNationalNumber) {
DoTestFindInContext("64(0)64123456", RegionCode::NZ());
// Check that using a "/" is fine in a phone number.
DoTestFindInContext("123/45678", RegionCode::DE());
// Note that real Polish numbers do *not* start with a 0.
DoTestFindInContext("0123/456789", RegionCode::PL());
DoTestFindInContext("123-456-7890", RegionCode::US());
}
@ -543,6 +555,50 @@ TEST_F(PhoneNumberMatcherTest, IntermediateParsePositions) {
}
}
TEST_F(PhoneNumberMatcherTest, FourMatchesInARow) {
string number1 = "415-666-7777";
string number2 = "800-443-1223";
string number3 = "212-443-1223";
string number4 = "650-443-1223";
string text = StrCat(number1, " - ", number2, " - ", number3, " - ", number4);
PhoneNumberMatcher matcher(text, RegionCode::US());
PhoneNumberMatch match;
EXPECT_TRUE(matcher.HasNext());
EXPECT_TRUE(matcher.Next(&match));
AssertMatchProperties(match, text, number1, RegionCode::US());
EXPECT_TRUE(matcher.HasNext());
EXPECT_TRUE(matcher.Next(&match));
AssertMatchProperties(match, text, number2, RegionCode::US());
EXPECT_TRUE(matcher.HasNext());
EXPECT_TRUE(matcher.Next(&match));
AssertMatchProperties(match, text, number3, RegionCode::US());
EXPECT_TRUE(matcher.HasNext());
EXPECT_TRUE(matcher.Next(&match));
AssertMatchProperties(match, text, number4, RegionCode::US());
}
TEST_F(PhoneNumberMatcherTest, MatchesFoundWithMultipleSpaces) {
string number1 = "415-666-7777";
string number2 = "800-443-1223";
string text = StrCat(number1, " ", number2);
PhoneNumberMatcher matcher(text, RegionCode::US());
PhoneNumberMatch match;
EXPECT_TRUE(matcher.HasNext());
EXPECT_TRUE(matcher.Next(&match));
AssertMatchProperties(match, text, number1, RegionCode::US());
EXPECT_TRUE(matcher.HasNext());
EXPECT_TRUE(matcher.Next(&match));
AssertMatchProperties(match, text, number2, RegionCode::US());
}
TEST_F(PhoneNumberMatcherTest, MatchWithSurroundingZipcodes) {
string number = "415-666-7777";
string zip_preceding =
@ -557,8 +613,7 @@ TEST_F(PhoneNumberMatcherTest, MatchWithSurroundingZipcodes) {
PhoneNumberMatch match;
EXPECT_TRUE(matcher->HasNext());
EXPECT_TRUE(matcher->Next(&match));
EXPECT_EQ(expected_result, match.number());
EXPECT_EQ(number, match.raw_string());
AssertMatchProperties(match, zip_preceding, number, RegionCode::US());
// Now repeat, but this time the phone number has spaces in it. It should
// still be found.
@ -573,8 +628,8 @@ TEST_F(PhoneNumberMatcherTest, MatchWithSurroundingZipcodes) {
PhoneNumberMatch match_with_spaces;
EXPECT_TRUE(matcher->HasNext());
EXPECT_TRUE(matcher->Next(&match_with_spaces));
EXPECT_EQ(expected_result, match_with_spaces.number());
EXPECT_EQ(number, match_with_spaces.raw_string());
AssertMatchProperties(
match_with_spaces, zip_following, number, RegionCode::US());
}
TEST_F(PhoneNumberMatcherTest, IsLatinLetter) {


+ 8
- 97
cpp/test/phonenumbers/phonenumberutil_test.cc View File

@ -316,23 +316,25 @@ TEST_F(PhoneNumberUtilTest, GetExampleNumber) {
bool success = phone_util_.GetExampleNumber(RegionCode::DE(), &test_number);
EXPECT_TRUE(success);
EXPECT_EQ(de_number, test_number);
success = phone_util_.GetExampleNumberForType(RegionCode::DE(),
PhoneNumberUtil::FIXED_LINE,
&test_number);
EXPECT_TRUE(success);
EXPECT_EQ(de_number, test_number);
test_number.Clear();
success = phone_util_.GetExampleNumberForType(RegionCode::DE(),
PhoneNumberUtil::MOBILE,
&test_number);
// Here we test that an example number was not returned, and that the number
// passed in was not modified.
test_number.Clear();
EXPECT_FALSE(success);
EXPECT_EQ(PhoneNumber::default_instance(), test_number);
// For the US, the example number is placed under general description, and
// hence should be used for both fixed line and mobile, so neither of these
// should return null.
test_number.Clear();
success = phone_util_.GetExampleNumberForType(RegionCode::US(),
PhoneNumberUtil::FIXED_LINE,
&test_number);
@ -340,21 +342,19 @@ TEST_F(PhoneNumberUtilTest, GetExampleNumber) {
// number passed in was modified.
EXPECT_TRUE(success);
EXPECT_NE(PhoneNumber::default_instance(), test_number);
test_number.Clear();
success = phone_util_.GetExampleNumberForType(RegionCode::US(),
PhoneNumberUtil::MOBILE,
&test_number);
EXPECT_TRUE(success);
EXPECT_NE(PhoneNumber::default_instance(), test_number);
test_number.Clear();
// CS is an invalid region, so we have no data for it. We should return false.
test_number.Clear();
EXPECT_FALSE(phone_util_.GetExampleNumberForType(RegionCode::CS(),
PhoneNumberUtil::MOBILE,
&test_number));
EXPECT_EQ(PhoneNumber::default_instance(), test_number);
test_number.Clear();
// RegionCode 001 is reserved for supporting non-geographical country calling
// code. We don't support getting an example number for it with this method.
EXPECT_FALSE(phone_util_.GetExampleNumber(RegionCode::UN001(), &test_number));
@ -1740,7 +1740,7 @@ TEST_F(PhoneNumberUtilTest, IsPossibleNumberWithReason) {
EXPECT_EQ(PhoneNumberUtil::TOO_SHORT,
phone_util_.IsPossibleNumberWithReason(ad_number));
ad_number.set_country_code(376);
ad_number.set_national_number(12345678901234567ULL);
ad_number.set_national_number(123456789012345678ULL);
EXPECT_EQ(PhoneNumberUtil::TOO_LONG,
phone_util_.IsPossibleNumberWithReason(ad_number));
}
@ -2998,36 +2998,30 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
EXPECT_EQ(nz_number, test_number);
// Testing international prefixes.
// Should strip country code.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0064 3 331 6005",
RegionCode::NZ(), &test_number));
EXPECT_EQ(nz_number, test_number);
// Try again, but this time we have an international number with Region Code
// US. It should recognise the country code and parse accordingly.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("01164 3 331 6005",
RegionCode::US(), &test_number));
EXPECT_EQ(nz_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+64 3 331 6005",
RegionCode::US(), &test_number));
EXPECT_EQ(nz_number, test_number);
// We should ignore the leading plus here, since it is not followed by a valid
// country code but instead is followed by the IDD for the US.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+01164 3 331 6005",
RegionCode::US(), &test_number));
EXPECT_EQ(nz_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+0064 3 331 6005",
RegionCode::NZ(), &test_number));
EXPECT_EQ(nz_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+ 00 64 3 331 6005",
RegionCode::NZ(), &test_number));
@ -3036,12 +3030,10 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
PhoneNumber us_local_number;
us_local_number.set_country_code(1);
us_local_number.set_national_number(2530000ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("tel:253-0000;phone-context=www.google.com",
RegionCode::US(), &test_number));
EXPECT_EQ(us_local_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse(
"tel:253-0000;isub=12345;phone-context=www.google.com",
@ -3050,12 +3042,10 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
// This is invalid because no "+" sign is present as part of phone-context.
// The phone context is simply ignored in this case just as if it contains a
// domain.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("tel:2530000;isub=12345;phone-context=1-650",
RegionCode::US(), &test_number));
EXPECT_EQ(us_local_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("tel:2530000;isub=12345;phone-context=1234.com",
RegionCode::US(), &test_number));
@ -3065,7 +3055,6 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
nz_number.Clear();
nz_number.set_country_code(64);
nz_number.set_national_number(64123456ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+64(0)64123456",
RegionCode::US(), &test_number));
@ -3075,7 +3064,6 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
PhoneNumber de_number;
de_number.set_country_code(49);
de_number.set_national_number(12345678ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("123/45678", RegionCode::DE(), &test_number));
EXPECT_EQ(de_number, test_number);
@ -3085,7 +3073,6 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
// Check it doesn't use the '1' as a country code when parsing if the phone
// number was already possible.
us_number.set_national_number(1234567890ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("123-456-7890", RegionCode::US(), &test_number));
EXPECT_EQ(us_number, test_number);
@ -3095,7 +3082,6 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
PhoneNumber star_number;
star_number.set_country_code(81);
star_number.set_national_number(2345ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+81 *2345", RegionCode::JP(), &test_number));
EXPECT_EQ(star_number, test_number);
@ -3103,7 +3089,6 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumber) {
PhoneNumber short_number;
short_number.set_country_code(64);
short_number.set_national_number(12ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("12", RegionCode::NZ(), &test_number));
EXPECT_EQ(short_number, test_number);
@ -3119,7 +3104,6 @@ TEST_F(PhoneNumberUtilTest, ParseNumberWithAlphaCharacters) {
phone_util_.Parse("0800 DDA 005", RegionCode::NZ(), &test_number));
EXPECT_EQ(tollfree_number, test_number);
test_number.Clear();
PhoneNumber premium_number;
premium_number.set_country_code(64);
premium_number.set_national_number(9003326005ULL);
@ -3129,24 +3113,20 @@ TEST_F(PhoneNumberUtilTest, ParseNumberWithAlphaCharacters) {
// Not enough alpha characters for them to be considered intentional, so they
// are stripped.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0900 332 6005a",
RegionCode::NZ(), &test_number));
EXPECT_EQ(premium_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0900 332 600a5",
RegionCode::NZ(), &test_number));
EXPECT_EQ(premium_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0900 332 600A5",
RegionCode::NZ(), &test_number));
EXPECT_EQ(premium_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0900 a332 600A5",
RegionCode::NZ(), &test_number));
@ -3162,7 +3142,6 @@ TEST_F(PhoneNumberUtilTest, ParseWithInternationalPrefixes) {
phone_util_.Parse("+1 (650) 333-6000",
RegionCode::US(), &test_number));
EXPECT_EQ(us_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+1-650-333-6000",
RegionCode::US(), &test_number));
@ -3170,44 +3149,37 @@ TEST_F(PhoneNumberUtilTest, ParseWithInternationalPrefixes) {
// Calling the US number from Singapore by using different service providers
// 1st test: calling using SingTel IDD service (IDD is 001)
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0011-650-333-6000",
RegionCode::SG(), &test_number));
EXPECT_EQ(us_number, test_number);
// 2nd test: calling using StarHub IDD service (IDD is 008)
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0081-650-333-6000",
RegionCode::SG(), &test_number));
EXPECT_EQ(us_number, test_number);
// 3rd test: calling using SingTel V019 service (IDD is 019)
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0191-650-333-6000",
RegionCode::SG(), &test_number));
EXPECT_EQ(us_number, test_number);
// Calling the US number from Poland
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0~01-650-333-6000",
RegionCode::PL(), &test_number));
EXPECT_EQ(us_number, test_number);
// Using "++" at the start.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("++1 (650) 333-6000",
RegionCode::PL(), &test_number));
EXPECT_EQ(us_number, test_number);
// Using a full-width plus sign.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("\xEF\xBC\x8B" "1 (650) 333-6000",
/* "+1 (650) 333-6000" */
RegionCode::SG(), &test_number));
// Using a soft hyphen U+00AD.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("1 (650) 333" "\xC2\xAD" "-6000",
/* "1 (650) 333­-6000­" */
@ -3215,7 +3187,6 @@ TEST_F(PhoneNumberUtilTest, ParseWithInternationalPrefixes) {
EXPECT_EQ(us_number, test_number);
// The whole number, including punctuation, is here represented in full-width
// form.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("\xEF\xBC\x8B\xEF\xBC\x91\xE3\x80\x80\xEF\xBC\x88"
"\xEF\xBC\x96\xEF\xBC\x95\xEF\xBC\x90\xEF\xBC\x89"
@ -3227,7 +3198,6 @@ TEST_F(PhoneNumberUtilTest, ParseWithInternationalPrefixes) {
EXPECT_EQ(us_number, test_number);
// Using the U+30FC dash.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("\xEF\xBC\x8B\xEF\xBC\x91\xE3\x80\x80\xEF\xBC\x88"
"\xEF\xBC\x96\xEF\xBC\x95\xEF\xBC\x90\xEF\xBC\x89"
@ -3241,7 +3211,6 @@ TEST_F(PhoneNumberUtilTest, ParseWithInternationalPrefixes) {
PhoneNumber toll_free_number;
toll_free_number.set_country_code(800);
toll_free_number.set_national_number(12345678ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("011 800 1234 5678",
RegionCode::US(), &test_number));
@ -3258,7 +3227,6 @@ TEST_F(PhoneNumberUtilTest, ParseWithLeadingZero) {
phone_util_.Parse("+39 02-36618 300",
RegionCode::NZ(), &test_number));
EXPECT_EQ(it_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("02-36618 300", RegionCode::IT(), &test_number));
EXPECT_EQ(it_number, test_number);
@ -3266,7 +3234,6 @@ TEST_F(PhoneNumberUtilTest, ParseWithLeadingZero) {
it_number.Clear();
it_number.set_country_code(39);
it_number.set_national_number(312345678ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("312 345 678", RegionCode::IT(), &test_number));
EXPECT_EQ(it_number, test_number);
@ -3282,19 +3249,16 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumberArgentina) {
phone_util_.Parse("+54 9 343 555 1212", RegionCode::AR(),
&test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0343 15 555 1212", RegionCode::AR(),
&test_number));
EXPECT_EQ(ar_number, test_number);
ar_number.set_national_number(93715654320ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+54 9 3715 65 4320", RegionCode::AR(),
&test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("03715 15 65 4320", RegionCode::AR(),
&test_number));
@ -3302,34 +3266,28 @@ TEST_F(PhoneNumberUtilTest, ParseNationalNumberArgentina) {
// Test parsing fixed-line numbers of Argentina.
ar_number.set_national_number(1137970000ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+54 11 3797 0000", RegionCode::AR(),
&test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("011 3797 0000", RegionCode::AR(), &test_number));
EXPECT_EQ(ar_number, test_number);
ar_number.set_national_number(3715654321ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+54 3715 65 4321", RegionCode::AR(),
&test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("03715 65 4321", RegionCode::AR(), &test_number));
EXPECT_EQ(ar_number, test_number);
ar_number.set_national_number(2312340000ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+54 23 1234 0000", RegionCode::AR(),
&test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("023 1234 0000", RegionCode::AR(), &test_number));
EXPECT_EQ(ar_number, test_number);
@ -3345,15 +3303,12 @@ TEST_F(PhoneNumberUtilTest, ParseWithXInNumber) {
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0123456789", RegionCode::AR(), &test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(0) 123456789", RegionCode::AR(), &test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0 123456789", RegionCode::AR(), &test_number));
EXPECT_EQ(ar_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(0xx) 123456789", RegionCode::AR(),
&test_number));
@ -3367,7 +3322,6 @@ TEST_F(PhoneNumberUtilTest, ParseWithXInNumber) {
// extension, as we allow extensions up to 7 digits. This assumption is okay
// for now as all the countries where a carrier selection code is written in
// the form of xx have a national significant number of length larger than 7.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("011xx5481429712", RegionCode::US(),
&test_number));
@ -3385,12 +3339,10 @@ TEST_F(PhoneNumberUtilTest, ParseNumbersMexico) {
phone_util_.Parse("+52 (449)978-0001", RegionCode::MX(),
&test_number));
EXPECT_EQ(mx_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("01 (449)978-0001", RegionCode::MX(),
&test_number));
EXPECT_EQ(mx_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(449)978-0001", RegionCode::MX(),
&test_number));
@ -3400,17 +3352,14 @@ TEST_F(PhoneNumberUtilTest, ParseNumbersMexico) {
mx_number.Clear();
mx_number.set_country_code(52);
mx_number.set_national_number(13312345678ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+52 1 33 1234-5678", RegionCode::MX(),
&test_number));
EXPECT_EQ(mx_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("044 (33) 1234-5678", RegionCode::MX(),
&test_number));
EXPECT_EQ(mx_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("045 33 1234-5678", RegionCode::MX(),
&test_number));
@ -3603,7 +3552,6 @@ TEST_F(PhoneNumberUtilTest, ParseNumberTooShortIfNationalPrefixStripped) {
&test_number));
EXPECT_EQ(by_number, test_number);
by_number.set_national_number(81234L);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("81234", RegionCode::BY(),
&test_number));
@ -3612,7 +3560,6 @@ TEST_F(PhoneNumberUtilTest, ParseNumberTooShortIfNationalPrefixStripped) {
// The prefix doesn't get stripped, since the input is a viable 6-digit
// number, whereas the result of stripping is only 5 digits.
by_number.set_national_number(812345L);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("812345", RegionCode::BY(),
&test_number));
@ -3620,7 +3567,6 @@ TEST_F(PhoneNumberUtilTest, ParseNumberTooShortIfNationalPrefixStripped) {
// The prefix gets stripped, since only 6-digit numbers are possible.
by_number.set_national_number(123456L);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("8123456", RegionCode::BY(),
&test_number));
@ -3637,17 +3583,14 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
phone_util_.Parse("03 331 6005 ext 3456", RegionCode::NZ(),
&test_number));
EXPECT_EQ(nz_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("03 331 6005x3456", RegionCode::NZ(),
&test_number));
EXPECT_EQ(nz_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("03-331 6005 int.3456", RegionCode::NZ(),
&test_number));
EXPECT_EQ(nz_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("03 331 6005 #3456", RegionCode::NZ(),
&test_number));
@ -3657,22 +3600,18 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
PhoneNumber non_extn_number;
non_extn_number.set_country_code(1);
non_extn_number.set_national_number(80074935247ULL);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("1800 six-flags", RegionCode::US(),
&test_number));
EXPECT_EQ(non_extn_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("1800 SIX-FLAGS", RegionCode::US(),
&test_number));
EXPECT_EQ(non_extn_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0~0 1800 7493 5247", RegionCode::PL(),
&test_number));
EXPECT_EQ(non_extn_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(1800) 7493.5247", RegionCode::US(),
&test_number));
@ -3683,7 +3622,6 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
extn_number.set_country_code(1);
extn_number.set_national_number(80074935247ULL);
extn_number.set_extension("1234");
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("0~0 1800 7493 5247 ~1234", RegionCode::PL(),
&test_number));
@ -3696,73 +3634,60 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
uk_number.set_country_code(44);
uk_number.set_national_number(2034567890ULL);
uk_number.set_extension("456");
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890x456", RegionCode::NZ(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890x456", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890 x456", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890 X456", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890 X 456", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890 X 456", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890 x 456 ", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44 2034567890 X 456", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44-2034567890;ext=456", RegionCode::GB(),
&test_number));
EXPECT_EQ(uk_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("tel:2034567890;ext=456;phone-context=+44",
RegionCode::ZZ(), &test_number));
EXPECT_EQ(uk_number, test_number);
// Full-width extension, "extn" only.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse(
"+442034567890\xEF\xBD\x85\xEF\xBD\x98\xEF\xBD\x94\xEF\xBD\x8E"
"456", RegionCode::GB(), &test_number));
EXPECT_EQ(uk_number, test_number);
// "xtn" only.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse(
"+44-2034567890\xEF\xBD\x98\xEF\xBD\x94\xEF\xBD\x8E""456",
RegionCode::GB(), &test_number));
EXPECT_EQ(uk_number, test_number);
// "xt" only.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+44-2034567890\xEF\xBD\x98\xEF\xBD\x94""456",
RegionCode::GB(), &test_number));
@ -3772,30 +3697,25 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
us_with_extension.set_country_code(1);
us_with_extension.set_national_number(8009013355ULL);
us_with_extension.set_extension("7246433");
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(800) 901-3355 x 7246433", RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_extension, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(800) 901-3355 , ext 7246433", RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_extension, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(800) 901-3355 ,extension 7246433",
RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_extension, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(800) 901-3355 ,extensi\xC3\xB3n 7246433",
/* "(800) 901-3355 ,extensión 7246433" */
RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_extension, test_number);
test_number.Clear();
// Repeat with the small letter o with acute accent created by combining
// characters.
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
@ -3804,12 +3724,10 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_extension, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(800) 901-3355 , 7246433", RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_extension, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(800) 901-3355 ext: 7246433", RegionCode::US(),
&test_number));
@ -3820,17 +3738,14 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
us_with_two_extensions_number.set_country_code(1);
us_with_two_extensions_number.set_national_number(2121231234ULL);
us_with_two_extensions_number.set_extension("508");
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(212)123-1234 x508/x1234", RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_two_extensions_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(212)123-1234 x508/ x1234", RegionCode::US(),
&test_number));
EXPECT_EQ(us_with_two_extensions_number, test_number);
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("(212)123-1234 x508\\x1234", RegionCode::US(),
&test_number));
@ -3842,7 +3757,6 @@ TEST_F(PhoneNumberUtilTest, ParseExtensions) {
us_with_extension.set_country_code(1);
us_with_extension.set_national_number(6451231234ULL);
us_with_extension.set_extension("910");
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::NO_PARSING_ERROR,
phone_util_.Parse("+1 (645) 123 1234-910#", RegionCode::US(),
&test_number));
@ -3890,7 +3804,8 @@ TEST_F(PhoneNumberUtilTest, ParseAndKeepRaw) {
&test_number));
EXPECT_EQ(alpha_numeric_number, test_number);
// Try with invalid region - expect failure.
// Try with invalid region - expect failure. We clear the test number first
// because if parsing isn't successful, the number parsed in won't be changed.
test_number.Clear();
EXPECT_EQ(PhoneNumberUtil::INVALID_COUNTRY_CODE_ERROR,
phone_util_.Parse("123 456 7890", RegionCode::CS(), &test_number));
@ -3921,7 +3836,6 @@ TEST_F(PhoneNumberUtilTest, ParseItalianLeadingZeros) {
phone_util_.Parse("011", RegionCode::AU(),
&test_number));
EXPECT_EQ(zeros_number, test_number);
test_number.Clear();
// Test the number "001".
zeros_number.set_national_number(1L);
@ -3931,7 +3845,6 @@ TEST_F(PhoneNumberUtilTest, ParseItalianLeadingZeros) {
phone_util_.Parse("001", RegionCode::AU(),
&test_number));
EXPECT_EQ(zeros_number, test_number);
test_number.Clear();
// Test the number "000". This number has 2 leading zeros.
zeros_number.set_national_number(0L);
@ -3941,7 +3854,6 @@ TEST_F(PhoneNumberUtilTest, ParseItalianLeadingZeros) {
phone_util_.Parse("000", RegionCode::AU(),
&test_number));
EXPECT_EQ(zeros_number, test_number);
test_number.Clear();
// Test the number "0000". This number has 3 leading zeros.
zeros_number.set_national_number(0L);
@ -3951,7 +3863,6 @@ TEST_F(PhoneNumberUtilTest, ParseItalianLeadingZeros) {
phone_util_.Parse("0000", RegionCode::AU(),
&test_number));
EXPECT_EQ(zeros_number, test_number);
test_number.Clear();
}
TEST_F(PhoneNumberUtilTest, CanBeInternationallyDialled) {


+ 1
- 1
cpp/test/phonenumbers/shortnumberinfo_test.cc View File

@ -151,7 +151,7 @@ TEST_F(ShortNumberInfoTest, GetExpectedCost) {
// Test a nonexistent country code.
EXPECT_EQ(ShortNumberInfo::ShortNumberCost::UNKNOWN_COST,
short_info_.GetExpectedCostForRegion("911", RegionCode::ZZ()));
unknown_cost_number.clear();
unknown_cost_number.Clear();
unknown_cost_number.set_country_code(123);
unknown_cost_number.set_national_number(911ULL);
EXPECT_EQ(ShortNumberInfo::ShortNumberCost::UNKNOWN_COST,


+ 20
- 0
debian/changelog View File

@ -1,3 +1,23 @@
libphonenumber (6.0) precise; urgency=low
* Code changes:
- Better support for detecting phone numbers in text that are beside each
other
- Change to how Japanese numbers beginning with "00" are modelled, with the
side-effect that the maximum possible number length has been extended by
1.
- Handle StringIndexOutOfBoundsException in the AsYouTypeFormatter when the
national prefix that was extracted was not found in the prefix. This
affected countries with very long carrier codes, such as Korea.
- Removal of some of the author attributions - contributions to be tracked
in CONTRIBUTORS file.
* Metadata changes:
- Updated phone metadata for region code(s): AS, BR, KW, LU
- New carrier data for country calling code(s): 1684 (en)
- Updated carrier data for country calling code(s): 352 (en)
-- Lara Scheidegger <lararennie@google.com> Tue, 25 Feb 2014 13:57:19 +0100
libphonenumber (5.9.4) precise; urgency=low
* Metadata changes:


BIN
java/carrier/src/com/google/i18n/phonenumbers/carrier/data/1684_en View File


BIN
java/carrier/src/com/google/i18n/phonenumbers/carrier/data/352_en View File


BIN
java/carrier/src/com/google/i18n/phonenumbers/carrier/data/config View File


+ 0
- 2
java/geocoder/src/com/google/i18n/phonenumbers/PhoneNumberToTimeZonesMapper.java View File

@ -31,8 +31,6 @@ import java.util.logging.Logger;
/**
* An offline mapper from phone numbers to time zones.
*
* @author Walter Erquinigo
*/
public class PhoneNumberToTimeZonesMapper {
private static PhoneNumberToTimeZonesMapper instance = null;


+ 0
- 2
java/internal/prefixmapper/src/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMap.java View File

@ -31,8 +31,6 @@ import java.util.StringTokenizer;
/**
* A utility that maps phone number prefixes to a list of strings describing the time zones to
* which each prefix belongs.
*
* @author Walter Erquinigo
*/
public class PrefixTimeZonesMap implements Externalizable {
private final PhonePrefixMap phonePrefixMap = new PhonePrefixMap();


+ 0
- 2
java/internal/prefixmapper/test/com/google/i18n/phonenumbers/prefixmapper/PrefixTimeZonesMapTest.java View File

@ -31,8 +31,6 @@ import java.util.TreeMap;
/**
* Unittests for PrefixTimeZonesMap.java
*
* @author Walter Erquinigo
*/
public class PrefixTimeZonesMapTest extends TestCase {
private final PrefixTimeZonesMap prefixTimeZonesMapForUS = new PrefixTimeZonesMap();


+ 15
- 7
java/libphonenumber/src/com/google/i18n/phonenumbers/AsYouTypeFormatter.java View File

@ -111,7 +111,7 @@ public class AsYouTypeFormatter {
private boolean shouldAddSpaceAfterNationalPrefix = false;
// This contains the national prefix that has been extracted. It contains only digits without
// formatting.
private String nationalPrefixExtracted = "";
private String extractedNationalPrefix = "";
private StringBuilder nationalNumber = new StringBuilder();
private List<NumberFormat> possibleFormats = new ArrayList<NumberFormat>();
@ -267,7 +267,7 @@ public class AsYouTypeFormatter {
lastMatchPosition = 0;
currentFormattingPattern = "";
prefixBeforeNationalNumber.setLength(0);
nationalPrefixExtracted = "";
extractedNationalPrefix = "";
nationalNumber.setLength(0);
ableToFormat = true;
inputHasFormatting = false;
@ -352,7 +352,7 @@ public class AsYouTypeFormatter {
if (attemptToExtractIdd()) {
isExpectingCountryCallingCode = true;
} else { // No IDD or plus sign is found, might be entering in national format.
nationalPrefixExtracted = removeNationalPrefixFromNationalNumber();
extractedNationalPrefix = removeNationalPrefixFromNationalNumber();
return attemptToChooseFormattingPattern();
}
default:
@ -390,19 +390,24 @@ public class AsYouTypeFormatter {
return attemptToChooseFormattingPattern();
}
// @VisibleForTesting
String getExtractedNationalPrefix() {
return extractedNationalPrefix;
}
// Some national prefixes are a substring of others. If extracting the shorter NDD doesn't result
// in a number we can format, we try to see if we can extract a longer version here.
private boolean ableToExtractLongerNdd() {
if (nationalPrefixExtracted.length() > 0) {
if (extractedNationalPrefix.length() > 0) {
// Put the extracted NDD back to the national number before attempting to extract a new NDD.
nationalNumber.insert(0, nationalPrefixExtracted);
nationalNumber.insert(0, extractedNationalPrefix);
// Remove the previously extracted NDD from prefixBeforeNationalNumber. We cannot simply set
// it to empty string because people sometimes incorrectly enter national prefix after the
// country code, e.g. +44 (0)20-1234-5678.
int indexOfPreviousNdd = prefixBeforeNationalNumber.lastIndexOf(nationalPrefixExtracted);
int indexOfPreviousNdd = prefixBeforeNationalNumber.lastIndexOf(extractedNationalPrefix);
prefixBeforeNationalNumber.setLength(indexOfPreviousNdd);
}
return !nationalPrefixExtracted.equals(removeNationalPrefixFromNationalNumber());
return !extractedNationalPrefix.equals(removeNationalPrefixFromNationalNumber());
}
private boolean isDigitOrLeadingPlusSign(char nextChar) {
@ -599,6 +604,9 @@ public class AsYouTypeFormatter {
}
String countryCodeString = Integer.toString(countryCode);
prefixBeforeNationalNumber.append(countryCodeString).append(SEPARATOR_BEFORE_NATIONAL_NUMBER);
// When we have successfully extracted the IDD, the previously extracted NDD should be cleared
// because it is no longer valid.
extractedNationalPrefix = "";
return true;
}


+ 0
- 2
java/libphonenumber/src/com/google/i18n/phonenumbers/MetadataManager.java View File

@ -35,8 +35,6 @@ import java.util.logging.Logger;
* Class encapsulating loading of PhoneNumber Metadata information. Currently this is used only for
* additional data files such as PhoneNumberAlternateFormats, but in the future it is envisaged it
* would handle the main metadata file (PhoneNumberMetadata.xml) as well.
*
* @author Lara Rennie
*/
class MetadataManager {
private static final String ALTERNATE_FORMATS_FILE_PREFIX =


+ 0
- 1
java/libphonenumber/src/com/google/i18n/phonenumbers/NumberParseException.java View File

@ -18,7 +18,6 @@ package com.google.i18n.phonenumbers;
/**
* Generic exception class for errors encountered when parsing phone numbers.
* @author Lara Rennie
*/
@SuppressWarnings("serial")
public class NumberParseException extends Exception {


+ 0
- 2
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatch.java View File

@ -50,8 +50,6 @@ import java.util.Arrays;
* // invoked on rawString().
* util.parse(m.rawString(), country).equals(m.number());
* </pre>
*
* @author Tom Hofmann
*/
public final class PhoneNumberMatch {
/** The start index into the text. */


+ 50
- 51
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberMatcher.java View File

@ -39,8 +39,6 @@ import java.util.regex.Pattern;
* not found.
*
* <p>This class is not thread-safe.
*
* @author Tom Hofmann
*/
final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
/**
@ -91,11 +89,33 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
private static final Pattern MATCHING_BRACKETS;
/**
* Matches white-space, which may indicate the end of a phone number and the start of something
* else (such as a neighbouring zip-code). If white-space is found, continues to match all
* characters that are not typically used to start a phone number.
* Patterns used to extract phone numbers from a larger phone-number-like pattern. These are
* ordered according to specificity. For example, white-space is last since that is frequently
* used in numbers, not just to separate two numbers. We have separate patterns since we don't
* want to break up the phone-number-like text on more than one different kind of symbol at one
* time, although symbols of the same type (e.g. space) can be safely grouped together.
*
* Note that if there is a match, we will always check any text found up to the first match as
* well.
*/
private static final Pattern GROUP_SEPARATOR;
private static final Pattern[] INNER_MATCHES = {
// Breaks on the slash - e.g. "651-234-2345/332-445-1234"
Pattern.compile("/+(.*)"),
// Note that the bracket here is inside the capturing group, since we consider it part of the
// phone number. Will match a pattern like "(650) 223 3345 (754) 223 3321".
Pattern.compile("(\\([^(]*)"),
// Breaks on a hyphen - e.g. "12345 - 332-445-1234 is my number."
// We require a space on either side of the hyphen for it to be considered a separator.
Pattern.compile("(?:\\p{Z}-|-\\p{Z})\\p{Z}*(.+)"),
// Various types of wide hyphens. Note we have decided not to enforce a space here, since it's
// possible that it's supposed to be used to break two numbers without spaces, and we haven't
// seen many instances of it used within a number.
Pattern.compile("[\u2012-\u2015\uFF0D]\\p{Z}*(.+)"),
// Breaks on a full stop - e.g. "12345. 332-445-1234 is my number."
Pattern.compile("\\.+\\p{Z}*([^.]+)"),
// Breaks on space - e.g. "3324451234 8002341234"
Pattern.compile("\\p{Z}+(\\P{Z}+)")
};
/**
* Punctuation that may be at the start of a phone number - brackets and plus signs.
@ -144,7 +164,6 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
String leadClassChars = openingParens + PhoneNumberUtil.PLUS_CHARS;
String leadClass = "[" + leadClassChars + "]";
LEAD_CLASS = Pattern.compile(leadClass);
GROUP_SEPARATOR = Pattern.compile("\\p{Z}" + "[^" + leadClassChars + "\\p{Nd}]*");
/* Phone number pattern allowing optional punctuation. */
PATTERN = Pattern.compile(
@ -293,10 +312,11 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
* @return the match found, null if none can be found
*/
private PhoneNumberMatch extractMatch(CharSequence candidate, int offset) {
// Skip a match that is more likely a publication page reference or a date.
if (PUB_PAGES.matcher(candidate).find() || SLASH_SEPARATED_DATES.matcher(candidate).find()) {
// Skip a match that is more likely to be a date.
if (SLASH_SEPARATED_DATES.matcher(candidate).find()) {
return null;
}
// Skip potential time-stamps.
if (TIME_STAMPS.matcher(candidate).find()) {
String followingText = text.toString().substring(offset + candidate.length());
@ -326,48 +346,26 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
* @return the match found, null if none can be found
*/
private PhoneNumberMatch extractInnerMatch(String candidate, int offset) {
// Try removing either the first or last "group" in the number and see if this gives a result.
// We consider white space to be a possible indication of the start or end of the phone number.
Matcher groupMatcher = GROUP_SEPARATOR.matcher(candidate);
if (groupMatcher.find()) {
// Try the first group by itself.
CharSequence firstGroupOnly = candidate.substring(0, groupMatcher.start());
firstGroupOnly = trimAfterFirstMatch(PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN,
firstGroupOnly);
PhoneNumberMatch match = parseAndVerify(firstGroupOnly.toString(), offset);
if (match != null) {
return match;
}
maxTries--;
int withoutFirstGroupStart = groupMatcher.end();
// Try the rest of the candidate without the first group.
CharSequence withoutFirstGroup = candidate.substring(withoutFirstGroupStart);
withoutFirstGroup = trimAfterFirstMatch(PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN,
withoutFirstGroup);
match = parseAndVerify(withoutFirstGroup.toString(), offset + withoutFirstGroupStart);
if (match != null) {
return match;
}
maxTries--;
if (maxTries > 0) {
int lastGroupStart = withoutFirstGroupStart;
while (groupMatcher.find()) {
// Find the last group.
lastGroupStart = groupMatcher.start();
}
CharSequence withoutLastGroup = candidate.substring(0, lastGroupStart);
withoutLastGroup = trimAfterFirstMatch(PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN,
withoutLastGroup);
if (withoutLastGroup.equals(firstGroupOnly)) {
// If there are only two groups, then the group "without the last group" is the same as
// the first group. In these cases, we don't want to re-check the number group, so we exit
// already.
return null;
for (Pattern possibleInnerMatch : INNER_MATCHES) {
int rangeStart = 0;
Matcher groupMatcher = possibleInnerMatch.matcher(candidate);
boolean isFirstMatch = true;
while (groupMatcher.find() && maxTries > 0) {
if (isFirstMatch) {
// We should handle any group before this one too.
CharSequence group = trimAfterFirstMatch(
PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN,
candidate.substring(0, groupMatcher.start()));
PhoneNumberMatch match = parseAndVerify(group.toString(), offset);
if (match != null) {
return match;
}
maxTries--;
isFirstMatch = false;
}
match = parseAndVerify(withoutLastGroup.toString(), offset);
CharSequence group = trimAfterFirstMatch(
PhoneNumberUtil.UNWANTED_END_CHAR_PATTERN, groupMatcher.group(1));
PhoneNumberMatch match = parseAndVerify(group.toString(), offset + groupMatcher.start(1));
if (match != null) {
return match;
}
@ -390,7 +388,7 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
try {
// Check the candidate doesn't contain any formatting which would indicate that it really
// isn't a phone number.
if (!MATCHING_BRACKETS.matcher(candidate).matches()) {
if (!MATCHING_BRACKETS.matcher(candidate).matches() || PUB_PAGES.matcher(candidate).find()) {
return null;
}
@ -416,6 +414,7 @@ final class PhoneNumberMatcher implements Iterator<PhoneNumberMatch> {
}
PhoneNumber number = phoneUtil.parseAndKeepRawInput(candidate, preferredRegion);
// Check Israel * numbers: these are a special case in that they are four-digit numbers that
// our library supports, but they can only be dialled with a leading *. Since we don't
// actually store or detect the * in our phone number library, this means in practice we


+ 1
- 2
java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java View File

@ -54,7 +54,6 @@ import java.util.regex.Pattern;
* http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm
*
* @author Shaopeng Jia
* @author Lara Rennie
*/
public class PhoneNumberUtil {
private static final Logger logger = Logger.getLogger(PhoneNumberUtil.class.getName());
@ -64,7 +63,7 @@ public class PhoneNumberUtil {
// The minimum and maximum length of the national significant number.
private static final int MIN_LENGTH_FOR_NSN = 2;
// The ITU says the maximum length should be 15, but we have found longer numbers in Germany.
static final int MAX_LENGTH_FOR_NSN = 16;
static final int MAX_LENGTH_FOR_NSN = 17;
// The maximum length of the country calling code.
static final int MAX_LENGTH_COUNTRY_CODE = 3;
// We don't allow input strings for parsing to be longer than 250 chars. This prevents malicious


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_AS View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_BR View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_KW View File


BIN
java/libphonenumber/src/com/google/i18n/phonenumbers/data/PhoneNumberMetadataProto_LU View File


+ 35
- 0
java/libphonenumber/test/com/google/i18n/phonenumbers/AsYouTypeFormatterTest.java View File

@ -1114,4 +1114,39 @@ public class AsYouTypeFormatterTest extends TestMetadataTestCase {
assertEquals("12", formatter.inputDigit('2'));
assertEquals("1 22", formatter.inputDigit('2'));
}
public void testAYTFClearNDDAfterIDDExtraction() {
AsYouTypeFormatter formatter = phoneUtil.getAsYouTypeFormatter(RegionCode.KR);
// Check that when we have successfully extracted an IDD, the previously extracted NDD is
// cleared since it is no longer valid.
assertEquals("0", formatter.inputDigit('0'));
assertEquals("00", formatter.inputDigit('0'));
assertEquals("007", formatter.inputDigit('7'));
assertEquals("0070", formatter.inputDigit('0'));
assertEquals("00700", formatter.inputDigit('0'));
assertEquals("0", formatter.getExtractedNationalPrefix());
// Once the IDD "00700" has been extracted, it no longer makes sense for the initial "0" to be
// treated as an NDD.
assertEquals("00700 1 ", formatter.inputDigit('1'));
assertEquals("", formatter.getExtractedNationalPrefix());
assertEquals("00700 1 2", formatter.inputDigit('2'));
assertEquals("00700 1 23", formatter.inputDigit('3'));
assertEquals("00700 1 234", formatter.inputDigit('4'));
assertEquals("00700 1 234 5", formatter.inputDigit('5'));
assertEquals("00700 1 234 56", formatter.inputDigit('6'));
assertEquals("00700 1 234 567", formatter.inputDigit('7'));
assertEquals("00700 1 234 567 8", formatter.inputDigit('8'));
assertEquals("00700 1 234 567 89", formatter.inputDigit('9'));
assertEquals("00700 1 234 567 890", formatter.inputDigit('0'));
assertEquals("00700 1 234 567 8901", formatter.inputDigit('1'));
assertEquals("00700123456789012", formatter.inputDigit('2'));
assertEquals("007001234567890123", formatter.inputDigit('3'));
assertEquals("0070012345678901234", formatter.inputDigit('4'));
assertEquals("00700123456789012345", formatter.inputDigit('5'));
assertEquals("007001234567890123456", formatter.inputDigit('6'));
assertEquals("0070012345678901234567", formatter.inputDigit('7'));
}
}

+ 0
- 2
java/libphonenumber/test/com/google/i18n/phonenumbers/ExampleNumbersTest.java View File

@ -30,8 +30,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
/**
* @author Lara Rennie
*
* Verifies all of the example numbers in the metadata are valid and of the correct type. If no
* example number exists for a particular type, the test still passes.
*/


+ 0
- 2
java/libphonenumber/test/com/google/i18n/phonenumbers/MetadataManagerTest.java View File

@ -22,8 +22,6 @@ import junit.framework.TestCase;
/**
* Some basic tests to check that the phone number metadata can be correctly loaded.
*
* @author Lara Rennie
*/
public class MetadataManagerTest extends TestCase {


+ 0
- 2
java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberMatchTest.java View File

@ -22,8 +22,6 @@ import junit.framework.TestCase;
/**
* Tests for {@link PhoneNumberMatch}.
*
* @author Tom Hofmann
*/
public class PhoneNumberMatchTest extends TestCase {
/**


+ 52
- 11
java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberMatcherTest.java View File

@ -29,7 +29,6 @@ import java.util.NoSuchElementException;
/**
* Tests for {@link PhoneNumberMatcher}. This only tests basic functionality based on test metadata.
*
* @author Tom Hofmann
* @see PhoneNumberUtilTest {@link PhoneNumberUtilTest} for the origin of the test data
*/
public class PhoneNumberMatcherTest extends TestMetadataTestCase {
@ -97,7 +96,8 @@ public class PhoneNumberMatcherTest extends TestMetadataTestCase {
doTestFindInContext("64(0)64123456", RegionCode.NZ);
// Check that using a "/" is fine in a phone number.
doTestFindInContext("123/45678", RegionCode.DE);
// Note that real Polish numbers do *not* start with a 0.
doTestFindInContext("0123/456789", RegionCode.PL);
doTestFindInContext("123-456-7890", RegionCode.US);
}
@ -240,29 +240,58 @@ public class PhoneNumberMatcherTest extends TestMetadataTestCase {
}
}
public void testFourMatchesInARow() throws Exception {
String number1 = "415-666-7777";
String number2 = "800-443-1223";
String number3 = "212-443-1223";
String number4 = "650-443-1223";
String text = number1 + " - " + number2 + " - " + number3 + " - " + number4;
Iterator<PhoneNumberMatch> iterator =
phoneUtil.findNumbers(text, RegionCode.US).iterator();
PhoneNumberMatch match = iterator.hasNext() ? iterator.next() : null;
assertMatchProperties(match, text, number1, RegionCode.US);
match = iterator.hasNext() ? iterator.next() : null;
assertMatchProperties(match, text, number2, RegionCode.US);
match = iterator.hasNext() ? iterator.next() : null;
assertMatchProperties(match, text, number3, RegionCode.US);
match = iterator.hasNext() ? iterator.next() : null;
assertMatchProperties(match, text, number4, RegionCode.US);
}
public void testMatchesFoundWithMultipleSpaces() throws Exception {
String number1 = "(415) 666-7777";
String number2 = "(800) 443-1223";
String text = number1 + " " + number2;
Iterator<PhoneNumberMatch> iterator =
phoneUtil.findNumbers(text, RegionCode.US).iterator();
PhoneNumberMatch match = iterator.hasNext() ? iterator.next() : null;
assertMatchProperties(match, text, number1, RegionCode.US);
match = iterator.hasNext() ? iterator.next() : null;
assertMatchProperties(match, text, number2, RegionCode.US);
}
public void testMatchWithSurroundingZipcodes() throws Exception {
String number = "415-666-7777";
String zipPreceding = "My address is CA 34215 - " + number + " is my number.";
PhoneNumber expectedResult = phoneUtil.parse(number, RegionCode.US);
Iterator<PhoneNumberMatch> iterator =
phoneUtil.findNumbers(zipPreceding, RegionCode.US).iterator();
PhoneNumberMatch match = iterator.hasNext() ? iterator.next() : null;
assertNotNull("Did not find a number in '" + zipPreceding + "'; expected " + number, match);
assertEquals(expectedResult, match.number());
assertEquals(number, match.rawString());
assertMatchProperties(match, zipPreceding, number, RegionCode.US);
// Now repeat, but this time the phone number has spaces in it. It should still be found.
number = "(415) 666 7777";
String zipFollowing = "My number is " + number + ". 34215 is my zip-code.";
iterator = phoneUtil.findNumbers(zipFollowing, RegionCode.US).iterator();
PhoneNumberMatch matchWithSpaces = iterator.hasNext() ? iterator.next() : null;
assertNotNull("Did not find a number in '" + zipFollowing + "'; expected " + number,
matchWithSpaces);
assertEquals(expectedResult, matchWithSpaces.number());
assertEquals(number, matchWithSpaces.rawString());
assertMatchProperties(matchWithSpaces, zipFollowing, number, RegionCode.US);
}
public void testIsLatinLetter() throws Exception {
@ -876,6 +905,18 @@ public class PhoneNumberMatcherTest extends TestMetadataTestCase {
assertFalse(iterator.hasNext());
}
/**
* Asserts that the expected match is non-null, and that the raw string and expected
* proto buffer are set appropriately.
*/
private void assertMatchProperties(
PhoneNumberMatch match, String text, String number, String region) throws Exception {
PhoneNumber expectedResult = phoneUtil.parse(number, region);
assertNotNull("Did not find a number in '" + text + "'; expected " + number, match);
assertEquals(expectedResult, match.number());
assertEquals(number, match.rawString());
}
/**
* Asserts that another number can be found in {@code text} starting at {@code index}, and that
* its corresponding range is {@code [start, end)}.


+ 4
- 7
java/libphonenumber/test/com/google/i18n/phonenumbers/PhoneNumberUtilTest.java View File

@ -33,7 +33,6 @@ import java.util.List;
* for regression test purposes - these tests are illustrative only and test functionality.
*
* @author Shaopeng Jia
* @author Lara Rennie
*/
public class PhoneNumberUtilTest extends TestMetadataTestCase {
// Set up some test numbers to re-use.
@ -797,13 +796,11 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
// Test the special logic for NANPA countries, for which regular length phone numbers are always
// output in international format, but short numbers are in national format.
PhoneNumber usRegularNumber = new PhoneNumber().setCountryCode(1)
.setNationalNumber(6502530000L);
assertEquals("+16502530000", phoneUtil.formatNumberForMobileDialing(usRegularNumber,
assertEquals("+16502530000", phoneUtil.formatNumberForMobileDialing(US_NUMBER,
RegionCode.US, false));
assertEquals("+16502530000", phoneUtil.formatNumberForMobileDialing(usRegularNumber,
assertEquals("+16502530000", phoneUtil.formatNumberForMobileDialing(US_NUMBER,
RegionCode.CA, false));
assertEquals("+16502530000", phoneUtil.formatNumberForMobileDialing(usRegularNumber,
assertEquals("+16502530000", phoneUtil.formatNumberForMobileDialing(US_NUMBER,
RegionCode.BR, false));
PhoneNumber usShortNumber = new PhoneNumber().setCountryCode(1).setNationalNumber(911L);
assertEquals("911", phoneUtil.formatNumberForMobileDialing(usShortNumber, RegionCode.US,
@ -1325,7 +1322,7 @@ public class PhoneNumberUtilTest extends TestMetadataTestCase {
adNumber.setCountryCode(376).setNationalNumber(1L);
assertEquals(PhoneNumberUtil.ValidationResult.TOO_SHORT,
phoneUtil.isPossibleNumberWithReason(adNumber));
adNumber.setCountryCode(376).setNationalNumber(12345678901234567L);
adNumber.setCountryCode(376).setNationalNumber(123456789012345678L);
assertEquals(PhoneNumberUtil.ValidationResult.TOO_LONG,
phoneUtil.isPossibleNumberWithReason(adNumber));
}


+ 0
- 1
java/libphonenumber/test/com/google/i18n/phonenumbers/TestMetadataTestCase.java View File

@ -25,7 +25,6 @@ import junit.framework.TestCase;
* used for regression test purposes.
*
* @author Shaopeng Jia
* @author Lara Rennie
*/
public class TestMetadataTestCase extends TestCase {
private static final String TEST_META_DATA_FILE_PREFIX =


+ 15
- 0
java/release_notes.txt View File

@ -1,3 +1,18 @@
Feb 25, 2014: libphonenumber-6.0
* Code changes:
- Better support for detecting phone numbers in text that are beside each other
- Change to how Japanese numbers beginning with "00" are modelled, with the
side-effect that the maximum possible number length has been extended by 1.
- Handle StringIndexOutOfBoundsException in the AsYouTypeFormatter when the
national prefix that was extracted was not found in the prefix. This affected
countries with very long carrier codes, such as Korea.
- Removal of some of the author attributions - contributions to be tracked in
CONTRIBUTORS file.
* Metadata changes:
- Updated phone metadata for region code(s): AS, BR, KW, LU
- New carrier data for country calling code(s): 1684 (en)
- Updated carrier data for country calling code(s): 352 (en)
Feb 07, 2014: libphonenumber-5.9.4
* Metadata changes:
- Updated phone metadata for region code(s):


+ 20
- 7
javascript/i18n/phonenumbers/asyoutypeformatter.js View File

@ -165,7 +165,7 @@ i18n.phonenumbers.AsYouTypeFormatter = function(regionCode) {
* @type {string}
* @private
*/
this.nationalPrefixExtracted_ = '';
this.extractedNationalPrefix_ = '';
/**
* @type {!goog.string.StringBuffer}
* @private
@ -505,7 +505,7 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.clear = function() {
this.lastMatchPosition_ = 0;
this.currentFormattingPattern_ = '';
this.prefixBeforeNationalNumber_.clear();
this.nationalPrefixExtracted_ = '';
this.extractedNationalPrefix_ = '';
this.nationalNumber_.clear();
this.ableToFormat_ = true;
this.inputHasFormatting_ = false;
@ -617,7 +617,7 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.
this.isExpectingCountryCallingCode_ = true;
} else {
// No IDD or plus sign is found, might be entering in national format.
this.nationalPrefixExtracted_ =
this.extractedNationalPrefix_ =
this.removeNationalPrefixFromNationalNumber_();
return this.attemptToChooseFormattingPattern_();
}
@ -669,6 +669,16 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.
};
/**
* @return {string}
* @private
*/
i18n.phonenumbers.AsYouTypeFormatter.prototype.getExtractedNationalPrefix_ =
function() {
return this.extractedNationalPrefix_;
};
/**
* Some national prefixes are a substring of others. If extracting the shorter
* NDD doesn't result in a number we can format, we try to see if we can extract
@ -678,13 +688,13 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.
*/
i18n.phonenumbers.AsYouTypeFormatter.prototype.ableToExtractLongerNdd_ =
function() {
if (this.nationalPrefixExtracted_.length > 0) {
if (this.extractedNationalPrefix_.length > 0) {
// Put the extracted NDD back to the national number before attempting to
// extract a new NDD.
/** @type {string} */
var nationalNumberStr = this.nationalNumber_.toString();
this.nationalNumber_.clear();
this.nationalNumber_.append(this.nationalPrefixExtracted_);
this.nationalNumber_.append(this.extractedNationalPrefix_);
this.nationalNumber_.append(nationalNumberStr);
// Remove the previously extracted NDD from prefixBeforeNationalNumber. We
// cannot simply set it to empty string because people sometimes incorrectly
@ -694,12 +704,12 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.ableToExtractLongerNdd_ =
this.prefixBeforeNationalNumber_.toString();
/** @type {number} */
var indexOfPreviousNdd = prefixBeforeNationalNumberStr.lastIndexOf(
this.nationalPrefixExtracted_);
this.extractedNationalPrefix_);
this.prefixBeforeNationalNumber_.clear();
this.prefixBeforeNationalNumber_.append(
prefixBeforeNationalNumberStr.substring(0, indexOfPreviousNdd));
}
return this.nationalPrefixExtracted_ !=
return this.extractedNationalPrefix_ !=
this.removeNationalPrefixFromNationalNumber_();
};
@ -1024,6 +1034,9 @@ i18n.phonenumbers.AsYouTypeFormatter.prototype.
var countryCodeString = '' + countryCode;
this.prefixBeforeNationalNumber_.append(countryCodeString).append(
i18n.phonenumbers.AsYouTypeFormatter.SEPARATOR_BEFORE_NATIONAL_NUMBER_);
// When we have successfully extracted the IDD, the previously extracted NDD
// should be cleared because it is no longer valid.
this.extractedNationalPrefix_ = "";
return true;
};


+ 32
- 0
javascript/i18n/phonenumbers/asyoutypeformatter_test.js View File

@ -1149,3 +1149,35 @@ function testAYTFShortNumberFormattingFix_US() {
assertEquals('12', f.inputDigit('2'));
assertEquals('1 22', f.inputDigit('2'));
}
function testAYTFClearNDDAfterIddExtraction() {
/** @type {i18n.phonenumbers.AsYouTypeFormatter} */
var f = new i18n.phonenumbers.AsYouTypeFormatter(RegionCode.KR);
// Check that when we have successfully extracted an IDD, the previously
// extracted NDD is cleared since it is no longer valid.
assertEquals('0', f.inputDigit('0'));
assertEquals('00', f.inputDigit('0'));
assertEquals('007', f.inputDigit('7'));
assertEquals('0070', f.inputDigit('0'));
assertEquals('00700', f.inputDigit('0'));
assertEquals('0', f.getExtractedNationalPrefix_());
assertEquals('00700 1 ', f.inputDigit('1'));
assertEquals('', f.getExtractedNationalPrefix_());
assertEquals('00700 1 2', f.inputDigit('2'));
assertEquals('00700 1 23', f.inputDigit('3'));
assertEquals('00700 1 234', f.inputDigit('4'));
assertEquals('00700 1 234 5', f.inputDigit('5'));
assertEquals('00700 1 234 56', f.inputDigit('6'));
assertEquals('00700 1 234 567', f.inputDigit('7'));
assertEquals('00700 1 234 567 8', f.inputDigit('8'));
assertEquals('00700 1 234 567 89', f.inputDigit('9'));
assertEquals('00700 1 234 567 890', f.inputDigit('0'));
assertEquals('00700 1 234 567 8901', f.inputDigit('1'));
assertEquals('00700123456789012', f.inputDigit('2'));
assertEquals('007001234567890123', f.inputDigit('3'));
assertEquals('0070012345678901234', f.inputDigit('4'));
assertEquals('00700123456789012345', f.inputDigit('5'));
assertEquals('007001234567890123456', f.inputDigit('6'));
assertEquals('0070012345678901234567', f.inputDigit('7'));
}

+ 78
- 79
javascript/i18n/phonenumbers/demo-compiled.js View File

@ -1,17 +1,17 @@
(function(){var k=this;
function aa(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==
b&&"undefined"==typeof a.call)return"object";return b}function l(a,b){function c(){}c.prototype=b.prototype;a.Ha=b.prototype;a.prototype=new c;a.prototype.constructor=a};function ba(a,b){return a<b?-1:a>b?1:0};var ca=Array.prototype,da=ca.indexOf?function(a,b,c){return ca.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if("string"==typeof a)return"string"==typeof b&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};function ea(a,b){ca.sort.call(a,b||fa)}function fa(a,b){return a>b?1:a<b?-1:0};var n,ga,p,ha;function ia(){return k.navigator?k.navigator.userAgent:null}ha=p=ga=n=!1;var q;if(q=ia()){var ja=k.navigator;n=0==q.indexOf("Opera");ga=!n&&-1!=q.indexOf("MSIE");p=!n&&-1!=q.indexOf("WebKit");ha=!n&&!p&&"Gecko"==ja.product}var r=ga,ka=ha,la=p;function ma(){var a=k.document;return a?a.documentMode:void 0}var s;
a:{var v="",w;if(n&&k.opera)var na=k.opera.version,v="function"==typeof na?na():na;else if(ka?w=/rv\:([^\);]+)(\)|;)/:r?w=/MSIE\s+([^\);]+)(\)|;)/:la&&(w=/WebKit\/(\S+)/),w)var oa=w.exec(ia()),v=oa?oa[1]:"";if(r){var pa=ma();if(pa>parseFloat(v)){s=String(pa);break a}}s=v}var qa={};
function ra(a){if(!qa[a]){for(var b=0,c=String(s).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",m=RegExp("(\\d*)(\\D*)","g"),t=RegExp("(\\d*)(\\D*)","g");do{var u=m.exec(g)||["","",""],L=t.exec(h)||["","",""];if(0==u[0].length&&0==L[0].length)break;b=ba(0==u[1].length?0:parseInt(u[1],10),0==L[1].length?0:parseInt(L[1],10))||ba(0==u[2].length,0==L[2].length)||ba(u[2],
L[2])}while(0==b)}qa[a]=0<=b}}var sa=k.document,ta=sa&&r?ma()||("CSS1Compat"==sa.compatMode?parseInt(s,10):5):void 0;if(ka||r){var ua;if(ua=r)ua=r&&9<=ta;ua||ka&&ra("1.9.1")}r&&ra("9");function va(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function wa(a,b){var c;a:{for(c in a)if(b.call(void 0,a[c],c,a))break a;c=void 0}return c&&a[c]};function xa(a){return"string"==typeof a?document.getElementById(a):a};function ya(a){return(new za(void 0)).ca(a)}function za(a){this.ha=a}za.prototype.ca=function(a){var b=[];Aa(this,a,b);return b.join("")};
function Aa(a,b,c){switch(typeof b){case "string":Ba(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(null==b){c.push("null");break}if("array"==aa(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Aa(a,a.ha?a.ha.call(b,String(f),e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),
Ba(f,c),c.push(":"),Aa(a,a.ha?a.ha.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:throw Error("Unknown type: "+typeof b);}}var Ca={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Da=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Ba(a,b){b.push('"',a.replace(Da,function(a){if(a in Ca)return Ca[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Ca[a]=e+b.toString(16)}),'"')};function Ea(a,b,c){this.Aa=a;this.pa=b.name||null;this.ta=b.Ma;this.l={};for(a=0;a<c.length;a++)b=c[a],this.l[b.j]=b}Ea.prototype.getName=function(){return this.pa};Ea.prototype.p=function(){return this.ta?this.ta.c():null};function Fa(a){a=va(a.l);ea(a,function(a,c){return a.j-c.j});return a}function Ga(a,b){return wa(a.l,function(a){return a.getName()==b})||null};function Ha(a,b,c){this.Ga=a;this.j=b;this.pa=c.name;this.q=!!c.ga;this.n=c.a;this.qa=c.type;this.va=!1;switch(this.n){case Ia:case Ja:case Ka:case La:case Ma:this.va=!0}this.ma=c.defaultValue}var Ia=3,Ja=4,Ka=6,La=16,Ma=18;Ha.prototype.p=function(){return this.Ga.c()};Ha.prototype.getName=function(){return this.pa};function x(){this.f={};this.l=this.c().l;this.e=this.oa=null}function Na(a,b){for(var c in a.f){var d=Number(c);a.l[d]||b.call(a,d,a.f[c])}}x.prototype.c=function(){var a=this.constructor,b;if(!(b=a.ua)){var c;b=a.Ea;var d=[],e;for(e in b)b.hasOwnProperty(e)&&(0==e?c=b[0]:d.push(new Ha(a,e,b[e])));c=new Ea(a,c,d);b=a.ua=c}return b};function Oa(a,b){b.p();a.c();return y(a,b.j)}function Pa(a,b){b.p();a.c();return Qa(a,b.j)}x.prototype.get=function(a,b){a.p();this.c();return z(this,a.j,b)};
x.prototype.set=function(a,b){a.p();this.c();A(this,a.j,b)};x.prototype.add=function(a,b){a.p();this.c();var c=a.j;this.f[c]||(this.f[c]=[]);this.f[c].push(b);this.e&&delete this.e[c]};x.prototype.clear=function(a){a.p();this.c();Ra(this,a.j)};
function Sa(a,b){for(var c=Fa(a.c()),d=0;d<c.length;d++){var e=c[d];if(Oa(b,e)){a.e&&delete a.e[e.j];var f=11==e.n||10==e.n;if(e.q){var g;g=b;var h=e;h.p();g.c();g=B(g,h.j);for(h=0;h<g.length;h++)a.add(e,f?Ta(g[h]):g[h])}else g=Ua(b,e),f?(f=Ua(a,e))?Sa(f,g):a.set(e,Ta(g)):a.set(e,g)}}}function Ta(a){var b=new a.constructor;b!=a&&(b.f={},b.e&&(b.e={}),Sa(b,a));return b}function y(a,b){return b in a.f&&void 0!==a.f[b]&&null!==a.f[b]}
function Ua(a,b){var c=b.j;if(!c in a.f)return null;var d=a.f[c];if(null==d)return null;if(a.oa){if(!(c in a.e)){var e=a.oa;if(null!=d)if(b.q){for(var f=[],g=0;g<d.length;g++)f[g]=e.s(b,d[g]);d=f}else d=e.s(b,d);return a.e[c]=d}return a.e[c]}return d}function z(a,b,c){b=a.l[b];a=Ua(a,b);return b.q?a[c||0]:a}function C(a,b,c){y(a,b)?a=z(a,b,c):(a=a.l[b],void 0===a.ma&&(b=a.qa,a.ma=b===Boolean?!1:b===Number?0:b===String?"":new b),a=a.ma);return a}function B(a,b){return Ua(a,a.l[b])||[]}
function Qa(a,b){return a.l[b].q?y(a,b)?a.f[b].length:0:y(a,b)?1:0}function A(a,b,c){a.f[b]=c;a.e&&(a.e[b]=c)}function Ra(a,b){delete a.f[b];a.e&&delete a.e[b]}function D(a,b){a.Ea=b;a.c=function(){return a.ua||(new a).c()}};function E(){}E.prototype.t=function(a,b){return 11==a.n||10==a.n?this.ca(b):b};E.prototype.$=function(a,b){var c=new a.Aa;this.wa(c,b);return c};E.prototype.s=function(a,b){if(11==a.n||10==a.n)return b instanceof x?b:this.$(a.qa.c(),b);if(!a.va)return b;var c=a.qa;if(c===String){if("number"===typeof b)return String(b)}else if(c===Number&&"string"===typeof b&&/^-?[0-9]+$/.test(b))return Number(b);return b};function Va(a){this.Fa=a}l(Va,E);Va.prototype.ca=function(a){for(var b=Fa(a.c()),c={},d=0;d<b.length;d++){var e=b[d],f=1==this.Fa?e.getName():e.j;if(Oa(a,e))if(e.q){var g=[];c[f]=g;for(f=0;f<Pa(a,e);f++)g.push(this.t(e,a.get(e,f)))}else c[f]=this.t(e,a.get(e))}Na(a,function(a,b){c[a]=b});return c};
Va.prototype.wa=function(a,b){var c=a.c(),d;for(d in b){var e,f=b[d],g=!/[^0-9]/.test(d);if(e=g?c.l[parseInt(d,10)]||null:Ga(c,d))if(e.q)for(g=0;g<f.length;g++)a.add(e,this.s(e,f[g]));else a.set(e,this.s(e,f));else g&&(e=a,g=Number(d),e.f[g]=f,e.e&&delete e.e[g])}};function F(a,b){null!=a&&this.append.apply(this,arguments)}F.prototype.h="";F.prototype.set=function(a){this.h=""+a};F.prototype.append=function(a,b,c){this.h+=a;if(null!=b)for(var d=1;d<arguments.length;d++)this.h+=arguments[d];return this};F.prototype.clear=function(){this.h=""};F.prototype.toString=function(){return this.h};/*
(function(){function i(a){throw a;}var j=void 0,k=!0,l=null,m=!1,p=this;
function aa(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function q(a,b){function c(){}c.prototype=b.prototype;a.La=b.prototype;a.prototype=new c;a.prototype.constructor=a};var ba=Array.prototype,ca=ba.indexOf?function(a,b,c){return ba.indexOf.call(a,b,c)}:function(a,b,c){c=c==l?0:0>c?Math.max(0,a.length+c):c;if("string"==typeof a)return"string"!=typeof b||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1};function da(a,b){ba.sort.call(a,b||ea)}function ea(a,b){return a>b?1:a<b?-1:0};var s,fa,t,ga;function ha(){return p.navigator?p.navigator.userAgent:l}ga=t=fa=s=m;var ia;if(ia=ha()){var ja=p.navigator;s=0==ia.indexOf("Opera");fa=!s&&-1!=ia.indexOf("MSIE");t=!s&&-1!=ia.indexOf("WebKit");ga=!s&&!t&&"Gecko"==ja.product}var u=fa,ka=ga,la=t;function ma(){var a=p.document;return a?a.documentMode:j}var na;
a:{var oa="",v;if(s&&p.opera)var pa=p.opera.version,oa="function"==typeof pa?pa():pa;else if(ka?v=/rv\:([^\);]+)(\)|;)/:u?v=/MSIE\s+([^\);]+)(\)|;)/:la&&(v=/WebKit\/(\S+)/),v)var qa=v.exec(ha()),oa=qa?qa[1]:"";if(u){var ra=ma();if(ra>parseFloat(oa)){na=String(ra);break a}}na=oa}var sa={};
function ta(a){if(!sa[a]){for(var b=0,c=String(na).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=Math.max(c.length,d.length),f=0;0==b&&f<e;f++){var g=c[f]||"",h=d[f]||"",n=RegExp("(\\d*)(\\D*)","g"),x=RegExp("(\\d*)(\\D*)","g");do{var r=n.exec(g)||["","",""],z=x.exec(h)||["","",""];if(0==r[0].length&&0==z[0].length)break;b=((0==r[1].length?0:parseInt(r[1],10))<(0==z[1].length?0:parseInt(z[1],10))?-1:(0==r[1].length?0:parseInt(r[1],10))>
(0==z[1].length?0:parseInt(z[1],10))?1:0)||((0==r[2].length)<(0==z[2].length)?-1:(0==r[2].length)>(0==z[2].length)?1:0)||(r[2]<z[2]?-1:r[2]>z[2]?1:0)}while(0==b)}sa[a]=0<=b}}var ua=p.document,va=!ua||!u?j:ma()||("CSS1Compat"==ua.compatMode?parseInt(na,10):5);if(ka||u){var wa;if(wa=u)wa=u&&9<=va;wa||ka&&ta("1.9.1")}u&&ta("9");function xa(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b}function ya(a,b){var c;a:{for(c in a)if(b.call(j,a[c],c,a))break a;c=j}return c&&a[c]};function za(a){return"string"==typeof a?document.getElementById(a):a};function Aa(a){return(new Ba(j)).ca(a)}function Ba(a){this.ga=a}Ba.prototype.ca=function(a){var b=[];Ca(this,a,b);return b.join("")};
function Ca(a,b,c){switch(typeof b){case "string":Da(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?b:"null");break;case "boolean":c.push(b);break;case "undefined":c.push("null");break;case "object":if(b==l){c.push("null");break}if("array"==aa(b)){var d=b.length;c.push("[");for(var e="",f=0;f<d;f++)c.push(e),e=b[f],Ca(a,a.ga?a.ga.call(b,String(f),e):e,c),e=",";c.push("]");break}c.push("{");d="";for(f in b)Object.prototype.hasOwnProperty.call(b,f)&&(e=b[f],"function"!=typeof e&&(c.push(d),
Da(f,c),c.push(":"),Ca(a,a.ga?a.ga.call(b,f,e):e,c),d=","));c.push("}");break;case "function":break;default:i(Error("Unknown type: "+typeof b))}}var Ea={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},Fa=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g;
function Da(a,b){b.push('"',a.replace(Fa,function(a){if(a in Ea)return Ea[a];var b=a.charCodeAt(0),e="\\u";16>b?e+="000":256>b?e+="00":4096>b&&(e+="0");return Ea[a]=e+b.toString(16)}),'"')};function Ga(a,b,c){this.za=a;this.oa=b.name||l;this.Sa=b.$||l;this.sa=b.Ra;this.l={};for(a=0;a<c.length;a++)b=c[a],this.l[b.j]=b}Ga.prototype.getName=function(){return this.oa};Ga.prototype.p=function(){return!this.sa?l:this.sa.c()};function Ha(a){a=xa(a.l);da(a,function(a,c){return a.j-c.j});return a}function Ia(a,b){return ya(a.l,function(a){return a.getName()==b})||l};function Ja(a,b,c){this.Ja=a;this.j=b;this.oa=c.name;this.r=!!c.fa;this.Ta=!!c.required;this.n=c.a;this.pa=c.type;this.ua=m;switch(this.n){case Ka:case La:case Ma:case Na:case Oa:this.ua=k}this.la=c.defaultValue}var Ka=3,La=4,Ma=6,Na=16,Oa=18;Ja.prototype.p=function(){return this.Ja.c()};Ja.prototype.getName=function(){return this.oa};function w(){this.f={};this.l=this.c().l;this.e=this.na=l}function Pa(a,b){for(var c in a.f){var d=Number(c);a.l[d]||b.call(a,d,a.f[c])}}w.prototype.c=function(){var a=this.constructor,b;if(!(b=a.ta)){var c;b=a.Ga;var d=[],e;for(e in b)b.hasOwnProperty(e)&&(0==e?c=b[0]:d.push(new Ja(a,e,b[e])));c=new Ga(a,c,d);b=a.ta=c}return b};function Qa(a,b){b.p();a.c();return y(a,b.j)}function Ra(a,b){b.p();a.c();return Sa(a,b.j)}w.prototype.get=function(a,b){a.p();this.c();return A(this,a.j,b)};
w.prototype.set=function(a,b){a.p();this.c();B(this,a.j,b)};w.prototype.add=function(a,b){a.p();this.c();var c=a.j;this.f[c]||(this.f[c]=[]);this.f[c].push(b);this.e&&delete this.e[c]};w.prototype.clear=function(a){a.p();this.c();Ta(this,a.j)};
function Ua(a,b){for(var c=Ha(a.c()),d=0;d<c.length;d++){var e=c[d];if(Qa(b,e)){a.e&&delete a.e[e.j];var f=11==e.n||10==e.n;if(e.r){var g;g=b;var h=e;h.p();g.c();g=C(g,h.j);for(h=0;h<g.length;h++)a.add(e,f?Va(g[h]):g[h])}else g=Wa(b,e),f?(f=Wa(a,e))?Ua(f,g):a.set(e,Va(g)):a.set(e,g)}}}function Va(a){var b=new a.constructor;b!=a&&(b.f={},b.e&&(b.e={}),Ua(b,a));return b}function y(a,b){return b in a.f&&a.f[b]!==j&&a.f[b]!==l}
function Wa(a,b){var c=b.j;if(!c in a.f)return l;var d=a.f[c];if(d==l)return l;if(a.na){if(!(c in a.e)){var e=a.na;if(d!=l)if(b.r){for(var f=[],g=0;g<d.length;g++)f[g]=e.t(b,d[g]);d=f}else d=e.t(b,d);return a.e[c]=d}return a.e[c]}return d}function A(a,b,c){b=a.l[b];a=Wa(a,b);return b.r?a[c||0]:a}function D(a,b,c){y(a,b)?a=A(a,b,c):(a=a.l[b],a.la===j&&(b=a.pa,a.la=b===Boolean?m:b===Number?0:b===String?"":new b),a=a.la);return a}function C(a,b){return Wa(a,a.l[b])||[]}
function Sa(a,b){return a.l[b].r?y(a,b)?a.f[b].length:0:y(a,b)?1:0}function B(a,b,c){a.f[b]=c;a.e&&(a.e[b]=c)}function Ta(a,b){delete a.f[b];a.e&&delete a.e[b]}function E(a,b){a.Ga=b;a.c=function(){return a.ta||(new a).c()}};function F(){}F.prototype.u=function(a,b){return 11==a.n||10==a.n?this.ca(b):b};F.prototype.z=function(a,b){var c=new a.za;this.va(c,b);return c};F.prototype.t=function(a,b){if(11==a.n||10==a.n)return b instanceof w?b:this.z(a.pa.c(),b);if(!a.ua)return b;var c=a.pa;if(c===String){if("number"===typeof b)return String(b)}else if(c===Number&&"string"===typeof b&&/^-?[0-9]+$/.test(b))return Number(b);return b};function Xa(a){this.Ha=a}q(Xa,F);Xa.prototype.ca=function(a){for(var b=Ha(a.c()),c={},d=0;d<b.length;d++){var e=b[d],f=1==this.Ha?e.getName():e.j;if(Qa(a,e))if(e.r){var g=[];c[f]=g;for(f=0;f<Ra(a,e);f++)g.push(this.u(e,a.get(e,f)))}else c[f]=this.u(e,a.get(e))}Pa(a,function(a,b){c[a]=b});return c};
Xa.prototype.va=function(a,b){var c=a.c(),d;for(d in b){var e,f=b[d],g=!/[^0-9]/.test(d);if(e=g?c.l[parseInt(d,10)]||l:Ia(c,d))if(e.r)for(g=0;g<f.length;g++)a.add(e,this.t(e,f[g]));else a.set(e,this.t(e,f));else g&&(e=a,g=Number(d),e.f[g]=f,e.e&&delete e.e[g])}};function G(a,b){a!=l&&this.append.apply(this,arguments)}G.prototype.h="";G.prototype.set=function(a){this.h=""+a};G.prototype.append=function(a,b,c){this.h+=a;if(b!=l)for(var d=1;d<arguments.length;d++)this.h+=arguments[d];return this};G.prototype.clear=function(){this.h=""};G.prototype.toString=function(){return this.h};/*
Protocol Buffer 2 Copyright 2008 Google Inc.
All other code copyright its respective owners.
@ -29,13 +29,13 @@ Va.prototype.wa=function(a,b){var c=a.c(),d;for(d in b){var e,f=b[d],g=!/[^0-9]/
See the License for the specific language governing permissions and
limitations under the License.
*/
function Wa(){x.apply(this)}l(Wa,x);function G(){x.apply(this)}l(G,x);function H(){x.apply(this)}l(H,x);H.prototype.xa=function(){return z(this,10)};H.prototype.g=function(){return C(this,10)};H.prototype.da=function(a){A(this,10,a)};function Xa(){x.apply(this)}l(Xa,x);
D(Wa,{0:{name:"NumberFormat",fa:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,a:9,type:String},2:{name:"format",required:!0,a:9,type:String},3:{name:"leading_digits_pattern",ga:!0,a:9,type:String},4:{name:"national_prefix_formatting_rule",a:9,type:String},6:{name:"national_prefix_optional_when_formatting",a:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",a:9,type:String}});
D(G,{0:{name:"PhoneNumberDesc",fa:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",a:9,type:String},3:{name:"possible_number_pattern",a:9,type:String},6:{name:"example_number",a:9,type:String}});
D(H,{0:{name:"PhoneMetadata",fa:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",required:!0,a:11,type:G},2:{name:"fixed_line",required:!0,a:11,type:G},3:{name:"mobile",required:!0,a:11,type:G},4:{name:"toll_free",required:!0,a:11,type:G},5:{name:"premium_rate",required:!0,a:11,type:G},6:{name:"shared_cost",required:!0,a:11,type:G},7:{name:"personal_number",required:!0,a:11,type:G},8:{name:"voip",required:!0,a:11,type:G},21:{name:"pager",required:!0,a:11,type:G},25:{name:"uan",required:!0,
a:11,type:G},27:{name:"emergency",required:!0,a:11,type:G},28:{name:"voicemail",required:!0,a:11,type:G},24:{name:"no_international_dialling",required:!0,a:11,type:G},9:{name:"id",required:!0,a:9,type:String},10:{name:"country_code",required:!0,a:5,type:Number},11:{name:"international_prefix",required:!0,a:9,type:String},17:{name:"preferred_international_prefix",a:9,type:String},12:{name:"national_prefix",a:9,type:String},13:{name:"preferred_extn_prefix",a:9,type:String},15:{name:"national_prefix_for_parsing",
a:9,type:String},16:{name:"national_prefix_transform_rule",a:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",a:8,defaultValue:!1,type:Boolean},19:{name:"number_format",ga:!0,a:11,type:Wa},20:{name:"intl_number_format",ga:!0,a:11,type:Wa},22:{name:"main_country_for_code",a:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",a:9,type:String},26:{name:"leading_zero_possible",a:8,defaultValue:!1,type:Boolean}});
D(Xa,{0:{name:"PhoneMetadataCollection",fa:"i18n.phonenumbers.PhoneMetadataCollection"},1:{name:"metadata",ga:!0,a:11,type:H}});/*
function Ya(){w.apply(this)}q(Ya,w);function H(){w.apply(this)}q(H,w);function I(){w.apply(this)}q(I,w);I.prototype.wa=function(){return A(this,10)};I.prototype.g=function(){return D(this,10)};I.prototype.da=function(a){B(this,10,a)};function Za(){w.apply(this)}q(Za,w);
E(Ya,{"0":{name:"NumberFormat",$:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:k,a:9,type:String},2:{name:"format",required:k,a:9,type:String},3:{name:"leading_digits_pattern",fa:k,a:9,type:String},4:{name:"national_prefix_formatting_rule",a:9,type:String},6:{name:"national_prefix_optional_when_formatting",a:8,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",a:9,type:String}});
E(H,{"0":{name:"PhoneNumberDesc",$:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",a:9,type:String},3:{name:"possible_number_pattern",a:9,type:String},6:{name:"example_number",a:9,type:String}});
E(I,{"0":{name:"PhoneMetadata",$:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",required:k,a:11,type:H},2:{name:"fixed_line",required:k,a:11,type:H},3:{name:"mobile",required:k,a:11,type:H},4:{name:"toll_free",required:k,a:11,type:H},5:{name:"premium_rate",required:k,a:11,type:H},6:{name:"shared_cost",required:k,a:11,type:H},7:{name:"personal_number",required:k,a:11,type:H},8:{name:"voip",required:k,a:11,type:H},21:{name:"pager",required:k,a:11,type:H},25:{name:"uan",required:k,a:11,type:H},
27:{name:"emergency",required:k,a:11,type:H},28:{name:"voicemail",required:k,a:11,type:H},24:{name:"no_international_dialling",required:k,a:11,type:H},9:{name:"id",required:k,a:9,type:String},10:{name:"country_code",required:k,a:5,type:Number},11:{name:"international_prefix",required:k,a:9,type:String},17:{name:"preferred_international_prefix",a:9,type:String},12:{name:"national_prefix",a:9,type:String},13:{name:"preferred_extn_prefix",a:9,type:String},15:{name:"national_prefix_for_parsing",a:9,type:String},
16:{name:"national_prefix_transform_rule",a:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",a:8,defaultValue:m,type:Boolean},19:{name:"number_format",fa:k,a:11,type:Ya},20:{name:"intl_number_format",fa:k,a:11,type:Ya},22:{name:"main_country_for_code",a:8,defaultValue:m,type:Boolean},23:{name:"leading_digits",a:9,type:String},26:{name:"leading_zero_possible",a:8,defaultValue:m,type:Boolean}});
E(Za,{"0":{name:"PhoneMetadataCollection",$:"i18n.phonenumbers.PhoneMetadataCollection"},1:{name:"metadata",fa:k,a:11,type:I}});/*
Protocol Buffer 2 Copyright 2008 Google Inc.
All other code copyright its respective owners.
@ -53,9 +53,9 @@ D(Xa,{0:{name:"PhoneMetadataCollection",fa:"i18n.phonenumbers.PhoneMetadataColle
See the License for the specific language governing permissions and
limitations under the License.
*/
function I(){x.apply(this)}l(I,x);I.prototype.xa=function(){return z(this,1)};I.prototype.g=function(){return C(this,1)};I.prototype.da=function(a){A(this,1,a)};I.prototype.getExtension=function(){return z(this,3)};
D(I,{0:{name:"PhoneNumber",fa:"i18n.phonenumbers.PhoneNumber"},1:{name:"country_code",required:!0,a:5,type:Number},2:{name:"national_number",required:!0,a:4,type:Number},3:{name:"extension",a:9,type:String},4:{name:"italian_leading_zero",a:8,type:Boolean},8:{name:"number_of_leading_zeros",a:5,defaultValue:1,type:Number},5:{name:"raw_input",a:9,type:String},6:{name:"country_code_source",a:14,defaultValue:1,type:{La:1,Ka:5,Ja:10,Ia:20}},7:{name:"preferred_domestic_carrier_code",a:9,type:String}});function Ya(){}l(Ya,E);Ya.prototype.$=function(a,b){var c=new a.Aa;c.oa=this;c.f=b;c.e={};return c};Ya.prototype.wa=function(){throw Error("Unimplemented");};function J(){}l(J,Ya);J.prototype.Ca=!1;J.prototype.ca=function(a){for(var b=Fa(a.c()),c=[],d=this.Ca,e=0;e<b.length;e++){var f=b[e];if(Oa(a,f)){var g=f.j,g=d?g-1:g;if(f.q){c[g]=[];for(var h=0;h<Pa(a,f);h++)c[g][h]=this.t(f,a.get(f,h))}else c[g]=this.t(f,a.get(f))}}Na(a,function(a,b){c[d?a-1:a]=b});return c};J.prototype.t=function(a,b){return 8==a.n?b?1:0:E.prototype.t.apply(this,arguments)};J.prototype.s=function(a,b){return 8==a.n?1===b:E.prototype.s.apply(this,arguments)};
J.prototype.$=function(a,b){var c=b;if(this.Ca){var c=[],d;for(d in b)c[parseInt(d,10)+1]=b[d]}return J.Ha.$.call(this,a,c)};/*
function J(){w.apply(this)}q(J,w);J.prototype.wa=function(){return A(this,1)};J.prototype.g=function(){return D(this,1)};J.prototype.da=function(a){B(this,1,a)};J.prototype.getExtension=function(){return A(this,3)};
E(J,{"0":{name:"PhoneNumber",$:"i18n.phonenumbers.PhoneNumber"},1:{name:"country_code",required:k,a:5,type:Number},2:{name:"national_number",required:k,a:4,type:Number},3:{name:"extension",a:9,type:String},4:{name:"italian_leading_zero",a:8,type:Boolean},8:{name:"number_of_leading_zeros",a:5,defaultValue:1,type:Number},5:{name:"raw_input",a:9,type:String},6:{name:"country_code_source",a:14,defaultValue:1,type:{Pa:1,Oa:5,Na:10,Ma:20}},7:{name:"preferred_domestic_carrier_code",a:9,type:String}});function $a(){}q($a,F);$a.prototype.z=function(a,b){var c=new a.za;c.na=this;c.f=b;c.e={};return c};$a.prototype.va=function(){i(Error("Unimplemented"))};function K(){}q(K,$a);K.prototype.Ba=m;K.prototype.ca=function(a){for(var b=Ha(a.c()),c=[],d=this.Ba,e=0;e<b.length;e++){var f=b[e];if(Qa(a,f)){var g=f.j,g=d?g-1:g;if(f.r){c[g]=[];for(var h=0;h<Ra(a,f);h++)c[g][h]=this.u(f,a.get(f,h))}else c[g]=this.u(f,a.get(f))}}Pa(a,function(a,b){c[d?a-1:a]=b});return c};K.prototype.u=function(a,b){return 8==a.n?b?1:0:F.prototype.u.apply(this,arguments)};K.prototype.t=function(a,b){return 8==a.n?1===b:F.prototype.t.apply(this,arguments)};
K.prototype.z=function(a,b){var c=b;if(this.Ba){var c=[],d;for(d in b)c[parseInt(d,10)+1]=b[d]}return K.La.z.call(this,a,c)};/*
Copyright (C) 2010 The Libphonenumber Authors
@ -71,11 +71,11 @@ J.prototype.$=function(a,b){var c=b;if(this.Ca){var c=[],d;for(d in b)c[parseInt
See the License for the specific language governing permissions and
limitations under the License.
*/
var K={1:"US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],
var L={1:"US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],
86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],
253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],379:["VA"],380:["UA"],381:["RS"],382:["ME"],385:["HR"],
386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],
691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},Za={AC:[,[,,"[2-467]\\d{3}","\\d{4}"],[,
691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},ab={AC:[,[,,"[2-467]\\d{3}","\\d{4}"],[,
,"(?:[267]\\d|3[0-5]|4[4-69])\\d{2}","\\d{4}",,,"6889"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"AC",247,"00",,,,,,,,,,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],AD:[,[,,"(?:[346-9]|180)\\d{5}","\\d{6,8}"],[,,"[78]\\d{5}","\\d{6}",,,"712345"],[,,"[346]\\d{5}","\\d{6}",,,"312345"],[,,"180[02]\\d{4}","\\d{8}",,,"18001234"],[,,"9\\d{5}","\\d{6}",,,"912345"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"AD",376,"00",,,,,,,,[[,"(\\d{3})(\\d{3})",
"$1 $2",["[346-9]"],"","",0],[,"(180[02])(\\d{4})","$1 $2",["1"],"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],AE:[,[,,"[2-79]\\d{7,8}|800\\d{2,9}","\\d{5,12}"],[,,"[2-4679][2-8]\\d{6}","\\d{7,8}",,,"22345678"],[,,"5[0256]\\d{7}","\\d{9}",,,"501234567"],[,,"400\\d{6}|800\\d{2,9}","\\d{5,12}",,,"800123456"],[,,"900[02]\\d{5}","\\d{9}",,,"900234567"],[,,"700[05]\\d{5}","\\d{9}",,,"700012345"],[,,"NA","NA"],[,,"NA","NA"],"AE",971,"00","0",,,"0",,,,[[,"([2-4679])(\\d{3})(\\d{4})",
"$1 $2 $3",["[2-4679][2-8]"],"0$1","",0],[,"(5[0256])(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1","",0],[,"([479]00)(\\d)(\\d{5})","$1 $2 $3",["[479]0"],"$1","",0],[,"([68]00)(\\d{2,9})","$1 $2",["60|8"],"$1","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"600[25]\\d{5}","\\d{9}",,,"600212345"],,,[,,"NA","NA"]],AF:[,[,,"[2-7]\\d{8}","\\d{7,9}"],[,,"(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\\d{6}","\\d{7,9}",,,"234567890"],[,,"7[057-9]\\d{7}","\\d{9}",,,"701234567"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA",
@ -92,9 +92,9 @@ var K={1:"US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC V
1],[,"(\\d{4})(\\d{3})(\\d{3})","$1 $2-$3",["3(?:53|8[78])","3(?:537|8(?:73|88))"],"0$1","",1],[,"(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["[23]"],"0$1","",1],[,"(\\d{3})","$1",["1[012]|911"],"$1","",0]],[[,"([68]\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[68]","[68]"],"0$1","",0],[,"(9)(11)(\\d{4})(\\d{4})","$1 $2 $3-$4",["911"]],[,"(9)(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3-$4",["9(?:2[234689]|3[3-8])","9(?:2(?:2[013]|3[067]|49|6[01346]|80|9[147-9])|3(?:36|4[12358]|5[138]|6[24]|7[069]|8[013578]))","9(?:2(?:2[013]|3[067]|49|6[01346]|80|9(?:[17-9]|4[13479]))|3(?:36|4[12358]|5(?:[18]|3[014-689])|6[24]|7[069]|8(?:[01]|3[013469]|5[0-39]|7[0-2459]|8[0-49])))"]],
[,"(9)(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3-$4",["93[58]","9(?:3(?:53|8[78]))","9(?:3(?:537|8(?:73|88)))"]],[,"(9)(\\d{4})(\\d{2})(\\d{4})","$1 $2 $3-$4",["9[23]"]],[,"(11)(\\d{4})(\\d{4})","$1 $2-$3",["1","1"],"0$1","",1],[,"(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["2(?:2[013]|3[067]|49|6[01346]|80|9[147-9])|3(?:36|4[12358]|5[138]|6[24]|7[069]|8[013578])","2(?:2[013]|3[067]|49|6[01346]|80|9(?:[17-9]|4[13479]))|3(?:36|4[12358]|5(?:[18]|3[0-689])|6[24]|7[069]|8(?:[01]|3[013469]|5[0-39]|7[0-2459]|8[0-49]))",
"2(?:2[013]|3[067]|49|6[01346]|80|9[147-9])|3(?:36|4[12358]|5[138]|6[24]|7[069]|8[013578])","2(?:2[013]|3[067]|49|6[01346]|80|9(?:[17-9]|4[13479]))|3(?:36|4[12358]|5(?:[18]|3[0-689])|6[24]|7[069]|8(?:[01]|3[013469]|5[0-39]|7[0-2459]|8[0-49]))"],"0$1","",1],[,"(\\d{4})(\\d{3})(\\d{3})","$1 $2-$3",["3(?:53|8[78])","3(?:537|8(?:73|88))","3(?:53|8[78])","3(?:537|8(?:73|88))"],"0$1","",1],[,"(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["[23]","[23]"],"0$1","",1]],[,,"NA","NA"],,,[,,"810\\d{7}","\\d{10}",,,"8101234567"],
[,,"810\\d{7}","\\d{10}",,,"8101234567"],,,[,,"NA","NA"]],AS:[,[,,"[5689]\\d{9}","\\d{7}(?:\\d{3})?"],[,,"6846(?:22|33|44|55|77|88|9[19])\\d{4}","\\d{7}(?:\\d{3})?",,,"6846221234"],[,,"684(?:733|25[2468])\\d{4}","\\d{10}",,,"6847331234"],[,,"8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}",,,"8002123456"],[,,"900[2-9]\\d{6}","\\d{10}",,,"9002123456"],[,,"NA","NA"],[,,"5(?:00|33|44)[2-9]\\d{6}","\\d{10}",,,"5002345678"],[,,"NA","NA"],"AS",1,"011","1",,,"1",,,,,,[,,"NA","NA"],,"684",[,,"NA","NA"],[,,"NA",
"NA"],,,[,,"NA","NA"]],AT:[,[,,"[1-9]\\d{3,12}","\\d{3,13}"],[,,"1\\d{3,12}|(?:2(?:1[467]|2[13-8]|5[2357]|6[1-46-8]|7[1-8]|8[124-7]|9[1458])|3(?:1[1-8]|3[23568]|4[5-7]|5[1378]|6[1-38]|8[3-68])|4(?:2[1-8]|35|63|7[1368]|8[2457])|5(?:12|2[1-8]|3[357]|4[147]|5[12578]|6[37])|6(?:13|2[1-47]|4[1-35-8]|5[468]|62)|7(?:2[1-8]|3[25]|4[13478]|5[68]|6[16-8]|7[1-6]|9[45]))\\d{3,10}","\\d{3,13}",,,"1234567890"],[,,"6(?:44|5[0-3579]|6[013-9]|[7-9]\\d)\\d{4,10}","\\d{7,13}",,,"644123456"],[,,"80[02]\\d{6,10}","\\d{9,13}",
,,"800123456"],[,,"(?:711|9(?:0[01]|3[019]))\\d{6,10}","\\d{9,13}",,,"900123456"],[,,"8(?:10|2[018])\\d{6,10}","\\d{9,13}",,,"810123456"],[,,"NA","NA"],[,,"780\\d{6,10}","\\d{9,13}",,,"780123456"],"AT",43,"00","0",,,"0",,,,[[,"(1)(\\d{3,12})","$1 $2",["1"],"0$1","",0],[,"(5\\d)(\\d{3,5})","$1 $2",["5[079]"],"0$1","",0],[,"(5\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["5[079]"],"0$1","",0],[,"(5\\d)(\\d{4})(\\d{4,7})","$1 $2 $3",["5[079]"],"0$1","",0],[,"(\\d{3})(\\d{3,10})","$1 $2",["316|46|51|732|6(?:44|5[0-3579]|[6-9])|7(?:1|[28]0)|[89]"],
[,,"810\\d{7}","\\d{10}",,,"8101234567"],,,[,,"NA","NA"]],AS:[,[,,"[5689]\\d{9}","\\d{7}(?:\\d{3})?"],[,,"6846(?:22|33|44|55|77|88|9[19])\\d{4}","\\d{7}(?:\\d{3})?",,,"6846221234"],[,,"684(?:25[2468]|7(?:3[13]|70))\\d{4}","\\d{10}",,,"6847331234"],[,,"8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}",,,"8002123456"],[,,"900[2-9]\\d{6}","\\d{10}",,,"9002123456"],[,,"NA","NA"],[,,"5(?:00|33|44)[2-9]\\d{6}","\\d{10}",,,"5002345678"],[,,"NA","NA"],"AS",1,"011","1",,,"1",,,,,,[,,"NA","NA"],,"684",[,,"NA","NA"],
[,,"NA","NA"],,,[,,"NA","NA"]],AT:[,[,,"[1-9]\\d{3,12}","\\d{3,13}"],[,,"1\\d{3,12}|(?:2(?:1[467]|2[13-8]|5[2357]|6[1-46-8]|7[1-8]|8[124-7]|9[1458])|3(?:1[1-8]|3[23568]|4[5-7]|5[1378]|6[1-38]|8[3-68])|4(?:2[1-8]|35|63|7[1368]|8[2457])|5(?:12|2[1-8]|3[357]|4[147]|5[12578]|6[37])|6(?:13|2[1-47]|4[1-35-8]|5[468]|62)|7(?:2[1-8]|3[25]|4[13478]|5[68]|6[16-8]|7[1-6]|9[45]))\\d{3,10}","\\d{3,13}",,,"1234567890"],[,,"6(?:44|5[0-3579]|6[013-9]|[7-9]\\d)\\d{4,10}","\\d{7,13}",,,"644123456"],[,,"80[02]\\d{6,10}",
"\\d{9,13}",,,"800123456"],[,,"(?:711|9(?:0[01]|3[019]))\\d{6,10}","\\d{9,13}",,,"900123456"],[,,"8(?:10|2[018])\\d{6,10}","\\d{9,13}",,,"810123456"],[,,"NA","NA"],[,,"780\\d{6,10}","\\d{9,13}",,,"780123456"],"AT",43,"00","0",,,"0",,,,[[,"(1)(\\d{3,12})","$1 $2",["1"],"0$1","",0],[,"(5\\d)(\\d{3,5})","$1 $2",["5[079]"],"0$1","",0],[,"(5\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["5[079]"],"0$1","",0],[,"(5\\d)(\\d{4})(\\d{4,7})","$1 $2 $3",["5[079]"],"0$1","",0],[,"(\\d{3})(\\d{3,10})","$1 $2",["316|46|51|732|6(?:44|5[0-3579]|[6-9])|7(?:1|[28]0)|[89]"],
"0$1","",0],[,"(\\d{4})(\\d{3,9})","$1 $2",["2|3(?:1[1-578]|[3-8])|4[2378]|5[2-6]|6(?:[12]|4[1-35-9]|5[468])|7(?:2[1-8]|35|4[1-8]|[5-79])"],"0$1","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"5(?:(?:0[1-9]|17)\\d{2,10}|[79]\\d{3,11})|720\\d{6,10}","\\d{5,13}",,,"50123"],,,[,,"NA","NA"]],AU:[,[,,"[1-578]\\d{5,9}","\\d{6,10}"],[,,"[237]\\d{8}|8(?:[68]\\d{3}|7[0-69]\\d{2}|9(?:[02-9]\\d{2}|1(?:[0-57-9]\\d|6[0135-9])))\\d{4}","\\d{8,9}",,,"212345678"],[,,"14(?:5\\d|71)\\d{5}|4(?:[0-2]\\d|3[0-57-9]|4[47-9]|5[0-25-9]|6[6-9]|7[0457-9]|8[17-9]|9[07-9])\\d{6}",
"\\d{9}",,,"412345678"],[,,"180(?:0\\d{3}|2)\\d{3}","\\d{7,10}",,,"1800123456"],[,,"190[0126]\\d{6}","\\d{10}",,,"1900123456"],[,,"13(?:00\\d{2})?\\d{4}","\\d{6,10}",,,"1300123456"],[,,"500\\d{6}","\\d{9}",,,"500123456"],[,,"550\\d{6}","\\d{9}",,,"550123456"],"AU",61,"(?:14(?:1[14]|34|4[17]|[56]6|7[47]|88))?001[14-689]","0",,,"0",,"0011",,[[,"([2378])(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)","",0],[,"(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[45]|14"],"0$1","",0],[,"(16)(\\d{3})(\\d{2,4})","$1 $2 $3",
["16"],"0$1","",0],[,"(1[389]\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[38]0|90)","1(?:[38]00|90)"],"$1","",0],[,"(180)(2\\d{3})","$1 $2",["180","1802"],"$1","",0],[,"(19\\d)(\\d{3})","$1 $2",["19[13]"],"$1","",0],[,"(19\\d{2})(\\d{4})","$1 $2",["19[67]"],"$1","",0],[,"(13)(\\d{2})(\\d{2})","$1 $2 $3",["13[1-9]"],"$1","",0]],,[,,"16\\d{3,7}","\\d{5,9}",,,"1612345"],1,,[,,"1(?:3(?:\\d{4}|00\\d{6})|80(?:0\\d{6}|2\\d{3}))","\\d{6,10}",,,"1300123456"],[,,"NA","NA"],,,[,,"NA","NA"]],AW:[,[,,"[25-9]\\d{6}",
@ -116,13 +116,13 @@ var K={1:"US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC V
"\\d{7}(?:\\d{3})?",,,"4412345678"],[,,"441(?:[37]\\d|5[0-39])\\d{5}","\\d{10}",,,"4413701234"],[,,"8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}",,,"8002123456"],[,,"900[2-9]\\d{6}","\\d{10}",,,"9002123456"],[,,"NA","NA"],[,,"5(?:00|33|44)[2-9]\\d{6}","\\d{10}",,,"5002345678"],[,,"NA","NA"],"BM",1,"011","1",,,"1",,,,,,[,,"NA","NA"],,"441",[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BN:[,[,,"[2-578]\\d{6}","\\d{7}"],[,,"[2-5]\\d{6}","\\d{7}",,,"2345678"],[,,"[78]\\d{6}","\\d{7}",,,"7123456"],[,,"NA",
"NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BN",673,"00",,,,,,,,[[,"([2-578]\\d{2})(\\d{4})","$1 $2",,"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BO:[,[,,"[23467]\\d{7}","\\d{7,8}"],[,,"(?:2(?:2\\d{2}|5(?:11|[258]\\d|9[67])|6(?:12|2\\d|9[34])|8(?:2[34]|39|62))|3(?:3\\d{2}|4(?:6\\d|8[24])|8(?:25|42|5[257]|86|9[25])|9(?:2\\d|3[234]|4[248]|5[24]|6[2-6]|7\\d))|4(?:4\\d{2}|6(?:11|[24689]\\d|72)))\\d{4}","\\d{7,8}",,,"22123456"],[,,"[67]\\d{7}","\\d{8}",,,
"71234567"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BO",591,"00(1\\d)?","0",,,"0(1\\d)?",,,,[[,"([234])(\\d{7})","$1 $2",["[234]"],"","0$CC $1",0],[,"([67]\\d{7})","$1",["[67]"],"","0$CC $1",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BQ:[,[,,"[347]\\d{6}","\\d{7}"],[,,"(?:318[023]|416[023]|7(?:1[578]|50)\\d)\\d{3}","\\d{7}",,,"7151234"],[,,"(?:318[14-68]|416[15-9]|7(?:0[01]|7[07]|[89]\\d)\\d)\\d{3}","\\d{7}",,,"3181234"],[,,"NA","NA"],[,,"NA",
"NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BQ",599,"00",,,,,,,,,,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BR:[,[,,"[1-46-9]\\d{7,10}|5\\d{8,9}","\\d{8,11}"],[,,"1[1-9][2-5]\\d{7}|(?:[4689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}","\\d{8,11}",,,"1123456789"],[,,"1[1-9]9\\d{8}|2[12478]9?[6-9]\\d{7}|(?:3[1-578]|[4689][1-9]|5[13-5]|7[13-579])[6-9]\\d{7}","\\d{10,11}",,,"11961234567"],[,,"800\\d{6,7}","\\d{8,11}",,,"800123456"],[,,"[359]00\\d{6,7}","\\d{8,11}",,,
"300123456"],[,,"[34]00\\d{5}","\\d{8}",,,"40041234"],[,,"NA","NA"],[,,"NA","NA"],"BR",55,"00(?:1[45]|2[135]|[34]1|43)","0",,,"0(?:(1[245]|2[135]|[34]1)(\\d{10,11}))?","$2",,,[[,"(\\d{4})(\\d{4})","$1-$2",["[2-9](?:[1-9]|0[1-9])"],"$1","",0],[,"(\\d{5})(\\d{4})","$1-$2",["9(?:[1-9]|0[1-9])"],"$1","",0],[,"(\\d{3,5})","$1",["1[125689]"],"$1","",0],[,"(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["(?:1[1-9]|2[12478])9"],"($1)","0 $CC ($1)",0],[,"(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["[1-9][1-9]"],"($1)","0 $CC ($1)",
0],[,"([34]00\\d)(\\d{4})","$1-$2",["[34]00"],"","",0],[,"([3589]00)(\\d{2,3})(\\d{4})","$1 $2 $3",["[3589]00"],"0$1","",0]],[[,"(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["(?:1[1-9]|2[12478])9","(?:1[1-9]|2[12478])9"],"($1)","0 $CC ($1)",0],[,"(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["[1-9][1-9]","[1-9][1-9]"],"($1)","0 $CC ($1)",0],[,"([34]00\\d)(\\d{4})","$1-$2",["[34]00","[34]00"],"","",0],[,"([3589]00)(\\d{2,3})(\\d{4})","$1 $2 $3",["[3589]00","[3589]00"],"0$1","",0]],[,,"NA","NA"],,,[,,"[34]00\\d{5}",
"\\d{8}",,,"40041234"],[,,"NA","NA"],,,[,,"NA","NA"]],BS:[,[,,"[2589]\\d{9}","\\d{7}(?:\\d{3})?"],[,,"242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3467]|8[0-4]|9[2-467])|461|502|6(?:12|7[67]|8[78]|9[89])|702)\\d{4}","\\d{7}(?:\\d{3})?",,,"2423456789"],[,,"242(?:3(?:5[79]|[79]5)|4(?:[2-4][1-9]|5[1-8]|6[2-8]|7\\d|81)|5(?:2[45]|3[35]|44|5[1-9]|65|77)|6[34]6|727)\\d{4}","\\d{10}",,,"2423591234"],[,,"242300\\d{4}|8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}",,,"8002123456"],[,,"900[2-9]\\d{6}","\\d{10}",
,,"9002123456"],[,,"NA","NA"],[,,"5(?:00|33|44)[2-9]\\d{6}","\\d{10}",,,"5002345678"],[,,"NA","NA"],"BS",1,"011","1",,,"1",,,,,,[,,"NA","NA"],,"242",[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BT:[,[,,"[1-8]\\d{6,7}","\\d{6,8}"],[,,"(?:2[3-6]|[34][5-7]|5[236]|6[2-46]|7[246]|8[2-4])\\d{5}","\\d{6,7}",,,"2345678"],[,,"[17]7\\d{6}","\\d{8}",,,"17123456"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BT",975,"00",,,,,,,,[[,"([17]7)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1|77"],
"","",0],[,"([2-8])(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"],"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BW:[,[,,"[2-79]\\d{6,7}","\\d{7,8}"],[,,"(?:2(?:4[0-48]|6[0-24]|9[0578])|3(?:1[0235-9]|55|6\\d|7[01]|9[0-57])|4(?:6[03]|7[1267]|9[0-5])|5(?:3[0389]|4[0489]|7[1-47]|88|9[0-49])|6(?:2[1-35]|5[149]|8[067]))\\d{4}","\\d{7}",,,"2401234"],[,,"7(?:[1-35]\\d{6}|[46][0-7]\\d{5}|7[01467]\\d{5})","\\d{8}",,,"71123456"],[,,"NA","NA"],[,,"90\\d{5}","\\d{7}",,,"9012345"],[,,
"NA","NA"],[,,"NA","NA"],[,,"79[12][01]\\d{4}","\\d{8}",,,"79101234"],"BW",267,"00",,,,,,,,[[,"(\\d{3})(\\d{4})","$1 $2",["[2-6]"],"","",0],[,"(7\\d)(\\d{3})(\\d{3})","$1 $2 $3",["7"],"","",0],[,"(90)(\\d{5})","$1 $2",["9"],"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BY:[,[,,"[1-4]\\d{8}|[89]\\d{9,10}","\\d{7,11}"],[,,"(?:1(?:5(?:1[1-5]|[24]\\d|6[2-4]|9[1-7])|6(?:[235]\\d|4[1-7])|7\\d{2})|2(?:1(?:[246]\\d|3[0-35-9]|5[1-9])|2(?:[235]\\d|4[0-8])|3(?:[26]\\d|3[02-79]|4[024-7]|5[03-7])))\\d{5}",
"NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BQ",599,"00",,,,,,,,,,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BR:[,[,,"[1-46-9]\\d{7,10}|5\\d{8,9}","\\d{8,11}"],[,,"1[1-9][2-5]\\d{7}|(?:[4689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}","\\d{8,11}",,,"1123456789"],[,,"1[1-9](?:7|9\\d)\\d{7}|2[12478]9?[6-9]\\d{7}|(?:3[1-578]|[4689][1-9]|5[13-5]|7[13-579])[6-9]\\d{7}","\\d{10,11}",,,"11961234567"],[,,"800\\d{6,7}","\\d{8,11}",,,"800123456"],[,,"[359]00\\d{6,7}","\\d{8,11}",
,,"300123456"],[,,"[34]00\\d{5}","\\d{8}",,,"40041234"],[,,"NA","NA"],[,,"NA","NA"],"BR",55,"00(?:1[45]|2[135]|[34]1|43)","0",,,"0(?:(1[245]|2[135]|[34]1)(\\d{10,11}))?","$2",,,[[,"(\\d{4})(\\d{4})","$1-$2",["[2-9](?:[1-9]|0[1-9])"],"$1","",0],[,"(\\d{5})(\\d{4})","$1-$2",["9(?:[1-9]|0[1-9])"],"$1","",0],[,"(\\d{3,5})","$1",["1[125689]"],"$1","",0],[,"(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["(?:1[1-9]|2[12478])9"],"($1)","0 $CC ($1)",0],[,"(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["[1-9][1-9]"],"($1)",
"0 $CC ($1)",0],[,"([34]00\\d)(\\d{4})","$1-$2",["[34]00"],"","",0],[,"([3589]00)(\\d{2,3})(\\d{4})","$1 $2 $3",["[3589]00"],"0$1","",0]],[[,"(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["(?:1[1-9]|2[12478])9","(?:1[1-9]|2[12478])9"],"($1)","0 $CC ($1)",0],[,"(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["[1-9][1-9]","[1-9][1-9]"],"($1)","0 $CC ($1)",0],[,"([34]00\\d)(\\d{4})","$1-$2",["[34]00","[34]00"],"","",0],[,"([3589]00)(\\d{2,3})(\\d{4})","$1 $2 $3",["[3589]00","[3589]00"],"0$1","",0]],[,,"NA","NA"],,,[,
,"[34]00\\d{5}","\\d{8}",,,"40041234"],[,,"NA","NA"],,,[,,"NA","NA"]],BS:[,[,,"[2589]\\d{9}","\\d{7}(?:\\d{3})?"],[,,"242(?:3(?:02|[236][1-9]|4[0-24-9]|5[0-68]|7[3467]|8[0-4]|9[2-467])|461|502|6(?:12|7[67]|8[78]|9[89])|702)\\d{4}","\\d{7}(?:\\d{3})?",,,"2423456789"],[,,"242(?:3(?:5[79]|[79]5)|4(?:[2-4][1-9]|5[1-8]|6[2-8]|7\\d|81)|5(?:2[45]|3[35]|44|5[1-9]|65|77)|6[34]6|727)\\d{4}","\\d{10}",,,"2423591234"],[,,"242300\\d{4}|8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}",,,"8002123456"],[,,"900[2-9]\\d{6}",
"\\d{10}",,,"9002123456"],[,,"NA","NA"],[,,"5(?:00|33|44)[2-9]\\d{6}","\\d{10}",,,"5002345678"],[,,"NA","NA"],"BS",1,"011","1",,,"1",,,,,,[,,"NA","NA"],,"242",[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BT:[,[,,"[1-8]\\d{6,7}","\\d{6,8}"],[,,"(?:2[3-6]|[34][5-7]|5[236]|6[2-46]|7[246]|8[2-4])\\d{5}","\\d{6,7}",,,"2345678"],[,,"[17]7\\d{6}","\\d{8}",,,"17123456"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BT",975,"00",,,,,,,,[[,"([17]7)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",
["1|77"],"","",0],[,"([2-8])(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"],"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BW:[,[,,"[2-79]\\d{6,7}","\\d{7,8}"],[,,"(?:2(?:4[0-48]|6[0-24]|9[0578])|3(?:1[0235-9]|55|6\\d|7[01]|9[0-57])|4(?:6[03]|7[1267]|9[0-5])|5(?:3[0389]|4[0489]|7[1-47]|88|9[0-49])|6(?:2[1-35]|5[149]|8[067]))\\d{4}","\\d{7}",,,"2401234"],[,,"7(?:[1-35]\\d{6}|[46][0-7]\\d{5}|7[01467]\\d{5})","\\d{8}",,,"71123456"],[,,"NA","NA"],[,,"90\\d{5}","\\d{7}",,,"9012345"],
[,,"NA","NA"],[,,"NA","NA"],[,,"79[12][01]\\d{4}","\\d{8}",,,"79101234"],"BW",267,"00",,,,,,,,[[,"(\\d{3})(\\d{4})","$1 $2",["[2-6]"],"","",0],[,"(7\\d)(\\d{3})(\\d{3})","$1 $2 $3",["7"],"","",0],[,"(90)(\\d{5})","$1 $2",["9"],"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],BY:[,[,,"[1-4]\\d{8}|[89]\\d{9,10}","\\d{7,11}"],[,,"(?:1(?:5(?:1[1-5]|[24]\\d|6[2-4]|9[1-7])|6(?:[235]\\d|4[1-7])|7\\d{2})|2(?:1(?:[246]\\d|3[0-35-9]|5[1-9])|2(?:[235]\\d|4[0-8])|3(?:[26]\\d|3[02-79]|4[024-7]|5[03-7])))\\d{5}",
"\\d{7,9}",,,"152450911"],[,,"(?:2(?:5[5679]|9[1-9])|33\\d|44\\d)\\d{6}","\\d{9}",,,"294911911"],[,,"8(?:0[13]|20\\d)\\d{7}","\\d{10,11}",,,"8011234567"],[,,"(?:810|902)\\d{7}","\\d{10}",,,"9021234567"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BY",375,"810","8",,,"8?0?",,"8~10",,[[,"(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["17[0-3589]|2[4-9]|[34]","17(?:[02358]|1[0-2]|9[0189])|2[4-9]|[34]"],"8 0$1","",0],[,"(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:5[24]|6[235]|7[467])|2(?:1[246]|2[25]|3[26])",
"1(?:5[24]|6(?:2|3[04-9]|5[0346-9])|7(?:[46]|7[37-9]))|2(?:1[246]|2[25]|3[26])"],"8 0$1","",0],[,"(\\d{4})(\\d{2})(\\d{3})","$1 $2-$3",["1(?:5[169]|6[3-5]|7[179])|2(?:1[35]|2[34]|3[3-5])","1(?:5[169]|6(?:3[1-3]|4|5[125])|7(?:1[3-9]|7[0-24-6]|9[2-7]))|2(?:1[35]|2[34]|3[3-5])"],"8 0$1","",0],[,"([89]\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8[01]|9"],"8 $1","",0],[,"(8\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["82"],"8 $1","",0]],,[,,"NA","NA"],,,[,,"8(?:[013]|[12]0)\\d{8}|902\\d{7}","\\d{10,11}",,,"82012345678"],
[,,"NA","NA"],,,[,,"NA","NA"]],BZ:[,[,,"[2-8]\\d{6}|0\\d{10}","\\d{7}(?:\\d{4})?"],[,,"[234578][02]\\d{5}","\\d{7}",,,"2221234"],[,,"6[0-367]\\d{5}","\\d{7}",,,"6221234"],[,,"0800\\d{7}","\\d{11}",,,"08001234123"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"BZ",501,"00",,,,,,,,[[,"(\\d{3})(\\d{4})","$1-$2",["[2-8]"],"","",0],[,"(0)(800)(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"],"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],1,,[,,"NA","NA"]],CA:[,[,,"[2-9]\\d{9}|3\\d{6}","\\d{7}(?:\\d{3})?"],
@ -258,7 +258,7 @@ HN:[,[,,"[237-9]\\d{7}","\\d{8}"],[,,"2(?:2(?:0[019]|1[1-36]|[23]\\d|4[056]|5[57
["1"],"0$1","",0],[,"(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1","",0],[,"(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1","",0]],,[,,"NA","NA"],,,[,,"2(?:[0-24-9]\\d{2}|3(?:[0-79]\\d|8[02-9]))\\d{4}","\\d{8}",,,"23821234"],[,,"NA","NA"],,,[,,"NA","NA"]],KR:[,[,,"[1-7]\\d{3,9}|8\\d{8}","\\d{4,10}"],[,,"(?:2|3[1-3]|[46][1-4]|5[1-5])(?:1\\d{2,3}|[1-9]\\d{6,7})","\\d{4,10}",,,"22123456"],[,,"1[0-26-9]\\d{7,8}","\\d{9,10}",,,"1023456789"],[,,"80\\d{7}","\\d{9}",,,"801234567"],[,,"60[2-9]\\d{6}","\\d{9}",
,,"602345678"],[,,"NA","NA"],[,,"50\\d{8}","\\d{10}",,,"5012345678"],[,,"70\\d{8}","\\d{10}",,,"7012345678"],"KR",82,"00(?:[124-68]|[37]\\d{2})","0",,,"0(8[1-46-8]|85\\d{2})?",,,,[[,"(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["1(?:0|1[19]|[69]9|5[458])|[57]0","1(?:0|1[19]|[69]9|5(?:44|59|8))|[57]0"],"0$1","0$CC-$1",0],[,"(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["1(?:[169][2-8]|[78]|5[1-4])|[68]0|[3-6][1-9][1-9]","1(?:[169][2-8]|[78]|5(?:[1-3]|4[56]))|[68]0|[3-6][1-9][1-9]"],"0$1","0$CC-$1",0],[,"(\\d{3})(\\d)(\\d{4})",
"$1-$2-$3",["131","1312"],"0$1","0$CC-$1",0],[,"(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["131","131[13-9]"],"0$1","0$CC-$1",0],[,"(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["13[2-9]"],"0$1","0$CC-$1",0],[,"(\\d{2})(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3-$4",["30"],"0$1","0$CC-$1",0],[,"(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2[1-9]"],"0$1","0$CC-$1",0],[,"(\\d)(\\d{3,4})","$1-$2",["21[0-46-9]"],"0$1","0$CC-$1",0],[,"(\\d{2})(\\d{3,4})","$1-$2",["[3-6][1-9]1","[3-6][1-9]1(?:[0-46-9])"],"0$1","0$CC-$1",0],[,"(\\d{4})(\\d{4})",
"$1-$2",["1(?:5[46-9]|6[04678])","1(?:5(?:44|66|77|88|99)|6(?:00|44|6[16]|70|88))"],"$1","0$CC-$1",0]],,[,,"15\\d{7,8}","\\d{9,10}",,,"1523456789"],,,[,,"NA","NA"],[,,"1(?:5(?:44|66|77|88|99)|6(?:00|44|6[16]|70|88))\\d{4}","\\d{8}",,,"15441234"],,,[,,"NA","NA"]],KW:[,[,,"[12569]\\d{6,7}","\\d{7,8}"],[,,"(?:18\\d|2(?:[23]\\d{2}|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7])))\\d{4}","\\d{7,8}",,,"22345678"],[,,"(?:5(?:1[0-5]|[05]\\d)|6(?:0[034679]|5[015-9]|6\\d|7[067]|9[0369])|9(?:0[09]|4[049]|6[069]|[79]\\d|8[08]))\\d{5}",
"$1-$2",["1(?:5[46-9]|6[04678])","1(?:5(?:44|66|77|88|99)|6(?:00|44|6[16]|70|88))"],"$1","0$CC-$1",0]],,[,,"15\\d{7,8}","\\d{9,10}",,,"1523456789"],,,[,,"NA","NA"],[,,"1(?:5(?:44|66|77|88|99)|6(?:00|44|6[16]|70|88))\\d{4}","\\d{8}",,,"15441234"],,,[,,"NA","NA"]],KW:[,[,,"[12569]\\d{6,7}","\\d{7,8}"],[,,"(?:18\\d|2(?:[23]\\d{2}|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7])))\\d{4}","\\d{7,8}",,,"22345678"],[,,"(?:5(?:[05]\\d|1[0-6])|6(?:0[034679]|5[015-9]|6\\d|7[067]|9[0369])|9(?:0[09]|4[049]|6[069]|[79]\\d|8[08]))\\d{5}",
"\\d{8}",,,"50012345"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"KW",965,"00",,,,,,,,[[,"(\\d{4})(\\d{3,4})","$1 $2",["[1269]"],"","",0],[,"(5[015]\\d)(\\d{5})","$1 $2",["5"],"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],KY:[,[,,"[3589]\\d{9}","\\d{7}(?:\\d{3})?"],[,,"345(?:2(?:22|44)|444|6(?:23|38|40)|7(?:4[35-79]|6[6-9]|77)|8(?:00|1[45]|25|[48]8)|9(?:14|4[035-9]))\\d{4}","\\d{7}(?:\\d{3})?",,,"3452221234"],[,,"345(?:32[1-9]|5(?:1[67]|2[5-7]|4[6-8]|76)|9(?:1[67]|2[3-9]|3[689]))\\d{4}",
"\\d{10}",,,"3453231234"],[,,"8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}",,,"8002345678"],[,,"900[2-9]\\d{6}|345976\\d{4}","\\d{10}",,,"9002345678"],[,,"NA","NA"],[,,"5(?:00|33|44)[2-9]\\d{6}","\\d{10}",,,"5002345678"],[,,"NA","NA"],"KY",1,"011","1",,,"1",,,,,,[,,"345849\\d{4}","\\d{10}",,,"3458491234"],,"345",[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],KZ:[,[,,"(?:33\\d|7\\d{2}|80[09])\\d{7}","\\d{10}"],[,,"33622\\d{5}|7(?:1(?:0(?:[23]\\d|4[023]|59|63)|1(?:[23]\\d|4[0-79]|59)|2(?:[23]\\d|59)|3(?:2\\d|3[1-79]|4[0-35-9]|59)|4(?:2\\d|3[013-79]|4[0-8]|5[1-79])|5(?:2\\d|3[1-8]|4[1-7]|59)|6(?:[234]\\d|5[19]|61)|72\\d|8(?:[27]\\d|3[1-46-9]|4[0-5]))|2(?:1(?:[23]\\d|4[46-9]|5[3469])|2(?:2\\d|3[0679]|46|5[12679])|3(?:[234]\\d|5[139])|4(?:2\\d|3[1235-9]|59)|5(?:[23]\\d|4[01246-8]|59|61)|6(?:2\\d|3[1-9]|4[0-4]|59)|7(?:[237]\\d|40|5[279])|8(?:[23]\\d|4[0-3]|59)|9(?:2\\d|3[124578]|59)))\\d{5}",
"\\d{10}",,,"7123456789"],[,,"7(?:0[01257]|47|6[02-4]|7[15-8]|85)\\d{7}","\\d{10}",,,"7710009998"],[,,"800\\d{7}","\\d{10}",,,"8001234567"],[,,"809\\d{7}","\\d{10}",,,"8091234567"],[,,"NA","NA"],[,,"NA","NA"],[,,"751\\d{7}","\\d{10}",,,"7511234567"],"KZ",7,"810","8",,,"8",,"8~10",,,,[,,"NA","NA"],,,[,,"751\\d{7}","\\d{10}",,,"7511234567"],[,,"NA","NA"],,,[,,"NA","NA"]],LA:[,[,,"[2-8]\\d{7,9}","\\d{6,10}"],[,,"(?:2[13]|[35-7][14]|41|8[1468])\\d{6}","\\d{6,8}",,,"21212862"],[,,"20(?:2[2389]|5[4-689]|7[6-8]|9[57-9])\\d{6}",
@ -271,7 +271,7 @@ HN:[,[,,"[237-9]\\d{7}","\\d{8}"],[,,"2(?:2(?:0[019]|1[1-36]|[23]\\d|4[056]|5[57
"\\d{7,9}",,,"4612345"],[,,"NA","NA"],[,,"90\\d{6}","\\d{8}",,,"90123456"],[,,"NA","NA"],[,,"NA","NA"],[,,"33200\\d{4}","\\d{9}",,,"332001234"],"LR",231,"00","0",,,"0",,,,[[,"([279]\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[279]"],"0$1","",0],[,"(7\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1","",0],[,"([4-6])(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1","",0],[,"(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[38]"],"0$1","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],LS:[,[,,"[2568]\\d{7}",
"\\d{8}"],[,,"2\\d{7}","\\d{8}",,,"22123456"],[,,"[56]\\d{7}","\\d{8}",,,"50123456"],[,,"800[256]\\d{4}","\\d{8}",,,"80021234"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],[,,"NA","NA"],"LS",266,"00",,,,,,,,[[,"(\\d{4})(\\d{4})","$1 $2",,"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],LT:[,[,,"[3-9]\\d{7}","\\d{8}"],[,,"(?:3[1478]|4[124-6]|52)\\d{6}","\\d{8}",,,"31234567"],[,,"6\\d{7}","\\d{8}",,,"61234567"],[,,"800\\d{5}","\\d{8}",,,"80012345"],[,,"9(?:0[0239]|10)\\d{5}","\\d{8}",
,,"90012345"],[,,"808\\d{5}","\\d{8}",,,"80812345"],[,,"700\\d{5}","\\d{8}",,,"70012345"],[,,"NA","NA"],"LT",370,"00","8",,,"[08]",,,,[[,"([34]\\d)(\\d{6})","$1 $2",["37|4(?:1|5[45]|6[2-4])"],"(8-$1)","",1],[,"([3-6]\\d{2})(\\d{5})","$1 $2",["3[148]|4(?:[24]|6[09])|528|6"],"(8-$1)","",1],[,"([7-9]\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1","",1],[,"(5)(2\\d{2})(\\d{4})","$1 $2 $3",["52[0-79]"],"(8-$1)","",1]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"70[67]\\d{5}","\\d{8}",,,"70712345"],,,[,,"NA",
"NA"]],LU:[,[,,"[24-9]\\d{3,10}|3(?:[0-46-9]\\d{2,9}|5[013-9]\\d{1,8})","\\d{4,11}"],[,,"(?:2(?:2\\d{1,2}|3[2-9]|[67]\\d|4[1-8]\\d?|5[1-5]\\d?|9[0-24-9]\\d?)|3(?:[059][05-9]|[13]\\d|[26][015-9]|4[0-26-9]|7[0-389]|8[08])\\d?|4\\d{2,3}|5(?:[01458]\\d|[27][0-69]|3[0-3]|[69][0-7])\\d?|7(?:1[019]|2[05-9]|3[05]|[45][07-9]|[679][089]|8[06-9])\\d?|8(?:0[2-9]|1[0-36-9]|3[3-9]|[469]9|[58][7-9]|7[89])\\d?|9(?:0[89]|2[0-49]|37|49|5[0-27-9]|7[7-9]|9[0-478])\\d?)\\d{1,7}","\\d{4,11}",,,"27123456"],[,,"6[269][18]\\d{6}",
"NA"]],LU:[,[,,"[24-9]\\d{3,10}|3(?:[0-46-9]\\d{2,9}|5[013-9]\\d{1,8})","\\d{4,11}"],[,,"(?:2(?:2\\d{1,2}|3[2-9]|[67]\\d|4[1-8]\\d?|5[1-5]\\d?|9[0-24-9]\\d?)|3(?:[059][05-9]|[13]\\d|[26][015-9]|4[0-26-9]|7[0-389]|8[08])\\d?|4\\d{2,3}|5(?:[01458]\\d|[27][0-69]|3[0-3]|[69][0-7])\\d?|7(?:1[019]|2[05-9]|3[05]|[45][07-9]|[679][089]|8[06-9])\\d?|8(?:0[2-9]|1[0-36-9]|3[3-9]|[469]9|[58][7-9]|7[89])\\d?|9(?:0[89]|2[0-49]|37|49|5[0-27-9]|7[7-9]|9[0-478])\\d?)\\d{1,7}","\\d{4,11}",,,"27123456"],[,,"6(?:[269][18]|71)\\d{6}",
"\\d{9}",,,"628123456"],[,,"800\\d{5}","\\d{8}",,,"80012345"],[,,"90[01]\\d{5}","\\d{8}",,,"90012345"],[,,"801\\d{5}","\\d{8}",,,"80112345"],[,,"70\\d{6}","\\d{8}",,,"70123456"],[,,"20(?:1\\d{5}|[2-689]\\d{1,7})","\\d{4,10}",,,"20201234"],"LU",352,"00",,,,"(15(?:0[06]|1[12]|35|4[04]|55|6[26]|77|88|99)\\d)",,,,[[,"(\\d{2})(\\d{3})","$1 $2",["[2-5]|7[1-9]|[89](?:[1-9]|0[2-9])"],"","$CC $1",0],[,"(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[2-5]|7[1-9]|[89](?:[1-9]|0[2-9])"],"","$CC $1",0],[,"(\\d{2})(\\d{2})(\\d{3})",
"$1 $2 $3",["20"],"","$CC $1",0],[,"(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"],"","$CC $1",0],[,"(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"],"","$CC $1",0],[,"(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"],"","$CC $1",0],[,"(\\d{2})(\\d{2})(\\d{2})(\\d{1,4})","$1 $2 $3 $4",["2(?:[12589]|4[12])|[3-5]|7[1-9]|[89](?:[1-9]|0[2-9])"],"","$CC $1",0],[,"(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0[01]|70"],"","$CC $1",0],[,"(\\d{3})(\\d{3})(\\d{3})",
"$1 $2 $3",["6"],"","$CC $1",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],LV:[,[,,"[2689]\\d{7}","\\d{8}"],[,,"6[3-8]\\d{6}","\\d{8}",,,"63123456"],[,,"2\\d{7}","\\d{8}",,,"21234567"],[,,"80\\d{6}","\\d{8}",,,"80123456"],[,,"90\\d{6}","\\d{8}",,,"90123456"],[,,"81\\d{6}","\\d{8}",,,"81123456"],[,,"NA","NA"],[,,"NA","NA"],"LV",371,"00",,,,,,,,[[,"([2689]\\d)(\\d{3})(\\d{3})","$1 $2 $3",,"","",0]],,[,,"NA","NA"],,,[,,"NA","NA"],[,,"NA","NA"],,,[,,"NA","NA"]],LY:[,[,,"[25679]\\d{8}",
@ -436,30 +436,29 @@ SK:[,[,,"[2-689]\\d{8}","\\d{9}"],[,,"[2-5]\\d{8}","\\d{9}",,,"212345678"],[,,"9
See the License for the specific language governing permissions and
limitations under the License.
*/
function M(){this.Ba={}}M.ya=function(){return M.za?M.za:M.za=new M};
var N={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9"},$a={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",
7:"7",8:"8",9:"9","+":"+","*":"*"},ab={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9",A:"2",B:"2",
C:"2",D:"3",E:"3",F:"3",G:"4",H:"4",I:"4",J:"5",K:"5",L:"5",M:"6",N:"6",O:"6",P:"7",Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},bb=/[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?/,cb=RegExp("[+\uff0b]+"),O=RegExp("^[+\uff0b]+"),db=RegExp("([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])"),eb=RegExp("[+\uff0b0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]"),fb=/[\\\/] *x/,gb=RegExp("[^0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9A-Za-z#]+$"),hb=/(?:.*?[A-Za-z]){3}.*/,ib=RegExp("(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)$",
"i"),jb=RegExp("^[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{2}$|^[+\uff0b]*(?:[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*]*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]){3,}[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]*(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)?$",
"i"),kb=/(\$\d)/,lb=/\$NP/,mb=/\$FG/,nb=/\$CC/,ob=/^\(?\$1\)?$/;function pb(a){var b=a.search(eb);0<=b?(a=a.substring(b),a=a.replace(gb,""),b=a.search(fb),0<=b&&(a=a.substring(0,b))):a="";return a}function qb(a){return 2>a.length?!1:P(jb,a)}function rb(a){return P(hb,a)?Q(a,ab):Q(a,N)}function sb(a){var b=rb(a.toString());a.clear();a.append(b)}function Q(a,b){for(var c=new F,d,e=a.length,f=0;f<e;++f)d=a.charAt(f),d=b[d.toUpperCase()],null!=d&&c.append(d);return c.toString()}
function tb(a){return null!=a&&isNaN(a)&&a.toUpperCase()in Za}function R(a,b,c){if(0==z(b,2)&&y(b,5)){var d=C(b,5);if(0<d.length)return d}var d=b.g(),e=S(b);if(0==c)return T(d,0,e,"");if(!(d in K))return e;a=U(a,d,V(d));b=ub(b,a,c);e=vb(e,a,c);return T(d,c,e,b)}function xb(a,b,c){var d=b.g(),e=S(b);if(!(d in K))return e;a=U(a,d,V(d));b=ub(b,a,2);c=vb(e,a,2,c);return T(d,2,c,b)}function U(a,b,c){return"001"==c?W(a,""+b):W(a,c)}
function yb(a,b,c){if(!tb(c))return R(a,b,1);var d=b.g(),e=S(b);if(!(d in K))return e;if(1==d){if(null!=c&&0<=da(K[1],c.toUpperCase()))return d+" "+R(a,b,2)}else if(d==zb(a,c))return R(a,b,2);var f=W(a,c),g=C(f,11);c="";P(bb,g)?c=g:y(f,17)&&(c=C(f,17));a=U(a,d,V(d));e=vb(e,a,1);b=ub(b,a,1);return 0<c.length?c+" "+d+" "+e+b:T(d,1,e,b)}
function Ab(a,b,c){var d;if(d=y(b,5)){if(d=y(b,4))d=b.g(),d=U(a,d,V(d)),d=!(null!=d&&C(d,26));if(!d){d=b.g();d=U(a,d,V(d));if(null==d)d=!1;else{var e=S(b);d=null!=Bb(B(d,19),e)}d=!d}}if(d)return C(b,5);if(!y(b,6))return R(a,b,2);switch(z(b,6)){case 1:a=R(a,b,1);break;case 5:a=yb(a,b,c);break;case 10:a=R(a,b,1).substring(1);break;default:d=V(b.g());var f;c=W(a,d);null==c?f=null:(c=C(c,12),f=0==c.length?null:c=c.replace("~",""));c=R(a,b,2);if(null==f||0==f.length){a=c;break}var g;a:{e=C(b,5);e=Q(e,
N);if(0==e.lastIndexOf(f,0))try{g=Cb(a,a.parse(e.substring(f.length),d));break a}catch(h){}g=!1}if(g){a=c;break}g=W(a,d);d=S(b);g=Bb(B(g,19),d);if(null==g){a=c;break}d=C(g,4);e=d.indexOf("$1");if(0>=e){a=c;break}d=d.substring(0,e);d=Q(d,N);if(0==d.length){a=c;break}g=Ta(g);Ra(g,4);d=[g];g=b.g();c=S(b);g in K?(a=U(a,g,V(g)),e="",e=Bb(d,c),null==e?e=c:(d=Ta(e),e=C(e,4),0<e.length&&(f=C(a,12),0<f.length?(e=e.replace(lb,f).replace(mb,"$1"),A(d,4,e)):Ra(d,4)),e=Db(c,d,2)),a=ub(b,a,2),a=T(g,2,e,a)):a=c}b=
C(b,5);null!=a&&0<b.length&&(g=Q(a,$a),c=Q(b,$a),g!=c&&(a=b));return a}function S(a){var b=""+z(a,2);return y(a,4)&&z(a,4)?Array(C(a,8)+1).join("0")+b:b}function T(a,b,c,d){switch(b){case 0:return"+"+a+c+d;case 1:return"+"+a+" "+c+d;case 3:return"tel:+"+a+"-"+c+d;default:return c+d}}function vb(a,b,c,d){b=0==B(b,20).length||2==c?B(b,19):B(b,20);b=Bb(b,a);return null==b?a:Db(a,b,c,d)}
function Bb(a,b){for(var c,d=a.length,e=0;e<d;++e){c=a[e];var f=Qa(c,3);if(0==f||0==b.search(z(c,3,f-1)))if(f=RegExp(z(c,1)),P(f,b))return c}return null}
function Db(a,b,c,d){var e=C(b,2),f=RegExp(z(b,1)),g=C(b,5),h="";2==c&&null!=d&&0<d.length&&0<g.length?(b=g.replace(nb,d),e=e.replace(kb,b),h=a.replace(f,e)):(b=C(b,4),h=2==c&&null!=b&&0<b.length?a.replace(f,e.replace(kb,b)):a.replace(f,e));3==c&&(h=h.replace(RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+"),""),h=h.replace(RegExp("[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+",
"g"),"-"));return h}function ub(a,b,c){return y(a,3)&&0!=a.getExtension().length?3==c?";ext="+a.getExtension():y(b,13)?z(b,13)+C(a,3):" ext. "+C(a,3):""}function Eb(a,b){var c=z(b,1);return y(c,2)&&X(a,c)?X(a,z(b,5))?4:X(a,z(b,4))?3:X(a,z(b,6))?5:X(a,z(b,8))?6:X(a,z(b,7))?7:X(a,z(b,21))?8:X(a,z(b,25))?9:X(a,z(b,28))?10:X(a,z(b,2))?z(b,18)||X(a,z(b,3))?2:0:!z(b,18)&&X(a,z(b,3))?1:-1:-1}
function W(a,b){if(null==b)return null;b=b.toUpperCase();var c=a.Ba[b];if(null==c){c=Za[b];if(null==c)return null;c=(new J).$(H.c(),c);a.Ba[b]=c}return c}function X(a,b){return P(C(b,3),a)&&P(C(b,2),a)}function Cb(a,b){var c=Fb(a,b);return Gb(a,b,c)}function Gb(a,b,c){var d=b.g(),e=U(a,d,c);if(null==e||"001"!=c&&d!=zb(a,c))return!1;a=z(e,1);b=S(b);return y(a,2)?-1!=Eb(b,e):(e=b.length,2<e&&16>=e)}
function Fb(a,b){if(null==b)return null;var c=b.g(),c=K[c];if(null==c)c=null;else if(1==c.length)c=c[0];else a:{for(var d=S(b),e,f=c.length,g=0;g<f;g++){e=c[g];var h=W(a,e);if(y(h,23)){if(0==d.search(z(h,23))){c=e;break a}}else if(-1!=Eb(d,h)){c=e;break a}}c=null}return c}function V(a){a=K[a];return null==a?"ZZ":a[0]}function zb(a,b){var c=W(a,b);if(null==c)throw"Invalid region code: "+b;return c.g()}function Hb(a,b){return P(a,b)?0:0==b.search(a)?3:2}
function Ib(a,b){var c=S(b),d=b.g();if(!(d in K))return 1;d=U(a,d,V(d));d=z(d,1);if(!y(d,2))return c=c.length,2>c?2:16<c?3:0;d=C(d,3);return Hb(d,c)}function Jb(a,b){var c=a.toString();if(0==c.length||"0"==c.charAt(0))return 0;for(var d,e=c.length,f=1;3>=f&&f<=e;++f)if(d=parseInt(c.substring(0,f),10),d in K)return b.append(c.substring(f)),d;return 0}
function Kb(a,b,c,d,e){if(0==a.length)return 0;a=new F(a);var f;null!=b&&(f=z(b,11));null==f&&(f="NonMatch");var g=a.toString();if(0==g.length)f=20;else if(O.test(g))g=g.replace(O,""),a.clear(),a.append(rb(g)),f=1;else{g=RegExp(f);sb(a);f=a.toString();if(0==f.search(g)){var g=f.match(g)[0].length,h=f.substring(g).match(db);h&&null!=h[1]&&0<h[1].length&&"0"==Q(h[1],N)?f=!1:(a.clear(),a.append(f.substring(g)),f=!0)}else f=!1;f=f?5:20}d&&A(e,6,f);if(20!=f){if(2>=a.h.length)throw"Phone number too short after IDD";
c=Jb(a,c);if(0!=c)return e.da(c),c;throw"Invalid country calling code";}if(null!=b&&(f=b.g(),g=""+f,h=a.toString(),0==h.lastIndexOf(g,0))){var m=new F(h.substring(g.length)),h=z(b,1),g=RegExp(C(h,2));Lb(m,b,null);b=m.toString();h=C(h,3);if(!P(g,a.toString())&&P(g,b)||3==Hb(h,a.toString()))return c.append(b),d&&A(e,6,10),e.da(f),f}e.da(0);return 0}
function Lb(a,b,c){var d=a.toString(),e=d.length,f=z(b,15);if(0!=e&&null!=f&&0!=f.length&&(f=RegExp("^(?:"+f+")"),e=f.exec(d))){var g=RegExp,h;h=z(b,1);h=C(h,2);g=g(h);h=P(g,d);var m=e.length-1;b=z(b,16);if(null==b||0==b.length||null==e[m]||0==e[m].length){if(!h||P(g,d.substring(e[0].length)))null!=c&&0<m&&null!=e[m]&&c.append(e[1]),a.set(d.substring(e[0].length))}else if(d=d.replace(f,b),!h||P(g,d))null!=c&&0<m&&c.append(e[1]),a.set(d)}}M.prototype.parse=function(a,b){return Mb(this,a,b,!1)};
function Mb(a,b,c,d){if(null==b)throw"The string supplied did not seem to be a phone number";if(250<b.length)throw"The string supplied is too long to be a phone number";var e=new F,f=b.indexOf(";phone-context=");if(0<f){var g=f+15;if("+"==b.charAt(g)){var h=b.indexOf(";",g);0<h?e.append(b.substring(g,h)):e.append(b.substring(g))}e.append(b.substring(b.indexOf("tel:")+4,f))}else e.append(pb(b));f=e.toString();g=f.indexOf(";isub=");0<g&&(e.clear(),e.append(f.substring(0,g)));if(!qb(e.toString()))throw"The string supplied did not seem to be a phone number";
f=e.toString();if(!(tb(c)||null!=f&&0<f.length&&O.test(f)))throw"Invalid country calling code";f=new I;d&&A(f,5,b);a:{b=e.toString();g=b.search(ib);if(0<=g&&qb(b.substring(0,g)))for(var h=b.match(ib),m=h.length,t=1;t<m;++t)if(null!=h[t]&&0<h[t].length){e.clear();e.append(b.substring(0,g));b=h[t];break a}b=""}0<b.length&&A(f,3,b);g=W(a,c);b=new F;h=0;m=e.toString();try{h=Kb(m,g,b,d,f)}catch(u){if("Invalid country calling code"==u&&O.test(m)){if(m=m.replace(O,""),h=Kb(m,g,b,d,f),0==h)throw u;}else throw u;
}0!=h?(e=V(h),e!=c&&(g=U(a,h,e))):(sb(e),b.append(e.toString()),null!=c?(h=g.g(),f.da(h)):d&&Ra(f,6));if(2>b.h.length)throw"The string supplied is too short to be a phone number";null!=g&&(a=new F,c=new F(b.toString()),Lb(c,g,a),e=c.toString(),g=z(g,1),g=C(g,3),2!=Hb(g,e)&&(b=c,d&&A(f,7,a.toString())));d=b.toString();a=d.length;if(2>a)throw"The string supplied is too short to be a phone number";if(16<a)throw"The string supplied is too long to be a phone number";if(1<d.length&&"0"==d.charAt(0)){A(f,
4,!0);for(a=1;a<d.length-1&&"0"==d.charAt(a);)a++;1!=a&&A(f,8,a)}A(f,2,parseInt(d,10));return f}function P(a,b){var c="string"==typeof a?b.match("^(?:"+a+")$"):b.match(a);return c&&c[0].length==b.length?!0:!1};/*
function M(){this.Aa={}}M.xa=function(){return M.ya?M.ya:M.ya=new M};
var N={"0":"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9"},bb={"0":"0",1:"1",2:"2",3:"3",4:"4",5:"5",
6:"6",7:"7",8:"8",9:"9","+":"+","*":"*"},cb={"0":"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9",A:"2",
B:"2",C:"2",D:"3",E:"3",F:"3",G:"4",H:"4",I:"4",J:"5",K:"5",L:"5",M:"6",N:"6",O:"6",P:"7",Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},db=/[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?/,eb=RegExp("[+\uff0b]+"),O=RegExp("^[+\uff0b]+"),fb=RegExp("([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])"),gb=RegExp("[+\uff0b0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]"),hb=/[\\\/] *x/,ib=RegExp("[^0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9A-Za-z#]+$"),jb=/(?:.*?[A-Za-z]){3}.*/,kb=RegExp("(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)$",
"i"),lb=RegExp("^[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{2}$|^[+\uff0b]*(?:[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*]*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]){3,}[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]*(?:;ext=([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|[,x\uff58#\uff03~\uff5e]|int|anexo|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,7})#?|[- ]+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,5})#)?$",
"i"),mb=/(\$\d)/,nb=/\$NP/,ob=/\$FG/,pb=/\$CC/,qb=/^\(?\$1\)?$/,rb={Qa:0,Ca:1,Ea:2,Da:3};function sb(a){var b=a.search(gb);0<=b?(a=a.substring(b),a=a.replace(ib,""),b=a.search(hb),0<=b&&(a=a.substring(0,b))):a="";return a}function tb(a){var b=P(jb,a.toString())?Q(a.toString(),cb):Q(a.toString(),N);a.clear();a.append(b)}function Q(a,b){for(var c=new G,d,e=a.length,f=0;f<e;++f)d=a.charAt(f),d=b[d.toUpperCase()],d!=l&&c.append(d);return c.toString()}
function ub(a){return a!=l&&isNaN(a)&&a.toUpperCase()in ab}function R(a,b,c){if(0==A(b,2)&&y(b,5)){var d=D(b,5);if(0<d.length)return d}var d=b.g(),e=S(b);if(0==c)return T(d,0,e,"");if(!(d in L))return e;a=U(a,d,V(d));b=vb(b,a,c);e=wb(e,a,c);return T(d,c,e,b)}function xb(a,b,c){var d=b.g(),e=S(b);if(!(d in L))return e;a=U(a,d,V(d));b=vb(b,a,2);c=wb(e,a,2,c);return T(d,2,c,b)}function U(a,b,c){return"001"==c?W(a,""+b):W(a,c)}
function yb(a,b,c){if(!ub(c))return R(a,b,1);var d=b.g(),e=S(b);if(!(d in L))return e;if(1==d){if(c!=l&&0<=ca(L[1],c.toUpperCase()))return d+" "+R(a,b,2)}else if(d==zb(a,c))return R(a,b,2);var f=W(a,c),g=D(f,11);c="";P(db,g)?c=g:y(f,17)&&(c=D(f,17));a=U(a,d,V(d));e=wb(e,a,1);b=vb(b,a,1);return 0<c.length?c+" "+d+" "+e+b:T(d,1,e,b)}
function Bb(a,b,c){var d;if(d=y(b,5)){if(d=y(b,4))d=b.g(),d=U(a,d,V(d)),d=!(d!=l&&D(d,26));if(!d){d=b.g();d=U(a,d,V(d));if(d==l)d=m;else{var e=S(b);d=Cb(C(d,19),e)!=l}d=!d}}if(d)return D(b,5);if(!y(b,6))return R(a,b,2);switch(A(b,6)){case 1:a=R(a,b,1);break;case 5:a=yb(a,b,c);break;case 10:a=R(a,b,1).substring(1);break;default:d=V(b.g());var f;c=W(a,d);c==l?f=l:(c=D(c,12),f=0==c.length?l:c=c.replace("~",""));c=R(a,b,2);if(f==l||0==f.length){a=c;break}var g;a:{e=D(b,5);e=Q(e,N);if(0==e.lastIndexOf(f,
0))try{g=Db(a,a.parse(e.substring(f.length),d));break a}catch(h){}g=m}if(g){a=c;break}g=W(a,d);d=S(b);g=Cb(C(g,19),d);if(g==l){a=c;break}d=D(g,4);e=d.indexOf("$1");if(0>=e){a=c;break}d=d.substring(0,e);d=Q(d,N);if(0==d.length){a=c;break}g=Va(g);Ta(g,4);d=[g];g=b.g();c=S(b);g in L?(a=U(a,g,V(g)),e="",e=Cb(d,c),e==l?e=c:(d=Va(e),e=D(e,4),0<e.length&&(f=D(a,12),0<f.length?(e=e.replace(nb,f).replace(ob,"$1"),B(d,4,e)):Ta(d,4)),e=Eb(c,d,2)),a=vb(b,a,2),a=T(g,2,e,a)):a=c}b=D(b,5);a!=l&&0<b.length&&(g=Q(a,
bb),c=Q(b,bb),g!=c&&(a=b));return a}function S(a){var b=""+A(a,2);return y(a,4)&&A(a,4)?Array(D(a,8)+1).join("0")+b:b}function T(a,b,c,d){switch(b){case 0:return"+"+a+c+d;case 1:return"+"+a+" "+c+d;case 3:return"tel:+"+a+"-"+c+d;default:return c+d}}function wb(a,b,c,d){b=0==C(b,20).length||2==c?C(b,19):C(b,20);b=Cb(b,a);return b==l?a:Eb(a,b,c,d)}function Cb(a,b){for(var c,d=a.length,e=0;e<d;++e){c=a[e];var f=Sa(c,3);if(0==f||0==b.search(A(c,3,f-1)))if(f=RegExp(A(c,1)),P(f,b))return c}return l}
function Eb(a,b,c,d){var e=D(b,2),f=RegExp(A(b,1)),g=D(b,5),h="";2==c&&d!=l&&0<d.length&&0<g.length?(b=g.replace(pb,d),e=e.replace(mb,b),h=a.replace(f,e)):(b=D(b,4),h=2==c&&b!=l&&0<b.length?a.replace(f,e.replace(mb,b)):a.replace(f,e));3==c&&(h=h.replace(RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+"),""),h=h.replace(RegExp("[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+",
"g"),"-"));return h}function vb(a,b,c){return!y(a,3)||0==a.getExtension().length?"":3==c?";ext="+a.getExtension():y(b,13)?A(b,13)+D(a,3):" ext. "+D(a,3)}function Fb(a,b){var c=A(b,1);return!y(c,2)||!X(a,c)?-1:X(a,A(b,5))?4:X(a,A(b,4))?3:X(a,A(b,6))?5:X(a,A(b,8))?6:X(a,A(b,7))?7:X(a,A(b,21))?8:X(a,A(b,25))?9:X(a,A(b,28))?10:X(a,A(b,2))?A(b,18)||X(a,A(b,3))?2:0:!A(b,18)&&X(a,A(b,3))?1:-1}
function W(a,b){if(b==l)return l;b=b.toUpperCase();var c=a.Aa[b];if(c==l){c=ab[b];if(c==l)return l;c=(new K).z(I.c(),c);a.Aa[b]=c}return c}function X(a,b){return P(D(b,3),a)&&P(D(b,2),a)}function Db(a,b){var c=Gb(a,b);return Hb(a,b,c)}function Hb(a,b,c){var d=b.g(),e=U(a,d,c);if(e==l||"001"!=c&&d!=zb(a,c))return m;a=A(e,1);b=S(b);return!y(a,2)?(e=b.length,2<e&&17>=e):-1!=Fb(b,e)}
function Gb(a,b){if(b==l)return l;var c=b.g(),c=L[c];if(c==l)c=l;else if(1==c.length)c=c[0];else a:{for(var d=S(b),e,f=c.length,g=0;g<f;g++){e=c[g];var h=W(a,e);if(y(h,23)){if(0==d.search(A(h,23))){c=e;break a}}else if(-1!=Fb(d,h)){c=e;break a}}c=l}return c}function V(a){a=L[a];return a==l?"ZZ":a[0]}function zb(a,b){var c=W(a,b);c==l&&i("Invalid region code: "+b);return c.g()}function Ib(a,b){return P(a,b)?0:0==b.search(a)?3:2}
function Jb(a,b){var c=S(b),d=b.g();if(!(d in L))return 1;d=U(a,d,V(d));d=A(d,1);if(!y(d,2))return c=c.length,2>c?2:17<c?3:0;d=D(d,3);return Ib(d,c)}function Kb(a,b){var c=a.toString();if(0==c.length||"0"==c.charAt(0))return 0;for(var d,e=c.length,f=1;3>=f&&f<=e;++f)if(d=parseInt(c.substring(0,f),10),d in L)return b.append(c.substring(f)),d;return 0}
function Lb(a,b,c,d,e){if(0==a.length)return 0;a=new G(a);var f;b!=l&&(f=A(b,11));f==l&&(f="NonMatch");var g=a.toString();if(0==g.length)f=20;else if(O.test(g))g=g.replace(O,""),a.clear(),a.append(P(jb,g)?Q(g,cb):Q(g,N)),f=1;else{g=RegExp(f);tb(a);f=a.toString();if(0==f.search(g)){var g=f.match(g)[0].length,h=f.substring(g).match(fb);h&&(h[1]!=l&&0<h[1].length)&&"0"==Q(h[1],N)?f=m:(a.clear(),a.append(f.substring(g)),f=k)}else f=m;f=f?5:20}d&&B(e,6,f);if(20!=f){2>=a.h.length&&i("Phone number too short after IDD");
f=Kb(a,c);if(0!=f)return e.da(f),f;i("Invalid country calling code")}if(b!=l&&(f=b.g(),g=""+f,h=a.toString(),0==h.lastIndexOf(g,0))){var n=new G(h.substring(g.length)),h=A(b,1),g=RegExp(D(h,2));Mb(n,b,l);b=n.toString();h=D(h,3);if(!P(g,a.toString())&&P(g,b)||3==Ib(h,a.toString()))return c.append(b),d&&B(e,6,10),e.da(f),f}e.da(0);return 0}
function Mb(a,b,c){var d=a.toString(),e=d.length,f=A(b,15);if(!(0==e||f==l||0==f.length))if(f=RegExp("^(?:"+f+")"),e=f.exec(d)){var g=RegExp,h;h=A(b,1);h=D(h,2);g=g(h);h=P(g,d);var n=e.length-1;b=A(b,16);if(b==l||0==b.length||e[n]==l||0==e[n].length){if(!h||P(g,d.substring(e[0].length)))c!=l&&(0<n&&e[n]!=l)&&c.append(e[1]),a.set(d.substring(e[0].length))}else if(d=d.replace(f,b),!h||P(g,d))c!=l&&0<n&&c.append(e[1]),a.set(d)}}M.prototype.parse=function(a,b){return Nb(this,a,b,m)};
function Nb(a,b,c,d){b==l&&i("The string supplied did not seem to be a phone number");250<b.length&&i("The string supplied is too long to be a phone number");var e=new G,f=b.indexOf(";phone-context=");if(0<f){var g=f+15;if("+"==b.charAt(g)){var h=b.indexOf(";",g);0<h?e.append(b.substring(g,h)):e.append(b.substring(g))}e.append(b.substring(b.indexOf("tel:")+4,f))}else e.append(sb(b));f=e.toString();g=f.indexOf(";isub=");0<g&&(e.clear(),e.append(f.substring(0,g)));(2>e.toString().length?0:P(lb,e.toString()))||
i("The string supplied did not seem to be a phone number");ub(c)||e.toString()!=l&&0<e.toString().length&&O.test(e.toString())||i("Invalid country calling code");f=new J;d&&B(f,5,b);a:{b=e.toString();g=b.search(kb);if(0<=g&&(2>b.substring(0,g).length?0:P(lb,b.substring(0,g))))for(var h=b.match(kb),n=h.length,x=1;x<n;++x)if(h[x]!=l&&0<h[x].length){e.clear();e.append(b.substring(0,g));b=h[x];break a}b=""}0<b.length&&B(f,3,b);g=W(a,c);b=new G;h=0;n=e.toString();try{h=Lb(n,g,b,d,f)}catch(r){"Invalid country calling code"==
r&&O.test(n)?(n=n.replace(O,""),h=Lb(n,g,b,d,f),0==h&&i(r)):i(r)}0!=h?(e=V(h),e!=c&&(g=U(a,h,e))):(tb(e),b.append(e.toString()),c!=l?(h=g.g(),f.da(h)):d&&Ta(f,6));2>b.h.length&&i("The string supplied is too short to be a phone number");g!=l&&(a=new G,c=new G(b.toString()),Mb(c,g,a),e=c.toString(),g=A(g,1),g=D(g,3),2!=Ib(g,e)&&(b=c,d&&B(f,7,a.toString())));d=b.toString();a=d.length;2>a&&i("The string supplied is too short to be a phone number");17<a&&i("The string supplied is too long to be a phone number");
if(1<d.length&&"0"==d.charAt(0)){B(f,4,k);for(a=1;a<d.length-1&&"0"==d.charAt(a);)a++;1!=a&&B(f,8,a)}B(f,2,parseInt(d,10));return f}function P(a,b){var c="string"==typeof a?b.match("^(?:"+a+")$"):b.match(a);return c&&c[0].length==b.length?k:m};/*
Copyright (C) 2010 The Libphonenumber Authors.
@ -475,18 +474,18 @@ f=e.toString();if(!(tb(c)||null!=f&&0<f.length&&O.test(f)))throw"Invalid country
See the License for the specific language governing permissions and
limitations under the License.
*/
function Nb(a){this.sa="\u2008";this.ja=RegExp(this.sa);this.ka="";this.r=new F;this.ea="";this.m=new F;this.w=new F;this.o=!0;this.aa=this.u=this.na=!1;this.ra=M.ya();this.ba=0;this.d=new F;this.ia=!1;this.v="";this.b=new F;this.i=[];this.la=a;this.Da=this.k=Ob(this,this.la)}var Pb=new H;A(Pb,11,"NA");
var Qb=/\[([^\[\]])*\]/g,Rb=/\d(?=[^,}][^,}])/g,Sb=RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*(\\$\\d[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*)+$"),Tb=/[- ]/;function Ob(a,b){var c=tb(b)?zb(a.ra,b):0,c=W(a.ra,V(c));return null!=c?c:Pb}
function Ub(a){for(var b=a.i.length,c=0;c<b;++c){var d=a.i[c],e=C(d,1);if(a.ea==e)return!1;var f;f=a;var g=d,h=C(g,1);if(-1!=h.indexOf("|"))f=!1;else{h=h.replace(Qb,"\\d");h=h.replace(Rb,"\\d");f.r.clear();var m;m=f;var g=C(g,2),t="999999999999999".match(h)[0];t.length<m.b.h.length?m="":(h=t.replace(RegExp(h,"g"),g),m=h=h.replace(RegExp("9","g"),m.sa));0<m.length?(f.r.append(m),f=!0):f=!1}if(f)return a.ea=e,a.ia=Tb.test(z(d,4)),a.ba=0,!0}return a.o=!1}
function Vb(a,b){for(var c=[],d=b.length-3,e=a.i.length,f=0;f<e;++f){var g=a.i[f];Qa(g,3)>d?(g=C(g,3,d),0==b.search(g)&&c.push(a.i[f])):c.push(a.i[f])}a.i=c}Nb.prototype.clear=function(){this.ka="";this.m.clear();this.w.clear();this.r.clear();this.ba=0;this.ea="";this.d.clear();this.v="";this.b.clear();this.o=!0;this.aa=this.u=this.na=!1;this.i=[];this.ia=!1;this.k!=this.Da&&(this.k=Ob(this,this.la))};function Wb(a,b){a.ka=Xb(a,b);return a.ka}
function Xb(a,b){a.m.append(b);var c=b;if(db.test(c)||1==a.m.h.length&&cb.test(c)){var c=b,d;"+"==c?(d=c,a.w.append(c)):(d=N[c],a.w.append(d),a.b.append(d));b=d}else a.o=!1,a.na=!0;if(!a.o){if(!a.na)if(Yb(a)){if(Zb(a))return $b(a)}else if(0<a.v.length&&(c=a.b.toString(),a.b.clear(),a.b.append(a.v),a.b.append(c),c=a.d.toString(),d=c.lastIndexOf(a.v),a.d.clear(),a.d.append(c.substring(0,d))),a.v!=ac(a))return a.d.append(" "),$b(a);return a.m.toString()}switch(a.w.h.length){case 0:case 1:case 2:return a.m.toString();
case 3:if(Yb(a))a.aa=!0;else return a.v=ac(a),bc(a);default:if(a.aa)return Zb(a)&&(a.aa=!1),a.d.toString()+a.b.toString();if(0<a.i.length){c=cc(a,b);d=dc(a);if(0<d.length)return d;Vb(a,a.b.toString());return Ub(a)?ec(a):a.o?fc(a,c):a.m.toString()}return bc(a)}}function $b(a){a.o=!0;a.aa=!1;a.i=[];return bc(a)}
function dc(a){for(var b=a.b.toString(),c=a.i.length,d=0;d<c;++d){var e=a.i[d],f=C(e,1);if(RegExp("^(?:"+f+")$").test(b))return a.ia=Tb.test(z(e,4)),b=b.replace(RegExp(f,"g"),z(e,2)),fc(a,b)}return""}function fc(a,b){var c=a.d.h.length;return a.ia&&0<c&&" "!=a.d.toString().charAt(c-1)?a.d+" "+b:a.d+b}
function bc(a){var b=a.b.toString();if(3<=b.length){for(var b=b.substring(0,3),c=a.u&&0<Qa(a.k,20)?B(a.k,20):B(a.k,19),d=c.length,e=0;e<d;++e){var f=c[e],g;(g=!y(a.k,12))||(g=a.u)||(g=z(f,6))||(g=C(f,4),g=0==g.length||ob.test(g));g&&(g=C(f,2),Sb.test(g)&&a.i.push(f))}Vb(a,b);b=dc(a);return 0<b.length?b:Ub(a)?ec(a):a.m.toString()}return fc(a,b)}
function ec(a){var b=a.b.toString(),c=b.length;if(0<c){for(var d="",e=0;e<c;e++)d=cc(a,b.charAt(e));return a.o?fc(a,d):a.m.toString()}return a.d.toString()}
function ac(a){var b=a.b.toString(),c=0,d;1!=a.k.xa()?d=!1:(d=a.b.toString(),d="1"==d.charAt(0)&&"0"!=d.charAt(1)&&"1"!=d.charAt(1));d?(c=1,a.d.append("1").append(" "),a.u=!0):y(a.k,15)&&(d=RegExp("^(?:"+z(a.k,15)+")"),d=b.match(d),null!=d&&null!=d[0]&&0<d[0].length&&(a.u=!0,c=d[0].length,a.d.append(b.substring(0,c))));a.b.clear();a.b.append(b.substring(c));return b.substring(0,c)}
function Yb(a){var b=a.w.toString(),c=RegExp("^(?:\\+|"+z(a.k,11)+")"),c=b.match(c);return null!=c&&null!=c[0]&&0<c[0].length?(a.u=!0,c=c[0].length,a.b.clear(),a.b.append(b.substring(c)),a.d.clear(),a.d.append(b.substring(0,c)),"+"!=b.charAt(0)&&a.d.append(" "),!0):!1}function Zb(a){if(0==a.b.h.length)return!1;var b=new F,c=Jb(a.b,b);if(0==c)return!1;a.b.clear();a.b.append(b.toString());b=V(c);"001"==b?a.k=W(a.ra,""+c):b!=a.la&&(a.k=Ob(a,b));a.d.append(""+c).append(" ");return!0}
function cc(a,b){var c=a.r.toString();if(0<=c.substring(a.ba).search(a.ja)){var d=c.search(a.ja),c=c.replace(a.ja,b);a.r.clear();a.r.append(c);a.ba=d;return c.substring(0,a.ba+1)}1==a.i.length&&(a.o=!1);a.ea="";return a.m.toString()};/*
function Ob(a){this.ra="\u2008";this.ia=RegExp(this.ra);this.ja="";this.s=new G;this.ea="";this.m=new G;this.w=new G;this.o=k;this.aa=this.v=this.ma=m;this.qa=M.xa();this.Ka=this.Ia=this.ba=0;this.d=new G;this.ha=m;this.q="";this.b=new G;this.i=[];this.ka=a;this.Fa=this.k=Pb(this,this.ka)}var Qb=new I;B(Qb,11,"NA");
var Rb=/\[([^\[\]])*\]/g,Sb=/\d(?=[^,}][^,}])/g,Tb=RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*(\\$\\d[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]*)+$"),Ub=/[- ]/;function Pb(a,b){var c=!ub(b)?0:zb(a.qa,b),c=W(a.qa,V(c));return c!=l?c:Qb}
function Vb(a){for(var b=a.i.length,c=0;c<b;++c){var d=a.i[c],e=D(d,1);if(a.ea==e)return m;var f;f=a;var g=d,h=D(g,1);if(-1!=h.indexOf("|"))f=m;else{h=h.replace(Rb,"\\d");h=h.replace(Sb,"\\d");f.s.clear();var n;n=f;var g=D(g,2),x="999999999999999".match(h)[0];x.length<n.b.h.length?n="":(h=x.replace(RegExp(h,"g"),g),n=h=h.replace(RegExp("9","g"),n.ra));0<n.length?(f.s.append(n),f=k):f=m}if(f)return a.ea=e,a.ha=Ub.test(A(d,4)),a.ba=0,k}return a.o=m}
function Wb(a,b){for(var c=[],d=b.length-3,e=a.i.length,f=0;f<e;++f){var g=a.i[f];Sa(g,3)>d?(g=D(g,3,d),0==b.search(g)&&c.push(a.i[f])):c.push(a.i[f])}a.i=c}Ob.prototype.clear=function(){this.ja="";this.m.clear();this.w.clear();this.s.clear();this.ba=0;this.ea="";this.d.clear();this.q="";this.b.clear();this.o=k;this.ma=m;this.Ia=this.Ka=0;this.aa=this.v=m;this.i=[];this.ha=m;this.k!=this.Fa&&(this.k=Pb(this,this.ka))};function Xb(a,b){a.ja=Yb(a,b);return a.ja}
function Yb(a,b){a.m.append(b);if(fb.test(b)||1==a.m.h.length&&eb.test(b)){var c=b,d;"+"==c?(d=c,a.w.append(c)):(d=N[c],a.w.append(d),a.b.append(d));b=d}else a.o=m,a.ma=k;if(!a.o){if(!a.ma)if(Zb(a)){if($b(a))return ac(a)}else if(0<a.q.length&&(c=a.b.toString(),a.b.clear(),a.b.append(a.q),a.b.append(c),c=a.d.toString(),d=c.lastIndexOf(a.q),a.d.clear(),a.d.append(c.substring(0,d))),a.q!=bc(a))return a.d.append(" "),ac(a);return a.m.toString()}switch(a.w.h.length){case 0:case 1:case 2:return a.m.toString();
case 3:if(Zb(a))a.aa=k;else return a.q=bc(a),cc(a);default:if(a.aa)return $b(a)&&(a.aa=m),a.d.toString()+a.b.toString();if(0<a.i.length){c=dc(a,b);d=ec(a);if(0<d.length)return d;Wb(a,a.b.toString());return Vb(a)?fc(a):a.o?gc(a,c):a.m.toString()}return cc(a)}}function ac(a){a.o=k;a.aa=m;a.i=[];return cc(a)}
function ec(a){for(var b=a.b.toString(),c=a.i.length,d=0;d<c;++d){var e=a.i[d],f=D(e,1);if(RegExp("^(?:"+f+")$").test(b))return a.ha=Ub.test(A(e,4)),b=b.replace(RegExp(f,"g"),A(e,2)),gc(a,b)}return""}function gc(a,b){var c=a.d.h.length;return a.ha&&0<c&&" "!=a.d.toString().charAt(c-1)?a.d+" "+b:a.d+b}
function cc(a){var b=a.b.toString();if(3<=b.length){for(var b=b.substring(0,3),c=a.v&&0<Sa(a.k,20)?C(a.k,20):C(a.k,19),d=c.length,e=0;e<d;++e){var f=c[e],g;if(!(g=!y(a.k,12)))if(!(g=a.v))if(!(g=A(f,6)))g=D(f,4),g=0==g.length||qb.test(g);g&&(g=D(f,2),Tb.test(g)&&a.i.push(f))}Wb(a,b);b=ec(a);return 0<b.length?b:Vb(a)?fc(a):a.m.toString()}return gc(a,b)}
function fc(a){var b=a.b.toString(),c=b.length;if(0<c){for(var d="",e=0;e<c;e++)d=dc(a,b.charAt(e));return a.o?gc(a,d):a.m.toString()}return a.d.toString()}
function bc(a){var b=a.b.toString(),c=0,d;1!=a.k.wa()?d=m:(d=a.b.toString(),d="1"==d.charAt(0)&&"0"!=d.charAt(1)&&"1"!=d.charAt(1));d?(c=1,a.d.append("1").append(" "),a.v=k):y(a.k,15)&&(d=RegExp("^(?:"+A(a.k,15)+")"),d=b.match(d),d!=l&&(d[0]!=l&&0<d[0].length)&&(a.v=k,c=d[0].length,a.d.append(b.substring(0,c))));a.b.clear();a.b.append(b.substring(c));return b.substring(0,c)}
function Zb(a){var b=a.w.toString(),c=RegExp("^(?:\\+|"+A(a.k,11)+")"),c=b.match(c);return c!=l&&c[0]!=l&&0<c[0].length?(a.v=k,c=c[0].length,a.b.clear(),a.b.append(b.substring(c)),a.d.clear(),a.d.append(b.substring(0,c)),"+"!=b.charAt(0)&&a.d.append(" "),k):m}function $b(a){if(0==a.b.h.length)return m;var b=new G,c=Kb(a.b,b);if(0==c)return m;a.b.clear();a.b.append(b.toString());b=V(c);"001"==b?a.k=W(a.qa,""+c):b!=a.ka&&(a.k=Pb(a,b));a.d.append(""+c).append(" ");a.q="";return k}
function dc(a,b){var c=a.s.toString();if(0<=c.substring(a.ba).search(a.ia)){var d=c.search(a.ia),c=c.replace(a.ia,b);a.s.clear();a.s.append(c);a.ba=d;return c.substring(0,a.ba+1)}1==a.i.length&&(a.o=m);a.ea="";return a.m.toString()};/*
Copyright (C) 2010 The Libphonenumber Authors.
@ -502,8 +501,8 @@ function cc(a,b){var c=a.r.toString();if(0<=c.substring(a.ba).search(a.ja)){var
See the License for the specific language governing permissions and
limitations under the License.
*/
function gc(){var a=xa("phoneNumber").value,b=xa("defaultCountry").value,c=xa("carrierCode").value,d=new F;try{var e=M.ya(),f;if(!tb(b)&&0<a.length&&"+"!=a.charAt(0))throw"Invalid country calling code";f=Mb(e,a,b,!0);d.append("****Parsing Result:****\n");d.append(ya((new Va(1)).ca(f)));d.append("\n\n****Validation Results:****");var g=0==Ib(e,f);d.append("\nResult from isPossibleNumber(): ");d.append(g);if(g){var h=Cb(e,f);d.append("\nResult from isValidNumber(): ");d.append(h);h&&b&&"ZZ"!=b&&(d.append("\nResult from isValidNumberForRegion(): "),
d.append(Gb(e,f,b)));d.append("\nPhone Number region: ");d.append(Fb(e,f));d.append("\nResult from getNumberType(): ");var m;var t=Fb(e,f),u=U(e,f.g(),t);if(null==u)m=-1;else{var L=S(f);m=Eb(L,u)}switch(m){case 0:d.append("FIXED_LINE");break;case 1:d.append("MOBILE");break;case 2:d.append("FIXED_LINE_OR_MOBILE");break;case 3:d.append("TOLL_FREE");break;case 4:d.append("PREMIUM_RATE");break;case 5:d.append("SHARED_COST");break;case 6:d.append("VOIP");break;case 7:d.append("PERSONAL_NUMBER");break;
case 8:d.append("PAGER");break;case 9:d.append("UAN");break;case -1:d.append("UNKNOWN")}}else{d.append("\nResult from isPossibleNumberWithReason(): ");switch(Ib(e,f)){case 1:d.append("INVALID_COUNTRY_CODE");break;case 2:d.append("TOO_SHORT");break;case 3:d.append("TOO_LONG")}d.append("\nNote: numbers that are not possible have type UNKNOWN, an unknown region, and are considered invalid.")}d.append("\n\n****Formatting Results:**** ");d.append("\nE164 format: ");d.append(h?R(e,f,0):"invalid");d.append("\nOriginal format: ");
d.append(Ab(e,f,b));d.append("\nNational format: ");d.append(R(e,f,2));d.append("\nInternational format: ");d.append(h?R(e,f,1):"invalid");d.append("\nOut-of-country format from US: ");d.append(h?yb(e,f,"US"):"invalid");d.append("\nOut-of-country format from Switzerland: ");d.append(h?yb(e,f,"CH"):"invalid");0<c.length&&(d.append("\nNational format with carrier code: "),d.append(xb(e,f,c)));d.append("\n\n****AsYouTypeFormatter Results****");for(var hc=new Nb(b),ic=a.length,b=0;b<ic;++b){var wb=a.charAt(b);
d.append("\nChar entered: ");d.append(wb);d.append(" Output: ");d.append(Wb(hc,wb))}}catch(jc){d.append("\n"+jc)}xa("output").value=d.toString();return!1}var Y=["phoneNumberParser"],Z=k;Y[0]in Z||!Z.execScript||Z.execScript("var "+Y[0]);for(var $;Y.length&&($=Y.shift());)Y.length||void 0===gc?Z=Z[$]?Z[$]:Z[$]={}:Z[$]=gc;})();
function hc(){var a=za("phoneNumber").value,b=za("defaultCountry").value,c=za("carrierCode").value,d=new G;try{var e=M.xa(),f;!ub(b)&&(0<a.length&&"+"!=a.charAt(0))&&i("Invalid country calling code");f=Nb(e,a,b,k);d.append("****Parsing Result:****\n");d.append(Aa((new Xa(1)).ca(f)));d.append("\n\n****Validation Results:****");var g=0==Jb(e,f);d.append("\nResult from isPossibleNumber(): ");d.append(g);if(g){var h=Db(e,f);d.append("\nResult from isValidNumber(): ");d.append(h);h&&(b&&"ZZ"!=b)&&(d.append("\nResult from isValidNumberForRegion(): "),
d.append(Hb(e,f,b)));d.append("\nPhone Number region: ");d.append(Gb(e,f));d.append("\nResult from getNumberType(): ");var n;var x=Gb(e,f),r=U(e,f.g(),x);if(r==l)n=-1;else{var z=S(f);n=Fb(z,r)}switch(n){case 0:d.append("FIXED_LINE");break;case 1:d.append("MOBILE");break;case 2:d.append("FIXED_LINE_OR_MOBILE");break;case 3:d.append("TOLL_FREE");break;case 4:d.append("PREMIUM_RATE");break;case 5:d.append("SHARED_COST");break;case 6:d.append("VOIP");break;case 7:d.append("PERSONAL_NUMBER");break;case 8:d.append("PAGER");
break;case 9:d.append("UAN");break;case -1:d.append("UNKNOWN")}}else{d.append("\nResult from isPossibleNumberWithReason(): ");switch(Jb(e,f)){case rb.Ca:d.append("INVALID_COUNTRY_CODE");break;case rb.Ea:d.append("TOO_SHORT");break;case rb.Da:d.append("TOO_LONG")}d.append("\nNote: numbers that are not possible have type UNKNOWN, an unknown region, and are considered invalid.")}d.append("\n\n****Formatting Results:**** ");d.append("\nE164 format: ");d.append(h?R(e,f,0):"invalid");d.append("\nOriginal format: ");
d.append(Bb(e,f,b));d.append("\nNational format: ");d.append(R(e,f,2));d.append("\nInternational format: ");d.append(h?R(e,f,1):"invalid");d.append("\nOut-of-country format from US: ");d.append(h?yb(e,f,"US"):"invalid");d.append("\nOut-of-country format from Switzerland: ");d.append(h?yb(e,f,"CH"):"invalid");0<c.length&&(d.append("\nNational format with carrier code: "),d.append(xb(e,f,c)));d.append("\n\n****AsYouTypeFormatter Results****");for(var ic=new Ob(b),jc=a.length,b=0;b<jc;++b){var Ab=a.charAt(b);
d.append("\nChar entered: ");d.append(Ab);d.append(" Output: ");d.append(Xb(ic,Ab))}}catch(kc){d.append("\n"+kc)}za("output").value=d.toString();return m}var Y=["phoneNumberParser"],Z=p;!(Y[0]in Z)&&Z.execScript&&Z.execScript("var "+Y[0]);for(var $;Y.length&&($=Y.shift());)!Y.length&&hc!==j?Z[$]=hc:Z=Z[$]?Z[$]:Z[$]={};})();

+ 4
- 4
javascript/i18n/phonenumbers/metadata.js View File

@ -461,7 +461,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"AS":[,[,,"[5689]\\d{9}","\\d{7}(?:\\d{3})?"]
,[,,"6846(?:22|33|44|55|77|88|9[19])\\d{4}","\\d{7}(?:\\d{3})?",,,"6846221234"]
,[,,"684(?:733|25[2468])\\d{4}","\\d{10}",,,"6847331234"]
,[,,"684(?:25[2468]|7(?:3[13]|70))\\d{4}","\\d{10}",,,"6847331234"]
,[,,"8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}",,,"8002123456"]
,[,,"900[2-9]\\d{6}","\\d{10}",,,"9002123456"]
,[,,"NA","NA"]
@ -815,7 +815,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"BR":[,[,,"[1-46-9]\\d{7,10}|5\\d{8,9}","\\d{8,11}"]
,[,,"1[1-9][2-5]\\d{7}|(?:[4689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}","\\d{8,11}",,,"1123456789"]
,[,,"1[1-9]9\\d{8}|2[12478]9?[6-9]\\d{7}|(?:3[1-578]|[4689][1-9]|5[13-5]|7[13-579])[6-9]\\d{7}","\\d{10,11}",,,"11961234567"]
,[,,"1[1-9](?:7|9\\d)\\d{7}|2[12478]9?[6-9]\\d{7}|(?:3[1-578]|[4689][1-9]|5[13-5]|7[13-579])[6-9]\\d{7}","\\d{10,11}",,,"11961234567"]
,[,,"800\\d{6,7}","\\d{8,11}",,,"800123456"]
,[,,"[359]00\\d{6,7}","\\d{8,11}",,,"300123456"]
,[,,"[34]00\\d{5}","\\d{8}",,,"40041234"]
@ -2626,7 +2626,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"KW":[,[,,"[12569]\\d{6,7}","\\d{7,8}"]
,[,,"(?:18\\d|2(?:[23]\\d{2}|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7])))\\d{4}","\\d{7,8}",,,"22345678"]
,[,,"(?:5(?:1[0-5]|[05]\\d)|6(?:0[034679]|5[015-9]|6\\d|7[067]|9[0369])|9(?:0[09]|4[049]|6[069]|[79]\\d|8[08]))\\d{5}","\\d{8}",,,"50012345"]
,[,,"(?:5(?:[05]\\d|1[0-6])|6(?:0[034679]|5[015-9]|6\\d|7[067]|9[0369])|9(?:0[09]|4[049]|6[069]|[79]\\d|8[08]))\\d{5}","\\d{8}",,,"50012345"]
,[,,"NA","NA"]
,[,,"NA","NA"]
,[,,"NA","NA"]
@ -2822,7 +2822,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"LU":[,[,,"[24-9]\\d{3,10}|3(?:[0-46-9]\\d{2,9}|5[013-9]\\d{1,8})","\\d{4,11}"]
,[,,"(?:2(?:2\\d{1,2}|3[2-9]|[67]\\d|4[1-8]\\d?|5[1-5]\\d?|9[0-24-9]\\d?)|3(?:[059][05-9]|[13]\\d|[26][015-9]|4[0-26-9]|7[0-389]|8[08])\\d?|4\\d{2,3}|5(?:[01458]\\d|[27][0-69]|3[0-3]|[69][0-7])\\d?|7(?:1[019]|2[05-9]|3[05]|[45][07-9]|[679][089]|8[06-9])\\d?|8(?:0[2-9]|1[0-36-9]|3[3-9]|[469]9|[58][7-9]|7[89])\\d?|9(?:0[89]|2[0-49]|37|49|5[0-27-9]|7[7-9]|9[0-478])\\d?)\\d{1,7}","\\d{4,11}",,,"27123456"]
,[,,"6[269][18]\\d{6}","\\d{9}",,,"628123456"]
,[,,"6(?:[269][18]|71)\\d{6}","\\d{9}",,,"628123456"]
,[,,"800\\d{5}","\\d{8}",,,"80012345"]
,[,,"90[01]\\d{5}","\\d{8}",,,"90012345"]
,[,,"801\\d{5}","\\d{8}",,,"80112345"]


+ 4
- 4
javascript/i18n/phonenumbers/metadatalite.js View File

@ -461,7 +461,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"AS":[,[,,"[5689]\\d{9}","\\d{7}(?:\\d{3})?"]
,[,,"6846(?:22|33|44|55|77|88|9[19])\\d{4}","\\d{7}(?:\\d{3})?"]
,[,,"684(?:733|25[2468])\\d{4}","\\d{10}"]
,[,,"684(?:25[2468]|7(?:3[13]|70))\\d{4}","\\d{10}"]
,[,,"8(?:00|44|55|66|77|88)[2-9]\\d{6}","\\d{10}"]
,[,,"900[2-9]\\d{6}","\\d{10}"]
,[,,"NA","NA"]
@ -815,7 +815,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"BR":[,[,,"[1-46-9]\\d{7,10}|5\\d{8,9}","\\d{8,11}"]
,[,,"1[1-9][2-5]\\d{7}|(?:[4689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-5]\\d{7}","\\d{8,11}"]
,[,,"1[1-9]9\\d{8}|2[12478]9?[6-9]\\d{7}|(?:3[1-578]|[4689][1-9]|5[13-5]|7[13-579])[6-9]\\d{7}","\\d{10,11}"]
,[,,"1[1-9](?:7|9\\d)\\d{7}|2[12478]9?[6-9]\\d{7}|(?:3[1-578]|[4689][1-9]|5[13-5]|7[13-579])[6-9]\\d{7}","\\d{10,11}"]
,[,,"800\\d{6,7}","\\d{8,11}"]
,[,,"[359]00\\d{6,7}","\\d{8,11}"]
,[,,"[34]00\\d{5}","\\d{8}"]
@ -2626,7 +2626,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"KW":[,[,,"[12569]\\d{6,7}","\\d{7,8}"]
,[,,"(?:18\\d|2(?:[23]\\d{2}|4(?:[1-35-9]\\d|44)|5(?:0[034]|[2-46]\\d|5[1-3]|7[1-7])))\\d{4}","\\d{7,8}"]
,[,,"(?:5(?:1[0-5]|[05]\\d)|6(?:0[034679]|5[015-9]|6\\d|7[067]|9[0369])|9(?:0[09]|4[049]|6[069]|[79]\\d|8[08]))\\d{5}","\\d{8}"]
,[,,"(?:5(?:[05]\\d|1[0-6])|6(?:0[034679]|5[015-9]|6\\d|7[067]|9[0369])|9(?:0[09]|4[049]|6[069]|[79]\\d|8[08]))\\d{5}","\\d{8}"]
,[,,"NA","NA"]
,[,,"NA","NA"]
,[,,"NA","NA"]
@ -2822,7 +2822,7 @@ i18n.phonenumbers.metadata.countryToMetadata = {
]
,"LU":[,[,,"[24-9]\\d{3,10}|3(?:[0-46-9]\\d{2,9}|5[013-9]\\d{1,8})","\\d{4,11}"]
,[,,"(?:2(?:2\\d{1,2}|3[2-9]|[67]\\d|4[1-8]\\d?|5[1-5]\\d?|9[0-24-9]\\d?)|3(?:[059][05-9]|[13]\\d|[26][015-9]|4[0-26-9]|7[0-389]|8[08])\\d?|4\\d{2,3}|5(?:[01458]\\d|[27][0-69]|3[0-3]|[69][0-7])\\d?|7(?:1[019]|2[05-9]|3[05]|[45][07-9]|[679][089]|8[06-9])\\d?|8(?:0[2-9]|1[0-36-9]|3[3-9]|[469]9|[58][7-9]|7[89])\\d?|9(?:0[89]|2[0-49]|37|49|5[0-27-9]|7[7-9]|9[0-478])\\d?)\\d{1,7}","\\d{4,11}"]
,[,,"6[269][18]\\d{6}","\\d{9}"]
,[,,"6(?:[269][18]|71)\\d{6}","\\d{9}"]
,[,,"800\\d{5}","\\d{8}"]
,[,,"90[01]\\d{5}","\\d{8}"]
,[,,"801\\d{5}","\\d{8}"]


+ 2
- 2
javascript/i18n/phonenumbers/phonenumberutil.js View File

@ -114,7 +114,7 @@ i18n.phonenumbers.PhoneNumberUtil.MIN_LENGTH_FOR_NSN_ = 2;
* @type {number}
* @private
*/
i18n.phonenumbers.PhoneNumberUtil.MAX_LENGTH_FOR_NSN_ = 16;
i18n.phonenumbers.PhoneNumberUtil.MAX_LENGTH_FOR_NSN_ = 17;
/**
@ -1511,8 +1511,8 @@ i18n.phonenumbers.PhoneNumberUtil.prototype.formatByPattern =
/** @type {string} */
var nationalPrefixFormattingRule =
formattingPattern.getNationalPrefixFormattingRuleOrDefault();
/** @type {string} */
if (nationalPrefixFormattingRule.length > 0) {
/** @type {string} */
var nationalPrefix = metadata.getNationalPrefixOrDefault();
if (nationalPrefix.length > 0) {
// Replace $NP with national prefix and $FG with the first group ($1).


+ 1
- 1
javascript/i18n/phonenumbers/phonenumberutil_test.js View File

@ -1768,7 +1768,7 @@ function testIsPossibleNumberWithReason() {
assertEquals(VR.TOO_SHORT,
phoneUtil.isPossibleNumberWithReason(adNumber));
adNumber.setCountryCode(376);
adNumber.setNationalNumber(12345678901234567);
adNumber.setNationalNumber(123456789012345678);
assertEquals(VR.TOO_LONG,
phoneUtil.isPossibleNumberWithReason(adNumber));
}


+ 20
- 10
resources/PhoneNumberMetadata.xml View File

@ -1112,11 +1112,14 @@
<exampleNumber>6846221234</exampleNumber>
</fixedLine>
<mobile>
<!-- Adding 24[246], operated from Blue Sky. -->
<!-- Added 25[246], operated from Blue Sky. Added 731, 770, operated by ASTCA. -->
<nationalNumberPattern>
684(?:
733|
25[2468]
25[2468]|
7(?:
3[13]|
70
)
)\d{4}
</nationalNumberPattern>
<possibleNumberPattern>\d{10}</possibleNumberPattern>
@ -3063,9 +3066,13 @@
last 8 digits. The following pattern is divided into 3 sections: ranges for which the
migration has been completed, ranges which are in transition, and ranges which are
still in the old format. (Ranges which were supposed to have been deprecated in
Oct. 2013 are still working as of Jan. 2014.) -->
Oct. 2013 are still working as of Jan. 2014.) Note that mobile radio services are
still 10 digits, with the subscriber number (the last 8 digits) beginning with 7. -->
<nationalNumberPattern>
1[1-9]9\d{8}|
1[1-9](?:
7|
9\d
)\d{7}|
2[12478]9?[6-9]\d{7}|
(?:
3[1-578]|
@ -13109,13 +13116,11 @@
<exampleNumber>22345678</exampleNumber>
</fixedLine>
<mobile>
<!-- The mention of the mobile range 6933 0000 - 6969 9999 seems to be
a mistake in the ITU plan, and should be 6933 0000 - 6933 9999. -->
<nationalNumberPattern>
(?:
5(?:
1[0-5]|
[05]\d
[05]\d|
1[0-6]
)|
6(?:
0[034679]|
@ -14152,7 +14157,12 @@
<exampleNumber>27123456</exampleNumber>
</fixedLine>
<mobile>
<nationalNumberPattern>6[269][18]\d{6}</nationalNumberPattern>
<nationalNumberPattern>
6(?:
[269][18]|
71
)\d{6}
</nationalNumberPattern>
<possibleNumberPattern>\d{9}</possibleNumberPattern>
<exampleNumber>628123456</exampleNumber>
</mobile>


+ 7
- 0
resources/carrier/en/1.txt View File

@ -56,6 +56,13 @@
1671878|Choice Phone
1671888|Choice Phone
1671898|Choice Phone
1684252|Blue Sky
1684254|Blue Sky
1684256|Blue Sky
1684258|Blue Sky
1684731|ASTCA
1684733|ASTCA
1684770|ASTCA
1767225|Cable & Wireless
1767235|Cable & Wireless
1767245|Cable & Wireless


+ 8
- 7
resources/carrier/en/352.txt View File

@ -12,11 +12,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
352021|LuxGSM
352091|Tango
35261|Orange
35262|LuxGSM
35266|Orange
35268|Orange
# In 2013 http://en.wikipedia.org/wiki/LuxGSM was renamed to POST.
352621|POST
352628|POST
352661|Orange
352668|Orange
352671|Join
352691|Tango
35291|Tango
352698|Tango

Loading…
Cancel
Save