@trackunit/custom-field-components 0.0.529 → 0.0.533-alpha-500b40a315.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.cjs.js +5 -3160
  2. package/index.esm.js +2 -3157
  3. package/package.json +11 -12
package/index.cjs.js CHANGED
@@ -7,6 +7,8 @@ var irisAppRuntimeCore = require('@trackunit/iris-app-runtime-core');
7
7
  var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
8
8
  var reactFormComponents = require('@trackunit/react-form-components');
9
9
  var React = require('react');
10
+ var uuid = require('uuid');
11
+ var libphonenumberJs = require('libphonenumber-js');
10
12
 
11
13
  function _interopNamespace(e) {
12
14
  if (e && e.__esModule) return e;
@@ -55,80 +57,6 @@ function __rest(s, e) {
55
57
  return t;
56
58
  }
57
59
 
58
- // Unique ID creation requires a high quality random # generator. In the browser we therefore
59
- // require the crypto API and do not support built-in fallback to lower quality random number
60
- // generators (like Math.random()).
61
- var getRandomValues;
62
- var rnds8 = new Uint8Array(16);
63
- function rng() {
64
- // lazy load so that environments that need to polyfill have a chance to do so
65
- if (!getRandomValues) {
66
- // getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
67
- // find the complete implementation of crypto (msCrypto) on IE11.
68
- getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
69
-
70
- if (!getRandomValues) {
71
- throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
72
- }
73
- }
74
-
75
- return getRandomValues(rnds8);
76
- }
77
-
78
- var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
79
-
80
- function validate(uuid) {
81
- return typeof uuid === 'string' && REGEX.test(uuid);
82
- }
83
-
84
- /**
85
- * Convert array of 16 byte values to UUID string format of the form:
86
- * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
87
- */
88
-
89
- var byteToHex = [];
90
-
91
- for (var i = 0; i < 256; ++i) {
92
- byteToHex.push((i + 0x100).toString(16).substr(1));
93
- }
94
-
95
- function stringify(arr) {
96
- var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
97
- // Note: Be careful editing this code! It's been tuned for performance
98
- // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
99
- var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
100
- // of the following:
101
- // - One or more input array values don't map to a hex octet (leading to
102
- // "undefined" in the uuid)
103
- // - Invalid input values for the RFC `version` or `variant` fields
104
-
105
- if (!validate(uuid)) {
106
- throw TypeError('Stringified UUID is invalid');
107
- }
108
-
109
- return uuid;
110
- }
111
-
112
- function v4(options, buf, offset) {
113
- options = options || {};
114
- var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
115
-
116
- rnds[6] = rnds[6] & 0x0f | 0x40;
117
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
118
-
119
- if (buf) {
120
- offset = offset || 0;
121
-
122
- for (var i = 0; i < 16; ++i) {
123
- buf[offset + i] = rnds[i];
124
- }
125
-
126
- return buf;
127
- }
128
-
129
- return stringify(rnds);
130
- }
131
-
132
60
  /**
133
61
  * A component that can be used to render a boolean field
134
62
  *
@@ -139,7 +67,7 @@ const BooleanCustomField = (_a) => {
139
67
  var { defaultValue, dataTestId = "booleanField", onChange, value, id, setValue, register, validationRules, disabled = false, label, tip, isInvalid, errorMessage, helpAddon, maxLength, helpText } = _a, rest = __rest(_a, ["defaultValue", "dataTestId", "onChange", "value", "id", "setValue", "register", "validationRules", "disabled", "label", "tip", "isInvalid", "errorMessage", "helpAddon", "maxLength", "helpText"]);
140
68
  const initialValue = value !== undefined ? value : defaultValue ? defaultValue : false;
141
69
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
142
- const htmlForId = id ? id : "boolean-custom-field-" + v4();
70
+ const htmlForId = id ? id : "boolean-custom-field-" + uuid.v4();
143
71
  const [internalValue, setInternalValue] = React__namespace.useState(initialValue);
144
72
  React__namespace.useEffect(() => {
145
73
  setInternalValue((value === undefined ? defaultValue : value) || false);
@@ -192,7 +120,7 @@ const convertToValueFormat = (value) => {
192
120
  */
193
121
  const DropdownCustomField = ({ defaultValue, dataTestId, onChange, onBlur, id, disabled = false, allValues, multiSelect = false, register, validationRules, setValue, label, tip, errorMessage, helpText, isInvalid, helpAddon, }) => {
194
122
  const renderAsInvalid = isInvalid || Boolean(errorMessage);
195
- const htmlForId = id ? id : "dropdown-custom-field-" + v4();
123
+ const htmlForId = id ? id : "dropdown-custom-field-" + uuid.v4();
196
124
  const [selectedValue, setSelectedValue] = React__namespace.useState(defaultValue ? defaultValue.map(convertToValueFormat) : []);
197
125
  const onChangeHandler = React__namespace.useCallback((selected) => {
198
126
  if (selected) {
@@ -214,3089 +142,6 @@ const DropdownCustomField = ({ defaultValue, dataTestId, onChange, onBlur, id, d
214
142
  return (jsxRuntime.jsx(reactFormComponents.FormGroup, { htmlFor: htmlForId, label: label, tip: tip, isInvalid: renderAsInvalid, helpText: errorMessage || helpText, helpAddon: helpAddon || null, dataTestId: dataTestId && `${dataTestId}-FormGroup`, children: jsxRuntime.jsx(reactFormComponents.Select, { inputId: htmlForId, "aria-labelledby": htmlForId + "-label", disabled: disabled, dataTestId: dataTestId, onChange: onChangeHandler, hasError: renderAsInvalid, options: options, value: selectedValue, isMulti: multiSelect, isClearable: true }) }));
215
143
  };
216
144
 
217
- // This file is a workaround for a bug in web browsers' "native"
218
- // ES6 importing system which is uncapable of importing "*.json" files.
219
- // https://github.com/catamphetamine/libphonenumber-js/issues/239
220
- var metadata = {"version":4,"country_calling_codes":{"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"],"7":["RU","KZ"],"20":["EG"],"27":["ZA"],"30":["GR"],"31":["NL"],"32":["BE"],"33":["FR"],"34":["ES"],"36":["HU"],"39":["IT","VA"],"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"],"380":["UA"],"381":["RS"],"382":["ME"],"383":["XK"],"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"],"850":["KP"],"852":["HK"],"853":["MO"],"855":["KH"],"856":["LA"],"880":["BD"],"886":["TW"],"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"],"992":["TJ"],"993":["TM"],"994":["AZ"],"995":["GE"],"996":["KG"],"998":["UZ"]},"countries":{"AC":["247","00","(?:[01589]\\d|[46])\\d{4}",[5,6]],"AD":["376","00","(?:1|6\\d)\\d{7}|[135-9]\\d{5}",[6,8,9],[["(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],["(\\d{4})(\\d{4})","$1 $2",["1"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]]],"AE":["971","00","(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",[5,6,7,8,9,10,11,12],[["(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],["(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],"0"],"AF":["93","00","[2-7]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"]],"0"],"AG":["1","011","(?:268|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([457]\\d{6})$|1","268$1",0,"268"],"AI":["1","011","(?:264|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2457]\\d{6})$|1","264$1",0,"264"],"AL":["355","00","(?:700\\d\\d|900)\\d{3}|8\\d{5,7}|(?:[2-5]|6\\d)\\d{7}",[6,7,8,9],[["(\\d{3})(\\d{3,4})","$1 $2",["80|9"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["4[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2358][2-5]|4"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["[23578]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["6"],"0$1"]],"0"],"AM":["374","00","(?:[1-489]\\d|55|60|77)\\d{6}",[8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[89]0"],"0 $1"],["(\\d{3})(\\d{5})","$1 $2",["2|3[12]"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["1|47"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[3-9]"],"0$1"]],"0"],"AO":["244","00","[29]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[29]"]]]],"AR":["54","00","(?:11|[89]\\d\\d)\\d{8}|[2368]\\d{9}",[10,11],[["(\\d{4})(\\d{2})(\\d{4})","$1 $2-$3",["2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9])","2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8]))|2(?:2[24-9]|3[1-59]|47)","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5[56][46]|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|58|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|54(?:4|5[13-7]|6[89])|86[3-6]))|2(?:2[24-9]|3[1-59]|47)|38(?:[58][78]|7[378])|3(?:454|85[56])[46]|3(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["1"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[68]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2-$3",["[23]"],"0$1",1],["(\\d)(\\d{4})(\\d{2})(\\d{4})","$2 15-$3-$4",["9(?:2[2-469]|3[3-578])","9(?:2(?:2[024-9]|3[0-59]|47|6[245]|9[02-8])|3(?:3[28]|4[03-9]|5[2-46-8]|7[1-578]|8[2-9]))","9(?:2(?:[23]02|6(?:[25]|4[6-8])|9(?:[02356]|4[02568]|72|8[23]))|3(?:3[28]|4(?:[04679]|3[5-8]|5[4-68]|8[2379])|5(?:[2467]|3[237]|8[2-5])|7[1-578]|8(?:[2469]|3[2578]|5[4-8]|7[36-8]|8[5-8])))|92(?:2[24-9]|3[1-59]|47)","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3[78]|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8[23])|7[1-578]|8(?:[2469]|3[278]|5(?:[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4[35][56]|58[45]|8(?:[38]5|54|76))[4-6]","9(?:2(?:[23]02|6(?:[25]|4(?:64|[78]))|9(?:[02356]|4(?:[0268]|5[2-6])|72|8[23]))|3(?:3[28]|4(?:[04679]|3(?:5(?:4[0-25689]|[56])|[78])|5(?:4[46]|8)|8[2379])|5(?:[2467]|3[237]|8(?:[23]|4(?:[45]|60)|5(?:4[0-39]|5|64)))|7[1-578]|8(?:[2469]|3[278]|5(?:4(?:4|5[13-7]|6[89])|[56][46]|[78])|7[378]|8(?:6[3-6]|[78]))))|92(?:2[24-9]|3[1-59]|47)|93(?:4(?:36|5[56])|8(?:[38]5|76))[4-6]"],"0$1",0,"$1 $2 $3-$4"],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 15-$3-$4",["91"],"0$1",0,"$1 $2 $3-$4"],["(\\d{3})(\\d{3})(\\d{5})","$1-$2-$3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 15-$3-$4",["9"],"0$1",0,"$1 $2 $3-$4"]],"0",0,"0?(?:(11|2(?:2(?:02?|[13]|2[13-79]|4[1-6]|5[2457]|6[124-8]|7[1-4]|8[13-6]|9[1267])|3(?:02?|1[467]|2[03-6]|3[13-8]|[49][2-6]|5[2-8]|[67])|4(?:7[3-578]|9)|6(?:[0136]|2[24-6]|4[6-8]?|5[15-8])|80|9(?:0[1-3]|[19]|2\\d|3[1-6]|4[02568]?|5[2-4]|6[2-46]|72?|8[23]?))|3(?:3(?:2[79]|6|8[2578])|4(?:0[0-24-9]|[12]|3[5-8]?|4[24-7]|5[4-68]?|6[02-9]|7[126]|8[2379]?|9[1-36-8])|5(?:1|2[1245]|3[237]?|4[1-46-9]|6[2-4]|7[1-6]|8[2-5]?)|6[24]|7(?:[069]|1[1568]|2[15]|3[145]|4[13]|5[14-8]|7[2-57]|8[126])|8(?:[01]|2[15-7]|3[2578]?|4[13-6]|5[4-8]?|6[1-357-9]|7[36-8]?|8[5-8]?|9[124])))15)?","9$1"],"AS":["1","011","(?:[58]\\d\\d|684|900)\\d{7}",[10],0,"1",0,"([267]\\d{6})$|1","684$1",0,"684"],"AT":["43","00","1\\d{3,12}|2\\d{6,12}|43(?:(?:0\\d|5[02-9])\\d{3,9}|2\\d{4,5}|[3467]\\d{4}|8\\d{4,6}|9\\d{4,7})|5\\d{4,12}|8\\d{7,12}|9\\d{8,12}|(?:[367]\\d|4[0-24-9])\\d{4,11}",[4,5,6,7,8,9,10,11,12,13],[["(\\d)(\\d{3,12})","$1 $2",["1(?:11|[2-9])"],"0$1"],["(\\d{3})(\\d{2})","$1 $2",["517"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["5[079]"],"0$1"],["(\\d{3})(\\d{3,10})","$1 $2",["(?:31|4)6|51|6(?:5[0-3579]|[6-9])|7(?:20|32|8)|[89]"],"0$1"],["(\\d{4})(\\d{3,9})","$1 $2",["[2-467]|5[2-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["5"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,7})","$1 $2 $3",["5"],"0$1"]],"0"],"AU":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{7}(?:\\d(?:\\d{2})?)?|8[0-24-9]\\d{7})|[2-478]\\d{8}|1\\d{4,7}",[5,6,7,8,9,10,12],[["(\\d{2})(\\d{3,4})","$1 $2",["16"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,4})","$1 $2 $3",["16"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["14|4"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[2378]"],"(0$1)"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:30|[89])"]]],"0",0,"(183[12])|0",0,0,0,[["(?:(?:2(?:[0-26-9]\\d|3[0-8]|4[02-9]|5[0135-9])|3(?:[0-3589]\\d|4[0-578]|6[1-9]|7[0-35-9])|7(?:[013-57-9]\\d|2[0-8]))\\d{3}|8(?:51(?:0(?:0[03-9]|[12479]\\d|3[2-9]|5[0-8]|6[1-9]|8[0-7])|1(?:[0235689]\\d|1[0-69]|4[0-589]|7[0-47-9])|2(?:0[0-79]|[18][13579]|2[14-9]|3[0-46-9]|[4-6]\\d|7[89]|9[0-4]))|(?:6[0-8]|[78]\\d)\\d{3}|9(?:[02-9]\\d{3}|1(?:(?:[0-58]\\d|6[0135-9])\\d|7(?:0[0-24-9]|[1-9]\\d)|9(?:[0-46-9]\\d|5[0-79])))))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,["163\\d{2,6}",[5,6,7,8,9]],["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],"AW":["297","00","(?:[25-79]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[25-9]"]]]],"AX":["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","2\\d{4,9}|35\\d{4,5}|(?:60\\d\\d|800)\\d{4,6}|7\\d{5,11}|(?:[14]\\d|3[0-46-9]|50)\\d{4,8}",[5,6,7,8,9,10,11,12],0,"0",0,0,0,0,"18",0,"00"],"AZ":["994","00","365\\d{6}|(?:[124579]\\d|60|88)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[28]|2|365|46","1[28]|2|365[45]|46","1[28]|2|365(?:4|5[02])|46"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[13-9]"],"0$1"]],"0"],"BA":["387","00","6\\d{8}|(?:[35689]\\d|49|70)\\d{6}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["6[1-3]|[7-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2-$3",["[3-5]|6[56]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["6"],"0$1"]],"0"],"BB":["1","011","(?:246|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","246$1",0,"246"],"BD":["880","00","[1-469]\\d{9}|8[0-79]\\d{7,8}|[2-79]\\d{8}|[2-9]\\d{7}|[3-9]\\d{6}|[57-9]\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{4,6})","$1-$2",["31[5-8]|[459]1"],"0$1"],["(\\d{3})(\\d{3,7})","$1-$2",["3(?:[67]|8[013-9])|4(?:6[168]|7|[89][18])|5(?:6[128]|9)|6(?:[15]|28|4[14])|7[2-589]|8(?:0[014-9]|[12])|9[358]|(?:3[2-5]|4[235]|5[2-578]|6[0389]|76|8[3-7]|9[24])1|(?:44|66)[01346-9]"],"0$1"],["(\\d{4})(\\d{3,6})","$1-$2",["[13-9]|22"],"0$1"],["(\\d)(\\d{7,8})","$1-$2",["2"],"0$1"]],"0"],"BE":["32","00","4\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:80|9)0"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[239]|4[23]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[15-8]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4"],"0$1"]],"0"],"BF":["226","00","[025-7]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[025-7]"]]]],"BG":["359","00","00800\\d{7}|[2-7]\\d{6,7}|[89]\\d{6,8}|2\\d{5}",[6,7,8,9,12],[["(\\d)(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["43[1-6]|70[1-9]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[356]|4[124-7]|7[1-9]|8[1-6]|9[1-7]"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["(?:70|8)0"],"0$1"],["(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3",["43[1-7]|7"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[48]|9[08]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"]],"0"],"BH":["973","00","[136-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[13679]|8[047]"]]]],"BI":["257","00","(?:[267]\\d|31)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2367]"]]]],"BJ":["229","00","[24-689]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-689]"]]]],"BL":["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:2[7-9]|5[12]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-2])\\d{4}"]]],"BM":["1","011","(?:441|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","441$1",0,"441"],"BN":["673","00","[2-578]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-578]"]]]],"BO":["591","00(?:1\\d)?","(?:[2-467]\\d\\d|8001)\\d{5}",[8,9],[["(\\d)(\\d{7})","$1 $2",["[23]|4[46]"]],["(\\d{8})","$1",["[67]"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["8"]]],"0",0,"0(1\\d)?"],"BQ":["599","00","(?:[34]1|7\\d)\\d{5}",[7],0,0,0,0,0,0,"[347]"],"BR":["55","00(?:1[245]|2[1-35]|31|4[13]|[56]5|99)","(?:[1-46-9]\\d\\d|5(?:[0-46-9]\\d|5[0-46-9]))\\d{8}|[1-9]\\d{9}|[3589]\\d{8}|[34]\\d{7}",[8,9,10,11],[["(\\d{4})(\\d{4})","$1-$2",["300|4(?:0[02]|37)","4(?:02|37)0|[34]00"]],["(\\d{3})(\\d{2,3})(\\d{4})","$1 $2 $3",["(?:[358]|90)0"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3",["(?:[14689][1-9]|2[12478]|3[1-578]|5[13-5]|7[13-579])[2-57]"],"($1)"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3",["[16][1-9]|[2-57-9]"],"($1)"]],"0",0,"(?:0|90)(?:(1[245]|2[1-35]|31|4[13]|[56]5|99)(\\d{10,11}))?","$2"],"BS":["1","011","(?:242|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([3-8]\\d{6})$|1","242$1",0,"242"],"BT":["975","00","[17]\\d{7}|[2-8]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[2-68]|7[246]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[67]|7"]]]],"BW":["267","00","(?:0800|(?:[37]|800)\\d)\\d{6}|(?:[2-6]\\d|90)\\d{5}",[7,8,10],[["(\\d{2})(\\d{5})","$1 $2",["90"]],["(\\d{3})(\\d{4})","$1 $2",["[24-6]|3[15-79]"]],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37]"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["8"]]]],"BY":["375","810","(?:[12]\\d|33|44|902)\\d{7}|8(?:0[0-79]\\d{5,7}|[1-7]\\d{9})|8(?:1[0-489]|[5-79]\\d)\\d{7}|8[1-79]\\d{6,7}|8[0-79]\\d{5}|8\\d{5}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3})","$1 $2",["800"],"8 $1"],["(\\d{3})(\\d{2})(\\d{2,4})","$1 $2 $3",["800"],"8 $1"],["(\\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"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["1(?:[56]|7[467])|2[1-3]"],"8 0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-4]"],"8 0$1"],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["[89]"],"8 $1"]],"8",0,"0|80?",0,0,0,0,"8~10"],"BZ":["501","00","(?:0800\\d|[2-8])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1-$2",["[2-8]"]],["(\\d)(\\d{3})(\\d{4})(\\d{3})","$1-$2-$3-$4",["0"]]]],"CA":["1","011","(?:[2-8]\\d|90)\\d{8}|3\\d{6}",[7,10],0,"1",0,0,0,0,0,[["(?:2(?:04|[23]6|[48]9|50|63)|3(?:06|43|54|6[578]|82)|4(?:03|1[68]|[26]8|3[178]|50|74)|5(?:06|1[49]|48|79|8[147])|6(?:04|[18]3|39|47|72)|7(?:0[59]|42|53|78|8[02])|8(?:[06]7|19|25|73)|90[25])[2-9]\\d{6}",[10]],["",[10]],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}",[10]],["900[2-9]\\d{6}",[10]],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|(?:5(?:00|2[125-9]|33|44|66|77|88)|622)[2-9]\\d{6}",[10]],0,["310\\d{4}",[7]],0,["600[2-9]\\d{6}",[10]]]],"CC":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:02|31|60|89)|1(?:18|76)|223)|91(?:0(?:1[0-2]|29)|1(?:[28]2|50|79)|2(?:10|64)|3(?:[06]8|22)|4[29]8|62\\d|70[23]|959))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],"CD":["243","00","[189]\\d{8}|[1-68]\\d{6}",[7,9],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[1-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]"],"0$1"]],"0"],"CF":["236","00","(?:[27]\\d{3}|8776)\\d{4}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[278]"]]]],"CG":["242","00","222\\d{6}|(?:0\\d|80)\\d{7}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[02]"]]]],"CH":["41","00","8\\d{11}|[2-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8[047]|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]|81"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["8"],"0$1"]],"0"],"CI":["225","00","[02]\\d{9}",[10],[["(\\d{2})(\\d{2})(\\d)(\\d{5})","$1 $2 $3 $4",["2"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3 $4",["0"]]]],"CK":["682","00","[2-578]\\d{4}",[5],[["(\\d{2})(\\d{3})","$1 $2",["[2-578]"]]]],"CL":["56","(?:0|1(?:1[0-69]|2[02-5]|5[13-58]|69|7[0167]|8[018]))0","12300\\d{6}|6\\d{9,10}|[2-9]\\d{8}",[9,10,11],[["(\\d{5})(\\d{4})","$1 $2",["219","2196"],"($1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["44"]],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2[1-36]"],"($1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["9[2-9]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["3[2-5]|[47]|5[1-3578]|6[13-57]|8(?:0[1-9]|[1-9])"],"($1)"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["60|8"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{3})(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3 $4",["60"]]]],"CM":["237","00","[26]\\d{8}|88\\d{6,7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["88"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[26]|88"]]]],"CN":["86","00|1(?:[12]\\d|79)\\d\\d00","1[127]\\d{8,9}|2\\d{9}(?:\\d{2})?|[12]\\d{6,7}|86\\d{6}|(?:1[03-689]\\d|6)\\d{7,9}|(?:[3-579]\\d|8[0-57-9])\\d{6,9}",[7,8,9,10,11,12],[["(\\d{2})(\\d{5,6})","$1 $2",["(?:10|2[0-57-9])[19]","(?:10|2[0-57-9])(?:10|9[56])","10(?:10|9[56])|2[0-57-9](?:100|9[56])"],"0$1"],["(\\d{3})(\\d{5,6})","$1 $2",["3(?:[157]|35|49|9[1-68])|4(?:[17]|2[179]|6[47-9]|8[23])|5(?:[1357]|2[37]|4[36]|6[1-46]|80)|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]|4[13]|5[1-5])|(?:4[35]|59|85)[1-9]","(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[1-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))[19]","85[23](?:10|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:10|9[56])","85[23](?:100|95)|(?:3(?:[157]\\d|35|49|9[1-68])|4(?:[17]\\d|2[179]|[35][1-9]|6[47-9]|8[23])|5(?:[1357]\\d|2[37]|4[36]|6[1-46]|80|9[1-9])|6(?:3[1-5]|6[0238]|9[12])|7(?:01|[1579]\\d|2[248]|3[014-9]|4[3-6]|6[023689])|8(?:1[236-8]|2[5-7]|[37]\\d|5[14-9]|8[36-8]|9[1-8])|9(?:0[1-3689]|1[1-79]|[379]\\d|4[13]|5[1-5]))(?:100|9[56])"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["(?:4|80)0"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|2(?:[02-57-9]|1[1-9])","10|2(?:[02-57-9]|1[1-9])","10[0-79]|2(?:[02-57-9]|1[1-79])|(?:10|21)8(?:0[1-9]|[1-9])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["3(?:[3-59]|7[02-68])|4(?:[26-8]|3[3-9]|5[2-9])|5(?:3[03-9]|[468]|7[028]|9[2-46-9])|6|7(?:[0-247]|3[04-9]|5[0-4689]|6[2368])|8(?:[1-358]|9[1-7])|9(?:[013479]|5[1-5])|(?:[34]1|55|79|87)[02-9]"],"0$1",1],["(\\d{3})(\\d{7,8})","$1 $2",["9"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["80"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[3-578]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["1[3-9]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["[12]"],"0$1",1]],"0",0,"(1(?:[12]\\d|79)\\d\\d)|0",0,0,0,0,"00"],"CO":["57","00(?:4(?:[14]4|56)|[579])","(?:60\\d\\d|9101)\\d{6}|(?:1\\d|3)\\d{9}",[10,11],[["(\\d{3})(\\d{7})","$1 $2",["6"],"($1)"],["(\\d{3})(\\d{7})","$1 $2",["3[0-357]|91"]],["(\\d)(\\d{3})(\\d{7})","$1-$2-$3",["1"],"0$1",0,"$1 $2 $3"]],"0",0,"0(4(?:[14]4|56)|[579])?"],"CR":["506","00","(?:8\\d|90)\\d{8}|(?:[24-8]\\d{3}|3005)\\d{4}",[8,10],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[3-9]"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["[89]"]]],0,0,"(19(?:0[0-2468]|1[09]|20|66|77|99))"],"CU":["53","119","[27]\\d{6,7}|[34]\\d{5,7}|(?:5|8\\d\\d)\\d{7}",[6,7,8,10],[["(\\d{2})(\\d{4,6})","$1 $2",["2[1-4]|[34]"],"(0$1)"],["(\\d)(\\d{6,7})","$1 $2",["7"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["5"],"0$1"],["(\\d{3})(\\d{7})","$1 $2",["8"],"0$1"]],"0"],"CV":["238","0","(?:[2-59]\\d\\d|800)\\d{4}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2-589]"]]]],"CW":["599","00","(?:[34]1|60|(?:7|9\\d)\\d)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[3467]"]],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["9[4-8]"]]],0,0,0,0,0,"[69]"],"CX":["61","001[14-689]|14(?:1[14]|34|4[17]|[56]6|7[47]|88)0011","1(?:[0-79]\\d{8}(?:\\d{2})?|8[0-24-9]\\d{7})|[148]\\d{8}|1\\d{5,7}",[6,7,8,9,10,12],0,"0",0,"([59]\\d{7})$|0","8$1",0,0,[["8(?:51(?:0(?:01|30|59|88)|1(?:17|46|75)|2(?:22|35))|91(?:00[6-9]|1(?:[28]1|49|78)|2(?:09|63)|3(?:12|26|75)|4(?:56|97)|64\\d|7(?:0[01]|1[0-2])|958))\\d{3}",[9]],["4(?:(?:79|94)[01]|83[0-389])\\d{5}|4(?:[0-3]\\d|4[047-9]|5[0-25-9]|6[016-9]|7[02-8]|8[0-24-9]|9[0-37-9])\\d{6}",[9]],["180(?:0\\d{3}|2)\\d{3}",[7,10]],["190[0-26]\\d{6}",[10]],0,0,0,0,["14(?:5(?:1[0458]|[23][458])|71\\d)\\d{4}",[9]],["13(?:00\\d{6}(?:\\d{2})?|45[0-4]\\d{3})|13\\d{4}",[6,8,10,12]]],"0011"],"CY":["357","00","(?:[279]\\d|[58]0)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[257-9]"]]]],"CZ":["420","00","(?:[2-578]\\d|60)\\d{7}|9\\d{8,11}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]|9[015-7]"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{2})","$1 $2 $3 $4",["96"]],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]]],"DE":["49","00","[2579]\\d{5,14}|49(?:[34]0|69|8\\d)\\d\\d?|49(?:37|49|60|7[089]|9\\d)\\d{1,3}|49(?:2[024-9]|3[2-689]|7[1-7])\\d{1,8}|(?:1|[368]\\d|4[0-8])\\d{3,13}|49(?:[015]\\d|2[13]|31|[46][1-8])\\d{1,9}",[4,5,6,7,8,9,10,11,12,13,14,15],[["(\\d{2})(\\d{3,13})","$1 $2",["3[02]|40|[68]9"],"0$1"],["(\\d{3})(\\d{3,12})","$1 $2",["2(?:0[1-389]|1[124]|2[18]|3[14])|3(?:[35-9][15]|4[015])|906|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1","2(?:0[1-389]|12[0-8])|3(?:[35-9][15]|4[015])|906|2(?:[13][14]|2[18])|(?:2[4-9]|4[2-9]|[579][1-9]|[68][1-8])1"],"0$1"],["(\\d{4})(\\d{2,11})","$1 $2",["[24-6]|3(?:[3569][02-46-9]|4[2-4679]|7[2-467]|8[2-46-8])|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]","[24-6]|3(?:3(?:0[1-467]|2[127-9]|3[124578]|7[1257-9]|8[1256]|9[145])|4(?:2[135]|4[13578]|9[1346])|5(?:0[14]|2[1-3589]|6[1-4]|7[13468]|8[13568])|6(?:2[1-489]|3[124-6]|6[13]|7[12579]|8[1-356]|9[135])|7(?:2[1-7]|4[145]|6[1-5]|7[1-4])|8(?:21|3[1468]|6|7[1467]|8[136])|9(?:0[12479]|2[1358]|4[134679]|6[1-9]|7[136]|8[147]|9[1468]))|70[2-8]|8(?:0[2-9]|[1-8])|90[7-9]|[79][1-9]|3[68]4[1347]|3(?:47|60)[1356]|3(?:3[46]|46|5[49])[1246]|3[4579]3[1357]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["138"],"0$1"],["(\\d{5})(\\d{2,10})","$1 $2",["3"],"0$1"],["(\\d{3})(\\d{5,11})","$1 $2",["181"],"0$1"],["(\\d{3})(\\d)(\\d{4,10})","$1 $2 $3",["1(?:3|80)|9"],"0$1"],["(\\d{3})(\\d{7,8})","$1 $2",["1[67]"],"0$1"],["(\\d{3})(\\d{7,12})","$1 $2",["8"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["185","1850","18500"],"0$1"],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["18[68]"],"0$1"],["(\\d{5})(\\d{6})","$1 $2",["15[0568]"],"0$1"],["(\\d{4})(\\d{7})","$1 $2",["15[1279]"],"0$1"],["(\\d{3})(\\d{8})","$1 $2",["18"],"0$1"],["(\\d{3})(\\d{2})(\\d{7,8})","$1 $2 $3",["1(?:6[023]|7)"],"0$1"],["(\\d{4})(\\d{2})(\\d{7})","$1 $2 $3",["15[279]"],"0$1"],["(\\d{3})(\\d{2})(\\d{8})","$1 $2 $3",["15"],"0$1"]],"0"],"DJ":["253","00","(?:2\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[27]"]]]],"DK":["45","00","[2-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-9]"]]]],"DM":["1","011","(?:[58]\\d\\d|767|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","767$1",0,"767"],"DO":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,0,0,0,"8001|8[024]9"],"DZ":["213","00","(?:[1-4]|[5-79]\\d|80)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["9"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-8]"],"0$1"]],"0"],"EC":["593","00","1\\d{9,10}|(?:[2-7]|9\\d)\\d{7}",[8,9,10,11],[["(\\d)(\\d{3})(\\d{4})","$1 $2-$3",["[2-7]"],"(0$1)",0,"$1-$2-$3"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{3})(\\d{3,4})","$1 $2 $3",["1"]]],"0"],"EE":["372","00","8\\d{9}|[4578]\\d{7}|(?:[3-8]\\d|90)\\d{5}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[369]|4[3-8]|5(?:[0-2]|5[0-478]|6[45])|7[1-9]|88","[369]|4[3-8]|5(?:[02]|1(?:[0-8]|95)|5[0-478]|6(?:4[0-4]|5[1-589]))|7[1-9]|88"]],["(\\d{4})(\\d{3,4})","$1 $2",["[45]|8(?:00|[1-49])","[45]|8(?:00[1-9]|[1-49])"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],"EG":["20","00","[189]\\d{8,9}|[24-6]\\d{8}|[135]\\d{7}",[8,9,10],[["(\\d)(\\d{7,8})","$1 $2",["[23]"],"0$1"],["(\\d{2})(\\d{6,7})","$1 $2",["1[35]|[4-6]|8[2468]|9[235-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[189]"],"0$1"]],"0"],"EH":["212","00","[5-8]\\d{8}",[9],0,"0",0,0,0,0,"528[89]"],"ER":["291","00","[178]\\d{6}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[178]"],"0$1"]],"0"],"ES":["34","00","[5-9]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[89]00"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-9]"]]]],"ET":["251","00","(?:11|[2-579]\\d)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-579]"],"0$1"]],"0"],"FI":["358","00|99(?:[01469]|5(?:[14]1|3[23]|5[59]|77|88|9[09]))","[1-35689]\\d{4}|7\\d{10,11}|(?:[124-7]\\d|3[0-46-9])\\d{8}|[1-9]\\d{5,8}",[5,6,7,8,9,10,11,12],[["(\\d)(\\d{4,9})","$1 $2",["[2568][1-8]|3(?:0[1-9]|[1-9])|9"],"0$1"],["(\\d{3})(\\d{3,7})","$1 $2",["[12]00|[368]|70[07-9]"],"0$1"],["(\\d{2})(\\d{4,8})","$1 $2",["[1245]|7[135]"],"0$1"],["(\\d{2})(\\d{6,10})","$1 $2",["7"],"0$1"]],"0",0,0,0,0,"1[03-79]|[2-9]",0,"00"],"FJ":["679","0(?:0|52)","45\\d{5}|(?:0800\\d|[235-9])\\d{6}",[7,11],[["(\\d{3})(\\d{4})","$1 $2",["[235-9]|45"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]]],0,0,0,0,0,0,0,"00"],"FK":["500","00","[2-7]\\d{4}",[5]],"FM":["691","00","(?:[39]\\d\\d|820)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[389]"]]]],"FO":["298","00","[2-9]\\d{5}",[6],[["(\\d{6})","$1",["[2-9]"]]],0,0,"(10(?:01|[12]0|88))"],"FR":["33","00","[1-9]\\d{8}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0 $1"],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["[1-79]"],"0$1"]],"0"],"GA":["241","00","(?:[067]\\d|11)\\d{6}|[2-7]\\d{6}",[7,8],[["(\\d)(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-7]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["11|[67]"],"0$1"]],0,0,"0(11\\d{6}|60\\d{6}|61\\d{6}|6[256]\\d{6}|7[467]\\d{6})","$1"],"GB":["44","00","[1-357-9]\\d{9}|[18]\\d{8}|8\\d{6}",[7,9,10],[["(\\d{3})(\\d{4})","$1 $2",["800","8001","80011","800111","8001111"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["845","8454","84546","845464"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["800"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["1(?:38|5[23]|69|76|94)","1(?:(?:38|69)7|5(?:24|39)|768|946)","1(?:3873|5(?:242|39[4-6])|(?:697|768)[347]|9467)"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["1(?:[2-69][02-9]|[78])"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[25]|7(?:0|6[02-9])","[25]|7(?:0|6(?:[03-9]|2[356]))"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[1389]"],"0$1"]],"0",0,0,0,0,0,[["(?:1(?:1(?:3(?:[0-58]\\d\\d|73[0235])|4(?:[0-5]\\d\\d|69[7-9]|70[0-579])|(?:(?:5[0-26-9]|[78][0-49])\\d|6(?:[0-4]\\d|50))\\d)|(?:2(?:(?:0[024-9]|2[3-9]|3[3-79]|4[1-689]|[58][02-9]|6[0-47-9]|7[013-9]|9\\d)\\d|1(?:[0-7]\\d|8[0-2]))|(?:3(?:0\\d|1[0-8]|[25][02-9]|3[02-579]|[468][0-46-9]|7[1-35-79]|9[2-578])|4(?:0[03-9]|[137]\\d|[28][02-57-9]|4[02-69]|5[0-8]|[69][0-79])|5(?:0[1-35-9]|[16]\\d|2[024-9]|3[015689]|4[02-9]|5[03-9]|7[0-35-9]|8[0-468]|9[0-57-9])|6(?:0[034689]|1\\d|2[0-35689]|[38][013-9]|4[1-467]|5[0-69]|6[13-9]|7[0-8]|9[0-24578])|7(?:0[0246-9]|2\\d|3[0236-8]|4[03-9]|5[0-46-9]|6[013-9]|7[0-35-9]|8[024-9]|9[02-9])|8(?:0[35-9]|2[1-57-9]|3[02-578]|4[0-578]|5[124-9]|6[2-69]|7\\d|8[02-9]|9[02569])|9(?:0[02-589]|[18]\\d|2[02-689]|3[1-57-9]|4[2-9]|5[0-579]|6[2-47-9]|7[0-24578]|9[2-57]))\\d)\\d)|2(?:0[013478]|3[0189]|4[017]|8[0-46-9]|9[0-2])\\d{3})\\d{4}|1(?:2(?:0(?:46[1-4]|87[2-9])|545[1-79]|76(?:2\\d|3[1-8]|6[1-6])|9(?:7(?:2[0-4]|3[2-5])|8(?:2[2-8]|7[0-47-9]|8[3-5])))|3(?:6(?:38[2-5]|47[23])|8(?:47[04-9]|64[0157-9]))|4(?:044[1-7]|20(?:2[23]|8\\d)|6(?:0(?:30|5[2-57]|6[1-8]|7[2-8])|140)|8(?:052|87[1-3]))|5(?:2(?:4(?:3[2-79]|6\\d)|76\\d)|6(?:26[06-9]|686))|6(?:06(?:4\\d|7[4-79])|295[5-7]|35[34]\\d|47(?:24|61)|59(?:5[08]|6[67]|74)|9(?:55[0-4]|77[23]))|7(?:26(?:6[13-9]|7[0-7])|(?:442|688)\\d|50(?:2[0-3]|[3-68]2|76))|8(?:27[56]\\d|37(?:5[2-5]|8[239])|843[2-58])|9(?:0(?:0(?:6[1-8]|85)|52\\d)|3583|4(?:66[1-8]|9(?:2[01]|81))|63(?:23|3[1-4])|9561))\\d{3}",[9,10]],["7(?:457[0-57-9]|700[01]|911[028])\\d{5}|7(?:[1-3]\\d\\d|4(?:[0-46-9]\\d|5[0-689])|5(?:0[0-8]|[13-9]\\d|2[0-35-9])|7(?:0[1-9]|[1-7]\\d|8[02-9]|9[0-689])|8(?:[014-9]\\d|[23][0-8])|9(?:[024-9]\\d|1[02-9]|3[0-689]))\\d{6}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[2-49]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]],0," x"],"GD":["1","011","(?:473|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","473$1",0,"473"],"GE":["995","00","(?:[3-57]\\d\\d|800)\\d{6}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["32"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[57]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[348]"],"0$1"]],"0"],"GF":["594","00","[56]94\\d{6}|(?:80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[56]|9[47]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[89]"],"0$1"]],"0"],"GG":["44","00","(?:1481|[357-9]\\d{3})\\d{6}|8\\d{6}(?:\\d{2})?",[7,9,10],0,"0",0,"([25-9]\\d{5})$|0","1481$1",0,0,[["1481[25-9]\\d{5}",[10]],["7(?:(?:781|839)\\d|911[17])\\d{5}",[10]],["80[08]\\d{7}|800\\d{6}|8001111"],["(?:8(?:4[2-5]|7[0-3])|9(?:[01]\\d|8[0-3]))\\d{7}|845464\\d",[7,10]],["70\\d{8}",[10]],0,["(?:3[0347]|55)\\d{8}",[10]],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}",[10]],["56\\d{8}",[10]]]],"GH":["233","00","(?:[235]\\d{3}|800)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[235]"],"0$1"]],"0"],"GI":["350","00","(?:[25]\\d|60)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["2"]]]],"GL":["299","00","(?:19|[2-689]\\d|70)\\d{4}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["19|[2-9]"]]]],"GM":["220","00","[2-9]\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],"GN":["224","00","722\\d{6}|(?:3|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["3"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[67]"]]]],"GP":["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0",0,0,0,0,0,[["590(?:0[1-68]|[14][0-24-9]|2[0-68]|3[1289]|5[3-579]|[68][0-689]|7[08]|9\\d)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-2])\\d{4}"]]],"GQ":["240","00","222\\d{6}|(?:3\\d|55|[89]0)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235]"]],["(\\d{3})(\\d{6})","$1 $2",["[89]"]]]],"GR":["30","00","5005000\\d{3}|8\\d{9,11}|(?:[269]\\d|70)\\d{8}",[10,11,12],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["21|7"]],["(\\d{4})(\\d{6})","$1 $2",["2(?:2|3[2-57-9]|4[2-469]|5[2-59]|6[2-9]|7[2-69]|8[2-49])|5"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2689]"]],["(\\d{3})(\\d{3,4})(\\d{5})","$1 $2 $3",["8"]]]],"GT":["502","00","(?:1\\d{3}|[2-7])\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1 $2",["[2-7]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],"GU":["1","011","(?:[58]\\d\\d|671|900)\\d{7}",[10],0,"1",0,"([3-9]\\d{6})$|1","671$1",0,"671"],"GW":["245","00","[49]\\d{8}|4\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["40"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"]]]],"GY":["592","001","9008\\d{3}|(?:[2-467]\\d\\d|862)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-46-9]"]]]],"HK":["852","00(?:30|5[09]|[126-9]?)","8[0-46-9]\\d{6,7}|9\\d{4,7}|(?:[2-7]|9\\d{3})\\d{7}",[5,6,7,8,9,11],[["(\\d{3})(\\d{2,5})","$1 $2",["900","9003"]],["(\\d{4})(\\d{4})","$1 $2",["[2-7]|8[1-4]|9(?:0[1-9]|[1-8])"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{3})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["9"]]],0,0,0,0,0,0,0,"00"],"HN":["504","00","8\\d{10}|[237-9]\\d{7}",[8,11],[["(\\d{4})(\\d{4})","$1-$2",["[237-9]"]]]],"HR":["385","00","(?:[24-69]\\d|3[0-79])\\d{7}|80\\d{5,7}|[1-79]\\d{7}|6\\d{5,6}",[6,7,8,9],[["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["6[01]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{4})(\\d{3})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-5]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"]],"0"],"HT":["509","00","(?:[2-489]\\d|55)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[2-589]"]]]],"HU":["36","00","[235-7]\\d{8}|[1-9]\\d{7}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27][2-9]|3[2-7]|4[24-9]|5[2-79]|6|8[2-57-9]|9[2-69]"],"(06 $1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"06 $1"]],"06"],"ID":["62","00[89]","(?:(?:00[1-9]|8\\d)\\d{4}|[1-36])\\d{6}|00\\d{10}|[1-9]\\d{8,10}|[2-9]\\d{7}",[7,8,9,10,11,12,13],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["15"]],["(\\d{2})(\\d{5,9})","$1 $2",["2[124]|[36]1"],"(0$1)"],["(\\d{3})(\\d{5,7})","$1 $2",["800"],"0$1"],["(\\d{3})(\\d{5,8})","$1 $2",["[2-79]"],"(0$1)"],["(\\d{3})(\\d{3,4})(\\d{3})","$1-$2-$3",["8[1-35-9]"],"0$1"],["(\\d{3})(\\d{6,8})","$1 $2",["1"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["804"],"0$1"],["(\\d{3})(\\d)(\\d{3})(\\d{3})","$1 $2 $3 $4",["80"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1-$2-$3",["8"],"0$1"]],"0"],"IE":["353","00","(?:1\\d|[2569])\\d{6,8}|4\\d{6,9}|7\\d{8}|8\\d{8,9}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["2[24-9]|47|58|6[237-9]|9[35-9]"],"(0$1)"],["(\\d{3})(\\d{5})","$1 $2",["[45]0"],"(0$1)"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["1"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2569]|4[1-69]|7[14]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["70"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["81"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[78]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["4"],"(0$1)"],["(\\d{2})(\\d)(\\d{3})(\\d{4})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"IL":["972","0(?:0|1[2-9])","1\\d{6}(?:\\d{3,5})?|[57]\\d{8}|[1-489]\\d{7}",[7,8,9,10,11,12],[["(\\d{4})(\\d{3})","$1-$2",["125"]],["(\\d{4})(\\d{2})(\\d{2})","$1-$2-$3",["121"]],["(\\d)(\\d{3})(\\d{4})","$1-$2-$3",["[2-489]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1-$2-$3",["12"]],["(\\d{4})(\\d{6})","$1-$2",["159"]],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3-$4",["1[7-9]"]],["(\\d{3})(\\d{1,2})(\\d{3})(\\d{4})","$1-$2 $3-$4",["15"]]],"0"],"IM":["44","00","1624\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([25-8]\\d{5})$|0","1624$1",0,"74576|(?:16|7[56])24"],"IN":["91","00","(?:000800|[2-9]\\d\\d)\\d{7}|1\\d{7,12}",[8,9,10,11,12,13],[["(\\d{8})","$1",["5(?:0|2[23]|3[03]|[67]1|88)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|888)","5(?:0|2(?:21|3)|3(?:0|3[23])|616|717|8888)"],0,1],["(\\d{4})(\\d{4,5})","$1 $2",["180","1800"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["140"],0,1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["11|2[02]|33|4[04]|79[1-7]|80[2-46]","11|2[02]|33|4[04]|79(?:[1-6]|7[19])|80(?:[2-4]|6[0-589])","11|2[02]|33|4[04]|79(?:[124-6]|3(?:[02-9]|1[0-24-9])|7(?:1|9[1-6]))|80(?:[2-4]|6[0-589])"],"0$1",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1(?:2[0-249]|3[0-25]|4[145]|[68]|7[1257])|2(?:1[257]|3[013]|4[01]|5[0137]|6[0158]|78|8[1568])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|5[12]|[78]1)|6(?:12|[2-4]1|5[17]|6[13]|80)|7(?:12|3[134]|4[47]|61|88)|8(?:16|2[014]|3[126]|6[136]|7[078]|8[34]|91)|(?:43|59|75)[15]|(?:1[59]|29|67|72)[14]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|674|7(?:(?:2[14]|3[34]|5[15])[2-6]|61[346]|88[0-8])|8(?:70[2-6]|84[235-7]|91[3-7])|(?:1(?:29|60|8[06])|261|552|6(?:12|[2-47]1|5[17]|6[13]|80)|7(?:12|31|4[47])|8(?:16|2[014]|3[126]|6[136]|7[78]|83))[2-7]","1(?:2[0-24]|3[0-25]|4[145]|[59][14]|6[1-9]|7[1257]|8[1-57-9])|2(?:1[257]|3[013]|4[01]|5[0137]|6[058]|78|8[1568]|9[14])|3(?:26|4[1-3]|5[34]|6[01489]|7[02-46]|8[159])|4(?:1[36]|2[1-47]|3[15]|5[12]|6[0-26-9]|7[0-24-9]|8[013-57]|9[014-7])|5(?:1[025]|22|[36][25]|4[28]|[578]1|9[15])|6(?:12(?:[2-6]|7[0-8])|74[2-7])|7(?:(?:2[14]|5[15])[2-6]|3171|61[346]|88(?:[2-7]|82))|8(?:70[2-6]|84(?:[2356]|7[19])|91(?:[3-6]|7[19]))|73[134][2-6]|(?:74[47]|8(?:16|2[014]|3[126]|6[136]|7[78]|83))(?:[2-6]|7[19])|(?:1(?:29|60|8[06])|261|552|6(?:[2-4]1|5[17]|6[13]|7(?:1|4[0189])|80)|7(?:12|88[01]))[2-7]"],"0$1",1],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2[2457-9]|3[2-5]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1[013-9]|28|3[129]|4[1-35689]|5[29]|6[02-5]|70)|807","1(?:[2-479]|5[0235-9])|[2-5]|6(?:1[1358]|2(?:[2457]|84|95)|3(?:[2-4]|55)|4[235-7]|5[2-689]|6[24578]|7[235689]|8[1-6])|7(?:1(?:[013-8]|9[6-9])|28[6-8]|3(?:17|2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4|5[0-367])|70[13-7])|807[19]","1(?:[2-479]|5(?:[0236-9]|5[013-9]))|[2-5]|6(?:2(?:84|95)|355|83)|73179|807(?:1|9[1-3])|(?:1552|6(?:1[1358]|2[2457]|3[2-4]|4[235-7]|5[2-689]|6[24578]|7[235689]|8[124-6])\\d|7(?:1(?:[013-8]\\d|9[6-9])|28[6-8]|3(?:2[0-49]|9[2-57])|4(?:1[2-4]|[29][0-7]|3[0-8]|[56]\\d|8[0-24-7])|5(?:2[1-3]|9[0-6])|6(?:0[5689]|2[5-9]|3[02-8]|4\\d|5[0-367])|70[13-7]))[2-7]"],"0$1",1],["(\\d{5})(\\d{5})","$1 $2",["[6-9]"],"0$1",1],["(\\d{4})(\\d{2,4})(\\d{4})","$1 $2 $3",["1(?:6|8[06])","1(?:6|8[06]0)"],0,1],["(\\d{4})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["18"],0,1]],"0"],"IO":["246","00","3\\d{6}",[7],[["(\\d{3})(\\d{4})","$1 $2",["3"]]]],"IQ":["964","00","(?:1|7\\d\\d)\\d{7}|[2-6]\\d{7,8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-6]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],"IR":["98","00","[1-9]\\d{9}|(?:[1-8]\\d\\d|9)\\d{3,4}",[4,5,6,7,10],[["(\\d{4,5})","$1",["96"],"0$1"],["(\\d{2})(\\d{4,5})","$1 $2",["(?:1[137]|2[13-68]|3[1458]|4[145]|5[1468]|6[16]|7[1467]|8[13467])[12689]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["9"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["[1-8]"],"0$1"]],"0"],"IS":["354","00|1(?:0(?:01|[12]0)|100)","(?:38\\d|[4-9])\\d{6}",[7,9],[["(\\d{3})(\\d{4})","$1 $2",["[4-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["3"]]],0,0,0,0,0,0,0,"00"],"IT":["39","00","0\\d{5,10}|1\\d{8,10}|3(?:[0-8]\\d{7,10}|9\\d{7,8})|(?:55|70)\\d{8}|8\\d{5}(?:\\d{2,4})?",[6,7,8,9,10,11],[["(\\d{2})(\\d{4,6})","$1 $2",["0[26]"]],["(\\d{3})(\\d{3,6})","$1 $2",["0[13-57-9][0159]|8(?:03|4[17]|9[2-5])","0[13-57-9][0159]|8(?:03|4[17]|9(?:2|3[04]|[45][0-4]))"]],["(\\d{4})(\\d{2,6})","$1 $2",["0(?:[13-579][2-46-8]|8[236-8])"]],["(\\d{4})(\\d{4})","$1 $2",["894"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[26]|5"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["1(?:44|[679])|[378]"]],["(\\d{3})(\\d{3,4})(\\d{4})","$1 $2 $3",["0[13-57-9][0159]|14"]],["(\\d{2})(\\d{4})(\\d{5})","$1 $2 $3",["0[26]"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["0"]],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["3"]]],0,0,0,0,0,0,[["0669[0-79]\\d{1,6}|0(?:1(?:[0159]\\d|[27][1-5]|31|4[1-4]|6[1356]|8[2-57])|2\\d\\d|3(?:[0159]\\d|2[1-4]|3[12]|[48][1-6]|6[2-59]|7[1-7])|4(?:[0159]\\d|[23][1-9]|4[245]|6[1-5]|7[1-4]|81)|5(?:[0159]\\d|2[1-5]|3[2-6]|4[1-79]|6[4-6]|7[1-578]|8[3-8])|6(?:[0-57-9]\\d|6[0-8])|7(?:[0159]\\d|2[12]|3[1-7]|4[2-46]|6[13569]|7[13-6]|8[1-59])|8(?:[0159]\\d|2[3-578]|3[1-356]|[6-8][1-5])|9(?:[0159]\\d|[238][1-5]|4[12]|6[1-8]|7[1-6]))\\d{2,7}"],["3[1-9]\\d{8}|3[2-9]\\d{7}",[9,10]],["80(?:0\\d{3}|3)\\d{3}",[6,9]],["(?:0878\\d{3}|89(?:2\\d|3[04]|4(?:[0-4]|[5-9]\\d\\d)|5[0-4]))\\d\\d|(?:1(?:44|6[346])|89(?:38|5[5-9]|9))\\d{6}",[6,8,9,10]],["1(?:78\\d|99)\\d{6}",[9,10]],0,0,0,["55\\d{8}",[10]],["84(?:[08]\\d{3}|[17])\\d{3}",[6,9]]]],"JE":["44","00","1534\\d{6}|(?:[3578]\\d|90)\\d{8}",[10],0,"0",0,"([0-24-8]\\d{5})$|0","1534$1",0,0,[["1534[0-24-8]\\d{5}"],["7(?:(?:(?:50|82)9|937)\\d|7(?:00[378]|97[7-9]))\\d{5}"],["80(?:07(?:35|81)|8901)\\d{4}"],["(?:8(?:4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|90(?:066[59]|1810|71(?:07|55)))\\d{4}"],["701511\\d{4}"],0,["(?:3(?:0(?:07(?:35|81)|8901)|3\\d{4}|4(?:4(?:4(?:05|42|69)|703)|5(?:041|800))|7(?:0002|1206))|55\\d{4})\\d{4}"],["76(?:464|652)\\d{5}|76(?:0[0-28]|2[356]|34|4[01347]|5[49]|6[0-369]|77|8[14]|9[139])\\d{6}"],["56\\d{8}"]]],"JM":["1","011","(?:[58]\\d\\d|658|900)\\d{7}",[10],0,"1",0,0,0,0,"658|876"],"JO":["962","00","(?:(?:[2689]|7\\d)\\d|32|53)\\d{6}",[8,9],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2356]|87"],"(0$1)"],["(\\d{3})(\\d{5,6})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["70"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["7"],"0$1"]],"0"],"JP":["81","010","00[1-9]\\d{6,14}|[257-9]\\d{9}|(?:00|[1-9]\\d\\d)\\d{6}",[8,9,10,11,12,13,14,15,16,17],[["(\\d{3})(\\d{3})(\\d{3})","$1-$2-$3",["(?:12|57|99)0"],"0$1"],["(\\d{4})(\\d)(\\d{4})","$1-$2-$3",["1(?:26|3[79]|4[56]|5[4-68]|6[3-5])|499|5(?:76|97)|746|8(?:3[89]|47|51|63)|9(?:80|9[16])","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:76|97)9|7468|8(?:3(?:8[7-9]|96)|477|51[2-9]|636)|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]","1(?:267|3(?:7[247]|9[278])|466|5(?:47|58|64)|6(?:3[245]|48|5[4-68]))|499[2468]|5(?:769|979[2-69])|7468|8(?:3(?:8[7-9]|96[2457-9])|477|51[2-9]|636[457-9])|9(?:802|9(?:1[23]|69))|1(?:45|58)[67]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2-$3",["[36]|4(?:2[09]|7[01])","[36]|4(?:2(?:0|9[02-69])|7(?:0[019]|1))"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["1(?:1|5[45]|77|88|9[69])|2(?:2[1-37]|3[0-269]|4[59]|5|6[24]|7[1-358]|8[1369]|9[0-38])|4(?:[28][1-9]|3[0-57]|[45]|6[248]|7[2-579]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-389])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9[2-6])|8(?:2[124589]|3[27-9]|49|51|6|7[0-468]|8[68]|9[019])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9[1-489])","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2(?:[127]|3[014-9])|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9[19])|62|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|8[1-9])|5(?:2|3[045]|4[0-369]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0-2469])|49|51|6(?:[0-24]|36|5[0-3589]|72|9[01459])|7[0-468]|8[68])|9(?:[23][1-9]|4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3[34]|4[0178]))|(?:49|55|83)[29]|(?:264|837)[016-9]|2(?:57|93)[015-9]|(?:25[0468]|422|838)[01]|(?:47[59]|59[89]|8(?:6[68]|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9[0169])|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:8294|96)[1-3]|2(?:57|93)[015-9]|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|8292|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]","1(?:1|5(?:4[018]|5[017])|77|88|9[69])|2(?:2[127]|3[0-269]|4[59]|5(?:[1-3]|5[0-69]|7[015-9]|9(?:17|99))|6(?:2|4[016-9])|7(?:[1-35]|8[0189])|8(?:[16]|3[0134]|9[0-5])|9(?:[028]|17|3[015-9]))|4(?:2(?:[13-79]|8[014-6])|3[0-57]|[45]|6[248]|7[2-47]|9[29])|5(?:2|3[045]|4[0-369]|5[29]|8[02389]|9[0-3])|7(?:2[02-46-9]|34|[58]|6[0249]|7[57]|9(?:[23]|4[0-59]|5[01569]|6[0167]))|8(?:2(?:[1258]|4[0-39]|9(?:[019]|4[1-3]|6(?:[0-47-9]|5[01346-9])))|3(?:[29]|7(?:[017-9]|6[6-8]))|49|51|6(?:[0-24]|36[23]|5(?:[0-389]|5[23])|6(?:[01]|9[178])|72|9[0145])|7[0-468]|8[68])|9(?:4[15]|5[138]|6[1-3]|7[156]|8[189]|9(?:[1289]|3(?:31|4[357])|4[0178]))|(?:223|8699)[014-9]|(?:25[0468]|422|838)[01]|(?:48|829(?:2|66)|9[23])[1-9]|(?:47[59]|59[89]|8(?:68|9))[019]"],"0$1"],["(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3",["[14]|[289][2-9]|5[3-9]|7[2-4679]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1-$2-$3",["800"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[257-9]"],"0$1"]],"0"],"KE":["254","000","(?:[17]\\d\\d|900)\\d{6}|(?:2|80)0\\d{6,7}|[4-6]\\d{6,8}",[7,8,9,10],[["(\\d{2})(\\d{5,7})","$1 $2",["[24-6]"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[17]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0"],"KG":["996","00","8\\d{9}|(?:[235-8]\\d|99)\\d{7}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["3(?:1[346]|[24-79])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[235-79]|88"],"0$1"],["(\\d{3})(\\d{3})(\\d)(\\d{2,3})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"KH":["855","00[14-9]","1\\d{9}|[1-9]\\d{7,8}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"KI":["686","00","(?:[37]\\d|6[0-79])\\d{6}|(?:[2-48]\\d|50)\\d{3}",[5,8],0,"0"],"KM":["269","00","[3478]\\d{6}",[7],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[3478]"]]]],"KN":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","869$1",0,"869"],"KP":["850","00|99","85\\d{6}|(?:19\\d|[2-7])\\d{7}",[8,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2-7]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"]],"0"],"KR":["82","00(?:[125689]|3(?:[46]5|91)|7(?:00|27|3|55|6[126]))","00[1-9]\\d{8,11}|(?:[12]|5\\d{3})\\d{7}|[13-6]\\d{9}|(?:[1-6]\\d|80)\\d{7}|[3-6]\\d{4,5}|(?:00|7)0\\d{8}",[5,6,8,9,10,11,12,13,14],[["(\\d{2})(\\d{3,4})","$1-$2",["(?:3[1-3]|[46][1-4]|5[1-5])1"],"0$1"],["(\\d{4})(\\d{4})","$1-$2",["1"]],["(\\d)(\\d{3,4})(\\d{4})","$1-$2-$3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1-$2-$3",["60|8"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1-$2-$3",["[1346]|5[1-5]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2-$3",["[57]"],"0$1"],["(\\d{2})(\\d{5})(\\d{4})","$1-$2-$3",["5"],"0$1"]],"0",0,"0(8(?:[1-46-8]|5\\d\\d))?"],"KW":["965","00","18\\d{5}|(?:[2569]\\d|41)\\d{6}",[7,8],[["(\\d{4})(\\d{3,4})","$1 $2",["[169]|2(?:[235]|4[1-35-9])|52"]],["(\\d{3})(\\d{5})","$1 $2",["[245]"]]]],"KY":["1","011","(?:345|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","345$1",0,"345"],"KZ":["7","810","(?:33622|8\\d{8})\\d{5}|[78]\\d{9}",[10,14],0,"8",0,0,0,0,"33|7",0,"8~10"],"LA":["856","00","[23]\\d{9}|3\\d{8}|(?:[235-8]\\d|41)\\d{6}",[8,9,10],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2[13]|3[14]|[4-8]"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["30[013-9]"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[23]"],"0$1"]],"0"],"LB":["961","00","[27-9]\\d{7}|[13-9]\\d{6}",[7,8],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[13-69]|7(?:[2-57]|62|8[0-7]|9[04-9])|8[02-9]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[27-9]"]]],"0"],"LC":["1","011","(?:[58]\\d\\d|758|900)\\d{7}",[10],0,"1",0,"([2-8]\\d{6})$|1","758$1",0,"758"],"LI":["423","00","[68]\\d{8}|(?:[2378]\\d|90)\\d{5}",[7,9],[["(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3",["[2379]|8(?:0[09]|7)","[2379]|8(?:0(?:02|9)|7)"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["69"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],"0",0,"(1001)|0"],"LK":["94","00","[1-9]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[1-689]"],"0$1"]],"0"],"LR":["231","00","(?:[25]\\d|33|77|88)\\d{7}|(?:2\\d|[4-6])\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[4-6]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23578]"],"0$1"]],"0"],"LS":["266","00","(?:[256]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2568]"]]]],"LT":["370","00","(?:[3469]\\d|52|[78]0)\\d{6}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["52[0-7]"],"(8-$1)",1],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[7-9]"],"8 $1",1],["(\\d{2})(\\d{6})","$1 $2",["37|4(?:[15]|6[1-8])"],"(8-$1)",1],["(\\d{3})(\\d{5})","$1 $2",["[3-6]"],"(8-$1)",1]],"8",0,"[08]"],"LU":["352","00","35[013-9]\\d{4,8}|6\\d{8}|35\\d{2,4}|(?:[2457-9]\\d|3[0-46-9])\\d{2,9}",[4,5,6,7,8,9,10,11],[["(\\d{2})(\\d{3})","$1 $2",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["2(?:0[2-689]|[2-9])|[3-57]|8(?:0[2-9]|[13-9])|9(?:0[89]|[2-579])"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["20[2-689]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4",["2(?:[0367]|4[3-8])"]],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["80[01]|90[015]"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3 $4",["20"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})(\\d{1,2})","$1 $2 $3 $4 $5",["2(?:[0367]|4[3-8])"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{1,5})","$1 $2 $3 $4",["[3-57]|8[13-9]|9(?:0[89]|[2-579])|(?:2|80)[2-9]"]]],0,0,"(15(?:0[06]|1[12]|[35]5|4[04]|6[26]|77|88|99)\\d)"],"LV":["371","00","(?:[268]\\d|90)\\d{6}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[269]|8[01]"]]]],"LY":["218","00","[2-9]\\d{8}",[9],[["(\\d{2})(\\d{7})","$1-$2",["[2-9]"],"0$1"]],"0"],"MA":["212","00","[5-8]\\d{8}",[9],[["(\\d{5})(\\d{4})","$1-$2",["5(?:29|38)","5(?:29[1289]|389)","529(?:1[1-46-9]|2[013-8]|90)|5(?:298|389)[0-46-9]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5[45]"],"0$1"],["(\\d{4})(\\d{5})","$1-$2",["5(?:2[2-489]|3[5-9]|9)|892","5(?:2(?:[2-49]|8[235-9])|3[5-9]|9)|892"],"0$1"],["(\\d{2})(\\d{7})","$1-$2",["8"],"0$1"],["(\\d{3})(\\d{6})","$1-$2",["[5-7]"],"0$1"]],"0",0,0,0,0,0,[["5293[01]\\d{4}|5(?:2(?:[0-25-7]\\d|3[1-578]|4[02-46-8]|8[0235-7]|9[0-289])|3(?:[0-47]\\d|5[02-9]|6[02-8]|8[0189]|9[3-9])|(?:4[067]|5[03])\\d)\\d{5}"],["(?:6(?:[0-79]\\d|8[0-247-9])|7(?:[017]\\d|2[0-2]|6[0-8]|8[0-3]))\\d{6}"],["80\\d{7}"],["89\\d{7}"],0,0,0,0,["592(?:4[0-2]|93)\\d{4}"]]],"MC":["377","00","(?:[3489]|6\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["4"],"0$1"],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[389]"]],["(\\d)(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4 $5",["6"],"0$1"]],"0"],"MD":["373","00","(?:[235-7]\\d|[89]0)\\d{6}",[8],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["22|3"],"0$1"],["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["[25-7]"],"0$1"]],"0"],"ME":["382","00","(?:20|[3-79]\\d)\\d{6}|80\\d{6,7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[2-9]"],"0$1"]],"0"],"MF":["590","00","590\\d{6}|(?:69|80|9\\d)\\d{7}",[9],0,"0",0,0,0,0,0,[["590(?:0[079]|[14]3|[27][79]|30|5[0-268]|87)\\d{4}"],["69(?:0\\d\\d|1(?:2[2-9]|3[0-5]))\\d{4}"],["80[0-5]\\d{6}"],0,0,0,0,0,["9(?:(?:395|76[018])\\d|475[0-2])\\d{4}"]]],"MG":["261","00","[23]\\d{8}",[9],[["(\\d{2})(\\d{2})(\\d{3})(\\d{2})","$1 $2 $3 $4",["[23]"],"0$1"]],"0",0,"([24-9]\\d{6})$|0","20$1"],"MH":["692","011","329\\d{4}|(?:[256]\\d|45)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1-$2",["[2-6]"]]],"1"],"MK":["389","00","[2-578]\\d{7}",[8],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2|34[47]|4(?:[37]7|5[47]|64)"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[347]"],"0$1"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["[58]"],"0$1"]],"0"],"ML":["223","00","[24-9]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24-9]"]]]],"MM":["95","00","1\\d{5,7}|95\\d{6}|(?:[4-7]|9[0-46-9])\\d{6,8}|(?:2|8\\d)\\d{5,8}",[6,7,8,9,10],[["(\\d)(\\d{2})(\\d{3})","$1 $2 $3",["16|2"],"0$1"],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["[45]|6(?:0[23]|[1-689]|7[235-7])|7(?:[0-4]|5[2-7])|8[1-6]"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[4-7]|8[1-35]"],"0$1"],["(\\d)(\\d{3})(\\d{4,6})","$1 $2 $3",["9(?:2[0-4]|[35-9]|4[137-9])"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["92"],"0$1"],["(\\d)(\\d{5})(\\d{4})","$1 $2 $3",["9"],"0$1"]],"0"],"MN":["976","001","[12]\\d{7,9}|[5-9]\\d{7}",[8,9,10],[["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["[12]1"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[5-9]"]],["(\\d{3})(\\d{5,6})","$1 $2",["[12]2[1-3]"],"0$1"],["(\\d{4})(\\d{5,6})","$1 $2",["[12](?:27|3[2-8]|4[2-68]|5[1-4689])","[12](?:27|3[2-8]|4[2-68]|5[1-4689])[0-3]"],"0$1"],["(\\d{5})(\\d{4,5})","$1 $2",["[12]"],"0$1"]],"0"],"MO":["853","00","0800\\d{3}|(?:28|[68]\\d)\\d{6}",[7,8],[["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{4})(\\d{4})","$1 $2",["[268]"]]]],"MP":["1","011","[58]\\d{9}|(?:67|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","670$1",0,"670"],"MQ":["596","00","596\\d{6}|(?:69|80|9\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[569]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"MR":["222","00","(?:[2-4]\\d\\d|800)\\d{5}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-48]"]]]],"MS":["1","011","(?:[58]\\d\\d|664|900)\\d{7}",[10],0,"1",0,"([34]\\d{6})$|1","664$1",0,"664"],"MT":["356","00","3550\\d{4}|(?:[2579]\\d\\d|800)\\d{5}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[2357-9]"]]]],"MU":["230","0(?:0|[24-7]0|3[03])","(?:[57]|8\\d\\d)\\d{7}|[2-468]\\d{6}",[7,8,10],[["(\\d{3})(\\d{4})","$1 $2",["[2-46]|8[013]"]],["(\\d{4})(\\d{4})","$1 $2",["[57]"]],["(\\d{5})(\\d{5})","$1 $2",["8"]]],0,0,0,0,0,0,0,"020"],"MV":["960","0(?:0|19)","(?:800|9[0-57-9]\\d)\\d{7}|[34679]\\d{6}",[7,10],[["(\\d{3})(\\d{4})","$1-$2",["[34679]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"]]],0,0,0,0,0,0,0,"00"],"MW":["265","00","(?:[1289]\\d|31|77)\\d{7}|1\\d{6}",[7,9],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["1[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"],"0$1"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[137-9]"],"0$1"]],"0"],"MX":["52","0[09]","1(?:(?:[27]2|44|99)[1-9]|65[0-689])\\d{7}|(?:1(?:[01]\\d|2[13-9]|[35][1-9]|4[0-35-9]|6[0-46-9]|7[013-9]|8[1-79]|9[1-8])|[2-9]\\d)\\d{8}",[10,11],[["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["33|5[56]|81"],0,1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[2-9]"],0,1],["(\\d)(\\d{2})(\\d{4})(\\d{4})","$2 $3 $4",["1(?:33|5[56]|81)"],0,1],["(\\d)(\\d{3})(\\d{3})(\\d{4})","$2 $3 $4",["1"],0,1]],"01",0,"0(?:[12]|4[45])|1",0,0,0,0,"00"],"MY":["60","00","1\\d{8,9}|(?:3\\d|[4-9])\\d{7}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1-$2 $3",["[4-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1-$2 $3",["1(?:[02469]|[378][1-9]|53)|8","1(?:[02469]|[37][1-9]|53|8(?:[1-46-9]|5[7-9]))|8"],"0$1"],["(\\d)(\\d{4})(\\d{4})","$1-$2 $3",["3"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{4})","$1-$2-$3-$4",["1(?:[367]|80)"]],["(\\d{3})(\\d{3})(\\d{4})","$1-$2 $3",["15"],"0$1"],["(\\d{2})(\\d{4})(\\d{4})","$1-$2 $3",["1"],"0$1"]],"0"],"MZ":["258","00","(?:2|8\\d)\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2|8[2-79]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["8"]]]],"NA":["264","00","[68]\\d{7,8}",[8,9],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["88"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["87"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],"NC":["687","00","(?:050|[2-57-9]\\d\\d)\\d{3}",[6],[["(\\d{2})(\\d{2})(\\d{2})","$1.$2.$3",["[02-57-9]"]]]],"NE":["227","00","[027-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["08"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[089]|2[013]|7[04]"]]]],"NF":["672","00","[13]\\d{5}",[6],[["(\\d{2})(\\d{4})","$1 $2",["1[0-3]"]],["(\\d)(\\d{5})","$1 $2",["[13]"]]],0,0,"([0-258]\\d{4})$","3$1"],"NG":["234","009","(?:[124-7]|9\\d{3})\\d{6}|[1-9]\\d{7}|[78]\\d{9,13}",[7,8,10,11,12,13,14],[["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["78"],"0$1"],["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[12]|9(?:0[3-9]|[1-9])"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["[3-7]|8[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{4})(\\d{4,5})","$1 $2 $3",["[78]"],"0$1"],["(\\d{3})(\\d{5})(\\d{5,6})","$1 $2 $3",["[78]"],"0$1"]],"0"],"NI":["505","00","(?:1800|[25-8]\\d{3})\\d{4}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[125-8]"]]]],"NL":["31","00","(?:[124-7]\\d\\d|3(?:[02-9]\\d|1[0-8]))\\d{6}|8\\d{6,9}|9\\d{6,10}|1\\d{4,5}",[5,6,7,8,9,10,11],[["(\\d{3})(\\d{4,7})","$1 $2",["[89]0"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["66"],"0$1"],["(\\d)(\\d{8})","$1 $2",["6"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["1[16-8]|2[259]|3[124]|4[17-9]|5[124679]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-578]|91"],"0$1"],["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3",["9"],"0$1"]],"0"],"NO":["47","00","(?:0|[2-9]\\d{3})\\d{4}",[5,8],[["(\\d{3})(\\d{2})(\\d{3})","$1 $2 $3",["8"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2-79]"]]],0,0,0,0,0,"[02-689]|7[0-8]"],"NP":["977","00","(?:1\\d|9)\\d{9}|[1-9]\\d{7}",[8,10,11],[["(\\d)(\\d{7})","$1-$2",["1[2-6]"],"0$1"],["(\\d{2})(\\d{6})","$1-$2",["1[01]|[2-8]|9(?:[1-59]|[67][2-6])"],"0$1"],["(\\d{3})(\\d{7})","$1-$2",["9"]]],"0"],"NR":["674","00","(?:444|(?:55|8\\d)\\d|666)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[4-68]"]]]],"NU":["683","00","(?:[47]|888\\d)\\d{3}",[4,7],[["(\\d{3})(\\d{4})","$1 $2",["8"]]]],"NZ":["64","0(?:0|161)","[29]\\d{7,9}|50\\d{5}(?:\\d{2,3})?|6[0-35-9]\\d{6}|7\\d{7,8}|8\\d{4,9}|(?:11\\d|[34])\\d{7}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,8})","$1 $2",["8[1-579]"],"0$1"],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["50[036-8]|[89]0","50(?:[0367]|88)|[89]0"],"0$1"],["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["24|[346]|7[2-57-9]|9[2-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:10|74)|[59]|80"],"0$1"],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["1|2[028]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,5})","$1 $2 $3",["2(?:[169]|7[0-35-9])|7|86"],"0$1"]],"0",0,0,0,0,0,0,"00"],"OM":["968","00","(?:1505|[279]\\d{3}|500)\\d{4}|800\\d{5,6}",[7,8,9],[["(\\d{3})(\\d{4,6})","$1 $2",["[58]"]],["(\\d{2})(\\d{6})","$1 $2",["2"]],["(\\d{4})(\\d{4})","$1 $2",["[179]"]]]],"PA":["507","00","(?:00800|8\\d{3})\\d{6}|[68]\\d{7}|[1-57-9]\\d{6}",[7,8,10,11],[["(\\d{3})(\\d{4})","$1-$2",["[1-57-9]"]],["(\\d{4})(\\d{4})","$1-$2",["[68]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]]],"PE":["51","00|19(?:1[124]|77|90)00","(?:[14-8]|9\\d)\\d{7}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["80"],"(0$1)"],["(\\d)(\\d{7})","$1 $2",["1"],"(0$1)"],["(\\d{2})(\\d{6})","$1 $2",["[4-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"]]],"0",0,0,0,0,0,0,"00"," Anexo "],"PF":["689","00","4\\d{5}(?:\\d{2})?|8\\d{7,8}",[6,8,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["44"]],["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["4|8[7-9]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],"PG":["675","00|140[1-3]","(?:180|[78]\\d{3})\\d{4}|(?:[2-589]\\d|64)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["18|[2-69]|85"]],["(\\d{4})(\\d{4})","$1 $2",["[78]"]]],0,0,0,0,0,0,0,"00"],"PH":["63","00","(?:[2-7]|9\\d)\\d{8}|2\\d{5}|(?:1800|8)\\d{7,9}",[6,8,9,10,11,12,13],[["(\\d)(\\d{5})","$1 $2",["2"],"(0$1)"],["(\\d{4})(\\d{4,6})","$1 $2",["3(?:23|39|46)|4(?:2[3-6]|[35]9|4[26]|76)|544|88[245]|(?:52|64|86)2","3(?:230|397|461)|4(?:2(?:35|[46]4|51)|396|4(?:22|63)|59[347]|76[15])|5(?:221|446)|642[23]|8(?:622|8(?:[24]2|5[13]))"],"(0$1)"],["(\\d{5})(\\d{4})","$1 $2",["346|4(?:27|9[35])|883","3469|4(?:279|9(?:30|56))|8834"],"(0$1)"],["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["2"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|8[2-8]"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]],["(\\d{4})(\\d{1,2})(\\d{3})(\\d{4})","$1 $2 $3 $4",["1"]]],"0"],"PK":["92","00","122\\d{6}|[24-8]\\d{10,11}|9(?:[013-9]\\d{8,10}|2(?:[01]\\d\\d|2(?:[06-8]\\d|1[01]))\\d{7})|(?:[2-8]\\d{3}|92(?:[0-7]\\d|8[1-9]))\\d{6}|[24-9]\\d{8}|[89]\\d{7}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,7})","$1 $2 $3",["[89]0"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["1"]],["(\\d{3})(\\d{6,7})","$1 $2",["2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:2[2-8]|3[27-9]|4[2-6]|6[3569]|9[25-8])","9(?:2[3-8]|98)|(?:2(?:3[2358]|4[2-4]|9[2-8])|45[3479]|54[2-467]|60[468]|72[236]|8(?:2[2-689]|3[23578]|4[3478]|5[2356])|9(?:22|3[27-9]|4[2-6]|6[3569]|9[25-7]))[2-9]"],"(0$1)"],["(\\d{2})(\\d{7,8})","$1 $2",["(?:2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91)[2-9]"],"(0$1)"],["(\\d{5})(\\d{5})","$1 $2",["58"],"(0$1)"],["(\\d{3})(\\d{7})","$1 $2",["3"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["2[125]|4[0-246-9]|5[1-35-7]|6[1-8]|7[14]|8[16]|91"],"(0$1)"],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[24-9]"],"(0$1)"]],"0"],"PL":["48","00","(?:6|8\\d\\d)\\d{7}|[1-9]\\d{6}(?:\\d{2})?|[26]\\d{5}",[6,7,8,9,10],[["(\\d{5})","$1",["19"]],["(\\d{3})(\\d{3})","$1 $2",["11|20|64"]],["(\\d{2})(\\d{2})(\\d{3})","$1 $2 $3",["(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])1","(?:1[2-8]|2[2-69]|3[2-4]|4[1-468]|5[24-689]|6[1-3578]|7[14-7]|8[1-79]|9[145])19"]],["(\\d{3})(\\d{2})(\\d{2,3})","$1 $2 $3",["64"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["21|39|45|5[0137]|6[0469]|7[02389]|8(?:0[14]|8)"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["1[2-8]|[2-7]|8[1-79]|9[145]"]],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["8"]]]],"PM":["508","00","[45]\\d{5}|(?:708|80\\d)\\d{6}",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[45]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"],"0$1"]],"0"],"PR":["1","011","(?:[589]\\d\\d|787)\\d{7}",[10],0,"1",0,0,0,0,"787|939"],"PS":["970","00","[2489]2\\d{6}|(?:1\\d|5)\\d{8}",[8,9,10],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[2489]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["5"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"PT":["351","00","1693\\d{5}|(?:[26-9]\\d|30)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["2[12]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["16|[236-9]"]]]],"PW":["680","01[12]","(?:[24-8]\\d\\d|345|900)\\d{4}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[2-9]"]]]],"PY":["595","00","59\\d{4,6}|9\\d{5,10}|(?:[2-46-8]\\d|5[0-8])\\d{4,7}",[6,7,8,9,10,11],[["(\\d{3})(\\d{3,6})","$1 $2",["[2-9]0"],"0$1"],["(\\d{2})(\\d{5})","$1 $2",["[26]1|3[289]|4[1246-8]|7[1-3]|8[1-36]"],"(0$1)"],["(\\d{3})(\\d{4,5})","$1 $2",["2[279]|3[13-5]|4[359]|5|6(?:[34]|7[1-46-8])|7[46-8]|85"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["2[14-68]|3[26-9]|4[1246-8]|6(?:1|75)|7[1-35]|8[1-36]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["87"]],["(\\d{3})(\\d{6})","$1 $2",["9(?:[5-79]|8[1-6])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[2-8]"],"0$1"],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["9"]]],"0"],"QA":["974","00","800\\d{4}|(?:2|800)\\d{6}|(?:0080|[3-7])\\d{7}",[7,8,9,11],[["(\\d{3})(\\d{4})","$1 $2",["2[16]|8"]],["(\\d{4})(\\d{4})","$1 $2",["[3-7]"]]]],"RE":["262","00","(?:26|[689]\\d)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2689]"],"0$1"]],"0",0,0,0,0,0,[["26(?:2\\d\\d|3(?:0\\d|1[0-3]))\\d{4}"],["(?:69(?:2\\d\\d|3(?:0[0-46]|1[013]|2[0-2]|3[0-39]|4\\d|5[0-5]|6[0-6]|7[0-27]|8[0-8]|9[0-479]))|9(?:399[0-3]|479[0-2]|76(?:2[27]|3[0-37]|9\\d)))\\d{4}"],["80\\d{7}"],["89[1-37-9]\\d{6}"],0,0,0,0,0,["8(?:1[019]|2[0156]|84|90)\\d{6}"]]],"RO":["40","00","(?:[2378]\\d|90)\\d{7}|[23]\\d{5}",[6,9],[["(\\d{3})(\\d{3})","$1 $2",["2[3-6]","2[3-6]\\d9"],"0$1"],["(\\d{2})(\\d{4})","$1 $2",["219|31"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[23]1"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[237-9]"],"0$1"]],"0",0,0,0,0,0,0,0," int "],"RS":["381","00","38[02-9]\\d{6,9}|6\\d{7,9}|90\\d{4,8}|38\\d{5,6}|(?:7\\d\\d|800)\\d{3,9}|(?:[12]\\d|3[0-79])\\d{5,10}",[6,7,8,9,10,11,12],[["(\\d{3})(\\d{3,9})","$1 $2",["(?:2[389]|39)0|[7-9]"],"0$1"],["(\\d{2})(\\d{5,10})","$1 $2",["[1-36]"],"0$1"]],"0"],"RU":["7","810","8\\d{13}|[347-9]\\d{9}",[10,14],[["(\\d{4})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-8]|2[1-9])","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:1[23]|[2-9]2))","7(?:1(?:[0-356]2|4[29]|7|8[27])|2(?:13[03-69]|62[013-9]))|72[1-57-9]2"],"8 ($1)",1],["(\\d{5})(\\d)(\\d{2})(\\d{2})","$1 $2 $3 $4",["7(?:1[0-68]|2[1-9])","7(?:1(?:[06][3-6]|[18]|2[35]|[3-5][3-5])|2(?:[13][3-5]|[24-689]|7[457]))","7(?:1(?:0(?:[356]|4[023])|[18]|2(?:3[013-9]|5)|3[45]|43[013-79]|5(?:3[1-8]|4[1-7]|5)|6(?:3[0-35-9]|[4-6]))|2(?:1(?:3[178]|[45])|[24-689]|3[35]|7[457]))|7(?:14|23)4[0-8]|71(?:33|45)[1-79]"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"8 ($1)",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2-$3-$4",["[349]|8(?:[02-7]|1[1-8])"],"8 ($1)",1],["(\\d{4})(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3 $4",["8"],"8 ($1)"]],"8",0,0,0,0,"3[04-689]|[489]",0,"8~10"],"RW":["250","00","(?:06|[27]\\d\\d|[89]00)\\d{6}",[8,9],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["0"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[7-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["2"]]],"0"],"SA":["966","00","92\\d{7}|(?:[15]|8\\d)\\d{8}",[9,10],[["(\\d{4})(\\d{5})","$1 $2",["9"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["1"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["81"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]]],"0"],"SB":["677","0[01]","(?:[1-6]|[7-9]\\d\\d)\\d{4}",[5,7],[["(\\d{2})(\\d{5})","$1 $2",["7|8[4-9]|9(?:[1-8]|9[0-8])"]]]],"SC":["248","010|0[0-2]","800\\d{4}|(?:[249]\\d|64)\\d{5}",[7],[["(\\d)(\\d{3})(\\d{3})","$1 $2 $3",["[246]|9[57]"]]],0,0,0,0,0,0,0,"00"],"SD":["249","00","[19]\\d{8}",[9],[["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[19]"],"0$1"]],"0"],"SE":["46","00","(?:[26]\\d\\d|9)\\d{9}|[1-9]\\d{8}|[1-689]\\d{7}|[1-4689]\\d{6}|2\\d{5}",[6,7,8,9,10],[["(\\d{2})(\\d{2,3})(\\d{2})","$1-$2 $3",["20"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{4})","$1-$2",["9(?:00|39|44|9)"],"0$1",0,"$1 $2"],["(\\d{2})(\\d{3})(\\d{2})","$1-$2 $3",["[12][136]|3[356]|4[0246]|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3"],["(\\d)(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2,3})(\\d{2})","$1-$2 $3",["1[2457]|2(?:[247-9]|5[0138])|3[0247-9]|4[1357-9]|5[0-35-9]|6(?:[125689]|4[02-57]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3"],["(\\d{3})(\\d{2,3})(\\d{3})","$1-$2 $3",["9(?:00|39|44)"],"0$1",0,"$1 $2 $3"],["(\\d{2})(\\d{2,3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["1[13689]|2[0136]|3[1356]|4[0246]|54|6[03]|90[1-9]"],"0$1",0,"$1 $2 $3 $4"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4",["10|7"],"0$1",0,"$1 $2 $3 $4"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1-$2 $3 $4",["8"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1-$2 $3 $4",["[13-5]|2(?:[247-9]|5[0138])|6(?:[124-689]|7[0-2])|9(?:[125-8]|3[02-5]|4[0-3])"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{2})(\\d{3})","$1-$2 $3 $4",["9"],"0$1",0,"$1 $2 $3 $4"],["(\\d{3})(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1-$2 $3 $4 $5",["[26]"],"0$1",0,"$1 $2 $3 $4 $5"]],"0"],"SG":["65","0[0-3]\\d","(?:(?:1\\d|8)\\d\\d|7000)\\d{7}|[3689]\\d{7}",[8,10,11],[["(\\d{4})(\\d{4})","$1 $2",["[369]|8(?:0[1-6]|[1-9])"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"]],["(\\d{4})(\\d{4})(\\d{3})","$1 $2 $3",["7"]],["(\\d{4})(\\d{3})(\\d{4})","$1 $2 $3",["1"]]]],"SH":["290","00","(?:[256]\\d|8)\\d{3}",[4,5],0,0,0,0,0,0,"[256]"],"SI":["386","00|10(?:22|66|88|99)","[1-7]\\d{7}|8\\d{4,7}|90\\d{4,6}",[5,6,7,8],[["(\\d{2})(\\d{3,6})","$1 $2",["8[09]|9"],"0$1"],["(\\d{3})(\\d{5})","$1 $2",["59|8"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[37][01]|4[0139]|51|6"],"0$1"],["(\\d)(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[1-57]"],"(0$1)"]],"0",0,0,0,0,0,0,"00"],"SJ":["47","00","0\\d{4}|(?:[489]\\d|[57]9)\\d{6}",[5,8],0,0,0,0,0,0,"79"],"SK":["421","00","[2-689]\\d{8}|[2-59]\\d{6}|[2-5]\\d{5}",[6,7,9],[["(\\d)(\\d{2})(\\d{3,4})","$1 $2 $3",["21"],"0$1"],["(\\d{2})(\\d{2})(\\d{2,3})","$1 $2 $3",["[3-5][1-8]1","[3-5][1-8]1[67]"],"0$1"],["(\\d)(\\d{3})(\\d{3})(\\d{2})","$1/$2 $3 $4",["2"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[689]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1/$2 $3 $4",["[3-5]"],"0$1"]],"0"],"SL":["232","00","(?:[237-9]\\d|66)\\d{6}",[8],[["(\\d{2})(\\d{6})","$1 $2",["[236-9]"],"(0$1)"]],"0"],"SM":["378","00","(?:0549|[5-7]\\d)\\d{6}",[8,10],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[5-7]"]],["(\\d{4})(\\d{6})","$1 $2",["0"]]],0,0,"([89]\\d{5})$","0549$1"],"SN":["221","00","(?:[378]\\d|93)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[379]"]]]],"SO":["252","00","[346-9]\\d{8}|[12679]\\d{7}|[1-5]\\d{6}|[1348]\\d{5}",[6,7,8,9],[["(\\d{2})(\\d{4})","$1 $2",["8[125]"]],["(\\d{6})","$1",["[134]"]],["(\\d)(\\d{6})","$1 $2",["[15]|2[0-79]|3[0-46-8]|4[0-7]"]],["(\\d)(\\d{7})","$1 $2",["(?:2|90)4|[67]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3478]|64|90"]],["(\\d{2})(\\d{5,7})","$1 $2",["1|28|6(?:0[5-7]|[1-35-9])|9[2-9]"]]],"0"],"SR":["597","00","(?:[2-5]|68|[78]\\d)\\d{5}",[6,7],[["(\\d{2})(\\d{2})(\\d{2})","$1-$2-$3",["56"]],["(\\d{3})(\\d{3})","$1-$2",["[2-5]"]],["(\\d{3})(\\d{4})","$1-$2",["[6-8]"]]]],"SS":["211","00","[19]\\d{8}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[19]"],"0$1"]],"0"],"ST":["239","00","(?:22|9\\d)\\d{5}",[7],[["(\\d{3})(\\d{4})","$1 $2",["[29]"]]]],"SV":["503","00","[267]\\d{7}|[89]00\\d{4}(?:\\d{4})?",[7,8,11],[["(\\d{3})(\\d{4})","$1 $2",["[89]"]],["(\\d{4})(\\d{4})","$1 $2",["[267]"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["[89]"]]]],"SX":["1","011","7215\\d{6}|(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"(5\\d{6})$|1","721$1",0,"721"],"SY":["963","00","[1-39]\\d{8}|[1-5]\\d{7}",[8,9],[["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-5]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1",1]],"0"],"SZ":["268","00","0800\\d{4}|(?:[237]\\d|900)\\d{6}",[8,9],[["(\\d{4})(\\d{4})","$1 $2",["[0237]"]],["(\\d{5})(\\d{4})","$1 $2",["9"]]]],"TA":["290","00","8\\d{3}",[4],0,0,0,0,0,0,"8"],"TC":["1","011","(?:[58]\\d\\d|649|900)\\d{7}",[10],0,"1",0,"([2-479]\\d{6})$|1","649$1",0,"649"],"TD":["235","00|16","(?:22|[69]\\d|77)\\d{6}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[2679]"]]],0,0,0,0,0,0,0,"00"],"TG":["228","00","[279]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[279]"]]]],"TH":["66","00[1-9]","(?:001800|[2-57]|[689]\\d)\\d{7}|1\\d{7,9}",[8,9,10,13],[["(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["2"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[13-9]"],"0$1"],["(\\d{4})(\\d{3})(\\d{3})","$1 $2 $3",["1"]]],"0"],"TJ":["992","810","[0-57-9]\\d{8}",[9],[["(\\d{6})(\\d)(\\d{2})","$1 $2 $3",["331","3317"]],["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[34]7|91[78]"]],["(\\d{4})(\\d)(\\d{4})","$1 $2 $3",["3[1-5]"]],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[0-57-9]"]]],0,0,0,0,0,0,0,"8~10"],"TK":["690","00","[2-47]\\d{3,6}",[4,5,6,7]],"TL":["670","00","7\\d{7}|(?:[2-47]\\d|[89]0)\\d{5}",[7,8],[["(\\d{3})(\\d{4})","$1 $2",["[2-489]|70"]],["(\\d{4})(\\d{4})","$1 $2",["7"]]]],"TM":["993","810","[1-6]\\d{7}",[8],[["(\\d{2})(\\d{2})(\\d{2})(\\d{2})","$1 $2-$3-$4",["12"],"(8 $1)"],["(\\d{3})(\\d)(\\d{2})(\\d{2})","$1 $2-$3-$4",["[1-5]"],"(8 $1)"],["(\\d{2})(\\d{6})","$1 $2",["6"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],"TN":["216","00","[2-57-9]\\d{7}",[8],[["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-57-9]"]]]],"TO":["676","00","(?:0800|(?:[5-8]\\d\\d|999)\\d)\\d{3}|[2-8]\\d{4}",[5,7],[["(\\d{2})(\\d{3})","$1-$2",["[2-4]|50|6[09]|7[0-24-69]|8[05]"]],["(\\d{4})(\\d{3})","$1 $2",["0"]],["(\\d{3})(\\d{4})","$1 $2",["[5-9]"]]]],"TR":["90","00","4\\d{6}|8\\d{11,12}|(?:[2-58]\\d\\d|900)\\d{7}",[7,10,12,13],[["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["512|8[01589]|90"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["5(?:[0-59]|61)","5(?:[0-59]|616)","5(?:[0-59]|6161)"],"0$1",1],["(\\d{3})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[24][1-8]|3[1-9]"],"(0$1)",1],["(\\d{3})(\\d{3})(\\d{6,7})","$1 $2 $3",["80"],"0$1",1]],"0"],"TT":["1","011","(?:[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-46-8]\\d{6})$|1","868$1",0,"868"],"TV":["688","00","(?:2|7\\d\\d|90)\\d{4}",[5,6,7],[["(\\d{2})(\\d{3})","$1 $2",["2"]],["(\\d{2})(\\d{4})","$1 $2",["90"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],"TW":["886","0(?:0[25-79]|19)","[2-689]\\d{8}|7\\d{9,10}|[2-8]\\d{7}|2\\d{6}",[7,8,9,10,11],[["(\\d{2})(\\d)(\\d{4})","$1 $2 $3",["202"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["[258]0"],"0$1"],["(\\d)(\\d{3,4})(\\d{4})","$1 $2 $3",["[23568]|4(?:0[02-48]|[1-47-9])|7[1-9]","[23568]|4(?:0[2-48]|[1-47-9])|(?:400|7)[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[49]"],"0$1"],["(\\d{2})(\\d{4})(\\d{4,5})","$1 $2 $3",["7"],"0$1"]],"0",0,0,0,0,0,0,0,"#"],"TZ":["255","00[056]","(?:[25-8]\\d|41|90)\\d{7}",[9],[["(\\d{3})(\\d{2})(\\d{4})","$1 $2 $3",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[24]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["5"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[67]"],"0$1"]],"0"],"UA":["380","00","[89]\\d{9}|[3-9]\\d{8}",[9,10],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6[12][29]|(?:3[1-8]|4[136-8]|5[12457]|6[49])2|(?:56|65)[24]","6[12][29]|(?:35|4[1378]|5[12457]|6[49])2|(?:56|65)[24]|(?:3[1-46-8]|46)2[013-9]"],"0$1"],["(\\d{4})(\\d{5})","$1 $2",["3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6[0135689]|7[4-6])|6(?:[12][3-7]|[459])","3[1-8]|4(?:[1367]|[45][6-9]|8[4-6])|5(?:[1-5]|6(?:[015689]|3[02389])|7[4-6])|6(?:[12][3-7]|[459])"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[3-7]|89|9[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["[89]"],"0$1"]],"0",0,0,0,0,0,0,"0~0"],"UG":["256","00[057]","800\\d{6}|(?:[29]0|[347]\\d)\\d{7}",[9],[["(\\d{4})(\\d{5})","$1 $2",["202","2024"],"0$1"],["(\\d{3})(\\d{6})","$1 $2",["[27-9]|4(?:6[45]|[7-9])"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[34]"],"0$1"]],"0"],"US":["1","011","[2-9]\\d{9}|3\\d{6}",[10],[["(\\d{3})(\\d{4})","$1-$2",["310"],0,1],["(\\d{3})(\\d{3})(\\d{4})","($1) $2-$3",["[2-9]"],0,1,"$1-$2-$3"]],"1",0,0,0,0,0,[["5056(?:[0-35-9]\\d|4[46])\\d{4}|(?:4722|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-589]|3[149]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-57-9]|1[02-9]|2[01356]|3[0-24679]|4[167]|5[0-2]|6[014]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|[34][016]|5[01679]|6[0-279]|78|8[0-29])|7(?:0[1-46-8]|1[2-9]|2[04-7]|3[1247]|4[037]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[068]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-389]|8[04-69]))[2-9]\\d{6}"],[""],["8(?:00|33|44|55|66|77|88)[2-9]\\d{6}"],["900[2-9]\\d{6}"],["52(?:3(?:[2-46-9][02-9]\\d|5(?:[02-46-9]\\d|5[0-46-9]))|4(?:[2-478][02-9]\\d|5(?:[034]\\d|2[024-9]|5[0-46-9])|6(?:0[1-9]|[2-9]\\d)|9(?:[05-9]\\d|2[0-5]|49)))\\d{4}|52[34][2-9]1[02-9]\\d{4}|5(?:00|2[125-9]|33|44|66|77|88)[2-9]\\d{6}"]]],"UY":["598","0(?:0|1[3-9]\\d)","(?:0004|4)\\d{9}|[1249]\\d{7}|(?:[49]\\d|80)\\d{5}",[7,8,10,13],[["(\\d{3})(\\d{4})","$1 $2",["405|8|90"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["9"],"0$1"],["(\\d{4})(\\d{4})","$1 $2",["[124]"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["4"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3 $4",["0"]]],"0",0,0,0,0,0,0,"00"," int. "],"UZ":["998","810","(?:33|[5-79]\\d|88)\\d{7}",[9],[["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[35-9]"],"8 $1"]],"8",0,0,0,0,0,0,"8~10"],"VA":["39","00","0\\d{5,10}|3[0-8]\\d{7,10}|55\\d{8}|8\\d{5}(?:\\d{2,4})?|(?:1\\d|39)\\d{7,8}",[6,7,8,9,10,11],0,0,0,0,0,0,"06698"],"VC":["1","011","(?:[58]\\d\\d|784|900)\\d{7}",[10],0,"1",0,"([2-7]\\d{6})$|1","784$1",0,"784"],"VE":["58","00","[68]00\\d{7}|(?:[24]\\d|[59]0)\\d{8}",[10],[["(\\d{3})(\\d{7})","$1-$2",["[24-689]"],"0$1"]],"0"],"VG":["1","011","(?:284|[58]\\d\\d|900)\\d{7}",[10],0,"1",0,"([2-578]\\d{6})$|1","284$1",0,"284"],"VI":["1","011","[58]\\d{9}|(?:34|90)0\\d{7}",[10],0,"1",0,"([2-9]\\d{6})$|1","340$1",0,"340"],"VN":["84","00","[12]\\d{9}|[135-9]\\d{8}|[16]\\d{7}|[16-8]\\d{6}",[7,8,9,10],[["(\\d{2})(\\d{5})","$1 $2",["80"],"0$1",1],["(\\d{4})(\\d{4,6})","$1 $2",["1"],0,1],["(\\d{2})(\\d{3})(\\d{2})(\\d{2})","$1 $2 $3 $4",["[69]"],"0$1",1],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[3578]"],"0$1",1],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["2[48]"],"0$1",1],["(\\d{3})(\\d{4})(\\d{3})","$1 $2 $3",["2"],"0$1",1]],"0"],"VU":["678","00","[57-9]\\d{6}|(?:[238]\\d|48)\\d{3}",[5,7],[["(\\d{3})(\\d{4})","$1 $2",["[57-9]"]]]],"WF":["681","00","(?:40|72)\\d{4}|8\\d{5}(?:\\d{3})?",[6,9],[["(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3",["[478]"]],["(\\d{3})(\\d{2})(\\d{2})(\\d{2})","$1 $2 $3 $4",["8"]]]],"WS":["685","0","(?:[2-6]|8\\d{5})\\d{4}|[78]\\d{6}|[68]\\d{5}",[5,6,7,10],[["(\\d{5})","$1",["[2-5]|6[1-9]"]],["(\\d{3})(\\d{3,7})","$1 $2",["[68]"]],["(\\d{2})(\\d{5})","$1 $2",["7"]]]],"XK":["383","00","[23]\\d{7,8}|(?:4\\d\\d|[89]00)\\d{5}",[8,9],[["(\\d{3})(\\d{5})","$1 $2",["[89]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3})","$1 $2 $3",["[2-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[23]"],"0$1"]],"0"],"YE":["967","00","(?:1|7\\d)\\d{7}|[1-7]\\d{6}",[7,8,9],[["(\\d)(\\d{3})(\\d{3,4})","$1 $2 $3",["[1-6]|7(?:[24-6]|8[0-7])"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["7"],"0$1"]],"0"],"YT":["262","00","(?:(?:(?:26|63)9|80\\d)\\d|9398)\\d{5}",[9],0,"0",0,0,0,0,"269|63|9398"],"ZA":["27","00","[1-79]\\d{8}|8\\d{4,9}",[5,6,7,8,9,10],[["(\\d{2})(\\d{3,4})","$1 $2",["8[1-4]"],"0$1"],["(\\d{2})(\\d{3})(\\d{2,3})","$1 $2 $3",["8[1-4]"],"0$1"],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["860"],"0$1"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["[1-9]"],"0$1"],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["8"],"0$1"]],"0"],"ZM":["260","00","800\\d{6}|(?:21|63|[79]\\d)\\d{7}",[9],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[28]"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["[79]"],"0$1"]],"0"],"ZW":["263","00","2(?:[0-57-9]\\d{6,8}|6[0-24-9]\\d{6,7})|[38]\\d{9}|[35-8]\\d{8}|[3-6]\\d{7}|[1-689]\\d{6}|[1-3569]\\d{5}|[1356]\\d{4}",[5,6,7,8,9,10],[["(\\d{3})(\\d{3,5})","$1 $2",["2(?:0[45]|2[278]|[49]8)|3(?:[09]8|17)|6(?:[29]8|37|75)|[23][78]|(?:33|5[15]|6[68])[78]"],"0$1"],["(\\d)(\\d{3})(\\d{2,4})","$1 $2 $3",["[49]"],"0$1"],["(\\d{3})(\\d{4})","$1 $2",["80"],"0$1"],["(\\d{2})(\\d{7})","$1 $2",["24|8[13-59]|(?:2[05-79]|39|5[45]|6[15-8])2","2(?:02[014]|4|[56]20|[79]2)|392|5(?:42|525)|6(?:[16-8]21|52[013])|8[13-59]"],"(0$1)"],["(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["7"],"0$1"],["(\\d{3})(\\d{3})(\\d{3,4})","$1 $2 $3",["2(?:1[39]|2[0157]|[378]|[56][14])|3(?:12|29)","2(?:1[39]|2[0157]|[378]|[56][14])|3(?:123|29)"],"0$1"],["(\\d{4})(\\d{6})","$1 $2",["8"],"0$1"],["(\\d{2})(\\d{3,5})","$1 $2",["1|2(?:0[0-36-9]|12|29|[56])|3(?:1[0-689]|[24-6])|5(?:[0236-9]|1[2-4])|6(?:[013-59]|7[0-46-9])|(?:33|55|6[68])[0-69]|(?:29|3[09]|62)[0-79]"],"0$1"],["(\\d{2})(\\d{3})(\\d{3,4})","$1 $2 $3",["29[013-9]|39|54"],"0$1"],["(\\d{4})(\\d{3,5})","$1 $2",["(?:25|54)8","258|5483"],"0$1"]],"0"]},"nonGeographic":{"800":["800",0,"(?:00|[1-9]\\d)\\d{6}",[8],[["(\\d{4})(\\d{4})","$1 $2",["\\d"]]],0,0,0,0,0,0,[0,0,["(?:00|[1-9]\\d)\\d{6}"]]],"808":["808",0,"[1-9]\\d{7}",[8],[["(\\d{4})(\\d{4})","$1 $2",["[1-9]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,0,["[1-9]\\d{7}"]]],"870":["870",0,"7\\d{11}|[35-7]\\d{8}",[9,12],[["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["[35-7]"]]],0,0,0,0,0,0,[0,["(?:[356]|774[45])\\d{8}|7[6-8]\\d{7}"]]],"878":["878",0,"10\\d{10}",[12],[["(\\d{2})(\\d{5})(\\d{5})","$1 $2 $3",["1"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["10\\d{10}"]]],"881":["881",0,"[0-36-9]\\d{8}",[9],[["(\\d)(\\d{3})(\\d{5})","$1 $2 $3",["[0-36-9]"]]],0,0,0,0,0,0,[0,["[0-36-9]\\d{8}"]]],"882":["882",0,"[13]\\d{6}(?:\\d{2,5})?|[19]\\d{7}|(?:[25]\\d\\d|4)\\d{7}(?:\\d{2})?",[7,8,9,10,11,12],[["(\\d{2})(\\d{5})","$1 $2",["16|342"]],["(\\d{2})(\\d{6})","$1 $2",["49"]],["(\\d{2})(\\d{2})(\\d{4})","$1 $2 $3",["1[36]|9"]],["(\\d{2})(\\d{4})(\\d{3})","$1 $2 $3",["3[23]"]],["(\\d{2})(\\d{3,4})(\\d{4})","$1 $2 $3",["16"]],["(\\d{2})(\\d{4})(\\d{4})","$1 $2 $3",["10|23|3(?:[15]|4[57])|4|51"]],["(\\d{3})(\\d{4})(\\d{4})","$1 $2 $3",["34"]],["(\\d{2})(\\d{4,5})(\\d{5})","$1 $2 $3",["[1-35]"]]],0,0,0,0,0,0,[0,["342\\d{4}|(?:337|49)\\d{6}|(?:3(?:2|47|7\\d{3})|50\\d{3})\\d{7}",[7,8,9,10,12]],0,0,0,0,0,0,["1(?:3(?:0[0347]|[13][0139]|2[035]|4[013568]|6[0459]|7[06]|8[15-8]|9[0689])\\d{4}|6\\d{5,10})|(?:345\\d|9[89])\\d{6}|(?:10|2(?:3|85\\d)|3(?:[15]|[69]\\d\\d)|4[15-8]|51)\\d{8}"]]],"883":["883",0,"(?:[1-4]\\d|51)\\d{6,10}",[8,9,10,11,12],[["(\\d{3})(\\d{3})(\\d{2,8})","$1 $2 $3",["[14]|2[24-689]|3[02-689]|51[24-9]"]],["(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["510"]],["(\\d{3})(\\d{3})(\\d{4})","$1 $2 $3",["21"]],["(\\d{4})(\\d{4})(\\d{4})","$1 $2 $3",["51[13]"]],["(\\d{3})(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3 $4",["[235]"]]],0,0,0,0,0,0,[0,0,0,0,0,0,0,0,["(?:2(?:00\\d\\d|10)|(?:370[1-9]|51\\d0)\\d)\\d{7}|51(?:00\\d{5}|[24-9]0\\d{4,7})|(?:1[013-79]|2[24-689]|3[02-689]|4[0-4])0\\d{5,9}"]]],"888":["888",0,"\\d{11}",[11],[["(\\d{3})(\\d{3})(\\d{5})","$1 $2 $3"]],0,0,0,0,0,0,[0,0,0,0,0,0,["\\d{11}"]]],"979":["979",0,"[1359]\\d{8}",[9],[["(\\d)(\\d{4})(\\d{4})","$1 $2 $3",["[1359]"]]],0,0,0,0,0,0,[0,0,0,["[1359]\\d{8}"]]]}};
221
-
222
- // Importing from a ".js" file is a workaround for Node.js "ES Modules"
223
-
224
- function withMetadataArgument(func, _arguments) {
225
- var args = Array.prototype.slice.call(_arguments);
226
- args.push(metadata);
227
- return func.apply(this, args)
228
- }
229
-
230
- function _typeof$2(obj) { "@babel/helpers - typeof"; return _typeof$2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$2(obj); }
231
-
232
- function _defineProperties$2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
233
-
234
- function _createClass$2(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$2(Constructor.prototype, protoProps); if (staticProps) _defineProperties$2(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
235
-
236
- function _classCallCheck$2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
237
-
238
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
239
-
240
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
241
-
242
- function _possibleConstructorReturn(self, call) { if (call && (_typeof$2(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
243
-
244
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
245
-
246
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
247
-
248
- function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
249
-
250
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
251
-
252
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
253
-
254
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
255
-
256
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
257
-
258
- // https://stackoverflow.com/a/46971044/970769
259
- // "Breaking changes in Typescript 2.1"
260
- // "Extending built-ins like Error, Array, and Map may no longer work."
261
- // "As a recommendation, you can manually adjust the prototype immediately after any super(...) calls."
262
- // https://github.com/Microsoft/TypeScript-wiki/blob/main/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work
263
- var ParseError = /*#__PURE__*/function (_Error) {
264
- _inherits(ParseError, _Error);
265
-
266
- var _super = _createSuper(ParseError);
267
-
268
- function ParseError(code) {
269
- var _this;
270
-
271
- _classCallCheck$2(this, ParseError);
272
-
273
- _this = _super.call(this, code); // Set the prototype explicitly.
274
- // Any subclass of FooError will have to manually set the prototype as well.
275
-
276
- Object.setPrototypeOf(_assertThisInitialized(_this), ParseError.prototype);
277
- _this.name = _this.constructor.name;
278
- return _this;
279
- }
280
-
281
- return _createClass$2(ParseError);
282
- }( /*#__PURE__*/_wrapNativeSuper(Error));
283
-
284
- // The minimum length of the national significant number.
285
- var MIN_LENGTH_FOR_NSN = 2; // The ITU says the maximum length should be 15,
286
- // but one can find longer numbers in Germany.
287
-
288
- var MAX_LENGTH_FOR_NSN = 17; // The maximum length of the country calling code.
289
-
290
- var MAX_LENGTH_COUNTRY_CODE = 3; // Digits accepted in phone numbers
291
- // (ascii, fullwidth, arabic-indic, and eastern arabic digits).
292
-
293
- var VALID_DIGITS = "0-9\uFF10-\uFF19\u0660-\u0669\u06F0-\u06F9"; // `DASHES` will be right after the opening square bracket of the "character class"
294
-
295
- var DASHES = "-\u2010-\u2015\u2212\u30FC\uFF0D";
296
- var SLASHES = "\uFF0F/";
297
- var DOTS = "\uFF0E.";
298
- var WHITESPACE = " \xA0\xAD\u200B\u2060\u3000";
299
- var BRACKETS = "()\uFF08\uFF09\uFF3B\uFF3D\\[\\]"; // export const OPENING_BRACKETS = '(\uFF08\uFF3B\\\['
300
-
301
- var TILDES = "~\u2053\u223C\uFF5E"; // Regular expression of acceptable punctuation found in phone numbers. This
302
- // excludes punctuation found as a leading character only. This consists of dash
303
- // characters, white space characters, full stops, slashes, square brackets,
304
- // parentheses and tildes. Full-width variants are also present.
305
-
306
- var VALID_PUNCTUATION = "".concat(DASHES).concat(SLASHES).concat(DOTS).concat(WHITESPACE).concat(BRACKETS).concat(TILDES);
307
- var PLUS_CHARS = "+\uFF0B"; // const LEADING_PLUS_CHARS_PATTERN = new RegExp('^[' + PLUS_CHARS + ']+')
308
-
309
- // Copy-pasted from:
310
- // https://github.com/substack/semver-compare/blob/master/index.js
311
- //
312
- // Inlining this function because some users reported issues with
313
- // importing from `semver-compare` in a browser with ES6 "native" modules.
314
- //
315
- // Fixes `semver-compare` not being able to compare versions with alpha/beta/etc "tags".
316
- // https://github.com/catamphetamine/libphonenumber-js/issues/381
317
- function compare (a, b) {
318
- a = a.split('-');
319
- b = b.split('-');
320
- var pa = a[0].split('.');
321
- var pb = b[0].split('.');
322
-
323
- for (var i = 0; i < 3; i++) {
324
- var na = Number(pa[i]);
325
- var nb = Number(pb[i]);
326
- if (na > nb) return 1;
327
- if (nb > na) return -1;
328
- if (!isNaN(na) && isNaN(nb)) return 1;
329
- if (isNaN(na) && !isNaN(nb)) return -1;
330
- }
331
-
332
- if (a[1] && b[1]) {
333
- return a[1] > b[1] ? 1 : a[1] < b[1] ? -1 : 0;
334
- }
335
-
336
- return !a[1] && b[1] ? 1 : a[1] && !b[1] ? -1 : 0;
337
- }
338
-
339
- function _typeof$1(obj) { "@babel/helpers - typeof"; return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof$1(obj); }
340
-
341
- function _classCallCheck$1(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
342
-
343
- function _defineProperties$1(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
344
-
345
- function _createClass$1(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties$1(Constructor.prototype, protoProps); if (staticProps) _defineProperties$1(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
346
-
347
- var V3 = '1.2.0'; // Moved `001` country code to "nonGeographic" section of metadata.
348
-
349
- var V4 = '1.7.35';
350
- var DEFAULT_EXT_PREFIX = ' ext. ';
351
- var CALLING_CODE_REG_EXP = /^\d+$/;
352
- /**
353
- * See: https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md
354
- */
355
-
356
- var Metadata = /*#__PURE__*/function () {
357
- function Metadata(metadata) {
358
- _classCallCheck$1(this, Metadata);
359
-
360
- validateMetadata(metadata);
361
- this.metadata = metadata;
362
- setVersion.call(this, metadata);
363
- }
364
-
365
- _createClass$1(Metadata, [{
366
- key: "getCountries",
367
- value: function getCountries() {
368
- return Object.keys(this.metadata.countries).filter(function (_) {
369
- return _ !== '001';
370
- });
371
- }
372
- }, {
373
- key: "getCountryMetadata",
374
- value: function getCountryMetadata(countryCode) {
375
- return this.metadata.countries[countryCode];
376
- }
377
- }, {
378
- key: "nonGeographic",
379
- value: function nonGeographic() {
380
- if (this.v1 || this.v2 || this.v3) return; // `nonGeographical` was a typo.
381
- // It's present in metadata generated from `1.7.35` to `1.7.37`.
382
- // The test case could be found by searching for "nonGeographical".
383
-
384
- return this.metadata.nonGeographic || this.metadata.nonGeographical;
385
- }
386
- }, {
387
- key: "hasCountry",
388
- value: function hasCountry(country) {
389
- return this.getCountryMetadata(country) !== undefined;
390
- }
391
- }, {
392
- key: "hasCallingCode",
393
- value: function hasCallingCode(callingCode) {
394
- if (this.getCountryCodesForCallingCode(callingCode)) {
395
- return true;
396
- }
397
-
398
- if (this.nonGeographic()) {
399
- if (this.nonGeographic()[callingCode]) {
400
- return true;
401
- }
402
- } else {
403
- // A hacky workaround for old custom metadata (generated before V4).
404
- var countryCodes = this.countryCallingCodes()[callingCode];
405
-
406
- if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
407
- return true;
408
- }
409
- }
410
- }
411
- }, {
412
- key: "isNonGeographicCallingCode",
413
- value: function isNonGeographicCallingCode(callingCode) {
414
- if (this.nonGeographic()) {
415
- return this.nonGeographic()[callingCode] ? true : false;
416
- } else {
417
- return this.getCountryCodesForCallingCode(callingCode) ? false : true;
418
- }
419
- } // Deprecated.
420
-
421
- }, {
422
- key: "country",
423
- value: function country(countryCode) {
424
- return this.selectNumberingPlan(countryCode);
425
- }
426
- }, {
427
- key: "selectNumberingPlan",
428
- value: function selectNumberingPlan(countryCode, callingCode) {
429
- // Supports just passing `callingCode` as the first argument.
430
- if (countryCode && CALLING_CODE_REG_EXP.test(countryCode)) {
431
- callingCode = countryCode;
432
- countryCode = null;
433
- }
434
-
435
- if (countryCode && countryCode !== '001') {
436
- if (!this.hasCountry(countryCode)) {
437
- throw new Error("Unknown country: ".concat(countryCode));
438
- }
439
-
440
- this.numberingPlan = new NumberingPlan(this.getCountryMetadata(countryCode), this);
441
- } else if (callingCode) {
442
- if (!this.hasCallingCode(callingCode)) {
443
- throw new Error("Unknown calling code: ".concat(callingCode));
444
- }
445
-
446
- this.numberingPlan = new NumberingPlan(this.getNumberingPlanMetadata(callingCode), this);
447
- } else {
448
- this.numberingPlan = undefined;
449
- }
450
-
451
- return this;
452
- }
453
- }, {
454
- key: "getCountryCodesForCallingCode",
455
- value: function getCountryCodesForCallingCode(callingCode) {
456
- var countryCodes = this.countryCallingCodes()[callingCode];
457
-
458
- if (countryCodes) {
459
- // Metadata before V4 included "non-geographic entity" calling codes
460
- // inside `country_calling_codes` (for example, `"881":["001"]`).
461
- // Now the semantics of `country_calling_codes` has changed:
462
- // it's specifically for "countries" now.
463
- // Older versions of custom metadata will simply skip parsing
464
- // "non-geographic entity" phone numbers with new versions
465
- // of this library: it's not considered a bug,
466
- // because such numbers are extremely rare,
467
- // and developers extremely rarely use custom metadata.
468
- if (countryCodes.length === 1 && countryCodes[0].length === 3) {
469
- return;
470
- }
471
-
472
- return countryCodes;
473
- }
474
- }
475
- }, {
476
- key: "getCountryCodeForCallingCode",
477
- value: function getCountryCodeForCallingCode(callingCode) {
478
- var countryCodes = this.getCountryCodesForCallingCode(callingCode);
479
-
480
- if (countryCodes) {
481
- return countryCodes[0];
482
- }
483
- }
484
- }, {
485
- key: "getNumberingPlanMetadata",
486
- value: function getNumberingPlanMetadata(callingCode) {
487
- var countryCode = this.getCountryCodeForCallingCode(callingCode);
488
-
489
- if (countryCode) {
490
- return this.getCountryMetadata(countryCode);
491
- }
492
-
493
- if (this.nonGeographic()) {
494
- var metadata = this.nonGeographic()[callingCode];
495
-
496
- if (metadata) {
497
- return metadata;
498
- }
499
- } else {
500
- // A hacky workaround for old custom metadata (generated before V4).
501
- // In that metadata, there was no concept of "non-geographic" metadata
502
- // so metadata for `001` country code was stored along with other countries.
503
- // The test case can be found by searching for:
504
- // "should work around `nonGeographic` metadata not existing".
505
- var countryCodes = this.countryCallingCodes()[callingCode];
506
-
507
- if (countryCodes && countryCodes.length === 1 && countryCodes[0] === '001') {
508
- return this.metadata.countries['001'];
509
- }
510
- }
511
- } // Deprecated.
512
-
513
- }, {
514
- key: "countryCallingCode",
515
- value: function countryCallingCode() {
516
- return this.numberingPlan.callingCode();
517
- } // Deprecated.
518
-
519
- }, {
520
- key: "IDDPrefix",
521
- value: function IDDPrefix() {
522
- return this.numberingPlan.IDDPrefix();
523
- } // Deprecated.
524
-
525
- }, {
526
- key: "defaultIDDPrefix",
527
- value: function defaultIDDPrefix() {
528
- return this.numberingPlan.defaultIDDPrefix();
529
- } // Deprecated.
530
-
531
- }, {
532
- key: "nationalNumberPattern",
533
- value: function nationalNumberPattern() {
534
- return this.numberingPlan.nationalNumberPattern();
535
- } // Deprecated.
536
-
537
- }, {
538
- key: "possibleLengths",
539
- value: function possibleLengths() {
540
- return this.numberingPlan.possibleLengths();
541
- } // Deprecated.
542
-
543
- }, {
544
- key: "formats",
545
- value: function formats() {
546
- return this.numberingPlan.formats();
547
- } // Deprecated.
548
-
549
- }, {
550
- key: "nationalPrefixForParsing",
551
- value: function nationalPrefixForParsing() {
552
- return this.numberingPlan.nationalPrefixForParsing();
553
- } // Deprecated.
554
-
555
- }, {
556
- key: "nationalPrefixTransformRule",
557
- value: function nationalPrefixTransformRule() {
558
- return this.numberingPlan.nationalPrefixTransformRule();
559
- } // Deprecated.
560
-
561
- }, {
562
- key: "leadingDigits",
563
- value: function leadingDigits() {
564
- return this.numberingPlan.leadingDigits();
565
- } // Deprecated.
566
-
567
- }, {
568
- key: "hasTypes",
569
- value: function hasTypes() {
570
- return this.numberingPlan.hasTypes();
571
- } // Deprecated.
572
-
573
- }, {
574
- key: "type",
575
- value: function type(_type) {
576
- return this.numberingPlan.type(_type);
577
- } // Deprecated.
578
-
579
- }, {
580
- key: "ext",
581
- value: function ext() {
582
- return this.numberingPlan.ext();
583
- }
584
- }, {
585
- key: "countryCallingCodes",
586
- value: function countryCallingCodes() {
587
- if (this.v1) return this.metadata.country_phone_code_to_countries;
588
- return this.metadata.country_calling_codes;
589
- } // Deprecated.
590
-
591
- }, {
592
- key: "chooseCountryByCountryCallingCode",
593
- value: function chooseCountryByCountryCallingCode(callingCode) {
594
- return this.selectNumberingPlan(callingCode);
595
- }
596
- }, {
597
- key: "hasSelectedNumberingPlan",
598
- value: function hasSelectedNumberingPlan() {
599
- return this.numberingPlan !== undefined;
600
- }
601
- }]);
602
-
603
- return Metadata;
604
- }();
605
-
606
- var NumberingPlan = /*#__PURE__*/function () {
607
- function NumberingPlan(metadata, globalMetadataObject) {
608
- _classCallCheck$1(this, NumberingPlan);
609
-
610
- this.globalMetadataObject = globalMetadataObject;
611
- this.metadata = metadata;
612
- setVersion.call(this, globalMetadataObject.metadata);
613
- }
614
-
615
- _createClass$1(NumberingPlan, [{
616
- key: "callingCode",
617
- value: function callingCode() {
618
- return this.metadata[0];
619
- } // Formatting information for regions which share
620
- // a country calling code is contained by only one region
621
- // for performance reasons. For example, for NANPA region
622
- // ("North American Numbering Plan Administration",
623
- // which includes USA, Canada, Cayman Islands, Bahamas, etc)
624
- // it will be contained in the metadata for `US`.
625
-
626
- }, {
627
- key: "getDefaultCountryMetadataForRegion",
628
- value: function getDefaultCountryMetadataForRegion() {
629
- return this.globalMetadataObject.getNumberingPlanMetadata(this.callingCode());
630
- } // Is always present.
631
-
632
- }, {
633
- key: "IDDPrefix",
634
- value: function IDDPrefix() {
635
- if (this.v1 || this.v2) return;
636
- return this.metadata[1];
637
- } // Is only present when a country supports multiple IDD prefixes.
638
-
639
- }, {
640
- key: "defaultIDDPrefix",
641
- value: function defaultIDDPrefix() {
642
- if (this.v1 || this.v2) return;
643
- return this.metadata[12];
644
- }
645
- }, {
646
- key: "nationalNumberPattern",
647
- value: function nationalNumberPattern() {
648
- if (this.v1 || this.v2) return this.metadata[1];
649
- return this.metadata[2];
650
- } // "possible length" data is always present in Google's metadata.
651
-
652
- }, {
653
- key: "possibleLengths",
654
- value: function possibleLengths() {
655
- if (this.v1) return;
656
- return this.metadata[this.v2 ? 2 : 3];
657
- }
658
- }, {
659
- key: "_getFormats",
660
- value: function _getFormats(metadata) {
661
- return metadata[this.v1 ? 2 : this.v2 ? 3 : 4];
662
- } // For countries of the same region (e.g. NANPA)
663
- // formats are all stored in the "main" country for that region.
664
- // E.g. "RU" and "KZ", "US" and "CA".
665
-
666
- }, {
667
- key: "formats",
668
- value: function formats() {
669
- var _this = this;
670
-
671
- var formats = this._getFormats(this.metadata) || this._getFormats(this.getDefaultCountryMetadataForRegion()) || [];
672
- return formats.map(function (_) {
673
- return new Format(_, _this);
674
- });
675
- }
676
- }, {
677
- key: "nationalPrefix",
678
- value: function nationalPrefix() {
679
- return this.metadata[this.v1 ? 3 : this.v2 ? 4 : 5];
680
- }
681
- }, {
682
- key: "_getNationalPrefixFormattingRule",
683
- value: function _getNationalPrefixFormattingRule(metadata) {
684
- return metadata[this.v1 ? 4 : this.v2 ? 5 : 6];
685
- } // For countries of the same region (e.g. NANPA)
686
- // national prefix formatting rule is stored in the "main" country for that region.
687
- // E.g. "RU" and "KZ", "US" and "CA".
688
-
689
- }, {
690
- key: "nationalPrefixFormattingRule",
691
- value: function nationalPrefixFormattingRule() {
692
- return this._getNationalPrefixFormattingRule(this.metadata) || this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion());
693
- }
694
- }, {
695
- key: "_nationalPrefixForParsing",
696
- value: function _nationalPrefixForParsing() {
697
- return this.metadata[this.v1 ? 5 : this.v2 ? 6 : 7];
698
- }
699
- }, {
700
- key: "nationalPrefixForParsing",
701
- value: function nationalPrefixForParsing() {
702
- // If `national_prefix_for_parsing` is not set explicitly,
703
- // then infer it from `national_prefix` (if any)
704
- return this._nationalPrefixForParsing() || this.nationalPrefix();
705
- }
706
- }, {
707
- key: "nationalPrefixTransformRule",
708
- value: function nationalPrefixTransformRule() {
709
- return this.metadata[this.v1 ? 6 : this.v2 ? 7 : 8];
710
- }
711
- }, {
712
- key: "_getNationalPrefixIsOptionalWhenFormatting",
713
- value: function _getNationalPrefixIsOptionalWhenFormatting() {
714
- return !!this.metadata[this.v1 ? 7 : this.v2 ? 8 : 9];
715
- } // For countries of the same region (e.g. NANPA)
716
- // "national prefix is optional when formatting" flag is
717
- // stored in the "main" country for that region.
718
- // E.g. "RU" and "KZ", "US" and "CA".
719
-
720
- }, {
721
- key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
722
- value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
723
- return this._getNationalPrefixIsOptionalWhenFormatting(this.metadata) || this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion());
724
- }
725
- }, {
726
- key: "leadingDigits",
727
- value: function leadingDigits() {
728
- return this.metadata[this.v1 ? 8 : this.v2 ? 9 : 10];
729
- }
730
- }, {
731
- key: "types",
732
- value: function types() {
733
- return this.metadata[this.v1 ? 9 : this.v2 ? 10 : 11];
734
- }
735
- }, {
736
- key: "hasTypes",
737
- value: function hasTypes() {
738
- // Versions 1.2.0 - 1.2.4: can be `[]`.
739
-
740
- /* istanbul ignore next */
741
- if (this.types() && this.types().length === 0) {
742
- return false;
743
- } // Versions <= 1.2.4: can be `undefined`.
744
- // Version >= 1.2.5: can be `0`.
745
-
746
-
747
- return !!this.types();
748
- }
749
- }, {
750
- key: "type",
751
- value: function type(_type2) {
752
- if (this.hasTypes() && getType(this.types(), _type2)) {
753
- return new Type(getType(this.types(), _type2), this);
754
- }
755
- }
756
- }, {
757
- key: "ext",
758
- value: function ext() {
759
- if (this.v1 || this.v2) return DEFAULT_EXT_PREFIX;
760
- return this.metadata[13] || DEFAULT_EXT_PREFIX;
761
- }
762
- }]);
763
-
764
- return NumberingPlan;
765
- }();
766
-
767
- var Format = /*#__PURE__*/function () {
768
- function Format(format, metadata) {
769
- _classCallCheck$1(this, Format);
770
-
771
- this._format = format;
772
- this.metadata = metadata;
773
- }
774
-
775
- _createClass$1(Format, [{
776
- key: "pattern",
777
- value: function pattern() {
778
- return this._format[0];
779
- }
780
- }, {
781
- key: "format",
782
- value: function format() {
783
- return this._format[1];
784
- }
785
- }, {
786
- key: "leadingDigitsPatterns",
787
- value: function leadingDigitsPatterns() {
788
- return this._format[2] || [];
789
- }
790
- }, {
791
- key: "nationalPrefixFormattingRule",
792
- value: function nationalPrefixFormattingRule() {
793
- return this._format[3] || this.metadata.nationalPrefixFormattingRule();
794
- }
795
- }, {
796
- key: "nationalPrefixIsOptionalWhenFormattingInNationalFormat",
797
- value: function nationalPrefixIsOptionalWhenFormattingInNationalFormat() {
798
- return !!this._format[4] || this.metadata.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
799
- }
800
- }, {
801
- key: "nationalPrefixIsMandatoryWhenFormattingInNationalFormat",
802
- value: function nationalPrefixIsMandatoryWhenFormattingInNationalFormat() {
803
- // National prefix is omitted if there's no national prefix formatting rule
804
- // set for this country, or when the national prefix formatting rule
805
- // contains no national prefix itself, or when this rule is set but
806
- // national prefix is optional for this phone number format
807
- // (and it is not enforced explicitly)
808
- return this.usesNationalPrefix() && !this.nationalPrefixIsOptionalWhenFormattingInNationalFormat();
809
- } // Checks whether national prefix formatting rule contains national prefix.
810
-
811
- }, {
812
- key: "usesNationalPrefix",
813
- value: function usesNationalPrefix() {
814
- return this.nationalPrefixFormattingRule() && // Check that national prefix formatting rule is not a "dummy" one.
815
- !FIRST_GROUP_ONLY_PREFIX_PATTERN.test(this.nationalPrefixFormattingRule()) // In compressed metadata, `this.nationalPrefixFormattingRule()` is `0`
816
- // when `national_prefix_formatting_rule` is not present.
817
- // So, `true` or `false` are returned explicitly here, so that
818
- // `0` number isn't returned.
819
- ? true : false;
820
- }
821
- }, {
822
- key: "internationalFormat",
823
- value: function internationalFormat() {
824
- return this._format[5] || this.format();
825
- }
826
- }]);
827
-
828
- return Format;
829
- }();
830
- /**
831
- * A pattern that is used to determine if the national prefix formatting rule
832
- * has the first group only, i.e., does not start with the national prefix.
833
- * Note that the pattern explicitly allows for unbalanced parentheses.
834
- */
835
-
836
-
837
- var FIRST_GROUP_ONLY_PREFIX_PATTERN = /^\(?\$1\)?$/;
838
-
839
- var Type = /*#__PURE__*/function () {
840
- function Type(type, metadata) {
841
- _classCallCheck$1(this, Type);
842
-
843
- this.type = type;
844
- this.metadata = metadata;
845
- }
846
-
847
- _createClass$1(Type, [{
848
- key: "pattern",
849
- value: function pattern() {
850
- if (this.metadata.v1) return this.type;
851
- return this.type[0];
852
- }
853
- }, {
854
- key: "possibleLengths",
855
- value: function possibleLengths() {
856
- if (this.metadata.v1) return;
857
- return this.type[1] || this.metadata.possibleLengths();
858
- }
859
- }]);
860
-
861
- return Type;
862
- }();
863
-
864
- function getType(types, type) {
865
- switch (type) {
866
- case 'FIXED_LINE':
867
- return types[0];
868
-
869
- case 'MOBILE':
870
- return types[1];
871
-
872
- case 'TOLL_FREE':
873
- return types[2];
874
-
875
- case 'PREMIUM_RATE':
876
- return types[3];
877
-
878
- case 'PERSONAL_NUMBER':
879
- return types[4];
880
-
881
- case 'VOICEMAIL':
882
- return types[5];
883
-
884
- case 'UAN':
885
- return types[6];
886
-
887
- case 'PAGER':
888
- return types[7];
889
-
890
- case 'VOIP':
891
- return types[8];
892
-
893
- case 'SHARED_COST':
894
- return types[9];
895
- }
896
- }
897
-
898
- function validateMetadata(metadata) {
899
- if (!metadata) {
900
- throw new Error('[libphonenumber-js] `metadata` argument not passed. Check your arguments.');
901
- } // `country_phone_code_to_countries` was renamed to
902
- // `country_calling_codes` in `1.0.18`.
903
-
904
-
905
- if (!is_object(metadata) || !is_object(metadata.countries)) {
906
- throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` child object property. Got ".concat(is_object(metadata) ? 'an object of shape: { ' + Object.keys(metadata).join(', ') + ' }' : 'a ' + type_of(metadata) + ': ' + metadata, "."));
907
- }
908
- } // Babel transforms `typeof` into some "branches"
909
- // so istanbul will show this as "branch not covered".
910
-
911
- /* istanbul ignore next */
912
-
913
- var is_object = function is_object(_) {
914
- return _typeof$1(_) === 'object';
915
- }; // Babel transforms `typeof` into some "branches"
916
- // so istanbul will show this as "branch not covered".
917
-
918
- /* istanbul ignore next */
919
-
920
-
921
- var type_of = function type_of(_) {
922
- return _typeof$1(_);
923
- };
924
- /**
925
- * Returns "country calling code" for a country.
926
- * Throws an error if the country doesn't exist or isn't supported by this library.
927
- * @param {string} country
928
- * @param {object} metadata
929
- * @return {string}
930
- * @example
931
- * // Returns "44"
932
- * getCountryCallingCode("GB")
933
- */
934
-
935
- function getCountryCallingCode(country, metadata) {
936
- metadata = new Metadata(metadata);
937
-
938
- if (metadata.hasCountry(country)) {
939
- return metadata.country(country).countryCallingCode();
940
- }
941
-
942
- throw new Error("Unknown country: ".concat(country));
943
- }
944
- function isSupportedCountry(country, metadata) {
945
- // metadata = new Metadata(metadata)
946
- // return metadata.hasCountry(country)
947
- return metadata.countries[country] !== undefined;
948
- }
949
-
950
- function setVersion(metadata) {
951
- var version = metadata.version;
952
-
953
- if (typeof version === 'number') {
954
- this.v1 = version === 1;
955
- this.v2 = version === 2;
956
- this.v3 = version === 3;
957
- this.v4 = version === 4;
958
- } else {
959
- if (!version) {
960
- this.v1 = true;
961
- } else if (compare(version, V3) === -1) {
962
- this.v2 = true;
963
- } else if (compare(version, V4) === -1) {
964
- this.v3 = true;
965
- } else {
966
- this.v4 = true;
967
- }
968
- }
969
- } // const ISO_COUNTRY_CODE = /^[A-Z]{2}$/
970
- // function isCountryCode(countryCode) {
971
- // return ISO_COUNTRY_CODE.test(countryCodeOrCountryCallingCode)
972
- // }
973
-
974
- var RFC3966_EXTN_PREFIX = ';ext=';
975
- /**
976
- * Helper method for constructing regular expressions for parsing. Creates
977
- * an expression that captures up to max_length digits.
978
- * @return {string} RegEx pattern to capture extension digits.
979
- */
980
-
981
- var getExtensionDigitsPattern = function getExtensionDigitsPattern(maxLength) {
982
- return "([".concat(VALID_DIGITS, "]{1,").concat(maxLength, "})");
983
- };
984
- /**
985
- * Helper initialiser method to create the regular-expression pattern to match
986
- * extensions.
987
- * Copy-pasted from Google's `libphonenumber`:
988
- * https://github.com/google/libphonenumber/blob/55b2646ec9393f4d3d6661b9c82ef9e258e8b829/javascript/i18n/phonenumbers/phonenumberutil.js#L759-L766
989
- * @return {string} RegEx pattern to capture extensions.
990
- */
991
-
992
-
993
- function createExtensionPattern(purpose) {
994
- // We cap the maximum length of an extension based on the ambiguity of the way
995
- // the extension is prefixed. As per ITU, the officially allowed length for
996
- // extensions is actually 40, but we don't support this since we haven't seen real
997
- // examples and this introduces many false interpretations as the extension labels
998
- // are not standardized.
999
-
1000
- /** @type {string} */
1001
- var extLimitAfterExplicitLabel = '20';
1002
- /** @type {string} */
1003
-
1004
- var extLimitAfterLikelyLabel = '15';
1005
- /** @type {string} */
1006
-
1007
- var extLimitAfterAmbiguousChar = '9';
1008
- /** @type {string} */
1009
-
1010
- var extLimitWhenNotSure = '6';
1011
- /** @type {string} */
1012
-
1013
- var possibleSeparatorsBetweenNumberAndExtLabel = "[ \xA0\\t,]*"; // Optional full stop (.) or colon, followed by zero or more spaces/tabs/commas.
1014
-
1015
- /** @type {string} */
1016
-
1017
- var possibleCharsAfterExtLabel = "[:\\.\uFF0E]?[ \xA0\\t,-]*";
1018
- /** @type {string} */
1019
-
1020
- var optionalExtnSuffix = "#?"; // Here the extension is called out in more explicit way, i.e mentioning it obvious
1021
- // patterns like "ext.".
1022
-
1023
- /** @type {string} */
1024
-
1025
- var explicitExtLabels = "(?:e?xt(?:ensi(?:o\u0301?|\xF3))?n?|\uFF45?\uFF58\uFF54\uFF4E?|\u0434\u043E\u0431|anexo)"; // One-character symbols that can be used to indicate an extension, and less
1026
- // commonly used or more ambiguous extension labels.
1027
-
1028
- /** @type {string} */
1029
-
1030
- var ambiguousExtLabels = "(?:[x\uFF58#\uFF03~\uFF5E]|int|\uFF49\uFF4E\uFF54)"; // When extension is not separated clearly.
1031
-
1032
- /** @type {string} */
1033
-
1034
- var ambiguousSeparator = "[- ]+"; // This is the same as possibleSeparatorsBetweenNumberAndExtLabel, but not matching
1035
- // comma as extension label may have it.
1036
-
1037
- /** @type {string} */
1038
-
1039
- var possibleSeparatorsNumberExtLabelNoComma = "[ \xA0\\t]*"; // ",," is commonly used for auto dialling the extension when connected. First
1040
- // comma is matched through possibleSeparatorsBetweenNumberAndExtLabel, so we do
1041
- // not repeat it here. Semi-colon works in Iphone and Android also to pop up a
1042
- // button with the extension number following.
1043
-
1044
- /** @type {string} */
1045
-
1046
- var autoDiallingAndExtLabelsFound = "(?:,{2}|;)";
1047
- /** @type {string} */
1048
-
1049
- var rfcExtn = RFC3966_EXTN_PREFIX + getExtensionDigitsPattern(extLimitAfterExplicitLabel);
1050
- /** @type {string} */
1051
-
1052
- var explicitExtn = possibleSeparatorsBetweenNumberAndExtLabel + explicitExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterExplicitLabel) + optionalExtnSuffix;
1053
- /** @type {string} */
1054
-
1055
- var ambiguousExtn = possibleSeparatorsBetweenNumberAndExtLabel + ambiguousExtLabels + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix;
1056
- /** @type {string} */
1057
-
1058
- var americanStyleExtnWithSuffix = ambiguousSeparator + getExtensionDigitsPattern(extLimitWhenNotSure) + "#";
1059
- /** @type {string} */
1060
-
1061
- var autoDiallingExtn = possibleSeparatorsNumberExtLabelNoComma + autoDiallingAndExtLabelsFound + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterLikelyLabel) + optionalExtnSuffix;
1062
- /** @type {string} */
1063
-
1064
- var onlyCommasExtn = possibleSeparatorsNumberExtLabelNoComma + "(?:,)+" + possibleCharsAfterExtLabel + getExtensionDigitsPattern(extLimitAfterAmbiguousChar) + optionalExtnSuffix; // The first regular expression covers RFC 3966 format, where the extension is added
1065
- // using ";ext=". The second more generic where extension is mentioned with explicit
1066
- // labels like "ext:". In both the above cases we allow more numbers in extension than
1067
- // any other extension labels. The third one captures when single character extension
1068
- // labels or less commonly used labels are used. In such cases we capture fewer
1069
- // extension digits in order to reduce the chance of falsely interpreting two
1070
- // numbers beside each other as a number + extension. The fourth one covers the
1071
- // special case of American numbers where the extension is written with a hash
1072
- // at the end, such as "- 503#". The fifth one is exclusively for extension
1073
- // autodialling formats which are used when dialling and in this case we accept longer
1074
- // extensions. The last one is more liberal on the number of commas that acts as
1075
- // extension labels, so we have a strict cap on the number of digits in such extensions.
1076
-
1077
- return rfcExtn + "|" + explicitExtn + "|" + ambiguousExtn + "|" + americanStyleExtnWithSuffix + "|" + autoDiallingExtn + "|" + onlyCommasExtn;
1078
- }
1079
-
1080
- // Checks we have at least three leading digits, and only valid punctuation,
1081
- // alpha characters and digits in the phone number. Does not include extension
1082
- // data. The symbol 'x' is allowed here as valid punctuation since it is often
1083
- // used as a placeholder for carrier codes, for example in Brazilian phone
1084
- // numbers. We also allow multiple '+' characters at the start.
1085
- //
1086
- // Corresponds to the following:
1087
- // [digits]{minLengthNsn}|
1088
- // plus_sign*
1089
- // (([punctuation]|[star])*[digits]){3,}([punctuation]|[star]|[digits]|[alpha])*
1090
- //
1091
- // The first reg-ex is to allow short numbers (two digits long) to be parsed if
1092
- // they are entered as "15" etc, but only if there is no punctuation in them.
1093
- // The second expression restricts the number of digits to three or more, but
1094
- // then allows them to be in international form, and to have alpha-characters
1095
- // and punctuation. We split up the two reg-exes here and combine them when
1096
- // creating the reg-ex VALID_PHONE_NUMBER_PATTERN itself so we can prefix it
1097
- // with ^ and append $ to each branch.
1098
- //
1099
- // "Note VALID_PUNCTUATION starts with a -,
1100
- // so must be the first in the range" (c) Google devs.
1101
- // (wtf did they mean by saying that; probably nothing)
1102
- //
1103
-
1104
- var MIN_LENGTH_PHONE_NUMBER_PATTERN = '[' + VALID_DIGITS + ']{' + MIN_LENGTH_FOR_NSN + '}'; //
1105
- // And this is the second reg-exp:
1106
- // (see MIN_LENGTH_PHONE_NUMBER_PATTERN for a full description of this reg-exp)
1107
- //
1108
-
1109
- var VALID_PHONE_NUMBER = '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){3,}' + '[' + VALID_PUNCTUATION + VALID_DIGITS + ']*'; // This regular expression isn't present in Google's `libphonenumber`
1110
- // and is only used to determine whether the phone number being input
1111
- // is too short for it to even consider it a "valid" number.
1112
- // This is just a way to differentiate between a really invalid phone
1113
- // number like "abcde" and a valid phone number that a user has just
1114
- // started inputting, like "+1" or "1": both these cases would be
1115
- // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this
1116
- // library can provide a more detailed error message — whether it's
1117
- // really "not a number", or is it just a start of a valid phone number.
1118
-
1119
- var VALID_PHONE_NUMBER_START_REG_EXP = new RegExp('^' + '[' + PLUS_CHARS + ']{0,1}' + '(?:' + '[' + VALID_PUNCTUATION + ']*' + '[' + VALID_DIGITS + ']' + '){1,2}' + '$', 'i');
1120
- var VALID_PHONE_NUMBER_WITH_EXTENSION = VALID_PHONE_NUMBER + // Phone number extensions
1121
- '(?:' + createExtensionPattern() + ')?'; // The combined regular expression for valid phone numbers:
1122
- //
1123
-
1124
- var VALID_PHONE_NUMBER_PATTERN = new RegExp( // Either a short two-digit-only phone number
1125
- '^' + MIN_LENGTH_PHONE_NUMBER_PATTERN + '$' + '|' + // Or a longer fully parsed phone number (min 3 characters)
1126
- '^' + VALID_PHONE_NUMBER_WITH_EXTENSION + '$', 'i'); // Checks to see if the string of characters could possibly be a phone number at
1127
- // all. At the moment, checks to see that the string begins with at least 2
1128
- // digits, ignoring any punctuation commonly found in phone numbers. This method
1129
- // does not require the number to be normalized in advance - but does assume
1130
- // that leading non-number symbols have been removed, such as by the method
1131
- // `extract_possible_number`.
1132
- //
1133
-
1134
- function isViablePhoneNumber(number) {
1135
- return number.length >= MIN_LENGTH_FOR_NSN && VALID_PHONE_NUMBER_PATTERN.test(number);
1136
- } // This is just a way to differentiate between a really invalid phone
1137
- // number like "abcde" and a valid phone number that a user has just
1138
- // started inputting, like "+1" or "1": both these cases would be
1139
- // considered `NOT_A_NUMBER` by Google's `libphonenumber`, but this
1140
- // library can provide a more detailed error message — whether it's
1141
- // really "not a number", or is it just a start of a valid phone number.
1142
-
1143
- function isViablePhoneNumberStart(number) {
1144
- return VALID_PHONE_NUMBER_START_REG_EXP.test(number);
1145
- }
1146
-
1147
- // 1 or more valid digits, for use when parsing.
1148
-
1149
- var EXTN_PATTERN = new RegExp('(?:' + createExtensionPattern() + ')$', 'i'); // Strips any extension (as in, the part of the number dialled after the call is
1150
- // connected, usually indicated with extn, ext, x or similar) from the end of
1151
- // the number, and returns it.
1152
-
1153
- function extractExtension(number) {
1154
- var start = number.search(EXTN_PATTERN);
1155
-
1156
- if (start < 0) {
1157
- return {};
1158
- } // If we find a potential extension, and the number preceding this is a viable
1159
- // number, we assume it is an extension.
1160
-
1161
-
1162
- var numberWithoutExtension = number.slice(0, start);
1163
- var matches = number.match(EXTN_PATTERN);
1164
- var i = 1;
1165
-
1166
- while (i < matches.length) {
1167
- if (matches[i]) {
1168
- return {
1169
- number: numberWithoutExtension,
1170
- ext: matches[i]
1171
- };
1172
- }
1173
-
1174
- i++;
1175
- }
1176
- }
1177
-
1178
- // These mappings map a character (key) to a specific digit that should
1179
- // replace it for normalization purposes. Non-European digits that
1180
- // may be used in phone numbers are mapped to a European equivalent.
1181
- //
1182
- // E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
1183
- //
1184
- var DIGITS = {
1185
- '0': '0',
1186
- '1': '1',
1187
- '2': '2',
1188
- '3': '3',
1189
- '4': '4',
1190
- '5': '5',
1191
- '6': '6',
1192
- '7': '7',
1193
- '8': '8',
1194
- '9': '9',
1195
- "\uFF10": '0',
1196
- // Fullwidth digit 0
1197
- "\uFF11": '1',
1198
- // Fullwidth digit 1
1199
- "\uFF12": '2',
1200
- // Fullwidth digit 2
1201
- "\uFF13": '3',
1202
- // Fullwidth digit 3
1203
- "\uFF14": '4',
1204
- // Fullwidth digit 4
1205
- "\uFF15": '5',
1206
- // Fullwidth digit 5
1207
- "\uFF16": '6',
1208
- // Fullwidth digit 6
1209
- "\uFF17": '7',
1210
- // Fullwidth digit 7
1211
- "\uFF18": '8',
1212
- // Fullwidth digit 8
1213
- "\uFF19": '9',
1214
- // Fullwidth digit 9
1215
- "\u0660": '0',
1216
- // Arabic-indic digit 0
1217
- "\u0661": '1',
1218
- // Arabic-indic digit 1
1219
- "\u0662": '2',
1220
- // Arabic-indic digit 2
1221
- "\u0663": '3',
1222
- // Arabic-indic digit 3
1223
- "\u0664": '4',
1224
- // Arabic-indic digit 4
1225
- "\u0665": '5',
1226
- // Arabic-indic digit 5
1227
- "\u0666": '6',
1228
- // Arabic-indic digit 6
1229
- "\u0667": '7',
1230
- // Arabic-indic digit 7
1231
- "\u0668": '8',
1232
- // Arabic-indic digit 8
1233
- "\u0669": '9',
1234
- // Arabic-indic digit 9
1235
- "\u06F0": '0',
1236
- // Eastern-Arabic digit 0
1237
- "\u06F1": '1',
1238
- // Eastern-Arabic digit 1
1239
- "\u06F2": '2',
1240
- // Eastern-Arabic digit 2
1241
- "\u06F3": '3',
1242
- // Eastern-Arabic digit 3
1243
- "\u06F4": '4',
1244
- // Eastern-Arabic digit 4
1245
- "\u06F5": '5',
1246
- // Eastern-Arabic digit 5
1247
- "\u06F6": '6',
1248
- // Eastern-Arabic digit 6
1249
- "\u06F7": '7',
1250
- // Eastern-Arabic digit 7
1251
- "\u06F8": '8',
1252
- // Eastern-Arabic digit 8
1253
- "\u06F9": '9' // Eastern-Arabic digit 9
1254
-
1255
- };
1256
- function parseDigit(character) {
1257
- return DIGITS[character];
1258
- }
1259
-
1260
- function _createForOfIteratorHelperLoose$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1261
-
1262
- function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
1263
-
1264
- function _arrayLikeToArray$5(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1265
- /**
1266
- * Parses phone number characters from a string.
1267
- * Drops all punctuation leaving only digits and the leading `+` sign (if any).
1268
- * Also converts wide-ascii and arabic-indic numerals to conventional numerals.
1269
- * E.g. in Iraq they don't write `+442323234` but rather `+٤٤٢٣٢٣٢٣٤`.
1270
- * @param {string} string
1271
- * @return {string}
1272
- * @example
1273
- * ```js
1274
- * // Outputs '8800555'.
1275
- * parseIncompletePhoneNumber('8 (800) 555')
1276
- * // Outputs '+7800555'.
1277
- * parseIncompletePhoneNumber('+7 800 555')
1278
- * ```
1279
- */
1280
-
1281
- function parseIncompletePhoneNumber(string) {
1282
- var result = ''; // Using `.split('')` here instead of normal `for ... of`
1283
- // because the importing application doesn't neccessarily include an ES6 polyfill.
1284
- // The `.split('')` approach discards "exotic" UTF-8 characters
1285
- // (the ones consisting of four bytes) but digits
1286
- // (including non-European ones) don't fall into that range
1287
- // so such "exotic" characters would be discarded anyway.
1288
-
1289
- for (var _iterator = _createForOfIteratorHelperLoose$4(string.split('')), _step; !(_step = _iterator()).done;) {
1290
- var character = _step.value;
1291
- result += parsePhoneNumberCharacter(character, result) || '';
1292
- }
1293
-
1294
- return result;
1295
- }
1296
- /**
1297
- * Parses next character while parsing phone number digits (including a `+`)
1298
- * from text: discards everything except `+` and digits, and `+` is only allowed
1299
- * at the start of a phone number.
1300
- * For example, is used in `react-phone-number-input` where it uses
1301
- * [`input-format`](https://gitlab.com/catamphetamine/input-format).
1302
- * @param {string} character - Yet another character from raw input string.
1303
- * @param {string?} prevParsedCharacters - Previous parsed characters.
1304
- * @param {object} meta - Optional custom use-case-specific metadata.
1305
- * @return {string?} The parsed character.
1306
- */
1307
-
1308
- function parsePhoneNumberCharacter(character, prevParsedCharacters) {
1309
- // Only allow a leading `+`.
1310
- if (character === '+') {
1311
- // If this `+` is not the first parsed character
1312
- // then discard it.
1313
- if (prevParsedCharacters) {
1314
- return;
1315
- }
1316
-
1317
- return '+';
1318
- } // Allow digits.
1319
-
1320
-
1321
- return parseDigit(character);
1322
- }
1323
-
1324
- function _createForOfIteratorHelperLoose$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1325
-
1326
- function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$4(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$4(o, minLen); }
1327
-
1328
- function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1329
-
1330
- /**
1331
- * Merges two arrays.
1332
- * @param {*} a
1333
- * @param {*} b
1334
- * @return {*}
1335
- */
1336
- function mergeArrays(a, b) {
1337
- var merged = a.slice();
1338
-
1339
- for (var _iterator = _createForOfIteratorHelperLoose$3(b), _step; !(_step = _iterator()).done;) {
1340
- var element = _step.value;
1341
-
1342
- if (a.indexOf(element) < 0) {
1343
- merged.push(element);
1344
- }
1345
- }
1346
-
1347
- return merged.sort(function (a, b) {
1348
- return a - b;
1349
- }); // ES6 version, requires Set polyfill.
1350
- // let merged = new Set(a)
1351
- // for (const element of b) {
1352
- // merged.add(i)
1353
- // }
1354
- // return Array.from(merged).sort((a, b) => a - b)
1355
- }
1356
-
1357
- function checkNumberLength(nationalNumber, metadata) {
1358
- return checkNumberLengthForType(nationalNumber, undefined, metadata);
1359
- } // Checks whether a number is possible for the country based on its length.
1360
- // Should only be called for the "new" metadata which has "possible lengths".
1361
-
1362
- function checkNumberLengthForType(nationalNumber, type, metadata) {
1363
- var type_info = metadata.type(type); // There should always be "<possiblePengths/>" set for every type element.
1364
- // This is declared in the XML schema.
1365
- // For size efficiency, where a sub-description (e.g. fixed-line)
1366
- // has the same "<possiblePengths/>" as the "general description", this is missing,
1367
- // so we fall back to the "general description". Where no numbers of the type
1368
- // exist at all, there is one possible length (-1) which is guaranteed
1369
- // not to match the length of any real phone number.
1370
-
1371
- var possible_lengths = type_info && type_info.possibleLengths() || metadata.possibleLengths(); // let local_lengths = type_info && type.possibleLengthsLocal() || metadata.possibleLengthsLocal()
1372
- // Metadata before version `1.0.18` didn't contain `possible_lengths`.
1373
-
1374
- if (!possible_lengths) {
1375
- return 'IS_POSSIBLE';
1376
- }
1377
-
1378
- if (type === 'FIXED_LINE_OR_MOBILE') {
1379
- // No such country in metadata.
1380
-
1381
- /* istanbul ignore next */
1382
- if (!metadata.type('FIXED_LINE')) {
1383
- // The rare case has been encountered where no fixedLine data is available
1384
- // (true for some non-geographic entities), so we just check mobile.
1385
- return checkNumberLengthForType(nationalNumber, 'MOBILE', metadata);
1386
- }
1387
-
1388
- var mobile_type = metadata.type('MOBILE');
1389
-
1390
- if (mobile_type) {
1391
- // Merge the mobile data in if there was any. "Concat" creates a new
1392
- // array, it doesn't edit possible_lengths in place, so we don't need a copy.
1393
- // Note that when adding the possible lengths from mobile, we have
1394
- // to again check they aren't empty since if they are this indicates
1395
- // they are the same as the general desc and should be obtained from there.
1396
- possible_lengths = mergeArrays(possible_lengths, mobile_type.possibleLengths()); // The current list is sorted; we need to merge in the new list and
1397
- // re-sort (duplicates are okay). Sorting isn't so expensive because
1398
- // the lists are very small.
1399
- // if (local_lengths) {
1400
- // local_lengths = mergeArrays(local_lengths, mobile_type.possibleLengthsLocal())
1401
- // } else {
1402
- // local_lengths = mobile_type.possibleLengthsLocal()
1403
- // }
1404
- }
1405
- } // If the type doesn't exist then return 'INVALID_LENGTH'.
1406
- else if (type && !type_info) {
1407
- return 'INVALID_LENGTH';
1408
- }
1409
-
1410
- var actual_length = nationalNumber.length; // In `libphonenumber-js` all "local-only" formats are dropped for simplicity.
1411
- // // This is safe because there is never an overlap beween the possible lengths
1412
- // // and the local-only lengths; this is checked at build time.
1413
- // if (local_lengths && local_lengths.indexOf(nationalNumber.length) >= 0)
1414
- // {
1415
- // return 'IS_POSSIBLE_LOCAL_ONLY'
1416
- // }
1417
-
1418
- var minimum_length = possible_lengths[0];
1419
-
1420
- if (minimum_length === actual_length) {
1421
- return 'IS_POSSIBLE';
1422
- }
1423
-
1424
- if (minimum_length > actual_length) {
1425
- return 'TOO_SHORT';
1426
- }
1427
-
1428
- if (possible_lengths[possible_lengths.length - 1] < actual_length) {
1429
- return 'TOO_LONG';
1430
- } // We skip the first element since we've already checked it.
1431
-
1432
-
1433
- return possible_lengths.indexOf(actual_length, 1) >= 0 ? 'IS_POSSIBLE' : 'INVALID_LENGTH';
1434
- }
1435
-
1436
- /**
1437
- * Checks if a phone number is "possible" (basically just checks its length).
1438
- *
1439
- * isPossible(phoneNumberInstance, { ..., v2: true }, metadata)
1440
- *
1441
- * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)
1442
- * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)
1443
- *
1444
- * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
1445
- * @param {object} [options]
1446
- * @param {object} metadata
1447
- * @return {string}
1448
- */
1449
-
1450
- function isPossiblePhoneNumber(input, options, metadata) {
1451
- /* istanbul ignore if */
1452
- if (options === undefined) {
1453
- options = {};
1454
- }
1455
-
1456
- metadata = new Metadata(metadata);
1457
-
1458
- if (options.v2) {
1459
- if (!input.countryCallingCode) {
1460
- throw new Error('Invalid phone number object passed');
1461
- }
1462
-
1463
- metadata.selectNumberingPlan(input.countryCallingCode);
1464
- } else {
1465
- if (!input.phone) {
1466
- return false;
1467
- }
1468
-
1469
- if (input.country) {
1470
- if (!metadata.hasCountry(input.country)) {
1471
- throw new Error("Unknown country: ".concat(input.country));
1472
- }
1473
-
1474
- metadata.country(input.country);
1475
- } else {
1476
- if (!input.countryCallingCode) {
1477
- throw new Error('Invalid phone number object passed');
1478
- }
1479
-
1480
- metadata.selectNumberingPlan(input.countryCallingCode);
1481
- }
1482
- } // Old metadata (< 1.0.18) had no "possible length" data.
1483
-
1484
-
1485
- if (metadata.possibleLengths()) {
1486
- return isPossibleNumber(input.phone || input.nationalNumber, metadata);
1487
- } else {
1488
- // There was a bug between `1.7.35` and `1.7.37` where "possible_lengths"
1489
- // were missing for "non-geographical" numbering plans.
1490
- // Just assume the number is possible in such cases:
1491
- // it's unlikely that anyone generated their custom metadata
1492
- // in that short period of time (one day).
1493
- // This code can be removed in some future major version update.
1494
- if (input.countryCallingCode && metadata.isNonGeographicCallingCode(input.countryCallingCode)) {
1495
- // "Non-geographic entities" did't have `possibleLengths`
1496
- // due to a bug in metadata generation process.
1497
- return true;
1498
- } else {
1499
- throw new Error('Missing "possibleLengths" in metadata. Perhaps the metadata has been generated before v1.0.18.');
1500
- }
1501
- }
1502
- }
1503
- function isPossibleNumber(nationalNumber, metadata) {
1504
- //, isInternational) {
1505
- switch (checkNumberLength(nationalNumber, metadata)) {
1506
- case 'IS_POSSIBLE':
1507
- return true;
1508
- // This library ignores "local-only" phone numbers (for simplicity).
1509
- // See the readme for more info on what are "local-only" phone numbers.
1510
- // case 'IS_POSSIBLE_LOCAL_ONLY':
1511
- // return !isInternational
1512
-
1513
- default:
1514
- return false;
1515
- }
1516
- }
1517
-
1518
- /**
1519
- * Checks whether the entire input sequence can be matched
1520
- * against the regular expression.
1521
- * @return {boolean}
1522
- */
1523
- function matchesEntirely(text, regular_expression) {
1524
- // If assigning the `''` default value is moved to the arguments above,
1525
- // code coverage would decrease for some weird reason.
1526
- text = text || '';
1527
- return new RegExp('^(?:' + regular_expression + ')$').test(text);
1528
- }
1529
-
1530
- function _createForOfIteratorHelperLoose$2(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1531
-
1532
- function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
1533
-
1534
- function _arrayLikeToArray$3(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1535
- var NON_FIXED_LINE_PHONE_TYPES = ['MOBILE', 'PREMIUM_RATE', 'TOLL_FREE', 'SHARED_COST', 'VOIP', 'PERSONAL_NUMBER', 'PAGER', 'UAN', 'VOICEMAIL']; // Finds out national phone number type (fixed line, mobile, etc)
1536
-
1537
- function getNumberType(input, options, metadata) {
1538
- // If assigning the `{}` default value is moved to the arguments above,
1539
- // code coverage would decrease for some weird reason.
1540
- options = options || {}; // When `parse()` returned `{}`
1541
- // meaning that the phone number is not a valid one.
1542
-
1543
- if (!input.country) {
1544
- return;
1545
- }
1546
-
1547
- metadata = new Metadata(metadata);
1548
- metadata.selectNumberingPlan(input.country, input.countryCallingCode);
1549
- var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // The following is copy-pasted from the original function:
1550
- // https://github.com/googlei18n/libphonenumber/blob/3ea547d4fbaa2d0b67588904dfa5d3f2557c27ff/javascript/i18n/phonenumbers/phonenumberutil.js#L2835
1551
- // Is this national number even valid for this country
1552
-
1553
- if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern())) {
1554
- return;
1555
- } // Is it fixed line number
1556
-
1557
-
1558
- if (isNumberTypeEqualTo(nationalNumber, 'FIXED_LINE', metadata)) {
1559
- // Because duplicate regular expressions are removed
1560
- // to reduce metadata size, if "mobile" pattern is ""
1561
- // then it means it was removed due to being a duplicate of the fixed-line pattern.
1562
- //
1563
- if (metadata.type('MOBILE') && metadata.type('MOBILE').pattern() === '') {
1564
- return 'FIXED_LINE_OR_MOBILE';
1565
- } // `MOBILE` type pattern isn't included if it matched `FIXED_LINE` one.
1566
- // For example, for "US" country.
1567
- // Old metadata (< `1.0.18`) had a specific "types" data structure
1568
- // that happened to be `undefined` for `MOBILE` in that case.
1569
- // Newer metadata (>= `1.0.18`) has another data structure that is
1570
- // not `undefined` for `MOBILE` in that case (it's just an empty array).
1571
- // So this `if` is just for backwards compatibility with old metadata.
1572
-
1573
-
1574
- if (!metadata.type('MOBILE')) {
1575
- return 'FIXED_LINE_OR_MOBILE';
1576
- } // Check if the number happens to qualify as both fixed line and mobile.
1577
- // (no such country in the minimal metadata set)
1578
-
1579
- /* istanbul ignore if */
1580
-
1581
-
1582
- if (isNumberTypeEqualTo(nationalNumber, 'MOBILE', metadata)) {
1583
- return 'FIXED_LINE_OR_MOBILE';
1584
- }
1585
-
1586
- return 'FIXED_LINE';
1587
- }
1588
-
1589
- for (var _iterator = _createForOfIteratorHelperLoose$2(NON_FIXED_LINE_PHONE_TYPES), _step; !(_step = _iterator()).done;) {
1590
- var type = _step.value;
1591
-
1592
- if (isNumberTypeEqualTo(nationalNumber, type, metadata)) {
1593
- return type;
1594
- }
1595
- }
1596
- }
1597
- function isNumberTypeEqualTo(nationalNumber, type, metadata) {
1598
- type = metadata.type(type);
1599
-
1600
- if (!type || !type.pattern()) {
1601
- return false;
1602
- } // Check if any possible number lengths are present;
1603
- // if so, we use them to avoid checking
1604
- // the validation pattern if they don't match.
1605
- // If they are absent, this means they match
1606
- // the general description, which we have
1607
- // already checked before a specific number type.
1608
-
1609
-
1610
- if (type.possibleLengths() && type.possibleLengths().indexOf(nationalNumber.length) < 0) {
1611
- return false;
1612
- }
1613
-
1614
- return matchesEntirely(nationalNumber, type.pattern());
1615
- }
1616
-
1617
- /**
1618
- * Checks if a given phone number is valid.
1619
- *
1620
- * isValid(phoneNumberInstance, { ..., v2: true }, metadata)
1621
- *
1622
- * isPossible({ phone: '8005553535', country: 'RU' }, { ... }, metadata)
1623
- * isPossible({ phone: '8005553535', country: 'RU' }, undefined, metadata)
1624
- *
1625
- * If the `number` is a string, it will be parsed to an object,
1626
- * but only if it contains only valid phone number characters (including punctuation).
1627
- * If the `number` is an object, it is used as is.
1628
- *
1629
- * The optional `defaultCountry` argument is the default country.
1630
- * I.e. it does not restrict to just that country,
1631
- * e.g. in those cases where several countries share
1632
- * the same phone numbering rules (NANPA, Britain, etc).
1633
- * For example, even though the number `07624 369230`
1634
- * belongs to the Isle of Man ("IM" country code)
1635
- * calling `isValidNumber('07624369230', 'GB', metadata)`
1636
- * still returns `true` because the country is not restricted to `GB`,
1637
- * it's just that `GB` is the default one for the phone numbering rules.
1638
- * For restricting the country see `isValidNumberForRegion()`
1639
- * though restricting a country might not be a good idea.
1640
- * https://github.com/googlei18n/libphonenumber/blob/master/FAQ.md#when-should-i-use-isvalidnumberforregion
1641
- *
1642
- * Examples:
1643
- *
1644
- * ```js
1645
- * isValidNumber('+78005553535', metadata)
1646
- * isValidNumber('8005553535', 'RU', metadata)
1647
- * isValidNumber('88005553535', 'RU', metadata)
1648
- * isValidNumber({ phone: '8005553535', country: 'RU' }, metadata)
1649
- * ```
1650
- */
1651
-
1652
- function isValidNumber(input, options, metadata) {
1653
- // If assigning the `{}` default value is moved to the arguments above,
1654
- // code coverage would decrease for some weird reason.
1655
- options = options || {};
1656
- metadata = new Metadata(metadata);
1657
- /**
1658
- * Checks if a phone number is "possible" (basically just checks its length).
1659
- *
1660
- * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
1661
- * @param {object} [options]
1662
- * @param {object} metadata
1663
- * @return {string}
1664
- */
1665
-
1666
- metadata.selectNumberingPlan(input.country, input.countryCallingCode); // By default, countries only have type regexps when it's required for
1667
- // distinguishing different countries having the same `countryCallingCode`.
1668
-
1669
- if (metadata.hasTypes()) {
1670
- return getNumberType(input, options, metadata.metadata) !== undefined;
1671
- } // If there are no type regexps for this country in metadata then use
1672
- // `nationalNumberPattern` as a "better than nothing" replacement.
1673
-
1674
-
1675
- var nationalNumber = options.v2 ? input.nationalNumber : input.phone;
1676
- return matchesEntirely(nationalNumber, metadata.nationalNumberPattern());
1677
- }
1678
-
1679
- /**
1680
- * Returns a list of countries that the phone number could potentially belong to.
1681
- * @param {string} callingCode — Calling code.
1682
- * @param {string} nationalNumber — National (significant) number.
1683
- * @param {object} metadata — Metadata.
1684
- * @return {string[]} A list of possible countries.
1685
- */
1686
-
1687
- function getPossibleCountriesForNumber(callingCode, nationalNumber, metadata) {
1688
- var _metadata = new Metadata(metadata);
1689
-
1690
- var possibleCountries = _metadata.getCountryCodesForCallingCode(callingCode);
1691
-
1692
- if (!possibleCountries) {
1693
- return [];
1694
- }
1695
-
1696
- return possibleCountries.filter(function (country) {
1697
- return couldNationalNumberBelongToCountry(nationalNumber, country, metadata);
1698
- });
1699
- }
1700
-
1701
- function couldNationalNumberBelongToCountry(nationalNumber, country, metadata) {
1702
- var _metadata = new Metadata(metadata);
1703
-
1704
- _metadata.selectNumberingPlan(country);
1705
-
1706
- if (_metadata.numberingPlan.possibleLengths().indexOf(nationalNumber.length) >= 0) {
1707
- return true;
1708
- }
1709
-
1710
- return false;
1711
- }
1712
-
1713
- //
1714
- // E.g. "(999) 111-22-33" -> "999 111 22 33"
1715
- //
1716
- // For some reason Google's metadata contains `<intlFormat/>`s with brackets and dashes.
1717
- // Meanwhile, there's no single opinion about using punctuation in international phone numbers.
1718
- //
1719
- // For example, Google's `<intlFormat/>` for USA is `+1 213-373-4253`.
1720
- // And here's a quote from WikiPedia's "North American Numbering Plan" page:
1721
- // https://en.wikipedia.org/wiki/North_American_Numbering_Plan
1722
- //
1723
- // "The country calling code for all countries participating in the NANP is 1.
1724
- // In international format, an NANP number should be listed as +1 301 555 01 00,
1725
- // where 301 is an area code (Maryland)."
1726
- //
1727
- // I personally prefer the international format without any punctuation.
1728
- // For example, brackets are remnants of the old age, meaning that the
1729
- // phone number part in brackets (so called "area code") can be omitted
1730
- // if dialing within the same "area".
1731
- // And hyphens were clearly introduced for splitting local numbers into memorizable groups.
1732
- // For example, remembering "5553535" is difficult but "555-35-35" is much simpler.
1733
- // Imagine a man taking a bus from home to work and seeing an ad with a phone number.
1734
- // He has a couple of seconds to memorize that number until it passes by.
1735
- // If it were spaces instead of hyphens the man wouldn't necessarily get it,
1736
- // but with hyphens instead of spaces the grouping is more explicit.
1737
- // I personally think that hyphens introduce visual clutter,
1738
- // so I prefer replacing them with spaces in international numbers.
1739
- // In the modern age all output is done on displays where spaces are clearly distinguishable
1740
- // so hyphens can be safely replaced with spaces without losing any legibility.
1741
- //
1742
-
1743
- function applyInternationalSeparatorStyle(formattedNumber) {
1744
- return formattedNumber.replace(new RegExp("[".concat(VALID_PUNCTUATION, "]+"), 'g'), ' ').trim();
1745
- }
1746
-
1747
- // first group is not used in the national pattern (e.g. Argentina) so the $1
1748
- // group does not match correctly. Therefore, we use `\d`, so that the first
1749
- // group actually used in the pattern will be matched.
1750
-
1751
- var FIRST_GROUP_PATTERN = /(\$\d)/;
1752
- function formatNationalNumberUsingFormat(number, format, _ref) {
1753
- var useInternationalFormat = _ref.useInternationalFormat,
1754
- withNationalPrefix = _ref.withNationalPrefix;
1755
- _ref.carrierCode;
1756
- _ref.metadata;
1757
- var formattedNumber = number.replace(new RegExp(format.pattern()), useInternationalFormat ? format.internationalFormat() : // This library doesn't use `domestic_carrier_code_formatting_rule`,
1758
- // because that one is only used when formatting phone numbers
1759
- // for dialing from a mobile phone, and this is not a dialing library.
1760
- // carrierCode && format.domesticCarrierCodeFormattingRule()
1761
- // // First, replace the $CC in the formatting rule with the desired carrier code.
1762
- // // Then, replace the $FG in the formatting rule with the first group
1763
- // // and the carrier code combined in the appropriate way.
1764
- // ? format.format().replace(FIRST_GROUP_PATTERN, format.domesticCarrierCodeFormattingRule().replace('$CC', carrierCode))
1765
- // : (
1766
- // withNationalPrefix && format.nationalPrefixFormattingRule()
1767
- // ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule())
1768
- // : format.format()
1769
- // )
1770
- withNationalPrefix && format.nationalPrefixFormattingRule() ? format.format().replace(FIRST_GROUP_PATTERN, format.nationalPrefixFormattingRule()) : format.format());
1771
-
1772
- if (useInternationalFormat) {
1773
- return applyInternationalSeparatorStyle(formattedNumber);
1774
- }
1775
-
1776
- return formattedNumber;
1777
- }
1778
-
1779
- /**
1780
- * Pattern that makes it easy to distinguish whether a region has a single
1781
- * international dialing prefix or not. If a region has a single international
1782
- * prefix (e.g. 011 in USA), it will be represented as a string that contains
1783
- * a sequence of ASCII digits, and possibly a tilde, which signals waiting for
1784
- * the tone. If there are multiple available international prefixes in a
1785
- * region, they will be represented as a regex string that always contains one
1786
- * or more characters that are not ASCII digits or a tilde.
1787
- */
1788
-
1789
- var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/; // For regions that have multiple IDD prefixes
1790
- // a preferred IDD prefix is returned.
1791
-
1792
- function getIddPrefix(country, callingCode, metadata) {
1793
- var countryMetadata = new Metadata(metadata);
1794
- countryMetadata.selectNumberingPlan(country, callingCode);
1795
-
1796
- if (countryMetadata.defaultIDDPrefix()) {
1797
- return countryMetadata.defaultIDDPrefix();
1798
- }
1799
-
1800
- if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {
1801
- return countryMetadata.IDDPrefix();
1802
- }
1803
- }
1804
-
1805
- /**
1806
- * @param {object} - `{ ?number, ?extension }`.
1807
- * @return {string} Phone URI (RFC 3966).
1808
- */
1809
-
1810
- function formatRFC3966(_ref) {
1811
- var number = _ref.number,
1812
- ext = _ref.ext;
1813
-
1814
- if (!number) {
1815
- return '';
1816
- }
1817
-
1818
- if (number[0] !== '+') {
1819
- throw new Error("\"formatRFC3966()\" expects \"number\" to be in E.164 format.");
1820
- }
1821
-
1822
- return "tel:".concat(number).concat(ext ? ';ext=' + ext : '');
1823
- }
1824
-
1825
- function _createForOfIteratorHelperLoose$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$2(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
1826
-
1827
- function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$2(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$2(o, minLen); }
1828
-
1829
- function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
1830
-
1831
- function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
1832
-
1833
- function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty$5(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
1834
-
1835
- function _defineProperty$5(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
1836
- var DEFAULT_OPTIONS = {
1837
- formatExtension: function formatExtension(formattedNumber, extension, metadata) {
1838
- return "".concat(formattedNumber).concat(metadata.ext()).concat(extension);
1839
- }
1840
- };
1841
- /**
1842
- * Formats a phone number.
1843
- *
1844
- * format(phoneNumberInstance, 'INTERNATIONAL', { ..., v2: true }, metadata)
1845
- * format(phoneNumberInstance, 'NATIONAL', { ..., v2: true }, metadata)
1846
- *
1847
- * format({ phone: '8005553535', country: 'RU' }, 'INTERNATIONAL', { ... }, metadata)
1848
- * format({ phone: '8005553535', country: 'RU' }, 'NATIONAL', undefined, metadata)
1849
- *
1850
- * @param {object|PhoneNumber} input — If `options.v2: true` flag is passed, the `input` should be a `PhoneNumber` instance. Otherwise, it should be an object of shape `{ phone: '...', country: '...' }`.
1851
- * @param {string} format
1852
- * @param {object} [options]
1853
- * @param {object} metadata
1854
- * @return {string}
1855
- */
1856
-
1857
- function formatNumber(input, format, options, metadata) {
1858
- // Apply default options.
1859
- if (options) {
1860
- options = _objectSpread$5(_objectSpread$5({}, DEFAULT_OPTIONS), options);
1861
- } else {
1862
- options = DEFAULT_OPTIONS;
1863
- }
1864
-
1865
- metadata = new Metadata(metadata);
1866
-
1867
- if (input.country && input.country !== '001') {
1868
- // Validate `input.country`.
1869
- if (!metadata.hasCountry(input.country)) {
1870
- throw new Error("Unknown country: ".concat(input.country));
1871
- }
1872
-
1873
- metadata.country(input.country);
1874
- } else if (input.countryCallingCode) {
1875
- metadata.selectNumberingPlan(input.countryCallingCode);
1876
- } else return input.phone || '';
1877
-
1878
- var countryCallingCode = metadata.countryCallingCode();
1879
- var nationalNumber = options.v2 ? input.nationalNumber : input.phone; // This variable should have been declared inside `case`s
1880
- // but Babel has a bug and it says "duplicate variable declaration".
1881
-
1882
- var number;
1883
-
1884
- switch (format) {
1885
- case 'NATIONAL':
1886
- // Legacy argument support.
1887
- // (`{ country: ..., phone: '' }`)
1888
- if (!nationalNumber) {
1889
- return '';
1890
- }
1891
-
1892
- number = formatNationalNumber(nationalNumber, input.carrierCode, 'NATIONAL', metadata, options);
1893
- return addExtension(number, input.ext, metadata, options.formatExtension);
1894
-
1895
- case 'INTERNATIONAL':
1896
- // Legacy argument support.
1897
- // (`{ country: ..., phone: '' }`)
1898
- if (!nationalNumber) {
1899
- return "+".concat(countryCallingCode);
1900
- }
1901
-
1902
- number = formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata, options);
1903
- number = "+".concat(countryCallingCode, " ").concat(number);
1904
- return addExtension(number, input.ext, metadata, options.formatExtension);
1905
-
1906
- case 'E.164':
1907
- // `E.164` doesn't define "phone number extensions".
1908
- return "+".concat(countryCallingCode).concat(nationalNumber);
1909
-
1910
- case 'RFC3966':
1911
- return formatRFC3966({
1912
- number: "+".concat(countryCallingCode).concat(nationalNumber),
1913
- ext: input.ext
1914
- });
1915
- // For reference, here's Google's IDD formatter:
1916
- // https://github.com/google/libphonenumber/blob/32719cf74e68796788d1ca45abc85dcdc63ba5b9/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L1546
1917
- // Not saying that this IDD formatter replicates it 1:1, but it seems to work.
1918
- // Who would even need to format phone numbers in IDD format anyway?
1919
-
1920
- case 'IDD':
1921
- if (!options.fromCountry) {
1922
- return; // throw new Error('`fromCountry` option not passed for IDD-prefixed formatting.')
1923
- }
1924
-
1925
- var formattedNumber = formatIDD(nationalNumber, input.carrierCode, countryCallingCode, options.fromCountry, metadata);
1926
- return addExtension(formattedNumber, input.ext, metadata, options.formatExtension);
1927
-
1928
- default:
1929
- throw new Error("Unknown \"format\" argument passed to \"formatNumber()\": \"".concat(format, "\""));
1930
- }
1931
- }
1932
-
1933
- function formatNationalNumber(number, carrierCode, formatAs, metadata, options) {
1934
- var format = chooseFormatForNumber(metadata.formats(), number);
1935
-
1936
- if (!format) {
1937
- return number;
1938
- }
1939
-
1940
- return formatNationalNumberUsingFormat(number, format, {
1941
- useInternationalFormat: formatAs === 'INTERNATIONAL',
1942
- withNationalPrefix: format.nationalPrefixIsOptionalWhenFormattingInNationalFormat() && options && options.nationalPrefix === false ? false : true,
1943
- carrierCode: carrierCode,
1944
- metadata: metadata
1945
- });
1946
- }
1947
-
1948
- function chooseFormatForNumber(availableFormats, nationalNnumber) {
1949
- for (var _iterator = _createForOfIteratorHelperLoose$1(availableFormats), _step; !(_step = _iterator()).done;) {
1950
- var format = _step.value;
1951
-
1952
- // Validate leading digits.
1953
- // The test case for "else path" could be found by searching for
1954
- // "format.leadingDigitsPatterns().length === 0".
1955
- if (format.leadingDigitsPatterns().length > 0) {
1956
- // The last leading_digits_pattern is used here, as it is the most detailed
1957
- var lastLeadingDigitsPattern = format.leadingDigitsPatterns()[format.leadingDigitsPatterns().length - 1]; // If leading digits don't match then move on to the next phone number format
1958
-
1959
- if (nationalNnumber.search(lastLeadingDigitsPattern) !== 0) {
1960
- continue;
1961
- }
1962
- } // Check that the national number matches the phone number format regular expression
1963
-
1964
-
1965
- if (matchesEntirely(nationalNnumber, format.pattern())) {
1966
- return format;
1967
- }
1968
- }
1969
- }
1970
-
1971
- function addExtension(formattedNumber, ext, metadata, formatExtension) {
1972
- return ext ? formatExtension(formattedNumber, ext, metadata) : formattedNumber;
1973
- }
1974
-
1975
- function formatIDD(nationalNumber, carrierCode, countryCallingCode, fromCountry, metadata) {
1976
- var fromCountryCallingCode = getCountryCallingCode(fromCountry, metadata.metadata); // When calling within the same country calling code.
1977
-
1978
- if (fromCountryCallingCode === countryCallingCode) {
1979
- var formattedNumber = formatNationalNumber(nationalNumber, carrierCode, 'NATIONAL', metadata); // For NANPA regions, return the national format for these regions
1980
- // but prefix it with the country calling code.
1981
-
1982
- if (countryCallingCode === '1') {
1983
- return countryCallingCode + ' ' + formattedNumber;
1984
- } // If regions share a country calling code, the country calling code need
1985
- // not be dialled. This also applies when dialling within a region, so this
1986
- // if clause covers both these cases. Technically this is the case for
1987
- // dialling from La Reunion to other overseas departments of France (French
1988
- // Guiana, Martinique, Guadeloupe), but not vice versa - so we don't cover
1989
- // this edge case for now and for those cases return the version including
1990
- // country calling code. Details here:
1991
- // http://www.petitfute.com/voyage/225-info-pratiques-reunion
1992
- //
1993
-
1994
-
1995
- return formattedNumber;
1996
- }
1997
-
1998
- var iddPrefix = getIddPrefix(fromCountry, undefined, metadata.metadata);
1999
-
2000
- if (iddPrefix) {
2001
- return "".concat(iddPrefix, " ").concat(countryCallingCode, " ").concat(formatNationalNumber(nationalNumber, null, 'INTERNATIONAL', metadata));
2002
- }
2003
- }
2004
-
2005
- function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
2006
-
2007
- function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty$4(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
2008
-
2009
- function _defineProperty$4(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2010
-
2011
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2012
-
2013
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
2014
-
2015
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
2016
-
2017
- var PhoneNumber = /*#__PURE__*/function () {
2018
- /**
2019
- * @param {string} countryOrCountryCallingCode
2020
- * @param {string} nationalNumber
2021
- * @param {object} metadata — Metadata JSON
2022
- * @return {PhoneNumber}
2023
- */
2024
- function PhoneNumber(countryOrCountryCallingCode, nationalNumber, metadata) {
2025
- _classCallCheck(this, PhoneNumber);
2026
-
2027
- if (!countryOrCountryCallingCode) {
2028
- throw new TypeError('`country` or `countryCallingCode` not passed');
2029
- }
2030
-
2031
- if (!nationalNumber) {
2032
- throw new TypeError('`nationalNumber` not passed');
2033
- }
2034
-
2035
- if (!metadata) {
2036
- throw new TypeError('`metadata` not passed');
2037
- }
2038
-
2039
- var _getCountryAndCountry = getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadata),
2040
- country = _getCountryAndCountry.country,
2041
- countryCallingCode = _getCountryAndCountry.countryCallingCode;
2042
-
2043
- this.country = country;
2044
- this.countryCallingCode = countryCallingCode;
2045
- this.nationalNumber = nationalNumber;
2046
- this.number = '+' + this.countryCallingCode + this.nationalNumber; // Exclude `metadata` property output from `PhoneNumber.toString()`
2047
- // so that it doesn't clutter the console output of Node.js.
2048
- // Previously, when Node.js did `console.log(new PhoneNumber(...))`,
2049
- // it would output the whole internal structure of the `metadata` object.
2050
-
2051
- this.getMetadata = function () {
2052
- return metadata;
2053
- };
2054
- }
2055
-
2056
- _createClass(PhoneNumber, [{
2057
- key: "setExt",
2058
- value: function setExt(ext) {
2059
- this.ext = ext;
2060
- }
2061
- }, {
2062
- key: "getPossibleCountries",
2063
- value: function getPossibleCountries() {
2064
- if (this.country) {
2065
- return [this.country];
2066
- }
2067
-
2068
- return getPossibleCountriesForNumber(this.countryCallingCode, this.nationalNumber, this.getMetadata());
2069
- }
2070
- }, {
2071
- key: "isPossible",
2072
- value: function isPossible() {
2073
- return isPossiblePhoneNumber(this, {
2074
- v2: true
2075
- }, this.getMetadata());
2076
- }
2077
- }, {
2078
- key: "isValid",
2079
- value: function isValid() {
2080
- return isValidNumber(this, {
2081
- v2: true
2082
- }, this.getMetadata());
2083
- }
2084
- }, {
2085
- key: "isNonGeographic",
2086
- value: function isNonGeographic() {
2087
- var metadata = new Metadata(this.getMetadata());
2088
- return metadata.isNonGeographicCallingCode(this.countryCallingCode);
2089
- }
2090
- }, {
2091
- key: "isEqual",
2092
- value: function isEqual(phoneNumber) {
2093
- return this.number === phoneNumber.number && this.ext === phoneNumber.ext;
2094
- } // This function was originally meant to be an equivalent for `validatePhoneNumberLength()`,
2095
- // but later it was found out that it doesn't include the possible `TOO_SHORT` result
2096
- // returned from `parsePhoneNumberWithError()` in the original `validatePhoneNumberLength()`,
2097
- // so eventually I simply commented out this method from the `PhoneNumber` class
2098
- // and just left the `validatePhoneNumberLength()` function, even though that one would require
2099
- // and additional step to also validate the actual country / calling code of the phone number.
2100
- // validateLength() {
2101
- // const metadata = new Metadata(this.getMetadata())
2102
- // metadata.selectNumberingPlan(this.countryCallingCode)
2103
- // const result = checkNumberLength(this.nationalNumber, metadata)
2104
- // if (result !== 'IS_POSSIBLE') {
2105
- // return result
2106
- // }
2107
- // }
2108
-
2109
- }, {
2110
- key: "getType",
2111
- value: function getType() {
2112
- return getNumberType(this, {
2113
- v2: true
2114
- }, this.getMetadata());
2115
- }
2116
- }, {
2117
- key: "format",
2118
- value: function format(_format, options) {
2119
- return formatNumber(this, _format, options ? _objectSpread$4(_objectSpread$4({}, options), {}, {
2120
- v2: true
2121
- }) : {
2122
- v2: true
2123
- }, this.getMetadata());
2124
- }
2125
- }, {
2126
- key: "formatNational",
2127
- value: function formatNational(options) {
2128
- return this.format('NATIONAL', options);
2129
- }
2130
- }, {
2131
- key: "formatInternational",
2132
- value: function formatInternational(options) {
2133
- return this.format('INTERNATIONAL', options);
2134
- }
2135
- }, {
2136
- key: "getURI",
2137
- value: function getURI(options) {
2138
- return this.format('RFC3966', options);
2139
- }
2140
- }]);
2141
-
2142
- return PhoneNumber;
2143
- }();
2144
-
2145
- var isCountryCode = function isCountryCode(value) {
2146
- return /^[A-Z]{2}$/.test(value);
2147
- };
2148
-
2149
- function getCountryAndCountryCallingCode(countryOrCountryCallingCode, metadataJson) {
2150
- var country;
2151
- var countryCallingCode;
2152
- var metadata = new Metadata(metadataJson); // If country code is passed then derive `countryCallingCode` from it.
2153
- // Also store the country code as `.country`.
2154
-
2155
- if (isCountryCode(countryOrCountryCallingCode)) {
2156
- country = countryOrCountryCallingCode;
2157
- metadata.selectNumberingPlan(country);
2158
- countryCallingCode = metadata.countryCallingCode();
2159
- } else {
2160
- countryCallingCode = countryOrCountryCallingCode;
2161
- }
2162
-
2163
- return {
2164
- country: country,
2165
- countryCallingCode: countryCallingCode
2166
- };
2167
- }
2168
-
2169
- var CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');
2170
- function stripIddPrefix(number, country, callingCode, metadata) {
2171
- if (!country) {
2172
- return;
2173
- } // Check if the number is IDD-prefixed.
2174
-
2175
-
2176
- var countryMetadata = new Metadata(metadata);
2177
- countryMetadata.selectNumberingPlan(country, callingCode);
2178
- var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());
2179
-
2180
- if (number.search(IDDPrefixPattern) !== 0) {
2181
- return;
2182
- } // Strip IDD prefix.
2183
-
2184
-
2185
- number = number.slice(number.match(IDDPrefixPattern)[0].length); // If there're any digits after an IDD prefix,
2186
- // then those digits are a country calling code.
2187
- // Since no country code starts with a `0`,
2188
- // the code below validates that the next digit (if present) is not `0`.
2189
-
2190
- var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);
2191
-
2192
- if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {
2193
- if (matchedGroups[1] === '0') {
2194
- return;
2195
- }
2196
- }
2197
-
2198
- return number;
2199
- }
2200
-
2201
- /**
2202
- * Strips any national prefix (such as 0, 1) present in a
2203
- * (possibly incomplete) number provided.
2204
- * "Carrier codes" are only used in Colombia and Brazil,
2205
- * and only when dialing within those countries from a mobile phone to a fixed line number.
2206
- * Sometimes it won't actually strip national prefix
2207
- * and will instead prepend some digits to the `number`:
2208
- * for example, when number `2345678` is passed with `VI` country selected,
2209
- * it will return `{ number: "3402345678" }`, because `340` area code is prepended.
2210
- * @param {string} number — National number digits.
2211
- * @param {object} metadata — Metadata with country selected.
2212
- * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. Even if a national prefix was extracted, it's not necessarily present in the returned object, so don't rely on its presence in the returned object in order to find out whether a national prefix has been extracted or not.
2213
- */
2214
- function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {
2215
- if (number && metadata.numberingPlan.nationalPrefixForParsing()) {
2216
- // See METADATA.md for the description of
2217
- // `national_prefix_for_parsing` and `national_prefix_transform_rule`.
2218
- // Attempt to parse the first digits as a national prefix.
2219
- var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');
2220
- var prefixMatch = prefixPattern.exec(number);
2221
-
2222
- if (prefixMatch) {
2223
- var nationalNumber;
2224
- var carrierCode; // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule
2225
- // If a `national_prefix_for_parsing` has any "capturing groups"
2226
- // then it means that the national (significant) number is equal to
2227
- // those "capturing groups" transformed via `national_prefix_transform_rule`,
2228
- // and nothing could be said about the actual national prefix:
2229
- // what is it and was it even there.
2230
- // If a `national_prefix_for_parsing` doesn't have any "capturing groups",
2231
- // then everything it matches is a national prefix.
2232
- // To determine whether `national_prefix_for_parsing` matched any
2233
- // "capturing groups", the value of the result of calling `.exec()`
2234
- // is looked at, and if it has non-undefined values where there're
2235
- // "capturing groups" in the regular expression, then it means
2236
- // that "capturing groups" have been matched.
2237
- // It's not possible to tell whether there'll be any "capturing gropus"
2238
- // before the matching process, because a `national_prefix_for_parsing`
2239
- // could exhibit both behaviors.
2240
-
2241
- var capturedGroupsCount = prefixMatch.length - 1;
2242
- var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];
2243
-
2244
- if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {
2245
- nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule()); // If there's more than one captured group,
2246
- // then carrier code is the second one.
2247
-
2248
- if (capturedGroupsCount > 1) {
2249
- carrierCode = prefixMatch[1];
2250
- }
2251
- } // If there're no "capturing groups",
2252
- // or if there're "capturing groups" but no
2253
- // `national_prefix_transform_rule`,
2254
- // then just strip the national prefix from the number,
2255
- // and possibly a carrier code.
2256
- // Seems like there could be more.
2257
- else {
2258
- // `prefixBeforeNationalNumber` is the whole substring matched by
2259
- // the `national_prefix_for_parsing` regular expression.
2260
- // There seem to be no guarantees that it's just a national prefix.
2261
- // For example, if there's a carrier code, it's gonna be a
2262
- // part of `prefixBeforeNationalNumber` too.
2263
- var prefixBeforeNationalNumber = prefixMatch[0];
2264
- nationalNumber = number.slice(prefixBeforeNationalNumber.length); // If there's at least one captured group,
2265
- // then carrier code is the first one.
2266
-
2267
- if (hasCapturedGroups) {
2268
- carrierCode = prefixMatch[1];
2269
- }
2270
- } // Tries to guess whether a national prefix was present in the input.
2271
- // This is not something copy-pasted from Google's library:
2272
- // they don't seem to have an equivalent for that.
2273
- // So this isn't an "officially approved" way of doing something like that.
2274
- // But since there seems no other existing method, this library uses it.
2275
-
2276
-
2277
- var nationalPrefix;
2278
-
2279
- if (hasCapturedGroups) {
2280
- var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);
2281
- var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup); // Example: an Argentinian (AR) phone number `0111523456789`.
2282
- // `prefixMatch[0]` is `01115`, and `$1` is `11`,
2283
- // and the rest of the phone number is `23456789`.
2284
- // The national number is transformed via `9$1` to `91123456789`.
2285
- // National prefix `0` is detected being present at the start.
2286
- // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {
2287
-
2288
- if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {
2289
- nationalPrefix = metadata.numberingPlan.nationalPrefix();
2290
- }
2291
- } else {
2292
- nationalPrefix = prefixMatch[0];
2293
- }
2294
-
2295
- return {
2296
- nationalNumber: nationalNumber,
2297
- nationalPrefix: nationalPrefix,
2298
- carrierCode: carrierCode
2299
- };
2300
- }
2301
- }
2302
-
2303
- return {
2304
- nationalNumber: number
2305
- };
2306
- }
2307
-
2308
- /**
2309
- * Strips national prefix and carrier code from a complete phone number.
2310
- * The difference from the non-"FromCompleteNumber" function is that
2311
- * it won't extract national prefix if the resultant number is too short
2312
- * to be a complete number for the selected phone numbering plan.
2313
- * @param {string} number — Complete phone number digits.
2314
- * @param {Metadata} metadata — Metadata with a phone numbering plan selected.
2315
- * @return {object} `{ nationalNumber: string, carrierCode: string? }`.
2316
- */
2317
-
2318
- function extractNationalNumber(number, metadata) {
2319
- // Parsing national prefixes and carrier codes
2320
- // is only required for local phone numbers
2321
- // but some people don't understand that
2322
- // and sometimes write international phone numbers
2323
- // with national prefixes (or maybe even carrier codes).
2324
- // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html
2325
- // Google's original library forgives such mistakes
2326
- // and so does this library, because it has been requested:
2327
- // https://github.com/catamphetamine/libphonenumber-js/issues/127
2328
- var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),
2329
- carrierCode = _extractNationalNumbe.carrierCode,
2330
- nationalNumber = _extractNationalNumbe.nationalNumber;
2331
-
2332
- if (nationalNumber !== number) {
2333
- if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {
2334
- // Don't strip the national prefix.
2335
- return {
2336
- nationalNumber: number
2337
- };
2338
- } // Check the national (significant) number length after extracting national prefix and carrier code.
2339
- // Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature.
2340
-
2341
-
2342
- if (metadata.possibleLengths()) {
2343
- // The number remaining after stripping the national prefix and carrier code
2344
- // should be long enough to have a possible length for the country.
2345
- // Otherwise, don't strip the national prefix and carrier code,
2346
- // since the original number could be a valid number.
2347
- // This check has been copy-pasted "as is" from Google's original library:
2348
- // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250
2349
- // It doesn't check for the "possibility" of the original `number`.
2350
- // I guess it's fine not checking that one. It works as is anyway.
2351
- if (!isPossibleIncompleteNationalNumber(nationalNumber, metadata)) {
2352
- // Don't strip the national prefix.
2353
- return {
2354
- nationalNumber: number
2355
- };
2356
- }
2357
- }
2358
- }
2359
-
2360
- return {
2361
- nationalNumber: nationalNumber,
2362
- carrierCode: carrierCode
2363
- };
2364
- } // In some countries, the same digit could be a national prefix
2365
- // or a leading digit of a valid phone number.
2366
- // For example, in Russia, national prefix is `8`,
2367
- // and also `800 555 35 35` is a valid number
2368
- // in which `8` is not a national prefix, but the first digit
2369
- // of a national (significant) number.
2370
- // Same's with Belarus:
2371
- // `82004910060` is a valid national (significant) number,
2372
- // but `2004910060` is not.
2373
- // To support such cases (to prevent the code from always stripping
2374
- // national prefix), a condition is imposed: a national prefix
2375
- // is not extracted when the original number is "viable" and the
2376
- // resultant number is not, a "viable" national number being the one
2377
- // that matches `national_number_pattern`.
2378
-
2379
- function shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {
2380
- // The equivalent in Google's code is:
2381
- // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004
2382
- if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {
2383
- return false;
2384
- } // This "is possible" national number (length) check has been commented out
2385
- // because it's superceded by the (effectively) same check done in the
2386
- // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.
2387
- // In other words, why run the same check twice if it could only be run once.
2388
- // // Check the national (significant) number length after extracting national prefix and carrier code.
2389
- // // Fixes a minor "weird behavior" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57
2390
- // // (Legacy generated metadata (before `1.0.18`) didn't support the "possible lengths" feature).
2391
- // if (metadata.possibleLengths()) {
2392
- // if (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&
2393
- // !isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {
2394
- // return false
2395
- // }
2396
- // }
2397
-
2398
-
2399
- return true;
2400
- }
2401
-
2402
- function isPossibleIncompleteNationalNumber(nationalNumber, metadata) {
2403
- switch (checkNumberLength(nationalNumber, metadata)) {
2404
- case 'TOO_SHORT':
2405
- case 'INVALID_LENGTH':
2406
- // This library ignores "local-only" phone numbers (for simplicity).
2407
- // See the readme for more info on what are "local-only" phone numbers.
2408
- // case 'IS_POSSIBLE_LOCAL_ONLY':
2409
- return false;
2410
-
2411
- default:
2412
- return true;
2413
- }
2414
- }
2415
-
2416
- /**
2417
- * Sometimes some people incorrectly input international phone numbers
2418
- * without the leading `+`. This function corrects such input.
2419
- * @param {string} number — Phone number digits.
2420
- * @param {string?} country
2421
- * @param {string?} callingCode
2422
- * @param {object} metadata
2423
- * @return {object} `{ countryCallingCode: string?, number: string }`.
2424
- */
2425
-
2426
- function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata) {
2427
- var countryCallingCode = country ? getCountryCallingCode(country, metadata) : callingCode;
2428
-
2429
- if (number.indexOf(countryCallingCode) === 0) {
2430
- metadata = new Metadata(metadata);
2431
- metadata.selectNumberingPlan(country, callingCode);
2432
- var possibleShorterNumber = number.slice(countryCallingCode.length);
2433
-
2434
- var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, metadata),
2435
- possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;
2436
-
2437
- var _extractNationalNumbe2 = extractNationalNumber(number, metadata),
2438
- nationalNumber = _extractNationalNumbe2.nationalNumber; // If the number was not valid before but is valid now,
2439
- // or if it was too long before, we consider the number
2440
- // with the country calling code stripped to be a better result
2441
- // and keep that instead.
2442
- // For example, in Germany (+49), `49` is a valid area code,
2443
- // so if a number starts with `49`, it could be both a valid
2444
- // national German number or an international number without
2445
- // a leading `+`.
2446
-
2447
-
2448
- if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, metadata) === 'TOO_LONG') {
2449
- return {
2450
- countryCallingCode: countryCallingCode,
2451
- number: possibleShorterNumber
2452
- };
2453
- }
2454
- }
2455
-
2456
- return {
2457
- number: number
2458
- };
2459
- }
2460
-
2461
- /**
2462
- * Converts a phone number digits (possibly with a `+`)
2463
- * into a calling code and the rest phone number digits.
2464
- * The "rest phone number digits" could include
2465
- * a national prefix, carrier code, and national
2466
- * (significant) number.
2467
- * @param {string} number — Phone number digits (possibly with a `+`).
2468
- * @param {string} [country] — Default country.
2469
- * @param {string} [callingCode] — Default calling code (some phone numbering plans are non-geographic).
2470
- * @param {object} metadata
2471
- * @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`
2472
- * @example
2473
- * // Returns `{ countryCallingCode: "1", number: "2133734253" }`.
2474
- * extractCountryCallingCode('2133734253', 'US', null, metadata)
2475
- * extractCountryCallingCode('2133734253', null, '1', metadata)
2476
- * extractCountryCallingCode('+12133734253', null, null, metadata)
2477
- * extractCountryCallingCode('+12133734253', 'RU', null, metadata)
2478
- */
2479
-
2480
- function extractCountryCallingCode(number, country, callingCode, metadata) {
2481
- if (!number) {
2482
- return {};
2483
- }
2484
-
2485
- var isNumberWithIddPrefix; // If this is not an international phone number,
2486
- // then either extract an "IDD" prefix, or extract a
2487
- // country calling code from a number by autocorrecting it
2488
- // by prepending a leading `+` in cases when it starts
2489
- // with the country calling code.
2490
- // https://wikitravel.org/en/International_dialling_prefix
2491
- // https://github.com/catamphetamine/libphonenumber-js/issues/376
2492
-
2493
- if (number[0] !== '+') {
2494
- // Convert an "out-of-country" dialing phone number
2495
- // to a proper international phone number.
2496
- var numberWithoutIDD = stripIddPrefix(number, country, callingCode, metadata); // If an IDD prefix was stripped then
2497
- // convert the number to international one
2498
- // for subsequent parsing.
2499
-
2500
- if (numberWithoutIDD && numberWithoutIDD !== number) {
2501
- isNumberWithIddPrefix = true;
2502
- number = '+' + numberWithoutIDD;
2503
- } else {
2504
- // Check to see if the number starts with the country calling code
2505
- // for the default country. If so, we remove the country calling code,
2506
- // and do some checks on the validity of the number before and after.
2507
- // https://github.com/catamphetamine/libphonenumber-js/issues/376
2508
- if (country || callingCode) {
2509
- var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, callingCode, metadata),
2510
- countryCallingCode = _extractCountryCallin.countryCallingCode,
2511
- shorterNumber = _extractCountryCallin.number;
2512
-
2513
- if (countryCallingCode) {
2514
- return {
2515
- countryCallingCodeSource: 'FROM_NUMBER_WITHOUT_PLUS_SIGN',
2516
- countryCallingCode: countryCallingCode,
2517
- number: shorterNumber
2518
- };
2519
- }
2520
- }
2521
-
2522
- return {
2523
- // No need to set it to `UNSPECIFIED`. It can be just `undefined`.
2524
- // countryCallingCodeSource: 'UNSPECIFIED',
2525
- number: number
2526
- };
2527
- }
2528
- } // Fast abortion: country codes do not begin with a '0'
2529
-
2530
-
2531
- if (number[1] === '0') {
2532
- return {};
2533
- }
2534
-
2535
- metadata = new Metadata(metadata); // The thing with country phone codes
2536
- // is that they are orthogonal to each other
2537
- // i.e. there's no such country phone code A
2538
- // for which country phone code B exists
2539
- // where B starts with A.
2540
- // Therefore, while scanning digits,
2541
- // if a valid country code is found,
2542
- // that means that it is the country code.
2543
- //
2544
-
2545
- var i = 2;
2546
-
2547
- while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {
2548
- var _countryCallingCode = number.slice(1, i);
2549
-
2550
- if (metadata.hasCallingCode(_countryCallingCode)) {
2551
- metadata.selectNumberingPlan(_countryCallingCode);
2552
- return {
2553
- countryCallingCodeSource: isNumberWithIddPrefix ? 'FROM_NUMBER_WITH_IDD' : 'FROM_NUMBER_WITH_PLUS_SIGN',
2554
- countryCallingCode: _countryCallingCode,
2555
- number: number.slice(i)
2556
- };
2557
- }
2558
-
2559
- i++;
2560
- }
2561
-
2562
- return {};
2563
- } // The possible values for the returned `countryCallingCodeSource` are:
2564
- //
2565
- // Copy-pasted from:
2566
- // https://github.com/google/libphonenumber/blob/master/resources/phonenumber.proto
2567
- //
2568
- // // The source from which the country_code is derived. This is not set in the
2569
- // // general parsing method, but in the method that parses and keeps raw_input.
2570
- // // New fields could be added upon request.
2571
- // enum CountryCodeSource {
2572
- // // Default value returned if this is not set, because the phone number was
2573
- // // created using parse, not parseAndKeepRawInput. hasCountryCodeSource will
2574
- // // return false if this is the case.
2575
- // UNSPECIFIED = 0;
2576
- //
2577
- // // The country_code is derived based on a phone number with a leading "+",
2578
- // // e.g. the French number "+33 1 42 68 53 00".
2579
- // FROM_NUMBER_WITH_PLUS_SIGN = 1;
2580
- //
2581
- // // The country_code is derived based on a phone number with a leading IDD,
2582
- // // e.g. the French number "011 33 1 42 68 53 00", as it is dialled from US.
2583
- // FROM_NUMBER_WITH_IDD = 5;
2584
- //
2585
- // // The country_code is derived based on a phone number without a leading
2586
- // // "+", e.g. the French number "33 1 42 68 53 00" when defaultCountry is
2587
- // // supplied as France.
2588
- // FROM_NUMBER_WITHOUT_PLUS_SIGN = 10;
2589
- //
2590
- // // The country_code is derived NOT based on the phone number itself, but
2591
- // // from the defaultCountry parameter provided in the parsing function by the
2592
- // // clients. This happens mostly for numbers written in the national format
2593
- // // (without country code). For example, this would be set when parsing the
2594
- // // French number "01 42 68 53 00", when defaultCountry is supplied as
2595
- // // France.
2596
- // FROM_DEFAULT_COUNTRY = 20;
2597
- // }
2598
-
2599
- function _createForOfIteratorHelperLoose(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (it) return (it = it.call(o)).next.bind(it); if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; return function () { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
2600
-
2601
- function _unsupportedIterableToArray$1(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$1(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen); }
2602
-
2603
- function _arrayLikeToArray$1(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
2604
- function getCountryByNationalNumber(nationalPhoneNumber, _ref) {
2605
- var countries = _ref.countries,
2606
- defaultCountry = _ref.defaultCountry,
2607
- metadata = _ref.metadata;
2608
- // Re-create `metadata` because it will be selecting a `country`.
2609
- metadata = new Metadata(metadata);
2610
- var matchingCountries = [];
2611
-
2612
- for (var _iterator = _createForOfIteratorHelperLoose(countries), _step; !(_step = _iterator()).done;) {
2613
- var country = _step.value;
2614
- metadata.country(country); // "Leading digits" patterns are only defined for about 20% of all countries.
2615
- // By definition, matching "leading digits" is a sufficient but not a necessary
2616
- // condition for a phone number to belong to a country.
2617
- // The point of "leading digits" check is that it's the fastest one to get a match.
2618
- // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits
2619
- // I'd suppose that "leading digits" patterns are mutually exclusive for different countries
2620
- // because of the intended use of that feature.
2621
-
2622
- if (metadata.leadingDigits()) {
2623
- if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {
2624
- return country;
2625
- }
2626
- } // Else perform full validation with all of those
2627
- // fixed-line/mobile/etc regular expressions.
2628
- else if (getNumberType({
2629
- phone: nationalPhoneNumber,
2630
- country: country
2631
- }, undefined, metadata.metadata)) {
2632
- // If the `defaultCountry` is among the `matchingCountries` then return it.
2633
- if (defaultCountry) {
2634
- if (country === defaultCountry) {
2635
- return country;
2636
- }
2637
-
2638
- matchingCountries.push(country);
2639
- } else {
2640
- return country;
2641
- }
2642
- }
2643
- } // Return the first ("main") one of the `matchingCountries`.
2644
-
2645
-
2646
- if (matchingCountries.length > 0) {
2647
- return matchingCountries[0];
2648
- }
2649
- }
2650
-
2651
- var USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;
2652
- function getCountryByCallingCode(callingCode, _ref) {
2653
- var nationalPhoneNumber = _ref.nationalNumber,
2654
- defaultCountry = _ref.defaultCountry,
2655
- metadata = _ref.metadata;
2656
-
2657
- /* istanbul ignore if */
2658
- if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {
2659
- if (metadata.isNonGeographicCallingCode(callingCode)) {
2660
- return '001';
2661
- }
2662
- }
2663
-
2664
- var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);
2665
-
2666
- if (!possibleCountries) {
2667
- return;
2668
- } // If there's just one country corresponding to the country code,
2669
- // then just return it, without further phone number digits validation.
2670
-
2671
-
2672
- if (possibleCountries.length === 1) {
2673
- return possibleCountries[0];
2674
- }
2675
-
2676
- return getCountryByNationalNumber(nationalPhoneNumber, {
2677
- countries: possibleCountries,
2678
- defaultCountry: defaultCountry,
2679
- metadata: metadata.metadata
2680
- });
2681
- }
2682
-
2683
- // When phone numbers are written in `RFC3966` format — `"tel:+12133734253"` —
2684
- var PLUS_SIGN = '+';
2685
- var RFC3966_VISUAL_SEPARATOR_ = '[\\-\\.\\(\\)]?';
2686
- var RFC3966_PHONE_DIGIT_ = '(' + '[' + VALID_DIGITS + ']' + '|' + RFC3966_VISUAL_SEPARATOR_ + ')';
2687
- var RFC3966_GLOBAL_NUMBER_DIGITS_ = '^' + '\\' + PLUS_SIGN + RFC3966_PHONE_DIGIT_ + '*' + '[' + VALID_DIGITS + ']' + RFC3966_PHONE_DIGIT_ + '*' + '$';
2688
- /**
2689
- * Regular expression of valid global-number-digits for the phone-context
2690
- * parameter, following the syntax defined in RFC3966.
2691
- */
2692
-
2693
- var RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_ = new RegExp(RFC3966_GLOBAL_NUMBER_DIGITS_, 'g'); // In this port of Google's library, we don't accept alpha characters in phone numbers.
2694
- // const ALPHANUM_ = VALID_ALPHA_ + VALID_DIGITS
2695
-
2696
- var ALPHANUM_ = VALID_DIGITS;
2697
- var RFC3966_DOMAINLABEL_ = '[' + ALPHANUM_ + ']+((\\-)*[' + ALPHANUM_ + '])*';
2698
- var VALID_ALPHA_ = 'a-zA-Z';
2699
- var RFC3966_TOPLABEL_ = '[' + VALID_ALPHA_ + ']+((\\-)*[' + ALPHANUM_ + '])*';
2700
- var RFC3966_DOMAINNAME_ = '^(' + RFC3966_DOMAINLABEL_ + '\\.)*' + RFC3966_TOPLABEL_ + '\\.?$';
2701
- /**
2702
- * Regular expression of valid domainname for the phone-context parameter,
2703
- * following the syntax defined in RFC3966.
2704
- */
2705
-
2706
- var RFC3966_DOMAINNAME_PATTERN_ = new RegExp(RFC3966_DOMAINNAME_, 'g');
2707
- var RFC3966_PREFIX_ = 'tel:';
2708
- var RFC3966_PHONE_CONTEXT_ = ';phone-context=';
2709
- var RFC3966_ISDN_SUBADDRESS_ = ';isub=';
2710
- /**
2711
- * Extracts the value of the phone-context parameter of `numberToExtractFrom`,
2712
- * following the syntax defined in RFC3966.
2713
- *
2714
- * @param {string} numberToExtractFrom
2715
- * @return {string|null} the extracted string (possibly empty), or `null` if no phone-context parameter is found.
2716
- */
2717
-
2718
- function extractPhoneContext(numberToExtractFrom) {
2719
- var indexOfPhoneContext = numberToExtractFrom.indexOf(RFC3966_PHONE_CONTEXT_); // If no phone-context parameter is present
2720
-
2721
- if (indexOfPhoneContext < 0) {
2722
- return null;
2723
- }
2724
-
2725
- var phoneContextStart = indexOfPhoneContext + RFC3966_PHONE_CONTEXT_.length; // If phone-context parameter is empty
2726
-
2727
- if (phoneContextStart >= numberToExtractFrom.length) {
2728
- return '';
2729
- }
2730
-
2731
- var phoneContextEnd = numberToExtractFrom.indexOf(';', phoneContextStart); // If phone-context is not the last parameter
2732
-
2733
- if (phoneContextEnd >= 0) {
2734
- return numberToExtractFrom.substring(phoneContextStart, phoneContextEnd);
2735
- } else {
2736
- return numberToExtractFrom.substring(phoneContextStart);
2737
- }
2738
- }
2739
- /**
2740
- * Returns whether the value of phoneContext follows the syntax defined in RFC3966.
2741
- *
2742
- * @param {string|null} phoneContext
2743
- * @return {boolean}
2744
- */
2745
-
2746
- function isPhoneContextValid(phoneContext) {
2747
- if (phoneContext === null) {
2748
- return true;
2749
- }
2750
-
2751
- if (phoneContext.length === 0) {
2752
- return false;
2753
- } // Does phone-context value match pattern of global-number-digits or domainname.
2754
-
2755
-
2756
- return RFC3966_GLOBAL_NUMBER_DIGITS_PATTERN_.test(phoneContext) || RFC3966_DOMAINNAME_PATTERN_.test(phoneContext);
2757
- }
2758
-
2759
- /**
2760
- * @param {string} numberToParse
2761
- * @param {string} nationalNumber
2762
- * @return {}
2763
- */
2764
-
2765
- function extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(numberToParse, _ref) {
2766
- var extractFormattedPhoneNumber = _ref.extractFormattedPhoneNumber;
2767
- var phoneContext = extractPhoneContext(numberToParse);
2768
-
2769
- if (!isPhoneContextValid(phoneContext)) {
2770
- throw new ParseError('NOT_A_NUMBER');
2771
- }
2772
-
2773
- var phoneNumberString;
2774
-
2775
- if (phoneContext === null) {
2776
- // Extract a possible number from the string passed in.
2777
- // (this strips leading characters that could not be the start of a phone number)
2778
- phoneNumberString = extractFormattedPhoneNumber(numberToParse) || '';
2779
- } else {
2780
- phoneNumberString = ''; // If the phone context contains a phone number prefix, we need to capture
2781
- // it, whereas domains will be ignored.
2782
-
2783
- if (phoneContext.charAt(0) === PLUS_SIGN) {
2784
- phoneNumberString += phoneContext;
2785
- } // Now append everything between the "tel:" prefix and the phone-context.
2786
- // This should include the national number, an optional extension or
2787
- // isdn-subaddress component. Note we also handle the case when "tel:" is
2788
- // missing, as we have seen in some of the phone number inputs.
2789
- // In that case, we append everything from the beginning.
2790
-
2791
-
2792
- var indexOfRfc3966Prefix = numberToParse.indexOf(RFC3966_PREFIX_);
2793
- var indexOfNationalNumber; // RFC 3966 "tel:" prefix is preset at this stage because
2794
- // `isPhoneContextValid()` requires it to be present.
2795
-
2796
- /* istanbul ignore else */
2797
-
2798
- if (indexOfRfc3966Prefix >= 0) {
2799
- indexOfNationalNumber = indexOfRfc3966Prefix + RFC3966_PREFIX_.length;
2800
- } else {
2801
- indexOfNationalNumber = 0;
2802
- }
2803
-
2804
- var indexOfPhoneContext = numberToParse.indexOf(RFC3966_PHONE_CONTEXT_);
2805
- phoneNumberString += numberToParse.substring(indexOfNationalNumber, indexOfPhoneContext);
2806
- } // Delete the isdn-subaddress and everything after it if it is present.
2807
- // Note extension won't appear at the same time with isdn-subaddress
2808
- // according to paragraph 5.3 of the RFC3966 spec.
2809
-
2810
-
2811
- var indexOfIsdn = phoneNumberString.indexOf(RFC3966_ISDN_SUBADDRESS_);
2812
-
2813
- if (indexOfIsdn > 0) {
2814
- phoneNumberString = phoneNumberString.substring(0, indexOfIsdn);
2815
- } // If both phone context and isdn-subaddress are absent but other
2816
- // parameters are present, the parameters are left in nationalNumber.
2817
- // This is because we are concerned about deleting content from a potential
2818
- // number string when there is no strong evidence that the number is
2819
- // actually written in RFC3966.
2820
-
2821
-
2822
- if (phoneNumberString !== '') {
2823
- return phoneNumberString;
2824
- }
2825
- }
2826
-
2827
- // This is a port of Google Android `libphonenumber`'s
2828
- // This prevents malicious input from consuming CPU.
2829
-
2830
- var MAX_INPUT_STRING_LENGTH = 250; // This consists of the plus symbol, digits, and arabic-indic digits.
2831
-
2832
- var PHONE_NUMBER_START_PATTERN = new RegExp('[' + PLUS_CHARS + VALID_DIGITS + ']'); // Regular expression of trailing characters that we want to remove.
2833
- // A trailing `#` is sometimes used when writing phone numbers with extensions in US.
2834
- // Example: "+1 (645) 123 1234-910#" number has extension "910".
2835
-
2836
- var AFTER_PHONE_NUMBER_END_PATTERN = new RegExp('[^' + VALID_DIGITS + '#' + ']+$');
2837
- //
2838
- // ```js
2839
- // parse('8 (800) 555-35-35', 'RU')
2840
- // parse('8 (800) 555-35-35', 'RU', metadata)
2841
- // parse('8 (800) 555-35-35', { country: { default: 'RU' } })
2842
- // parse('8 (800) 555-35-35', { country: { default: 'RU' } }, metadata)
2843
- // parse('+7 800 555 35 35')
2844
- // parse('+7 800 555 35 35', metadata)
2845
- // ```
2846
- //
2847
-
2848
- /**
2849
- * Parses a phone number.
2850
- *
2851
- * parse('123456789', { defaultCountry: 'RU', v2: true }, metadata)
2852
- * parse('123456789', { defaultCountry: 'RU' }, metadata)
2853
- * parse('123456789', undefined, metadata)
2854
- *
2855
- * @param {string} input
2856
- * @param {object} [options]
2857
- * @param {object} metadata
2858
- * @return {object|PhoneNumber?} If `options.v2: true` flag is passed, it returns a `PhoneNumber?` instance. Otherwise, returns an object of shape `{ phone: '...', country: '...' }` (or just `{}` if no phone number was parsed).
2859
- */
2860
-
2861
- function parse(text, options, metadata) {
2862
- // If assigning the `{}` default value is moved to the arguments above,
2863
- // code coverage would decrease for some weird reason.
2864
- options = options || {};
2865
- metadata = new Metadata(metadata); // Validate `defaultCountry`.
2866
-
2867
- if (options.defaultCountry && !metadata.hasCountry(options.defaultCountry)) {
2868
- if (options.v2) {
2869
- throw new ParseError('INVALID_COUNTRY');
2870
- }
2871
-
2872
- throw new Error("Unknown country: ".concat(options.defaultCountry));
2873
- } // Parse the phone number.
2874
-
2875
-
2876
- var _parseInput = parseInput(text, options.v2, options.extract),
2877
- formattedPhoneNumber = _parseInput.number,
2878
- ext = _parseInput.ext,
2879
- error = _parseInput.error; // If the phone number is not viable then return nothing.
2880
-
2881
-
2882
- if (!formattedPhoneNumber) {
2883
- if (options.v2) {
2884
- if (error === 'TOO_SHORT') {
2885
- throw new ParseError('TOO_SHORT');
2886
- }
2887
-
2888
- throw new ParseError('NOT_A_NUMBER');
2889
- }
2890
-
2891
- return {};
2892
- }
2893
-
2894
- var _parsePhoneNumber = parsePhoneNumber$1(formattedPhoneNumber, options.defaultCountry, options.defaultCallingCode, metadata),
2895
- country = _parsePhoneNumber.country,
2896
- nationalNumber = _parsePhoneNumber.nationalNumber,
2897
- countryCallingCode = _parsePhoneNumber.countryCallingCode,
2898
- countryCallingCodeSource = _parsePhoneNumber.countryCallingCodeSource,
2899
- carrierCode = _parsePhoneNumber.carrierCode;
2900
-
2901
- if (!metadata.hasSelectedNumberingPlan()) {
2902
- if (options.v2) {
2903
- throw new ParseError('INVALID_COUNTRY');
2904
- }
2905
-
2906
- return {};
2907
- } // Validate national (significant) number length.
2908
-
2909
-
2910
- if (!nationalNumber || nationalNumber.length < MIN_LENGTH_FOR_NSN) {
2911
- // Won't throw here because the regexp already demands length > 1.
2912
-
2913
- /* istanbul ignore if */
2914
- if (options.v2) {
2915
- throw new ParseError('TOO_SHORT');
2916
- } // Google's demo just throws an error in this case.
2917
-
2918
-
2919
- return {};
2920
- } // Validate national (significant) number length.
2921
- //
2922
- // A sidenote:
2923
- //
2924
- // They say that sometimes national (significant) numbers
2925
- // can be longer than `MAX_LENGTH_FOR_NSN` (e.g. in Germany).
2926
- // https://github.com/googlei18n/libphonenumber/blob/7e1748645552da39c4e1ba731e47969d97bdb539/resources/phonenumber.proto#L36
2927
- // Such numbers will just be discarded.
2928
- //
2929
-
2930
-
2931
- if (nationalNumber.length > MAX_LENGTH_FOR_NSN) {
2932
- if (options.v2) {
2933
- throw new ParseError('TOO_LONG');
2934
- } // Google's demo just throws an error in this case.
2935
-
2936
-
2937
- return {};
2938
- }
2939
-
2940
- if (options.v2) {
2941
- var phoneNumber = new PhoneNumber(countryCallingCode, nationalNumber, metadata.metadata);
2942
-
2943
- if (country) {
2944
- phoneNumber.country = country;
2945
- }
2946
-
2947
- if (carrierCode) {
2948
- phoneNumber.carrierCode = carrierCode;
2949
- }
2950
-
2951
- if (ext) {
2952
- phoneNumber.ext = ext;
2953
- }
2954
-
2955
- phoneNumber.__countryCallingCodeSource = countryCallingCodeSource;
2956
- return phoneNumber;
2957
- } // Check if national phone number pattern matches the number.
2958
- // National number pattern is different for each country,
2959
- // even for those ones which are part of the "NANPA" group.
2960
-
2961
-
2962
- var valid = (options.extended ? metadata.hasSelectedNumberingPlan() : country) ? matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) : false;
2963
-
2964
- if (!options.extended) {
2965
- return valid ? result(country, nationalNumber, ext) : {};
2966
- } // isInternational: countryCallingCode !== undefined
2967
-
2968
-
2969
- return {
2970
- country: country,
2971
- countryCallingCode: countryCallingCode,
2972
- carrierCode: carrierCode,
2973
- valid: valid,
2974
- possible: valid ? true : options.extended === true && metadata.possibleLengths() && isPossibleNumber(nationalNumber, metadata) ? true : false,
2975
- phone: nationalNumber,
2976
- ext: ext
2977
- };
2978
- }
2979
- /**
2980
- * Extracts a formatted phone number from text.
2981
- * Doesn't guarantee that the extracted phone number
2982
- * is a valid phone number (for example, doesn't validate its length).
2983
- * @param {string} text
2984
- * @param {boolean} [extract] — If `false`, then will parse the entire `text` as a phone number.
2985
- * @param {boolean} [throwOnError] — By default, it won't throw if the text is too long.
2986
- * @return {string}
2987
- * @example
2988
- * // Returns "(213) 373-4253".
2989
- * extractFormattedPhoneNumber("Call (213) 373-4253 for assistance.")
2990
- */
2991
-
2992
- function _extractFormattedPhoneNumber(text, extract, throwOnError) {
2993
- if (!text) {
2994
- return;
2995
- }
2996
-
2997
- if (text.length > MAX_INPUT_STRING_LENGTH) {
2998
- if (throwOnError) {
2999
- throw new ParseError('TOO_LONG');
3000
- }
3001
-
3002
- return;
3003
- }
3004
-
3005
- if (extract === false) {
3006
- return text;
3007
- } // Attempt to extract a possible number from the string passed in
3008
-
3009
-
3010
- var startsAt = text.search(PHONE_NUMBER_START_PATTERN);
3011
-
3012
- if (startsAt < 0) {
3013
- return;
3014
- }
3015
-
3016
- return text // Trim everything to the left of the phone number
3017
- .slice(startsAt) // Remove trailing non-numerical characters
3018
- .replace(AFTER_PHONE_NUMBER_END_PATTERN, '');
3019
- }
3020
- /**
3021
- * @param {string} text - Input.
3022
- * @param {boolean} v2 - Legacy API functions don't pass `v2: true` flag.
3023
- * @param {boolean} [extract] - Whether to extract a phone number from `text`, or attempt to parse the entire text as a phone number.
3024
- * @return {object} `{ ?number, ?ext }`.
3025
- */
3026
-
3027
-
3028
- function parseInput(text, v2, extract) {
3029
- // // Parse RFC 3966 phone number URI.
3030
- // if (text && text.indexOf('tel:') === 0) {
3031
- // return parseRFC3966(text)
3032
- // }
3033
- // let number = extractFormattedPhoneNumber(text, extract, v2)
3034
- var number = extractFormattedPhoneNumberFromPossibleRfc3966NumberUri(text, {
3035
- extractFormattedPhoneNumber: function extractFormattedPhoneNumber(text) {
3036
- return _extractFormattedPhoneNumber(text, extract, v2);
3037
- }
3038
- }); // If the phone number is not viable, then abort.
3039
-
3040
- if (!number) {
3041
- return {};
3042
- }
3043
-
3044
- if (!isViablePhoneNumber(number)) {
3045
- if (isViablePhoneNumberStart(number)) {
3046
- return {
3047
- error: 'TOO_SHORT'
3048
- };
3049
- }
3050
-
3051
- return {};
3052
- } // Attempt to parse extension first, since it doesn't require region-specific
3053
- // data and we want to have the non-normalised number here.
3054
-
3055
-
3056
- var withExtensionStripped = extractExtension(number);
3057
-
3058
- if (withExtensionStripped.ext) {
3059
- return withExtensionStripped;
3060
- }
3061
-
3062
- return {
3063
- number: number
3064
- };
3065
- }
3066
- /**
3067
- * Creates `parse()` result object.
3068
- */
3069
-
3070
-
3071
- function result(country, nationalNumber, ext) {
3072
- var result = {
3073
- country: country,
3074
- phone: nationalNumber
3075
- };
3076
-
3077
- if (ext) {
3078
- result.ext = ext;
3079
- }
3080
-
3081
- return result;
3082
- }
3083
- /**
3084
- * Parses a viable phone number.
3085
- * @param {string} formattedPhoneNumber — Example: "(213) 373-4253".
3086
- * @param {string} [defaultCountry]
3087
- * @param {string} [defaultCallingCode]
3088
- * @param {Metadata} metadata
3089
- * @return {object} Returns `{ country: string?, countryCallingCode: string?, nationalNumber: string? }`.
3090
- */
3091
-
3092
-
3093
- function parsePhoneNumber$1(formattedPhoneNumber, defaultCountry, defaultCallingCode, metadata) {
3094
- // Extract calling code from phone number.
3095
- var _extractCountryCallin = extractCountryCallingCode(parseIncompletePhoneNumber(formattedPhoneNumber), defaultCountry, defaultCallingCode, metadata.metadata),
3096
- countryCallingCodeSource = _extractCountryCallin.countryCallingCodeSource,
3097
- countryCallingCode = _extractCountryCallin.countryCallingCode,
3098
- number = _extractCountryCallin.number; // Choose a country by `countryCallingCode`.
3099
-
3100
-
3101
- var country;
3102
-
3103
- if (countryCallingCode) {
3104
- metadata.selectNumberingPlan(countryCallingCode);
3105
- } // If `formattedPhoneNumber` is passed in "national" format
3106
- // then `number` is defined and `countryCallingCode` is `undefined`.
3107
- else if (number && (defaultCountry || defaultCallingCode)) {
3108
- metadata.selectNumberingPlan(defaultCountry, defaultCallingCode);
3109
-
3110
- if (defaultCountry) {
3111
- country = defaultCountry;
3112
- }
3113
-
3114
- countryCallingCode = defaultCallingCode || getCountryCallingCode(defaultCountry, metadata.metadata);
3115
- } else return {};
3116
-
3117
- if (!number) {
3118
- return {
3119
- countryCallingCodeSource: countryCallingCodeSource,
3120
- countryCallingCode: countryCallingCode
3121
- };
3122
- }
3123
-
3124
- var _extractNationalNumbe = extractNationalNumber(parseIncompletePhoneNumber(number), metadata),
3125
- nationalNumber = _extractNationalNumbe.nationalNumber,
3126
- carrierCode = _extractNationalNumbe.carrierCode; // Sometimes there are several countries
3127
- // corresponding to the same country phone code
3128
- // (e.g. NANPA countries all having `1` country phone code).
3129
- // Therefore, to reliably determine the exact country,
3130
- // national (significant) number should have been parsed first.
3131
- //
3132
- // When `metadata.json` is generated, all "ambiguous" country phone codes
3133
- // get their countries populated with the full set of
3134
- // "phone number type" regular expressions.
3135
- //
3136
-
3137
-
3138
- var exactCountry = getCountryByCallingCode(countryCallingCode, {
3139
- nationalNumber: nationalNumber,
3140
- defaultCountry: defaultCountry,
3141
- metadata: metadata
3142
- });
3143
-
3144
- if (exactCountry) {
3145
- country = exactCountry;
3146
- /* istanbul ignore if */
3147
-
3148
- if (exactCountry === '001') ; else {
3149
- metadata.country(country);
3150
- }
3151
- }
3152
-
3153
- return {
3154
- country: country,
3155
- countryCallingCode: countryCallingCode,
3156
- countryCallingCodeSource: countryCallingCodeSource,
3157
- nationalNumber: nationalNumber,
3158
- carrierCode: carrierCode
3159
- };
3160
- }
3161
-
3162
- function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3163
-
3164
- function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty$3(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3165
-
3166
- function _defineProperty$3(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3167
- function parsePhoneNumberWithError(text, options, metadata) {
3168
- return parse(text, _objectSpread$3(_objectSpread$3({}, options), {}, {
3169
- v2: true
3170
- }), metadata);
3171
- }
3172
-
3173
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
3174
-
3175
- function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3176
-
3177
- function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty$2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3178
-
3179
- function _defineProperty$2(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3180
-
3181
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
3182
-
3183
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3184
-
3185
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
3186
-
3187
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
3188
-
3189
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
3190
-
3191
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
3192
-
3193
- // Extracts the following properties from function arguments:
3194
- // * input `text`
3195
- // * `options` object
3196
- // * `metadata` JSON
3197
- function normalizeArguments(args) {
3198
- var _Array$prototype$slic = Array.prototype.slice.call(args),
3199
- _Array$prototype$slic2 = _slicedToArray(_Array$prototype$slic, 4),
3200
- arg_1 = _Array$prototype$slic2[0],
3201
- arg_2 = _Array$prototype$slic2[1],
3202
- arg_3 = _Array$prototype$slic2[2],
3203
- arg_4 = _Array$prototype$slic2[3];
3204
-
3205
- var text;
3206
- var options;
3207
- var metadata; // If the phone number is passed as a string.
3208
- // `parsePhoneNumber('88005553535', ...)`.
3209
-
3210
- if (typeof arg_1 === 'string') {
3211
- text = arg_1;
3212
- } else throw new TypeError('A text for parsing must be a string.'); // If "default country" argument is being passed then move it to `options`.
3213
- // `parsePhoneNumber('88005553535', 'RU', [options], metadata)`.
3214
-
3215
-
3216
- if (!arg_2 || typeof arg_2 === 'string') {
3217
- if (arg_4) {
3218
- options = arg_3;
3219
- metadata = arg_4;
3220
- } else {
3221
- options = undefined;
3222
- metadata = arg_3;
3223
- }
3224
-
3225
- if (arg_2) {
3226
- options = _objectSpread$2({
3227
- defaultCountry: arg_2
3228
- }, options);
3229
- }
3230
- } // `defaultCountry` is not passed.
3231
- // Example: `parsePhoneNumber('+78005553535', [options], metadata)`.
3232
- else if (isObject(arg_2)) {
3233
- if (arg_3) {
3234
- options = arg_2;
3235
- metadata = arg_3;
3236
- } else {
3237
- metadata = arg_2;
3238
- }
3239
- } else throw new Error("Invalid second argument: ".concat(arg_2));
3240
-
3241
- return {
3242
- text: text,
3243
- options: options,
3244
- metadata: metadata
3245
- };
3246
- } // Otherwise istanbul would show this as "branch not covered".
3247
-
3248
- /* istanbul ignore next */
3249
-
3250
- var isObject = function isObject(_) {
3251
- return _typeof(_) === 'object';
3252
- };
3253
-
3254
- function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3255
-
3256
- function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty$1(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3257
-
3258
- function _defineProperty$1(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3259
- function parsePhoneNumber(text, options, metadata) {
3260
- // Validate `defaultCountry`.
3261
- if (options && options.defaultCountry && !isSupportedCountry(options.defaultCountry, metadata)) {
3262
- options = _objectSpread$1(_objectSpread$1({}, options), {}, {
3263
- defaultCountry: undefined
3264
- });
3265
- } // Parse phone number.
3266
-
3267
-
3268
- try {
3269
- return parsePhoneNumberWithError(text, options, metadata);
3270
- } catch (error) {
3271
- /* istanbul ignore else */
3272
- if (error instanceof ParseError) ; else {
3273
- throw error;
3274
- }
3275
- }
3276
- }
3277
-
3278
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3279
-
3280
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3281
-
3282
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
3283
- function isValidPhoneNumber$1() {
3284
- var _normalizeArguments = normalizeArguments(arguments),
3285
- text = _normalizeArguments.text,
3286
- options = _normalizeArguments.options,
3287
- metadata = _normalizeArguments.metadata;
3288
-
3289
- options = _objectSpread(_objectSpread({}, options), {}, {
3290
- extract: false
3291
- });
3292
- var phoneNumber = parsePhoneNumber(text, options, metadata);
3293
- return phoneNumber && phoneNumber.isValid() || false;
3294
- }
3295
-
3296
- function isValidPhoneNumber() {
3297
- return withMetadataArgument(isValidPhoneNumber$1, arguments)
3298
- }
3299
-
3300
145
  /**
3301
146
  * Get validation rules for a field
3302
147
  *
@@ -3433,7 +278,7 @@ const getEmailValidationRules = (definition) => {
3433
278
  const getPhoneNumberValidationRules = (definition) => {
3434
279
  const defaultRules = {};
3435
280
  const pattern = {
3436
- validate: value => isValidPhoneNumber(value) || value === "",
281
+ validate: value => libphonenumberJs.isValidPhoneNumber(value) || value === "",
3437
282
  };
3438
283
  return definition.uiEditable
3439
284
  ? Object.assign(Object.assign({}, pattern), defaultRules) : defaultRules;