intl-tel-input 25.0.1 → 25.1.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/README.md +9 -9
- package/build/js/data.js +35 -17
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput.d.ts +6 -1
- package/build/js/intlTelInput.js +61 -32
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +61 -32
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +60 -31
- package/react/build/IntlTelInput.d.ts +6 -1
- package/react/build/IntlTelInput.js +60 -31
- package/react/build/IntlTelInputWithUtils.cjs +60 -31
- package/react/build/IntlTelInputWithUtils.js +60 -31
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +140 -108
- package/vue/build/IntlTelInputWithUtils.mjs +527 -495
|
@@ -9,8 +9,7 @@ const r2 = [
|
|
|
9
9
|
"ax",
|
|
10
10
|
// Åland Islands
|
|
11
11
|
"358",
|
|
12
|
-
1
|
|
13
|
-
["18"]
|
|
12
|
+
1
|
|
14
13
|
],
|
|
15
14
|
[
|
|
16
15
|
"al",
|
|
@@ -77,7 +76,9 @@ const r2 = [
|
|
|
77
76
|
"au",
|
|
78
77
|
// Australia
|
|
79
78
|
"61",
|
|
80
|
-
0
|
|
79
|
+
0,
|
|
80
|
+
null,
|
|
81
|
+
"0"
|
|
81
82
|
],
|
|
82
83
|
[
|
|
83
84
|
"at",
|
|
@@ -258,14 +259,16 @@ const r2 = [
|
|
|
258
259
|
// Christmas Island
|
|
259
260
|
"61",
|
|
260
261
|
2,
|
|
261
|
-
["89164"]
|
|
262
|
+
["89164"],
|
|
263
|
+
"0"
|
|
262
264
|
],
|
|
263
265
|
[
|
|
264
266
|
"cc",
|
|
265
267
|
// Cocos (Keeling) Islands
|
|
266
268
|
"61",
|
|
267
269
|
1,
|
|
268
|
-
["89162"]
|
|
270
|
+
["89162"],
|
|
271
|
+
"0"
|
|
269
272
|
],
|
|
270
273
|
[
|
|
271
274
|
"co",
|
|
@@ -498,7 +501,8 @@ const r2 = [
|
|
|
498
501
|
// Guernsey
|
|
499
502
|
"44",
|
|
500
503
|
1,
|
|
501
|
-
["1481", "7781", "7839", "7911"]
|
|
504
|
+
["1481", "7781", "7839", "7911"],
|
|
505
|
+
"0"
|
|
502
506
|
],
|
|
503
507
|
[
|
|
504
508
|
"gn",
|
|
@@ -570,7 +574,8 @@ const r2 = [
|
|
|
570
574
|
// Isle of Man
|
|
571
575
|
"44",
|
|
572
576
|
2,
|
|
573
|
-
["1624", "74576", "7524", "7924", "7624"]
|
|
577
|
+
["1624", "74576", "7524", "7924", "7624"],
|
|
578
|
+
"0"
|
|
574
579
|
],
|
|
575
580
|
[
|
|
576
581
|
"il",
|
|
@@ -600,7 +605,8 @@ const r2 = [
|
|
|
600
605
|
// Jersey
|
|
601
606
|
"44",
|
|
602
607
|
3,
|
|
603
|
-
["1534", "7509", "7700", "7797", "7829", "7937"]
|
|
608
|
+
["1534", "7509", "7700", "7797", "7829", "7937"],
|
|
609
|
+
"0"
|
|
604
610
|
],
|
|
605
611
|
[
|
|
606
612
|
"jo",
|
|
@@ -612,7 +618,8 @@ const r2 = [
|
|
|
612
618
|
// Kazakhstan
|
|
613
619
|
"7",
|
|
614
620
|
1,
|
|
615
|
-
["33", "7"]
|
|
621
|
+
["33", "7"],
|
|
622
|
+
"8"
|
|
616
623
|
],
|
|
617
624
|
[
|
|
618
625
|
"ke",
|
|
@@ -744,7 +751,8 @@ const r2 = [
|
|
|
744
751
|
// Mayotte
|
|
745
752
|
"262",
|
|
746
753
|
1,
|
|
747
|
-
["269", "639"]
|
|
754
|
+
["269", "639"],
|
|
755
|
+
"0"
|
|
748
756
|
],
|
|
749
757
|
[
|
|
750
758
|
"mx",
|
|
@@ -787,7 +795,9 @@ const r2 = [
|
|
|
787
795
|
"ma",
|
|
788
796
|
// Morocco
|
|
789
797
|
"212",
|
|
790
|
-
0
|
|
798
|
+
0,
|
|
799
|
+
null,
|
|
800
|
+
"0"
|
|
791
801
|
],
|
|
792
802
|
[
|
|
793
803
|
"mz",
|
|
@@ -948,7 +958,9 @@ const r2 = [
|
|
|
948
958
|
"re",
|
|
949
959
|
// Réunion
|
|
950
960
|
"262",
|
|
951
|
-
0
|
|
961
|
+
0,
|
|
962
|
+
null,
|
|
963
|
+
"0"
|
|
952
964
|
],
|
|
953
965
|
[
|
|
954
966
|
"ro",
|
|
@@ -959,7 +971,9 @@ const r2 = [
|
|
|
959
971
|
"ru",
|
|
960
972
|
// Russia
|
|
961
973
|
"7",
|
|
962
|
-
0
|
|
974
|
+
0,
|
|
975
|
+
null,
|
|
976
|
+
"8"
|
|
963
977
|
],
|
|
964
978
|
[
|
|
965
979
|
"rw",
|
|
@@ -1231,7 +1245,9 @@ const r2 = [
|
|
|
1231
1245
|
"gb",
|
|
1232
1246
|
// United Kingdom
|
|
1233
1247
|
"44",
|
|
1234
|
-
0
|
|
1248
|
+
0,
|
|
1249
|
+
null,
|
|
1250
|
+
"0"
|
|
1235
1251
|
],
|
|
1236
1252
|
[
|
|
1237
1253
|
"us",
|
|
@@ -1288,7 +1304,8 @@ const r2 = [
|
|
|
1288
1304
|
// Western Sahara
|
|
1289
1305
|
"212",
|
|
1290
1306
|
1,
|
|
1291
|
-
["5288", "5289"]
|
|
1307
|
+
["5288", "5289"],
|
|
1308
|
+
"0"
|
|
1292
1309
|
],
|
|
1293
1310
|
[
|
|
1294
1311
|
"ye",
|
|
@@ -1307,15 +1324,16 @@ const r2 = [
|
|
|
1307
1324
|
]
|
|
1308
1325
|
], W = [];
|
|
1309
1326
|
for (let y = 0; y < r2.length; y++) {
|
|
1310
|
-
const
|
|
1327
|
+
const e = r2[y];
|
|
1311
1328
|
W[y] = {
|
|
1312
1329
|
name: "",
|
|
1313
1330
|
// this is now populated in the plugin
|
|
1314
|
-
iso2:
|
|
1315
|
-
dialCode:
|
|
1316
|
-
priority:
|
|
1317
|
-
areaCodes:
|
|
1318
|
-
nodeById: {}
|
|
1331
|
+
iso2: e[0],
|
|
1332
|
+
dialCode: e[1],
|
|
1333
|
+
priority: e[2] || 0,
|
|
1334
|
+
areaCodes: e[3] || null,
|
|
1335
|
+
nodeById: {},
|
|
1336
|
+
nationalPrefix: e[4] || null
|
|
1319
1337
|
};
|
|
1320
1338
|
}
|
|
1321
1339
|
const O2 = {
|
|
@@ -1650,45 +1668,45 @@ const l2 = {
|
|
|
1650
1668
|
"888",
|
|
1651
1669
|
"889"
|
|
1652
1670
|
], c1 = (y) => y.replace(/\D/g, ""), s2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), o2 = (y) => {
|
|
1653
|
-
const
|
|
1654
|
-
if (
|
|
1655
|
-
const n =
|
|
1671
|
+
const e = c1(y);
|
|
1672
|
+
if (e.charAt(0) === "1") {
|
|
1673
|
+
const n = e.substr(1, 3);
|
|
1656
1674
|
return U2.indexOf(n) !== -1;
|
|
1657
1675
|
}
|
|
1658
1676
|
return !1;
|
|
1659
|
-
}, V2 = (y,
|
|
1660
|
-
if (n === 0 && !
|
|
1677
|
+
}, V2 = (y, e, n, r) => {
|
|
1678
|
+
if (n === 0 && !r)
|
|
1661
1679
|
return 0;
|
|
1662
1680
|
let o = 0;
|
|
1663
|
-
for (let a = 0; a <
|
|
1664
|
-
if (/[+0-9]/.test(
|
|
1681
|
+
for (let a = 0; a < e.length; a++) {
|
|
1682
|
+
if (/[+0-9]/.test(e[a]) && o++, o === y && !r)
|
|
1665
1683
|
return a + 1;
|
|
1666
|
-
if (
|
|
1684
|
+
if (r && o === y + 1)
|
|
1667
1685
|
return a;
|
|
1668
1686
|
}
|
|
1669
|
-
return
|
|
1670
|
-
}, T = (y,
|
|
1671
|
-
const
|
|
1672
|
-
return
|
|
1673
|
-
}, $1 = (y,
|
|
1687
|
+
return e.length;
|
|
1688
|
+
}, T = (y, e, n) => {
|
|
1689
|
+
const r = document.createElement(y);
|
|
1690
|
+
return e && Object.entries(e).forEach(([o, a]) => r.setAttribute(o, a)), n && n.appendChild(r), r;
|
|
1691
|
+
}, $1 = (y, ...e) => {
|
|
1674
1692
|
const { instances: n } = C;
|
|
1675
|
-
Object.values(n).forEach((
|
|
1693
|
+
Object.values(n).forEach((r) => r[y](...e));
|
|
1676
1694
|
};
|
|
1677
1695
|
class K2 {
|
|
1678
|
-
constructor(
|
|
1679
|
-
this.id = F2++, this.telInput =
|
|
1696
|
+
constructor(e, n = {}) {
|
|
1697
|
+
this.id = F2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, l2, n), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
|
|
1680
1698
|
}
|
|
1681
1699
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1682
1700
|
_init() {
|
|
1683
1701
|
this.options.useFullscreenPopup && (this.options.fixDropdownWidth = !1), this.options.onlyCountries.length === 1 && (this.options.initialCountry = this.options.onlyCountries[0]), this.options.separateDialCode && (this.options.nationalMode = !1), this.options.allowDropdown && !this.options.showFlags && !this.options.separateDialCode && (this.options.nationalMode = !1), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
1684
|
-
const
|
|
1685
|
-
this.showSelectedCountryOnLeft = this.isRTL ?
|
|
1702
|
+
const e = this.options.allowDropdown || this.options.separateDialCode;
|
|
1703
|
+
this.showSelectedCountryOnLeft = this.isRTL ? !e : e, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft), this.options.i18n = { ...u2, ...this.options.i18n };
|
|
1686
1704
|
const n = new Promise((o, a) => {
|
|
1687
1705
|
this.resolveAutoCountryPromise = o, this.rejectAutoCountryPromise = a;
|
|
1688
|
-
}),
|
|
1706
|
+
}), r = new Promise((o, a) => {
|
|
1689
1707
|
this.resolveUtilsScriptPromise = o, this.rejectUtilsScriptPromise = a;
|
|
1690
1708
|
});
|
|
1691
|
-
this.promise = Promise.all([n,
|
|
1709
|
+
this.promise = Promise.all([n, r]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
1692
1710
|
}
|
|
1693
1711
|
//********************
|
|
1694
1712
|
//* PRIVATE METHODS
|
|
@@ -1699,68 +1717,68 @@ class K2 {
|
|
|
1699
1717
|
}
|
|
1700
1718
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1701
1719
|
_sortCountries() {
|
|
1702
|
-
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((
|
|
1703
|
-
const { countryOrder:
|
|
1704
|
-
if (
|
|
1705
|
-
const o =
|
|
1720
|
+
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, n) => {
|
|
1721
|
+
const { countryOrder: r } = this.options;
|
|
1722
|
+
if (r) {
|
|
1723
|
+
const o = r.indexOf(e.iso2), a = r.indexOf(n.iso2), c = o > -1, g = a > -1;
|
|
1706
1724
|
if (c || g)
|
|
1707
1725
|
return c && g ? o - a : c ? -1 : 1;
|
|
1708
1726
|
}
|
|
1709
|
-
return
|
|
1727
|
+
return e.name.localeCompare(n.name);
|
|
1710
1728
|
});
|
|
1711
1729
|
}
|
|
1712
1730
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1713
|
-
_addToDialCodeMap(
|
|
1731
|
+
_addToDialCodeMap(e, n, r) {
|
|
1714
1732
|
n.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = n.length), this.dialCodeToIso2Map.hasOwnProperty(n) || (this.dialCodeToIso2Map[n] = []);
|
|
1715
1733
|
for (let a = 0; a < this.dialCodeToIso2Map[n].length; a++)
|
|
1716
|
-
if (this.dialCodeToIso2Map[n][a] ===
|
|
1734
|
+
if (this.dialCodeToIso2Map[n][a] === e)
|
|
1717
1735
|
return;
|
|
1718
|
-
const o =
|
|
1719
|
-
this.dialCodeToIso2Map[n][o] =
|
|
1736
|
+
const o = r !== void 0 ? r : this.dialCodeToIso2Map[n].length;
|
|
1737
|
+
this.dialCodeToIso2Map[n][o] = e;
|
|
1720
1738
|
}
|
|
1721
1739
|
//* Process onlyCountries or excludeCountries array if present.
|
|
1722
1740
|
_processAllCountries() {
|
|
1723
|
-
const { onlyCountries:
|
|
1724
|
-
if (
|
|
1725
|
-
const
|
|
1741
|
+
const { onlyCountries: e, excludeCountries: n } = this.options;
|
|
1742
|
+
if (e.length) {
|
|
1743
|
+
const r = e.map(
|
|
1726
1744
|
(o) => o.toLowerCase()
|
|
1727
1745
|
);
|
|
1728
1746
|
this.countries = W.filter(
|
|
1729
|
-
(o) =>
|
|
1747
|
+
(o) => r.indexOf(o.iso2) > -1
|
|
1730
1748
|
);
|
|
1731
1749
|
} else if (n.length) {
|
|
1732
|
-
const
|
|
1750
|
+
const r = n.map(
|
|
1733
1751
|
(o) => o.toLowerCase()
|
|
1734
1752
|
);
|
|
1735
1753
|
this.countries = W.filter(
|
|
1736
|
-
(o) =>
|
|
1754
|
+
(o) => r.indexOf(o.iso2) === -1
|
|
1737
1755
|
);
|
|
1738
1756
|
} else
|
|
1739
1757
|
this.countries = W;
|
|
1740
1758
|
}
|
|
1741
1759
|
//* Translate Countries by object literal provided on config.
|
|
1742
1760
|
_translateCountryNames() {
|
|
1743
|
-
for (let
|
|
1744
|
-
const n = this.countries[
|
|
1745
|
-
this.options.i18n.hasOwnProperty(n) && (this.countries[
|
|
1761
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1762
|
+
const n = this.countries[e].iso2.toLowerCase();
|
|
1763
|
+
this.options.i18n.hasOwnProperty(n) && (this.countries[e].name = this.options.i18n[n]);
|
|
1746
1764
|
}
|
|
1747
1765
|
}
|
|
1748
1766
|
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1749
1767
|
_processDialCodes() {
|
|
1750
1768
|
this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
|
|
1751
|
-
for (let
|
|
1752
|
-
const n = this.countries[
|
|
1769
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1770
|
+
const n = this.countries[e];
|
|
1753
1771
|
this.dialCodes[n.dialCode] || (this.dialCodes[n.dialCode] = !0), this._addToDialCodeMap(n.iso2, n.dialCode, n.priority);
|
|
1754
1772
|
}
|
|
1755
|
-
for (let
|
|
1756
|
-
const n = this.countries[
|
|
1773
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1774
|
+
const n = this.countries[e];
|
|
1757
1775
|
if (n.areaCodes) {
|
|
1758
|
-
const
|
|
1776
|
+
const r = this.dialCodeToIso2Map[n.dialCode][0];
|
|
1759
1777
|
for (let o = 0; o < n.areaCodes.length; o++) {
|
|
1760
1778
|
const a = n.areaCodes[o];
|
|
1761
1779
|
for (let c = 1; c < a.length; c++) {
|
|
1762
|
-
const g =
|
|
1763
|
-
this._addToDialCodeMap(
|
|
1780
|
+
const g = a.substr(0, c), f = n.dialCode + g;
|
|
1781
|
+
this._addToDialCodeMap(r, f), this._addToDialCodeMap(n.iso2, f);
|
|
1764
1782
|
}
|
|
1765
1783
|
this._addToDialCodeMap(n.iso2, n.dialCode + a);
|
|
1766
1784
|
}
|
|
@@ -1769,29 +1787,29 @@ class K2 {
|
|
|
1769
1787
|
}
|
|
1770
1788
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1771
1789
|
_generateMarkup() {
|
|
1772
|
-
var
|
|
1790
|
+
var I, A, G;
|
|
1773
1791
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1774
1792
|
const {
|
|
1775
|
-
allowDropdown:
|
|
1793
|
+
allowDropdown: e,
|
|
1776
1794
|
separateDialCode: n,
|
|
1777
|
-
showFlags:
|
|
1795
|
+
showFlags: r,
|
|
1778
1796
|
containerClass: o,
|
|
1779
1797
|
hiddenInput: a,
|
|
1780
1798
|
dropdownContainer: c,
|
|
1781
1799
|
fixDropdownWidth: g,
|
|
1782
1800
|
useFullscreenPopup: f,
|
|
1783
|
-
countrySearch:
|
|
1801
|
+
countrySearch: S,
|
|
1784
1802
|
i18n: _
|
|
1785
1803
|
} = this.options;
|
|
1786
|
-
let
|
|
1787
|
-
|
|
1788
|
-
const
|
|
1789
|
-
if ((
|
|
1804
|
+
let b = "iti";
|
|
1805
|
+
e && (b += " iti--allow-dropdown"), r && (b += " iti--show-flags"), o && (b += ` ${o}`), f || (b += " iti--inline-dropdown");
|
|
1806
|
+
const w = T("div", { class: b });
|
|
1807
|
+
if ((I = this.telInput.parentNode) == null || I.insertBefore(w, this.telInput), e || r || n) {
|
|
1790
1808
|
this.countryContainer = T(
|
|
1791
1809
|
"div",
|
|
1792
1810
|
{ class: "iti__country-container" },
|
|
1793
|
-
|
|
1794
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px",
|
|
1811
|
+
w
|
|
1812
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = T(
|
|
1795
1813
|
"button",
|
|
1796
1814
|
{
|
|
1797
1815
|
type: "button",
|
|
@@ -1813,7 +1831,7 @@ class K2 {
|
|
|
1813
1831
|
"span",
|
|
1814
1832
|
{ class: "iti__a11y-text" },
|
|
1815
1833
|
this.selectedCountryInner
|
|
1816
|
-
),
|
|
1834
|
+
), e && (this.dropdownArrow = T(
|
|
1817
1835
|
"div",
|
|
1818
1836
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1819
1837
|
F
|
|
@@ -1821,12 +1839,12 @@ class K2 {
|
|
|
1821
1839
|
"div",
|
|
1822
1840
|
{ class: "iti__selected-dial-code" },
|
|
1823
1841
|
this.selectedCountry
|
|
1824
|
-
)),
|
|
1842
|
+
)), e) {
|
|
1825
1843
|
const M = g ? "" : "iti--flexible-dropdown-width";
|
|
1826
1844
|
if (this.dropdownContent = T("div", {
|
|
1827
1845
|
id: `iti-${this.id}__dropdown-content`,
|
|
1828
1846
|
class: `iti__dropdown-content iti__hide ${M}`
|
|
1829
|
-
}),
|
|
1847
|
+
}), S && (this.searchInput = T(
|
|
1830
1848
|
"input",
|
|
1831
1849
|
{
|
|
1832
1850
|
type: "text",
|
|
@@ -1853,39 +1871,39 @@ class K2 {
|
|
|
1853
1871
|
"aria-label": _.countryListAriaLabel
|
|
1854
1872
|
},
|
|
1855
1873
|
this.dropdownContent
|
|
1856
|
-
), this._appendListItems(),
|
|
1874
|
+
), this._appendListItems(), S && this._updateSearchResultsText(), c) {
|
|
1857
1875
|
let x = "iti iti--container";
|
|
1858
1876
|
f ? x += " iti--fullscreen-popup" : x += " iti--inline-dropdown", this.dropdown = T("div", { class: x }), this.dropdown.appendChild(this.dropdownContent);
|
|
1859
1877
|
} else
|
|
1860
1878
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1861
1879
|
}
|
|
1862
1880
|
}
|
|
1863
|
-
if (
|
|
1881
|
+
if (w.appendChild(this.telInput), this._updateInputPadding(), a) {
|
|
1864
1882
|
const F = this.telInput.getAttribute("name") || "", M = a(F);
|
|
1865
1883
|
if (M.phone) {
|
|
1866
1884
|
const x = (A = this.telInput.form) == null ? void 0 : A.querySelector(`input[name="${M.phone}"]`);
|
|
1867
1885
|
x ? this.hiddenInput = x : (this.hiddenInput = T("input", {
|
|
1868
1886
|
type: "hidden",
|
|
1869
1887
|
name: M.phone
|
|
1870
|
-
}),
|
|
1888
|
+
}), w.appendChild(this.hiddenInput));
|
|
1871
1889
|
}
|
|
1872
1890
|
if (M.country) {
|
|
1873
1891
|
const x = (G = this.telInput.form) == null ? void 0 : G.querySelector(`input[name="${M.country}"]`);
|
|
1874
1892
|
x ? this.hiddenInputCountry = x : (this.hiddenInputCountry = T("input", {
|
|
1875
1893
|
type: "hidden",
|
|
1876
1894
|
name: M.country
|
|
1877
|
-
}),
|
|
1895
|
+
}), w.appendChild(this.hiddenInputCountry));
|
|
1878
1896
|
}
|
|
1879
1897
|
}
|
|
1880
1898
|
}
|
|
1881
1899
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1882
1900
|
_appendListItems() {
|
|
1883
|
-
for (let
|
|
1884
|
-
const n = this.countries[
|
|
1901
|
+
for (let e = 0; e < this.countries.length; e++) {
|
|
1902
|
+
const n = this.countries[e], r = e === 0 ? "iti__highlight" : "", o = T(
|
|
1885
1903
|
"li",
|
|
1886
1904
|
{
|
|
1887
1905
|
id: `iti-${this.id}__item-${n.iso2}`,
|
|
1888
|
-
class: `iti__country ${
|
|
1906
|
+
class: `iti__country ${r}`,
|
|
1889
1907
|
tabindex: "-1",
|
|
1890
1908
|
role: "option",
|
|
1891
1909
|
"data-dial-code": n.dialCode,
|
|
@@ -1902,13 +1920,13 @@ class K2 {
|
|
|
1902
1920
|
//* Set the initial state of the input value and the selected country by:
|
|
1903
1921
|
//* 1. Extracting a dial code from the given number
|
|
1904
1922
|
//* 2. Using explicit initialCountry
|
|
1905
|
-
_setInitialState(
|
|
1906
|
-
const n = this.telInput.getAttribute("value"),
|
|
1923
|
+
_setInitialState(e = !1) {
|
|
1924
|
+
const n = this.telInput.getAttribute("value"), r = this.telInput.value, a = n && n.charAt(0) === "+" && (!r || r.charAt(0) !== "+") ? n : r, c = this._getDialCode(a), g = o2(a), { initialCountry: f, geoIpLookup: S } = this.options, _ = f === "auto" && S;
|
|
1907
1925
|
if (c && !g)
|
|
1908
1926
|
this._updateCountryFromNumber(a);
|
|
1909
|
-
else if (!_ ||
|
|
1910
|
-
const
|
|
1911
|
-
|
|
1927
|
+
else if (!_ || e) {
|
|
1928
|
+
const b = f ? f.toLowerCase() : "";
|
|
1929
|
+
b && this._getCountryData(b, !0) ? this._setCountry(b) : c && g ? this._setCountry("us") : this._setCountry();
|
|
1912
1930
|
}
|
|
1913
1931
|
a && this._updateValFromNumber(a);
|
|
1914
1932
|
}
|
|
@@ -1918,10 +1936,10 @@ class K2 {
|
|
|
1918
1936
|
}
|
|
1919
1937
|
//* Update hidden input on form submit.
|
|
1920
1938
|
_initHiddenInputListener() {
|
|
1921
|
-
var
|
|
1939
|
+
var e;
|
|
1922
1940
|
this._handleHiddenInputSubmit = () => {
|
|
1923
1941
|
this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "");
|
|
1924
|
-
}, (
|
|
1942
|
+
}, (e = this.telInput.form) == null || e.addEventListener(
|
|
1925
1943
|
"submit",
|
|
1926
1944
|
this._handleHiddenInputSubmit
|
|
1927
1945
|
);
|
|
@@ -1931,8 +1949,8 @@ class K2 {
|
|
|
1931
1949
|
this._handleLabelClick = (n) => {
|
|
1932
1950
|
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : n.preventDefault();
|
|
1933
1951
|
};
|
|
1934
|
-
const
|
|
1935
|
-
|
|
1952
|
+
const e = this.telInput.closest("label");
|
|
1953
|
+
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
1936
1954
|
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
1937
1955
|
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (n) => {
|
|
1938
1956
|
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === "Tab" && this._closeDropdown();
|
|
@@ -1943,18 +1961,18 @@ class K2 {
|
|
|
1943
1961
|
}
|
|
1944
1962
|
//* Init many requests: utils script / geo ip lookup.
|
|
1945
1963
|
_initRequests() {
|
|
1946
|
-
let { loadUtils:
|
|
1947
|
-
|
|
1964
|
+
let { loadUtils: e, initialCountry: n, geoIpLookup: r } = this.options;
|
|
1965
|
+
e && !C.utils ? (this._handlePageLoad = () => {
|
|
1948
1966
|
var a;
|
|
1949
|
-
window.removeEventListener("load", this._handlePageLoad), (a = C.attachUtils(
|
|
1967
|
+
window.removeEventListener("load", this._handlePageLoad), (a = C.attachUtils(e)) == null || a.catch(() => {
|
|
1950
1968
|
});
|
|
1951
|
-
}, C.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), n === "auto" &&
|
|
1969
|
+
}, C.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), n === "auto" && r && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1952
1970
|
}
|
|
1953
1971
|
//* Perform the geo ip lookup.
|
|
1954
1972
|
_loadAutoCountry() {
|
|
1955
1973
|
C.autoCountry ? this.handleAutoCountry() : C.startedLoadingAutoCountry || (C.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1956
|
-
(
|
|
1957
|
-
const n =
|
|
1974
|
+
(e = "") => {
|
|
1975
|
+
const n = e.toLowerCase();
|
|
1958
1976
|
n && this._getCountryData(n, !0) ? (C.autoCountry = n, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
|
|
1959
1977
|
},
|
|
1960
1978
|
() => {
|
|
@@ -1967,68 +1985,68 @@ class K2 {
|
|
|
1967
1985
|
}
|
|
1968
1986
|
//* Initialize the tel input listeners.
|
|
1969
1987
|
_initTelInputListeners() {
|
|
1970
|
-
const { strictMode:
|
|
1988
|
+
const { strictMode: e, formatAsYouType: n, separateDialCode: r, formatOnDisplay: o, allowDropdown: a, countrySearch: c } = this.options;
|
|
1971
1989
|
let g = !1;
|
|
1972
1990
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (g = !0), this._handleInputEvent = (f) => {
|
|
1973
|
-
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" &&
|
|
1974
|
-
const
|
|
1975
|
-
this.telInput.value =
|
|
1991
|
+
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" && r && a && c) {
|
|
1992
|
+
const w = this.telInput.selectionStart || 0, I = this.telInput.value.substring(0, w - 1), A = this.telInput.value.substring(w);
|
|
1993
|
+
this.telInput.value = I + A, this._openDropdownWithPlus();
|
|
1976
1994
|
return;
|
|
1977
1995
|
}
|
|
1978
1996
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1979
|
-
const
|
|
1980
|
-
|
|
1981
|
-
const
|
|
1982
|
-
if (n && !g && !
|
|
1983
|
-
const
|
|
1997
|
+
const S = (f == null ? void 0 : f.data) && /[^+0-9]/.test(f.data), _ = (f == null ? void 0 : f.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1998
|
+
S || _ && !e ? g = !0 : /[^+0-9]/.test(this.telInput.value) || (g = !1);
|
|
1999
|
+
const b = (f == null ? void 0 : f.detail) && f.detail.isSetNumber && !o;
|
|
2000
|
+
if (n && !g && !b) {
|
|
2001
|
+
const w = this.telInput.selectionStart || 0, A = this.telInput.value.substring(0, w).replace(/[^+0-9]/g, "").length, G = (f == null ? void 0 : f.inputType) === "deleteContentForward", F = this._formatNumberAsYouType(), M = V2(A, F, w, G);
|
|
1984
2002
|
this.telInput.value = F, this.telInput.setSelectionRange(M, M);
|
|
1985
2003
|
}
|
|
1986
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (
|
|
2004
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (e || r) && (this._handleKeydownEvent = (f) => {
|
|
1987
2005
|
if (f.key && f.key.length === 1 && !f.altKey && !f.ctrlKey && !f.metaKey) {
|
|
1988
|
-
if (
|
|
2006
|
+
if (r && a && c && f.key === "+") {
|
|
1989
2007
|
f.preventDefault(), this._openDropdownWithPlus();
|
|
1990
2008
|
return;
|
|
1991
2009
|
}
|
|
1992
|
-
if (
|
|
1993
|
-
const
|
|
2010
|
+
if (e) {
|
|
2011
|
+
const S = this.telInput.value, _ = S.charAt(0) === "+", b = !_ && this.telInput.selectionStart === 0 && f.key === "+", w = /^[0-9]$/.test(f.key), I = r ? w : b || w, A = S.slice(0, this.telInput.selectionStart) + f.key + S.slice(this.telInput.selectionEnd), G = this._getFullNumber(A), F = C.utils.getCoreNumber(G, this.selectedCountryData.iso2), M = this.maxCoreNumberLength && F.length > this.maxCoreNumberLength;
|
|
1994
2012
|
let x = !1;
|
|
1995
2013
|
if (_) {
|
|
1996
2014
|
const f1 = this.selectedCountryData.iso2;
|
|
1997
2015
|
x = this._getCountryFromNumber(G) !== f1;
|
|
1998
2016
|
}
|
|
1999
|
-
(!
|
|
2017
|
+
(!I || M && !x && !b) && f.preventDefault();
|
|
2000
2018
|
}
|
|
2001
2019
|
}
|
|
2002
2020
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
2003
2021
|
}
|
|
2004
2022
|
//* Adhere to the input's maxlength attr.
|
|
2005
|
-
_cap(
|
|
2023
|
+
_cap(e) {
|
|
2006
2024
|
const n = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
2007
|
-
return n &&
|
|
2025
|
+
return n && e.length > n ? e.substr(0, n) : e;
|
|
2008
2026
|
}
|
|
2009
2027
|
//* Trigger a custom event on the input.
|
|
2010
|
-
_trigger(
|
|
2011
|
-
const
|
|
2028
|
+
_trigger(e, n = {}) {
|
|
2029
|
+
const r = new CustomEvent(e, {
|
|
2012
2030
|
bubbles: !0,
|
|
2013
2031
|
cancelable: !0,
|
|
2014
2032
|
detail: n
|
|
2015
2033
|
});
|
|
2016
|
-
this.telInput.dispatchEvent(
|
|
2034
|
+
this.telInput.dispatchEvent(r);
|
|
2017
2035
|
}
|
|
2018
2036
|
//* Open the dropdown.
|
|
2019
2037
|
_openDropdown() {
|
|
2020
|
-
const { fixDropdownWidth:
|
|
2021
|
-
if (
|
|
2022
|
-
const
|
|
2023
|
-
|
|
2038
|
+
const { fixDropdownWidth: e, countrySearch: n } = this.options;
|
|
2039
|
+
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), n) {
|
|
2040
|
+
const r = this.countryList.firstElementChild;
|
|
2041
|
+
r && (this._highlightListItem(r, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
|
|
2024
2042
|
}
|
|
2025
2043
|
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2026
2044
|
}
|
|
2027
2045
|
//* Set the dropdown position
|
|
2028
2046
|
_setDropdownPosition() {
|
|
2029
2047
|
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2030
|
-
const
|
|
2031
|
-
this.options.dropdownContainer && (this.dropdown.style.top = `${
|
|
2048
|
+
const e = this.telInput.getBoundingClientRect(), n = this.telInput.offsetHeight;
|
|
2049
|
+
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + n}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
|
|
2032
2050
|
}
|
|
2033
2051
|
}
|
|
2034
2052
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
@@ -2045,16 +2063,16 @@ class K2 {
|
|
|
2045
2063
|
const a = (c = o.target) == null ? void 0 : c.closest(".iti__country");
|
|
2046
2064
|
a && this._selectListItem(a);
|
|
2047
2065
|
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
2048
|
-
let
|
|
2066
|
+
let e = !0;
|
|
2049
2067
|
this._handleClickOffToClose = () => {
|
|
2050
|
-
|
|
2068
|
+
e || this._closeDropdown(), e = !1;
|
|
2051
2069
|
}, document.documentElement.addEventListener(
|
|
2052
2070
|
"click",
|
|
2053
2071
|
this._handleClickOffToClose
|
|
2054
2072
|
);
|
|
2055
|
-
let n = "",
|
|
2073
|
+
let n = "", r = null;
|
|
2056
2074
|
if (this._handleKeydownOnDropdown = (o) => {
|
|
2057
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === "ArrowUp" || o.key === "ArrowDown" ? this._handleUpDownKey(o.key) : o.key === "Enter" ? this._handleEnterKey() : o.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(o.key) && (o.stopPropagation(),
|
|
2075
|
+
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === "ArrowUp" || o.key === "ArrowDown" ? this._handleUpDownKey(o.key) : o.key === "Enter" ? this._handleEnterKey() : o.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(o.key) && (o.stopPropagation(), r && clearTimeout(r), n += o.key.toLowerCase(), this._searchForCountry(n), r = setTimeout(() => {
|
|
2058
2076
|
n = "";
|
|
2059
2077
|
}, 1e3));
|
|
2060
2078
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
@@ -2071,41 +2089,41 @@ class K2 {
|
|
|
2071
2089
|
}
|
|
2072
2090
|
}
|
|
2073
2091
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2074
|
-
_searchForCountry(
|
|
2092
|
+
_searchForCountry(e) {
|
|
2075
2093
|
for (let n = 0; n < this.countries.length; n++) {
|
|
2076
|
-
const
|
|
2077
|
-
if (
|
|
2078
|
-
const a =
|
|
2094
|
+
const r = this.countries[n];
|
|
2095
|
+
if (r.name.substr(0, e.length).toLowerCase() === e) {
|
|
2096
|
+
const a = r.nodeById[this.id];
|
|
2079
2097
|
this._highlightListItem(a, !1), this._scrollTo(a);
|
|
2080
2098
|
break;
|
|
2081
2099
|
}
|
|
2082
2100
|
}
|
|
2083
2101
|
}
|
|
2084
2102
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2085
|
-
_filterCountries(
|
|
2086
|
-
let
|
|
2103
|
+
_filterCountries(e, n = !1) {
|
|
2104
|
+
let r = !0;
|
|
2087
2105
|
this.countryList.innerHTML = "";
|
|
2088
|
-
const o = s2(
|
|
2106
|
+
const o = s2(e);
|
|
2089
2107
|
for (let a = 0; a < this.countries.length; a++) {
|
|
2090
|
-
const c = this.countries[a], g = s2(c.name), f = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((_) => _[0]).join("").toLowerCase(),
|
|
2091
|
-
if (n || g.includes(o) ||
|
|
2108
|
+
const c = this.countries[a], g = s2(c.name), f = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((_) => _[0]).join("").toLowerCase(), S = `+${c.dialCode}`;
|
|
2109
|
+
if (n || g.includes(o) || S.includes(o) || c.iso2.includes(o) || f.includes(o)) {
|
|
2092
2110
|
const _ = c.nodeById[this.id];
|
|
2093
|
-
_ && this.countryList.appendChild(_),
|
|
2111
|
+
_ && this.countryList.appendChild(_), r && (this._highlightListItem(_, !1), r = !1);
|
|
2094
2112
|
}
|
|
2095
2113
|
}
|
|
2096
|
-
|
|
2114
|
+
r && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
2097
2115
|
}
|
|
2098
2116
|
//* Update search results text (for a11y).
|
|
2099
2117
|
_updateSearchResultsText() {
|
|
2100
|
-
const { i18n:
|
|
2101
|
-
let
|
|
2102
|
-
n === 0 ?
|
|
2118
|
+
const { i18n: e } = this.options, n = this.countryList.childElementCount;
|
|
2119
|
+
let r;
|
|
2120
|
+
n === 0 ? r = e.zeroSearchResults : n === 1 ? r = e.oneSearchResult : r = e.multipleSearchResults.replace("${count}", n.toString()), this.searchResultsA11yText.textContent = r;
|
|
2103
2121
|
}
|
|
2104
2122
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2105
|
-
_handleUpDownKey(
|
|
2106
|
-
var
|
|
2107
|
-
let n =
|
|
2108
|
-
!n && this.countryList.childElementCount > 1 && (n =
|
|
2123
|
+
_handleUpDownKey(e) {
|
|
2124
|
+
var r, o;
|
|
2125
|
+
let n = e === "ArrowUp" ? (r = this.highlightedItem) == null ? void 0 : r.previousElementSibling : (o = this.highlightedItem) == null ? void 0 : o.nextElementSibling;
|
|
2126
|
+
!n && this.countryList.childElementCount > 1 && (n = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), n && (this._scrollTo(n), this._highlightListItem(n, !1));
|
|
2109
2127
|
}
|
|
2110
2128
|
//* Select the currently highlighted item.
|
|
2111
2129
|
_handleEnterKey() {
|
|
@@ -2113,10 +2131,10 @@ class K2 {
|
|
|
2113
2131
|
}
|
|
2114
2132
|
//* Update the input's value to the given val (format first if possible)
|
|
2115
2133
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2116
|
-
_updateValFromNumber(
|
|
2117
|
-
let n =
|
|
2134
|
+
_updateValFromNumber(e) {
|
|
2135
|
+
let n = e;
|
|
2118
2136
|
if (this.options.formatOnDisplay && C.utils && this.selectedCountryData) {
|
|
2119
|
-
const
|
|
2137
|
+
const r = this.options.nationalMode || n.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: o, INTERNATIONAL: a } = C.utils.numberFormat, c = r ? o : a;
|
|
2120
2138
|
n = C.utils.formatNumber(
|
|
2121
2139
|
n,
|
|
2122
2140
|
this.selectedCountryData.iso2,
|
|
@@ -2127,35 +2145,49 @@ class K2 {
|
|
|
2127
2145
|
}
|
|
2128
2146
|
//* Check if need to select a new country based on the given number
|
|
2129
2147
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2130
|
-
_updateCountryFromNumber(
|
|
2131
|
-
const n = this._getCountryFromNumber(
|
|
2148
|
+
_updateCountryFromNumber(e) {
|
|
2149
|
+
const n = this._getCountryFromNumber(e);
|
|
2132
2150
|
return n !== null ? this._setCountry(n) : !1;
|
|
2133
2151
|
}
|
|
2134
|
-
|
|
2135
|
-
const n =
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2152
|
+
_ensureHasDialCode(e) {
|
|
2153
|
+
const { dialCode: n, nationalPrefix: r } = this.selectedCountryData;
|
|
2154
|
+
if (e.charAt(0) === "+" || !n)
|
|
2155
|
+
return e;
|
|
2156
|
+
const c = r && e.charAt(0) === r && !this.options.separateDialCode ? e.substring(1) : e;
|
|
2157
|
+
return `+${n}${c}`;
|
|
2158
|
+
}
|
|
2159
|
+
_getCountryFromNumber(e) {
|
|
2160
|
+
const n = e.indexOf("+");
|
|
2161
|
+
let r = n ? e.substring(n) : e;
|
|
2162
|
+
const o = this.selectedCountryData.iso2, a = this.selectedCountryData.dialCode;
|
|
2163
|
+
r = this._ensureHasDialCode(r);
|
|
2164
|
+
const c = this._getDialCode(r, !0);
|
|
2165
|
+
if (c && c === this.prevDialCodeMatch)
|
|
2166
|
+
return null;
|
|
2167
|
+
this.prevDialCodeMatch = c;
|
|
2168
|
+
const g = c1(r);
|
|
2140
2169
|
if (c) {
|
|
2141
|
-
const f =
|
|
2142
|
-
if (!
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2170
|
+
const f = c1(c), S = this.dialCodeToIso2Map[f];
|
|
2171
|
+
if (!o && this.defaultCountry && S.includes(this.defaultCountry))
|
|
2172
|
+
return this.defaultCountry;
|
|
2173
|
+
const _ = o && S.includes(o) && g.length === f.length;
|
|
2174
|
+
if (!(a === "1" && o2(g)) && !_) {
|
|
2175
|
+
for (let w = 0; w < S.length; w++)
|
|
2176
|
+
if (S[w])
|
|
2177
|
+
return S[w];
|
|
2146
2178
|
}
|
|
2147
2179
|
} else {
|
|
2148
|
-
if (
|
|
2180
|
+
if (r.charAt(0) === "+" && g.length)
|
|
2149
2181
|
return "";
|
|
2150
|
-
if ((!
|
|
2182
|
+
if ((!r || r === "+") && !this.selectedCountryData.iso2)
|
|
2151
2183
|
return this.defaultCountry;
|
|
2152
2184
|
}
|
|
2153
2185
|
return null;
|
|
2154
2186
|
}
|
|
2155
2187
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2156
|
-
_highlightListItem(
|
|
2157
|
-
const
|
|
2158
|
-
if (
|
|
2188
|
+
_highlightListItem(e, n) {
|
|
2189
|
+
const r = this.highlightedItem;
|
|
2190
|
+
if (r && (r.classList.remove("iti__highlight"), r.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) {
|
|
2159
2191
|
this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
|
|
2160
2192
|
const o = this.highlightedItem.getAttribute("id") || "";
|
|
2161
2193
|
this.selectedCountry.setAttribute("aria-activedescendant", o), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", o);
|
|
@@ -2164,27 +2196,27 @@ class K2 {
|
|
|
2164
2196
|
}
|
|
2165
2197
|
//* Find the country data for the given iso2 code
|
|
2166
2198
|
//* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
|
|
2167
|
-
_getCountryData(
|
|
2168
|
-
for (let
|
|
2169
|
-
if (this.countries[
|
|
2170
|
-
return this.countries[
|
|
2199
|
+
_getCountryData(e, n) {
|
|
2200
|
+
for (let r = 0; r < this.countries.length; r++)
|
|
2201
|
+
if (this.countries[r].iso2 === e)
|
|
2202
|
+
return this.countries[r];
|
|
2171
2203
|
if (n)
|
|
2172
2204
|
return null;
|
|
2173
|
-
throw new Error(`No country data for '${
|
|
2205
|
+
throw new Error(`No country data for '${e}'`);
|
|
2174
2206
|
}
|
|
2175
2207
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2176
2208
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2177
|
-
_setCountry(
|
|
2178
|
-
const { separateDialCode: n, showFlags:
|
|
2179
|
-
if (this.selectedCountryData =
|
|
2209
|
+
_setCountry(e) {
|
|
2210
|
+
const { separateDialCode: n, showFlags: r, i18n: o } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2211
|
+
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2180
2212
|
let c = "", g = "";
|
|
2181
|
-
|
|
2213
|
+
e && r ? (c = `iti__flag iti__${e}`, g = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (c = "iti__flag iti__globe", g = o.noCountrySelected), this.selectedCountryInner.className = c, this.selectedCountryA11yText.textContent = g;
|
|
2182
2214
|
}
|
|
2183
|
-
if (this._setSelectedCountryTitleAttribute(
|
|
2215
|
+
if (this._setSelectedCountryTitleAttribute(e, n), n) {
|
|
2184
2216
|
const c = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2185
2217
|
this.selectedDialCode.innerHTML = c, this._updateInputPadding();
|
|
2186
2218
|
}
|
|
2187
|
-
return this._updatePlaceholder(), this._updateMaxLength(), a.iso2 !==
|
|
2219
|
+
return this._updatePlaceholder(), this._updateMaxLength(), a.iso2 !== e;
|
|
2188
2220
|
}
|
|
2189
2221
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2190
2222
|
_updateInputPadding() {
|
|
@@ -2195,8 +2227,8 @@ class K2 {
|
|
|
2195
2227
|
}
|
|
2196
2228
|
//* Update the maximum valid number length for the currently selected country.
|
|
2197
2229
|
_updateMaxLength() {
|
|
2198
|
-
const { strictMode:
|
|
2199
|
-
if (
|
|
2230
|
+
const { strictMode: e, placeholderNumberType: n, validationNumberTypes: r } = this.options, { iso2: o } = this.selectedCountryData;
|
|
2231
|
+
if (e && C.utils)
|
|
2200
2232
|
if (o) {
|
|
2201
2233
|
const a = C.utils.numberType[n];
|
|
2202
2234
|
let c = C.utils.getExampleNumber(
|
|
@@ -2205,18 +2237,18 @@ class K2 {
|
|
|
2205
2237
|
a,
|
|
2206
2238
|
!0
|
|
2207
2239
|
), g = c;
|
|
2208
|
-
for (; C.utils.isPossibleNumber(c, o,
|
|
2240
|
+
for (; C.utils.isPossibleNumber(c, o, r); )
|
|
2209
2241
|
g = c, c += "0";
|
|
2210
2242
|
const f = C.utils.getCoreNumber(g, o);
|
|
2211
2243
|
this.maxCoreNumberLength = f.length, o === "by" && (this.maxCoreNumberLength = f.length + 1);
|
|
2212
2244
|
} else
|
|
2213
2245
|
this.maxCoreNumberLength = null;
|
|
2214
2246
|
}
|
|
2215
|
-
_setSelectedCountryTitleAttribute(
|
|
2247
|
+
_setSelectedCountryTitleAttribute(e = null, n) {
|
|
2216
2248
|
if (!this.selectedCountry)
|
|
2217
2249
|
return;
|
|
2218
|
-
let
|
|
2219
|
-
|
|
2250
|
+
let r;
|
|
2251
|
+
e && !n ? r = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? r = this.selectedCountryData.name : r = "Unknown", this.selectedCountry.setAttribute("title", r);
|
|
2220
2252
|
}
|
|
2221
2253
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2222
2254
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
@@ -2224,41 +2256,41 @@ class K2 {
|
|
|
2224
2256
|
//* will definitely exist.
|
|
2225
2257
|
_getHiddenSelectedCountryWidth() {
|
|
2226
2258
|
if (this.telInput.parentNode) {
|
|
2227
|
-
const
|
|
2228
|
-
|
|
2259
|
+
const e = this.telInput.parentNode.cloneNode(!1);
|
|
2260
|
+
e.style.visibility = "hidden", document.body.appendChild(e);
|
|
2229
2261
|
const n = this.countryContainer.cloneNode();
|
|
2230
|
-
|
|
2231
|
-
const
|
|
2232
|
-
n.appendChild(
|
|
2233
|
-
const o =
|
|
2234
|
-
return document.body.removeChild(
|
|
2262
|
+
e.appendChild(n);
|
|
2263
|
+
const r = this.selectedCountry.cloneNode(!0);
|
|
2264
|
+
n.appendChild(r);
|
|
2265
|
+
const o = r.offsetWidth;
|
|
2266
|
+
return document.body.removeChild(e), o;
|
|
2235
2267
|
}
|
|
2236
2268
|
return 0;
|
|
2237
2269
|
}
|
|
2238
2270
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
2239
2271
|
_updatePlaceholder() {
|
|
2240
2272
|
const {
|
|
2241
|
-
autoPlaceholder:
|
|
2273
|
+
autoPlaceholder: e,
|
|
2242
2274
|
placeholderNumberType: n,
|
|
2243
|
-
nationalMode:
|
|
2275
|
+
nationalMode: r,
|
|
2244
2276
|
customPlaceholder: o
|
|
2245
|
-
} = this.options, a =
|
|
2277
|
+
} = this.options, a = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
2246
2278
|
if (C.utils && a) {
|
|
2247
2279
|
const c = C.utils.numberType[n];
|
|
2248
2280
|
let g = this.selectedCountryData.iso2 ? C.utils.getExampleNumber(
|
|
2249
2281
|
this.selectedCountryData.iso2,
|
|
2250
|
-
|
|
2282
|
+
r,
|
|
2251
2283
|
c
|
|
2252
2284
|
) : "";
|
|
2253
2285
|
g = this._beforeSetNumber(g), typeof o == "function" && (g = o(g, this.selectedCountryData)), this.telInput.setAttribute("placeholder", g);
|
|
2254
2286
|
}
|
|
2255
2287
|
}
|
|
2256
2288
|
//* Called when the user selects a list item from the dropdown.
|
|
2257
|
-
_selectListItem(
|
|
2289
|
+
_selectListItem(e) {
|
|
2258
2290
|
const n = this._setCountry(
|
|
2259
|
-
|
|
2291
|
+
e.getAttribute("data-country-code")
|
|
2260
2292
|
);
|
|
2261
|
-
this._closeDropdown(), this._updateDialCode(
|
|
2293
|
+
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), n && this._triggerCountryChange();
|
|
2262
2294
|
}
|
|
2263
2295
|
//* Close the dropdown and unbind any listeners.
|
|
2264
2296
|
_closeDropdown() {
|
|
@@ -2271,38 +2303,38 @@ class K2 {
|
|
|
2271
2303
|
), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this._trigger("close:countrydropdown");
|
|
2272
2304
|
}
|
|
2273
2305
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2274
|
-
_scrollTo(
|
|
2275
|
-
const n = this.countryList,
|
|
2306
|
+
_scrollTo(e) {
|
|
2307
|
+
const n = this.countryList, r = document.documentElement.scrollTop, o = n.offsetHeight, a = n.getBoundingClientRect().top + r, c = a + o, g = e.offsetHeight, f = e.getBoundingClientRect().top + r, S = f + g, _ = f - a + n.scrollTop;
|
|
2276
2308
|
if (f < a)
|
|
2277
2309
|
n.scrollTop = _;
|
|
2278
|
-
else if (
|
|
2279
|
-
const
|
|
2280
|
-
n.scrollTop = _ -
|
|
2310
|
+
else if (S > c) {
|
|
2311
|
+
const b = o - g;
|
|
2312
|
+
n.scrollTop = _ - b;
|
|
2281
2313
|
}
|
|
2282
2314
|
}
|
|
2283
2315
|
//* Replace any existing dial code with the new one
|
|
2284
2316
|
//* Note: called from _selectListItem and setCountry
|
|
2285
|
-
_updateDialCode(
|
|
2286
|
-
const n = this.telInput.value,
|
|
2317
|
+
_updateDialCode(e) {
|
|
2318
|
+
const n = this.telInput.value, r = `+${e}`;
|
|
2287
2319
|
let o;
|
|
2288
2320
|
if (n.charAt(0) === "+") {
|
|
2289
2321
|
const a = this._getDialCode(n);
|
|
2290
|
-
a ? o = n.replace(a,
|
|
2322
|
+
a ? o = n.replace(a, r) : o = r, this.telInput.value = o;
|
|
2291
2323
|
}
|
|
2292
2324
|
}
|
|
2293
2325
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2294
2326
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2295
|
-
_getDialCode(
|
|
2296
|
-
let
|
|
2297
|
-
if (
|
|
2327
|
+
_getDialCode(e, n) {
|
|
2328
|
+
let r = "";
|
|
2329
|
+
if (e.charAt(0) === "+") {
|
|
2298
2330
|
let o = "";
|
|
2299
|
-
for (let a = 0; a <
|
|
2300
|
-
const c =
|
|
2331
|
+
for (let a = 0; a < e.length; a++) {
|
|
2332
|
+
const c = e.charAt(a);
|
|
2301
2333
|
if (!isNaN(parseInt(c, 10))) {
|
|
2302
2334
|
if (o += c, n)
|
|
2303
|
-
this.dialCodeToIso2Map[o] && (
|
|
2335
|
+
this.dialCodeToIso2Map[o] && (r = e.substr(0, a + 1));
|
|
2304
2336
|
else if (this.dialCodes[o]) {
|
|
2305
|
-
|
|
2337
|
+
r = e.substr(0, a + 1);
|
|
2306
2338
|
break;
|
|
2307
2339
|
}
|
|
2308
2340
|
if (o.length === this.dialCodeMaxLen)
|
|
@@ -2310,23 +2342,23 @@ class K2 {
|
|
|
2310
2342
|
}
|
|
2311
2343
|
}
|
|
2312
2344
|
}
|
|
2313
|
-
return
|
|
2345
|
+
return r;
|
|
2314
2346
|
}
|
|
2315
2347
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2316
|
-
_getFullNumber(
|
|
2317
|
-
const n =
|
|
2348
|
+
_getFullNumber(e) {
|
|
2349
|
+
const n = e || this.telInput.value.trim(), { dialCode: r } = this.selectedCountryData;
|
|
2318
2350
|
let o;
|
|
2319
2351
|
const a = c1(n);
|
|
2320
|
-
return this.options.separateDialCode && n.charAt(0) !== "+" &&
|
|
2352
|
+
return this.options.separateDialCode && n.charAt(0) !== "+" && r && a ? o = `+${r}` : o = "", o + n;
|
|
2321
2353
|
}
|
|
2322
2354
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2323
|
-
_beforeSetNumber(
|
|
2324
|
-
let n =
|
|
2355
|
+
_beforeSetNumber(e) {
|
|
2356
|
+
let n = e;
|
|
2325
2357
|
if (this.options.separateDialCode) {
|
|
2326
|
-
let
|
|
2327
|
-
if (
|
|
2328
|
-
|
|
2329
|
-
const o = n[
|
|
2358
|
+
let r = this._getDialCode(n);
|
|
2359
|
+
if (r) {
|
|
2360
|
+
r = `+${this.selectedCountryData.dialCode}`;
|
|
2361
|
+
const o = n[r.length] === " " || n[r.length] === "-" ? r.length + 1 : r.length;
|
|
2330
2362
|
n = n.substr(o);
|
|
2331
2363
|
}
|
|
2332
2364
|
}
|
|
@@ -2338,8 +2370,8 @@ class K2 {
|
|
|
2338
2370
|
}
|
|
2339
2371
|
//* Format the number as the user types.
|
|
2340
2372
|
_formatNumberAsYouType() {
|
|
2341
|
-
const
|
|
2342
|
-
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && n.includes(`+${
|
|
2373
|
+
const e = this._getFullNumber(), n = C.utils ? C.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: r } = this.selectedCountryData;
|
|
2374
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && n.includes(`+${r}`) ? (n.split(`+${r}`)[1] || "").trim() : n;
|
|
2343
2375
|
}
|
|
2344
2376
|
//**************************
|
|
2345
2377
|
//* SECRET PUBLIC METHODS
|
|
@@ -2358,8 +2390,8 @@ class K2 {
|
|
|
2358
2390
|
//* Remove plugin.
|
|
2359
2391
|
destroy() {
|
|
2360
2392
|
var a, c;
|
|
2361
|
-
const { allowDropdown:
|
|
2362
|
-
if (
|
|
2393
|
+
const { allowDropdown: e, separateDialCode: n } = this.options;
|
|
2394
|
+
if (e) {
|
|
2363
2395
|
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2364
2396
|
"click",
|
|
2365
2397
|
this._handleClickSelectedCountry
|
|
@@ -2370,8 +2402,8 @@ class K2 {
|
|
|
2370
2402
|
const g = this.telInput.closest("label");
|
|
2371
2403
|
g && g.removeEventListener("click", this._handleLabelClick);
|
|
2372
2404
|
}
|
|
2373
|
-
const { form:
|
|
2374
|
-
this._handleHiddenInputSubmit &&
|
|
2405
|
+
const { form: r } = this.telInput;
|
|
2406
|
+
this._handleHiddenInputSubmit && r && r.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this.telInput.removeAttribute("data-intl-tel-input-id"), n && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2375
2407
|
const o = this.telInput.parentNode;
|
|
2376
2408
|
(a = o == null ? void 0 : o.parentNode) == null || a.insertBefore(this.telInput, o), (c = o == null ? void 0 : o.parentNode) == null || c.removeChild(o), delete C.instances[this.id];
|
|
2377
2409
|
}
|
|
@@ -2383,13 +2415,13 @@ class K2 {
|
|
|
2383
2415
|
) : "";
|
|
2384
2416
|
}
|
|
2385
2417
|
//* Format the number to the given format.
|
|
2386
|
-
getNumber(
|
|
2418
|
+
getNumber(e) {
|
|
2387
2419
|
if (C.utils) {
|
|
2388
2420
|
const { iso2: n } = this.selectedCountryData;
|
|
2389
2421
|
return C.utils.formatNumber(
|
|
2390
2422
|
this._getFullNumber(),
|
|
2391
2423
|
n,
|
|
2392
|
-
|
|
2424
|
+
e
|
|
2393
2425
|
);
|
|
2394
2426
|
}
|
|
2395
2427
|
return "";
|
|
@@ -2408,8 +2440,8 @@ class K2 {
|
|
|
2408
2440
|
//* Get the validation error.
|
|
2409
2441
|
getValidationError() {
|
|
2410
2442
|
if (C.utils) {
|
|
2411
|
-
const { iso2:
|
|
2412
|
-
return C.utils.getValidationError(this._getFullNumber(),
|
|
2443
|
+
const { iso2: e } = this.selectedCountryData;
|
|
2444
|
+
return C.utils.getValidationError(this._getFullNumber(), e);
|
|
2413
2445
|
}
|
|
2414
2446
|
return -99;
|
|
2415
2447
|
}
|
|
@@ -2417,72 +2449,72 @@ class K2 {
|
|
|
2417
2449
|
isValidNumber() {
|
|
2418
2450
|
if (!this.selectedCountryData.iso2)
|
|
2419
2451
|
return !1;
|
|
2420
|
-
const
|
|
2452
|
+
const e = this._getFullNumber(), n = e.search(new RegExp("\\p{L}", "u"));
|
|
2421
2453
|
if (n > -1) {
|
|
2422
|
-
const
|
|
2454
|
+
const r = e.substring(0, n), o = this._utilsIsPossibleNumber(r), a = this._utilsIsPossibleNumber(e);
|
|
2423
2455
|
return o && a;
|
|
2424
2456
|
}
|
|
2425
|
-
return this._utilsIsPossibleNumber(
|
|
2457
|
+
return this._utilsIsPossibleNumber(e);
|
|
2426
2458
|
}
|
|
2427
|
-
_utilsIsPossibleNumber(
|
|
2428
|
-
return C.utils ? C.utils.isPossibleNumber(
|
|
2459
|
+
_utilsIsPossibleNumber(e) {
|
|
2460
|
+
return C.utils ? C.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2429
2461
|
}
|
|
2430
2462
|
//* Validate the input val (precise)
|
|
2431
2463
|
isValidNumberPrecise() {
|
|
2432
2464
|
if (!this.selectedCountryData.iso2)
|
|
2433
2465
|
return !1;
|
|
2434
|
-
const
|
|
2466
|
+
const e = this._getFullNumber(), n = e.search(new RegExp("\\p{L}", "u"));
|
|
2435
2467
|
if (n > -1) {
|
|
2436
|
-
const
|
|
2468
|
+
const r = e.substring(0, n), o = this._utilsIsValidNumber(r), a = this._utilsIsValidNumber(e);
|
|
2437
2469
|
return o && a;
|
|
2438
2470
|
}
|
|
2439
|
-
return this._utilsIsValidNumber(
|
|
2471
|
+
return this._utilsIsValidNumber(e);
|
|
2440
2472
|
}
|
|
2441
|
-
_utilsIsValidNumber(
|
|
2442
|
-
return C.utils ? C.utils.isValidNumber(
|
|
2473
|
+
_utilsIsValidNumber(e) {
|
|
2474
|
+
return C.utils ? C.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2443
2475
|
}
|
|
2444
2476
|
//* Update the selected country, and update the input val accordingly.
|
|
2445
|
-
setCountry(
|
|
2446
|
-
const n =
|
|
2447
|
-
(
|
|
2477
|
+
setCountry(e) {
|
|
2478
|
+
const n = e == null ? void 0 : e.toLowerCase(), r = this.selectedCountryData.iso2;
|
|
2479
|
+
(e && n !== r || !e && r) && (this._setCountry(n), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2448
2480
|
}
|
|
2449
2481
|
//* Set the input value and update the country.
|
|
2450
|
-
setNumber(
|
|
2451
|
-
const n = this._updateCountryFromNumber(
|
|
2452
|
-
this._updateValFromNumber(
|
|
2482
|
+
setNumber(e) {
|
|
2483
|
+
const n = this._updateCountryFromNumber(e);
|
|
2484
|
+
this._updateValFromNumber(e), n && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
|
|
2453
2485
|
}
|
|
2454
2486
|
//* Set the placeholder number typ
|
|
2455
|
-
setPlaceholderNumberType(
|
|
2456
|
-
this.options.placeholderNumberType =
|
|
2487
|
+
setPlaceholderNumberType(e) {
|
|
2488
|
+
this.options.placeholderNumberType = e, this._updatePlaceholder();
|
|
2457
2489
|
}
|
|
2458
|
-
setDisabled(
|
|
2459
|
-
this.telInput.disabled =
|
|
2490
|
+
setDisabled(e) {
|
|
2491
|
+
this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2460
2492
|
}
|
|
2461
2493
|
}
|
|
2462
2494
|
const H2 = (y) => {
|
|
2463
2495
|
if (!C.utils && !C.startedLoadingUtilsScript) {
|
|
2464
|
-
let
|
|
2496
|
+
let e;
|
|
2465
2497
|
if (typeof y == "function")
|
|
2466
2498
|
try {
|
|
2467
|
-
|
|
2499
|
+
e = Promise.resolve(y());
|
|
2468
2500
|
} catch (n) {
|
|
2469
2501
|
return Promise.reject(n);
|
|
2470
2502
|
}
|
|
2471
2503
|
else
|
|
2472
2504
|
return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof y}`));
|
|
2473
|
-
return C.startedLoadingUtilsScript = !0,
|
|
2474
|
-
const
|
|
2475
|
-
if (!
|
|
2505
|
+
return C.startedLoadingUtilsScript = !0, e.then((n) => {
|
|
2506
|
+
const r = n == null ? void 0 : n.default;
|
|
2507
|
+
if (!r || typeof r != "object")
|
|
2476
2508
|
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
2477
|
-
return C.utils =
|
|
2509
|
+
return C.utils = r, $1("handleUtils"), !0;
|
|
2478
2510
|
}).catch((n) => {
|
|
2479
2511
|
throw $1("rejectUtilsScriptPromise", n), n;
|
|
2480
2512
|
});
|
|
2481
2513
|
}
|
|
2482
2514
|
return null;
|
|
2483
2515
|
}, C = Object.assign(
|
|
2484
|
-
(y,
|
|
2485
|
-
const n = new K2(y,
|
|
2516
|
+
(y, e) => {
|
|
2517
|
+
const n = new K2(y, e);
|
|
2486
2518
|
return n._init(), y.setAttribute("data-intl-tel-input-id", n.id.toString()), C.instances[n.id] = n, n;
|
|
2487
2519
|
},
|
|
2488
2520
|
{
|
|
@@ -2493,37 +2525,37 @@ const H2 = (y) => {
|
|
|
2493
2525
|
getCountryData: () => W,
|
|
2494
2526
|
//* A getter for the plugin instance.
|
|
2495
2527
|
getInstance: (y) => {
|
|
2496
|
-
const
|
|
2497
|
-
return
|
|
2528
|
+
const e = y.getAttribute("data-intl-tel-input-id");
|
|
2529
|
+
return e ? C.instances[e] : null;
|
|
2498
2530
|
},
|
|
2499
2531
|
//* A map from instance ID to instance object.
|
|
2500
2532
|
instances: {},
|
|
2501
2533
|
attachUtils: H2,
|
|
2502
2534
|
startedLoadingUtilsScript: !1,
|
|
2503
2535
|
startedLoadingAutoCountry: !1,
|
|
2504
|
-
version: "25.0
|
|
2536
|
+
version: "25.1.0"
|
|
2505
2537
|
}
|
|
2506
2538
|
);
|
|
2507
2539
|
(function() {
|
|
2508
2540
|
var y = this || self;
|
|
2509
|
-
function
|
|
2541
|
+
function e(d, t) {
|
|
2510
2542
|
d = d.split(".");
|
|
2511
|
-
var
|
|
2512
|
-
d[0] in
|
|
2513
|
-
for (var
|
|
2543
|
+
var $ = y;
|
|
2544
|
+
d[0] in $ || typeof $.execScript > "u" || $.execScript("var " + d[0]);
|
|
2545
|
+
for (var i; d.length && (i = d.shift()); ) d.length || t === void 0 ? $[i] && $[i] !== Object.prototype[i] ? $ = $[i] : $ = $[i] = {} : $[i] = t;
|
|
2514
2546
|
}
|
|
2515
2547
|
function n(d, t) {
|
|
2516
|
-
function
|
|
2548
|
+
function $() {
|
|
2517
2549
|
}
|
|
2518
|
-
|
|
2550
|
+
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(i, s, u) {
|
|
2519
2551
|
for (var l = Array(arguments.length - 2), h = 2; h < arguments.length; h++) l[h - 2] = arguments[h];
|
|
2520
|
-
return t.prototype[s].apply(
|
|
2552
|
+
return t.prototype[s].apply(i, l);
|
|
2521
2553
|
};
|
|
2522
2554
|
}
|
|
2523
|
-
function
|
|
2555
|
+
function r(d) {
|
|
2524
2556
|
const t = [];
|
|
2525
|
-
let
|
|
2526
|
-
for (const
|
|
2557
|
+
let $ = 0;
|
|
2558
|
+
for (const i in d) t[$++] = d[i];
|
|
2527
2559
|
return t;
|
|
2528
2560
|
}
|
|
2529
2561
|
var o = class {
|
|
@@ -2547,7 +2579,7 @@ const H2 = (y) => {
|
|
|
2547
2579
|
}
|
|
2548
2580
|
new g();
|
|
2549
2581
|
const f = {};
|
|
2550
|
-
class
|
|
2582
|
+
class S {
|
|
2551
2583
|
constructor() {
|
|
2552
2584
|
if (f !== f) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
2553
2585
|
}
|
|
@@ -2555,9 +2587,9 @@ const H2 = (y) => {
|
|
|
2555
2587
|
return "";
|
|
2556
2588
|
}
|
|
2557
2589
|
}
|
|
2558
|
-
new
|
|
2590
|
+
new S();
|
|
2559
2591
|
const _ = {};
|
|
2560
|
-
class
|
|
2592
|
+
class b {
|
|
2561
2593
|
constructor() {
|
|
2562
2594
|
var t = y.trustedTypes && y.trustedTypes.emptyHTML || "";
|
|
2563
2595
|
if (_ !== _) throw Error("SafeHtml is not meant to be built directly");
|
|
@@ -2567,8 +2599,8 @@ const H2 = (y) => {
|
|
|
2567
2599
|
return this.g.toString();
|
|
2568
2600
|
}
|
|
2569
2601
|
}
|
|
2570
|
-
new
|
|
2571
|
-
function
|
|
2602
|
+
new b();
|
|
2603
|
+
function w(d, t) {
|
|
2572
2604
|
switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
|
|
2573
2605
|
case G:
|
|
2574
2606
|
case F:
|
|
@@ -2576,21 +2608,21 @@ const H2 = (y) => {
|
|
|
2576
2608
|
case x:
|
|
2577
2609
|
case f1:
|
|
2578
2610
|
case A:
|
|
2579
|
-
case
|
|
2611
|
+
case I:
|
|
2580
2612
|
this.o = !0;
|
|
2581
2613
|
}
|
|
2582
2614
|
this.j = t.defaultValue;
|
|
2583
2615
|
}
|
|
2584
|
-
var
|
|
2616
|
+
var I = 1, A = 2, G = 3, F = 4, M = 6, x = 16, f1 = 18;
|
|
2585
2617
|
function v1(d, t) {
|
|
2586
2618
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
2587
|
-
var
|
|
2588
|
-
this.g[
|
|
2619
|
+
var $ = t[d];
|
|
2620
|
+
this.g[$.g] = $;
|
|
2589
2621
|
}
|
|
2590
2622
|
}
|
|
2591
2623
|
function a2(d) {
|
|
2592
|
-
return d =
|
|
2593
|
-
return t.g -
|
|
2624
|
+
return d = r(d.g), d.sort(function(t, $) {
|
|
2625
|
+
return t.g - $.g;
|
|
2594
2626
|
}), d;
|
|
2595
2627
|
}
|
|
2596
2628
|
function R() {
|
|
@@ -2606,8 +2638,8 @@ const H2 = (y) => {
|
|
|
2606
2638
|
w1(this, d.g, t);
|
|
2607
2639
|
};
|
|
2608
2640
|
function S1(d, t) {
|
|
2609
|
-
for (var
|
|
2610
|
-
var s =
|
|
2641
|
+
for (var $ = a2(d.m()), i = 0; i < $.length; i++) {
|
|
2642
|
+
var s = $[i], u = s.g;
|
|
2611
2643
|
if (B(t, u)) {
|
|
2612
2644
|
d.g && delete d.g[s.g];
|
|
2613
2645
|
var l = s.h == 11 || s.h == 10;
|
|
@@ -2626,26 +2658,26 @@ const H2 = (y) => {
|
|
|
2626
2658
|
return d.h[t] != null;
|
|
2627
2659
|
}
|
|
2628
2660
|
function n1(d, t) {
|
|
2629
|
-
var
|
|
2630
|
-
if (
|
|
2661
|
+
var $ = d.h[t];
|
|
2662
|
+
if ($ == null) return null;
|
|
2631
2663
|
if (d.l) {
|
|
2632
2664
|
if (!(t in d.g)) {
|
|
2633
|
-
var
|
|
2634
|
-
if (
|
|
2635
|
-
for (var u = [], l = 0; l <
|
|
2636
|
-
|
|
2637
|
-
} else
|
|
2638
|
-
return d.g[t] =
|
|
2665
|
+
var i = d.l, s = d.j[t];
|
|
2666
|
+
if ($ != null) if (s.l) {
|
|
2667
|
+
for (var u = [], l = 0; l < $.length; l++) u[l] = i.h(s, $[l]);
|
|
2668
|
+
$ = u;
|
|
2669
|
+
} else $ = i.h(s, $);
|
|
2670
|
+
return d.g[t] = $;
|
|
2639
2671
|
}
|
|
2640
2672
|
return d.g[t];
|
|
2641
2673
|
}
|
|
2642
|
-
return
|
|
2674
|
+
return $;
|
|
2643
2675
|
}
|
|
2644
|
-
function p(d, t,
|
|
2645
|
-
var
|
|
2646
|
-
return d.j[t].l ?
|
|
2676
|
+
function p(d, t, $) {
|
|
2677
|
+
var i = n1(d, t);
|
|
2678
|
+
return d.j[t].l ? i[$ || 0] : i;
|
|
2647
2679
|
}
|
|
2648
|
-
function
|
|
2680
|
+
function v(d, t) {
|
|
2649
2681
|
if (B(d, t)) d = p(d, t);
|
|
2650
2682
|
else d: {
|
|
2651
2683
|
if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
|
|
@@ -2665,16 +2697,16 @@ const H2 = (y) => {
|
|
|
2665
2697
|
function K(d, t) {
|
|
2666
2698
|
return d.j[t].l ? B(d, t) ? d.h[t].length : 0 : B(d, t) ? 1 : 0;
|
|
2667
2699
|
}
|
|
2668
|
-
function E(d, t,
|
|
2669
|
-
d.h[t] =
|
|
2700
|
+
function E(d, t, $) {
|
|
2701
|
+
d.h[t] = $, d.g && (d.g[t] = $);
|
|
2670
2702
|
}
|
|
2671
|
-
function w1(d, t,
|
|
2672
|
-
d.h[t] || (d.h[t] = []), d.h[t].push(
|
|
2703
|
+
function w1(d, t, $) {
|
|
2704
|
+
d.h[t] || (d.h[t] = []), d.h[t].push($), d.g && delete d.g[t];
|
|
2673
2705
|
}
|
|
2674
2706
|
function i1(d, t) {
|
|
2675
|
-
var
|
|
2676
|
-
for (
|
|
2677
|
-
return new v1(d,
|
|
2707
|
+
var $ = [], i;
|
|
2708
|
+
for (i in t) i != 0 && $.push(new w(i, t[i]));
|
|
2709
|
+
return new v1(d, $);
|
|
2678
2710
|
}
|
|
2679
2711
|
function r1() {
|
|
2680
2712
|
}
|
|
@@ -2707,8 +2739,8 @@ const H2 = (y) => {
|
|
|
2707
2739
|
}
|
|
2708
2740
|
N.prototype.h = "", N.prototype.set = function(d) {
|
|
2709
2741
|
this.h = "" + d;
|
|
2710
|
-
}, N.prototype.g = function(d, t,
|
|
2711
|
-
if (this.h += String(d), t != null) for (let
|
|
2742
|
+
}, N.prototype.g = function(d, t, $) {
|
|
2743
|
+
if (this.h += String(d), t != null) for (let i = 1; i < arguments.length; i++) this.h += arguments[i];
|
|
2712
2744
|
return this;
|
|
2713
2745
|
};
|
|
2714
2746
|
function k(d) {
|
|
@@ -2722,10 +2754,10 @@ const H2 = (y) => {
|
|
|
2722
2754
|
}
|
|
2723
2755
|
n(z, R);
|
|
2724
2756
|
var L1 = null;
|
|
2725
|
-
function
|
|
2757
|
+
function L() {
|
|
2726
2758
|
R.call(this);
|
|
2727
2759
|
}
|
|
2728
|
-
n(
|
|
2760
|
+
n(L, R);
|
|
2729
2761
|
var N1 = null;
|
|
2730
2762
|
function Z() {
|
|
2731
2763
|
R.call(this);
|
|
@@ -2735,30 +2767,30 @@ const H2 = (y) => {
|
|
|
2735
2767
|
z.prototype.m = function() {
|
|
2736
2768
|
var d = L1;
|
|
2737
2769
|
return d || (L1 = d = i1(z, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
|
|
2738
|
-
}, z.m = z.prototype.m,
|
|
2770
|
+
}, z.m = z.prototype.m, L.prototype.m = function() {
|
|
2739
2771
|
var d = N1;
|
|
2740
|
-
return d || (N1 = d = i1(
|
|
2741
|
-
},
|
|
2772
|
+
return d || (N1 = d = i1(L, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
|
|
2773
|
+
}, L.m = L.prototype.m, Z.prototype.m = function() {
|
|
2742
2774
|
var d = T1;
|
|
2743
2775
|
return d || (T1 = d = i1(Z, {
|
|
2744
2776
|
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
|
|
2745
|
-
1: { name: "general_desc", i: 11, type:
|
|
2746
|
-
2: { name: "fixed_line", i: 11, type:
|
|
2747
|
-
3: { name: "mobile", i: 11, type:
|
|
2748
|
-
4: { name: "toll_free", i: 11, type:
|
|
2749
|
-
5: { name: "premium_rate", i: 11, type:
|
|
2750
|
-
6: { name: "shared_cost", i: 11, type:
|
|
2751
|
-
7: { name: "personal_number", i: 11, type:
|
|
2752
|
-
8: { name: "voip", i: 11, type:
|
|
2753
|
-
21: { name: "pager", i: 11, type:
|
|
2754
|
-
25: { name: "uan", i: 11, type:
|
|
2755
|
-
27: { name: "emergency", i: 11, type:
|
|
2756
|
-
28: { name: "voicemail", i: 11, type:
|
|
2757
|
-
29: { name: "short_code", i: 11, type:
|
|
2758
|
-
30: { name: "standard_rate", i: 11, type:
|
|
2759
|
-
31: { name: "carrier_specific", i: 11, type:
|
|
2760
|
-
33: { name: "sms_services", i: 11, type:
|
|
2761
|
-
24: { name: "no_international_dialling", i: 11, type:
|
|
2777
|
+
1: { name: "general_desc", i: 11, type: L },
|
|
2778
|
+
2: { name: "fixed_line", i: 11, type: L },
|
|
2779
|
+
3: { name: "mobile", i: 11, type: L },
|
|
2780
|
+
4: { name: "toll_free", i: 11, type: L },
|
|
2781
|
+
5: { name: "premium_rate", i: 11, type: L },
|
|
2782
|
+
6: { name: "shared_cost", i: 11, type: L },
|
|
2783
|
+
7: { name: "personal_number", i: 11, type: L },
|
|
2784
|
+
8: { name: "voip", i: 11, type: L },
|
|
2785
|
+
21: { name: "pager", i: 11, type: L },
|
|
2786
|
+
25: { name: "uan", i: 11, type: L },
|
|
2787
|
+
27: { name: "emergency", i: 11, type: L },
|
|
2788
|
+
28: { name: "voicemail", i: 11, type: L },
|
|
2789
|
+
29: { name: "short_code", i: 11, type: L },
|
|
2790
|
+
30: { name: "standard_rate", i: 11, type: L },
|
|
2791
|
+
31: { name: "carrier_specific", i: 11, type: L },
|
|
2792
|
+
33: { name: "sms_services", i: 11, type: L },
|
|
2793
|
+
24: { name: "no_international_dialling", i: 11, type: L },
|
|
2762
2794
|
9: { name: "id", required: !0, i: 9, type: String },
|
|
2763
2795
|
10: { name: "country_code", i: 5, type: Number },
|
|
2764
2796
|
11: { name: "international_prefix", i: 9, type: String },
|
|
@@ -7981,8 +8013,8 @@ const H2 = (y) => {
|
|
|
7981
8013
|
return d != null && (K(d, 9) != 1 || P(d, 9)[0] != -1);
|
|
7982
8014
|
}
|
|
7983
8015
|
function s1(d, t) {
|
|
7984
|
-
for (var
|
|
7985
|
-
return
|
|
8016
|
+
for (var $ = new N(), i, s = d.length, u = 0; u < s; ++u) i = d.charAt(u), i = t[i.toUpperCase()], i != null && $.g(i);
|
|
8017
|
+
return $.toString();
|
|
7986
8018
|
}
|
|
7987
8019
|
function O1(d) {
|
|
7988
8020
|
return d.length == 0 || w2.test(d);
|
|
@@ -7992,50 +8024,50 @@ const H2 = (y) => {
|
|
|
7992
8024
|
}
|
|
7993
8025
|
D.prototype.format = function(d, t) {
|
|
7994
8026
|
if (p(d, 2) == 0 && B(d, 5)) {
|
|
7995
|
-
var
|
|
7996
|
-
if (0 <
|
|
8027
|
+
var $ = v(d, 5);
|
|
8028
|
+
if (0 < $.length) return $;
|
|
7997
8029
|
}
|
|
7998
|
-
|
|
7999
|
-
var
|
|
8000
|
-
if (t == 0) return G1(
|
|
8001
|
-
if (!(
|
|
8002
|
-
var s = d1(this,
|
|
8003
|
-
d = B(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : B(s, 13) ? p(s, 13) +
|
|
8030
|
+
$ = v(d, 1);
|
|
8031
|
+
var i = t1(d);
|
|
8032
|
+
if (t == 0) return G1($, 0, i, "");
|
|
8033
|
+
if (!($ in X)) return i;
|
|
8034
|
+
var s = d1(this, $, e1($));
|
|
8035
|
+
d = B(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : B(s, 13) ? p(s, 13) + v(d, 3) : " ext. " + v(d, 3) : "";
|
|
8004
8036
|
d: {
|
|
8005
8037
|
s = P(s, 20).length == 0 || t == 2 ? P(s, 19) : P(s, 20);
|
|
8006
8038
|
for (var u, l = s.length, h = 0; h < l; ++h) {
|
|
8007
8039
|
u = s[h];
|
|
8008
8040
|
var m = K(u, 3);
|
|
8009
|
-
if ((m == 0 ||
|
|
8041
|
+
if ((m == 0 || i.search(p(u, 3, m - 1)) == 0) && (m = new RegExp(p(u, 1)), U(m, i))) {
|
|
8010
8042
|
s = u;
|
|
8011
8043
|
break d;
|
|
8012
8044
|
}
|
|
8013
8045
|
}
|
|
8014
8046
|
s = null;
|
|
8015
8047
|
}
|
|
8016
|
-
return s != null && (l = s, s =
|
|
8048
|
+
return s != null && (l = s, s = v(l, 2), u = new RegExp(p(l, 1)), v(
|
|
8017
8049
|
l,
|
|
8018
8050
|
5
|
|
8019
|
-
), l =
|
|
8051
|
+
), l = v(l, 4), i = t == 2 && l != null && 0 < l.length ? i.replace(u, s.replace(S2, l)) : i.replace(u, s), t == 3 && (i = i.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), i = i.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), G1($, t, i, d);
|
|
8020
8052
|
};
|
|
8021
|
-
function d1(d, t,
|
|
8022
|
-
return
|
|
8053
|
+
function d1(d, t, $) {
|
|
8054
|
+
return $ == "001" ? j(d, "" + t) : j(d, $);
|
|
8023
8055
|
}
|
|
8024
8056
|
function t1(d) {
|
|
8025
8057
|
if (!B(d, 2)) return "";
|
|
8026
8058
|
var t = "" + p(d, 2);
|
|
8027
|
-
return B(d, 4) && p(d, 4) && 0 <
|
|
8059
|
+
return B(d, 4) && p(d, 4) && 0 < v(d, 8) ? Array(v(d, 8) + 1).join("0") + t : t;
|
|
8028
8060
|
}
|
|
8029
|
-
function G1(d, t,
|
|
8061
|
+
function G1(d, t, $, i) {
|
|
8030
8062
|
switch (t) {
|
|
8031
8063
|
case 0:
|
|
8032
|
-
return "+" + d +
|
|
8064
|
+
return "+" + d + $ + i;
|
|
8033
8065
|
case 1:
|
|
8034
|
-
return "+" + d + " " +
|
|
8066
|
+
return "+" + d + " " + $ + i;
|
|
8035
8067
|
case 3:
|
|
8036
|
-
return "tel:+" + d + "-" +
|
|
8068
|
+
return "tel:+" + d + "-" + $ + i;
|
|
8037
8069
|
default:
|
|
8038
|
-
return
|
|
8070
|
+
return $ + i;
|
|
8039
8071
|
}
|
|
8040
8072
|
}
|
|
8041
8073
|
function u1(d, t) {
|
|
@@ -8066,8 +8098,8 @@ const H2 = (y) => {
|
|
|
8066
8098
|
}
|
|
8067
8099
|
}
|
|
8068
8100
|
function F1(d, t) {
|
|
8069
|
-
var
|
|
8070
|
-
return d = d1(d,
|
|
8101
|
+
var $ = U1(d, t);
|
|
8102
|
+
return d = d1(d, v(t, 1), $), d == null ? -1 : (t = t1(t), C1(t, d));
|
|
8071
8103
|
}
|
|
8072
8104
|
function C1(d, t) {
|
|
8073
8105
|
return O(d, p(t, 1)) ? O(d, p(t, 5)) ? 4 : O(d, p(t, 4)) ? 3 : O(d, p(t, 6)) ? 5 : O(d, p(t, 8)) ? 6 : O(d, p(t, 7)) ? 7 : O(d, p(t, 21)) ? 8 : O(d, p(t, 25)) ? 9 : O(d, p(t, 28)) ? 10 : O(d, p(t, 2)) ? p(t, 18) || O(d, p(t, 3)) ? 2 : 0 : !p(t, 18) && O(d, p(t, 3)) ? 1 : -1 : -1;
|
|
@@ -8075,38 +8107,38 @@ const H2 = (y) => {
|
|
|
8075
8107
|
function j(d, t) {
|
|
8076
8108
|
if (t == null) return null;
|
|
8077
8109
|
t = t.toUpperCase();
|
|
8078
|
-
var
|
|
8079
|
-
if (
|
|
8080
|
-
if (
|
|
8081
|
-
|
|
8110
|
+
var $ = d.g[t];
|
|
8111
|
+
if ($ == null) {
|
|
8112
|
+
if ($ = E1[t], $ == null) return null;
|
|
8113
|
+
$ = new q().g(Z.m(), $), d.g[t] = $;
|
|
8082
8114
|
}
|
|
8083
|
-
return
|
|
8115
|
+
return $;
|
|
8084
8116
|
}
|
|
8085
8117
|
function O(d, t) {
|
|
8086
|
-
var
|
|
8087
|
-
return 0 < K(t, 9) && P(t, 9).indexOf(
|
|
8118
|
+
var $ = d.length;
|
|
8119
|
+
return 0 < K(t, 9) && P(t, 9).indexOf($) == -1 ? !1 : U(v(t, 2), d);
|
|
8088
8120
|
}
|
|
8089
8121
|
function b2(d, t) {
|
|
8090
|
-
var
|
|
8091
|
-
return s == null ||
|
|
8122
|
+
var $ = U1(d, t), i = v(t, 1), s = d1(d, i, $);
|
|
8123
|
+
return s == null || $ != "001" && i != V1(d, $) ? s = !1 : (d = t1(t), s = C1(d, s) != -1), s;
|
|
8092
8124
|
}
|
|
8093
8125
|
function U1(d, t) {
|
|
8094
8126
|
if (t == null) return null;
|
|
8095
|
-
var
|
|
8096
|
-
if (
|
|
8097
|
-
else if (
|
|
8127
|
+
var $ = v(t, 1);
|
|
8128
|
+
if ($ = X[$], $ == null) d = null;
|
|
8129
|
+
else if ($.length == 1) d = $[0];
|
|
8098
8130
|
else d: {
|
|
8099
8131
|
t = t1(t);
|
|
8100
|
-
for (var
|
|
8101
|
-
|
|
8102
|
-
var l = j(d,
|
|
8132
|
+
for (var i, s = $.length, u = 0; u < s; u++) {
|
|
8133
|
+
i = $[u];
|
|
8134
|
+
var l = j(d, i);
|
|
8103
8135
|
if (B(l, 23)) {
|
|
8104
8136
|
if (t.search(p(l, 23)) == 0) {
|
|
8105
|
-
d =
|
|
8137
|
+
d = i;
|
|
8106
8138
|
break d;
|
|
8107
8139
|
}
|
|
8108
8140
|
} else if (C1(t, l) != -1) {
|
|
8109
|
-
d =
|
|
8141
|
+
d = i;
|
|
8110
8142
|
break d;
|
|
8111
8143
|
}
|
|
8112
8144
|
}
|
|
@@ -8119,28 +8151,28 @@ const H2 = (y) => {
|
|
|
8119
8151
|
}
|
|
8120
8152
|
function V1(d, t) {
|
|
8121
8153
|
if (d = j(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8122
|
-
return
|
|
8154
|
+
return v(d, 10);
|
|
8123
8155
|
}
|
|
8124
|
-
function l1(d, t,
|
|
8125
|
-
var s = u1(
|
|
8126
|
-
if (s = P(s, 10),
|
|
8127
|
-
else return l1(d, t,
|
|
8128
|
-
return u[0] == -1 ? 5 : (t = t.length, -1 < s.indexOf(t) ? 4 : (
|
|
8156
|
+
function l1(d, t, $, i) {
|
|
8157
|
+
var s = u1($, i), u = K(s, 9) == 0 ? P(p($, 1), 9) : P(s, 9);
|
|
8158
|
+
if (s = P(s, 10), i == 2) if (k1(u1($, 0))) d = u1($, 1), k1(d) && (u = u.concat(K(d, 9) == 0 ? P(p($, 1), 9) : P(d, 9)), u.sort(), s.length == 0 ? s = P(d, 10) : (s = s.concat(P(d, 10)), s.sort()));
|
|
8159
|
+
else return l1(d, t, $, 1);
|
|
8160
|
+
return u[0] == -1 ? 5 : (t = t.length, -1 < s.indexOf(t) ? 4 : ($ = u[0], $ == t ? 0 : $ > t ? 2 : u[u.length - 1] < t ? 3 : -1 < u.indexOf(t, 1) ? 0 : 5));
|
|
8129
8161
|
}
|
|
8130
|
-
function a1(d, t,
|
|
8131
|
-
var
|
|
8132
|
-
return t =
|
|
8162
|
+
function a1(d, t, $) {
|
|
8163
|
+
var i = t1(t);
|
|
8164
|
+
return t = v(t, 1), t in X ? (t = d1(d, t, e1(t)), l1(d, i, t, $)) : 1;
|
|
8133
8165
|
}
|
|
8134
8166
|
function K1(d, t) {
|
|
8135
8167
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8136
|
-
for (var
|
|
8168
|
+
for (var $, i = d.length, s = 1; 3 >= s && s <= i; ++s) if ($ = parseInt(d.substring(0, s), 10), $ in X) return t.g(d.substring(s)), $;
|
|
8137
8169
|
return 0;
|
|
8138
8170
|
}
|
|
8139
|
-
function H1(d, t,
|
|
8171
|
+
function H1(d, t, $, i, s, u) {
|
|
8140
8172
|
if (t.length == 0) return 0;
|
|
8141
8173
|
t = new N(t);
|
|
8142
8174
|
var l;
|
|
8143
|
-
|
|
8175
|
+
$ != null && (l = p($, 11)), l == null && (l = "NonMatch");
|
|
8144
8176
|
var h = t.toString();
|
|
8145
8177
|
if (h.length == 0) l = 20;
|
|
8146
8178
|
else if (Q.test(h)) h = h.replace(Q, ""), k(t), t.g(R1(h)), l = 1;
|
|
@@ -8154,27 +8186,27 @@ const H2 = (y) => {
|
|
|
8154
8186
|
}
|
|
8155
8187
|
if (s && E(u, 6, l), l != 20) {
|
|
8156
8188
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8157
|
-
if (d = K1(t,
|
|
8189
|
+
if (d = K1(t, i), d != 0) return E(u, 1, d), d;
|
|
8158
8190
|
throw Error("Invalid country calling code");
|
|
8159
8191
|
}
|
|
8160
|
-
return
|
|
8192
|
+
return $ != null && (l = v($, 10), h = "" + l, m = t.toString(), m.lastIndexOf(h, 0) == 0 && (h = new N(m.substring(h.length)), m = p($, 1), m = new RegExp(v(m, 2)), j1(h, $, null), h = h.toString(), !U(m, t.toString()) && U(m, h) || l1(d, t.toString(), $, -1) == 3)) ? (i.g(h), s && E(u, 6, 10), E(u, 1, l), l) : (E(u, 1, 0), 0);
|
|
8161
8193
|
}
|
|
8162
|
-
function j1(d, t,
|
|
8163
|
-
var
|
|
8194
|
+
function j1(d, t, $) {
|
|
8195
|
+
var i = d.toString(), s = i.length, u = p(t, 15);
|
|
8164
8196
|
if (s != 0 && u != null && u.length != 0) {
|
|
8165
8197
|
var l = new RegExp("^(?:" + u + ")");
|
|
8166
|
-
if (s = l.exec(
|
|
8167
|
-
u = new RegExp(
|
|
8168
|
-
var h = U(u,
|
|
8169
|
-
t = p(t, 16), t == null || t.length == 0 || s[m] == null || s[m].length == 0 ? (!h || U(u,
|
|
8198
|
+
if (s = l.exec(i)) {
|
|
8199
|
+
u = new RegExp(v(p(t, 1), 2));
|
|
8200
|
+
var h = U(u, i), m = s.length - 1;
|
|
8201
|
+
t = p(t, 16), t == null || t.length == 0 || s[m] == null || s[m].length == 0 ? (!h || U(u, i.substring(s[0].length))) && ($ != null && 0 < m && s[m] != null && $.g(s[1]), d.set(i.substring(s[0].length))) : (i = i.replace(l, t), (!h || U(u, i)) && ($ != null && 0 < m && $.g(s[1]), d.set(i)));
|
|
8170
8202
|
}
|
|
8171
8203
|
}
|
|
8172
8204
|
}
|
|
8173
|
-
function Y(d, t,
|
|
8174
|
-
if (!o1(
|
|
8175
|
-
return W1(d, t,
|
|
8205
|
+
function Y(d, t, $) {
|
|
8206
|
+
if (!o1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8207
|
+
return W1(d, t, $, !0);
|
|
8176
8208
|
}
|
|
8177
|
-
function W1(d, t,
|
|
8209
|
+
function W1(d, t, $, i) {
|
|
8178
8210
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8179
8211
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8180
8212
|
var s = new N(), u = t.indexOf(";phone-context=");
|
|
@@ -8186,8 +8218,8 @@ const H2 = (y) => {
|
|
|
8186
8218
|
}
|
|
8187
8219
|
var h = u;
|
|
8188
8220
|
if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = _2.exec(h), h = I2.exec(h), l = l !== null || h !== null), !l || (u != null ? (u.charAt(0) === "+" && s.g(u), u = t.indexOf("tel:"), s.g(t.substring(0 <= u ? u + 4 : 0, t.indexOf(";phone-context=")))) : (u = s.g, l = t ?? "", h = l.search(g2), 0 <= h ? (l = l.substring(h), l = l.replace(m2, ""), h = l.search(C2), 0 <= h && (l = l.substring(0, h))) : l = "", u.call(s, l)), u = s.toString(), l = u.indexOf(";isub="), 0 < l && (k(s), s.g(u.substring(0, l))), !x1(s.toString()))) throw Error("The string supplied did not seem to be a phone number");
|
|
8189
|
-
if (u = s.toString(), !(o1(
|
|
8190
|
-
u = new H(),
|
|
8221
|
+
if (u = s.toString(), !(o1($) || u != null && 0 < u.length && Q.test(u))) throw Error("Invalid country calling code");
|
|
8222
|
+
u = new H(), i && E(u, 5, t);
|
|
8191
8223
|
d: {
|
|
8192
8224
|
if (t = s.toString(), l = t.search(P1), 0 <= l && x1(t.substring(0, l))) {
|
|
8193
8225
|
h = t.match(P1);
|
|
@@ -8198,25 +8230,25 @@ const H2 = (y) => {
|
|
|
8198
8230
|
}
|
|
8199
8231
|
t = "";
|
|
8200
8232
|
}
|
|
8201
|
-
0 < t.length && E(u, 3, t), l = j(d,
|
|
8233
|
+
0 < t.length && E(u, 3, t), l = j(d, $), t = new N(), h = 0, m = s.toString();
|
|
8202
8234
|
try {
|
|
8203
|
-
h = H1(d, m, l, t,
|
|
8235
|
+
h = H1(d, m, l, t, i, u);
|
|
8204
8236
|
} catch (_1) {
|
|
8205
8237
|
if (_1.message == "Invalid country calling code" && Q.test(m)) {
|
|
8206
|
-
if (m = m.replace(Q, ""), h = H1(d, m, l, t,
|
|
8238
|
+
if (m = m.replace(Q, ""), h = H1(d, m, l, t, i, u), h == 0) throw _1;
|
|
8207
8239
|
} else throw _1;
|
|
8208
8240
|
}
|
|
8209
|
-
if (h != 0 ? (s = e1(h), s !=
|
|
8241
|
+
if (h != 0 ? (s = e1(h), s != $ && (l = d1(d, h, s))) : (B1(s), t.g(s.toString()), $ != null ? (h = v(l, 10), E(
|
|
8210
8242
|
u,
|
|
8211
8243
|
1,
|
|
8212
8244
|
h
|
|
8213
|
-
)) :
|
|
8245
|
+
)) : i && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (l != null && ($ = new N(), s = new N(t.toString()), j1(s, l, $), d = l1(d, s.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = s, i && 0 < $.toString().length && E(u, 7, $.toString()))), i = t.toString(), d = i.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
|
|
8214
8246
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
8215
|
-
if (1 <
|
|
8216
|
-
for (E(u, 4, !0), d = 1; d <
|
|
8247
|
+
if (1 < i.length && i.charAt(0) == "0") {
|
|
8248
|
+
for (E(u, 4, !0), d = 1; d < i.length - 1 && i.charAt(d) == "0"; ) d++;
|
|
8217
8249
|
d != 1 && E(u, 8, d);
|
|
8218
8250
|
}
|
|
8219
|
-
return E(u, 2, parseInt(
|
|
8251
|
+
return E(u, 2, parseInt(i, 10)), u;
|
|
8220
8252
|
}
|
|
8221
8253
|
function U(d, t) {
|
|
8222
8254
|
return !!((d = typeof d == "string" ? t.match("^(?:" + d + ")$") : t.match(d)) && d[0].length == t.length);
|
|
@@ -8228,37 +8260,37 @@ const H2 = (y) => {
|
|
|
8228
8260
|
E(z1, 11, "NA");
|
|
8229
8261
|
var N2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), Z1 = /[- ]/;
|
|
8230
8262
|
function Y1(d, t) {
|
|
8231
|
-
var
|
|
8232
|
-
return t = o1(t) ? V1(
|
|
8263
|
+
var $ = d.ga;
|
|
8264
|
+
return t = o1(t) ? V1($, t) : 0, d = j(d.ga, e1(t)), d ?? z1;
|
|
8233
8265
|
}
|
|
8234
8266
|
function J1(d) {
|
|
8235
|
-
for (var t = d.j.length,
|
|
8236
|
-
var
|
|
8267
|
+
for (var t = d.j.length, $ = 0; $ < t; ++$) {
|
|
8268
|
+
var i = d.j[$], s = v(i, 1);
|
|
8237
8269
|
if (d.da == s) return !1;
|
|
8238
|
-
var u = d, l =
|
|
8270
|
+
var u = d, l = i, h = v(l, 1);
|
|
8239
8271
|
k(u.v);
|
|
8240
8272
|
var m = u;
|
|
8241
|
-
l =
|
|
8273
|
+
l = v(l, 2);
|
|
8242
8274
|
var V = "999999999999999".match(h)[0];
|
|
8243
|
-
if (V.length < m.g.h.length ? m = "" : (m = V.replace(new RegExp(h, "g"), l), m = m.replace(RegExp("9", "g"), " ")), 0 < m.length ? (u.v.g(m), u = !0) : u = !1, u) return d.da = s, d.ha = Z1.test(p(
|
|
8275
|
+
if (V.length < m.g.h.length ? m = "" : (m = V.replace(new RegExp(h, "g"), l), m = m.replace(RegExp("9", "g"), " ")), 0 < m.length ? (u.v.g(m), u = !0) : u = !1, u) return d.da = s, d.ha = Z1.test(p(i, 4)), d.$ = 0, !0;
|
|
8244
8276
|
}
|
|
8245
8277
|
return d.u = !1;
|
|
8246
8278
|
}
|
|
8247
8279
|
function q1(d, t) {
|
|
8248
|
-
for (var
|
|
8280
|
+
for (var $ = [], i = t.length - 3, s = d.j.length, u = 0; u < s; ++u) {
|
|
8249
8281
|
var l = d.j[u];
|
|
8250
|
-
K(l, 3) == 0 ?
|
|
8282
|
+
K(l, 3) == 0 ? $.push(d.j[u]) : (l = p(l, 3, Math.min(i, K(l, 3) - 1)), t.search(l) == 0 && $.push(d.j[u]));
|
|
8251
8283
|
}
|
|
8252
|
-
d.j =
|
|
8284
|
+
d.j = $;
|
|
8253
8285
|
}
|
|
8254
8286
|
function T2(d, t) {
|
|
8255
8287
|
d.s.g(t);
|
|
8256
|
-
var
|
|
8257
|
-
if (D1.test(
|
|
8288
|
+
var $ = t;
|
|
8289
|
+
if (D1.test($) || d.s.h.length == 1 && p2.test($) ? (t == "+" ? ($ = t, d.ba.g(t)) : ($ = g1[t], d.ba.g($), d.g.g($)), t = $) : (d.u = !1, d.la = !0), !d.u) {
|
|
8258
8290
|
if (!d.la) {
|
|
8259
8291
|
if (e2(d)) {
|
|
8260
8292
|
if ($2(d)) return X1(d);
|
|
8261
|
-
} else if (0 < d.o.length && (t = d.g.toString(), k(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(),
|
|
8293
|
+
} else if (0 < d.o.length && (t = d.g.toString(), k(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), $ = t.lastIndexOf(d.o), k(d.h), d.h.g(t.substring(0, $))), d.o != t2(d)) return d.h.g(" "), X1(d);
|
|
8262
8294
|
}
|
|
8263
8295
|
return d.s.toString();
|
|
8264
8296
|
}
|
|
@@ -8271,90 +8303,90 @@ const H2 = (y) => {
|
|
|
8271
8303
|
if (e2(d)) d.ea = !0;
|
|
8272
8304
|
else return d.o = t2(d), m1(d);
|
|
8273
8305
|
default:
|
|
8274
|
-
return d.ea ? ($2(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = n2(d, t),
|
|
8306
|
+
return d.ea ? ($2(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = n2(d, t), $ = Q1(d), 0 < $.length ? $ : (q1(d, d.g.toString()), J1(d) ? d2(d) : d.u ? h1(d, t) : d.s.toString())) : m1(d);
|
|
8275
8307
|
}
|
|
8276
8308
|
}
|
|
8277
8309
|
function X1(d) {
|
|
8278
8310
|
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, k(d.v), d.da = "", m1(d);
|
|
8279
8311
|
}
|
|
8280
8312
|
function Q1(d) {
|
|
8281
|
-
for (var t = d.g.toString(),
|
|
8282
|
-
var s = d.j[
|
|
8313
|
+
for (var t = d.g.toString(), $ = d.j.length, i = 0; i < $; ++i) {
|
|
8314
|
+
var s = d.j[i], u = v(s, 1);
|
|
8283
8315
|
if (new RegExp("^(?:" + u + ")$").test(t) && (d.ha = Z1.test(p(s, 4)), s = t.replace(new RegExp(u, "g"), p(s, 2)), s = h1(d, s), s1(s, c2) == d.ba)) return s;
|
|
8284
8316
|
}
|
|
8285
8317
|
return "";
|
|
8286
8318
|
}
|
|
8287
8319
|
function h1(d, t) {
|
|
8288
|
-
var
|
|
8289
|
-
return d.ha && 0 <
|
|
8320
|
+
var $ = d.h.h.length;
|
|
8321
|
+
return d.ha && 0 < $ && d.h.toString().charAt($ - 1) != " " ? d.h + " " + t : d.h + t;
|
|
8290
8322
|
}
|
|
8291
8323
|
function m1(d) {
|
|
8292
8324
|
var t = d.g.toString();
|
|
8293
8325
|
if (3 <= t.length) {
|
|
8294
|
-
for (var
|
|
8295
|
-
var u =
|
|
8296
|
-
0 < d.o.length && O1(
|
|
8326
|
+
for (var $ = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ? P(d.l, 20) : P(d.l, 19), i = $.length, s = 0; s < i; ++s) {
|
|
8327
|
+
var u = $[s];
|
|
8328
|
+
0 < d.o.length && O1(v(u, 4)) && !p(u, 6) && !B(u, 5) || (d.o.length != 0 || d.ca || O1(v(u, 4)) || p(u, 6)) && N2.test(v(u, 2)) && d.j.push(u);
|
|
8297
8329
|
}
|
|
8298
8330
|
return q1(d, t), t = Q1(d), 0 < t.length ? t : J1(d) ? d2(d) : d.s.toString();
|
|
8299
8331
|
}
|
|
8300
8332
|
return h1(d, t);
|
|
8301
8333
|
}
|
|
8302
8334
|
function d2(d) {
|
|
8303
|
-
var t = d.g.toString(),
|
|
8304
|
-
if (0 <
|
|
8305
|
-
for (var
|
|
8306
|
-
return d.u ? h1(d,
|
|
8335
|
+
var t = d.g.toString(), $ = t.length;
|
|
8336
|
+
if (0 < $) {
|
|
8337
|
+
for (var i = "", s = 0; s < $; s++) i = n2(d, t.charAt(s));
|
|
8338
|
+
return d.u ? h1(d, i) : d.s.toString();
|
|
8307
8339
|
}
|
|
8308
8340
|
return d.h.toString();
|
|
8309
8341
|
}
|
|
8310
8342
|
function t2(d) {
|
|
8311
|
-
var t = d.g.toString(),
|
|
8312
|
-
if (p(d.l, 10) != 1) var
|
|
8313
|
-
else
|
|
8314
|
-
return
|
|
8343
|
+
var t = d.g.toString(), $ = 0;
|
|
8344
|
+
if (p(d.l, 10) != 1) var i = !1;
|
|
8345
|
+
else i = d.g.toString(), i = i.charAt(0) == "1" && i.charAt(1) != "0" && i.charAt(1) != "1";
|
|
8346
|
+
return i ? ($ = 1, d.h.g("1").g(" "), d.ca = !0) : B(d.l, 15) && (i = new RegExp("^(?:" + p(d.l, 15) + ")"), i = t.match(i), i != null && i[0] != null && 0 < i[0].length && (d.ca = !0, $ = i[0].length, d.h.g(t.substring(0, $)))), k(d.g), d.g.g(t.substring($)), t.substring(0, $);
|
|
8315
8347
|
}
|
|
8316
8348
|
function e2(d) {
|
|
8317
|
-
var t = d.ba.toString(),
|
|
8318
|
-
return
|
|
8349
|
+
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
|
|
8350
|
+
return $ = t.match($), $ != null && $[0] != null && 0 < $[0].length ? (d.ca = !0, $ = $[0].length, k(d.g), d.g.g(t.substring($)), k(d.h), d.h.g(t.substring(0, $)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
|
|
8319
8351
|
}
|
|
8320
8352
|
function $2(d) {
|
|
8321
8353
|
if (d.g.h.length == 0) return !1;
|
|
8322
|
-
var t = new N(),
|
|
8323
|
-
return
|
|
8354
|
+
var t = new N(), $ = K1(d.g, t);
|
|
8355
|
+
return $ == 0 ? !1 : (k(d.g), d.g.g(t.toString()), t = e1($), t == "001" ? d.l = j(d.ga, "" + $) : t != d.ka && (d.l = Y1(d, t)), d.h.g("" + $).g(" "), d.o = "", !0);
|
|
8324
8356
|
}
|
|
8325
8357
|
function n2(d, t) {
|
|
8326
|
-
var
|
|
8327
|
-
if (0 <=
|
|
8328
|
-
var
|
|
8329
|
-
return t =
|
|
8358
|
+
var $ = d.v.toString();
|
|
8359
|
+
if (0 <= $.substring(d.$).search(d.fa)) {
|
|
8360
|
+
var i = $.search(d.fa);
|
|
8361
|
+
return t = $.replace(d.fa, t), k(d.v), d.v.g(t), d.$ = i, t.substring(0, d.$ + 1);
|
|
8330
8362
|
}
|
|
8331
8363
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
8332
8364
|
}
|
|
8333
8365
|
const y1 = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
|
|
8334
|
-
|
|
8366
|
+
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
8335
8367
|
try {
|
|
8336
|
-
const
|
|
8368
|
+
const $ = d.replace(/[^+0-9]/g, ""), i = new L2(t);
|
|
8337
8369
|
t = "";
|
|
8338
|
-
for (let s = 0; s <
|
|
8370
|
+
for (let s = 0; s < $.length; s++) i.ja = T2(i, $.charAt(s)), t = i.ja;
|
|
8339
8371
|
return t;
|
|
8340
8372
|
} catch {
|
|
8341
8373
|
return d;
|
|
8342
8374
|
}
|
|
8343
|
-
}),
|
|
8375
|
+
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => {
|
|
8344
8376
|
try {
|
|
8345
8377
|
const s = D.g(), u = Y(s, d, t);
|
|
8346
|
-
var
|
|
8347
|
-
return
|
|
8378
|
+
var i = a1(s, u, -1);
|
|
8379
|
+
return i == 0 || i == 4 ? s.format(u, typeof $ > "u" ? 0 : $) : d;
|
|
8348
8380
|
} catch {
|
|
8349
8381
|
return d;
|
|
8350
8382
|
}
|
|
8351
|
-
}),
|
|
8383
|
+
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, i) => {
|
|
8352
8384
|
try {
|
|
8353
8385
|
const m = D.g();
|
|
8354
8386
|
d: {
|
|
8355
8387
|
var s = m;
|
|
8356
8388
|
if (o1(d)) {
|
|
8357
|
-
var u = u1(j(s, d),
|
|
8389
|
+
var u = u1(j(s, d), $);
|
|
8358
8390
|
try {
|
|
8359
8391
|
if (B(u, 6)) {
|
|
8360
8392
|
var l = p(u, 6), h = W1(s, l, d, !1);
|
|
@@ -8365,61 +8397,61 @@ const H2 = (y) => {
|
|
|
8365
8397
|
}
|
|
8366
8398
|
h = null;
|
|
8367
8399
|
}
|
|
8368
|
-
return m.format(h,
|
|
8400
|
+
return m.format(h, i ? 0 : t ? 2 : 1);
|
|
8369
8401
|
} catch {
|
|
8370
8402
|
return "";
|
|
8371
8403
|
}
|
|
8372
|
-
}),
|
|
8404
|
+
}), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
|
|
8373
8405
|
try {
|
|
8374
8406
|
return p(Y(D.g(), d, t), 3);
|
|
8375
8407
|
} catch {
|
|
8376
8408
|
return "";
|
|
8377
8409
|
}
|
|
8378
|
-
}),
|
|
8410
|
+
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
8379
8411
|
try {
|
|
8380
|
-
const
|
|
8381
|
-
return F1(
|
|
8412
|
+
const $ = D.g(), i = Y($, d, t);
|
|
8413
|
+
return F1($, i);
|
|
8382
8414
|
} catch {
|
|
8383
8415
|
return -99;
|
|
8384
8416
|
}
|
|
8385
|
-
}),
|
|
8417
|
+
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
8386
8418
|
if (!t) return 1;
|
|
8387
8419
|
try {
|
|
8388
|
-
const
|
|
8389
|
-
return a1(
|
|
8390
|
-
} catch (
|
|
8391
|
-
return
|
|
8420
|
+
const $ = D.g(), i = Y($, d, t);
|
|
8421
|
+
return a1($, i, -1);
|
|
8422
|
+
} catch ($) {
|
|
8423
|
+
return $.message === "Invalid country calling code" ? 1 : 3 >= d.length || $.message === "Phone number too short after IDD" || $.message === "The string supplied is too short to be a phone number" ? 2 : $.message === "The string supplied is too long to be a phone number" ? 3 : -99;
|
|
8392
8424
|
}
|
|
8393
|
-
}),
|
|
8425
|
+
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t, $) => {
|
|
8394
8426
|
try {
|
|
8395
|
-
const
|
|
8396
|
-
if (
|
|
8397
|
-
const l =
|
|
8398
|
-
return u && l.includes(F1(
|
|
8427
|
+
const i = D.g(), s = Y(i, d, t), u = b2(i, s);
|
|
8428
|
+
if ($) {
|
|
8429
|
+
const l = $.map((h) => y1[h]);
|
|
8430
|
+
return u && l.includes(F1(i, s));
|
|
8399
8431
|
}
|
|
8400
8432
|
return u;
|
|
8401
8433
|
} catch {
|
|
8402
8434
|
return !1;
|
|
8403
8435
|
}
|
|
8404
|
-
}),
|
|
8436
|
+
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => {
|
|
8405
8437
|
try {
|
|
8406
|
-
const
|
|
8407
|
-
if (
|
|
8408
|
-
|
|
8409
|
-
for (let u of
|
|
8438
|
+
const i = D.g(), s = Y(i, d, t);
|
|
8439
|
+
if ($) {
|
|
8440
|
+
$.includes("FIXED_LINE_OR_MOBILE") && ($.includes("MOBILE") || $.push("MOBILE"), $.includes("FIXED_LINE") || $.push("FIXED_LINE"));
|
|
8441
|
+
for (let u of $) if (a1(i, s, y1[u]) === 0) return !0;
|
|
8410
8442
|
return !1;
|
|
8411
8443
|
}
|
|
8412
|
-
return a1(
|
|
8444
|
+
return a1(i, s, -1) === 0;
|
|
8413
8445
|
} catch {
|
|
8414
8446
|
return !1;
|
|
8415
8447
|
}
|
|
8416
|
-
}),
|
|
8448
|
+
}), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
|
|
8417
8449
|
try {
|
|
8418
8450
|
return p(Y(D.g(), d, t), 2).toString();
|
|
8419
8451
|
} catch {
|
|
8420
8452
|
return "";
|
|
8421
8453
|
}
|
|
8422
|
-
}),
|
|
8454
|
+
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", y1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
|
|
8423
8455
|
})();
|
|
8424
8456
|
const j2 = window.intlTelInputUtilsTemp;
|
|
8425
8457
|
delete window.intlTelInputUtilsTemp;
|
|
@@ -8456,40 +8488,40 @@ const z2 = {
|
|
|
8456
8488
|
"changeValidity",
|
|
8457
8489
|
"changeErrorCode"
|
|
8458
8490
|
], ["update:modelValue"]),
|
|
8459
|
-
setup(y, { expose:
|
|
8460
|
-
const
|
|
8461
|
-
let
|
|
8462
|
-
f.value !==
|
|
8491
|
+
setup(y, { expose: e, emit: n }) {
|
|
8492
|
+
const r = A2(y, "modelValue"), o = y, a = n, c = I1(), g = I1(), f = I1(!1), S = () => g.value ? o.options.strictMode ? g.value.isValidNumberPrecise() : g.value.isValidNumber() : null, _ = () => {
|
|
8493
|
+
let I = S();
|
|
8494
|
+
f.value !== I && (f.value = I, a("changeValidity", !!I), a(
|
|
8463
8495
|
"changeErrorCode",
|
|
8464
|
-
|
|
8496
|
+
I ? null : g.value.getValidationError()
|
|
8465
8497
|
));
|
|
8466
|
-
},
|
|
8467
|
-
var
|
|
8468
|
-
a("changeNumber", ((
|
|
8469
|
-
},
|
|
8470
|
-
var
|
|
8471
|
-
a("changeCountry", ((
|
|
8498
|
+
}, b = () => {
|
|
8499
|
+
var I;
|
|
8500
|
+
a("changeNumber", ((I = g.value) == null ? void 0 : I.getNumber()) ?? ""), _();
|
|
8501
|
+
}, w = () => {
|
|
8502
|
+
var I;
|
|
8503
|
+
a("changeCountry", ((I = g.value) == null ? void 0 : I.getSelectedCountryData().iso2) ?? ""), b(), _();
|
|
8472
8504
|
};
|
|
8473
8505
|
return E2(() => {
|
|
8474
8506
|
c.value && (g.value = C(c.value, o.options), o.value && g.value.setNumber(o.value), o.disabled && g.value.setDisabled(o.disabled));
|
|
8475
8507
|
}), D2(
|
|
8476
8508
|
() => o.disabled,
|
|
8477
|
-
(
|
|
8509
|
+
(I) => {
|
|
8478
8510
|
var A;
|
|
8479
|
-
return (A = g.value) == null ? void 0 : A.setDisabled(
|
|
8511
|
+
return (A = g.value) == null ? void 0 : A.setDisabled(I);
|
|
8480
8512
|
}
|
|
8481
8513
|
), M2(() => {
|
|
8482
|
-
var
|
|
8483
|
-
return (
|
|
8484
|
-
}),
|
|
8514
|
+
var I;
|
|
8515
|
+
return (I = g.value) == null ? void 0 : I.destroy();
|
|
8516
|
+
}), e({ instance: g, input: c }), (I, A) => P2((x2(), R2("input", B2({
|
|
8485
8517
|
ref_key: "input",
|
|
8486
8518
|
ref: c,
|
|
8487
|
-
"onUpdate:modelValue": A[0] || (A[0] = (G) =>
|
|
8519
|
+
"onUpdate:modelValue": A[0] || (A[0] = (G) => r.value = G),
|
|
8488
8520
|
type: "tel",
|
|
8489
|
-
onCountrychange:
|
|
8490
|
-
onInput:
|
|
8521
|
+
onCountrychange: w,
|
|
8522
|
+
onInput: b
|
|
8491
8523
|
}, y.inputProps), null, 16)), [
|
|
8492
|
-
[k2,
|
|
8524
|
+
[k2, r.value]
|
|
8493
8525
|
]);
|
|
8494
8526
|
}
|
|
8495
8527
|
};
|