intl-tel-input 24.5.2 → 24.6.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 +51 -12
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +10 -4
- package/build/js/intlTelInput.js +59 -24
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +56 -25
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +6 -8
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +58 -23
- package/react/build/IntlTelInput.d.ts +10 -4
- package/react/build/IntlTelInput.js +58 -23
- package/react/build/IntlTelInputWithUtils.cjs +55 -24
- package/react/build/IntlTelInputWithUtils.js +55 -24
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +64 -40
- package/vue/build/IntlTelInputWithUtils.mjs +448 -428
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as i2, useModel as T2, ref as I1, onMounted as N2, watch as A2, onUnmounted as E2, withDirectives as D2, openBlock as M2, createElementBlock as P2, mergeProps as x2, vModelText as R2 } from "vue";
|
|
2
|
+
const n2 = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -1306,8 +1306,8 @@ const i2 = [
|
|
|
1306
1306
|
"263"
|
|
1307
1307
|
]
|
|
1308
1308
|
], H = [];
|
|
1309
|
-
for (let y = 0; y <
|
|
1310
|
-
const e =
|
|
1309
|
+
for (let y = 0; y < n2.length; y++) {
|
|
1310
|
+
const e = n2[y];
|
|
1311
1311
|
H[y] = {
|
|
1312
1312
|
name: "",
|
|
1313
1313
|
// this is now populated in the plugin
|
|
@@ -1607,6 +1607,8 @@ const u2 = {
|
|
|
1607
1607
|
i18n: {},
|
|
1608
1608
|
//* Initial country.
|
|
1609
1609
|
initialCountry: "",
|
|
1610
|
+
//* Specify the path to the libphonenumber script to enable validation/formatting.
|
|
1611
|
+
loadUtilsOnInit: "",
|
|
1610
1612
|
//* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
|
|
1611
1613
|
nationalMode: !0,
|
|
1612
1614
|
//* Display only these countries.
|
|
@@ -1627,7 +1629,7 @@ const u2 = {
|
|
|
1627
1629
|
navigator.userAgent
|
|
1628
1630
|
) || window.innerWidth <= 500
|
|
1629
1631
|
) : !1,
|
|
1630
|
-
//*
|
|
1632
|
+
//* Deprecated! Use `loadUtilsOnInit` instead.
|
|
1631
1633
|
utilsScript: "",
|
|
1632
1634
|
//* The number type to enforce during validation.
|
|
1633
1635
|
validationNumberType: "MOBILE"
|
|
@@ -1652,43 +1654,43 @@ const u2 = {
|
|
|
1652
1654
|
], f1 = (y) => y.replace(/\D/g, ""), r2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), s2 = (y) => {
|
|
1653
1655
|
const e = f1(y);
|
|
1654
1656
|
if (e.charAt(0) === "1") {
|
|
1655
|
-
const
|
|
1656
|
-
return G2.indexOf(
|
|
1657
|
+
const i = e.substr(1, 3);
|
|
1658
|
+
return G2.indexOf(i) !== -1;
|
|
1657
1659
|
}
|
|
1658
1660
|
return !1;
|
|
1659
|
-
},
|
|
1660
|
-
if (
|
|
1661
|
+
}, U2 = (y, e, i, n) => {
|
|
1662
|
+
if (i === 0 && !n)
|
|
1661
1663
|
return 0;
|
|
1662
1664
|
let o = 0;
|
|
1663
1665
|
for (let a = 0; a < e.length; a++) {
|
|
1664
|
-
if (/[+0-9]/.test(e[a]) && o++, o === y && !
|
|
1666
|
+
if (/[+0-9]/.test(e[a]) && o++, o === y && !n)
|
|
1665
1667
|
return a + 1;
|
|
1666
|
-
if (
|
|
1668
|
+
if (n && o === y + 1)
|
|
1667
1669
|
return a;
|
|
1668
1670
|
}
|
|
1669
1671
|
return e.length;
|
|
1670
|
-
},
|
|
1671
|
-
const
|
|
1672
|
-
return e && Object.entries(e).forEach(([o, a]) =>
|
|
1673
|
-
}, $1 = (y) => {
|
|
1674
|
-
const { instances:
|
|
1675
|
-
Object.values(
|
|
1672
|
+
}, A = (y, e, i) => {
|
|
1673
|
+
const n = document.createElement(y);
|
|
1674
|
+
return e && Object.entries(e).forEach(([o, a]) => n.setAttribute(o, a)), i && i.appendChild(n), n;
|
|
1675
|
+
}, $1 = (y, ...e) => {
|
|
1676
|
+
const { instances: i } = m;
|
|
1677
|
+
Object.values(i).forEach((n) => n[y](...e));
|
|
1676
1678
|
};
|
|
1677
|
-
class
|
|
1678
|
-
constructor(e,
|
|
1679
|
-
this.id = O2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u2,
|
|
1679
|
+
class F2 {
|
|
1680
|
+
constructor(e, i = {}) {
|
|
1681
|
+
this.id = O2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u2, i), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
|
|
1680
1682
|
}
|
|
1681
1683
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1682
1684
|
_init() {
|
|
1683
1685
|
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
1686
|
const e = this.options.allowDropdown || this.options.separateDialCode;
|
|
1685
1687
|
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 = { ...o2, ...this.options.i18n };
|
|
1686
|
-
const
|
|
1688
|
+
const i = new Promise((o, a) => {
|
|
1687
1689
|
this.resolveAutoCountryPromise = o, this.rejectAutoCountryPromise = a;
|
|
1688
|
-
}),
|
|
1690
|
+
}), n = new Promise((o, a) => {
|
|
1689
1691
|
this.resolveUtilsScriptPromise = o, this.rejectUtilsScriptPromise = a;
|
|
1690
1692
|
});
|
|
1691
|
-
this.promise = Promise.all([
|
|
1693
|
+
this.promise = Promise.all([i, n]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
1692
1694
|
}
|
|
1693
1695
|
//********************
|
|
1694
1696
|
//* PRIVATE METHODS
|
|
@@ -1699,41 +1701,41 @@ class U2 {
|
|
|
1699
1701
|
}
|
|
1700
1702
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1701
1703
|
_sortCountries() {
|
|
1702
|
-
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e,
|
|
1703
|
-
const { countryOrder:
|
|
1704
|
-
if (
|
|
1705
|
-
const o =
|
|
1704
|
+
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, i) => {
|
|
1705
|
+
const { countryOrder: n } = this.options;
|
|
1706
|
+
if (n) {
|
|
1707
|
+
const o = n.indexOf(e.iso2), a = n.indexOf(i.iso2), c = o > -1, g = a > -1;
|
|
1706
1708
|
if (c || g)
|
|
1707
1709
|
return c && g ? o - a : c ? -1 : 1;
|
|
1708
1710
|
}
|
|
1709
|
-
return e.name.localeCompare(
|
|
1711
|
+
return e.name.localeCompare(i.name);
|
|
1710
1712
|
});
|
|
1711
1713
|
}
|
|
1712
1714
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1713
|
-
_addToDialCodeMap(e,
|
|
1714
|
-
|
|
1715
|
-
for (let a = 0; a < this.dialCodeToIso2Map[
|
|
1716
|
-
if (this.dialCodeToIso2Map[
|
|
1715
|
+
_addToDialCodeMap(e, i, n) {
|
|
1716
|
+
i.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = i.length), this.dialCodeToIso2Map.hasOwnProperty(i) || (this.dialCodeToIso2Map[i] = []);
|
|
1717
|
+
for (let a = 0; a < this.dialCodeToIso2Map[i].length; a++)
|
|
1718
|
+
if (this.dialCodeToIso2Map[i][a] === e)
|
|
1717
1719
|
return;
|
|
1718
|
-
const o =
|
|
1719
|
-
this.dialCodeToIso2Map[
|
|
1720
|
+
const o = n !== void 0 ? n : this.dialCodeToIso2Map[i].length;
|
|
1721
|
+
this.dialCodeToIso2Map[i][o] = e;
|
|
1720
1722
|
}
|
|
1721
1723
|
//* Process onlyCountries or excludeCountries array if present.
|
|
1722
1724
|
_processAllCountries() {
|
|
1723
|
-
const { onlyCountries: e, excludeCountries:
|
|
1725
|
+
const { onlyCountries: e, excludeCountries: i } = this.options;
|
|
1724
1726
|
if (e.length) {
|
|
1725
|
-
const
|
|
1727
|
+
const n = e.map(
|
|
1726
1728
|
(o) => o.toLowerCase()
|
|
1727
1729
|
);
|
|
1728
1730
|
this.countries = H.filter(
|
|
1729
|
-
(o) =>
|
|
1731
|
+
(o) => n.indexOf(o.iso2) > -1
|
|
1730
1732
|
);
|
|
1731
|
-
} else if (
|
|
1732
|
-
const
|
|
1733
|
+
} else if (i.length) {
|
|
1734
|
+
const n = i.map(
|
|
1733
1735
|
(o) => o.toLowerCase()
|
|
1734
1736
|
);
|
|
1735
1737
|
this.countries = H.filter(
|
|
1736
|
-
(o) =>
|
|
1738
|
+
(o) => n.indexOf(o.iso2) === -1
|
|
1737
1739
|
);
|
|
1738
1740
|
} else
|
|
1739
1741
|
this.countries = H;
|
|
@@ -1741,28 +1743,28 @@ class U2 {
|
|
|
1741
1743
|
//* Translate Countries by object literal provided on config.
|
|
1742
1744
|
_translateCountryNames() {
|
|
1743
1745
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1744
|
-
const
|
|
1745
|
-
this.options.i18n.hasOwnProperty(
|
|
1746
|
+
const i = this.countries[e].iso2.toLowerCase();
|
|
1747
|
+
this.options.i18n.hasOwnProperty(i) && (this.countries[e].name = this.options.i18n[i]);
|
|
1746
1748
|
}
|
|
1747
1749
|
}
|
|
1748
1750
|
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
1749
1751
|
_processDialCodes() {
|
|
1750
1752
|
this.dialCodes = {}, this.dialCodeMaxLen = 0, this.dialCodeToIso2Map = {};
|
|
1751
1753
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1752
|
-
const
|
|
1753
|
-
this.dialCodes[
|
|
1754
|
+
const i = this.countries[e];
|
|
1755
|
+
this.dialCodes[i.dialCode] || (this.dialCodes[i.dialCode] = !0), this._addToDialCodeMap(i.iso2, i.dialCode, i.priority);
|
|
1754
1756
|
}
|
|
1755
1757
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1756
|
-
const
|
|
1757
|
-
if (
|
|
1758
|
-
const
|
|
1759
|
-
for (let o = 0; o <
|
|
1760
|
-
const a =
|
|
1758
|
+
const i = this.countries[e];
|
|
1759
|
+
if (i.areaCodes) {
|
|
1760
|
+
const n = this.dialCodeToIso2Map[i.dialCode][0];
|
|
1761
|
+
for (let o = 0; o < i.areaCodes.length; o++) {
|
|
1762
|
+
const a = i.areaCodes[o];
|
|
1761
1763
|
for (let c = 1; c < a.length; c++) {
|
|
1762
|
-
const g =
|
|
1763
|
-
this._addToDialCodeMap(
|
|
1764
|
+
const g = i.dialCode + a.substr(0, c);
|
|
1765
|
+
this._addToDialCodeMap(n, g), this._addToDialCodeMap(i.iso2, g);
|
|
1764
1766
|
}
|
|
1765
|
-
this._addToDialCodeMap(
|
|
1767
|
+
this._addToDialCodeMap(i.iso2, i.dialCode + a);
|
|
1766
1768
|
}
|
|
1767
1769
|
}
|
|
1768
1770
|
}
|
|
@@ -1773,8 +1775,8 @@ class U2 {
|
|
|
1773
1775
|
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
1776
|
const {
|
|
1775
1777
|
allowDropdown: e,
|
|
1776
|
-
separateDialCode:
|
|
1777
|
-
showFlags:
|
|
1778
|
+
separateDialCode: i,
|
|
1779
|
+
showFlags: n,
|
|
1778
1780
|
containerClass: o,
|
|
1779
1781
|
hiddenInput: a,
|
|
1780
1782
|
dropdownContainer: c,
|
|
@@ -1784,14 +1786,14 @@ class U2 {
|
|
|
1784
1786
|
i18n: _
|
|
1785
1787
|
} = this.options;
|
|
1786
1788
|
let I = "iti";
|
|
1787
|
-
e && (I += " iti--allow-dropdown"),
|
|
1788
|
-
const
|
|
1789
|
-
if ((v = this.telInput.parentNode) == null || v.insertBefore(
|
|
1790
|
-
this.countryContainer =
|
|
1789
|
+
e && (I += " iti--allow-dropdown"), n && (I += " iti--show-flags"), o && (I += ` ${o}`), f || (I += " iti--inline-dropdown");
|
|
1790
|
+
const L = A("div", { class: I });
|
|
1791
|
+
if ((v = this.telInput.parentNode) == null || v.insertBefore(L, this.telInput), e || n || i) {
|
|
1792
|
+
this.countryContainer = A(
|
|
1791
1793
|
"div",
|
|
1792
1794
|
{ class: "iti__country-container" },
|
|
1793
|
-
|
|
1794
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry =
|
|
1795
|
+
L
|
|
1796
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = A(
|
|
1795
1797
|
"button",
|
|
1796
1798
|
{
|
|
1797
1799
|
type: "button",
|
|
@@ -1803,30 +1805,30 @@ class U2 {
|
|
|
1803
1805
|
role: "combobox"
|
|
1804
1806
|
},
|
|
1805
1807
|
this.countryContainer
|
|
1806
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
1808
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = A(
|
|
1807
1809
|
"div",
|
|
1808
1810
|
{ class: "iti__selected-country" },
|
|
1809
1811
|
this.countryContainer
|
|
1810
1812
|
);
|
|
1811
|
-
const
|
|
1812
|
-
if (this.selectedCountryInner =
|
|
1813
|
+
const T = A("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1814
|
+
if (this.selectedCountryInner = A("div", { class: "iti__flag" }, T), this.selectedCountryA11yText = A(
|
|
1813
1815
|
"span",
|
|
1814
1816
|
{ class: "iti__a11y-text" },
|
|
1815
1817
|
this.selectedCountryInner
|
|
1816
|
-
), e && (this.dropdownArrow =
|
|
1818
|
+
), e && (this.dropdownArrow = A(
|
|
1817
1819
|
"div",
|
|
1818
1820
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1819
|
-
|
|
1820
|
-
)),
|
|
1821
|
+
T
|
|
1822
|
+
)), i && (this.selectedDialCode = A(
|
|
1821
1823
|
"div",
|
|
1822
1824
|
{ class: "iti__selected-dial-code" },
|
|
1823
1825
|
this.selectedCountry
|
|
1824
1826
|
)), e) {
|
|
1825
1827
|
const M = g ? "" : "iti--flexible-dropdown-width";
|
|
1826
|
-
if (this.dropdownContent =
|
|
1828
|
+
if (this.dropdownContent = A("div", {
|
|
1827
1829
|
id: `iti-${this.id}__dropdown-content`,
|
|
1828
1830
|
class: `iti__dropdown-content iti__hide ${M}`
|
|
1829
|
-
}), b && (this.searchInput =
|
|
1831
|
+
}), b && (this.searchInput = A(
|
|
1830
1832
|
"input",
|
|
1831
1833
|
{
|
|
1832
1834
|
type: "text",
|
|
@@ -1840,11 +1842,11 @@ class U2 {
|
|
|
1840
1842
|
autocomplete: "off"
|
|
1841
1843
|
},
|
|
1842
1844
|
this.dropdownContent
|
|
1843
|
-
), this.searchResultsA11yText =
|
|
1845
|
+
), this.searchResultsA11yText = A(
|
|
1844
1846
|
"span",
|
|
1845
1847
|
{ class: "iti__a11y-text" },
|
|
1846
1848
|
this.dropdownContent
|
|
1847
|
-
)), this.countryList =
|
|
1849
|
+
)), this.countryList = A(
|
|
1848
1850
|
"ul",
|
|
1849
1851
|
{
|
|
1850
1852
|
class: "iti__country-list",
|
|
@@ -1855,48 +1857,48 @@ class U2 {
|
|
|
1855
1857
|
this.dropdownContent
|
|
1856
1858
|
), this._appendListItems(), b && this._updateSearchResultsText(), c) {
|
|
1857
1859
|
let O = "iti iti--container";
|
|
1858
|
-
f ? O += " iti--fullscreen-popup" : O += " iti--inline-dropdown", this.dropdown =
|
|
1860
|
+
f ? O += " iti--fullscreen-popup" : O += " iti--inline-dropdown", this.dropdown = A("div", { class: O }), this.dropdown.appendChild(this.dropdownContent);
|
|
1859
1861
|
} else
|
|
1860
1862
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1861
1863
|
}
|
|
1862
1864
|
}
|
|
1863
|
-
if (
|
|
1864
|
-
const
|
|
1865
|
-
M.phone && (this.hiddenInput =
|
|
1865
|
+
if (L.appendChild(this.telInput), this._updateInputPadding(), a) {
|
|
1866
|
+
const T = this.telInput.getAttribute("name") || "", M = a(T);
|
|
1867
|
+
M.phone && (this.hiddenInput = A("input", {
|
|
1866
1868
|
type: "hidden",
|
|
1867
1869
|
name: M.phone
|
|
1868
|
-
}),
|
|
1870
|
+
}), L.appendChild(this.hiddenInput)), M.country && (this.hiddenInputCountry = A("input", {
|
|
1869
1871
|
type: "hidden",
|
|
1870
1872
|
name: M.country
|
|
1871
|
-
}),
|
|
1873
|
+
}), L.appendChild(this.hiddenInputCountry));
|
|
1872
1874
|
}
|
|
1873
1875
|
}
|
|
1874
1876
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1875
1877
|
_appendListItems() {
|
|
1876
1878
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1877
|
-
const
|
|
1879
|
+
const i = this.countries[e], n = e === 0 ? "iti__highlight" : "", o = A(
|
|
1878
1880
|
"li",
|
|
1879
1881
|
{
|
|
1880
|
-
id: `iti-${this.id}__item-${
|
|
1881
|
-
class: `iti__country ${
|
|
1882
|
+
id: `iti-${this.id}__item-${i.iso2}`,
|
|
1883
|
+
class: `iti__country ${n}`,
|
|
1882
1884
|
tabindex: "-1",
|
|
1883
1885
|
role: "option",
|
|
1884
|
-
"data-dial-code":
|
|
1885
|
-
"data-country-code":
|
|
1886
|
+
"data-dial-code": i.dialCode,
|
|
1887
|
+
"data-country-code": i.iso2,
|
|
1886
1888
|
"aria-selected": "false"
|
|
1887
1889
|
},
|
|
1888
1890
|
this.countryList
|
|
1889
1891
|
);
|
|
1890
|
-
|
|
1892
|
+
i.nodeById[this.id] = o;
|
|
1891
1893
|
let a = "";
|
|
1892
|
-
this.options.showFlags && (a += `<div class='iti__flag iti__${
|
|
1894
|
+
this.options.showFlags && (a += `<div class='iti__flag iti__${i.iso2}'></div>`), a += `<span class='iti__country-name'>${i.name}</span>`, a += `<span class='iti__dial-code'>+${i.dialCode}</span>`, o.insertAdjacentHTML("beforeend", a);
|
|
1893
1895
|
}
|
|
1894
1896
|
}
|
|
1895
1897
|
//* Set the initial state of the input value and the selected country by:
|
|
1896
1898
|
//* 1. Extracting a dial code from the given number
|
|
1897
1899
|
//* 2. Using explicit initialCountry
|
|
1898
1900
|
_setInitialState(e = !1) {
|
|
1899
|
-
const
|
|
1901
|
+
const i = this.telInput.getAttribute("value"), n = this.telInput.value, a = i && i.charAt(0) === "+" && (!n || n.charAt(0) !== "+") ? i : n, c = this._getDialCode(a), g = s2(a), { initialCountry: f, geoIpLookup: b } = this.options, _ = f === "auto" && b;
|
|
1900
1902
|
if (c && !g)
|
|
1901
1903
|
this._updateCountryFromNumber(a);
|
|
1902
1904
|
else if (!_ || e) {
|
|
@@ -1921,14 +1923,14 @@ class U2 {
|
|
|
1921
1923
|
}
|
|
1922
1924
|
//* initialise the dropdown listeners.
|
|
1923
1925
|
_initDropdownListeners() {
|
|
1924
|
-
this._handleLabelClick = (
|
|
1925
|
-
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() :
|
|
1926
|
+
this._handleLabelClick = (i) => {
|
|
1927
|
+
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : i.preventDefault();
|
|
1926
1928
|
};
|
|
1927
1929
|
const e = this.telInput.closest("label");
|
|
1928
1930
|
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
1929
1931
|
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
1930
|
-
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (
|
|
1931
|
-
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(
|
|
1932
|
+
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (i) => {
|
|
1933
|
+
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), this._openDropdown()), i.key === "Tab" && this._closeDropdown();
|
|
1932
1934
|
}, this.countryContainer.addEventListener(
|
|
1933
1935
|
"keydown",
|
|
1934
1936
|
this._handleCountryContainerKeydown
|
|
@@ -1936,17 +1938,19 @@ class U2 {
|
|
|
1936
1938
|
}
|
|
1937
1939
|
//* Init many requests: utils script / geo ip lookup.
|
|
1938
1940
|
_initRequests() {
|
|
1939
|
-
|
|
1940
|
-
e &&
|
|
1941
|
-
|
|
1942
|
-
|
|
1941
|
+
let { loadUtilsOnInit: e, utilsScript: i, initialCountry: n, geoIpLookup: o } = this.options;
|
|
1942
|
+
!e && i && (console.warn("intl-tel-input: The `utilsScript` option is deprecated and will be removed in a future release! Please use the `loadUtilsOnInit` option instead."), e = i), e && !m.utils ? (this._handlePageLoad = () => {
|
|
1943
|
+
var c;
|
|
1944
|
+
window.removeEventListener("load", this._handlePageLoad), (c = m.loadUtils(e)) == null || c.catch(() => {
|
|
1945
|
+
});
|
|
1946
|
+
}, m.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), n === "auto" && o && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1943
1947
|
}
|
|
1944
1948
|
//* Perform the geo ip lookup.
|
|
1945
1949
|
_loadAutoCountry() {
|
|
1946
|
-
|
|
1950
|
+
m.autoCountry ? this.handleAutoCountry() : m.startedLoadingAutoCountry || (m.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1947
1951
|
(e = "") => {
|
|
1948
|
-
const
|
|
1949
|
-
|
|
1952
|
+
const i = e.toLowerCase();
|
|
1953
|
+
i && this._getCountryData(i, !0) ? (m.autoCountry = i, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
|
|
1950
1954
|
},
|
|
1951
1955
|
() => {
|
|
1952
1956
|
this._setInitialState(!0), $1("rejectAutoCountryPromise");
|
|
@@ -1958,68 +1962,68 @@ class U2 {
|
|
|
1958
1962
|
}
|
|
1959
1963
|
//* Initialize the tel input listeners.
|
|
1960
1964
|
_initTelInputListeners() {
|
|
1961
|
-
const { strictMode: e, formatAsYouType:
|
|
1965
|
+
const { strictMode: e, formatAsYouType: i, separateDialCode: n, formatOnDisplay: o, allowDropdown: a, countrySearch: c } = this.options;
|
|
1962
1966
|
let g = !1;
|
|
1963
1967
|
new RegExp("\\p{L}", "u").test(this.telInput.value) && (g = !0), this._handleInputEvent = (f) => {
|
|
1964
|
-
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" &&
|
|
1965
|
-
const
|
|
1966
|
-
this.telInput.value = v +
|
|
1968
|
+
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" && n && a && c) {
|
|
1969
|
+
const L = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, L - 1), T = this.telInput.value.substring(L);
|
|
1970
|
+
this.telInput.value = v + T, this._openDropdownWithPlus();
|
|
1967
1971
|
return;
|
|
1968
1972
|
}
|
|
1969
1973
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1970
1974
|
const b = (f == null ? void 0 : f.data) && /[^+0-9]/.test(f.data), _ = (f == null ? void 0 : f.inputType) === "insertFromPaste" && this.telInput.value;
|
|
1971
1975
|
b || _ && !e ? g = !0 : /[^+0-9]/.test(this.telInput.value) || (g = !1);
|
|
1972
1976
|
const I = (f == null ? void 0 : f.detail) && f.detail.isSetNumber && !o;
|
|
1973
|
-
if (
|
|
1974
|
-
const
|
|
1977
|
+
if (i && !g && !I) {
|
|
1978
|
+
const L = this.telInput.selectionStart || 0, T = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, M = (f == null ? void 0 : f.inputType) === "deleteContentForward", O = this._formatNumberAsYouType(), Z = U2(T, O, L, M);
|
|
1975
1979
|
this.telInput.value = O, this.telInput.setSelectionRange(Z, Z);
|
|
1976
1980
|
}
|
|
1977
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (e ||
|
|
1981
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (e || n) && (this._handleKeydownEvent = (f) => {
|
|
1978
1982
|
if (f.key && f.key.length === 1 && !f.altKey && !f.ctrlKey && !f.metaKey) {
|
|
1979
|
-
if (
|
|
1983
|
+
if (n && a && c && f.key === "+") {
|
|
1980
1984
|
f.preventDefault(), this._openDropdownWithPlus();
|
|
1981
1985
|
return;
|
|
1982
1986
|
}
|
|
1983
1987
|
if (e) {
|
|
1984
|
-
const b = this.telInput.value, _ = b.charAt(0) === "+", I = !_ && this.telInput.selectionStart === 0 && f.key === "+",
|
|
1985
|
-
let
|
|
1988
|
+
const b = this.telInput.value, _ = b.charAt(0) === "+", I = !_ && this.telInput.selectionStart === 0 && f.key === "+", L = /^[0-9]$/.test(f.key), v = n ? L : I || L, T = b.slice(0, this.telInput.selectionStart) + f.key + b.slice(this.telInput.selectionEnd), M = this._getFullNumber(T), O = m.utils.getCoreNumber(M, this.selectedCountryData.iso2), Z = this.maxCoreNumberLength && O.length > this.maxCoreNumberLength;
|
|
1989
|
+
let i1 = !1;
|
|
1986
1990
|
if (_) {
|
|
1987
1991
|
const p1 = this.selectedCountryData.iso2;
|
|
1988
|
-
|
|
1992
|
+
i1 = this._getCountryFromNumber(M) !== p1;
|
|
1989
1993
|
}
|
|
1990
|
-
(!v || Z && !
|
|
1994
|
+
(!v || Z && !i1 && !I) && f.preventDefault();
|
|
1991
1995
|
}
|
|
1992
1996
|
}
|
|
1993
1997
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
1994
1998
|
}
|
|
1995
1999
|
//* Adhere to the input's maxlength attr.
|
|
1996
2000
|
_cap(e) {
|
|
1997
|
-
const
|
|
1998
|
-
return
|
|
2001
|
+
const i = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
2002
|
+
return i && e.length > i ? e.substr(0, i) : e;
|
|
1999
2003
|
}
|
|
2000
2004
|
//* Trigger a custom event on the input.
|
|
2001
|
-
_trigger(e,
|
|
2002
|
-
const
|
|
2005
|
+
_trigger(e, i = {}) {
|
|
2006
|
+
const n = new CustomEvent(e, {
|
|
2003
2007
|
bubbles: !0,
|
|
2004
2008
|
cancelable: !0,
|
|
2005
|
-
detail:
|
|
2009
|
+
detail: i
|
|
2006
2010
|
});
|
|
2007
|
-
this.telInput.dispatchEvent(
|
|
2011
|
+
this.telInput.dispatchEvent(n);
|
|
2008
2012
|
}
|
|
2009
2013
|
//* Open the dropdown.
|
|
2010
2014
|
_openDropdown() {
|
|
2011
|
-
const { fixDropdownWidth: e, countrySearch:
|
|
2012
|
-
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(),
|
|
2013
|
-
const
|
|
2014
|
-
|
|
2015
|
+
const { fixDropdownWidth: e, countrySearch: i } = this.options;
|
|
2016
|
+
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), i) {
|
|
2017
|
+
const n = this.countryList.firstElementChild;
|
|
2018
|
+
n && (this._highlightListItem(n, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
|
|
2015
2019
|
}
|
|
2016
2020
|
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2017
2021
|
}
|
|
2018
2022
|
//* Set the dropdown position
|
|
2019
2023
|
_setDropdownPosition() {
|
|
2020
2024
|
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2021
|
-
const e = this.telInput.getBoundingClientRect(),
|
|
2022
|
-
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top +
|
|
2025
|
+
const e = this.telInput.getBoundingClientRect(), i = this.telInput.offsetHeight;
|
|
2026
|
+
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + i}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
|
|
2023
2027
|
}
|
|
2024
2028
|
}
|
|
2025
2029
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
@@ -2043,10 +2047,10 @@ class U2 {
|
|
|
2043
2047
|
"click",
|
|
2044
2048
|
this._handleClickOffToClose
|
|
2045
2049
|
);
|
|
2046
|
-
let
|
|
2050
|
+
let i = "", n = null;
|
|
2047
2051
|
if (this._handleKeydownOnDropdown = (o) => {
|
|
2048
|
-
["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(),
|
|
2049
|
-
|
|
2052
|
+
["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(), n && clearTimeout(n), i += o.key.toLowerCase(), this._searchForCountry(i), n = setTimeout(() => {
|
|
2053
|
+
i = "";
|
|
2050
2054
|
}, 1e3));
|
|
2051
2055
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
2052
2056
|
const o = () => {
|
|
@@ -2063,40 +2067,40 @@ class U2 {
|
|
|
2063
2067
|
}
|
|
2064
2068
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2065
2069
|
_searchForCountry(e) {
|
|
2066
|
-
for (let
|
|
2067
|
-
const
|
|
2068
|
-
if (
|
|
2069
|
-
const a =
|
|
2070
|
+
for (let i = 0; i < this.countries.length; i++) {
|
|
2071
|
+
const n = this.countries[i];
|
|
2072
|
+
if (n.name.substr(0, e.length).toLowerCase() === e) {
|
|
2073
|
+
const a = n.nodeById[this.id];
|
|
2070
2074
|
this._highlightListItem(a, !1), this._scrollTo(a);
|
|
2071
2075
|
break;
|
|
2072
2076
|
}
|
|
2073
2077
|
}
|
|
2074
2078
|
}
|
|
2075
2079
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2076
|
-
_filterCountries(e,
|
|
2077
|
-
let
|
|
2080
|
+
_filterCountries(e, i = !1) {
|
|
2081
|
+
let n = !0;
|
|
2078
2082
|
this.countryList.innerHTML = "";
|
|
2079
2083
|
const o = r2(e);
|
|
2080
2084
|
for (let a = 0; a < this.countries.length; a++) {
|
|
2081
2085
|
const c = this.countries[a], g = r2(c.name), f = c.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((_) => _[0]).join("").toLowerCase(), b = `+${c.dialCode}`;
|
|
2082
|
-
if (
|
|
2086
|
+
if (i || g.includes(o) || b.includes(o) || c.iso2.includes(o) || f.includes(o)) {
|
|
2083
2087
|
const _ = c.nodeById[this.id];
|
|
2084
|
-
_ && this.countryList.appendChild(_),
|
|
2088
|
+
_ && this.countryList.appendChild(_), n && (this._highlightListItem(_, !1), n = !1);
|
|
2085
2089
|
}
|
|
2086
2090
|
}
|
|
2087
|
-
|
|
2091
|
+
n && this._highlightListItem(null, !1), this.countryList.scrollTop = 0, this._updateSearchResultsText();
|
|
2088
2092
|
}
|
|
2089
2093
|
//* Update search results text (for a11y).
|
|
2090
2094
|
_updateSearchResultsText() {
|
|
2091
|
-
const { i18n: e } = this.options,
|
|
2092
|
-
let
|
|
2093
|
-
|
|
2095
|
+
const { i18n: e } = this.options, i = this.countryList.childElementCount;
|
|
2096
|
+
let n;
|
|
2097
|
+
i === 0 ? n = e.zeroSearchResults : i === 1 ? n = e.oneSearchResult : n = e.multipleSearchResults.replace("${count}", i.toString()), this.searchResultsA11yText.textContent = n;
|
|
2094
2098
|
}
|
|
2095
2099
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2096
2100
|
_handleUpDownKey(e) {
|
|
2097
|
-
var
|
|
2098
|
-
let
|
|
2099
|
-
!
|
|
2101
|
+
var n, o;
|
|
2102
|
+
let i = e === "ArrowUp" ? (n = this.highlightedItem) == null ? void 0 : n.previousElementSibling : (o = this.highlightedItem) == null ? void 0 : o.nextElementSibling;
|
|
2103
|
+
!i && this.countryList.childElementCount > 1 && (i = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), i && (this._scrollTo(i), this._highlightListItem(i, !1));
|
|
2100
2104
|
}
|
|
2101
2105
|
//* Select the currently highlighted item.
|
|
2102
2106
|
_handleEnterKey() {
|
|
@@ -2105,29 +2109,29 @@ class U2 {
|
|
|
2105
2109
|
//* Update the input's value to the given val (format first if possible)
|
|
2106
2110
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2107
2111
|
_updateValFromNumber(e) {
|
|
2108
|
-
let
|
|
2109
|
-
if (this.options.formatOnDisplay &&
|
|
2110
|
-
const
|
|
2111
|
-
|
|
2112
|
-
|
|
2112
|
+
let i = e;
|
|
2113
|
+
if (this.options.formatOnDisplay && m.utils && this.selectedCountryData) {
|
|
2114
|
+
const n = this.options.nationalMode || i.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: o, INTERNATIONAL: a } = m.utils.numberFormat, c = n ? o : a;
|
|
2115
|
+
i = m.utils.formatNumber(
|
|
2116
|
+
i,
|
|
2113
2117
|
this.selectedCountryData.iso2,
|
|
2114
2118
|
c
|
|
2115
2119
|
);
|
|
2116
2120
|
}
|
|
2117
|
-
|
|
2121
|
+
i = this._beforeSetNumber(i), this.telInput.value = i;
|
|
2118
2122
|
}
|
|
2119
2123
|
//* Check if need to select a new country based on the given number
|
|
2120
2124
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2121
2125
|
_updateCountryFromNumber(e) {
|
|
2122
|
-
const
|
|
2123
|
-
return
|
|
2126
|
+
const i = this._getCountryFromNumber(e);
|
|
2127
|
+
return i !== null ? this._setCountry(i) : !1;
|
|
2124
2128
|
}
|
|
2125
2129
|
_getCountryFromNumber(e) {
|
|
2126
|
-
const
|
|
2127
|
-
let
|
|
2130
|
+
const i = e.indexOf("+");
|
|
2131
|
+
let n = i ? e.substring(i) : e;
|
|
2128
2132
|
const o = this.selectedCountryData.dialCode;
|
|
2129
|
-
|
|
2130
|
-
const c = this._getDialCode(
|
|
2133
|
+
n && o === "1" && n.charAt(0) !== "+" && (n.charAt(0) !== "1" && (n = `1${n}`), n = `+${n}`), this.options.separateDialCode && o && n.charAt(0) !== "+" && (n = `+${o}${n}`);
|
|
2134
|
+
const c = this._getDialCode(n, !0), g = f1(n);
|
|
2131
2135
|
if (c) {
|
|
2132
2136
|
const f = this.dialCodeToIso2Map[f1(c)], b = f.indexOf(this.selectedCountryData.iso2) !== -1 && g.length <= c.length - 1;
|
|
2133
2137
|
if (!(o === "1" && s2(g)) && !b) {
|
|
@@ -2136,42 +2140,42 @@ class U2 {
|
|
|
2136
2140
|
return f[I];
|
|
2137
2141
|
}
|
|
2138
2142
|
} else {
|
|
2139
|
-
if (
|
|
2143
|
+
if (n.charAt(0) === "+" && g.length)
|
|
2140
2144
|
return "";
|
|
2141
|
-
if ((!
|
|
2145
|
+
if ((!n || n === "+") && !this.selectedCountryData.iso2)
|
|
2142
2146
|
return this.defaultCountry;
|
|
2143
2147
|
}
|
|
2144
2148
|
return null;
|
|
2145
2149
|
}
|
|
2146
2150
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2147
|
-
_highlightListItem(e,
|
|
2148
|
-
const
|
|
2149
|
-
if (
|
|
2151
|
+
_highlightListItem(e, i) {
|
|
2152
|
+
const n = this.highlightedItem;
|
|
2153
|
+
if (n && (n.classList.remove("iti__highlight"), n.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem) {
|
|
2150
2154
|
this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true");
|
|
2151
2155
|
const o = this.highlightedItem.getAttribute("id") || "";
|
|
2152
2156
|
this.selectedCountry.setAttribute("aria-activedescendant", o), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", o);
|
|
2153
2157
|
}
|
|
2154
|
-
|
|
2158
|
+
i && this.highlightedItem.focus();
|
|
2155
2159
|
}
|
|
2156
2160
|
//* Find the country data for the given iso2 code
|
|
2157
2161
|
//* the ignoreOnlyCountriesOption is only used during init() while parsing the onlyCountries array
|
|
2158
|
-
_getCountryData(e,
|
|
2159
|
-
for (let
|
|
2160
|
-
if (this.countries[
|
|
2161
|
-
return this.countries[
|
|
2162
|
-
if (
|
|
2162
|
+
_getCountryData(e, i) {
|
|
2163
|
+
for (let n = 0; n < this.countries.length; n++)
|
|
2164
|
+
if (this.countries[n].iso2 === e)
|
|
2165
|
+
return this.countries[n];
|
|
2166
|
+
if (i)
|
|
2163
2167
|
return null;
|
|
2164
2168
|
throw new Error(`No country data for '${e}'`);
|
|
2165
2169
|
}
|
|
2166
2170
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2167
2171
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2168
2172
|
_setCountry(e) {
|
|
2169
|
-
const { separateDialCode:
|
|
2173
|
+
const { separateDialCode: i, showFlags: n, i18n: o } = this.options, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2170
2174
|
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2171
2175
|
let c = "", g = "";
|
|
2172
|
-
e &&
|
|
2176
|
+
e && n ? (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;
|
|
2173
2177
|
}
|
|
2174
|
-
if (this._setSelectedCountryTitleAttribute(e,
|
|
2178
|
+
if (this._setSelectedCountryTitleAttribute(e, i), i) {
|
|
2175
2179
|
const c = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2176
2180
|
this.selectedDialCode.innerHTML = c, this._updateInputPadding();
|
|
2177
2181
|
}
|
|
@@ -2180,34 +2184,34 @@ class U2 {
|
|
|
2180
2184
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2181
2185
|
_updateInputPadding() {
|
|
2182
2186
|
if (this.selectedCountry) {
|
|
2183
|
-
const
|
|
2184
|
-
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${
|
|
2187
|
+
const i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
|
|
2188
|
+
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${i}px` : this.telInput.style.paddingRight = `${i}px`;
|
|
2185
2189
|
}
|
|
2186
2190
|
}
|
|
2187
2191
|
//* Update the maximum valid number length for the currently selected country.
|
|
2188
2192
|
_updateMaxLength() {
|
|
2189
|
-
const { strictMode: e, placeholderNumberType:
|
|
2190
|
-
if (e &&
|
|
2193
|
+
const { strictMode: e, placeholderNumberType: i, validationNumberType: n } = this.options, { iso2: o } = this.selectedCountryData;
|
|
2194
|
+
if (e && m.utils)
|
|
2191
2195
|
if (o) {
|
|
2192
|
-
const a =
|
|
2193
|
-
let c =
|
|
2196
|
+
const a = m.utils.numberType[i];
|
|
2197
|
+
let c = m.utils.getExampleNumber(
|
|
2194
2198
|
o,
|
|
2195
2199
|
!1,
|
|
2196
2200
|
a,
|
|
2197
2201
|
!0
|
|
2198
2202
|
), g = c;
|
|
2199
|
-
for (;
|
|
2203
|
+
for (; m.utils.isPossibleNumber(c, o, n); )
|
|
2200
2204
|
g = c, c += "0";
|
|
2201
|
-
const f =
|
|
2205
|
+
const f = m.utils.getCoreNumber(g, o);
|
|
2202
2206
|
this.maxCoreNumberLength = f.length, o === "by" && (this.maxCoreNumberLength = f.length + 1);
|
|
2203
2207
|
} else
|
|
2204
2208
|
this.maxCoreNumberLength = null;
|
|
2205
2209
|
}
|
|
2206
|
-
_setSelectedCountryTitleAttribute(e = null,
|
|
2210
|
+
_setSelectedCountryTitleAttribute(e = null, i) {
|
|
2207
2211
|
if (!this.selectedCountry)
|
|
2208
2212
|
return;
|
|
2209
|
-
let
|
|
2210
|
-
e && !
|
|
2213
|
+
let n;
|
|
2214
|
+
e && !i ? n = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? n = this.selectedCountryData.name : n = "Unknown", this.selectedCountry.setAttribute("title", n);
|
|
2211
2215
|
}
|
|
2212
2216
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2213
2217
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
@@ -2217,11 +2221,11 @@ class U2 {
|
|
|
2217
2221
|
if (this.telInput.parentNode) {
|
|
2218
2222
|
const e = this.telInput.parentNode.cloneNode(!1);
|
|
2219
2223
|
e.style.visibility = "hidden", document.body.appendChild(e);
|
|
2220
|
-
const
|
|
2221
|
-
e.appendChild(
|
|
2222
|
-
const
|
|
2223
|
-
|
|
2224
|
-
const o =
|
|
2224
|
+
const i = this.countryContainer.cloneNode();
|
|
2225
|
+
e.appendChild(i);
|
|
2226
|
+
const n = this.selectedCountry.cloneNode(!0);
|
|
2227
|
+
i.appendChild(n);
|
|
2228
|
+
const o = n.offsetWidth;
|
|
2225
2229
|
return document.body.removeChild(e), o;
|
|
2226
2230
|
}
|
|
2227
2231
|
return 0;
|
|
@@ -2230,15 +2234,15 @@ class U2 {
|
|
|
2230
2234
|
_updatePlaceholder() {
|
|
2231
2235
|
const {
|
|
2232
2236
|
autoPlaceholder: e,
|
|
2233
|
-
placeholderNumberType:
|
|
2234
|
-
nationalMode:
|
|
2237
|
+
placeholderNumberType: i,
|
|
2238
|
+
nationalMode: n,
|
|
2235
2239
|
customPlaceholder: o
|
|
2236
2240
|
} = this.options, a = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
2237
|
-
if (
|
|
2238
|
-
const c =
|
|
2239
|
-
let g = this.selectedCountryData.iso2 ?
|
|
2241
|
+
if (m.utils && a) {
|
|
2242
|
+
const c = m.utils.numberType[i];
|
|
2243
|
+
let g = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
|
|
2240
2244
|
this.selectedCountryData.iso2,
|
|
2241
|
-
|
|
2245
|
+
n,
|
|
2242
2246
|
c
|
|
2243
2247
|
) : "";
|
|
2244
2248
|
g = this._beforeSetNumber(g), typeof o == "function" && (g = o(g, this.selectedCountryData)), this.telInput.setAttribute("placeholder", g);
|
|
@@ -2246,10 +2250,10 @@ class U2 {
|
|
|
2246
2250
|
}
|
|
2247
2251
|
//* Called when the user selects a list item from the dropdown.
|
|
2248
2252
|
_selectListItem(e) {
|
|
2249
|
-
const
|
|
2253
|
+
const i = this._setCountry(
|
|
2250
2254
|
e.getAttribute("data-country-code")
|
|
2251
2255
|
);
|
|
2252
|
-
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(),
|
|
2256
|
+
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), i && this._triggerCountryChange();
|
|
2253
2257
|
}
|
|
2254
2258
|
//* Close the dropdown and unbind any listeners.
|
|
2255
2259
|
_closeDropdown() {
|
|
@@ -2259,41 +2263,41 @@ class U2 {
|
|
|
2259
2263
|
), this.countryList.removeEventListener(
|
|
2260
2264
|
"mouseover",
|
|
2261
2265
|
this._handleMouseoverCountryList
|
|
2262
|
-
), 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._trigger("close:countrydropdown");
|
|
2266
|
+
), 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");
|
|
2263
2267
|
}
|
|
2264
2268
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2265
2269
|
_scrollTo(e) {
|
|
2266
|
-
const
|
|
2270
|
+
const i = this.countryList, n = document.documentElement.scrollTop, o = i.offsetHeight, a = i.getBoundingClientRect().top + n, c = a + o, g = e.offsetHeight, f = e.getBoundingClientRect().top + n, b = f + g, _ = f - a + i.scrollTop;
|
|
2267
2271
|
if (f < a)
|
|
2268
|
-
|
|
2272
|
+
i.scrollTop = _;
|
|
2269
2273
|
else if (b > c) {
|
|
2270
2274
|
const I = o - g;
|
|
2271
|
-
|
|
2275
|
+
i.scrollTop = _ - I;
|
|
2272
2276
|
}
|
|
2273
2277
|
}
|
|
2274
2278
|
//* Replace any existing dial code with the new one
|
|
2275
2279
|
//* Note: called from _selectListItem and setCountry
|
|
2276
2280
|
_updateDialCode(e) {
|
|
2277
|
-
const
|
|
2281
|
+
const i = this.telInput.value, n = `+${e}`;
|
|
2278
2282
|
let o;
|
|
2279
|
-
if (
|
|
2280
|
-
const a = this._getDialCode(
|
|
2281
|
-
a ? o =
|
|
2283
|
+
if (i.charAt(0) === "+") {
|
|
2284
|
+
const a = this._getDialCode(i);
|
|
2285
|
+
a ? o = i.replace(a, n) : o = n, this.telInput.value = o;
|
|
2282
2286
|
}
|
|
2283
2287
|
}
|
|
2284
2288
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2285
2289
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2286
|
-
_getDialCode(e,
|
|
2287
|
-
let
|
|
2290
|
+
_getDialCode(e, i) {
|
|
2291
|
+
let n = "";
|
|
2288
2292
|
if (e.charAt(0) === "+") {
|
|
2289
2293
|
let o = "";
|
|
2290
2294
|
for (let a = 0; a < e.length; a++) {
|
|
2291
2295
|
const c = e.charAt(a);
|
|
2292
2296
|
if (!isNaN(parseInt(c, 10))) {
|
|
2293
|
-
if (o += c,
|
|
2294
|
-
this.dialCodeToIso2Map[o] && (
|
|
2297
|
+
if (o += c, i)
|
|
2298
|
+
this.dialCodeToIso2Map[o] && (n = e.substr(0, a + 1));
|
|
2295
2299
|
else if (this.dialCodes[o]) {
|
|
2296
|
-
|
|
2300
|
+
n = e.substr(0, a + 1);
|
|
2297
2301
|
break;
|
|
2298
2302
|
}
|
|
2299
2303
|
if (o.length === this.dialCodeMaxLen)
|
|
@@ -2301,27 +2305,27 @@ class U2 {
|
|
|
2301
2305
|
}
|
|
2302
2306
|
}
|
|
2303
2307
|
}
|
|
2304
|
-
return
|
|
2308
|
+
return n;
|
|
2305
2309
|
}
|
|
2306
2310
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2307
2311
|
_getFullNumber(e) {
|
|
2308
|
-
const
|
|
2312
|
+
const i = e || this.telInput.value.trim(), { dialCode: n } = this.selectedCountryData;
|
|
2309
2313
|
let o;
|
|
2310
|
-
const a = f1(
|
|
2311
|
-
return this.options.separateDialCode &&
|
|
2314
|
+
const a = f1(i);
|
|
2315
|
+
return this.options.separateDialCode && i.charAt(0) !== "+" && n && a ? o = `+${n}` : o = "", o + i;
|
|
2312
2316
|
}
|
|
2313
2317
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2314
2318
|
_beforeSetNumber(e) {
|
|
2315
|
-
let
|
|
2319
|
+
let i = e;
|
|
2316
2320
|
if (this.options.separateDialCode) {
|
|
2317
|
-
let
|
|
2318
|
-
if (
|
|
2319
|
-
|
|
2320
|
-
const o = n
|
|
2321
|
-
|
|
2321
|
+
let n = this._getDialCode(i);
|
|
2322
|
+
if (n) {
|
|
2323
|
+
n = `+${this.selectedCountryData.dialCode}`;
|
|
2324
|
+
const o = i[n.length] === " " || i[n.length] === "-" ? n.length + 1 : n.length;
|
|
2325
|
+
i = i.substr(o);
|
|
2322
2326
|
}
|
|
2323
2327
|
}
|
|
2324
|
-
return this._cap(
|
|
2328
|
+
return this._cap(i);
|
|
2325
2329
|
}
|
|
2326
2330
|
//* Trigger the 'countrychange' event.
|
|
2327
2331
|
_triggerCountryChange() {
|
|
@@ -2329,19 +2333,19 @@ class U2 {
|
|
|
2329
2333
|
}
|
|
2330
2334
|
//* Format the number as the user types.
|
|
2331
2335
|
_formatNumberAsYouType() {
|
|
2332
|
-
const e = this._getFullNumber(),
|
|
2333
|
-
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" &&
|
|
2336
|
+
const e = this._getFullNumber(), i = m.utils ? m.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: n } = this.selectedCountryData;
|
|
2337
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${n}`) ? (i.split(`+${n}`)[1] || "").trim() : i;
|
|
2334
2338
|
}
|
|
2335
2339
|
//**************************
|
|
2336
2340
|
//* SECRET PUBLIC METHODS
|
|
2337
2341
|
//**************************
|
|
2338
2342
|
//* This is called when the geoip call returns.
|
|
2339
2343
|
handleAutoCountry() {
|
|
2340
|
-
this.options.initialCountry === "auto" &&
|
|
2344
|
+
this.options.initialCountry === "auto" && m.autoCountry && (this.defaultCountry = m.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2341
2345
|
}
|
|
2342
2346
|
//* This is called when the utils request completes.
|
|
2343
2347
|
handleUtils() {
|
|
2344
|
-
|
|
2348
|
+
m.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2345
2349
|
}
|
|
2346
2350
|
//********************
|
|
2347
2351
|
//* PUBLIC METHODS
|
|
@@ -2349,7 +2353,7 @@ class U2 {
|
|
|
2349
2353
|
//* Remove plugin.
|
|
2350
2354
|
destroy() {
|
|
2351
2355
|
var a, c;
|
|
2352
|
-
const { allowDropdown: e, separateDialCode:
|
|
2356
|
+
const { allowDropdown: e, separateDialCode: i } = this.options;
|
|
2353
2357
|
if (e) {
|
|
2354
2358
|
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2355
2359
|
"click",
|
|
@@ -2361,25 +2365,25 @@ class U2 {
|
|
|
2361
2365
|
const g = this.telInput.closest("label");
|
|
2362
2366
|
g && g.removeEventListener("click", this._handleLabelClick);
|
|
2363
2367
|
}
|
|
2364
|
-
const { form:
|
|
2365
|
-
this._handleHiddenInputSubmit &&
|
|
2368
|
+
const { form: n } = this.telInput;
|
|
2369
|
+
this._handleHiddenInputSubmit && n && n.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"), i && (this.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2366
2370
|
const o = this.telInput.parentNode;
|
|
2367
|
-
(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
|
|
2371
|
+
(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 m.instances[this.id];
|
|
2368
2372
|
}
|
|
2369
2373
|
//* Get the extension from the current number.
|
|
2370
2374
|
getExtension() {
|
|
2371
|
-
return
|
|
2375
|
+
return m.utils ? m.utils.getExtension(
|
|
2372
2376
|
this._getFullNumber(),
|
|
2373
2377
|
this.selectedCountryData.iso2
|
|
2374
2378
|
) : "";
|
|
2375
2379
|
}
|
|
2376
2380
|
//* Format the number to the given format.
|
|
2377
2381
|
getNumber(e) {
|
|
2378
|
-
if (
|
|
2379
|
-
const { iso2:
|
|
2380
|
-
return
|
|
2382
|
+
if (m.utils) {
|
|
2383
|
+
const { iso2: i } = this.selectedCountryData;
|
|
2384
|
+
return m.utils.formatNumber(
|
|
2381
2385
|
this._getFullNumber(),
|
|
2382
|
-
|
|
2386
|
+
i,
|
|
2383
2387
|
e
|
|
2384
2388
|
);
|
|
2385
2389
|
}
|
|
@@ -2387,7 +2391,7 @@ class U2 {
|
|
|
2387
2391
|
}
|
|
2388
2392
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
2389
2393
|
getNumberType() {
|
|
2390
|
-
return
|
|
2394
|
+
return m.utils ? m.utils.getNumberType(
|
|
2391
2395
|
this._getFullNumber(),
|
|
2392
2396
|
this.selectedCountryData.iso2
|
|
2393
2397
|
) : -99;
|
|
@@ -2398,9 +2402,9 @@ class U2 {
|
|
|
2398
2402
|
}
|
|
2399
2403
|
//* Get the validation error.
|
|
2400
2404
|
getValidationError() {
|
|
2401
|
-
if (
|
|
2405
|
+
if (m.utils) {
|
|
2402
2406
|
const { iso2: e } = this.selectedCountryData;
|
|
2403
|
-
return
|
|
2407
|
+
return m.utils.getValidationError(this._getFullNumber(), e);
|
|
2404
2408
|
}
|
|
2405
2409
|
return -99;
|
|
2406
2410
|
}
|
|
@@ -2408,39 +2412,39 @@ class U2 {
|
|
|
2408
2412
|
isValidNumber() {
|
|
2409
2413
|
if (!this.selectedCountryData.iso2)
|
|
2410
2414
|
return !1;
|
|
2411
|
-
const e = this._getFullNumber(),
|
|
2412
|
-
if (
|
|
2413
|
-
const
|
|
2415
|
+
const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u"));
|
|
2416
|
+
if (i > -1) {
|
|
2417
|
+
const n = e.substring(0, i), o = this._utilsIsPossibleNumber(n), a = this._utilsIsPossibleNumber(e);
|
|
2414
2418
|
return o && a;
|
|
2415
2419
|
}
|
|
2416
2420
|
return this._utilsIsPossibleNumber(e);
|
|
2417
2421
|
}
|
|
2418
2422
|
_utilsIsPossibleNumber(e) {
|
|
2419
|
-
return
|
|
2423
|
+
return m.utils ? m.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberType) : null;
|
|
2420
2424
|
}
|
|
2421
2425
|
//* Validate the input val (precise)
|
|
2422
2426
|
isValidNumberPrecise() {
|
|
2423
2427
|
if (!this.selectedCountryData.iso2)
|
|
2424
2428
|
return !1;
|
|
2425
|
-
const e = this._getFullNumber(),
|
|
2426
|
-
if (
|
|
2427
|
-
const
|
|
2429
|
+
const e = this._getFullNumber(), i = e.search(new RegExp("\\p{L}", "u"));
|
|
2430
|
+
if (i > -1) {
|
|
2431
|
+
const n = e.substring(0, i), o = this._utilsIsValidNumber(n), a = this._utilsIsValidNumber(e);
|
|
2428
2432
|
return o && a;
|
|
2429
2433
|
}
|
|
2430
2434
|
return this._utilsIsValidNumber(e);
|
|
2431
2435
|
}
|
|
2432
2436
|
_utilsIsValidNumber(e) {
|
|
2433
|
-
return
|
|
2437
|
+
return m.utils ? m.utils.isValidNumber(e, this.selectedCountryData.iso2) : null;
|
|
2434
2438
|
}
|
|
2435
2439
|
//* Update the selected country, and update the input val accordingly.
|
|
2436
2440
|
setCountry(e) {
|
|
2437
|
-
const
|
|
2438
|
-
(e &&
|
|
2441
|
+
const i = e == null ? void 0 : e.toLowerCase(), n = this.selectedCountryData.iso2;
|
|
2442
|
+
(e && i !== n || !e && n) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2439
2443
|
}
|
|
2440
2444
|
//* Set the input value and update the country.
|
|
2441
2445
|
setNumber(e) {
|
|
2442
|
-
const
|
|
2443
|
-
this._updateValFromNumber(e),
|
|
2446
|
+
const i = this._updateCountryFromNumber(e);
|
|
2447
|
+
this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
|
|
2444
2448
|
}
|
|
2445
2449
|
//* Set the placeholder number typ
|
|
2446
2450
|
setPlaceholderNumberType(e) {
|
|
@@ -2450,20 +2454,34 @@ class U2 {
|
|
|
2450
2454
|
this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
2451
2455
|
}
|
|
2452
2456
|
}
|
|
2453
|
-
const V2 = (y) =>
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2457
|
+
const V2 = (y) => {
|
|
2458
|
+
if (!m.utils && !m.startedLoadingUtilsScript) {
|
|
2459
|
+
let e;
|
|
2460
|
+
if (typeof y == "string")
|
|
2461
|
+
e = Promise.reject(new Error("INTENTIONALLY BROKEN: this build of intl-tel-input includes the utilities module inline, but it has incorrectly attempted to load the utilities separately. If you are seeing this message, something is broken!"));
|
|
2462
|
+
else if (typeof y == "function")
|
|
2463
|
+
try {
|
|
2464
|
+
if (e = y(), !(e instanceof Promise))
|
|
2465
|
+
throw new TypeError(`The function passed to loadUtils must return a promise for the utilities module, not ${typeof e}`);
|
|
2466
|
+
} catch (i) {
|
|
2467
|
+
return Promise.reject(i);
|
|
2468
|
+
}
|
|
2469
|
+
else
|
|
2470
|
+
return Promise.reject(new TypeError(`The argument passed to loadUtils must be a URL string or a function that returns a promise for the utilities module, not ${typeof y}`));
|
|
2471
|
+
return m.startedLoadingUtilsScript = !0, e.then((i) => {
|
|
2472
|
+
const n = i == null ? void 0 : i.default;
|
|
2473
|
+
if (!n || typeof n != "object")
|
|
2474
|
+
throw typeof y == "string" ? new TypeError(`The module loaded from ${y} did not set utils as its default export.`) : new TypeError("The loader function passed to loadUtils did not resolve to a module object with utils as its default export.");
|
|
2475
|
+
return m.utils = n, $1("handleUtils"), !0;
|
|
2476
|
+
}).catch((i) => {
|
|
2477
|
+
throw $1("rejectUtilsScriptPromise", i), i;
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
return null;
|
|
2481
|
+
}, m = Object.assign(
|
|
2464
2482
|
(y, e) => {
|
|
2465
|
-
const
|
|
2466
|
-
return
|
|
2483
|
+
const i = new F2(y, e);
|
|
2484
|
+
return i._init(), y.setAttribute("data-intl-tel-input-id", i.id.toString()), m.instances[i.id] = i, i;
|
|
2467
2485
|
},
|
|
2468
2486
|
{
|
|
2469
2487
|
defaults: u2,
|
|
@@ -2474,12 +2492,14 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2474
2492
|
//* A getter for the plugin instance.
|
|
2475
2493
|
getInstance: (y) => {
|
|
2476
2494
|
const e = y.getAttribute("data-intl-tel-input-id");
|
|
2477
|
-
return e ?
|
|
2495
|
+
return e ? m.instances[e] : null;
|
|
2478
2496
|
},
|
|
2479
2497
|
//* A map from instance ID to instance object.
|
|
2480
2498
|
instances: {},
|
|
2481
2499
|
loadUtils: V2,
|
|
2482
|
-
|
|
2500
|
+
startedLoadingUtilsScript: !1,
|
|
2501
|
+
startedLoadingAutoCountry: !1,
|
|
2502
|
+
version: "24.6.0"
|
|
2483
2503
|
}
|
|
2484
2504
|
);
|
|
2485
2505
|
(function() {
|
|
@@ -2488,20 +2508,20 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2488
2508
|
d = d.split(".");
|
|
2489
2509
|
var $ = y;
|
|
2490
2510
|
d[0] in $ || typeof $.execScript > "u" || $.execScript("var " + d[0]);
|
|
2491
|
-
for (var
|
|
2511
|
+
for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ? $[r] && $[r] !== Object.prototype[r] ? $ = $[r] : $ = $[r] = {} : $[r] = t;
|
|
2492
2512
|
}
|
|
2493
|
-
function
|
|
2513
|
+
function i(d, t) {
|
|
2494
2514
|
function $() {
|
|
2495
2515
|
}
|
|
2496
|
-
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(
|
|
2516
|
+
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(r, s, u) {
|
|
2497
2517
|
for (var l = Array(arguments.length - 2), h = 2; h < arguments.length; h++) l[h - 2] = arguments[h];
|
|
2498
|
-
return t.prototype[s].apply(
|
|
2518
|
+
return t.prototype[s].apply(r, l);
|
|
2499
2519
|
};
|
|
2500
2520
|
}
|
|
2501
|
-
function
|
|
2521
|
+
function n(d) {
|
|
2502
2522
|
const t = [];
|
|
2503
2523
|
let $ = 0;
|
|
2504
|
-
for (const
|
|
2524
|
+
for (const r in d) t[$++] = d[r];
|
|
2505
2525
|
return t;
|
|
2506
2526
|
}
|
|
2507
2527
|
var o = class {
|
|
@@ -2546,20 +2566,20 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2546
2566
|
}
|
|
2547
2567
|
}
|
|
2548
2568
|
new I();
|
|
2549
|
-
function
|
|
2569
|
+
function L(d, t) {
|
|
2550
2570
|
switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
|
|
2551
2571
|
case M:
|
|
2552
2572
|
case O:
|
|
2553
2573
|
case Z:
|
|
2554
|
-
case
|
|
2574
|
+
case i1:
|
|
2555
2575
|
case p1:
|
|
2556
|
-
case
|
|
2576
|
+
case T:
|
|
2557
2577
|
case v:
|
|
2558
2578
|
this.o = !0;
|
|
2559
2579
|
}
|
|
2560
2580
|
this.j = t.defaultValue;
|
|
2561
2581
|
}
|
|
2562
|
-
var v = 1,
|
|
2582
|
+
var v = 1, T = 2, M = 3, O = 4, Z = 6, i1 = 16, p1 = 18;
|
|
2563
2583
|
function v1(d, t) {
|
|
2564
2584
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
2565
2585
|
var $ = t[d];
|
|
@@ -2567,52 +2587,52 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2567
2587
|
}
|
|
2568
2588
|
}
|
|
2569
2589
|
function l2(d) {
|
|
2570
|
-
return d =
|
|
2590
|
+
return d = n(d.g), d.sort(function(t, $) {
|
|
2571
2591
|
return t.g - $.g;
|
|
2572
2592
|
}), d;
|
|
2573
2593
|
}
|
|
2574
|
-
function
|
|
2594
|
+
function x() {
|
|
2575
2595
|
this.h = {}, this.j = this.m().g, this.g = this.l = null;
|
|
2576
2596
|
}
|
|
2577
|
-
|
|
2597
|
+
x.prototype.has = function(d) {
|
|
2578
2598
|
return R(this, d.g);
|
|
2579
|
-
},
|
|
2599
|
+
}, x.prototype.get = function(d, t) {
|
|
2580
2600
|
return p(this, d.g, t);
|
|
2581
|
-
},
|
|
2601
|
+
}, x.prototype.set = function(d, t) {
|
|
2582
2602
|
E(this, d.g, t);
|
|
2583
|
-
},
|
|
2603
|
+
}, x.prototype.add = function(d, t) {
|
|
2584
2604
|
w1(this, d.g, t);
|
|
2585
2605
|
};
|
|
2586
2606
|
function S1(d, t) {
|
|
2587
|
-
for (var $ = l2(d.m()),
|
|
2588
|
-
var s = $[
|
|
2607
|
+
for (var $ = l2(d.m()), r = 0; r < $.length; r++) {
|
|
2608
|
+
var s = $[r], u = s.g;
|
|
2589
2609
|
if (R(t, u)) {
|
|
2590
2610
|
d.g && delete d.g[s.g];
|
|
2591
2611
|
var l = s.h == 11 || s.h == 10;
|
|
2592
2612
|
if (s.l) {
|
|
2593
|
-
s =
|
|
2613
|
+
s = P(t, u);
|
|
2594
2614
|
for (var h = 0; h < s.length; h++) w1(d, u, l ? s[h].clone() : s[h]);
|
|
2595
|
-
} else s =
|
|
2615
|
+
} else s = n1(t, u), l ? (l = n1(d, u)) ? S1(l, s) : E(d, u, s.clone()) : E(d, u, s);
|
|
2596
2616
|
}
|
|
2597
2617
|
}
|
|
2598
2618
|
}
|
|
2599
|
-
|
|
2619
|
+
x.prototype.clone = function() {
|
|
2600
2620
|
var d = new this.constructor();
|
|
2601
2621
|
return d != this && (d.h = {}, d.g && (d.g = {}), S1(d, this)), d;
|
|
2602
2622
|
};
|
|
2603
2623
|
function R(d, t) {
|
|
2604
2624
|
return d.h[t] != null;
|
|
2605
2625
|
}
|
|
2606
|
-
function
|
|
2626
|
+
function n1(d, t) {
|
|
2607
2627
|
var $ = d.h[t];
|
|
2608
2628
|
if ($ == null) return null;
|
|
2609
2629
|
if (d.l) {
|
|
2610
2630
|
if (!(t in d.g)) {
|
|
2611
|
-
var
|
|
2631
|
+
var r = d.l, s = d.j[t];
|
|
2612
2632
|
if ($ != null) if (s.l) {
|
|
2613
|
-
for (var u = [], l = 0; l < $.length; l++) u[l] =
|
|
2633
|
+
for (var u = [], l = 0; l < $.length; l++) u[l] = r.h(s, $[l]);
|
|
2614
2634
|
$ = u;
|
|
2615
|
-
} else $ =
|
|
2635
|
+
} else $ = r.h(s, $);
|
|
2616
2636
|
return d.g[t] = $;
|
|
2617
2637
|
}
|
|
2618
2638
|
return d.g[t];
|
|
@@ -2620,8 +2640,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2620
2640
|
return $;
|
|
2621
2641
|
}
|
|
2622
2642
|
function p(d, t, $) {
|
|
2623
|
-
var
|
|
2624
|
-
return d.j[t].l ?
|
|
2643
|
+
var r = n1(d, t);
|
|
2644
|
+
return d.j[t].l ? r[$ || 0] : r;
|
|
2625
2645
|
}
|
|
2626
2646
|
function S(d, t) {
|
|
2627
2647
|
if (R(d, t)) d = p(d, t);
|
|
@@ -2637,10 +2657,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2637
2657
|
}
|
|
2638
2658
|
return d;
|
|
2639
2659
|
}
|
|
2640
|
-
function
|
|
2641
|
-
return
|
|
2660
|
+
function P(d, t) {
|
|
2661
|
+
return n1(d, t) || [];
|
|
2642
2662
|
}
|
|
2643
|
-
function
|
|
2663
|
+
function F(d, t) {
|
|
2644
2664
|
return d.j[t].l ? R(d, t) ? d.h[t].length : 0 : R(d, t) ? 1 : 0;
|
|
2645
2665
|
}
|
|
2646
2666
|
function E(d, t, $) {
|
|
@@ -2650,8 +2670,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2650
2670
|
d.h[t] || (d.h[t] = []), d.h[t].push($), d.g && delete d.g[t];
|
|
2651
2671
|
}
|
|
2652
2672
|
function r1(d, t) {
|
|
2653
|
-
var $ = [],
|
|
2654
|
-
for (
|
|
2673
|
+
var $ = [], r;
|
|
2674
|
+
for (r in t) r != 0 && $.push(new L(r, t[r]));
|
|
2655
2675
|
return new v1(d, $);
|
|
2656
2676
|
}
|
|
2657
2677
|
function s1() {
|
|
@@ -2659,7 +2679,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2659
2679
|
s1.prototype.g = function(d) {
|
|
2660
2680
|
throw new d.h(), Error("Unimplemented");
|
|
2661
2681
|
}, s1.prototype.h = function(d, t) {
|
|
2662
|
-
if (d.h == 11 || d.h == 10) return t instanceof
|
|
2682
|
+
if (d.h == 11 || d.h == 10) return t instanceof x ? t : this.g(d.s.prototype.m(), t);
|
|
2663
2683
|
if (d.h == 14) return typeof t == "string" && b1.test(t) && (d = Number(t), 0 < d) ? d : t;
|
|
2664
2684
|
if (!d.o) return t;
|
|
2665
2685
|
if (d = d.s, d === String) {
|
|
@@ -2670,55 +2690,55 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2670
2690
|
var b1 = /^-?[0-9]+$/;
|
|
2671
2691
|
function g1() {
|
|
2672
2692
|
}
|
|
2673
|
-
|
|
2693
|
+
i(g1, s1), g1.prototype.g = function(d, t) {
|
|
2674
2694
|
return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
|
|
2675
2695
|
};
|
|
2676
2696
|
function q() {
|
|
2677
2697
|
}
|
|
2678
|
-
|
|
2698
|
+
i(q, g1), q.prototype.h = function(d, t) {
|
|
2679
2699
|
return d.h == 8 ? !!t : s1.prototype.h.apply(this, arguments);
|
|
2680
2700
|
}, q.prototype.g = function(d, t) {
|
|
2681
2701
|
return q.ma.g.call(this, d, t);
|
|
2682
2702
|
};
|
|
2683
|
-
function
|
|
2703
|
+
function N(d, t) {
|
|
2684
2704
|
d != null && this.g.apply(this, arguments);
|
|
2685
2705
|
}
|
|
2686
|
-
|
|
2706
|
+
N.prototype.h = "", N.prototype.set = function(d) {
|
|
2687
2707
|
this.h = "" + d;
|
|
2688
|
-
},
|
|
2689
|
-
if (this.h += String(d), t != null) for (let
|
|
2708
|
+
}, N.prototype.g = function(d, t, $) {
|
|
2709
|
+
if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
|
|
2690
2710
|
return this;
|
|
2691
2711
|
};
|
|
2692
2712
|
function B(d) {
|
|
2693
2713
|
d.h = "";
|
|
2694
2714
|
}
|
|
2695
|
-
|
|
2715
|
+
N.prototype.toString = function() {
|
|
2696
2716
|
return this.h;
|
|
2697
2717
|
};
|
|
2698
2718
|
function j() {
|
|
2699
|
-
|
|
2719
|
+
x.call(this);
|
|
2700
2720
|
}
|
|
2701
|
-
|
|
2702
|
-
var
|
|
2721
|
+
i(j, x);
|
|
2722
|
+
var L1 = null;
|
|
2703
2723
|
function w() {
|
|
2704
|
-
|
|
2724
|
+
x.call(this);
|
|
2705
2725
|
}
|
|
2706
|
-
|
|
2707
|
-
var
|
|
2726
|
+
i(w, x);
|
|
2727
|
+
var T1 = null;
|
|
2708
2728
|
function W() {
|
|
2709
|
-
|
|
2729
|
+
x.call(this);
|
|
2710
2730
|
}
|
|
2711
|
-
|
|
2712
|
-
var
|
|
2731
|
+
i(W, x);
|
|
2732
|
+
var N1 = null;
|
|
2713
2733
|
j.prototype.m = function() {
|
|
2714
|
-
var d =
|
|
2715
|
-
return d || (
|
|
2734
|
+
var d = L1;
|
|
2735
|
+
return d || (L1 = d = r1(j, { 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;
|
|
2716
2736
|
}, j.m = j.prototype.m, w.prototype.m = function() {
|
|
2717
|
-
var d =
|
|
2718
|
-
return d || (
|
|
2737
|
+
var d = T1;
|
|
2738
|
+
return d || (T1 = d = r1(w, { 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;
|
|
2719
2739
|
}, w.m = w.prototype.m, W.prototype.m = function() {
|
|
2720
|
-
var d =
|
|
2721
|
-
return d || (
|
|
2740
|
+
var d = N1;
|
|
2741
|
+
return d || (N1 = d = r1(W, {
|
|
2722
2742
|
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
|
|
2723
2743
|
1: { name: "general_desc", i: 11, type: w },
|
|
2724
2744
|
2: { name: "fixed_line", i: 11, type: w },
|
|
@@ -2757,13 +2777,13 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
2757
2777
|
})), d;
|
|
2758
2778
|
}, W.m = W.prototype.m;
|
|
2759
2779
|
function V() {
|
|
2760
|
-
|
|
2780
|
+
x.call(this);
|
|
2761
2781
|
}
|
|
2762
|
-
|
|
2763
|
-
var
|
|
2782
|
+
i(V, x);
|
|
2783
|
+
var A1 = null, a2 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
|
|
2764
2784
|
V.prototype.m = function() {
|
|
2765
|
-
var d =
|
|
2766
|
-
return d || (
|
|
2785
|
+
var d = A1;
|
|
2786
|
+
return d || (A1 = d = r1(V, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: a2 }, 7: {
|
|
2767
2787
|
name: "preferred_domestic_carrier_code",
|
|
2768
2788
|
i: 9,
|
|
2769
2789
|
type: String
|
|
@@ -8015,8 +8035,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8015
8035
|
function M1() {
|
|
8016
8036
|
return ";ext=" + Y("20") + "|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[ \\t,-]*" + (Y("20") + "#?|[ \\t,]*(?:[xx##~~]|int|int)[:\\..]?[ \\t,-]*") + (Y("9") + "#?|[- ]+") + (Y("6") + "#|[ \\t]*(?:,{2}|;)[:\\..]?[ \\t,-]*") + (Y("15") + "#?|[ \\t]*(?:,)+[:\\..]?[ \\t,-]*") + (Y("9") + "#?");
|
|
8017
8037
|
}
|
|
8018
|
-
var
|
|
8019
|
-
function
|
|
8038
|
+
var P1 = new RegExp("(?:" + M1() + ")$", "i"), I2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + M1() + ")?$", "i"), v2 = /(\$\d)/, S2 = /^\(?\$1\)?$/;
|
|
8039
|
+
function x1(d) {
|
|
8020
8040
|
return 2 > d.length ? !1 : G(I2, d);
|
|
8021
8041
|
}
|
|
8022
8042
|
function R1(d) {
|
|
@@ -8027,10 +8047,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8027
8047
|
B(d), d.g(t);
|
|
8028
8048
|
}
|
|
8029
8049
|
function k1(d) {
|
|
8030
|
-
return d != null && (
|
|
8050
|
+
return d != null && (F(d, 9) != 1 || P(d, 9)[0] != -1);
|
|
8031
8051
|
}
|
|
8032
8052
|
function o1(d, t) {
|
|
8033
|
-
for (var $ = new
|
|
8053
|
+
for (var $ = new N(), r, s = d.length, u = 0; u < s; ++u) r = d.charAt(u), r = t[r.toUpperCase()], r != null && $.g(r);
|
|
8034
8054
|
return $.toString();
|
|
8035
8055
|
}
|
|
8036
8056
|
function O1(d) {
|
|
@@ -8045,17 +8065,17 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8045
8065
|
if (0 < $.length) return $;
|
|
8046
8066
|
}
|
|
8047
8067
|
$ = S(d, 1);
|
|
8048
|
-
var
|
|
8049
|
-
if (t == 0) return G1($, 0,
|
|
8050
|
-
if (!($ in X)) return
|
|
8068
|
+
var r = t1(d);
|
|
8069
|
+
if (t == 0) return G1($, 0, r, "");
|
|
8070
|
+
if (!($ in X)) return r;
|
|
8051
8071
|
var s = d1(this, $, e1($));
|
|
8052
8072
|
d = R(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : R(s, 13) ? p(s, 13) + S(d, 3) : " ext. " + S(d, 3) : "";
|
|
8053
8073
|
d: {
|
|
8054
|
-
s =
|
|
8074
|
+
s = P(s, 20).length == 0 || t == 2 ? P(s, 19) : P(s, 20);
|
|
8055
8075
|
for (var u, l = s.length, h = 0; h < l; ++h) {
|
|
8056
8076
|
u = s[h];
|
|
8057
|
-
var
|
|
8058
|
-
if ((
|
|
8077
|
+
var C = F(u, 3);
|
|
8078
|
+
if ((C == 0 || r.search(p(u, 3, C - 1)) == 0) && (C = new RegExp(p(u, 1)), G(C, r))) {
|
|
8059
8079
|
s = u;
|
|
8060
8080
|
break d;
|
|
8061
8081
|
}
|
|
@@ -8065,7 +8085,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8065
8085
|
return s != null && (l = s, s = S(l, 2), u = new RegExp(p(l, 1)), S(
|
|
8066
8086
|
l,
|
|
8067
8087
|
5
|
|
8068
|
-
), l = S(l, 4),
|
|
8088
|
+
), l = S(l, 4), r = t == 2 && l != null && 0 < l.length ? r.replace(u, s.replace(v2, l)) : r.replace(u, s), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), G1($, t, r, d);
|
|
8069
8089
|
};
|
|
8070
8090
|
function d1(d, t, $) {
|
|
8071
8091
|
return $ == "001" ? K(d, "" + t) : K(d, $);
|
|
@@ -8075,16 +8095,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8075
8095
|
var t = "" + p(d, 2);
|
|
8076
8096
|
return R(d, 4) && p(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
|
|
8077
8097
|
}
|
|
8078
|
-
function G1(d, t, $,
|
|
8098
|
+
function G1(d, t, $, r) {
|
|
8079
8099
|
switch (t) {
|
|
8080
8100
|
case 0:
|
|
8081
|
-
return "+" + d + $ +
|
|
8101
|
+
return "+" + d + $ + r;
|
|
8082
8102
|
case 1:
|
|
8083
|
-
return "+" + d + " " + $ +
|
|
8103
|
+
return "+" + d + " " + $ + r;
|
|
8084
8104
|
case 3:
|
|
8085
|
-
return "tel:+" + d + "-" + $ +
|
|
8105
|
+
return "tel:+" + d + "-" + $ + r;
|
|
8086
8106
|
default:
|
|
8087
|
-
return $ +
|
|
8107
|
+
return $ + r;
|
|
8088
8108
|
}
|
|
8089
8109
|
}
|
|
8090
8110
|
function l1(d, t) {
|
|
@@ -8129,25 +8149,25 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8129
8149
|
}
|
|
8130
8150
|
function k(d, t) {
|
|
8131
8151
|
var $ = d.length;
|
|
8132
|
-
return 0 <
|
|
8152
|
+
return 0 < F(t, 9) && P(t, 9).indexOf($) == -1 ? !1 : G(S(t, 2), d);
|
|
8133
8153
|
}
|
|
8134
|
-
function
|
|
8154
|
+
function U1(d, t) {
|
|
8135
8155
|
if (t == null) return null;
|
|
8136
8156
|
var $ = S(t, 1);
|
|
8137
8157
|
if ($ = X[$], $ == null) d = null;
|
|
8138
8158
|
else if ($.length == 1) d = $[0];
|
|
8139
8159
|
else d: {
|
|
8140
8160
|
t = t1(t);
|
|
8141
|
-
for (var
|
|
8142
|
-
|
|
8143
|
-
var l = K(d,
|
|
8161
|
+
for (var r, s = $.length, u = 0; u < s; u++) {
|
|
8162
|
+
r = $[u];
|
|
8163
|
+
var l = K(d, r);
|
|
8144
8164
|
if (R(l, 23)) {
|
|
8145
8165
|
if (t.search(p(l, 23)) == 0) {
|
|
8146
|
-
d =
|
|
8166
|
+
d = r;
|
|
8147
8167
|
break d;
|
|
8148
8168
|
}
|
|
8149
8169
|
} else if (m1(t, l) != -1) {
|
|
8150
|
-
d =
|
|
8170
|
+
d = r;
|
|
8151
8171
|
break d;
|
|
8152
8172
|
}
|
|
8153
8173
|
}
|
|
@@ -8158,28 +8178,28 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8158
8178
|
function e1(d) {
|
|
8159
8179
|
return d = X[d], d == null ? "ZZ" : d[0];
|
|
8160
8180
|
}
|
|
8161
|
-
function
|
|
8181
|
+
function F1(d, t) {
|
|
8162
8182
|
if (d = K(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8163
8183
|
return S(d, 10);
|
|
8164
8184
|
}
|
|
8165
|
-
function a1(d, t, $,
|
|
8166
|
-
var s = l1($,
|
|
8167
|
-
if (s =
|
|
8185
|
+
function a1(d, t, $, r) {
|
|
8186
|
+
var s = l1($, r), u = F(s, 9) == 0 ? P(p($, 1), 9) : P(s, 9);
|
|
8187
|
+
if (s = P(s, 10), r == 2) if (k1(l1($, 0))) d = l1($, 1), k1(d) && (u = u.concat(F(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()));
|
|
8168
8188
|
else return a1(d, t, $, 1);
|
|
8169
8189
|
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));
|
|
8170
8190
|
}
|
|
8171
8191
|
function J(d, t, $) {
|
|
8172
|
-
var
|
|
8173
|
-
return t = S(t, 1), t in X ? (t = d1(d, t, e1(t)), a1(d,
|
|
8192
|
+
var r = t1(t);
|
|
8193
|
+
return t = S(t, 1), t in X ? (t = d1(d, t, e1(t)), a1(d, r, t, $)) : 1;
|
|
8174
8194
|
}
|
|
8175
8195
|
function V1(d, t) {
|
|
8176
8196
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8177
|
-
for (var $,
|
|
8197
|
+
for (var $, r = d.length, s = 1; 3 >= s && s <= r; ++s) if ($ = parseInt(d.substring(0, s), 10), $ in X) return t.g(d.substring(s)), $;
|
|
8178
8198
|
return 0;
|
|
8179
8199
|
}
|
|
8180
|
-
function K1(d, t, $,
|
|
8200
|
+
function K1(d, t, $, r, s, u) {
|
|
8181
8201
|
if (t.length == 0) return 0;
|
|
8182
|
-
t = new
|
|
8202
|
+
t = new N(t);
|
|
8183
8203
|
var l;
|
|
8184
8204
|
$ != null && (l = p($, 11)), l == null && (l = "NonMatch");
|
|
8185
8205
|
var h = t.toString();
|
|
@@ -8188,26 +8208,26 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8188
8208
|
else {
|
|
8189
8209
|
if (h = new RegExp(l), B1(t), l = t.toString(), l.search(h) == 0) {
|
|
8190
8210
|
h = l.match(h)[0].length;
|
|
8191
|
-
var
|
|
8192
|
-
|
|
8211
|
+
var C = l.substring(h).match(D1);
|
|
8212
|
+
C && C[1] != null && 0 < C[1].length && o1(C[1], C1) == "0" ? l = !1 : (B(t), t.g(l.substring(h)), l = !0);
|
|
8193
8213
|
} else l = !1;
|
|
8194
8214
|
l = l ? 5 : 20;
|
|
8195
8215
|
}
|
|
8196
8216
|
if (s && E(u, 6, l), l != 20) {
|
|
8197
8217
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8198
|
-
if (d = V1(t,
|
|
8218
|
+
if (d = V1(t, r), d != 0) return E(u, 1, d), d;
|
|
8199
8219
|
throw Error("Invalid country calling code");
|
|
8200
8220
|
}
|
|
8201
|
-
return $ != null && (l = S($, 10), h = "" + l,
|
|
8221
|
+
return $ != null && (l = S($, 10), h = "" + l, C = t.toString(), C.lastIndexOf(h, 0) == 0 && (h = new N(C.substring(h.length)), C = p($, 1), C = new RegExp(S(C, 2)), H1(h, $, null), h = h.toString(), !G(C, t.toString()) && G(C, h) || a1(d, t.toString(), $, -1) == 3)) ? (r.g(h), s && E(u, 6, 10), E(u, 1, l), l) : (E(u, 1, 0), 0);
|
|
8202
8222
|
}
|
|
8203
8223
|
function H1(d, t, $) {
|
|
8204
|
-
var
|
|
8224
|
+
var r = d.toString(), s = r.length, u = p(t, 15);
|
|
8205
8225
|
if (s != 0 && u != null && u.length != 0) {
|
|
8206
8226
|
var l = new RegExp("^(?:" + u + ")");
|
|
8207
|
-
if (s = l.exec(
|
|
8227
|
+
if (s = l.exec(r)) {
|
|
8208
8228
|
u = new RegExp(S(p(t, 1), 2));
|
|
8209
|
-
var h = G(u,
|
|
8210
|
-
t = p(t, 16), t == null || t.length == 0 || s[
|
|
8229
|
+
var h = G(u, r), C = s.length - 1;
|
|
8230
|
+
t = p(t, 16), t == null || t.length == 0 || s[C] == null || s[C].length == 0 ? (!h || G(u, r.substring(s[0].length))) && ($ != null && 0 < C && s[C] != null && $.g(s[1]), d.set(r.substring(s[0].length))) : (r = r.replace(l, t), (!h || G(u, r)) && ($ != null && 0 < C && $.g(s[1]), d.set(r)));
|
|
8211
8231
|
}
|
|
8212
8232
|
}
|
|
8213
8233
|
}
|
|
@@ -8215,10 +8235,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8215
8235
|
if (!u1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8216
8236
|
return j1(d, t, $, !0);
|
|
8217
8237
|
}
|
|
8218
|
-
function j1(d, t, $,
|
|
8238
|
+
function j1(d, t, $, r) {
|
|
8219
8239
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8220
8240
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8221
|
-
var s = new
|
|
8241
|
+
var s = new N(), u = t.indexOf(";phone-context=");
|
|
8222
8242
|
if (u === -1) u = null;
|
|
8223
8243
|
else if (u += 15, u >= t.length) u = "";
|
|
8224
8244
|
else {
|
|
@@ -8226,73 +8246,73 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8226
8246
|
u = l !== -1 ? t.substring(u, l) : t.substring(u);
|
|
8227
8247
|
}
|
|
8228
8248
|
var h = u;
|
|
8229
|
-
if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = y2.exec(h), h = _2.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(p2), 0 <= h ? (l = l.substring(h), l = l.replace(C2, ""), h = l.search(g2), 0 <= h && (l = l.substring(0, h))) : l = "", u.call(s, l)), u = s.toString(), l = u.indexOf(";isub="), 0 < l && (B(s), s.g(u.substring(0, l))), !
|
|
8249
|
+
if (h == null ? l = !0 : h.length === 0 ? l = !1 : (l = y2.exec(h), h = _2.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(p2), 0 <= h ? (l = l.substring(h), l = l.replace(C2, ""), h = l.search(g2), 0 <= h && (l = l.substring(0, h))) : l = "", u.call(s, l)), u = s.toString(), l = u.indexOf(";isub="), 0 < l && (B(s), s.g(u.substring(0, l))), !x1(s.toString()))) throw Error("The string supplied did not seem to be a phone number");
|
|
8230
8250
|
if (u = s.toString(), !(u1($) || u != null && 0 < u.length && Q.test(u))) throw Error("Invalid country calling code");
|
|
8231
|
-
u = new V(),
|
|
8251
|
+
u = new V(), r && E(u, 5, t);
|
|
8232
8252
|
d: {
|
|
8233
|
-
if (t = s.toString(), l = t.search(
|
|
8234
|
-
h = t.match(
|
|
8235
|
-
for (var
|
|
8236
|
-
B(s), s.g(t.substring(0, l)), t = h[
|
|
8253
|
+
if (t = s.toString(), l = t.search(P1), 0 <= l && x1(t.substring(0, l))) {
|
|
8254
|
+
h = t.match(P1);
|
|
8255
|
+
for (var C = h.length, U = 1; U < C; ++U) if (h[U] != null && 0 < h[U].length) {
|
|
8256
|
+
B(s), s.g(t.substring(0, l)), t = h[U];
|
|
8237
8257
|
break d;
|
|
8238
8258
|
}
|
|
8239
8259
|
}
|
|
8240
8260
|
t = "";
|
|
8241
8261
|
}
|
|
8242
|
-
0 < t.length && E(u, 3, t), l = K(d, $), t = new
|
|
8262
|
+
0 < t.length && E(u, 3, t), l = K(d, $), t = new N(), h = 0, C = s.toString();
|
|
8243
8263
|
try {
|
|
8244
|
-
h = K1(d,
|
|
8264
|
+
h = K1(d, C, l, t, r, u);
|
|
8245
8265
|
} catch (_1) {
|
|
8246
|
-
if (_1.message == "Invalid country calling code" && Q.test(
|
|
8247
|
-
if (
|
|
8266
|
+
if (_1.message == "Invalid country calling code" && Q.test(C)) {
|
|
8267
|
+
if (C = C.replace(Q, ""), h = K1(d, C, l, t, r, u), h == 0) throw _1;
|
|
8248
8268
|
} else throw _1;
|
|
8249
8269
|
}
|
|
8250
8270
|
if (h != 0 ? (s = e1(h), s != $ && (l = d1(d, h, s))) : (B1(s), t.g(s.toString()), $ != null ? (h = S(l, 10), E(
|
|
8251
8271
|
u,
|
|
8252
8272
|
1,
|
|
8253
8273
|
h
|
|
8254
|
-
)) :
|
|
8274
|
+
)) : r && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (l != null && ($ = new N(), s = new N(t.toString()), H1(s, l, $), d = a1(d, s.toString(), l, -1), d != 2 && d != 4 && d != 5 && (t = s, r && 0 < $.toString().length && E(u, 7, $.toString()))), r = t.toString(), d = r.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
|
|
8255
8275
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
8256
|
-
if (1 <
|
|
8257
|
-
for (E(u, 4, !0), d = 1; d <
|
|
8276
|
+
if (1 < r.length && r.charAt(0) == "0") {
|
|
8277
|
+
for (E(u, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
|
|
8258
8278
|
d != 1 && E(u, 8, d);
|
|
8259
8279
|
}
|
|
8260
|
-
return E(u, 2, parseInt(
|
|
8280
|
+
return E(u, 2, parseInt(r, 10)), u;
|
|
8261
8281
|
}
|
|
8262
8282
|
function G(d, t) {
|
|
8263
8283
|
return !!((d = typeof d == "string" ? t.match("^(?:" + d + ")$") : t.match(d)) && d[0].length == t.length);
|
|
8264
8284
|
}
|
|
8265
8285
|
function w2(d) {
|
|
8266
|
-
this.fa = RegExp(" "), this.ja = "", this.v = new
|
|
8286
|
+
this.fa = RegExp(" "), this.ja = "", this.v = new N(), this.da = "", this.s = new N(), this.ba = new N(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = D.g(), this.$ = 0, this.h = new N(), this.ha = !1, this.o = "", this.g = new N(), this.j = [], this.ka = d, this.l = Z1(this, this.ka);
|
|
8267
8287
|
}
|
|
8268
8288
|
var W1 = new W();
|
|
8269
8289
|
E(W1, 11, "NA");
|
|
8270
8290
|
var b2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), z1 = /[- ]/;
|
|
8271
8291
|
function Z1(d, t) {
|
|
8272
8292
|
var $ = d.ga;
|
|
8273
|
-
return t = u1(t) ?
|
|
8293
|
+
return t = u1(t) ? F1($, t) : 0, d = K(d.ga, e1(t)), d ?? W1;
|
|
8274
8294
|
}
|
|
8275
8295
|
function Y1(d) {
|
|
8276
8296
|
for (var t = d.j.length, $ = 0; $ < t; ++$) {
|
|
8277
|
-
var
|
|
8297
|
+
var r = d.j[$], s = S(r, 1);
|
|
8278
8298
|
if (d.da == s) return !1;
|
|
8279
|
-
var u = d, l =
|
|
8299
|
+
var u = d, l = r, h = S(l, 1);
|
|
8280
8300
|
B(u.v);
|
|
8281
|
-
var
|
|
8301
|
+
var C = u;
|
|
8282
8302
|
l = S(l, 2);
|
|
8283
|
-
var
|
|
8284
|
-
if (
|
|
8303
|
+
var U = "999999999999999".match(h)[0];
|
|
8304
|
+
if (U.length < C.g.h.length ? C = "" : (C = U.replace(new RegExp(h, "g"), l), C = C.replace(RegExp("9", "g"), " ")), 0 < C.length ? (u.v.g(C), u = !0) : u = !1, u) return d.da = s, d.ha = z1.test(p(r, 4)), d.$ = 0, !0;
|
|
8285
8305
|
}
|
|
8286
8306
|
return d.u = !1;
|
|
8287
8307
|
}
|
|
8288
8308
|
function J1(d, t) {
|
|
8289
|
-
for (var $ = [],
|
|
8309
|
+
for (var $ = [], r = t.length - 3, s = d.j.length, u = 0; u < s; ++u) {
|
|
8290
8310
|
var l = d.j[u];
|
|
8291
|
-
|
|
8311
|
+
F(l, 3) == 0 ? $.push(d.j[u]) : (l = p(l, 3, Math.min(r, F(l, 3) - 1)), t.search(l) == 0 && $.push(d.j[u]));
|
|
8292
8312
|
}
|
|
8293
8313
|
d.j = $;
|
|
8294
8314
|
}
|
|
8295
|
-
function
|
|
8315
|
+
function L2(d, t) {
|
|
8296
8316
|
d.s.g(t);
|
|
8297
8317
|
var $ = t;
|
|
8298
8318
|
if (D1.test($) || d.s.h.length == 1 && f2.test($) ? (t == "+" ? ($ = t, d.ba.g(t)) : ($ = C1[t], d.ba.g($), d.g.g($)), t = $) : (d.u = !1, d.la = !0), !d.u) {
|
|
@@ -8319,8 +8339,8 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8319
8339
|
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, B(d.v), d.da = "", y1(d);
|
|
8320
8340
|
}
|
|
8321
8341
|
function X1(d) {
|
|
8322
|
-
for (var t = d.g.toString(), $ = d.j.length,
|
|
8323
|
-
var s = d.j[
|
|
8342
|
+
for (var t = d.g.toString(), $ = d.j.length, r = 0; r < $; ++r) {
|
|
8343
|
+
var s = d.j[r], u = S(s, 1);
|
|
8324
8344
|
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), o1(s, h2) == d.ba)) return s;
|
|
8325
8345
|
}
|
|
8326
8346
|
return "";
|
|
@@ -8332,7 +8352,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8332
8352
|
function y1(d) {
|
|
8333
8353
|
var t = d.g.toString();
|
|
8334
8354
|
if (3 <= t.length) {
|
|
8335
|
-
for (var $ = d.ca && d.o.length == 0 && 0 <
|
|
8355
|
+
for (var $ = d.ca && d.o.length == 0 && 0 < F(d.l, 20) ? P(d.l, 20) : P(d.l, 19), r = $.length, s = 0; s < r; ++s) {
|
|
8336
8356
|
var u = $[s];
|
|
8337
8357
|
0 < d.o.length && O1(S(u, 4)) && !p(u, 6) && !R(u, 5) || (d.o.length != 0 || d.ca || O1(S(u, 4)) || p(u, 6)) && b2.test(S(u, 2)) && d.j.push(u);
|
|
8338
8358
|
}
|
|
@@ -8343,16 +8363,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8343
8363
|
function Q1(d) {
|
|
8344
8364
|
var t = d.g.toString(), $ = t.length;
|
|
8345
8365
|
if (0 < $) {
|
|
8346
|
-
for (var
|
|
8347
|
-
return d.u ? h1(d,
|
|
8366
|
+
for (var r = "", s = 0; s < $; s++) r = $2(d, t.charAt(s));
|
|
8367
|
+
return d.u ? h1(d, r) : d.s.toString();
|
|
8348
8368
|
}
|
|
8349
8369
|
return d.h.toString();
|
|
8350
8370
|
}
|
|
8351
8371
|
function d2(d) {
|
|
8352
8372
|
var t = d.g.toString(), $ = 0;
|
|
8353
|
-
if (p(d.l, 10) != 1) var
|
|
8354
|
-
else
|
|
8355
|
-
return
|
|
8373
|
+
if (p(d.l, 10) != 1) var r = !1;
|
|
8374
|
+
else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
|
|
8375
|
+
return r ? ($ = 1, d.h.g("1").g(" "), d.ca = !0) : R(d.l, 15) && (r = new RegExp("^(?:" + p(d.l, 15) + ")"), r = t.match(r), r != null && r[0] != null && 0 < r[0].length && (d.ca = !0, $ = r[0].length, d.h.g(t.substring(0, $)))), B(d.g), d.g.g(t.substring($)), t.substring(0, $);
|
|
8356
8376
|
}
|
|
8357
8377
|
function t2(d) {
|
|
8358
8378
|
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
|
|
@@ -8360,23 +8380,23 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8360
8380
|
}
|
|
8361
8381
|
function e2(d) {
|
|
8362
8382
|
if (d.g.h.length == 0) return !1;
|
|
8363
|
-
var t = new
|
|
8383
|
+
var t = new N(), $ = V1(d.g, t);
|
|
8364
8384
|
return $ == 0 ? !1 : (B(d.g), d.g.g(t.toString()), t = e1($), t == "001" ? d.l = K(d.ga, "" + $) : t != d.ka && (d.l = Z1(d, t)), d.h.g("" + $).g(" "), d.o = "", !0);
|
|
8365
8385
|
}
|
|
8366
8386
|
function $2(d, t) {
|
|
8367
8387
|
var $ = d.v.toString();
|
|
8368
8388
|
if (0 <= $.substring(d.$).search(d.fa)) {
|
|
8369
|
-
var
|
|
8370
|
-
return t = $.replace(d.fa, t), B(d.v), d.v.g(t), d.$ =
|
|
8389
|
+
var r = $.search(d.fa);
|
|
8390
|
+
return t = $.replace(d.fa, t), B(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
|
|
8371
8391
|
}
|
|
8372
8392
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
8373
8393
|
}
|
|
8374
8394
|
const c1 = { 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 };
|
|
8375
8395
|
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
8376
8396
|
try {
|
|
8377
|
-
const $ = d.replace(/[^+0-9]/g, ""),
|
|
8397
|
+
const $ = d.replace(/[^+0-9]/g, ""), r = new w2(t);
|
|
8378
8398
|
t = "";
|
|
8379
|
-
for (let s = 0; s < $.length; s++)
|
|
8399
|
+
for (let s = 0; s < $.length; s++) r.ja = L2(r, $.charAt(s)), t = r.ja;
|
|
8380
8400
|
return t;
|
|
8381
8401
|
} catch {
|
|
8382
8402
|
return d;
|
|
@@ -8384,16 +8404,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8384
8404
|
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => {
|
|
8385
8405
|
try {
|
|
8386
8406
|
const s = D.g(), u = z(s, d, t);
|
|
8387
|
-
var
|
|
8388
|
-
return
|
|
8407
|
+
var r = J(s, u, -1);
|
|
8408
|
+
return r == 0 || r == 4 ? s.format(u, typeof $ > "u" ? 0 : $) : d;
|
|
8389
8409
|
} catch {
|
|
8390
8410
|
return d;
|
|
8391
8411
|
}
|
|
8392
|
-
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $,
|
|
8412
|
+
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, r) => {
|
|
8393
8413
|
try {
|
|
8394
|
-
const
|
|
8414
|
+
const C = D.g();
|
|
8395
8415
|
d: {
|
|
8396
|
-
var s =
|
|
8416
|
+
var s = C;
|
|
8397
8417
|
if (u1(d)) {
|
|
8398
8418
|
var u = l1(K(s, d), $);
|
|
8399
8419
|
try {
|
|
@@ -8406,7 +8426,7 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8406
8426
|
}
|
|
8407
8427
|
h = null;
|
|
8408
8428
|
}
|
|
8409
|
-
return
|
|
8429
|
+
return C.format(h, r ? 0 : t ? 2 : 1);
|
|
8410
8430
|
} catch {
|
|
8411
8431
|
return "";
|
|
8412
8432
|
}
|
|
@@ -8419,11 +8439,11 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8419
8439
|
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
8420
8440
|
try {
|
|
8421
8441
|
const l = D.g(), h = z(l, d, t);
|
|
8422
|
-
var $ =
|
|
8423
|
-
if (
|
|
8442
|
+
var $ = U1(l, h), r = d1(l, S(h, 1), $);
|
|
8443
|
+
if (r == null) var s = -1;
|
|
8424
8444
|
else {
|
|
8425
8445
|
var u = t1(h);
|
|
8426
|
-
s = m1(u,
|
|
8446
|
+
s = m1(u, r);
|
|
8427
8447
|
}
|
|
8428
8448
|
return s;
|
|
8429
8449
|
} catch {
|
|
@@ -8432,18 +8452,18 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8432
8452
|
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
8433
8453
|
if (!t) return 1;
|
|
8434
8454
|
try {
|
|
8435
|
-
const $ = D.g(),
|
|
8436
|
-
return J($,
|
|
8455
|
+
const $ = D.g(), r = z($, d, t);
|
|
8456
|
+
return J($, r, -1);
|
|
8437
8457
|
} catch ($) {
|
|
8438
8458
|
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;
|
|
8439
8459
|
}
|
|
8440
8460
|
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t) => {
|
|
8441
8461
|
try {
|
|
8442
|
-
const
|
|
8443
|
-
var $ = z(
|
|
8444
|
-
d =
|
|
8445
|
-
var s = S($, 1), u = d1(d, s,
|
|
8446
|
-
if (u == null ||
|
|
8462
|
+
const C = D.g();
|
|
8463
|
+
var $ = z(C, d, t), r = U1(C, $);
|
|
8464
|
+
d = C;
|
|
8465
|
+
var s = S($, 1), u = d1(d, s, r);
|
|
8466
|
+
if (u == null || r != "001" && s != F1(d, r)) var l = !1;
|
|
8447
8467
|
else {
|
|
8448
8468
|
var h = t1($);
|
|
8449
8469
|
l = m1(h, u) != -1;
|
|
@@ -8454,16 +8474,16 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8454
8474
|
}
|
|
8455
8475
|
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => {
|
|
8456
8476
|
try {
|
|
8457
|
-
const
|
|
8477
|
+
const r = D.g(), s = z(r, d, t);
|
|
8458
8478
|
if ($) {
|
|
8459
|
-
const u = J(
|
|
8479
|
+
const u = J(r, s, c1[$]) === 0;
|
|
8460
8480
|
if ($ === "FIXED_LINE_OR_MOBILE") {
|
|
8461
|
-
const l = J(
|
|
8481
|
+
const l = J(r, s, c1.MOBILE) === 0, h = J(r, s, c1.FIXED_LINE) === 0;
|
|
8462
8482
|
return l || h || u;
|
|
8463
8483
|
}
|
|
8464
8484
|
return u;
|
|
8465
8485
|
}
|
|
8466
|
-
return J(
|
|
8486
|
+
return J(r, s, -1) === 0;
|
|
8467
8487
|
} catch {
|
|
8468
8488
|
return !1;
|
|
8469
8489
|
}
|
|
@@ -8477,10 +8497,10 @@ const V2 = (y) => !C.utils && !C.startedLoadingUtilsScript ? (C.startedLoadingUt
|
|
|
8477
8497
|
})();
|
|
8478
8498
|
const K2 = window.intlTelInputUtilsTemp;
|
|
8479
8499
|
delete window.intlTelInputUtilsTemp;
|
|
8480
|
-
|
|
8500
|
+
m.utils = K2;
|
|
8481
8501
|
const j2 = {
|
|
8482
8502
|
__name: "IntlTelInputWithUtils",
|
|
8483
|
-
props: /* @__PURE__ */
|
|
8503
|
+
props: /* @__PURE__ */ i2({
|
|
8484
8504
|
disabled: {
|
|
8485
8505
|
type: Boolean,
|
|
8486
8506
|
default: !1
|
|
@@ -8504,14 +8524,14 @@ const j2 = {
|
|
|
8504
8524
|
},
|
|
8505
8525
|
modelModifiers: {}
|
|
8506
8526
|
}),
|
|
8507
|
-
emits: /* @__PURE__ */
|
|
8527
|
+
emits: /* @__PURE__ */ i2([
|
|
8508
8528
|
"changeNumber",
|
|
8509
8529
|
"changeCountry",
|
|
8510
8530
|
"changeValidity",
|
|
8511
8531
|
"changeErrorCode"
|
|
8512
8532
|
], ["update:modelValue"]),
|
|
8513
|
-
setup(y, { expose: e, emit:
|
|
8514
|
-
const
|
|
8533
|
+
setup(y, { expose: e, emit: i }) {
|
|
8534
|
+
const n = T2(y, "modelValue"), o = y, a = i, c = I1(), g = I1(), f = I1(!1), b = () => g.value ? o.options.strictMode ? g.value.isValidNumberPrecise() : g.value.isValidNumber() : null, _ = () => {
|
|
8515
8535
|
let v = b();
|
|
8516
8536
|
f.value !== v && (f.value = v, a("changeValidity", !!v), a(
|
|
8517
8537
|
"changeErrorCode",
|
|
@@ -8520,30 +8540,30 @@ const j2 = {
|
|
|
8520
8540
|
}, I = () => {
|
|
8521
8541
|
var v;
|
|
8522
8542
|
a("changeNumber", ((v = g.value) == null ? void 0 : v.getNumber()) ?? ""), _();
|
|
8523
|
-
},
|
|
8543
|
+
}, L = () => {
|
|
8524
8544
|
var v;
|
|
8525
8545
|
a("changeCountry", ((v = g.value) == null ? void 0 : v.getSelectedCountryData().iso2) ?? ""), I(), _();
|
|
8526
8546
|
};
|
|
8527
|
-
return
|
|
8528
|
-
c.value && (g.value =
|
|
8529
|
-
}),
|
|
8547
|
+
return N2(() => {
|
|
8548
|
+
c.value && (g.value = m(c.value, o.options), o.value && g.value.setNumber(o.value), o.disabled && g.value.setDisabled(o.disabled));
|
|
8549
|
+
}), A2(
|
|
8530
8550
|
() => o.disabled,
|
|
8531
8551
|
(v) => {
|
|
8532
|
-
var
|
|
8533
|
-
return (
|
|
8552
|
+
var T;
|
|
8553
|
+
return (T = g.value) == null ? void 0 : T.setDisabled(v);
|
|
8534
8554
|
}
|
|
8535
8555
|
), E2(() => {
|
|
8536
8556
|
var v;
|
|
8537
8557
|
return (v = g.value) == null ? void 0 : v.destroy();
|
|
8538
|
-
}), e({ instance: g, input: c }), (v,
|
|
8558
|
+
}), e({ instance: g, input: c }), (v, T) => D2((M2(), P2("input", x2({
|
|
8539
8559
|
ref_key: "input",
|
|
8540
8560
|
ref: c,
|
|
8541
|
-
"onUpdate:modelValue":
|
|
8561
|
+
"onUpdate:modelValue": T[0] || (T[0] = (M) => n.value = M),
|
|
8542
8562
|
type: "tel",
|
|
8543
|
-
onCountrychange:
|
|
8563
|
+
onCountrychange: L,
|
|
8544
8564
|
onInput: I
|
|
8545
8565
|
}, y.inputProps), null, 16)), [
|
|
8546
|
-
[R2,
|
|
8566
|
+
[R2, n.value]
|
|
8547
8567
|
]);
|
|
8548
8568
|
}
|
|
8549
8569
|
};
|