@rpcbase/ui 0.207.0 → 0.208.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.
- package/dist/index.js +7 -7
- package/dist/index19.js +1 -1
- package/dist/index19.js.map +1 -1
- package/dist/index200.js +56 -55
- package/dist/index200.js.map +1 -1
- package/dist/index201.js +60 -8
- package/dist/index201.js.map +1 -1
- package/dist/index202.js +7 -15
- package/dist/index202.js.map +1 -1
- package/dist/index203.js +15 -143
- package/dist/index203.js.map +1 -1
- package/dist/index204.js +145 -4
- package/dist/index204.js.map +1 -1
- package/dist/index205.js +4 -11
- package/dist/index205.js.map +1 -1
- package/dist/index206.js +10 -104
- package/dist/index206.js.map +1 -1
- package/dist/index207.js +94 -347
- package/dist/index207.js.map +1 -1
- package/dist/index208.js +349 -87
- package/dist/index208.js.map +1 -1
- package/dist/index209.js +73 -304
- package/dist/index209.js.map +1 -1
- package/dist/index210.js +309 -193
- package/dist/index210.js.map +1 -1
- package/dist/index211.js +211 -19
- package/dist/index211.js.map +1 -1
- package/dist/index212.js +18 -27
- package/dist/index212.js.map +1 -1
- package/dist/index213.js +27 -187
- package/dist/index213.js.map +1 -1
- package/dist/index214.js +186 -16
- package/dist/index214.js.map +1 -1
- package/dist/index215.js +18 -44
- package/dist/index215.js.map +1 -1
- package/dist/index216.js +60 -8
- package/dist/index216.js.map +1 -1
- package/dist/index217.js +42 -23
- package/dist/index217.js.map +1 -1
- package/dist/index218.js +9 -44
- package/dist/index218.js.map +1 -1
- package/dist/index219.js +25 -18
- package/dist/index219.js.map +1 -1
- package/dist/index220.js +45 -3
- package/dist/index220.js.map +1 -1
- package/dist/index221.js +17 -4
- package/dist/index221.js.map +1 -1
- package/dist/index222.js +3 -21
- package/dist/index222.js.map +1 -1
- package/dist/index223.js +4 -24
- package/dist/index223.js.map +1 -1
- package/dist/index224.js +17 -64
- package/dist/index224.js.map +1 -1
- package/dist/index225.js +23 -13
- package/dist/index225.js.map +1 -1
- package/dist/index226.js +68 -4
- package/dist/index226.js.map +1 -1
- package/dist/index227.js +14 -50
- package/dist/index227.js.map +1 -1
- package/dist/index228.js +4 -6
- package/dist/index228.js.map +1 -1
- package/dist/index229.js +50 -26
- package/dist/index229.js.map +1 -1
- package/dist/index230.js +5 -13
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +25 -8
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +17 -3
- package/dist/index232.js.map +1 -0
- package/dist/index233.js +8 -24
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +2 -71
- package/dist/index235.js +29 -3
- package/dist/index235.js.map +1 -0
- package/dist/index236.js +69 -12
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +3 -54
- package/dist/index238.js +11 -114
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +51 -6
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +115 -13
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +6 -687
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +13 -253
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +662 -676
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +252 -7430
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +700 -6
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +7429 -11
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +5 -4
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +11 -458
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +5 -37
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +458 -18
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +34 -24
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +19 -4
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +23 -54
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +4 -7
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +57 -11
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +8 -3
- package/dist/index256.js.map +1 -1
- package/dist/index257.js +12 -16
- package/dist/index257.js.map +1 -1
- package/dist/index258.js +3 -26
- package/dist/index258.js.map +1 -1
- package/dist/index259.js +15 -42
- package/dist/index259.js.map +1 -1
- package/dist/index260.js +25 -13
- package/dist/index260.js.map +1 -1
- package/dist/index261.js +40 -22
- package/dist/index261.js.map +1 -1
- package/dist/index262.js +13 -17
- package/dist/index262.js.map +1 -1
- package/dist/index263.js +24 -34
- package/dist/index263.js.map +1 -1
- package/dist/index264.js +17 -5
- package/dist/index264.js.map +1 -1
- package/dist/index265.js +35 -9
- package/dist/index265.js.map +1 -1
- package/dist/index266.js +5 -8
- package/dist/index266.js.map +1 -1
- package/dist/index267.js +9 -9
- package/dist/index267.js.map +1 -1
- package/dist/index268.js +8 -10
- package/dist/index268.js.map +1 -1
- package/dist/index269.js +9 -7
- package/dist/index269.js.map +1 -1
- package/dist/index270.js +9 -72
- package/dist/index270.js.map +1 -1
- package/dist/index271.js +7 -171
- package/dist/index271.js.map +1 -1
- package/dist/index272.js +63 -104
- package/dist/index272.js.map +1 -1
- package/dist/index273.js +169 -12
- package/dist/index273.js.map +1 -1
- package/dist/index274.js +109 -75
- package/dist/index274.js.map +1 -1
- package/dist/index275.js +12 -44
- package/dist/index275.js.map +1 -1
- package/dist/index276.js +79 -12
- package/dist/index276.js.map +1 -1
- package/dist/index277.js +45 -15
- package/dist/index277.js.map +1 -1
- package/dist/index278.js +12 -98
- package/dist/index278.js.map +1 -1
- package/dist/index279.js +15 -55
- package/dist/index279.js.map +1 -1
- package/dist/index280.js +89 -98
- package/dist/index280.js.map +1 -1
- package/dist/index281.js +27 -42
- package/dist/index281.js.map +1 -1
- package/dist/index282.js +92 -97
- package/dist/index282.js.map +1 -1
- package/dist/index283.js +62 -46
- package/dist/index283.js.map +1 -1
- package/dist/index284.js +108 -38
- package/dist/index284.js.map +1 -1
- package/dist/index285.js +48 -135
- package/dist/index285.js.map +1 -1
- package/dist/index286.js +43 -139
- package/dist/index286.js.map +1 -1
- package/dist/index287.js +105 -217
- package/dist/index287.js.map +1 -1
- package/dist/index288.js +109 -210
- package/dist/index288.js.map +1 -1
- package/dist/index289.js +168 -212
- package/dist/index289.js.map +1 -1
- package/dist/index290.js +240 -5
- package/dist/index290.js.map +1 -1
- package/dist/index291.js +298 -6
- package/dist/index291.js.map +1 -1
- package/dist/index292.js +5 -7
- package/dist/index292.js.map +1 -1
- package/dist/index293.js +4 -4
- package/dist/index293.js.map +1 -1
- package/dist/index294.js +7 -6
- package/dist/index294.js.map +1 -1
- package/dist/index295.js +6 -21
- package/dist/index295.js.map +1 -1
- package/dist/index296.js +6 -10
- package/dist/index296.js.map +1 -1
- package/dist/index297.js +18 -123
- package/dist/index297.js.map +1 -1
- package/dist/index298.js +10 -164
- package/dist/index298.js.map +1 -1
- package/dist/index299.js +116 -58
- package/dist/index299.js.map +1 -1
- package/dist/index300.js +161 -106
- package/dist/index300.js.map +1 -1
- package/dist/index301.js +66 -489
- package/dist/index301.js.map +1 -1
- package/dist/index302.js +106 -59
- package/dist/index302.js.map +1 -1
- package/dist/index303.js +492 -4
- package/dist/index303.js.map +1 -1
- package/dist/index304.js +62 -27
- package/dist/index304.js.map +1 -1
- package/dist/index305.js +4 -66
- package/dist/index305.js.map +1 -1
- package/dist/index306.js +27 -152
- package/dist/index306.js.map +1 -1
- package/dist/index307.js +59 -555
- package/dist/index307.js.map +1 -1
- package/dist/index308.js +143 -201
- package/dist/index308.js.map +1 -1
- package/dist/index309.js +56 -326
- package/dist/index309.js.map +1 -1
- package/dist/index310.js +553 -260
- package/dist/index310.js.map +1 -1
- package/dist/index311.js +214 -0
- package/dist/index311.js.map +1 -0
- package/dist/index312.js +335 -0
- package/dist/index312.js.map +1 -0
- package/dist/index313.js +272 -0
- package/dist/index313.js.map +1 -0
- package/package.json +2 -2
- package/dist/index234.js.map +0 -1
- package/dist/index237.js.map +0 -1
package/dist/index259.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index259.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index259.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/stripIddPrefix.js"],"sourcesContent":["import Metadata from '../metadata.js';\nimport { VALID_DIGITS } from '../constants.js';\nvar CAPTURING_DIGIT_PATTERN = new RegExp('([' + VALID_DIGITS + '])');\nexport default function stripIddPrefix(number, country, callingCode, metadata) {\n if (!country) {\n return;\n }\n // Check if the number is IDD-prefixed.\n var countryMetadata = new Metadata(metadata);\n countryMetadata.selectNumberingPlan(country, callingCode);\n var IDDPrefixPattern = new RegExp(countryMetadata.IDDPrefix());\n if (number.search(IDDPrefixPattern) !== 0) {\n return;\n }\n // Strip IDD prefix.\n number = number.slice(number.match(IDDPrefixPattern)[0].length);\n // If there're any digits after an IDD prefix,\n // then those digits are a country calling code.\n // Since no country code starts with a `0`,\n // the code below validates that the next digit (if present) is not `0`.\n var matchedGroups = number.match(CAPTURING_DIGIT_PATTERN);\n if (matchedGroups && matchedGroups[1] != null && matchedGroups[1].length > 0) {\n if (matchedGroups[1] === '0') {\n return;\n }\n }\n return number;\n}\n//# sourceMappingURL=stripIddPrefix.js.map"],"x_google_ignoreList":[0],"mappings":";;;AAEA,IAAI,IAA8B,OAAO,OAAO,IAAe,KAAK;AACpE,SAAwB,EAAe,GAAQ,GAAS,GAAa,GAAU;AACxE,QAIL;MAAI,IAAkB,IAAI,EAAS,EAAS;AAC5C,IAAgB,oBAAoB,GAAS,EAAY;EACzD,IAAI,IAAmB,IAAI,OAAO,EAAgB,WAAW,CAAC;AAC1D,QAAO,OAAO,EAAiB,KAAK,GAIxC;OAAS,EAAO,MAAM,EAAO,MAAM,EAAiB,CAAC,GAAG,OAAO;GAK/D,IAAI,IAAgB,EAAO,MAAM,EAAwB;SACrD,KAAiB,EAAc,MAAM,QAAQ,EAAc,GAAG,SAAS,KACrE,EAAc,OAAO,KAI3B,QAAO"}
|
package/dist/index260.js
CHANGED
|
@@ -1,17 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
//#region ../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js
|
|
2
|
+
function e(e, t) {
|
|
3
|
+
if (e && t.numberingPlan.nationalPrefixForParsing()) {
|
|
4
|
+
var n = RegExp("^(?:" + t.numberingPlan.nationalPrefixForParsing() + ")"), r = n.exec(e);
|
|
5
|
+
if (r) {
|
|
6
|
+
var i, a, o = r.length - 1, s = o > 0 && r[o];
|
|
7
|
+
if (t.nationalPrefixTransformRule() && s) i = e.replace(n, t.nationalPrefixTransformRule()), o > 1 && (a = r[1]);
|
|
8
|
+
else {
|
|
9
|
+
var c = r[0];
|
|
10
|
+
i = e.slice(c.length), s && (a = r[1]);
|
|
11
|
+
}
|
|
12
|
+
var l;
|
|
13
|
+
if (s) {
|
|
14
|
+
var u = e.indexOf(r[1]);
|
|
15
|
+
e.slice(0, u) === t.numberingPlan.nationalPrefix() && (l = t.numberingPlan.nationalPrefix());
|
|
16
|
+
} else l = r[0];
|
|
17
|
+
return {
|
|
18
|
+
nationalNumber: i,
|
|
19
|
+
nationalPrefix: l,
|
|
20
|
+
carrierCode: a
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return { nationalNumber: e };
|
|
13
25
|
}
|
|
14
26
|
//#endregion
|
|
15
|
-
export {
|
|
27
|
+
export { e as default };
|
|
16
28
|
|
|
17
29
|
//# sourceMappingURL=index260.js.map
|
package/dist/index260.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index260.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index260.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumberFromPossiblyIncompleteNumber.js"],"sourcesContent":["/**\r\n * Strips any national prefix (such as 0, 1) present in a\r\n * (possibly incomplete) number provided.\r\n * \"Carrier codes\" are only used in Colombia and Brazil,\r\n * and only when dialing within those countries from a mobile phone to a fixed line number.\r\n * Sometimes it won't actually strip national prefix\r\n * and will instead prepend some digits to the `number`:\r\n * for example, when number `2345678` is passed with `VI` country selected,\r\n * it will return `{ number: \"3402345678\" }`, because `340` area code is prepended.\r\n * @param {string} number — National number digits.\r\n * @param {object} metadata — Metadata with country selected.\r\n * @return {object} `{ nationalNumber: string, nationalPrefix: string? carrierCode: string? }`. 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.\r\n */\nexport default function extractNationalNumberFromPossiblyIncompleteNumber(number, metadata) {\n if (number && metadata.numberingPlan.nationalPrefixForParsing()) {\n // See METADATA.md for the description of\n // `national_prefix_for_parsing` and `national_prefix_transform_rule`.\n // Attempt to parse the first digits as a national prefix.\n var prefixPattern = new RegExp('^(?:' + metadata.numberingPlan.nationalPrefixForParsing() + ')');\n var prefixMatch = prefixPattern.exec(number);\n if (prefixMatch) {\n var nationalNumber;\n var carrierCode;\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/blob/master/METADATA.md#national_prefix_for_parsing--national_prefix_transform_rule\n // If a `national_prefix_for_parsing` has any \"capturing groups\"\n // then it means that the national (significant) number is equal to\n // those \"capturing groups\" transformed via `national_prefix_transform_rule`,\n // and nothing could be said about the actual national prefix:\n // what is it and was it even there.\n // If a `national_prefix_for_parsing` doesn't have any \"capturing groups\",\n // then everything it matches is a national prefix.\n // To determine whether `national_prefix_for_parsing` matched any\n // \"capturing groups\", the value of the result of calling `.exec()`\n // is looked at, and if it has non-undefined values where there're\n // \"capturing groups\" in the regular expression, then it means\n // that \"capturing groups\" have been matched.\n // It's not possible to tell whether there'll be any \"capturing gropus\"\n // before the matching process, because a `national_prefix_for_parsing`\n // could exhibit both behaviors.\n var capturedGroupsCount = prefixMatch.length - 1;\n var hasCapturedGroups = capturedGroupsCount > 0 && prefixMatch[capturedGroupsCount];\n if (metadata.nationalPrefixTransformRule() && hasCapturedGroups) {\n nationalNumber = number.replace(prefixPattern, metadata.nationalPrefixTransformRule());\n // If there's more than one captured group,\n // then carrier code is the second one.\n if (capturedGroupsCount > 1) {\n carrierCode = prefixMatch[1];\n }\n }\n // If there're no \"capturing groups\",\n // or if there're \"capturing groups\" but no\n // `national_prefix_transform_rule`,\n // then just strip the national prefix from the number,\n // and possibly a carrier code.\n // Seems like there could be more.\n else {\n // `prefixBeforeNationalNumber` is the whole substring matched by\n // the `national_prefix_for_parsing` regular expression.\n // There seem to be no guarantees that it's just a national prefix.\n // For example, if there's a carrier code, it's gonna be a\n // part of `prefixBeforeNationalNumber` too.\n var prefixBeforeNationalNumber = prefixMatch[0];\n nationalNumber = number.slice(prefixBeforeNationalNumber.length);\n // If there's at least one captured group,\n // then carrier code is the first one.\n if (hasCapturedGroups) {\n carrierCode = prefixMatch[1];\n }\n }\n // Tries to guess whether a national prefix was present in the input.\n // This is not something copy-pasted from Google's library:\n // they don't seem to have an equivalent for that.\n // So this isn't an \"officially approved\" way of doing something like that.\n // But since there seems no other existing method, this library uses it.\n var nationalPrefix;\n if (hasCapturedGroups) {\n var possiblePositionOfTheFirstCapturedGroup = number.indexOf(prefixMatch[1]);\n var possibleNationalPrefix = number.slice(0, possiblePositionOfTheFirstCapturedGroup);\n // Example: an Argentinian (AR) phone number `0111523456789`.\n // `prefixMatch[0]` is `01115`, and `$1` is `11`,\n // and the rest of the phone number is `23456789`.\n // The national number is transformed via `9$1` to `91123456789`.\n // National prefix `0` is detected being present at the start.\n // if (possibleNationalPrefix.indexOf(metadata.numberingPlan.nationalPrefix()) === 0) {\n if (possibleNationalPrefix === metadata.numberingPlan.nationalPrefix()) {\n nationalPrefix = metadata.numberingPlan.nationalPrefix();\n }\n } else {\n nationalPrefix = prefixMatch[0];\n }\n return {\n nationalNumber: nationalNumber,\n nationalPrefix: nationalPrefix,\n carrierCode: carrierCode\n };\n }\n }\n return {\n nationalNumber: number\n };\n}\n//# sourceMappingURL=extractNationalNumberFromPossiblyIncompleteNumber.js.map"],"x_google_ignoreList":[0],"mappings":";AAaA,SAAwB,EAAkD,GAAQ,GAAU;AAC1F,KAAI,KAAU,EAAS,cAAc,0BAA0B,EAAE;EAI/D,IAAI,IAAoB,OAAO,SAAS,EAAS,cAAc,0BAA0B,GAAG,IAAI,EAC5F,IAAc,EAAc,KAAK,EAAO;AAC5C,MAAI,GAAa;GACf,IAAI,GACA,GAiBA,IAAsB,EAAY,SAAS,GAC3C,IAAoB,IAAsB,KAAK,EAAY;AAC/D,OAAI,EAAS,6BAA6B,IAAI,EAI5C,CAHA,IAAiB,EAAO,QAAQ,GAAe,EAAS,6BAA6B,CAAC,EAGlF,IAAsB,MACxB,IAAc,EAAY;QASzB;IAMH,IAAI,IAA6B,EAAY;AAI7C,IAHA,IAAiB,EAAO,MAAM,EAA2B,OAAO,EAG5D,MACF,IAAc,EAAY;;GAQ9B,IAAI;AACJ,OAAI,GAAmB;IACrB,IAAI,IAA0C,EAAO,QAAQ,EAAY,GAAG;AAQ5E,IAP6B,EAAO,MAAM,GAAG,EAAwC,KAOtD,EAAS,cAAc,gBAAgB,KACpE,IAAiB,EAAS,cAAc,gBAAgB;SAG1D,KAAiB,EAAY;AAE/B,UAAO;IACW;IACA;IACH;IACd;;;AAGL,QAAO,EACL,gBAAgB,GACjB"}
|
package/dist/index261.js
CHANGED
|
@@ -1,29 +1,47 @@
|
|
|
1
|
-
import e from "./index250.js";
|
|
2
|
-
import t from "./
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
import { Metadata as e } from "./index250.js";
|
|
2
|
+
import t from "./index255.js";
|
|
3
|
+
//#region ../../node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js
|
|
4
|
+
function n(e, t) {
|
|
5
|
+
var n = typeof Symbol < "u" && e[Symbol.iterator] || e["@@iterator"];
|
|
6
|
+
if (n) return (n = n.call(e)).next.bind(n);
|
|
7
|
+
if (Array.isArray(e) || (n = r(e)) || t && e && typeof e.length == "number") {
|
|
8
|
+
n && (e = n);
|
|
9
|
+
var i = 0;
|
|
10
|
+
return function() {
|
|
11
|
+
return i >= e.length ? { done: !0 } : {
|
|
12
|
+
done: !1,
|
|
13
|
+
value: e[i++]
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
18
|
+
}
|
|
19
|
+
function r(e, t) {
|
|
20
|
+
if (e) {
|
|
21
|
+
if (typeof e == "string") return i(e, t);
|
|
22
|
+
var n = {}.toString.call(e).slice(8, -1);
|
|
23
|
+
return n === "Object" && e.constructor && (n = e.constructor.name), n === "Map" || n === "Set" ? Array.from(e) : n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? i(e, t) : void 0;
|
|
24
|
+
}
|
|
15
25
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
26
|
+
function i(e, t) {
|
|
27
|
+
(t == null || t > e.length) && (t = e.length);
|
|
28
|
+
for (var n = 0, r = Array(t); n < t; n++) r[n] = e[n];
|
|
29
|
+
return r;
|
|
18
30
|
}
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
function a(r, i) {
|
|
32
|
+
var a = i.countries, o = i.metadata;
|
|
33
|
+
o = new e(o);
|
|
34
|
+
for (var s = n(a), c; !(c = s()).done;) {
|
|
35
|
+
var l = c.value;
|
|
36
|
+
if (o.selectNumberingPlan(l), o.leadingDigits()) {
|
|
37
|
+
if (r && r.search(o.leadingDigits()) === 0) return l;
|
|
38
|
+
} else if (t({
|
|
39
|
+
phone: r,
|
|
40
|
+
country: l
|
|
41
|
+
}, void 0, o.metadata)) return l;
|
|
24
42
|
}
|
|
25
43
|
}
|
|
26
44
|
//#endregion
|
|
27
|
-
export {
|
|
45
|
+
export { a as default };
|
|
28
46
|
|
|
29
47
|
//# sourceMappingURL=index261.js.map
|
package/dist/index261.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index261.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index261.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/getCountryByNationalNumber.js"],"sourcesContent":["function _createForOfIteratorHelperLoose(r, e) { var t = \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (t) return (t = t.call(r)).next.bind(t); if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && \"number\" == typeof r.length) { t && (r = t); var o = 0; return function () { return o >= r.length ? { done: !0 } : { done: !1, value: r[o++] }; }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nimport Metadata from '../metadata.js';\nimport getNumberType from './getNumberType.js';\n\n// Returns the exact country that the `nationalPhoneNumber` belongs to\n// in cases of ambiguity, i.e. when multiple countries share the same \"country calling code\".\nexport default function getCountryByNationalNumber(nationalPhoneNumber, _ref) {\n var countries = _ref.countries,\n metadata = _ref.metadata;\n // Re-create `metadata` because it will be selecting a `country`.\n metadata = new Metadata(metadata);\n\n // const matchingCountries = []\n\n for (var _iterator = _createForOfIteratorHelperLoose(countries), _step; !(_step = _iterator()).done;) {\n var country = _step.value;\n metadata.selectNumberingPlan(country);\n // \"Leading digits\" patterns are only defined for about 20% of all countries.\n // By definition, matching \"leading digits\" is a sufficient but not a necessary\n // condition for a phone number to belong to a country.\n // The point of \"leading digits\" check is that it's the fastest one to get a match.\n // https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/METADATA.md#leading_digits\n // I'd suppose that \"leading digits\" patterns are mutually exclusive for different countries\n // because of the intended use of that feature.\n if (metadata.leadingDigits()) {\n if (nationalPhoneNumber && nationalPhoneNumber.search(metadata.leadingDigits()) === 0) {\n return country;\n }\n }\n // Else perform full validation with all of those\n // fixed-line/mobile/etc regular expressions.\n else if (getNumberType({\n phone: nationalPhoneNumber,\n country: country\n }, undefined, metadata.metadata)) {\n // When multiple countries share the same \"country calling code\",\n // type patterns aren't guaranteed to be unique among them.\n // For example, both `US` and `CA` have the same pattern for `toll_free` numbers.\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/103#note_1417147572\n //\n // That means that this `if` condition could be `true` for multiple countries from the list.\n // Currently, it just returns the first one, which is also the \"main\" country for the \"country calling code\".\n // In an example with `toll_free` numbers above, `\"US\"` would be returned even though\n // it could as well be `\"CA\"`.\n //\n // There was also a time when this attempted to be overly smart\n // and kept track of all such multiple matching countries\n // and then picked the one that matched the `defaultCountry`, if provided.\n // For example, with `toll_free` numbers above, and with `defaultCountry: \"CA\"`,\n // it would've returned `\"CA\"` instead of `\"US\"`.\n // Later it turned out that such \"overly smart\" behavior turned out to be just confusing,\n // so this \"overly smart\" country detection was reverted to returning the \"main\" country\n // for the \"country calling code\".\n // https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/154\n //\n return country;\n //\n // The \"overly smart\" behavior code:\n //\n // if (defaultCountry) {\n // \tif (country === defaultCountry) {\n // \t\treturn country\n // \t} else {\n // \t\tmatchingCountries.push(country)\n // \t}\n // } else {\n // \treturn country\n // }\n }\n }\n\n // // Return the first (\"main\") one of the `matchingCountries`.\n // if (matchingCountries.length > 0) {\n // \treturn matchingCountries[0]\n // }\n}\n//# sourceMappingURL=getCountryByNationalNumber.js.map"],"x_google_ignoreList":[0],"mappings":";;;AAAA,SAAS,EAAgC,GAAG,GAAG;CAAE,IAAI,IAAmB,OAAO,SAAtB,OAAgC,EAAE,OAAO,aAAa,EAAE;AAAe,KAAI,EAAG,SAAQ,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,KAAK,EAAE;AAAE,KAAI,MAAM,QAAQ,EAAE,KAAK,IAAI,EAA4B,EAAE,KAAK,KAAK,KAAiB,OAAO,EAAE,UAArB,UAA6B;AAAE,QAAM,IAAI;EAAI,IAAI,IAAI;AAAG,SAAO,WAAY;AAAE,UAAO,KAAK,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,GAAG;IAAE,MAAM,CAAC;IAAG,OAAO,EAAE;IAAM;;;AAAO,OAAU,UAAU,wIAAwI;;AACviB,SAAS,EAA4B,GAAG,GAAG;AAAE,KAAI,GAAG;AAAE,MAAgB,OAAO,KAAnB,SAAsB,QAAO,EAAkB,GAAG,EAAE;EAAE,IAAI,IAAI,EAAE,CAAC,SAAS,KAAK,EAAE,CAAC,MAAM,GAAG,GAAG;AAAE,SAAoB,MAAb,YAAkB,EAAE,gBAAgB,IAAI,EAAE,YAAY,OAAiB,MAAV,SAAyB,MAAV,QAAc,MAAM,KAAK,EAAE,GAAmB,MAAhB,eAAqB,2CAA2C,KAAK,EAAE,GAAG,EAAkB,GAAG,EAAE,GAAG,KAAK;;;AACpX,SAAS,EAAkB,GAAG,GAAG;AAAE,EAAS,KAAR,QAAa,IAAI,EAAE,YAAY,IAAI,EAAE;AAAS,MAAK,IAAI,IAAI,GAAG,IAAI,MAAM,EAAE,EAAE,IAAI,GAAG,IAAK,GAAE,KAAK,EAAE;AAAI,QAAO;;AAMhJ,SAAwB,EAA2B,GAAqB,GAAM;CAC5E,IAAI,IAAY,EAAK,WACnB,IAAW,EAAK;AAElB,KAAW,IAAI,EAAS,EAAS;AAIjC,MAAK,IAAI,IAAY,EAAgC,EAAU,EAAE,GAAO,EAAE,IAAQ,GAAW,EAAE,OAAO;EACpG,IAAI,IAAU,EAAM;AASpB,MARA,EAAS,oBAAoB,EAAQ,EAQjC,EAAS,eAAe;OACtB,KAAuB,EAAoB,OAAO,EAAS,eAAe,CAAC,KAAK,EAClF,QAAO;aAKF,EAAc;GACrB,OAAO;GACE;GACV,EAAE,KAAA,GAAW,EAAS,SAAS,CAqB9B,QAAO"}
|
package/dist/index262.js
CHANGED
|
@@ -1,21 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
number: d
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return { number: a };
|
|
1
|
+
import e from "./index261.js";
|
|
2
|
+
//#region ../../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js
|
|
3
|
+
var t = !1;
|
|
4
|
+
function n(n, r) {
|
|
5
|
+
var i = r.nationalNumber, a = r.metadata;
|
|
6
|
+
/* istanbul ignore if */
|
|
7
|
+
if (t && a.isNonGeographicCallingCode(n)) return "001";
|
|
8
|
+
var o = a.getCountryCodesForCallingCode(n);
|
|
9
|
+
if (o) return o.length === 1 ? o[0] : e(i, {
|
|
10
|
+
countries: o,
|
|
11
|
+
metadata: a.metadata
|
|
12
|
+
});
|
|
17
13
|
}
|
|
18
14
|
//#endregion
|
|
19
|
-
export {
|
|
15
|
+
export { n as default };
|
|
20
16
|
|
|
21
17
|
//# sourceMappingURL=index262.js.map
|
package/dist/index262.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index262.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index262.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/getCountryByCallingCode.js"],"sourcesContent":["import getCountryByNationalNumber from './getCountryByNationalNumber.js';\nvar USE_NON_GEOGRAPHIC_COUNTRY_CODE = false;\n\n// Returns the exact country for the `nationalNumber`\n// that belongs to the specified \"country calling code\".\nexport default function getCountryByCallingCode(callingCode, _ref) {\n var nationalPhoneNumber = _ref.nationalNumber,\n metadata = _ref.metadata;\n /* istanbul ignore if */\n if (USE_NON_GEOGRAPHIC_COUNTRY_CODE) {\n if (metadata.isNonGeographicCallingCode(callingCode)) {\n return '001';\n }\n }\n var possibleCountries = metadata.getCountryCodesForCallingCode(callingCode);\n if (!possibleCountries) {\n return;\n }\n // If there's just one country corresponding to the country code,\n // then just return it, without further phone number digits validation.\n if (possibleCountries.length === 1) {\n return possibleCountries[0];\n }\n return getCountryByNationalNumber(nationalPhoneNumber, {\n countries: possibleCountries,\n metadata: metadata.metadata\n });\n}\n//# sourceMappingURL=getCountryByCallingCode.js.map"],"x_google_ignoreList":[0],"mappings":";;AACA,IAAI,IAAkC;AAItC,SAAwB,EAAwB,GAAa,GAAM;CACjE,IAAI,IAAsB,EAAK,gBAC7B,IAAW,EAAK;;AAElB,KAAI,KACE,EAAS,2BAA2B,EAAY,CAClD,QAAO;CAGX,IAAI,IAAoB,EAAS,8BAA8B,EAAY;AACtE,OAQL,QAHI,EAAkB,WAAW,IACxB,EAAkB,KAEpB,EAA2B,GAAqB;EACrD,WAAW;EACX,UAAU,EAAS;EACpB,CAAC"}
|
package/dist/index263.js
CHANGED
|
@@ -1,39 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import t from "./
|
|
3
|
-
import n from "./
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var c;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
s = new e(s);
|
|
25
|
-
for (var p = 2; p - 1 <= 3 && p <= r.length;) {
|
|
26
|
-
var m = r.slice(1, p);
|
|
27
|
-
if (s.hasCallingCode(m)) return s.selectNumberingPlan(m), {
|
|
28
|
-
countryCallingCodeSource: c ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
|
|
29
|
-
countryCallingCode: m,
|
|
30
|
-
number: r.slice(p)
|
|
31
|
-
};
|
|
32
|
-
p++;
|
|
1
|
+
import e from "./index252.js";
|
|
2
|
+
import t from "./index254.js";
|
|
3
|
+
import n from "./index260.js";
|
|
4
|
+
import r from "./index262.js";
|
|
5
|
+
//#region ../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js
|
|
6
|
+
function i(e, t, i) {
|
|
7
|
+
var s = n(e, i), c = s.carrierCode, l = s.nationalNumber;
|
|
8
|
+
return l !== e && (!a(e, l, i) || i.numberingPlan.possibleLengths() && (t ||= r(i.numberingPlan.callingCode(), {
|
|
9
|
+
nationalNumber: l,
|
|
10
|
+
metadata: i
|
|
11
|
+
}), !o(l, t, i))) ? { nationalNumber: e } : {
|
|
12
|
+
nationalNumber: l,
|
|
13
|
+
carrierCode: c
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function a(e, n, r) {
|
|
17
|
+
return !(t(e, r.nationalNumberPattern()) && !t(n, r.nationalNumberPattern()));
|
|
18
|
+
}
|
|
19
|
+
function o(t, n, r) {
|
|
20
|
+
switch (e(t, n, r)) {
|
|
21
|
+
case "TOO_SHORT":
|
|
22
|
+
case "INVALID_LENGTH": return !1;
|
|
23
|
+
default: return !0;
|
|
33
24
|
}
|
|
34
|
-
return {};
|
|
35
25
|
}
|
|
36
26
|
//#endregion
|
|
37
|
-
export {
|
|
27
|
+
export { i as default };
|
|
38
28
|
|
|
39
29
|
//# sourceMappingURL=index263.js.map
|
package/dist/index263.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index263.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index263.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractNationalNumber.js"],"sourcesContent":["import extractNationalNumberFromPossiblyIncompleteNumber from './extractNationalNumberFromPossiblyIncompleteNumber.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryByCallingCode from './getCountryByCallingCode.js';\n\n/**\r\n * Strips national prefix and carrier code from a complete phone number.\r\n * The difference from the non-\"FromCompleteNumber\" function is that\r\n * it won't extract national prefix if the resultant number is too short\r\n * to be a complete number for the selected phone numbering plan.\r\n * @param {string} number — Complete phone number digits.\r\n * @param {string?} country — Country, if known.\r\n * @param {Metadata} metadata — Metadata with a phone numbering plan selected.\r\n * @return {object} `{ nationalNumber: string, carrierCode: string? }`.\r\n */\nexport default function extractNationalNumber(number, country, metadata) {\n // Parsing national prefixes and carrier codes\n // is only required for local phone numbers\n // but some people don't understand that\n // and sometimes write international phone numbers\n // with national prefixes (or maybe even carrier codes).\n // http://ucken.blogspot.ru/2016/03/trunk-prefixes-in-skype4b.html\n // Google's original library forgives such mistakes\n // and so does this library, because it has been requested:\n // https://github.com/catamphetamine/libphonenumber-js/issues/127\n var _extractNationalNumbe = extractNationalNumberFromPossiblyIncompleteNumber(number, metadata),\n carrierCode = _extractNationalNumbe.carrierCode,\n nationalNumber = _extractNationalNumbe.nationalNumber;\n if (nationalNumber !== number) {\n if (!shouldHaveExtractedNationalPrefix(number, nationalNumber, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n // Check the national (significant) number length after extracting national prefix and carrier code.\n // Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature.\n if (metadata.numberingPlan.possibleLengths()) {\n // If an exact `country` is not specified, attempt to detect it from the assumed national number.\n if (!country) {\n country = getCountryByCallingCode(metadata.numberingPlan.callingCode(), {\n nationalNumber: nationalNumber,\n metadata: metadata\n });\n }\n\n // The number remaining after stripping the national prefix and carrier code\n // should be long enough to have a possible length for the country.\n // Otherwise, don't strip the national prefix and carrier code,\n // since the original number could be a valid number.\n // This check has been copy-pasted \"as is\" from Google's original library:\n // https://github.com/google/libphonenumber/blob/876268eb1ad6cdc1b7b5bef17fc5e43052702d57/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L3236-L3250\n // It doesn't check for the \"possibility\" of the original `number`.\n // I guess it's fine not checking that one. It works as is anyway.\n if (!isPossibleIncompleteNationalNumber(nationalNumber, country, metadata)) {\n // Don't strip the national prefix.\n return {\n nationalNumber: number\n };\n }\n }\n }\n return {\n nationalNumber: nationalNumber,\n carrierCode: carrierCode\n };\n}\n\n// In some countries, the same digit could be a national prefix\n// or a leading digit of a valid phone number.\n// For example, in Russia, national prefix is `8`,\n// and also `800 555 35 35` is a valid number\n// in which `8` is not a national prefix, but the first digit\n// of a national (significant) number.\n// Same's with Belarus:\n// `82004910060` is a valid national (significant) number,\n// but `2004910060` is not.\n// To support such cases (to prevent the code from always stripping\n// national prefix), a condition is imposed: a national prefix\n// is not extracted when the original number is \"viable\" and the\n// resultant number is not, a \"viable\" national number being the one\n// that matches `national_number_pattern`.\nfunction shouldHaveExtractedNationalPrefix(nationalNumberBefore, nationalNumberAfter, metadata) {\n // The equivalent in Google's code is:\n // https://github.com/google/libphonenumber/blob/e326fa1fc4283bb05eb35cb3c15c18f98a31af33/java/libphonenumber/src/com/google/i18n/phonenumbers/PhoneNumberUtil.java#L2969-L3004\n if (matchesEntirely(nationalNumberBefore, metadata.nationalNumberPattern()) && !matchesEntirely(nationalNumberAfter, metadata.nationalNumberPattern())) {\n return false;\n }\n // This \"is possible\" national number (length) check has been commented out\n // because it's superceded by the (effectively) same check done in the\n // `extractNationalNumber()` function after it calls `shouldHaveExtractedNationalPrefix()`.\n // In other words, why run the same check twice if it could only be run once.\n // // Check the national (significant) number length after extracting national prefix and carrier code.\n // // Fixes a minor \"weird behavior\" bug: https://gitlab.com/catamphetamine/libphonenumber-js/-/issues/57\n // // (Legacy generated metadata (before `1.0.18`) didn't support the \"possible lengths\" feature).\n // if (metadata.possibleLengths()) {\n // \tif (isPossibleIncompleteNationalNumber(nationalNumberBefore, metadata) &&\n // \t\t!isPossibleIncompleteNationalNumber(nationalNumberAfter, metadata)) {\n // \t\treturn false\n // \t}\n // }\n return true;\n}\nfunction isPossibleIncompleteNationalNumber(nationalNumber, country, metadata) {\n switch (checkNumberLength(nationalNumber, country, metadata)) {\n case 'TOO_SHORT':\n case 'INVALID_LENGTH':\n // This library ignores \"local-only\" phone numbers (for simplicity).\n // See the readme for more info on what are \"local-only\" phone numbers.\n // case 'IS_POSSIBLE_LOCAL_ONLY':\n return false;\n default:\n return true;\n }\n}\n//# sourceMappingURL=extractNationalNumber.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;AAeA,SAAwB,EAAsB,GAAQ,GAAS,GAAU;CAUvE,IAAI,IAAwB,EAAkD,GAAQ,EAAS,EAC7F,IAAc,EAAsB,aACpC,IAAiB,EAAsB;AAmCzC,QAlCI,MAAmB,MACjB,CAAC,EAAkC,GAAQ,GAAgB,EAAS,IAQpE,EAAS,cAAc,iBAAiB,KAE1C,AACE,MAAU,EAAwB,EAAS,cAAc,aAAa,EAAE;EACtD;EACN;EACX,CAAC,EAWA,CAAC,EAAmC,GAAgB,GAAS,EAAS,KAEjE,EACL,gBAAgB,GACjB,GAIA;EACW;EACH;EACd;;AAiBH,SAAS,EAAkC,GAAsB,GAAqB,GAAU;AAmB9F,QAhBA,EAAI,EAAgB,GAAsB,EAAS,uBAAuB,CAAC,IAAI,CAAC,EAAgB,GAAqB,EAAS,uBAAuB,CAAC;;AAkBxJ,SAAS,EAAmC,GAAgB,GAAS,GAAU;AAC7E,SAAQ,EAAkB,GAAgB,GAAS,EAAS,EAA5D;EACE,KAAK;EACL,KAAK,iBAIH,QAAO;EACT,QACE,QAAO"}
|
package/dist/index264.js
CHANGED
|
@@ -1,9 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { Metadata as e, getCountryCallingCode as t } from "./index250.js";
|
|
2
|
+
import n from "./index252.js";
|
|
3
|
+
import r from "./index254.js";
|
|
4
|
+
import i from "./index263.js";
|
|
5
|
+
//#region ../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js
|
|
6
|
+
function a(a, o, s, c, l) {
|
|
7
|
+
var u = o || s ? t(o || s, l) : c;
|
|
8
|
+
if (a.indexOf(u) === 0) {
|
|
9
|
+
l = new e(l), l.selectNumberingPlan(o || s, u);
|
|
10
|
+
var d = a.slice(u.length), f = i(d, o, l).nationalNumber, p = i(a, o, l).nationalNumber;
|
|
11
|
+
if (!r(p, l.nationalNumberPattern()) && r(f, l.nationalNumberPattern()) || n(p, o, l) === "TOO_LONG") return {
|
|
12
|
+
countryCallingCode: u,
|
|
13
|
+
number: d
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return { number: a };
|
|
5
17
|
}
|
|
6
18
|
//#endregion
|
|
7
|
-
export {
|
|
19
|
+
export { a as default };
|
|
8
20
|
|
|
9
21
|
//# sourceMappingURL=index264.js.map
|
package/dist/index264.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index264.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index264.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js"],"sourcesContent":["import Metadata from '../metadata.js';\nimport matchesEntirely from './matchesEntirely.js';\nimport extractNationalNumber from './extractNationalNumber.js';\nimport checkNumberLength from './checkNumberLength.js';\nimport getCountryCallingCode from '../getCountryCallingCode.js';\n\n/**\r\n * Sometimes some people incorrectly input international phone numbers\r\n * without the leading `+`. This function corrects such input.\r\n * @param {string} number — Phone number digits.\r\n * @param {string} [country] — Exact country of the phone number.\r\n * @param {string} [defaultCountry]\r\n * @param {string} [defaultCallingCode]\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCode: string?, number: string }`.\r\n */\nexport default function extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata) {\n var countryCallingCode = country || defaultCountry ? getCountryCallingCode(country || defaultCountry, metadata) : defaultCallingCode;\n if (number.indexOf(countryCallingCode) === 0) {\n metadata = new Metadata(metadata);\n metadata.selectNumberingPlan(country || defaultCountry, countryCallingCode);\n var possibleShorterNumber = number.slice(countryCallingCode.length);\n var _extractNationalNumbe = extractNationalNumber(possibleShorterNumber, country, metadata),\n possibleShorterNationalNumber = _extractNationalNumbe.nationalNumber;\n var _extractNationalNumbe2 = extractNationalNumber(number, country, metadata),\n nationalNumber = _extractNationalNumbe2.nationalNumber;\n\n // If the number was not valid before but is valid now,\n // or if it was too long before, we consider the number\n // with the country calling code stripped to be a better result\n // and keep that instead.\n // For example, in Germany (+49), `49` is a valid area code,\n // so if a number starts with `49`, it could be both a valid\n // national German number or an international number without\n // a leading `+`.\n if (!matchesEntirely(nationalNumber, metadata.nationalNumberPattern()) && matchesEntirely(possibleShorterNationalNumber, metadata.nationalNumberPattern()) || checkNumberLength(nationalNumber, country, metadata) === 'TOO_LONG') {\n return {\n countryCallingCode: countryCallingCode,\n number: possibleShorterNumber\n };\n }\n }\n return {\n number: number\n };\n}\n//# sourceMappingURL=extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;AAgBA,SAAwB,EAAgE,GAAQ,GAAS,GAAgB,GAAoB,GAAU;CACrJ,IAAI,IAAqB,KAAW,IAAiB,EAAsB,KAAW,GAAgB,EAAS,GAAG;AAClH,KAAI,EAAO,QAAQ,EAAmB,KAAK,GAAG;AAE5C,EADA,IAAW,IAAI,EAAS,EAAS,EACjC,EAAS,oBAAoB,KAAW,GAAgB,EAAmB;EAC3E,IAAI,IAAwB,EAAO,MAAM,EAAmB,OAAO,EAEjE,IAD0B,EAAsB,GAAuB,GAAS,EAAS,CACnC,gBAEtD,IAD2B,EAAsB,GAAQ,GAAS,EAAS,CACnC;AAU1C,MAAI,CAAC,EAAgB,GAAgB,EAAS,uBAAuB,CAAC,IAAI,EAAgB,GAA+B,EAAS,uBAAuB,CAAC,IAAI,EAAkB,GAAgB,GAAS,EAAS,KAAK,WACrN,QAAO;GACe;GACpB,QAAQ;GACT;;AAGL,QAAO,EACG,WACT"}
|
package/dist/index265.js
CHANGED
|
@@ -1,13 +1,39 @@
|
|
|
1
|
-
import e from "./
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
1
|
+
import { Metadata as e } from "./index250.js";
|
|
2
|
+
import t from "./index259.js";
|
|
3
|
+
import n from "./index264.js";
|
|
4
|
+
//#region ../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js
|
|
5
|
+
function r(r, i, a, o, s) {
|
|
6
|
+
if (!r) return {};
|
|
7
|
+
var c;
|
|
8
|
+
if (r[0] !== "+") {
|
|
9
|
+
var l = t(r, i || a, o, s);
|
|
10
|
+
if (l && l !== r) c = !0, r = "+" + l;
|
|
11
|
+
else {
|
|
12
|
+
if (i || a || o) {
|
|
13
|
+
var u = n(r, i, a, o, s), d = u.countryCallingCode, f = u.number;
|
|
14
|
+
if (d) return {
|
|
15
|
+
countryCallingCodeSource: "FROM_NUMBER_WITHOUT_PLUS_SIGN",
|
|
16
|
+
countryCallingCode: d,
|
|
17
|
+
number: f
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
return { number: r };
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (r[1] === "0") return {};
|
|
24
|
+
s = new e(s);
|
|
25
|
+
for (var p = 2; p - 1 <= 3 && p <= r.length;) {
|
|
26
|
+
var m = r.slice(1, p);
|
|
27
|
+
if (s.hasCallingCode(m)) return s.selectNumberingPlan(m), {
|
|
28
|
+
countryCallingCodeSource: c ? "FROM_NUMBER_WITH_IDD" : "FROM_NUMBER_WITH_PLUS_SIGN",
|
|
29
|
+
countryCallingCode: m,
|
|
30
|
+
number: r.slice(p)
|
|
31
|
+
};
|
|
32
|
+
p++;
|
|
33
|
+
}
|
|
34
|
+
return {};
|
|
9
35
|
}
|
|
10
36
|
//#endregion
|
|
11
|
-
export {
|
|
37
|
+
export { r as default };
|
|
12
38
|
|
|
13
39
|
//# sourceMappingURL=index265.js.map
|
package/dist/index265.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index265.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/
|
|
1
|
+
{"version":3,"file":"index265.js","names":[],"sources":["../../../node_modules/libphonenumber-js/es6/helpers/extractCountryCallingCode.js"],"sourcesContent":["import stripIddPrefix from './stripIddPrefix.js';\nimport extractCountryCallingCodeFromInternationalNumberWithoutPlusSign from './extractCountryCallingCodeFromInternationalNumberWithoutPlusSign.js';\nimport Metadata from '../metadata.js';\nimport { MAX_LENGTH_COUNTRY_CODE } from '../constants.js';\n\n/**\r\n * Converts a phone number digits (possibly with a `+`)\r\n * into a calling code and the rest phone number digits.\r\n * The \"rest phone number digits\" could include\r\n * a national prefix, carrier code, and national\r\n * (significant) number.\r\n * @param {string} number — Phone number digits (possibly with a `+`).\r\n * @param {string} [country] — Country.\r\n * @param {string} [defaultCountry] — Default country.\r\n * @param {string} [defaultCallingCode] — Default calling code (some phone numbering plans are non-geographic).\r\n * @param {object} metadata\r\n * @return {object} `{ countryCallingCodeSource: string?, countryCallingCode: string?, number: string }`\r\n * @example\r\n * // Returns `{ countryCallingCode: \"1\", number: \"2133734253\" }`.\r\n * extractCountryCallingCode('2133734253', null, 'US', null, metadata)\r\n * extractCountryCallingCode('2133734253', null, null, '1', metadata)\r\n * extractCountryCallingCode('+12133734253', null, null, null, metadata)\r\n * extractCountryCallingCode('+12133734253', null, 'RU', null, metadata)\r\n */\nexport default function extractCountryCallingCode(number, country, defaultCountry, defaultCallingCode, metadata) {\n if (!number) {\n return {};\n }\n var isNumberWithIddPrefix;\n\n // If this is not an international phone number,\n // then either extract an \"IDD\" prefix, or extract a\n // country calling code from a number by autocorrecting it\n // by prepending a leading `+` in cases when it starts\n // with the country calling code.\n // https://wikitravel.org/en/International_dialling_prefix\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (number[0] !== '+') {\n // Convert an \"out-of-country\" dialing phone number\n // to a proper international phone number.\n var numberWithoutIDD = stripIddPrefix(number, country || defaultCountry, defaultCallingCode, metadata);\n // If an IDD prefix was stripped then\n // convert the number to international one\n // for subsequent parsing.\n if (numberWithoutIDD && numberWithoutIDD !== number) {\n isNumberWithIddPrefix = true;\n number = '+' + numberWithoutIDD;\n } else {\n // Check to see if the number starts with the country calling code\n // for the default country. If so, we remove the country calling code,\n // and do some checks on the validity of the number before and after.\n // https://github.com/catamphetamine/libphonenumber-js/issues/376\n if (country || defaultCountry || defaultCallingCode) {\n var _extractCountryCallin = extractCountryCallingCodeFromInternationalNumberWithoutPlusSign(number, country, defaultCountry, defaultCallingCode, metadata),\n countryCallingCode = _extractCountryCallin.countryCallingCode,\n shorterNumber = _extractCountryCallin.number;\n if (countryCallingCode) {\n return {\n countryCallingCodeSource: 'FROM_NUMBER_WITHOUT_PLUS_SIGN',\n countryCallingCode: countryCallingCode,\n number: shorterNumber\n };\n }\n }\n return {\n // No need to set it to `UNSPECIFIED`. It can be just `undefined`.\n // countryCallingCodeSource: 'UNSPECIFIED',\n number: number\n };\n }\n }\n\n // `number` can only be international at this point.\n\n // Fast abortion: country codes do not begin with a '0'\n if (number[1] === '0') {\n return {};\n }\n metadata = new Metadata(metadata);\n\n // The thing with country phone codes\n // is that they are orthogonal to each other\n // i.e. there's no such country phone code A\n // for which country phone code B exists\n // where B starts with A.\n // Therefore, while scanning digits,\n // if a valid country code is found,\n // that means that it is the country code.\n //\n var i = 2;\n while (i - 1 <= MAX_LENGTH_COUNTRY_CODE && i <= number.length) {\n var _countryCallingCode = number.slice(1, i);\n if (metadata.hasCallingCode(_countryCallingCode)) {\n metadata.selectNumberingPlan(_countryCallingCode);\n return {\n countryCallingCodeSource: isNumberWithIddPrefix ? 'FROM_NUMBER_WITH_IDD' : 'FROM_NUMBER_WITH_PLUS_SIGN',\n countryCallingCode: _countryCallingCode,\n number: number.slice(i)\n };\n }\n i++;\n }\n return {};\n}\n\n// The possible values for the returned `countryCallingCodeSource` are:\n//\n// Copy-pasted from:\n// https://github.com/google/libphonenumber/blob/master/resources/phonenumber.proto\n//\n// // The source from which the country_code is derived. This is not set in the\n// // general parsing method, but in the method that parses and keeps raw_input.\n// // New fields could be added upon request.\n// enum CountryCodeSource {\n// // Default value returned if this is not set, because the phone number was\n// // created using parse, not parseAndKeepRawInput. hasCountryCodeSource will\n// // return false if this is the case.\n// UNSPECIFIED = 0;\n//\n// // The country_code is derived based on a phone number with a leading \"+\",\n// // e.g. the French number \"+33 1 42 68 53 00\".\n// FROM_NUMBER_WITH_PLUS_SIGN = 1;\n//\n// // The country_code is derived based on a phone number with a leading IDD,\n// // e.g. the French number \"011 33 1 42 68 53 00\", as it is dialled from US.\n// FROM_NUMBER_WITH_IDD = 5;\n//\n// // The country_code is derived based on a phone number without a leading\n// // \"+\", e.g. the French number \"33 1 42 68 53 00\" when defaultCountry is\n// // supplied as France.\n// FROM_NUMBER_WITHOUT_PLUS_SIGN = 10;\n//\n// // The country_code is derived NOT based on the phone number itself, but\n// // from the defaultCountry parameter provided in the parsing function by the\n// // clients. This happens mostly for numbers written in the national format\n// // (without country code). For example, this would be set when parsing the\n// // French number \"01 42 68 53 00\", when defaultCountry is supplied as\n// // France.\n// FROM_DEFAULT_COUNTRY = 20;\n// }\n//# sourceMappingURL=extractCountryCallingCode.js.map"],"x_google_ignoreList":[0],"mappings":";;;;AAwBA,SAAwB,EAA0B,GAAQ,GAAS,GAAgB,GAAoB,GAAU;AAC/G,KAAI,CAAC,EACH,QAAO,EAAE;CAEX,IAAI;AASJ,KAAI,EAAO,OAAO,KAAK;EAGrB,IAAI,IAAmB,EAAe,GAAQ,KAAW,GAAgB,GAAoB,EAAS;AAItG,MAAI,KAAoB,MAAqB,EAE3C,CADA,IAAwB,IACxB,IAAS,MAAM;OACV;AAKL,OAAI,KAAW,KAAkB,GAAoB;IACnD,IAAI,IAAwB,EAAgE,GAAQ,GAAS,GAAgB,GAAoB,EAAS,EACxJ,IAAqB,EAAsB,oBAC3C,IAAgB,EAAsB;AACxC,QAAI,EACF,QAAO;KACL,0BAA0B;KACN;KACpB,QAAQ;KACT;;AAGL,UAAO,EAGG,WACT;;;AAOL,KAAI,EAAO,OAAO,IAChB,QAAO,EAAE;AAEX,KAAW,IAAI,EAAS,EAAS;AAYjC,MADA,IAAI,IAAI,GACD,IAAI,KAAA,KAAgC,KAAK,EAAO,SAAQ;EAC7D,IAAI,IAAsB,EAAO,MAAM,GAAG,EAAE;AAC5C,MAAI,EAAS,eAAe,EAAoB,CAE9C,QADA,EAAS,oBAAoB,EAAoB,EAC1C;GACL,0BAA0B,IAAwB,yBAAyB;GAC3E,oBAAoB;GACpB,QAAQ,EAAO,MAAM,EAAE;GACxB;AAEH;;AAEF,QAAO,EAAE"}
|