intl-tel-input 25.8.0 → 25.8.2
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 +7 -7
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +19 -19
- package/angular/build/IntlTelInputWithUtils.js +19 -19
- package/angular/build/types/intl-tel-input.d.ts +0 -1
- package/build/css/intlTelInput.css +5 -1
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/i18n/en/interface.js +2 -2
- package/build/js/intlTelInput.d.ts +0 -1
- package/build/js/intlTelInput.js +32 -28
- package/build/js/intlTelInput.min.js +3 -3
- package/build/js/intlTelInputWithUtils.js +32 -28
- package/build/js/intlTelInputWithUtils.min.js +4 -4
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +31 -27
- package/react/build/IntlTelInput.d.ts +0 -1
- package/react/build/IntlTelInput.js +31 -27
- package/react/build/IntlTelInputWithUtils.cjs +31 -27
- package/react/build/IntlTelInputWithUtils.js +31 -27
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +176 -172
- package/vue/build/IntlTelInputWithUtils.mjs +462 -458
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as r2, useModel as D2, ref as v1, onMounted as
|
|
1
|
+
import { mergeModels as r2, useModel as D2, ref as v1, onMounted as P2, watch as x2, onUnmounted as R2, withDirectives as B2, createElementBlock as k2, openBlock as O2, mergeProps as G2, vModelText as U2 } from "vue";
|
|
2
2
|
const F2 = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
@@ -1579,8 +1579,8 @@ const V2 = {
|
|
|
1579
1579
|
zm: "Zambia",
|
|
1580
1580
|
zw: "Zimbabwe"
|
|
1581
1581
|
}, K2 = {
|
|
1582
|
-
selectedCountryAriaLabel: "
|
|
1583
|
-
noCountrySelected: "
|
|
1582
|
+
selectedCountryAriaLabel: "Change country, selected ${country}",
|
|
1583
|
+
noCountrySelected: "Select country",
|
|
1584
1584
|
countryListAriaLabel: "List of countries",
|
|
1585
1585
|
searchPlaceholder: "Search",
|
|
1586
1586
|
clearSearchAriaLabel: "Clear search",
|
|
@@ -1590,14 +1590,14 @@ const V2 = {
|
|
|
1590
1590
|
// additional countries (not supported by country-list library)
|
|
1591
1591
|
ac: "Ascension Island",
|
|
1592
1592
|
xk: "Kosovo"
|
|
1593
|
-
},
|
|
1593
|
+
}, a2 = { ...V2, ...K2 };
|
|
1594
1594
|
for (const y of q)
|
|
1595
|
-
y.name =
|
|
1595
|
+
y.name = a2[y.iso2];
|
|
1596
1596
|
let H2 = 0;
|
|
1597
1597
|
const S1 = (y) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(y).matches, j2 = () => {
|
|
1598
1598
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1599
|
-
const y = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), e = S1("(max-width: 500px)"), i = S1("(max-height: 600px)"),
|
|
1600
|
-
return y || e ||
|
|
1599
|
+
const y = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), e = S1("(max-width: 500px)"), i = S1("(max-height: 600px)"), n = S1("(pointer: coarse)");
|
|
1600
|
+
return y || e || n && i;
|
|
1601
1601
|
}
|
|
1602
1602
|
return !1;
|
|
1603
1603
|
}, l2 = {
|
|
@@ -1667,30 +1667,30 @@ const S1 = (y) => typeof window < "u" && typeof window.matchMedia == "function"
|
|
|
1667
1667
|
"887",
|
|
1668
1668
|
"888",
|
|
1669
1669
|
"889"
|
|
1670
|
-
], f1 = (y) => y.replace(/\D/g, ""), o2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(),
|
|
1670
|
+
], f1 = (y) => y.replace(/\D/g, ""), o2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), u2 = (y) => {
|
|
1671
1671
|
const e = f1(y);
|
|
1672
1672
|
if (e.charAt(0) === "1") {
|
|
1673
1673
|
const i = e.substring(1, 4);
|
|
1674
1674
|
return W2.includes(i);
|
|
1675
1675
|
}
|
|
1676
1676
|
return !1;
|
|
1677
|
-
}, z2 = (y, e, i,
|
|
1678
|
-
if (i === 0 && !
|
|
1677
|
+
}, z2 = (y, e, i, n) => {
|
|
1678
|
+
if (i === 0 && !n)
|
|
1679
1679
|
return 0;
|
|
1680
|
-
let
|
|
1680
|
+
let o = 0;
|
|
1681
1681
|
for (let l = 0; l < e.length; l++) {
|
|
1682
|
-
if (/[+0-9]/.test(e[l]) &&
|
|
1682
|
+
if (/[+0-9]/.test(e[l]) && o++, o === y && !n)
|
|
1683
1683
|
return l + 1;
|
|
1684
|
-
if (
|
|
1684
|
+
if (n && o === y + 1)
|
|
1685
1685
|
return l;
|
|
1686
1686
|
}
|
|
1687
1687
|
return e.length;
|
|
1688
1688
|
}, T = (y, e, i) => {
|
|
1689
|
-
const
|
|
1690
|
-
return e && Object.entries(e).forEach(([
|
|
1689
|
+
const n = document.createElement(y);
|
|
1690
|
+
return e && Object.entries(e).forEach(([o, l]) => n.setAttribute(o, l)), i && i.appendChild(n), n;
|
|
1691
1691
|
}, i1 = (y, ...e) => {
|
|
1692
1692
|
const { instances: i } = m;
|
|
1693
|
-
Object.values(i).forEach((
|
|
1693
|
+
Object.values(i).forEach((n) => n[y](...e));
|
|
1694
1694
|
};
|
|
1695
1695
|
class p1 {
|
|
1696
1696
|
/**
|
|
@@ -1707,13 +1707,13 @@ class p1 {
|
|
|
1707
1707
|
_init() {
|
|
1708
1708
|
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]"), this.telInput.dir = "ltr";
|
|
1709
1709
|
const e = this.options.allowDropdown || this.options.separateDialCode;
|
|
1710
|
-
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 = { ...
|
|
1711
|
-
const i = new Promise((
|
|
1712
|
-
this.resolveAutoCountryPromise =
|
|
1713
|
-
}),
|
|
1714
|
-
this.resolveUtilsScriptPromise =
|
|
1710
|
+
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 = { ...a2, ...this.options.i18n };
|
|
1711
|
+
const i = new Promise((o, l) => {
|
|
1712
|
+
this.resolveAutoCountryPromise = o, this.rejectAutoCountryPromise = l;
|
|
1713
|
+
}), n = new Promise((o, l) => {
|
|
1714
|
+
this.resolveUtilsScriptPromise = o, this.rejectUtilsScriptPromise = l;
|
|
1715
1715
|
});
|
|
1716
|
-
this.promise = Promise.all([i,
|
|
1716
|
+
this.promise = Promise.all([i, n]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
1717
1717
|
}
|
|
1718
1718
|
//********************
|
|
1719
1719
|
//* PRIVATE METHODS
|
|
@@ -1730,40 +1730,40 @@ class p1 {
|
|
|
1730
1730
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1731
1731
|
_sortCountries() {
|
|
1732
1732
|
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, i) => {
|
|
1733
|
-
const { countryOrder:
|
|
1734
|
-
if (
|
|
1735
|
-
const
|
|
1736
|
-
if (
|
|
1737
|
-
return
|
|
1733
|
+
const { countryOrder: n } = this.options;
|
|
1734
|
+
if (n) {
|
|
1735
|
+
const o = n.indexOf(e.iso2), l = n.indexOf(i.iso2), g = o > -1, C = l > -1;
|
|
1736
|
+
if (g || C)
|
|
1737
|
+
return g && C ? o - l : g ? -1 : 1;
|
|
1738
1738
|
}
|
|
1739
1739
|
return e.name.localeCompare(i.name);
|
|
1740
1740
|
});
|
|
1741
1741
|
}
|
|
1742
1742
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1743
|
-
_addToDialCodeMap(e, i,
|
|
1743
|
+
_addToDialCodeMap(e, i, n) {
|
|
1744
1744
|
i.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = i.length), this.dialCodeToIso2Map.hasOwnProperty(i) || (this.dialCodeToIso2Map[i] = []);
|
|
1745
|
-
const
|
|
1746
|
-
if (
|
|
1745
|
+
const o = this.dialCodeToIso2Map[i];
|
|
1746
|
+
if (o.includes(e))
|
|
1747
1747
|
return;
|
|
1748
|
-
const l =
|
|
1749
|
-
|
|
1748
|
+
const l = n !== void 0 ? n : o.length;
|
|
1749
|
+
o[l] = e;
|
|
1750
1750
|
}
|
|
1751
1751
|
//* Process onlyCountries or excludeCountries array if present.
|
|
1752
1752
|
_processAllCountries() {
|
|
1753
1753
|
const { onlyCountries: e, excludeCountries: i } = this.options;
|
|
1754
1754
|
if (e.length) {
|
|
1755
|
-
const
|
|
1756
|
-
(
|
|
1755
|
+
const n = e.map(
|
|
1756
|
+
(o) => o.toLowerCase()
|
|
1757
1757
|
);
|
|
1758
1758
|
this.countries = q.filter(
|
|
1759
|
-
(
|
|
1759
|
+
(o) => n.includes(o.iso2)
|
|
1760
1760
|
);
|
|
1761
1761
|
} else if (i.length) {
|
|
1762
|
-
const
|
|
1763
|
-
(
|
|
1762
|
+
const n = i.map(
|
|
1763
|
+
(o) => o.toLowerCase()
|
|
1764
1764
|
);
|
|
1765
1765
|
this.countries = q.filter(
|
|
1766
|
-
(
|
|
1766
|
+
(o) => !n.includes(o.iso2)
|
|
1767
1767
|
);
|
|
1768
1768
|
} else
|
|
1769
1769
|
this.countries = q;
|
|
@@ -1783,38 +1783,38 @@ class p1 {
|
|
|
1783
1783
|
for (const e of this.countries)
|
|
1784
1784
|
if (e.areaCodes) {
|
|
1785
1785
|
const i = this.dialCodeToIso2Map[e.dialCode][0];
|
|
1786
|
-
for (const
|
|
1787
|
-
for (let
|
|
1788
|
-
const l =
|
|
1789
|
-
this._addToDialCodeMap(i,
|
|
1786
|
+
for (const n of e.areaCodes) {
|
|
1787
|
+
for (let o = 1; o < n.length; o++) {
|
|
1788
|
+
const l = n.substring(0, o), g = e.dialCode + l;
|
|
1789
|
+
this._addToDialCodeMap(i, g), this._addToDialCodeMap(e.iso2, g);
|
|
1790
1790
|
}
|
|
1791
|
-
this._addToDialCodeMap(e.iso2, e.dialCode +
|
|
1791
|
+
this._addToDialCodeMap(e.iso2, e.dialCode + n);
|
|
1792
1792
|
}
|
|
1793
1793
|
}
|
|
1794
1794
|
}
|
|
1795
1795
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1796
1796
|
_generateMarkup() {
|
|
1797
|
-
var
|
|
1797
|
+
var f, I, G;
|
|
1798
1798
|
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
1799
1799
|
const {
|
|
1800
1800
|
allowDropdown: e,
|
|
1801
1801
|
separateDialCode: i,
|
|
1802
|
-
showFlags:
|
|
1803
|
-
containerClass:
|
|
1802
|
+
showFlags: n,
|
|
1803
|
+
containerClass: o,
|
|
1804
1804
|
hiddenInput: l,
|
|
1805
|
-
dropdownContainer:
|
|
1805
|
+
dropdownContainer: g,
|
|
1806
1806
|
fixDropdownWidth: C,
|
|
1807
|
-
useFullscreenPopup:
|
|
1807
|
+
useFullscreenPopup: c,
|
|
1808
1808
|
countrySearch: S,
|
|
1809
1809
|
i18n: w
|
|
1810
1810
|
} = this.options, b = p1._buildClassNames({
|
|
1811
1811
|
iti: !0,
|
|
1812
1812
|
"iti--allow-dropdown": e,
|
|
1813
|
-
"iti--show-flags":
|
|
1814
|
-
"iti--inline-dropdown": !
|
|
1815
|
-
[
|
|
1813
|
+
"iti--show-flags": n,
|
|
1814
|
+
"iti--inline-dropdown": !c,
|
|
1815
|
+
[o]: !!o
|
|
1816
1816
|
}), L = T("div", { class: b });
|
|
1817
|
-
if ((
|
|
1817
|
+
if ((f = this.telInput.parentNode) == null || f.insertBefore(L, this.telInput), e || n || i) {
|
|
1818
1818
|
this.countryContainer = T(
|
|
1819
1819
|
"div",
|
|
1820
1820
|
{ class: "iti__country-container" },
|
|
@@ -1825,7 +1825,7 @@ class p1 {
|
|
|
1825
1825
|
type: "button",
|
|
1826
1826
|
class: "iti__selected-country",
|
|
1827
1827
|
"aria-expanded": "false",
|
|
1828
|
-
"aria-label": this.options.i18n.
|
|
1828
|
+
"aria-label": this.options.i18n.noCountrySelected,
|
|
1829
1829
|
"aria-haspopup": "dialog",
|
|
1830
1830
|
"aria-controls": `iti-${this.id}__dropdown-content`
|
|
1831
1831
|
},
|
|
@@ -1835,11 +1835,15 @@ class p1 {
|
|
|
1835
1835
|
{ class: "iti__selected-country" },
|
|
1836
1836
|
this.countryContainer
|
|
1837
1837
|
);
|
|
1838
|
-
const U = T(
|
|
1839
|
-
|
|
1840
|
-
"
|
|
1841
|
-
|
|
1842
|
-
|
|
1838
|
+
const U = T(
|
|
1839
|
+
"div",
|
|
1840
|
+
{ class: "iti__selected-country-primary" },
|
|
1841
|
+
this.selectedCountry
|
|
1842
|
+
);
|
|
1843
|
+
if (this.selectedCountryInner = T(
|
|
1844
|
+
"div",
|
|
1845
|
+
{ class: "iti__flag" },
|
|
1846
|
+
U
|
|
1843
1847
|
), e && (this.dropdownArrow = T(
|
|
1844
1848
|
"div",
|
|
1845
1849
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
@@ -1856,7 +1860,7 @@ class p1 {
|
|
|
1856
1860
|
role: "dialog",
|
|
1857
1861
|
"aria-modal": "true"
|
|
1858
1862
|
}), S) {
|
|
1859
|
-
const
|
|
1863
|
+
const x = T(
|
|
1860
1864
|
"div",
|
|
1861
1865
|
{ class: "iti__search-input-wrapper" },
|
|
1862
1866
|
this.dropdownContent
|
|
@@ -1867,7 +1871,7 @@ class p1 {
|
|
|
1867
1871
|
class: "iti__search-icon",
|
|
1868
1872
|
"aria-hidden": "true"
|
|
1869
1873
|
},
|
|
1870
|
-
|
|
1874
|
+
x
|
|
1871
1875
|
), this.searchIcon.innerHTML = `
|
|
1872
1876
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
1873
1877
|
<circle cx="11" cy="11" r="7" />
|
|
@@ -1888,7 +1892,7 @@ class p1 {
|
|
|
1888
1892
|
"aria-autocomplete": "list",
|
|
1889
1893
|
autocomplete: "off"
|
|
1890
1894
|
},
|
|
1891
|
-
|
|
1895
|
+
x
|
|
1892
1896
|
), this.searchClearButton = T(
|
|
1893
1897
|
"button",
|
|
1894
1898
|
{
|
|
@@ -1897,7 +1901,7 @@ class p1 {
|
|
|
1897
1901
|
"aria-label": w.clearSearchAriaLabel,
|
|
1898
1902
|
tabindex: "-1"
|
|
1899
1903
|
},
|
|
1900
|
-
|
|
1904
|
+
x
|
|
1901
1905
|
);
|
|
1902
1906
|
const Y = `iti-${this.id}-clear-mask`;
|
|
1903
1907
|
this.searchClearButton.innerHTML = `
|
|
@@ -1930,15 +1934,15 @@ class p1 {
|
|
|
1930
1934
|
"aria-label": w.countryListAriaLabel
|
|
1931
1935
|
},
|
|
1932
1936
|
this.dropdownContent
|
|
1933
|
-
), this._appendListItems(), S && this._updateSearchResultsA11yText(),
|
|
1934
|
-
const
|
|
1937
|
+
), this._appendListItems(), S && this._updateSearchResultsA11yText(), g) {
|
|
1938
|
+
const x = p1._buildClassNames({
|
|
1935
1939
|
iti: !0,
|
|
1936
1940
|
"iti--container": !0,
|
|
1937
|
-
"iti--fullscreen-popup":
|
|
1938
|
-
"iti--inline-dropdown": !
|
|
1939
|
-
[
|
|
1941
|
+
"iti--fullscreen-popup": c,
|
|
1942
|
+
"iti--inline-dropdown": !c,
|
|
1943
|
+
[o]: !!o
|
|
1940
1944
|
});
|
|
1941
|
-
this.dropdown = T("div", { class:
|
|
1945
|
+
this.dropdown = T("div", { class: x }), this.dropdown.appendChild(this.dropdownContent);
|
|
1942
1946
|
} else
|
|
1943
1947
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1944
1948
|
}
|
|
@@ -1946,15 +1950,15 @@ class p1 {
|
|
|
1946
1950
|
if (L.appendChild(this.telInput), this._updateInputPadding(), l) {
|
|
1947
1951
|
const U = this.telInput.getAttribute("name") || "", D = l(U);
|
|
1948
1952
|
if (D.phone) {
|
|
1949
|
-
const
|
|
1950
|
-
|
|
1953
|
+
const x = (I = this.telInput.form) == null ? void 0 : I.querySelector(`input[name="${D.phone}"]`);
|
|
1954
|
+
x ? this.hiddenInput = x : (this.hiddenInput = T("input", {
|
|
1951
1955
|
type: "hidden",
|
|
1952
1956
|
name: D.phone
|
|
1953
1957
|
}), L.appendChild(this.hiddenInput));
|
|
1954
1958
|
}
|
|
1955
1959
|
if (D.country) {
|
|
1956
|
-
const
|
|
1957
|
-
|
|
1960
|
+
const x = (G = this.telInput.form) == null ? void 0 : G.querySelector(`input[name="${D.country}"]`);
|
|
1961
|
+
x ? this.hiddenInputCountry = x : (this.hiddenInputCountry = T("input", {
|
|
1958
1962
|
type: "hidden",
|
|
1959
1963
|
name: D.country
|
|
1960
1964
|
}), L.appendChild(this.hiddenInputCountry));
|
|
@@ -1964,11 +1968,11 @@ class p1 {
|
|
|
1964
1968
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1965
1969
|
_appendListItems() {
|
|
1966
1970
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1967
|
-
const i = this.countries[e],
|
|
1971
|
+
const i = this.countries[e], n = e === 0 ? "iti__highlight" : "", o = T(
|
|
1968
1972
|
"li",
|
|
1969
1973
|
{
|
|
1970
1974
|
id: `iti-${this.id}__item-${i.iso2}`,
|
|
1971
|
-
class: `iti__country ${
|
|
1975
|
+
class: `iti__country ${n}`,
|
|
1972
1976
|
tabindex: "-1",
|
|
1973
1977
|
role: "option",
|
|
1974
1978
|
"data-dial-code": i.dialCode,
|
|
@@ -1977,21 +1981,21 @@ class p1 {
|
|
|
1977
1981
|
},
|
|
1978
1982
|
this.countryList
|
|
1979
1983
|
);
|
|
1980
|
-
i.nodeById[this.id] =
|
|
1984
|
+
i.nodeById[this.id] = o;
|
|
1981
1985
|
let l = "";
|
|
1982
|
-
this.options.showFlags && (l += `<div class='iti__flag iti__${i.iso2}'></div>`), l += `<span class='iti__country-name'>${i.name}</span>`, l += `<span class='iti__dial-code' dir='ltr'>+${i.dialCode}</span>`,
|
|
1986
|
+
this.options.showFlags && (l += `<div class='iti__flag iti__${i.iso2}'></div>`), l += `<span class='iti__country-name'>${i.name}</span>`, l += `<span class='iti__dial-code' dir='ltr'>+${i.dialCode}</span>`, o.insertAdjacentHTML("beforeend", l);
|
|
1983
1987
|
}
|
|
1984
1988
|
}
|
|
1985
1989
|
//* Set the initial state of the input value and the selected country by:
|
|
1986
1990
|
//* 1. Extracting a dial code from the given number
|
|
1987
1991
|
//* 2. Using explicit initialCountry
|
|
1988
1992
|
_setInitialState(e = !1) {
|
|
1989
|
-
const i = this.telInput.getAttribute("value"),
|
|
1990
|
-
if (
|
|
1993
|
+
const i = this.telInput.getAttribute("value"), n = this.telInput.value, l = i && i.charAt(0) === "+" && (!n || n.charAt(0) !== "+") ? i : n, g = this._getDialCode(l), C = u2(l), { initialCountry: c, geoIpLookup: S } = this.options, w = c === "auto" && S;
|
|
1994
|
+
if (g && !C)
|
|
1991
1995
|
this._updateCountryFromNumber(l);
|
|
1992
1996
|
else if (!w || e) {
|
|
1993
|
-
const b =
|
|
1994
|
-
b && this._getCountryData(b, !0) ? this._setCountry(b) :
|
|
1997
|
+
const b = c ? c.toLowerCase() : "";
|
|
1998
|
+
b && this._getCountryData(b, !0) ? this._setCountry(b) : g && C ? this._setCountry("us") : this._setCountry();
|
|
1995
1999
|
}
|
|
1996
2000
|
l && this._updateValFromNumber(l);
|
|
1997
2001
|
}
|
|
@@ -2026,12 +2030,12 @@ class p1 {
|
|
|
2026
2030
|
}
|
|
2027
2031
|
//* Init many requests: utils script / geo ip lookup.
|
|
2028
2032
|
_initRequests() {
|
|
2029
|
-
let { loadUtils: e, initialCountry: i, geoIpLookup:
|
|
2033
|
+
let { loadUtils: e, initialCountry: i, geoIpLookup: n } = this.options;
|
|
2030
2034
|
e && !m.utils ? (this._handlePageLoad = () => {
|
|
2031
2035
|
var l;
|
|
2032
2036
|
window.removeEventListener("load", this._handlePageLoad), (l = m.attachUtils(e)) == null || l.catch(() => {
|
|
2033
2037
|
});
|
|
2034
|
-
}, m.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), i === "auto" &&
|
|
2038
|
+
}, m.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), i === "auto" && n && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
2035
2039
|
}
|
|
2036
2040
|
//* Perform the geo ip lookup.
|
|
2037
2041
|
_loadAutoCountry() {
|
|
@@ -2050,31 +2054,31 @@ class p1 {
|
|
|
2050
2054
|
}
|
|
2051
2055
|
//* Initialize the tel input listeners.
|
|
2052
2056
|
_initTelInputListeners() {
|
|
2053
|
-
const { strictMode: e, formatAsYouType: i, separateDialCode:
|
|
2057
|
+
const { strictMode: e, formatAsYouType: i, separateDialCode: n, formatOnDisplay: o, allowDropdown: l, countrySearch: g } = this.options;
|
|
2054
2058
|
let C = !1;
|
|
2055
|
-
new RegExp("\\p{L}", "u").test(this.telInput.value) && (C = !0), this._handleInputEvent = (
|
|
2056
|
-
if (this.isAndroid && (
|
|
2057
|
-
const L = this.telInput.selectionStart || 0,
|
|
2058
|
-
this.telInput.value =
|
|
2059
|
+
new RegExp("\\p{L}", "u").test(this.telInput.value) && (C = !0), this._handleInputEvent = (c) => {
|
|
2060
|
+
if (this.isAndroid && (c == null ? void 0 : c.data) === "+" && n && l && g) {
|
|
2061
|
+
const L = this.telInput.selectionStart || 0, f = this.telInput.value.substring(0, L - 1), I = this.telInput.value.substring(L);
|
|
2062
|
+
this.telInput.value = f + I, this._openDropdownWithPlus();
|
|
2059
2063
|
return;
|
|
2060
2064
|
}
|
|
2061
2065
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
2062
|
-
const S = (
|
|
2066
|
+
const S = (c == null ? void 0 : c.data) && /[^+0-9]/.test(c.data), w = (c == null ? void 0 : c.inputType) === "insertFromPaste" && this.telInput.value;
|
|
2063
2067
|
S || w && !e ? C = !0 : /[^+0-9]/.test(this.telInput.value) || (C = !1);
|
|
2064
|
-
const b = (
|
|
2068
|
+
const b = (c == null ? void 0 : c.detail) && c.detail.isSetNumber && !o;
|
|
2065
2069
|
if (i && !C && !b) {
|
|
2066
|
-
const L = this.telInput.selectionStart || 0, I = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, G = (
|
|
2070
|
+
const L = this.telInput.selectionStart || 0, I = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, G = (c == null ? void 0 : c.inputType) === "deleteContentForward", U = this._formatNumberAsYouType(), D = z2(I, U, L, G);
|
|
2067
2071
|
this.telInput.value = U, this.telInput.setSelectionRange(D, D);
|
|
2068
2072
|
}
|
|
2069
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (e ||
|
|
2070
|
-
if (
|
|
2071
|
-
if (
|
|
2072
|
-
|
|
2073
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (e || n) && (this._handleKeydownEvent = (c) => {
|
|
2074
|
+
if (c.key && c.key.length === 1 && !c.altKey && !c.ctrlKey && !c.metaKey) {
|
|
2075
|
+
if (n && l && g && c.key === "+") {
|
|
2076
|
+
c.preventDefault(), this._openDropdownWithPlus();
|
|
2073
2077
|
return;
|
|
2074
2078
|
}
|
|
2075
2079
|
if (e) {
|
|
2076
|
-
const S = this.telInput.value, b = !(S.charAt(0) === "+") && this.telInput.selectionStart === 0 &&
|
|
2077
|
-
(!
|
|
2080
|
+
const S = this.telInput.value, b = !(S.charAt(0) === "+") && this.telInput.selectionStart === 0 && c.key === "+", L = /^[0-9]$/.test(c.key), f = n ? L : b || L, I = S.slice(0, this.telInput.selectionStart) + c.key + S.slice(this.telInput.selectionEnd), G = this._getFullNumber(I), U = m.utils.getCoreNumber(G, this.selectedCountryData.iso2), D = this.maxCoreNumberLength && U.length > this.maxCoreNumberLength, Y = this._getNewCountryFromNumber(G) !== null;
|
|
2081
|
+
(!f || D && !Y && !b) && c.preventDefault();
|
|
2078
2082
|
}
|
|
2079
2083
|
}
|
|
2080
2084
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
@@ -2086,19 +2090,19 @@ class p1 {
|
|
|
2086
2090
|
}
|
|
2087
2091
|
//* Trigger a custom event on the input.
|
|
2088
2092
|
_trigger(e, i = {}) {
|
|
2089
|
-
const
|
|
2093
|
+
const n = new CustomEvent(e, {
|
|
2090
2094
|
bubbles: !0,
|
|
2091
2095
|
cancelable: !0,
|
|
2092
2096
|
detail: i
|
|
2093
2097
|
});
|
|
2094
|
-
this.telInput.dispatchEvent(
|
|
2098
|
+
this.telInput.dispatchEvent(n);
|
|
2095
2099
|
}
|
|
2096
2100
|
//* Open the dropdown.
|
|
2097
2101
|
_openDropdown() {
|
|
2098
2102
|
const { fixDropdownWidth: e, countrySearch: i } = this.options;
|
|
2099
2103
|
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) {
|
|
2100
|
-
const
|
|
2101
|
-
|
|
2104
|
+
const n = this.countryList.firstElementChild;
|
|
2105
|
+
n && (this._highlightListItem(n, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
|
|
2102
2106
|
}
|
|
2103
2107
|
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2104
2108
|
}
|
|
@@ -2111,85 +2115,85 @@ class p1 {
|
|
|
2111
2115
|
}
|
|
2112
2116
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2113
2117
|
_bindDropdownListeners() {
|
|
2114
|
-
this._handleMouseoverCountryList = (
|
|
2115
|
-
var
|
|
2116
|
-
const
|
|
2117
|
-
|
|
2118
|
+
this._handleMouseoverCountryList = (n) => {
|
|
2119
|
+
var l;
|
|
2120
|
+
const o = (l = n.target) == null ? void 0 : l.closest(".iti__country");
|
|
2121
|
+
o && this._highlightListItem(o, !1);
|
|
2118
2122
|
}, this.countryList.addEventListener(
|
|
2119
2123
|
"mouseover",
|
|
2120
2124
|
this._handleMouseoverCountryList
|
|
2121
|
-
), this._handleClickCountryList = (
|
|
2122
|
-
var
|
|
2123
|
-
const
|
|
2124
|
-
|
|
2125
|
-
}, this.countryList.addEventListener("click", this._handleClickCountryList)
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
);
|
|
2133
|
-
let
|
|
2134
|
-
if (this._handleKeydownOnDropdown = (
|
|
2135
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(
|
|
2136
|
-
|
|
2125
|
+
), this._handleClickCountryList = (n) => {
|
|
2126
|
+
var l;
|
|
2127
|
+
const o = (l = n.target) == null ? void 0 : l.closest(".iti__country");
|
|
2128
|
+
o && this._selectListItem(o);
|
|
2129
|
+
}, this.countryList.addEventListener("click", this._handleClickCountryList), this._handleClickOffToClose = (n) => {
|
|
2130
|
+
!!n.target.closest(`#iti-${this.id}__dropdown-content`) || this._closeDropdown();
|
|
2131
|
+
}, setTimeout(() => {
|
|
2132
|
+
document.documentElement.addEventListener(
|
|
2133
|
+
"click",
|
|
2134
|
+
this._handleClickOffToClose
|
|
2135
|
+
);
|
|
2136
|
+
}, 0);
|
|
2137
|
+
let e = "", i = null;
|
|
2138
|
+
if (this._handleKeydownOnDropdown = (n) => {
|
|
2139
|
+
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(n.key) && (n.preventDefault(), n.stopPropagation(), n.key === "ArrowUp" || n.key === "ArrowDown" ? this._handleUpDownKey(n.key) : n.key === "Enter" ? this._handleEnterKey() : n.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(n.key) && (n.stopPropagation(), i && clearTimeout(i), e += n.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
|
|
2140
|
+
e = "";
|
|
2137
2141
|
}, 1e3));
|
|
2138
2142
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
2139
|
-
const
|
|
2140
|
-
const
|
|
2141
|
-
|
|
2143
|
+
const n = () => {
|
|
2144
|
+
const l = this.searchInput.value.trim();
|
|
2145
|
+
l ? this._filterCountries(l) : this._filterCountries("", !0), this.searchInput.value ? this.searchClearButton.classList.remove("iti__hide") : this.searchClearButton.classList.add("iti__hide");
|
|
2142
2146
|
};
|
|
2143
|
-
let
|
|
2147
|
+
let o = null;
|
|
2144
2148
|
this._handleSearchChange = () => {
|
|
2145
|
-
|
|
2146
|
-
|
|
2149
|
+
o && clearTimeout(o), o = setTimeout(() => {
|
|
2150
|
+
n(), o = null;
|
|
2147
2151
|
}, 100);
|
|
2148
|
-
}, this.searchInput.addEventListener("input", this._handleSearchChange), this._handleSearchClear = (
|
|
2149
|
-
|
|
2150
|
-
}, this.searchClearButton.addEventListener("click", this._handleSearchClear)
|
|
2152
|
+
}, this.searchInput.addEventListener("input", this._handleSearchChange), this._handleSearchClear = () => {
|
|
2153
|
+
this.searchInput.value = "", this.searchInput.focus(), n();
|
|
2154
|
+
}, this.searchClearButton.addEventListener("click", this._handleSearchClear);
|
|
2151
2155
|
}
|
|
2152
2156
|
}
|
|
2153
2157
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2154
2158
|
_searchForCountry(e) {
|
|
2155
2159
|
for (const i of this.countries)
|
|
2156
2160
|
if (i.name.substring(0, e.length).toLowerCase() === e) {
|
|
2157
|
-
const
|
|
2158
|
-
this._highlightListItem(
|
|
2161
|
+
const o = i.nodeById[this.id];
|
|
2162
|
+
this._highlightListItem(o, !1), this._scrollTo(o);
|
|
2159
2163
|
break;
|
|
2160
2164
|
}
|
|
2161
2165
|
}
|
|
2162
2166
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2163
2167
|
_filterCountries(e, i = !1) {
|
|
2164
|
-
let
|
|
2168
|
+
let n = !0;
|
|
2165
2169
|
this.countryList.innerHTML = "";
|
|
2166
|
-
const
|
|
2167
|
-
for (const
|
|
2168
|
-
i || l === 0 ?
|
|
2170
|
+
const o = o2(e), l = o.length, g = [], C = [], c = [], S = [], w = [], b = [];
|
|
2171
|
+
for (const f of this.countries)
|
|
2172
|
+
i || l === 0 ? c.push(f) : f.iso2 === o ? g.push(f) : f.normalisedName.startsWith(o) ? C.push(f) : f.normalisedName.includes(o) ? c.push(f) : o === f.dialCode || o === f.dialCodePlus ? S.push(f) : f.dialCodePlus.includes(o) ? w.push(f) : f.initials.includes(o) && b.push(f);
|
|
2169
2173
|
const L = [
|
|
2170
|
-
...
|
|
2171
|
-
...C.sort((
|
|
2172
|
-
...
|
|
2173
|
-
...S.sort((
|
|
2174
|
-
...w.sort((
|
|
2175
|
-
...b.sort((
|
|
2174
|
+
...g.sort((f, I) => f.priority - I.priority),
|
|
2175
|
+
...C.sort((f, I) => f.priority - I.priority),
|
|
2176
|
+
...c.sort((f, I) => f.priority - I.priority),
|
|
2177
|
+
...S.sort((f, I) => f.priority - I.priority),
|
|
2178
|
+
...w.sort((f, I) => f.priority - I.priority),
|
|
2179
|
+
...b.sort((f, I) => f.priority - I.priority)
|
|
2176
2180
|
];
|
|
2177
|
-
for (const
|
|
2178
|
-
const I =
|
|
2179
|
-
I && (this.countryList.appendChild(I),
|
|
2181
|
+
for (const f of L) {
|
|
2182
|
+
const I = f.nodeById[this.id];
|
|
2183
|
+
I && (this.countryList.appendChild(I), n && (this._highlightListItem(I, !1), n = !1));
|
|
2180
2184
|
}
|
|
2181
|
-
|
|
2185
|
+
n ? (this._highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove("iti__hide")) : this.searchNoResults && this.searchNoResults.classList.add("iti__hide"), this.countryList.scrollTop = 0, this._updateSearchResultsA11yText();
|
|
2182
2186
|
}
|
|
2183
2187
|
//* Update search results text (for a11y).
|
|
2184
2188
|
_updateSearchResultsA11yText() {
|
|
2185
2189
|
const { i18n: e } = this.options, i = this.countryList.childElementCount;
|
|
2186
|
-
let
|
|
2187
|
-
"searchResultsText" in e ?
|
|
2190
|
+
let n;
|
|
2191
|
+
"searchResultsText" in e ? n = e.searchResultsText(i) : i === 0 ? n = e.zeroSearchResults : i === 1 ? n = e.oneSearchResult : n = e.multipleSearchResults.replace("${count}", i.toString()), this.searchResultsA11yText.textContent = n;
|
|
2188
2192
|
}
|
|
2189
2193
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2190
2194
|
_handleUpDownKey(e) {
|
|
2191
|
-
var
|
|
2192
|
-
let i = e === "ArrowUp" ? (
|
|
2195
|
+
var n, o;
|
|
2196
|
+
let i = e === "ArrowUp" ? (n = this.highlightedItem) == null ? void 0 : n.previousElementSibling : (o = this.highlightedItem) == null ? void 0 : o.nextElementSibling;
|
|
2193
2197
|
!i && this.countryList.childElementCount > 1 && (i = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), i && (this._scrollTo(i), this._highlightListItem(i, !1));
|
|
2194
2198
|
}
|
|
2195
2199
|
//* Select the currently highlighted item.
|
|
@@ -2201,11 +2205,11 @@ class p1 {
|
|
|
2201
2205
|
_updateValFromNumber(e) {
|
|
2202
2206
|
let i = e;
|
|
2203
2207
|
if (this.options.formatOnDisplay && m.utils && this.selectedCountryData) {
|
|
2204
|
-
const
|
|
2208
|
+
const n = this.options.nationalMode || i.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: o, INTERNATIONAL: l } = m.utils.numberFormat, g = n ? o : l;
|
|
2205
2209
|
i = m.utils.formatNumber(
|
|
2206
2210
|
i,
|
|
2207
2211
|
this.selectedCountryData.iso2,
|
|
2208
|
-
|
|
2212
|
+
g
|
|
2209
2213
|
);
|
|
2210
2214
|
}
|
|
2211
2215
|
i = this._beforeSetNumber(i), this.telInput.value = i;
|
|
@@ -2217,54 +2221,54 @@ class p1 {
|
|
|
2217
2221
|
return i !== null ? this._setCountry(i) : !1;
|
|
2218
2222
|
}
|
|
2219
2223
|
_ensureHasDialCode(e) {
|
|
2220
|
-
const { dialCode: i, nationalPrefix:
|
|
2224
|
+
const { dialCode: i, nationalPrefix: n } = this.selectedCountryData;
|
|
2221
2225
|
if (e.charAt(0) === "+" || !i)
|
|
2222
2226
|
return e;
|
|
2223
|
-
const
|
|
2224
|
-
return `+${i}${
|
|
2227
|
+
const g = n && e.charAt(0) === n && !this.options.separateDialCode ? e.substring(1) : e;
|
|
2228
|
+
return `+${i}${g}`;
|
|
2225
2229
|
}
|
|
2226
2230
|
// Get the country ISO2 code from the given number
|
|
2227
2231
|
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
2228
2232
|
// NOTE: consider refactoring this to be more clear
|
|
2229
2233
|
_getNewCountryFromNumber(e) {
|
|
2230
2234
|
const i = e.indexOf("+");
|
|
2231
|
-
let
|
|
2232
|
-
const
|
|
2233
|
-
|
|
2234
|
-
const
|
|
2235
|
-
if (
|
|
2236
|
-
const
|
|
2237
|
-
if (!
|
|
2235
|
+
let n = i ? e.substring(i) : e;
|
|
2236
|
+
const o = this.selectedCountryData.iso2, l = this.selectedCountryData.dialCode;
|
|
2237
|
+
n = this._ensureHasDialCode(n);
|
|
2238
|
+
const g = this._getDialCode(n, !0), C = f1(n);
|
|
2239
|
+
if (g) {
|
|
2240
|
+
const c = f1(g), S = this.dialCodeToIso2Map[c];
|
|
2241
|
+
if (!o && this.defaultCountry && S.includes(this.defaultCountry))
|
|
2238
2242
|
return this.defaultCountry;
|
|
2239
|
-
const w = this.selectedCountryData.areaCodes && C.length >
|
|
2240
|
-
if (!(l === "1" &&
|
|
2241
|
-
for (const
|
|
2242
|
-
if (
|
|
2243
|
-
return
|
|
2243
|
+
const w = this.selectedCountryData.areaCodes && C.length > c.length, b = o && S.includes(o) && !w;
|
|
2244
|
+
if (!(l === "1" && u2(C)) && !b) {
|
|
2245
|
+
for (const f of S)
|
|
2246
|
+
if (f)
|
|
2247
|
+
return f;
|
|
2244
2248
|
}
|
|
2245
2249
|
} else {
|
|
2246
|
-
if (
|
|
2250
|
+
if (n.charAt(0) === "+" && C.length)
|
|
2247
2251
|
return "";
|
|
2248
|
-
if ((!
|
|
2252
|
+
if ((!n || n === "+") && !this.selectedCountryData.iso2)
|
|
2249
2253
|
return this.defaultCountry;
|
|
2250
2254
|
}
|
|
2251
2255
|
return null;
|
|
2252
2256
|
}
|
|
2253
2257
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2254
2258
|
_highlightListItem(e, i) {
|
|
2255
|
-
const
|
|
2256
|
-
if (
|
|
2257
|
-
const
|
|
2258
|
-
this.searchInput.setAttribute("aria-activedescendant",
|
|
2259
|
+
const n = this.highlightedItem;
|
|
2260
|
+
if (n && (n.classList.remove("iti__highlight"), n.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true"), this.options.countrySearch)) {
|
|
2261
|
+
const o = this.highlightedItem.getAttribute("id") || "";
|
|
2262
|
+
this.searchInput.setAttribute("aria-activedescendant", o);
|
|
2259
2263
|
}
|
|
2260
2264
|
i && this.highlightedItem.focus();
|
|
2261
2265
|
}
|
|
2262
2266
|
//* Find the country data for the given iso2 code
|
|
2263
2267
|
//* the allowFail option is only used during init() for the initialCountry option, and for the iso2 returned from geoIpLookup - in these 2 cases we don't want to error out
|
|
2264
2268
|
_getCountryData(e, i) {
|
|
2265
|
-
const
|
|
2266
|
-
if (
|
|
2267
|
-
return
|
|
2269
|
+
const n = this.countryByIso2.get(e);
|
|
2270
|
+
if (n)
|
|
2271
|
+
return n;
|
|
2268
2272
|
if (i)
|
|
2269
2273
|
return null;
|
|
2270
2274
|
throw new Error(`No country data for '${e}'`);
|
|
@@ -2272,14 +2276,14 @@ class p1 {
|
|
|
2272
2276
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2273
2277
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2274
2278
|
_setCountry(e) {
|
|
2275
|
-
const { separateDialCode: i, showFlags:
|
|
2279
|
+
const { separateDialCode: i, showFlags: n, i18n: o } = this.options, l = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2276
2280
|
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2277
|
-
let
|
|
2278
|
-
e &&
|
|
2281
|
+
let g = "", C = "";
|
|
2282
|
+
e && n ? (g = `iti__flag iti__${e}`, C = o.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name)) : (g = "iti__flag iti__globe", C = o.noCountrySelected), this.selectedCountryInner.className = g, this.selectedCountry.setAttribute("aria-label", C);
|
|
2279
2283
|
}
|
|
2280
2284
|
if (this._setSelectedCountryTitleAttribute(e, i), i) {
|
|
2281
|
-
const
|
|
2282
|
-
this.selectedDialCode.innerHTML =
|
|
2285
|
+
const g = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2286
|
+
this.selectedDialCode.innerHTML = g, this._updateInputPadding();
|
|
2283
2287
|
}
|
|
2284
2288
|
return this._updatePlaceholder(), this._updateMaxLength(), l.iso2 !== e;
|
|
2285
2289
|
}
|
|
@@ -2292,28 +2296,28 @@ class p1 {
|
|
|
2292
2296
|
}
|
|
2293
2297
|
//* Update the maximum valid number length for the currently selected country.
|
|
2294
2298
|
_updateMaxLength() {
|
|
2295
|
-
const { strictMode: e, placeholderNumberType: i, validationNumberTypes:
|
|
2299
|
+
const { strictMode: e, placeholderNumberType: i, validationNumberTypes: n } = this.options, { iso2: o } = this.selectedCountryData;
|
|
2296
2300
|
if (e && m.utils)
|
|
2297
|
-
if (
|
|
2301
|
+
if (o) {
|
|
2298
2302
|
const l = m.utils.numberType[i];
|
|
2299
|
-
let
|
|
2300
|
-
|
|
2303
|
+
let g = m.utils.getExampleNumber(
|
|
2304
|
+
o,
|
|
2301
2305
|
!1,
|
|
2302
2306
|
l,
|
|
2303
2307
|
!0
|
|
2304
|
-
), C =
|
|
2305
|
-
for (; m.utils.isPossibleNumber(
|
|
2306
|
-
C =
|
|
2307
|
-
const
|
|
2308
|
-
this.maxCoreNumberLength =
|
|
2308
|
+
), C = g;
|
|
2309
|
+
for (; m.utils.isPossibleNumber(g, o, n); )
|
|
2310
|
+
C = g, g += "0";
|
|
2311
|
+
const c = m.utils.getCoreNumber(C, o);
|
|
2312
|
+
this.maxCoreNumberLength = c.length, o === "by" && (this.maxCoreNumberLength = c.length + 1);
|
|
2309
2313
|
} else
|
|
2310
2314
|
this.maxCoreNumberLength = null;
|
|
2311
2315
|
}
|
|
2312
2316
|
_setSelectedCountryTitleAttribute(e = null, i) {
|
|
2313
2317
|
if (!this.selectedCountry)
|
|
2314
2318
|
return;
|
|
2315
|
-
let
|
|
2316
|
-
e && !i ?
|
|
2319
|
+
let n;
|
|
2320
|
+
e && !i ? n = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? n = this.selectedCountryData.name : n = this.options.i18n.noCountrySelected, this.selectedCountry.setAttribute("title", n);
|
|
2317
2321
|
}
|
|
2318
2322
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2319
2323
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
@@ -2325,10 +2329,10 @@ class p1 {
|
|
|
2325
2329
|
e.style.visibility = "hidden", document.body.appendChild(e);
|
|
2326
2330
|
const i = this.countryContainer.cloneNode();
|
|
2327
2331
|
e.appendChild(i);
|
|
2328
|
-
const
|
|
2329
|
-
i.appendChild(
|
|
2330
|
-
const
|
|
2331
|
-
return document.body.removeChild(e),
|
|
2332
|
+
const n = this.selectedCountry.cloneNode(!0);
|
|
2333
|
+
i.appendChild(n);
|
|
2334
|
+
const o = n.offsetWidth;
|
|
2335
|
+
return document.body.removeChild(e), o;
|
|
2332
2336
|
}
|
|
2333
2337
|
return 0;
|
|
2334
2338
|
}
|
|
@@ -2337,17 +2341,17 @@ class p1 {
|
|
|
2337
2341
|
const {
|
|
2338
2342
|
autoPlaceholder: e,
|
|
2339
2343
|
placeholderNumberType: i,
|
|
2340
|
-
nationalMode:
|
|
2341
|
-
customPlaceholder:
|
|
2344
|
+
nationalMode: n,
|
|
2345
|
+
customPlaceholder: o
|
|
2342
2346
|
} = this.options, l = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
2343
2347
|
if (m.utils && l) {
|
|
2344
|
-
const
|
|
2348
|
+
const g = m.utils.numberType[i];
|
|
2345
2349
|
let C = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
|
|
2346
2350
|
this.selectedCountryData.iso2,
|
|
2347
|
-
|
|
2348
|
-
|
|
2351
|
+
n,
|
|
2352
|
+
g
|
|
2349
2353
|
) : "";
|
|
2350
|
-
C = this._beforeSetNumber(C), typeof
|
|
2354
|
+
C = this._beforeSetNumber(C), typeof o == "function" && (C = o(C, this.selectedCountryData)), this.telInput.setAttribute("placeholder", C);
|
|
2351
2355
|
}
|
|
2352
2356
|
}
|
|
2353
2357
|
//* Called when the user selects a list item from the dropdown.
|
|
@@ -2369,62 +2373,62 @@ class p1 {
|
|
|
2369
2373
|
}
|
|
2370
2374
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2371
2375
|
_scrollTo(e) {
|
|
2372
|
-
const i = this.countryList,
|
|
2373
|
-
if (
|
|
2376
|
+
const i = this.countryList, n = document.documentElement.scrollTop, o = i.offsetHeight, l = i.getBoundingClientRect().top + n, g = l + o, C = e.offsetHeight, c = e.getBoundingClientRect().top + n, S = c + C, w = c - l + i.scrollTop;
|
|
2377
|
+
if (c < l)
|
|
2374
2378
|
i.scrollTop = w;
|
|
2375
|
-
else if (S >
|
|
2376
|
-
const b =
|
|
2379
|
+
else if (S > g) {
|
|
2380
|
+
const b = o - C;
|
|
2377
2381
|
i.scrollTop = w - b;
|
|
2378
2382
|
}
|
|
2379
2383
|
}
|
|
2380
2384
|
//* Replace any existing dial code with the new one
|
|
2381
2385
|
//* Note: called from _selectListItem and setCountry
|
|
2382
2386
|
_updateDialCode(e) {
|
|
2383
|
-
const i = this.telInput.value,
|
|
2384
|
-
let
|
|
2387
|
+
const i = this.telInput.value, n = `+${e}`;
|
|
2388
|
+
let o;
|
|
2385
2389
|
if (i.charAt(0) === "+") {
|
|
2386
2390
|
const l = this._getDialCode(i);
|
|
2387
|
-
l ?
|
|
2391
|
+
l ? o = i.replace(l, n) : o = n, this.telInput.value = o;
|
|
2388
2392
|
}
|
|
2389
2393
|
}
|
|
2390
2394
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2391
2395
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2392
2396
|
_getDialCode(e, i) {
|
|
2393
|
-
let
|
|
2397
|
+
let n = "";
|
|
2394
2398
|
if (e.charAt(0) === "+") {
|
|
2395
|
-
let
|
|
2399
|
+
let o = "";
|
|
2396
2400
|
for (let l = 0; l < e.length; l++) {
|
|
2397
|
-
const
|
|
2398
|
-
if (!isNaN(parseInt(
|
|
2399
|
-
if (
|
|
2400
|
-
this.dialCodeToIso2Map[
|
|
2401
|
-
else if (this.dialCodes.has(
|
|
2402
|
-
|
|
2401
|
+
const g = e.charAt(l);
|
|
2402
|
+
if (!isNaN(parseInt(g, 10))) {
|
|
2403
|
+
if (o += g, i)
|
|
2404
|
+
this.dialCodeToIso2Map[o] && (n = e.substring(0, l + 1));
|
|
2405
|
+
else if (this.dialCodes.has(o)) {
|
|
2406
|
+
n = e.substring(0, l + 1);
|
|
2403
2407
|
break;
|
|
2404
2408
|
}
|
|
2405
|
-
if (
|
|
2409
|
+
if (o.length === this.dialCodeMaxLen)
|
|
2406
2410
|
break;
|
|
2407
2411
|
}
|
|
2408
2412
|
}
|
|
2409
2413
|
}
|
|
2410
|
-
return
|
|
2414
|
+
return n;
|
|
2411
2415
|
}
|
|
2412
2416
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2413
2417
|
_getFullNumber(e) {
|
|
2414
|
-
const i = e || this.telInput.value.trim(), { dialCode:
|
|
2415
|
-
let
|
|
2418
|
+
const i = e || this.telInput.value.trim(), { dialCode: n } = this.selectedCountryData;
|
|
2419
|
+
let o;
|
|
2416
2420
|
const l = f1(i);
|
|
2417
|
-
return this.options.separateDialCode && i.charAt(0) !== "+" &&
|
|
2421
|
+
return this.options.separateDialCode && i.charAt(0) !== "+" && n && l ? o = `+${n}` : o = "", o + i;
|
|
2418
2422
|
}
|
|
2419
2423
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2420
2424
|
_beforeSetNumber(e) {
|
|
2421
2425
|
let i = e;
|
|
2422
2426
|
if (this.options.separateDialCode) {
|
|
2423
|
-
let
|
|
2424
|
-
if (
|
|
2425
|
-
|
|
2426
|
-
const
|
|
2427
|
-
i = i.substring(
|
|
2427
|
+
let n = this._getDialCode(i);
|
|
2428
|
+
if (n) {
|
|
2429
|
+
n = `+${this.selectedCountryData.dialCode}`;
|
|
2430
|
+
const o = i[n.length] === " " || i[n.length] === "-" ? n.length + 1 : n.length;
|
|
2431
|
+
i = i.substring(o);
|
|
2428
2432
|
}
|
|
2429
2433
|
}
|
|
2430
2434
|
return this._cap(i);
|
|
@@ -2435,8 +2439,8 @@ class p1 {
|
|
|
2435
2439
|
}
|
|
2436
2440
|
//* Format the number as the user types.
|
|
2437
2441
|
_formatNumberAsYouType() {
|
|
2438
|
-
const e = this._getFullNumber(), i = m.utils ? m.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode:
|
|
2439
|
-
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${
|
|
2442
|
+
const e = this._getFullNumber(), i = m.utils ? m.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: n } = this.selectedCountryData;
|
|
2443
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${n}`) ? (i.split(`+${n}`)[1] || "").trim() : i;
|
|
2440
2444
|
}
|
|
2441
2445
|
//**************************
|
|
2442
2446
|
//* SECRET PUBLIC METHODS
|
|
@@ -2454,7 +2458,7 @@ class p1 {
|
|
|
2454
2458
|
//********************
|
|
2455
2459
|
//* Remove plugin.
|
|
2456
2460
|
destroy() {
|
|
2457
|
-
var l,
|
|
2461
|
+
var l, g;
|
|
2458
2462
|
this.telInput.iti = void 0;
|
|
2459
2463
|
const { allowDropdown: e, separateDialCode: i } = this.options;
|
|
2460
2464
|
if (e) {
|
|
@@ -2468,10 +2472,10 @@ class p1 {
|
|
|
2468
2472
|
const C = this.telInput.closest("label");
|
|
2469
2473
|
C && C.removeEventListener("click", this._handleLabelClick);
|
|
2470
2474
|
}
|
|
2471
|
-
const { form:
|
|
2472
|
-
this._handleHiddenInputSubmit &&
|
|
2473
|
-
const
|
|
2474
|
-
(l =
|
|
2475
|
+
const { form: n } = this.telInput;
|
|
2476
|
+
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);
|
|
2477
|
+
const o = this.telInput.parentNode;
|
|
2478
|
+
(l = o == null ? void 0 : o.parentNode) == null || l.insertBefore(this.telInput, o), (g = o == null ? void 0 : o.parentNode) == null || g.removeChild(o), delete m.instances[this.id];
|
|
2475
2479
|
}
|
|
2476
2480
|
//* Get the extension from the current number.
|
|
2477
2481
|
getExtension() {
|
|
@@ -2526,20 +2530,20 @@ class p1 {
|
|
|
2526
2530
|
_validateNumber(e) {
|
|
2527
2531
|
if (!this.selectedCountryData.iso2)
|
|
2528
2532
|
return !1;
|
|
2529
|
-
const i = this._getFullNumber(),
|
|
2530
|
-
if (
|
|
2531
|
-
const l = i.substring(0,
|
|
2532
|
-
return
|
|
2533
|
+
const i = this._getFullNumber(), n = i.search(new RegExp("\\p{L}", "u")), o = (l) => e ? this._utilsIsValidNumber(l) : this._utilsIsPossibleNumber(l);
|
|
2534
|
+
if (n > -1) {
|
|
2535
|
+
const l = i.substring(0, n), g = o(l), C = o(i);
|
|
2536
|
+
return g && C;
|
|
2533
2537
|
}
|
|
2534
|
-
return
|
|
2538
|
+
return o(i);
|
|
2535
2539
|
}
|
|
2536
2540
|
_utilsIsValidNumber(e) {
|
|
2537
2541
|
return m.utils ? m.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2538
2542
|
}
|
|
2539
2543
|
//* Update the selected country, and update the input val accordingly.
|
|
2540
2544
|
setCountry(e) {
|
|
2541
|
-
const i = e == null ? void 0 : e.toLowerCase(),
|
|
2542
|
-
(e && i !==
|
|
2545
|
+
const i = e == null ? void 0 : e.toLowerCase(), n = this.selectedCountryData.iso2;
|
|
2546
|
+
(e && i !== n || !e && n) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2543
2547
|
}
|
|
2544
2548
|
//* Set the input value and update the country.
|
|
2545
2549
|
setNumber(e) {
|
|
@@ -2566,10 +2570,10 @@ const Z2 = (y) => {
|
|
|
2566
2570
|
else
|
|
2567
2571
|
return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof y}`));
|
|
2568
2572
|
return m.startedLoadingUtilsScript = !0, e.then((i) => {
|
|
2569
|
-
const
|
|
2570
|
-
if (!
|
|
2573
|
+
const n = i == null ? void 0 : i.default;
|
|
2574
|
+
if (!n || typeof n != "object")
|
|
2571
2575
|
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
2572
|
-
return m.utils =
|
|
2576
|
+
return m.utils = n, i1("handleUtils"), !0;
|
|
2573
2577
|
}).catch((i) => {
|
|
2574
2578
|
throw i1("rejectUtilsScriptPromise", i), i;
|
|
2575
2579
|
});
|
|
@@ -2596,7 +2600,7 @@ const Z2 = (y) => {
|
|
|
2596
2600
|
attachUtils: Z2,
|
|
2597
2601
|
startedLoadingUtilsScript: !1,
|
|
2598
2602
|
startedLoadingAutoCountry: !1,
|
|
2599
|
-
version: "25.8.
|
|
2603
|
+
version: "25.8.2"
|
|
2600
2604
|
}
|
|
2601
2605
|
);
|
|
2602
2606
|
(function() {
|
|
@@ -2605,23 +2609,23 @@ const Z2 = (y) => {
|
|
|
2605
2609
|
d = d.split(".");
|
|
2606
2610
|
var $ = y;
|
|
2607
2611
|
d[0] in $ || typeof $.execScript > "u" || $.execScript("var " + d[0]);
|
|
2608
|
-
for (var
|
|
2612
|
+
for (var s; d.length && (s = d.shift()); ) d.length || t === void 0 ? $[s] && $[s] !== Object.prototype[s] ? $ = $[s] : $ = $[s] = {} : $[s] = t;
|
|
2609
2613
|
}
|
|
2610
2614
|
function i(d, t) {
|
|
2611
2615
|
function $() {
|
|
2612
2616
|
}
|
|
2613
|
-
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(
|
|
2614
|
-
for (var
|
|
2615
|
-
return t.prototype[
|
|
2617
|
+
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(s, r, u) {
|
|
2618
|
+
for (var a = Array(arguments.length - 2), h = 2; h < arguments.length; h++) a[h - 2] = arguments[h];
|
|
2619
|
+
return t.prototype[r].apply(s, a);
|
|
2616
2620
|
};
|
|
2617
2621
|
}
|
|
2618
|
-
function
|
|
2622
|
+
function n(d) {
|
|
2619
2623
|
const t = [];
|
|
2620
2624
|
let $ = 0;
|
|
2621
|
-
for (const
|
|
2625
|
+
for (const s in d) t[$++] = d[s];
|
|
2622
2626
|
return t;
|
|
2623
2627
|
}
|
|
2624
|
-
var
|
|
2628
|
+
var o = class {
|
|
2625
2629
|
constructor(d) {
|
|
2626
2630
|
if (l !== l) throw Error("SafeUrl is not meant to be built directly");
|
|
2627
2631
|
this.g = d;
|
|
@@ -2630,21 +2634,21 @@ const Z2 = (y) => {
|
|
|
2630
2634
|
return this.g.toString();
|
|
2631
2635
|
}
|
|
2632
2636
|
}, l = {};
|
|
2633
|
-
new
|
|
2634
|
-
const
|
|
2637
|
+
new o("about:invalid#zClosurez"), new o("about:blank");
|
|
2638
|
+
const g = {};
|
|
2635
2639
|
class C {
|
|
2636
2640
|
constructor() {
|
|
2637
|
-
if (
|
|
2641
|
+
if (g !== g) throw Error("SafeStyle is not meant to be built directly");
|
|
2638
2642
|
}
|
|
2639
2643
|
toString() {
|
|
2640
2644
|
return "";
|
|
2641
2645
|
}
|
|
2642
2646
|
}
|
|
2643
2647
|
new C();
|
|
2644
|
-
const
|
|
2648
|
+
const c = {};
|
|
2645
2649
|
class S {
|
|
2646
2650
|
constructor() {
|
|
2647
|
-
if (
|
|
2651
|
+
if (c !== c) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
2648
2652
|
}
|
|
2649
2653
|
toString() {
|
|
2650
2654
|
return "";
|
|
@@ -2668,15 +2672,15 @@ const Z2 = (y) => {
|
|
|
2668
2672
|
case G:
|
|
2669
2673
|
case U:
|
|
2670
2674
|
case D:
|
|
2671
|
-
case
|
|
2675
|
+
case x:
|
|
2672
2676
|
case Y:
|
|
2673
2677
|
case I:
|
|
2674
|
-
case
|
|
2678
|
+
case f:
|
|
2675
2679
|
this.o = !0;
|
|
2676
2680
|
}
|
|
2677
2681
|
this.j = t.defaultValue;
|
|
2678
2682
|
}
|
|
2679
|
-
var
|
|
2683
|
+
var f = 1, I = 2, G = 3, U = 4, D = 6, x = 16, Y = 18;
|
|
2680
2684
|
function c2(d, t) {
|
|
2681
2685
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
2682
2686
|
var $ = t[d];
|
|
@@ -2684,7 +2688,7 @@ const Z2 = (y) => {
|
|
|
2684
2688
|
}
|
|
2685
2689
|
}
|
|
2686
2690
|
function f2(d) {
|
|
2687
|
-
return d =
|
|
2691
|
+
return d = n(d.g), d.sort(function(t, $) {
|
|
2688
2692
|
return t.g - $.g;
|
|
2689
2693
|
}), d;
|
|
2690
2694
|
}
|
|
@@ -2694,22 +2698,22 @@ const Z2 = (y) => {
|
|
|
2694
2698
|
R.prototype.has = function(d) {
|
|
2695
2699
|
return B(this, d.g);
|
|
2696
2700
|
}, R.prototype.get = function(d, t) {
|
|
2697
|
-
return
|
|
2701
|
+
return p(this, d.g, t);
|
|
2698
2702
|
}, R.prototype.set = function(d, t) {
|
|
2699
2703
|
E(this, d.g, t);
|
|
2700
2704
|
}, R.prototype.add = function(d, t) {
|
|
2701
2705
|
b1(this, d.g, t);
|
|
2702
2706
|
};
|
|
2703
2707
|
function w1(d, t) {
|
|
2704
|
-
for (var $ = f2(d.m()),
|
|
2705
|
-
var
|
|
2706
|
-
if (B(t,
|
|
2707
|
-
d.g && delete d.g[
|
|
2708
|
-
var
|
|
2709
|
-
if (
|
|
2710
|
-
|
|
2711
|
-
for (var h = 0; h <
|
|
2712
|
-
} else
|
|
2708
|
+
for (var $ = f2(d.m()), s = 0; s < $.length; s++) {
|
|
2709
|
+
var r = $[s], u = r.g;
|
|
2710
|
+
if (B(t, u)) {
|
|
2711
|
+
d.g && delete d.g[r.g];
|
|
2712
|
+
var a = r.h == 11 || r.h == 10;
|
|
2713
|
+
if (r.l) {
|
|
2714
|
+
r = P(t, u);
|
|
2715
|
+
for (var h = 0; h < r.length; h++) b1(d, u, a ? r[h].clone() : r[h]);
|
|
2716
|
+
} else r = n1(t, u), a ? (a = n1(d, u)) ? w1(a, r) : E(d, u, r.clone()) : E(d, u, r);
|
|
2713
2717
|
}
|
|
2714
2718
|
}
|
|
2715
2719
|
}
|
|
@@ -2725,23 +2729,23 @@ const Z2 = (y) => {
|
|
|
2725
2729
|
if ($ == null) return null;
|
|
2726
2730
|
if (d.l) {
|
|
2727
2731
|
if (!(t in d.g)) {
|
|
2728
|
-
var
|
|
2729
|
-
if ($ != null) if (
|
|
2730
|
-
for (var
|
|
2731
|
-
$ =
|
|
2732
|
-
} else $ =
|
|
2732
|
+
var s = d.l, r = d.j[t];
|
|
2733
|
+
if ($ != null) if (r.l) {
|
|
2734
|
+
for (var u = [], a = 0; a < $.length; a++) u[a] = s.h(r, $[a]);
|
|
2735
|
+
$ = u;
|
|
2736
|
+
} else $ = s.h(r, $);
|
|
2733
2737
|
return d.g[t] = $;
|
|
2734
2738
|
}
|
|
2735
2739
|
return d.g[t];
|
|
2736
2740
|
}
|
|
2737
2741
|
return $;
|
|
2738
2742
|
}
|
|
2739
|
-
function
|
|
2740
|
-
var
|
|
2741
|
-
return d.j[t].l ?
|
|
2743
|
+
function p(d, t, $) {
|
|
2744
|
+
var s = n1(d, t);
|
|
2745
|
+
return d.j[t].l ? s[$ || 0] : s;
|
|
2742
2746
|
}
|
|
2743
2747
|
function v(d, t) {
|
|
2744
|
-
if (B(d, t)) d =
|
|
2748
|
+
if (B(d, t)) d = p(d, t);
|
|
2745
2749
|
else d: {
|
|
2746
2750
|
if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
|
|
2747
2751
|
else if (t === Number) d.j = 0;
|
|
@@ -2754,7 +2758,7 @@ const Z2 = (y) => {
|
|
|
2754
2758
|
}
|
|
2755
2759
|
return d;
|
|
2756
2760
|
}
|
|
2757
|
-
function
|
|
2761
|
+
function P(d, t) {
|
|
2758
2762
|
return n1(d, t) || [];
|
|
2759
2763
|
}
|
|
2760
2764
|
function K(d, t) {
|
|
@@ -2767,8 +2771,8 @@ const Z2 = (y) => {
|
|
|
2767
2771
|
d.h[t] || (d.h[t] = []), d.h[t].push($), d.g && delete d.g[t];
|
|
2768
2772
|
}
|
|
2769
2773
|
function s1(d, t) {
|
|
2770
|
-
var $ = [],
|
|
2771
|
-
for (
|
|
2774
|
+
var $ = [], s;
|
|
2775
|
+
for (s in t) s != 0 && $.push(new L(s, t[s]));
|
|
2772
2776
|
return new c2(d, $);
|
|
2773
2777
|
}
|
|
2774
2778
|
function r1() {
|
|
@@ -2803,7 +2807,7 @@ const Z2 = (y) => {
|
|
|
2803
2807
|
A.prototype.h = "", A.prototype.set = function(d) {
|
|
2804
2808
|
this.h = "" + d;
|
|
2805
2809
|
}, A.prototype.g = function(d, t, $) {
|
|
2806
|
-
if (this.h += String(d), t != null) for (let
|
|
2810
|
+
if (this.h += String(d), t != null) for (let s = 1; s < arguments.length; s++) this.h += arguments[s];
|
|
2807
2811
|
return this;
|
|
2808
2812
|
};
|
|
2809
2813
|
function k(d) {
|
|
@@ -8298,10 +8302,10 @@ const Z2 = (y) => {
|
|
|
8298
8302
|
function J(d) {
|
|
8299
8303
|
return "([0-90-9٠-٩۰-۹]{1," + d + "})";
|
|
8300
8304
|
}
|
|
8301
|
-
function
|
|
8305
|
+
function P1() {
|
|
8302
8306
|
return ";ext=" + J("20") + "|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[ \\t,-]*" + (J("20") + "#?|[ \\t,]*(?:[xx##~~]|int|int)[:\\..]?[ \\t,-]*") + (J("9") + "#?|[- ]+") + (J("6") + "#|[ \\t]*(?:,{2}|;)[:\\..]?[ \\t,-]*") + (J("15") + "#?|[ \\t]*(?:,)+[:\\..]?[ \\t,-]*") + (J("9") + "#?");
|
|
8303
8307
|
}
|
|
8304
|
-
var
|
|
8308
|
+
var x1 = new RegExp("(?:" + P1() + ")$", "i"), b2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + P1() + ")?$", "i"), L2 = /(\$\d)/, N2 = /^\(?\$1\)?$/;
|
|
8305
8309
|
function R1(d) {
|
|
8306
8310
|
return 2 > d.length ? !1 : F(b2, d);
|
|
8307
8311
|
}
|
|
@@ -8313,91 +8317,91 @@ const Z2 = (y) => {
|
|
|
8313
8317
|
k(d), d.g(t);
|
|
8314
8318
|
}
|
|
8315
8319
|
function O1(d) {
|
|
8316
|
-
return d != null && (K(d, 9) != 1 ||
|
|
8320
|
+
return d != null && (K(d, 9) != 1 || P(d, 9)[0] != -1);
|
|
8317
8321
|
}
|
|
8318
8322
|
function o1(d, t) {
|
|
8319
|
-
for (var $ = new A(),
|
|
8323
|
+
for (var $ = new A(), s, r = d.length, u = 0; u < r; ++u) s = d.charAt(u), s = t[s.toUpperCase()], s != null && $.g(s);
|
|
8320
8324
|
return $.toString();
|
|
8321
8325
|
}
|
|
8322
8326
|
function G1(d) {
|
|
8323
8327
|
return d.length == 0 || N2.test(d);
|
|
8324
8328
|
}
|
|
8325
|
-
function
|
|
8329
|
+
function u1(d) {
|
|
8326
8330
|
return d != null && isNaN(d) && d.toUpperCase() in M1;
|
|
8327
8331
|
}
|
|
8328
8332
|
M.prototype.format = function(d, t) {
|
|
8329
|
-
if (
|
|
8333
|
+
if (p(d, 2) == 0 && B(d, 5)) {
|
|
8330
8334
|
var $ = v(d, 5);
|
|
8331
8335
|
if (0 < $.length) return $;
|
|
8332
8336
|
}
|
|
8333
8337
|
$ = v(d, 1);
|
|
8334
|
-
var
|
|
8335
|
-
if (t == 0) return U1($, 0,
|
|
8336
|
-
if (!($ in Q)) return
|
|
8337
|
-
var
|
|
8338
|
-
d = B(d, 3) &&
|
|
8338
|
+
var s = e1(d);
|
|
8339
|
+
if (t == 0) return U1($, 0, s, "");
|
|
8340
|
+
if (!($ in Q)) return s;
|
|
8341
|
+
var r = t1(this, $, $1($));
|
|
8342
|
+
d = B(d, 3) && p(d, 3).length != 0 ? t == 3 ? ";ext=" + p(d, 3) : B(r, 13) ? p(r, 13) + v(d, 3) : " ext. " + v(d, 3) : "";
|
|
8339
8343
|
d: {
|
|
8340
|
-
|
|
8341
|
-
for (var
|
|
8342
|
-
|
|
8343
|
-
var _ = K(
|
|
8344
|
-
if ((_ == 0 ||
|
|
8345
|
-
|
|
8344
|
+
r = P(r, 20).length == 0 || t == 2 ? P(r, 19) : P(r, 20);
|
|
8345
|
+
for (var u, a = r.length, h = 0; h < a; ++h) {
|
|
8346
|
+
u = r[h];
|
|
8347
|
+
var _ = K(u, 3);
|
|
8348
|
+
if ((_ == 0 || s.search(p(u, 3, _ - 1)) == 0) && (_ = new RegExp(p(u, 1)), F(_, s))) {
|
|
8349
|
+
r = u;
|
|
8346
8350
|
break d;
|
|
8347
8351
|
}
|
|
8348
8352
|
}
|
|
8349
|
-
|
|
8353
|
+
r = null;
|
|
8350
8354
|
}
|
|
8351
|
-
return
|
|
8352
|
-
|
|
8355
|
+
return r != null && (a = r, r = v(a, 2), u = new RegExp(p(a, 1)), v(
|
|
8356
|
+
a,
|
|
8353
8357
|
5
|
|
8354
|
-
),
|
|
8358
|
+
), a = v(a, 4), s = t == 2 && a != null && 0 < a.length ? s.replace(u, r.replace(L2, a)) : s.replace(u, r), t == 3 && (s = s.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), s = s.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), U1($, t, s, d);
|
|
8355
8359
|
};
|
|
8356
8360
|
function t1(d, t, $) {
|
|
8357
8361
|
return $ == "001" ? j(d, "" + t) : j(d, $);
|
|
8358
8362
|
}
|
|
8359
8363
|
function e1(d) {
|
|
8360
8364
|
if (!B(d, 2)) return "";
|
|
8361
|
-
var t = "" +
|
|
8362
|
-
return B(d, 4) &&
|
|
8365
|
+
var t = "" + p(d, 2);
|
|
8366
|
+
return B(d, 4) && p(d, 4) && 0 < v(d, 8) ? Array(v(d, 8) + 1).join("0") + t : t;
|
|
8363
8367
|
}
|
|
8364
|
-
function U1(d, t, $,
|
|
8368
|
+
function U1(d, t, $, s) {
|
|
8365
8369
|
switch (t) {
|
|
8366
8370
|
case 0:
|
|
8367
|
-
return "+" + d + $ +
|
|
8371
|
+
return "+" + d + $ + s;
|
|
8368
8372
|
case 1:
|
|
8369
|
-
return "+" + d + " " + $ +
|
|
8373
|
+
return "+" + d + " " + $ + s;
|
|
8370
8374
|
case 3:
|
|
8371
|
-
return "tel:+" + d + "-" + $ +
|
|
8375
|
+
return "tel:+" + d + "-" + $ + s;
|
|
8372
8376
|
default:
|
|
8373
|
-
return $ +
|
|
8377
|
+
return $ + s;
|
|
8374
8378
|
}
|
|
8375
8379
|
}
|
|
8376
|
-
function
|
|
8380
|
+
function a1(d, t) {
|
|
8377
8381
|
switch (t) {
|
|
8378
8382
|
case 4:
|
|
8379
|
-
return
|
|
8383
|
+
return p(d, 5);
|
|
8380
8384
|
case 3:
|
|
8381
|
-
return
|
|
8385
|
+
return p(d, 4);
|
|
8382
8386
|
case 1:
|
|
8383
|
-
return
|
|
8387
|
+
return p(d, 3);
|
|
8384
8388
|
case 0:
|
|
8385
8389
|
case 2:
|
|
8386
|
-
return
|
|
8390
|
+
return p(d, 2);
|
|
8387
8391
|
case 5:
|
|
8388
|
-
return
|
|
8392
|
+
return p(d, 6);
|
|
8389
8393
|
case 6:
|
|
8390
|
-
return
|
|
8394
|
+
return p(d, 8);
|
|
8391
8395
|
case 7:
|
|
8392
|
-
return
|
|
8396
|
+
return p(d, 7);
|
|
8393
8397
|
case 8:
|
|
8394
|
-
return
|
|
8398
|
+
return p(d, 21);
|
|
8395
8399
|
case 9:
|
|
8396
|
-
return
|
|
8400
|
+
return p(d, 25);
|
|
8397
8401
|
case 10:
|
|
8398
|
-
return
|
|
8402
|
+
return p(d, 28);
|
|
8399
8403
|
default:
|
|
8400
|
-
return
|
|
8404
|
+
return p(d, 1);
|
|
8401
8405
|
}
|
|
8402
8406
|
}
|
|
8403
8407
|
function F1(d, t) {
|
|
@@ -8405,7 +8409,7 @@ const Z2 = (y) => {
|
|
|
8405
8409
|
return d = t1(d, v(t, 1), $), d == null ? -1 : (t = e1(t), m1(t, d));
|
|
8406
8410
|
}
|
|
8407
8411
|
function m1(d, t) {
|
|
8408
|
-
return O(d,
|
|
8412
|
+
return O(d, p(t, 1)) ? O(d, p(t, 5)) ? 4 : O(d, p(t, 4)) ? 3 : O(d, p(t, 6)) ? 5 : O(d, p(t, 8)) ? 6 : O(d, p(t, 7)) ? 7 : O(d, p(t, 21)) ? 8 : O(d, p(t, 25)) ? 9 : O(d, p(t, 28)) ? 10 : O(d, p(t, 2)) ? p(t, 18) || O(d, p(t, 3)) ? 2 : 0 : !p(t, 18) && O(d, p(t, 3)) ? 1 : -1 : -1;
|
|
8409
8413
|
}
|
|
8410
8414
|
function j(d, t) {
|
|
8411
8415
|
if (t == null) return null;
|
|
@@ -8419,11 +8423,11 @@ const Z2 = (y) => {
|
|
|
8419
8423
|
}
|
|
8420
8424
|
function O(d, t) {
|
|
8421
8425
|
var $ = d.length;
|
|
8422
|
-
return 0 < K(t, 9) &&
|
|
8426
|
+
return 0 < K(t, 9) && P(t, 9).indexOf($) == -1 ? !1 : F(v(t, 2), d);
|
|
8423
8427
|
}
|
|
8424
8428
|
function T2(d, t) {
|
|
8425
|
-
var $ = V1(d, t),
|
|
8426
|
-
return
|
|
8429
|
+
var $ = V1(d, t), s = v(t, 1), r = t1(d, s, $);
|
|
8430
|
+
return r == null || $ != "001" && s != K1(d, $) ? r = !1 : (d = e1(t), r = m1(d, r) != -1), r;
|
|
8427
8431
|
}
|
|
8428
8432
|
function V1(d, t) {
|
|
8429
8433
|
if (t == null) return null;
|
|
@@ -8432,16 +8436,16 @@ const Z2 = (y) => {
|
|
|
8432
8436
|
else if ($.length == 1) d = $[0];
|
|
8433
8437
|
else d: {
|
|
8434
8438
|
t = e1(t);
|
|
8435
|
-
for (var
|
|
8436
|
-
|
|
8437
|
-
var
|
|
8438
|
-
if (B(
|
|
8439
|
-
if (t.search(
|
|
8440
|
-
d =
|
|
8439
|
+
for (var s, r = $.length, u = 0; u < r; u++) {
|
|
8440
|
+
s = $[u];
|
|
8441
|
+
var a = j(d, s);
|
|
8442
|
+
if (B(a, 23)) {
|
|
8443
|
+
if (t.search(p(a, 23)) == 0) {
|
|
8444
|
+
d = s;
|
|
8441
8445
|
break d;
|
|
8442
8446
|
}
|
|
8443
|
-
} else if (m1(t,
|
|
8444
|
-
d =
|
|
8447
|
+
} else if (m1(t, a) != -1) {
|
|
8448
|
+
d = s;
|
|
8445
8449
|
break d;
|
|
8446
8450
|
}
|
|
8447
8451
|
}
|
|
@@ -8456,102 +8460,102 @@ const Z2 = (y) => {
|
|
|
8456
8460
|
if (d = j(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8457
8461
|
return v(d, 10);
|
|
8458
8462
|
}
|
|
8459
|
-
function l1(d, t, $,
|
|
8460
|
-
var
|
|
8461
|
-
if (
|
|
8463
|
+
function l1(d, t, $, s) {
|
|
8464
|
+
var r = a1($, s), u = K(r, 9) == 0 ? P(p($, 1), 9) : P(r, 9);
|
|
8465
|
+
if (r = P(r, 10), s == 2) if (O1(a1($, 0))) d = a1($, 1), O1(d) && (u = u.concat(K(d, 9) == 0 ? P(p($, 1), 9) : P(d, 9)), u.sort(), r.length == 0 ? r = P(d, 10) : (r = r.concat(P(d, 10)), r.sort()));
|
|
8462
8466
|
else return l1(d, t, $, 1);
|
|
8463
|
-
return
|
|
8467
|
+
return u[0] == -1 ? 5 : (t = t.length, -1 < r.indexOf(t) ? 4 : ($ = u[0], $ == t ? 0 : $ > t ? 2 : u[u.length - 1] < t ? 3 : -1 < u.indexOf(t, 1) ? 0 : 5));
|
|
8464
8468
|
}
|
|
8465
8469
|
function h1(d, t, $) {
|
|
8466
|
-
var
|
|
8467
|
-
return t = v(t, 1), t in Q ? (t = t1(d, t, $1(t)), l1(d,
|
|
8470
|
+
var s = e1(t);
|
|
8471
|
+
return t = v(t, 1), t in Q ? (t = t1(d, t, $1(t)), l1(d, s, t, $)) : 1;
|
|
8468
8472
|
}
|
|
8469
8473
|
function H1(d, t) {
|
|
8470
8474
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8471
|
-
for (var $,
|
|
8475
|
+
for (var $, s = d.length, r = 1; 3 >= r && r <= s; ++r) if ($ = parseInt(d.substring(0, r), 10), $ in Q) return t.g(d.substring(r)), $;
|
|
8472
8476
|
return 0;
|
|
8473
8477
|
}
|
|
8474
|
-
function j1(d, t, $,
|
|
8478
|
+
function j1(d, t, $, s, r, u) {
|
|
8475
8479
|
if (t.length == 0) return 0;
|
|
8476
8480
|
t = new A(t);
|
|
8477
|
-
var
|
|
8478
|
-
$ != null && (
|
|
8481
|
+
var a;
|
|
8482
|
+
$ != null && (a = p($, 11)), a == null && (a = "NonMatch");
|
|
8479
8483
|
var h = t.toString();
|
|
8480
|
-
if (h.length == 0)
|
|
8481
|
-
else if (d1.test(h)) h = h.replace(d1, ""), k(t), t.g(B1(h)),
|
|
8484
|
+
if (h.length == 0) a = 20;
|
|
8485
|
+
else if (d1.test(h)) h = h.replace(d1, ""), k(t), t.g(B1(h)), a = 1;
|
|
8482
8486
|
else {
|
|
8483
|
-
if (h = new RegExp(
|
|
8484
|
-
h =
|
|
8485
|
-
var _ =
|
|
8486
|
-
_ && _[1] != null && 0 < _[1].length && o1(_[1], C1) == "0" ?
|
|
8487
|
-
} else
|
|
8488
|
-
|
|
8487
|
+
if (h = new RegExp(a), k1(t), a = t.toString(), a.search(h) == 0) {
|
|
8488
|
+
h = a.match(h)[0].length;
|
|
8489
|
+
var _ = a.substring(h).match(D1);
|
|
8490
|
+
_ && _[1] != null && 0 < _[1].length && o1(_[1], C1) == "0" ? a = !1 : (k(t), t.g(a.substring(h)), a = !0);
|
|
8491
|
+
} else a = !1;
|
|
8492
|
+
a = a ? 5 : 20;
|
|
8489
8493
|
}
|
|
8490
|
-
if (
|
|
8494
|
+
if (r && E(u, 6, a), a != 20) {
|
|
8491
8495
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8492
|
-
if (d = H1(t,
|
|
8496
|
+
if (d = H1(t, s), d != 0) return E(u, 1, d), d;
|
|
8493
8497
|
throw Error("Invalid country calling code");
|
|
8494
8498
|
}
|
|
8495
|
-
return $ != null && (
|
|
8499
|
+
return $ != null && (a = v($, 10), h = "" + a, _ = t.toString(), _.lastIndexOf(h, 0) == 0 && (h = new A(_.substring(h.length)), _ = p($, 1), _ = new RegExp(v(_, 2)), W1(h, $, null), h = h.toString(), !F(_, t.toString()) && F(_, h) || l1(d, t.toString(), $, -1) == 3)) ? (s.g(h), r && E(u, 6, 10), E(u, 1, a), a) : (E(u, 1, 0), 0);
|
|
8496
8500
|
}
|
|
8497
8501
|
function W1(d, t, $) {
|
|
8498
|
-
var
|
|
8499
|
-
if (
|
|
8500
|
-
var
|
|
8501
|
-
if (
|
|
8502
|
-
|
|
8503
|
-
var h = F(
|
|
8504
|
-
t =
|
|
8502
|
+
var s = d.toString(), r = s.length, u = p(t, 15);
|
|
8503
|
+
if (r != 0 && u != null && u.length != 0) {
|
|
8504
|
+
var a = new RegExp("^(?:" + u + ")");
|
|
8505
|
+
if (r = a.exec(s)) {
|
|
8506
|
+
u = new RegExp(v(p(t, 1), 2));
|
|
8507
|
+
var h = F(u, s), _ = r.length - 1;
|
|
8508
|
+
t = p(t, 16), t == null || t.length == 0 || r[_] == null || r[_].length == 0 ? (!h || F(u, s.substring(r[0].length))) && ($ != null && 0 < _ && r[_] != null && $.g(r[1]), d.set(s.substring(r[0].length))) : (s = s.replace(a, t), (!h || F(u, s)) && ($ != null && 0 < _ && $.g(r[1]), d.set(s)));
|
|
8505
8509
|
}
|
|
8506
8510
|
}
|
|
8507
8511
|
}
|
|
8508
8512
|
function Z(d, t, $) {
|
|
8509
|
-
if (!
|
|
8513
|
+
if (!u1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8510
8514
|
return z1(d, t, $, !0);
|
|
8511
8515
|
}
|
|
8512
|
-
function z1(d, t, $,
|
|
8516
|
+
function z1(d, t, $, s) {
|
|
8513
8517
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8514
8518
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8515
|
-
var
|
|
8516
|
-
if (
|
|
8517
|
-
else if (
|
|
8519
|
+
var r = new A(), u = t.indexOf(";phone-context=");
|
|
8520
|
+
if (u === -1) u = null;
|
|
8521
|
+
else if (u += 15, u >= t.length) u = "";
|
|
8518
8522
|
else {
|
|
8519
|
-
var
|
|
8520
|
-
|
|
8523
|
+
var a = t.indexOf(";", u);
|
|
8524
|
+
u = a !== -1 ? t.substring(u, a) : t.substring(u);
|
|
8521
8525
|
}
|
|
8522
|
-
var h =
|
|
8523
|
-
if (h == null ?
|
|
8524
|
-
if (
|
|
8525
|
-
|
|
8526
|
+
var h = u;
|
|
8527
|
+
if (h == null ? a = !0 : h.length === 0 ? a = !1 : (a = S2.exec(h), h = w2.exec(h), a = a !== null || h !== null), !a || (u != null ? (u.charAt(0) === "+" && r.g(u), u = t.indexOf("tel:"), r.g(t.substring(0 <= u ? u + 4 : 0, t.indexOf(";phone-context=")))) : (u = r.g, a = t ?? "", h = a.search(y2), 0 <= h ? (a = a.substring(h), a = a.replace(I2, ""), h = a.search(_2), 0 <= h && (a = a.substring(0, h))) : a = "", u.call(r, a)), u = r.toString(), a = u.indexOf(";isub="), 0 < a && (k(r), r.g(u.substring(0, a))), !R1(r.toString()))) throw Error("The string supplied did not seem to be a phone number");
|
|
8528
|
+
if (u = r.toString(), !(u1($) || u != null && 0 < u.length && d1.test(u))) throw Error("Invalid country calling code");
|
|
8529
|
+
u = new H(), s && E(u, 5, t);
|
|
8526
8530
|
d: {
|
|
8527
|
-
if (t =
|
|
8528
|
-
h = t.match(
|
|
8531
|
+
if (t = r.toString(), a = t.search(x1), 0 <= a && R1(t.substring(0, a))) {
|
|
8532
|
+
h = t.match(x1);
|
|
8529
8533
|
for (var _ = h.length, V = 1; V < _; ++V) if (h[V] != null && 0 < h[V].length) {
|
|
8530
|
-
k(
|
|
8534
|
+
k(r), r.g(t.substring(0, a)), t = h[V];
|
|
8531
8535
|
break d;
|
|
8532
8536
|
}
|
|
8533
8537
|
}
|
|
8534
8538
|
t = "";
|
|
8535
8539
|
}
|
|
8536
|
-
0 < t.length && E(
|
|
8540
|
+
0 < t.length && E(u, 3, t), a = j(d, $), t = new A(), h = 0, _ = r.toString();
|
|
8537
8541
|
try {
|
|
8538
|
-
h = j1(d, _,
|
|
8542
|
+
h = j1(d, _, a, t, s, u);
|
|
8539
8543
|
} catch (I1) {
|
|
8540
8544
|
if (I1.message == "Invalid country calling code" && d1.test(_)) {
|
|
8541
|
-
if (_ = _.replace(d1, ""), h = j1(d, _,
|
|
8545
|
+
if (_ = _.replace(d1, ""), h = j1(d, _, a, t, s, u), h == 0) throw I1;
|
|
8542
8546
|
} else throw I1;
|
|
8543
8547
|
}
|
|
8544
|
-
if (h != 0 ? (
|
|
8545
|
-
|
|
8548
|
+
if (h != 0 ? (r = $1(h), r != $ && (a = t1(d, h, r))) : (k1(r), t.g(r.toString()), $ != null ? (h = v(a, 10), E(
|
|
8549
|
+
u,
|
|
8546
8550
|
1,
|
|
8547
8551
|
h
|
|
8548
|
-
)) :
|
|
8552
|
+
)) : s && (delete u.h[6], u.g && delete u.g[6])), 2 > t.h.length || (a != null && ($ = new A(), r = new A(t.toString()), W1(r, a, $), d = l1(d, r.toString(), a, -1), d != 2 && d != 4 && d != 5 && (t = r, s && 0 < $.toString().length && E(u, 7, $.toString()))), s = t.toString(), d = s.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
|
|
8549
8553
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
8550
|
-
if (1 <
|
|
8551
|
-
for (E(
|
|
8552
|
-
d != 1 && E(
|
|
8554
|
+
if (1 < s.length && s.charAt(0) == "0") {
|
|
8555
|
+
for (E(u, 4, !0), d = 1; d < s.length - 1 && s.charAt(d) == "0"; ) d++;
|
|
8556
|
+
d != 1 && E(u, 8, d);
|
|
8553
8557
|
}
|
|
8554
|
-
return E(
|
|
8558
|
+
return E(u, 2, parseInt(s, 10)), u;
|
|
8555
8559
|
}
|
|
8556
8560
|
function F(d, t) {
|
|
8557
8561
|
return !!((d = t.match(new RegExp("^(?:" + (typeof d == "string" ? d : d.source) + ")$", "i"))) && d[0].length == t.length);
|
|
@@ -8564,25 +8568,25 @@ const Z2 = (y) => {
|
|
|
8564
8568
|
var E2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), Y1 = /[- ]/;
|
|
8565
8569
|
function J1(d, t) {
|
|
8566
8570
|
var $ = d.ga;
|
|
8567
|
-
return t =
|
|
8571
|
+
return t = u1(t) ? K1($, t) : 0, d = j(d.ga, $1(t)), d ?? Z1;
|
|
8568
8572
|
}
|
|
8569
8573
|
function q1(d) {
|
|
8570
8574
|
for (var t = d.j.length, $ = 0; $ < t; ++$) {
|
|
8571
|
-
var
|
|
8572
|
-
if (d.da ==
|
|
8573
|
-
var
|
|
8574
|
-
k(
|
|
8575
|
-
var _ =
|
|
8576
|
-
|
|
8575
|
+
var s = d.j[$], r = v(s, 1);
|
|
8576
|
+
if (d.da == r) return !1;
|
|
8577
|
+
var u = d, a = s, h = v(a, 1);
|
|
8578
|
+
k(u.v);
|
|
8579
|
+
var _ = u;
|
|
8580
|
+
a = v(a, 2);
|
|
8577
8581
|
var V = "999999999999999".match(h)[0];
|
|
8578
|
-
if (V.length < _.g.h.length ? _ = "" : (_ = V.replace(new RegExp(h, "g"),
|
|
8582
|
+
if (V.length < _.g.h.length ? _ = "" : (_ = V.replace(new RegExp(h, "g"), a), _ = _.replace(RegExp("9", "g"), " ")), 0 < _.length ? (u.v.g(_), u = !0) : u = !1, u) return d.da = r, d.ha = Y1.test(p(s, 4)), d.$ = 0, !0;
|
|
8579
8583
|
}
|
|
8580
8584
|
return d.u = !1;
|
|
8581
8585
|
}
|
|
8582
8586
|
function X1(d, t) {
|
|
8583
|
-
for (var $ = [],
|
|
8584
|
-
var
|
|
8585
|
-
K(
|
|
8587
|
+
for (var $ = [], s = t.length - 3, r = d.j.length, u = 0; u < r; ++u) {
|
|
8588
|
+
var a = d.j[u];
|
|
8589
|
+
K(a, 3) == 0 ? $.push(d.j[u]) : (a = p(a, 3, Math.min(s, K(a, 3) - 1)), t.search(a) == 0 && $.push(d.j[u]));
|
|
8586
8590
|
}
|
|
8587
8591
|
d.j = $;
|
|
8588
8592
|
}
|
|
@@ -8613,9 +8617,9 @@ const Z2 = (y) => {
|
|
|
8613
8617
|
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, k(d.v), d.da = "", y1(d);
|
|
8614
8618
|
}
|
|
8615
8619
|
function d2(d) {
|
|
8616
|
-
for (var t = d.g.toString(), $ = d.j.length,
|
|
8617
|
-
var
|
|
8618
|
-
if (new RegExp("^(?:" +
|
|
8620
|
+
for (var t = d.g.toString(), $ = d.j.length, s = 0; s < $; ++s) {
|
|
8621
|
+
var r = d.j[s], u = v(r, 1);
|
|
8622
|
+
if (new RegExp("^(?:" + u + ")$").test(t) && (d.ha = Y1.test(p(r, 4)), r = t.replace(new RegExp(u, "g"), p(r, 2)), r = c1(d, r), o1(r, g2) == d.ba)) return r;
|
|
8619
8623
|
}
|
|
8620
8624
|
return "";
|
|
8621
8625
|
}
|
|
@@ -8626,9 +8630,9 @@ const Z2 = (y) => {
|
|
|
8626
8630
|
function y1(d) {
|
|
8627
8631
|
var t = d.g.toString();
|
|
8628
8632
|
if (3 <= t.length) {
|
|
8629
|
-
for (var $ = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ?
|
|
8630
|
-
var
|
|
8631
|
-
0 < d.o.length && G1(v(
|
|
8633
|
+
for (var $ = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ? P(d.l, 20) : P(d.l, 19), s = $.length, r = 0; r < s; ++r) {
|
|
8634
|
+
var u = $[r];
|
|
8635
|
+
0 < d.o.length && G1(v(u, 4)) && !p(u, 6) && !B(u, 5) || (d.o.length != 0 || d.ca || G1(v(u, 4)) || p(u, 6)) && E2.test(v(u, 2)) && d.j.push(u);
|
|
8632
8636
|
}
|
|
8633
8637
|
return X1(d, t), t = d2(d), 0 < t.length ? t : q1(d) ? t2(d) : d.s.toString();
|
|
8634
8638
|
}
|
|
@@ -8637,19 +8641,19 @@ const Z2 = (y) => {
|
|
|
8637
8641
|
function t2(d) {
|
|
8638
8642
|
var t = d.g.toString(), $ = t.length;
|
|
8639
8643
|
if (0 < $) {
|
|
8640
|
-
for (var
|
|
8641
|
-
return d.u ? c1(d,
|
|
8644
|
+
for (var s = "", r = 0; r < $; r++) s = n2(d, t.charAt(r));
|
|
8645
|
+
return d.u ? c1(d, s) : d.s.toString();
|
|
8642
8646
|
}
|
|
8643
8647
|
return d.h.toString();
|
|
8644
8648
|
}
|
|
8645
8649
|
function e2(d) {
|
|
8646
8650
|
var t = d.g.toString(), $ = 0;
|
|
8647
|
-
if (
|
|
8648
|
-
else
|
|
8649
|
-
return
|
|
8651
|
+
if (p(d.l, 10) != 1) var s = !1;
|
|
8652
|
+
else s = d.g.toString(), s = s.charAt(0) == "1" && s.charAt(1) != "0" && s.charAt(1) != "1";
|
|
8653
|
+
return s ? ($ = 1, d.h.g("1").g(" "), d.ca = !0) : B(d.l, 15) && (s = new RegExp("^(?:" + p(d.l, 15) + ")"), s = t.match(s), s != null && s[0] != null && 0 < s[0].length && (d.ca = !0, $ = s[0].length, d.h.g(t.substring(0, $)))), k(d.g), d.g.g(t.substring($)), t.substring(0, $);
|
|
8650
8654
|
}
|
|
8651
8655
|
function $2(d) {
|
|
8652
|
-
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" +
|
|
8656
|
+
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
|
|
8653
8657
|
return $ = t.match($), $ != null && $[0] != null && 0 < $[0].length ? (d.ca = !0, $ = $[0].length, k(d.g), d.g.g(t.substring($)), k(d.h), d.h.g(t.substring(0, $)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
|
|
8654
8658
|
}
|
|
8655
8659
|
function i2(d) {
|
|
@@ -8660,8 +8664,8 @@ const Z2 = (y) => {
|
|
|
8660
8664
|
function n2(d, t) {
|
|
8661
8665
|
var $ = d.v.toString();
|
|
8662
8666
|
if (0 <= $.substring(d.$).search(d.fa)) {
|
|
8663
|
-
var
|
|
8664
|
-
return t = $.replace(d.fa, t), k(d.v), d.v.g(t), d.$ =
|
|
8667
|
+
var s = $.search(d.fa);
|
|
8668
|
+
return t = $.replace(d.fa, t), k(d.v), d.v.g(t), d.$ = s, t.substring(0, d.$ + 1);
|
|
8665
8669
|
}
|
|
8666
8670
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
8667
8671
|
}
|
|
@@ -8671,31 +8675,31 @@ const Z2 = (y) => {
|
|
|
8671
8675
|
}, _1 = { 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 };
|
|
8672
8676
|
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
8673
8677
|
try {
|
|
8674
|
-
const $ = d.replace(/[^+0-9]/g, ""),
|
|
8678
|
+
const $ = d.replace(/[^+0-9]/g, ""), s = new A2(t);
|
|
8675
8679
|
t = "";
|
|
8676
|
-
for (let
|
|
8680
|
+
for (let r = 0; r < $.length; r++) s.ja = M2(s, $.charAt(r)), t = s.ja;
|
|
8677
8681
|
return t;
|
|
8678
8682
|
} catch {
|
|
8679
8683
|
return d;
|
|
8680
8684
|
}
|
|
8681
8685
|
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => {
|
|
8682
8686
|
try {
|
|
8683
|
-
const
|
|
8684
|
-
var
|
|
8685
|
-
return
|
|
8687
|
+
const r = M.g(), u = Z(r, d, t);
|
|
8688
|
+
var s = h1(r, u, -1);
|
|
8689
|
+
return s == 0 || s == 4 ? r.format(u, typeof $ > "u" ? 0 : $) : d;
|
|
8686
8690
|
} catch {
|
|
8687
8691
|
return d;
|
|
8688
8692
|
}
|
|
8689
|
-
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $,
|
|
8693
|
+
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, s) => {
|
|
8690
8694
|
try {
|
|
8691
8695
|
const _ = M.g();
|
|
8692
8696
|
d: {
|
|
8693
|
-
var
|
|
8694
|
-
if (
|
|
8695
|
-
var
|
|
8697
|
+
var r = _;
|
|
8698
|
+
if (u1(d)) {
|
|
8699
|
+
var u = a1(j(r, d), $);
|
|
8696
8700
|
try {
|
|
8697
|
-
if (B(
|
|
8698
|
-
var
|
|
8701
|
+
if (B(u, 6)) {
|
|
8702
|
+
var a = p(u, 6), h = z1(r, a, d, !1);
|
|
8699
8703
|
break d;
|
|
8700
8704
|
}
|
|
8701
8705
|
} catch {
|
|
@@ -8703,57 +8707,57 @@ const Z2 = (y) => {
|
|
|
8703
8707
|
}
|
|
8704
8708
|
h = null;
|
|
8705
8709
|
}
|
|
8706
|
-
return _.format(h,
|
|
8710
|
+
return _.format(h, s ? 0 : t ? 2 : 1);
|
|
8707
8711
|
} catch {
|
|
8708
8712
|
return "";
|
|
8709
8713
|
}
|
|
8710
8714
|
}), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
|
|
8711
8715
|
try {
|
|
8712
|
-
return
|
|
8716
|
+
return p(Z(M.g(), d, t), 3);
|
|
8713
8717
|
} catch {
|
|
8714
8718
|
return "";
|
|
8715
8719
|
}
|
|
8716
8720
|
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
8717
8721
|
try {
|
|
8718
|
-
const $ = M.g(),
|
|
8719
|
-
return F1($,
|
|
8722
|
+
const $ = M.g(), s = Z($, d, t);
|
|
8723
|
+
return F1($, s);
|
|
8720
8724
|
} catch {
|
|
8721
8725
|
return -99;
|
|
8722
8726
|
}
|
|
8723
8727
|
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
8724
8728
|
if (!t) return 1;
|
|
8725
8729
|
try {
|
|
8726
|
-
const $ = M.g(),
|
|
8727
|
-
return h1($,
|
|
8730
|
+
const $ = M.g(), s = Z($, d, t);
|
|
8731
|
+
return h1($, s, -1);
|
|
8728
8732
|
} catch ($) {
|
|
8729
8733
|
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;
|
|
8730
8734
|
}
|
|
8731
8735
|
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t, $) => {
|
|
8732
8736
|
try {
|
|
8733
|
-
const
|
|
8737
|
+
const s = M.g(), r = Z(s, d, t), u = T2(s, r);
|
|
8734
8738
|
if ($) {
|
|
8735
|
-
const
|
|
8736
|
-
return
|
|
8739
|
+
const a = s2($).map((h) => _1[h]);
|
|
8740
|
+
return u && a.includes(F1(s, r));
|
|
8737
8741
|
}
|
|
8738
|
-
return
|
|
8742
|
+
return u;
|
|
8739
8743
|
} catch {
|
|
8740
8744
|
return !1;
|
|
8741
8745
|
}
|
|
8742
8746
|
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => {
|
|
8743
8747
|
try {
|
|
8744
|
-
const
|
|
8748
|
+
const s = M.g(), r = Z(s, d, t);
|
|
8745
8749
|
if ($) {
|
|
8746
|
-
const
|
|
8747
|
-
for (let
|
|
8750
|
+
const u = s2($);
|
|
8751
|
+
for (let a of u) if (h1(s, r, _1[a]) === 0) return !0;
|
|
8748
8752
|
return !1;
|
|
8749
8753
|
}
|
|
8750
|
-
return h1(
|
|
8754
|
+
return h1(s, r, -1) === 0;
|
|
8751
8755
|
} catch {
|
|
8752
8756
|
return !1;
|
|
8753
8757
|
}
|
|
8754
8758
|
}), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
|
|
8755
8759
|
try {
|
|
8756
|
-
return
|
|
8760
|
+
return p(Z(M.g(), d, t), 2).toString();
|
|
8757
8761
|
} catch {
|
|
8758
8762
|
return "";
|
|
8759
8763
|
}
|
|
@@ -8795,41 +8799,41 @@ const q2 = {
|
|
|
8795
8799
|
"changeErrorCode"
|
|
8796
8800
|
], ["update:modelValue"]),
|
|
8797
8801
|
setup(y, { expose: e, emit: i }) {
|
|
8798
|
-
const
|
|
8799
|
-
let
|
|
8800
|
-
|
|
8802
|
+
const n = D2(y, "modelValue"), o = y, l = i, g = v1(), C = v1(), c = v1(!1), S = () => C.value ? o.options.strictMode ? C.value.isValidNumberPrecise() : C.value.isValidNumber() : null, w = () => {
|
|
8803
|
+
let f = S();
|
|
8804
|
+
c.value !== f && (c.value = f, l("changeValidity", !!f), l(
|
|
8801
8805
|
"changeErrorCode",
|
|
8802
|
-
|
|
8806
|
+
f ? null : C.value.getValidationError()
|
|
8803
8807
|
));
|
|
8804
8808
|
}, b = () => {
|
|
8805
|
-
var
|
|
8806
|
-
l("changeNumber", ((
|
|
8809
|
+
var f;
|
|
8810
|
+
l("changeNumber", ((f = C.value) == null ? void 0 : f.getNumber()) ?? ""), w();
|
|
8807
8811
|
}, L = () => {
|
|
8808
|
-
var
|
|
8809
|
-
l("changeCountry", ((
|
|
8812
|
+
var f;
|
|
8813
|
+
l("changeCountry", ((f = C.value) == null ? void 0 : f.getSelectedCountryData().iso2) ?? ""), b(), w();
|
|
8810
8814
|
};
|
|
8811
|
-
return
|
|
8812
|
-
|
|
8813
|
-
}),
|
|
8814
|
-
() =>
|
|
8815
|
-
(
|
|
8815
|
+
return P2(() => {
|
|
8816
|
+
g.value && (C.value = m(g.value, o.options), o.value && C.value.setNumber(o.value), o.disabled && C.value.setDisabled(o.disabled), c.value = S());
|
|
8817
|
+
}), x2(
|
|
8818
|
+
() => o.disabled,
|
|
8819
|
+
(f) => {
|
|
8816
8820
|
var I;
|
|
8817
|
-
return (I = C.value) == null ? void 0 : I.setDisabled(
|
|
8821
|
+
return (I = C.value) == null ? void 0 : I.setDisabled(f);
|
|
8818
8822
|
}
|
|
8819
8823
|
), R2(() => {
|
|
8820
|
-
var
|
|
8821
|
-
return (
|
|
8822
|
-
}), e({ instance: C, input:
|
|
8824
|
+
var f;
|
|
8825
|
+
return (f = C.value) == null ? void 0 : f.destroy();
|
|
8826
|
+
}), e({ instance: C, input: g }), (f, I) => B2((O2(), k2("input", G2({
|
|
8823
8827
|
ref_key: "input",
|
|
8824
|
-
ref:
|
|
8825
|
-
"onUpdate:modelValue": I[0] || (I[0] = (G) =>
|
|
8828
|
+
ref: g,
|
|
8829
|
+
"onUpdate:modelValue": I[0] || (I[0] = (G) => n.value = G),
|
|
8826
8830
|
type: "tel",
|
|
8827
8831
|
onCountrychange: L,
|
|
8828
8832
|
onInput: b
|
|
8829
8833
|
}, y.inputProps), null, 16)), [
|
|
8830
8834
|
[
|
|
8831
8835
|
U2,
|
|
8832
|
-
|
|
8836
|
+
n.value,
|
|
8833
8837
|
void 0,
|
|
8834
8838
|
{ lazy: !0 }
|
|
8835
8839
|
]
|