intl-tel-input 25.8.1 → 25.8.3
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 +25 -39
- package/angular/build/IntlTelInputWithUtils.js +25 -39
- package/angular/build/types/intl-tel-input.d.ts +0 -2
- package/build/css/intlTelInput.css +2 -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 -2
- package/build/js/intlTelInput.js +38 -48
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +38 -48
- package/build/js/intlTelInputWithUtils.min.js +4 -4
- package/package.json +1 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +37 -47
- package/react/build/IntlTelInput.d.ts +0 -2
- package/react/build/IntlTelInput.js +37 -47
- package/react/build/IntlTelInputWithUtils.cjs +37 -47
- package/react/build/IntlTelInputWithUtils.js +37 -47
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +171 -172
- package/vue/build/IntlTelInputWithUtils.mjs +474 -475
|
@@ -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), C = o > -1, g = l > -1;
|
|
1736
|
+
if (C || g)
|
|
1737
|
+
return C && g ? o - l : C ? -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), C = e.dialCode + l;
|
|
1789
|
+
this._addToDialCodeMap(i, C), this._addToDialCodeMap(e.iso2, C);
|
|
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:
|
|
1806
|
-
fixDropdownWidth:
|
|
1807
|
-
useFullscreenPopup:
|
|
1805
|
+
dropdownContainer: C,
|
|
1806
|
+
fixDropdownWidth: g,
|
|
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,28 +1835,32 @@ 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" },
|
|
1846
1850
|
U
|
|
1847
1851
|
)), i && (this.selectedDialCode = T(
|
|
1848
1852
|
"div",
|
|
1849
|
-
{ class: "iti__selected-dial-code",
|
|
1853
|
+
{ class: "iti__selected-dial-code", dir: "ltr" },
|
|
1850
1854
|
this.selectedCountry
|
|
1851
1855
|
)), e) {
|
|
1852
|
-
const D =
|
|
1856
|
+
const D = g ? "" : "iti--flexible-dropdown-width";
|
|
1853
1857
|
if (this.dropdownContent = T("div", {
|
|
1854
1858
|
id: `iti-${this.id}__dropdown-content`,
|
|
1855
1859
|
class: `iti__dropdown-content iti__hide ${D}`,
|
|
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(), C) {
|
|
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, C = this._getDialCode(l), g = u2(l), { initialCountry: c, geoIpLookup: S } = this.options, w = c === "auto" && S;
|
|
1994
|
+
if (C && !g)
|
|
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) : C && g ? 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:
|
|
2054
|
-
let
|
|
2055
|
-
new RegExp("\\p{L}", "u").test(this.telInput.value) && (
|
|
2056
|
-
if (this.isAndroid && (
|
|
2057
|
-
const L = this.telInput.selectionStart || 0,
|
|
2058
|
-
this.telInput.value =
|
|
2057
|
+
const { strictMode: e, formatAsYouType: i, separateDialCode: n, formatOnDisplay: o, allowDropdown: l, countrySearch: C } = this.options;
|
|
2058
|
+
let g = !1;
|
|
2059
|
+
new RegExp("\\p{L}", "u").test(this.telInput.value) && (g = !0), this._handleInputEvent = (c) => {
|
|
2060
|
+
if (this.isAndroid && (c == null ? void 0 : c.data) === "+" && n && l && C) {
|
|
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 = (
|
|
2063
|
-
S || w && !e ?
|
|
2064
|
-
const b = (
|
|
2065
|
-
if (i && !
|
|
2066
|
-
const L = this.telInput.selectionStart || 0, I = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, G = (
|
|
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;
|
|
2067
|
+
S || w && !e ? g = !0 : /[^+0-9]/.test(this.telInput.value) || (g = !1);
|
|
2068
|
+
const b = (c == null ? void 0 : c.detail) && c.detail.isSetNumber && !o;
|
|
2069
|
+
if (i && !g && !b) {
|
|
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 && C && 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, C = [], g = [], c = [], S = [], w = [], b = [];
|
|
2171
|
+
for (const f of this.countries)
|
|
2172
|
+
i || l === 0 ? c.push(f) : f.iso2 === o ? C.push(f) : f.normalisedName.startsWith(o) ? g.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
|
-
...
|
|
2172
|
-
...
|
|
2173
|
-
...S.sort((
|
|
2174
|
-
...w.sort((
|
|
2175
|
-
...b.sort((
|
|
2174
|
+
...C.sort((f, I) => f.priority - I.priority),
|
|
2175
|
+
...g.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, C = n ? o : l;
|
|
2205
2209
|
i = m.utils.formatNumber(
|
|
2206
2210
|
i,
|
|
2207
2211
|
this.selectedCountryData.iso2,
|
|
2208
|
-
|
|
2212
|
+
C
|
|
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 C = n && e.charAt(0) === n && !this.options.separateDialCode ? e.substring(1) : e;
|
|
2228
|
+
return `+${i}${C}`;
|
|
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 C = this._getDialCode(n, !0), g = f1(n);
|
|
2239
|
+
if (C) {
|
|
2240
|
+
const c = f1(C), S = this.dialCodeToIso2Map[c];
|
|
2241
|
+
if (!o && this.defaultCountry && S.includes(this.defaultCountry))
|
|
2238
2242
|
return this.defaultCountry;
|
|
2239
|
-
const w = this.selectedCountryData.areaCodes &&
|
|
2240
|
-
if (!(l === "1" &&
|
|
2241
|
-
for (const
|
|
2242
|
-
if (
|
|
2243
|
-
return
|
|
2243
|
+
const w = this.selectedCountryData.areaCodes && g.length > c.length, b = o && S.includes(o) && !w;
|
|
2244
|
+
if (!(l === "1" && u2(g)) && !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) === "+" && g.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,15 @@ 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:
|
|
2276
|
-
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
+
const { separateDialCode: i, showFlags: n, i18n: o } = this.options, l = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2280
|
+
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
|
|
2281
|
+
const C = e && n ? `iti__flag iti__${e}` : "iti__flag iti__globe";
|
|
2282
|
+
let g, c;
|
|
2283
|
+
e ? (c = this.selectedCountryData.name, g = o.selectedCountryAriaLabel.replace("${country}", this.selectedCountryData.name)) : (c = o.noCountrySelected, g = o.noCountrySelected), this.selectedCountryInner.className = C, this.selectedCountry.setAttribute("title", c), this.selectedCountry.setAttribute("aria-label", g);
|
|
2279
2284
|
}
|
|
2280
|
-
if (
|
|
2281
|
-
const
|
|
2282
|
-
this.selectedDialCode.innerHTML =
|
|
2285
|
+
if (i) {
|
|
2286
|
+
const C = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2287
|
+
this.selectedDialCode.innerHTML = C, this._updateInputPadding();
|
|
2283
2288
|
}
|
|
2284
2289
|
return this._updatePlaceholder(), this._updateMaxLength(), l.iso2 !== e;
|
|
2285
2290
|
}
|
|
@@ -2292,29 +2297,23 @@ class p1 {
|
|
|
2292
2297
|
}
|
|
2293
2298
|
//* Update the maximum valid number length for the currently selected country.
|
|
2294
2299
|
_updateMaxLength() {
|
|
2295
|
-
const { strictMode: e, placeholderNumberType: i, validationNumberTypes:
|
|
2300
|
+
const { strictMode: e, placeholderNumberType: i, validationNumberTypes: n } = this.options, { iso2: o } = this.selectedCountryData;
|
|
2296
2301
|
if (e && m.utils)
|
|
2297
|
-
if (
|
|
2302
|
+
if (o) {
|
|
2298
2303
|
const l = m.utils.numberType[i];
|
|
2299
|
-
let
|
|
2300
|
-
|
|
2304
|
+
let C = m.utils.getExampleNumber(
|
|
2305
|
+
o,
|
|
2301
2306
|
!1,
|
|
2302
2307
|
l,
|
|
2303
2308
|
!0
|
|
2304
|
-
),
|
|
2305
|
-
for (; m.utils.isPossibleNumber(
|
|
2306
|
-
|
|
2307
|
-
const
|
|
2308
|
-
this.maxCoreNumberLength =
|
|
2309
|
+
), g = C;
|
|
2310
|
+
for (; m.utils.isPossibleNumber(C, o, n); )
|
|
2311
|
+
g = C, C += "0";
|
|
2312
|
+
const c = m.utils.getCoreNumber(g, o);
|
|
2313
|
+
this.maxCoreNumberLength = c.length, o === "by" && (this.maxCoreNumberLength = c.length + 1);
|
|
2309
2314
|
} else
|
|
2310
2315
|
this.maxCoreNumberLength = null;
|
|
2311
2316
|
}
|
|
2312
|
-
_setSelectedCountryTitleAttribute(e = null, i) {
|
|
2313
|
-
if (!this.selectedCountry)
|
|
2314
|
-
return;
|
|
2315
|
-
let s;
|
|
2316
|
-
e && !i ? s = `${this.selectedCountryData.name}: +${this.selectedCountryData.dialCode}` : e ? s = this.selectedCountryData.name : s = "Unknown", this.selectedCountry.setAttribute("title", s);
|
|
2317
|
-
}
|
|
2318
2317
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2319
2318
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
2320
2319
|
//* NOTE: this is only used when separateDialCode is enabled, so countryContainer and selectedCountry
|
|
@@ -2325,10 +2324,10 @@ class p1 {
|
|
|
2325
2324
|
e.style.visibility = "hidden", document.body.appendChild(e);
|
|
2326
2325
|
const i = this.countryContainer.cloneNode();
|
|
2327
2326
|
e.appendChild(i);
|
|
2328
|
-
const
|
|
2329
|
-
i.appendChild(
|
|
2330
|
-
const
|
|
2331
|
-
return document.body.removeChild(e),
|
|
2327
|
+
const n = this.selectedCountry.cloneNode(!0);
|
|
2328
|
+
i.appendChild(n);
|
|
2329
|
+
const o = n.offsetWidth;
|
|
2330
|
+
return document.body.removeChild(e), o;
|
|
2332
2331
|
}
|
|
2333
2332
|
return 0;
|
|
2334
2333
|
}
|
|
@@ -2337,17 +2336,17 @@ class p1 {
|
|
|
2337
2336
|
const {
|
|
2338
2337
|
autoPlaceholder: e,
|
|
2339
2338
|
placeholderNumberType: i,
|
|
2340
|
-
nationalMode:
|
|
2341
|
-
customPlaceholder:
|
|
2339
|
+
nationalMode: n,
|
|
2340
|
+
customPlaceholder: o
|
|
2342
2341
|
} = this.options, l = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
2343
2342
|
if (m.utils && l) {
|
|
2344
|
-
const
|
|
2345
|
-
let
|
|
2343
|
+
const C = m.utils.numberType[i];
|
|
2344
|
+
let g = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
|
|
2346
2345
|
this.selectedCountryData.iso2,
|
|
2347
|
-
|
|
2348
|
-
|
|
2346
|
+
n,
|
|
2347
|
+
C
|
|
2349
2348
|
) : "";
|
|
2350
|
-
|
|
2349
|
+
g = this._beforeSetNumber(g), typeof o == "function" && (g = o(g, this.selectedCountryData)), this.telInput.setAttribute("placeholder", g);
|
|
2351
2350
|
}
|
|
2352
2351
|
}
|
|
2353
2352
|
//* Called when the user selects a list item from the dropdown.
|
|
@@ -2369,62 +2368,62 @@ class p1 {
|
|
|
2369
2368
|
}
|
|
2370
2369
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2371
2370
|
_scrollTo(e) {
|
|
2372
|
-
const i = this.countryList,
|
|
2373
|
-
if (
|
|
2371
|
+
const i = this.countryList, n = document.documentElement.scrollTop, o = i.offsetHeight, l = i.getBoundingClientRect().top + n, C = l + o, g = e.offsetHeight, c = e.getBoundingClientRect().top + n, S = c + g, w = c - l + i.scrollTop;
|
|
2372
|
+
if (c < l)
|
|
2374
2373
|
i.scrollTop = w;
|
|
2375
|
-
else if (S >
|
|
2376
|
-
const b =
|
|
2374
|
+
else if (S > C) {
|
|
2375
|
+
const b = o - g;
|
|
2377
2376
|
i.scrollTop = w - b;
|
|
2378
2377
|
}
|
|
2379
2378
|
}
|
|
2380
2379
|
//* Replace any existing dial code with the new one
|
|
2381
2380
|
//* Note: called from _selectListItem and setCountry
|
|
2382
2381
|
_updateDialCode(e) {
|
|
2383
|
-
const i = this.telInput.value,
|
|
2384
|
-
let
|
|
2382
|
+
const i = this.telInput.value, n = `+${e}`;
|
|
2383
|
+
let o;
|
|
2385
2384
|
if (i.charAt(0) === "+") {
|
|
2386
2385
|
const l = this._getDialCode(i);
|
|
2387
|
-
l ?
|
|
2386
|
+
l ? o = i.replace(l, n) : o = n, this.telInput.value = o;
|
|
2388
2387
|
}
|
|
2389
2388
|
}
|
|
2390
2389
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2391
2390
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2392
2391
|
_getDialCode(e, i) {
|
|
2393
|
-
let
|
|
2392
|
+
let n = "";
|
|
2394
2393
|
if (e.charAt(0) === "+") {
|
|
2395
|
-
let
|
|
2394
|
+
let o = "";
|
|
2396
2395
|
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
|
-
|
|
2396
|
+
const C = e.charAt(l);
|
|
2397
|
+
if (!isNaN(parseInt(C, 10))) {
|
|
2398
|
+
if (o += C, i)
|
|
2399
|
+
this.dialCodeToIso2Map[o] && (n = e.substring(0, l + 1));
|
|
2400
|
+
else if (this.dialCodes.has(o)) {
|
|
2401
|
+
n = e.substring(0, l + 1);
|
|
2403
2402
|
break;
|
|
2404
2403
|
}
|
|
2405
|
-
if (
|
|
2404
|
+
if (o.length === this.dialCodeMaxLen)
|
|
2406
2405
|
break;
|
|
2407
2406
|
}
|
|
2408
2407
|
}
|
|
2409
2408
|
}
|
|
2410
|
-
return
|
|
2409
|
+
return n;
|
|
2411
2410
|
}
|
|
2412
2411
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2413
2412
|
_getFullNumber(e) {
|
|
2414
|
-
const i = e || this.telInput.value.trim(), { dialCode:
|
|
2415
|
-
let
|
|
2413
|
+
const i = e || this.telInput.value.trim(), { dialCode: n } = this.selectedCountryData;
|
|
2414
|
+
let o;
|
|
2416
2415
|
const l = f1(i);
|
|
2417
|
-
return this.options.separateDialCode && i.charAt(0) !== "+" &&
|
|
2416
|
+
return this.options.separateDialCode && i.charAt(0) !== "+" && n && l ? o = `+${n}` : o = "", o + i;
|
|
2418
2417
|
}
|
|
2419
2418
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2420
2419
|
_beforeSetNumber(e) {
|
|
2421
2420
|
let i = e;
|
|
2422
2421
|
if (this.options.separateDialCode) {
|
|
2423
|
-
let
|
|
2424
|
-
if (
|
|
2425
|
-
|
|
2426
|
-
const
|
|
2427
|
-
i = i.substring(
|
|
2422
|
+
let n = this._getDialCode(i);
|
|
2423
|
+
if (n) {
|
|
2424
|
+
n = `+${this.selectedCountryData.dialCode}`;
|
|
2425
|
+
const o = i[n.length] === " " || i[n.length] === "-" ? n.length + 1 : n.length;
|
|
2426
|
+
i = i.substring(o);
|
|
2428
2427
|
}
|
|
2429
2428
|
}
|
|
2430
2429
|
return this._cap(i);
|
|
@@ -2435,8 +2434,8 @@ class p1 {
|
|
|
2435
2434
|
}
|
|
2436
2435
|
//* Format the number as the user types.
|
|
2437
2436
|
_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(`+${
|
|
2437
|
+
const e = this._getFullNumber(), i = m.utils ? m.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: n } = this.selectedCountryData;
|
|
2438
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${n}`) ? (i.split(`+${n}`)[1] || "").trim() : i;
|
|
2440
2439
|
}
|
|
2441
2440
|
//**************************
|
|
2442
2441
|
//* SECRET PUBLIC METHODS
|
|
@@ -2454,7 +2453,7 @@ class p1 {
|
|
|
2454
2453
|
//********************
|
|
2455
2454
|
//* Remove plugin.
|
|
2456
2455
|
destroy() {
|
|
2457
|
-
var l,
|
|
2456
|
+
var l, C;
|
|
2458
2457
|
this.telInput.iti = void 0;
|
|
2459
2458
|
const { allowDropdown: e, separateDialCode: i } = this.options;
|
|
2460
2459
|
if (e) {
|
|
@@ -2465,13 +2464,13 @@ class p1 {
|
|
|
2465
2464
|
"keydown",
|
|
2466
2465
|
this._handleCountryContainerKeydown
|
|
2467
2466
|
);
|
|
2468
|
-
const
|
|
2469
|
-
|
|
2467
|
+
const g = this.telInput.closest("label");
|
|
2468
|
+
g && g.removeEventListener("click", this._handleLabelClick);
|
|
2470
2469
|
}
|
|
2471
|
-
const { form:
|
|
2472
|
-
this._handleHiddenInputSubmit &&
|
|
2473
|
-
const
|
|
2474
|
-
(l =
|
|
2470
|
+
const { form: n } = this.telInput;
|
|
2471
|
+
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);
|
|
2472
|
+
const o = this.telInput.parentNode;
|
|
2473
|
+
(l = o == null ? void 0 : o.parentNode) == null || l.insertBefore(this.telInput, o), (C = o == null ? void 0 : o.parentNode) == null || C.removeChild(o), delete m.instances[this.id];
|
|
2475
2474
|
}
|
|
2476
2475
|
//* Get the extension from the current number.
|
|
2477
2476
|
getExtension() {
|
|
@@ -2526,20 +2525,20 @@ class p1 {
|
|
|
2526
2525
|
_validateNumber(e) {
|
|
2527
2526
|
if (!this.selectedCountryData.iso2)
|
|
2528
2527
|
return !1;
|
|
2529
|
-
const i = this._getFullNumber(),
|
|
2530
|
-
if (
|
|
2531
|
-
const l = i.substring(0,
|
|
2532
|
-
return
|
|
2528
|
+
const i = this._getFullNumber(), n = i.search(new RegExp("\\p{L}", "u")), o = (l) => e ? this._utilsIsValidNumber(l) : this._utilsIsPossibleNumber(l);
|
|
2529
|
+
if (n > -1) {
|
|
2530
|
+
const l = i.substring(0, n), C = o(l), g = o(i);
|
|
2531
|
+
return C && g;
|
|
2533
2532
|
}
|
|
2534
|
-
return
|
|
2533
|
+
return o(i);
|
|
2535
2534
|
}
|
|
2536
2535
|
_utilsIsValidNumber(e) {
|
|
2537
2536
|
return m.utils ? m.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2538
2537
|
}
|
|
2539
2538
|
//* Update the selected country, and update the input val accordingly.
|
|
2540
2539
|
setCountry(e) {
|
|
2541
|
-
const i = e == null ? void 0 : e.toLowerCase(),
|
|
2542
|
-
(e && i !==
|
|
2540
|
+
const i = e == null ? void 0 : e.toLowerCase(), n = this.selectedCountryData.iso2;
|
|
2541
|
+
(e && i !== n || !e && n) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2543
2542
|
}
|
|
2544
2543
|
//* Set the input value and update the country.
|
|
2545
2544
|
setNumber(e) {
|
|
@@ -2566,10 +2565,10 @@ const Z2 = (y) => {
|
|
|
2566
2565
|
else
|
|
2567
2566
|
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
2567
|
return m.startedLoadingUtilsScript = !0, e.then((i) => {
|
|
2569
|
-
const
|
|
2570
|
-
if (!
|
|
2568
|
+
const n = i == null ? void 0 : i.default;
|
|
2569
|
+
if (!n || typeof n != "object")
|
|
2571
2570
|
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 =
|
|
2571
|
+
return m.utils = n, i1("handleUtils"), !0;
|
|
2573
2572
|
}).catch((i) => {
|
|
2574
2573
|
throw i1("rejectUtilsScriptPromise", i), i;
|
|
2575
2574
|
});
|
|
@@ -2596,7 +2595,7 @@ const Z2 = (y) => {
|
|
|
2596
2595
|
attachUtils: Z2,
|
|
2597
2596
|
startedLoadingUtilsScript: !1,
|
|
2598
2597
|
startedLoadingAutoCountry: !1,
|
|
2599
|
-
version: "25.8.
|
|
2598
|
+
version: "25.8.3"
|
|
2600
2599
|
}
|
|
2601
2600
|
);
|
|
2602
2601
|
(function() {
|
|
@@ -2605,23 +2604,23 @@ const Z2 = (y) => {
|
|
|
2605
2604
|
d = d.split(".");
|
|
2606
2605
|
var $ = y;
|
|
2607
2606
|
d[0] in $ || typeof $.execScript > "u" || $.execScript("var " + d[0]);
|
|
2608
|
-
for (var
|
|
2607
|
+
for (var s; d.length && (s = d.shift()); ) d.length || t === void 0 ? $[s] && $[s] !== Object.prototype[s] ? $ = $[s] : $ = $[s] = {} : $[s] = t;
|
|
2609
2608
|
}
|
|
2610
2609
|
function i(d, t) {
|
|
2611
2610
|
function $() {
|
|
2612
2611
|
}
|
|
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[
|
|
2612
|
+
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(s, r, u) {
|
|
2613
|
+
for (var a = Array(arguments.length - 2), h = 2; h < arguments.length; h++) a[h - 2] = arguments[h];
|
|
2614
|
+
return t.prototype[r].apply(s, a);
|
|
2616
2615
|
};
|
|
2617
2616
|
}
|
|
2618
|
-
function
|
|
2617
|
+
function n(d) {
|
|
2619
2618
|
const t = [];
|
|
2620
2619
|
let $ = 0;
|
|
2621
|
-
for (const
|
|
2620
|
+
for (const s in d) t[$++] = d[s];
|
|
2622
2621
|
return t;
|
|
2623
2622
|
}
|
|
2624
|
-
var
|
|
2623
|
+
var o = class {
|
|
2625
2624
|
constructor(d) {
|
|
2626
2625
|
if (l !== l) throw Error("SafeUrl is not meant to be built directly");
|
|
2627
2626
|
this.g = d;
|
|
@@ -2630,21 +2629,21 @@ const Z2 = (y) => {
|
|
|
2630
2629
|
return this.g.toString();
|
|
2631
2630
|
}
|
|
2632
2631
|
}, l = {};
|
|
2633
|
-
new
|
|
2634
|
-
const
|
|
2635
|
-
class
|
|
2632
|
+
new o("about:invalid#zClosurez"), new o("about:blank");
|
|
2633
|
+
const C = {};
|
|
2634
|
+
class g {
|
|
2636
2635
|
constructor() {
|
|
2637
|
-
if (
|
|
2636
|
+
if (C !== C) throw Error("SafeStyle is not meant to be built directly");
|
|
2638
2637
|
}
|
|
2639
2638
|
toString() {
|
|
2640
2639
|
return "";
|
|
2641
2640
|
}
|
|
2642
2641
|
}
|
|
2643
|
-
new
|
|
2644
|
-
const
|
|
2642
|
+
new g();
|
|
2643
|
+
const c = {};
|
|
2645
2644
|
class S {
|
|
2646
2645
|
constructor() {
|
|
2647
|
-
if (
|
|
2646
|
+
if (c !== c) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
2648
2647
|
}
|
|
2649
2648
|
toString() {
|
|
2650
2649
|
return "";
|
|
@@ -2668,15 +2667,15 @@ const Z2 = (y) => {
|
|
|
2668
2667
|
case G:
|
|
2669
2668
|
case U:
|
|
2670
2669
|
case D:
|
|
2671
|
-
case
|
|
2670
|
+
case x:
|
|
2672
2671
|
case Y:
|
|
2673
2672
|
case I:
|
|
2674
|
-
case
|
|
2673
|
+
case f:
|
|
2675
2674
|
this.o = !0;
|
|
2676
2675
|
}
|
|
2677
2676
|
this.j = t.defaultValue;
|
|
2678
2677
|
}
|
|
2679
|
-
var
|
|
2678
|
+
var f = 1, I = 2, G = 3, U = 4, D = 6, x = 16, Y = 18;
|
|
2680
2679
|
function c2(d, t) {
|
|
2681
2680
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
2682
2681
|
var $ = t[d];
|
|
@@ -2684,7 +2683,7 @@ const Z2 = (y) => {
|
|
|
2684
2683
|
}
|
|
2685
2684
|
}
|
|
2686
2685
|
function f2(d) {
|
|
2687
|
-
return d =
|
|
2686
|
+
return d = n(d.g), d.sort(function(t, $) {
|
|
2688
2687
|
return t.g - $.g;
|
|
2689
2688
|
}), d;
|
|
2690
2689
|
}
|
|
@@ -2694,22 +2693,22 @@ const Z2 = (y) => {
|
|
|
2694
2693
|
R.prototype.has = function(d) {
|
|
2695
2694
|
return B(this, d.g);
|
|
2696
2695
|
}, R.prototype.get = function(d, t) {
|
|
2697
|
-
return
|
|
2696
|
+
return p(this, d.g, t);
|
|
2698
2697
|
}, R.prototype.set = function(d, t) {
|
|
2699
2698
|
E(this, d.g, t);
|
|
2700
2699
|
}, R.prototype.add = function(d, t) {
|
|
2701
2700
|
b1(this, d.g, t);
|
|
2702
2701
|
};
|
|
2703
2702
|
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
|
|
2703
|
+
for (var $ = f2(d.m()), s = 0; s < $.length; s++) {
|
|
2704
|
+
var r = $[s], u = r.g;
|
|
2705
|
+
if (B(t, u)) {
|
|
2706
|
+
d.g && delete d.g[r.g];
|
|
2707
|
+
var a = r.h == 11 || r.h == 10;
|
|
2708
|
+
if (r.l) {
|
|
2709
|
+
r = P(t, u);
|
|
2710
|
+
for (var h = 0; h < r.length; h++) b1(d, u, a ? r[h].clone() : r[h]);
|
|
2711
|
+
} else r = n1(t, u), a ? (a = n1(d, u)) ? w1(a, r) : E(d, u, r.clone()) : E(d, u, r);
|
|
2713
2712
|
}
|
|
2714
2713
|
}
|
|
2715
2714
|
}
|
|
@@ -2725,23 +2724,23 @@ const Z2 = (y) => {
|
|
|
2725
2724
|
if ($ == null) return null;
|
|
2726
2725
|
if (d.l) {
|
|
2727
2726
|
if (!(t in d.g)) {
|
|
2728
|
-
var
|
|
2729
|
-
if ($ != null) if (
|
|
2730
|
-
for (var
|
|
2731
|
-
$ =
|
|
2732
|
-
} else $ =
|
|
2727
|
+
var s = d.l, r = d.j[t];
|
|
2728
|
+
if ($ != null) if (r.l) {
|
|
2729
|
+
for (var u = [], a = 0; a < $.length; a++) u[a] = s.h(r, $[a]);
|
|
2730
|
+
$ = u;
|
|
2731
|
+
} else $ = s.h(r, $);
|
|
2733
2732
|
return d.g[t] = $;
|
|
2734
2733
|
}
|
|
2735
2734
|
return d.g[t];
|
|
2736
2735
|
}
|
|
2737
2736
|
return $;
|
|
2738
2737
|
}
|
|
2739
|
-
function
|
|
2740
|
-
var
|
|
2741
|
-
return d.j[t].l ?
|
|
2738
|
+
function p(d, t, $) {
|
|
2739
|
+
var s = n1(d, t);
|
|
2740
|
+
return d.j[t].l ? s[$ || 0] : s;
|
|
2742
2741
|
}
|
|
2743
2742
|
function v(d, t) {
|
|
2744
|
-
if (B(d, t)) d =
|
|
2743
|
+
if (B(d, t)) d = p(d, t);
|
|
2745
2744
|
else d: {
|
|
2746
2745
|
if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
|
|
2747
2746
|
else if (t === Number) d.j = 0;
|
|
@@ -2754,7 +2753,7 @@ const Z2 = (y) => {
|
|
|
2754
2753
|
}
|
|
2755
2754
|
return d;
|
|
2756
2755
|
}
|
|
2757
|
-
function
|
|
2756
|
+
function P(d, t) {
|
|
2758
2757
|
return n1(d, t) || [];
|
|
2759
2758
|
}
|
|
2760
2759
|
function K(d, t) {
|
|
@@ -2767,8 +2766,8 @@ const Z2 = (y) => {
|
|
|
2767
2766
|
d.h[t] || (d.h[t] = []), d.h[t].push($), d.g && delete d.g[t];
|
|
2768
2767
|
}
|
|
2769
2768
|
function s1(d, t) {
|
|
2770
|
-
var $ = [],
|
|
2771
|
-
for (
|
|
2769
|
+
var $ = [], s;
|
|
2770
|
+
for (s in t) s != 0 && $.push(new L(s, t[s]));
|
|
2772
2771
|
return new c2(d, $);
|
|
2773
2772
|
}
|
|
2774
2773
|
function r1() {
|
|
@@ -2803,7 +2802,7 @@ const Z2 = (y) => {
|
|
|
2803
2802
|
A.prototype.h = "", A.prototype.set = function(d) {
|
|
2804
2803
|
this.h = "" + d;
|
|
2805
2804
|
}, A.prototype.g = function(d, t, $) {
|
|
2806
|
-
if (this.h += String(d), t != null) for (let
|
|
2805
|
+
if (this.h += String(d), t != null) for (let s = 1; s < arguments.length; s++) this.h += arguments[s];
|
|
2807
2806
|
return this;
|
|
2808
2807
|
};
|
|
2809
2808
|
function k(d) {
|
|
@@ -8298,10 +8297,10 @@ const Z2 = (y) => {
|
|
|
8298
8297
|
function J(d) {
|
|
8299
8298
|
return "([0-90-9٠-٩۰-۹]{1," + d + "})";
|
|
8300
8299
|
}
|
|
8301
|
-
function
|
|
8300
|
+
function P1() {
|
|
8302
8301
|
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
8302
|
}
|
|
8304
|
-
var
|
|
8303
|
+
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
8304
|
function R1(d) {
|
|
8306
8305
|
return 2 > d.length ? !1 : F(b2, d);
|
|
8307
8306
|
}
|
|
@@ -8313,91 +8312,91 @@ const Z2 = (y) => {
|
|
|
8313
8312
|
k(d), d.g(t);
|
|
8314
8313
|
}
|
|
8315
8314
|
function O1(d) {
|
|
8316
|
-
return d != null && (K(d, 9) != 1 ||
|
|
8315
|
+
return d != null && (K(d, 9) != 1 || P(d, 9)[0] != -1);
|
|
8317
8316
|
}
|
|
8318
8317
|
function o1(d, t) {
|
|
8319
|
-
for (var $ = new A(),
|
|
8318
|
+
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
8319
|
return $.toString();
|
|
8321
8320
|
}
|
|
8322
8321
|
function G1(d) {
|
|
8323
8322
|
return d.length == 0 || N2.test(d);
|
|
8324
8323
|
}
|
|
8325
|
-
function
|
|
8324
|
+
function u1(d) {
|
|
8326
8325
|
return d != null && isNaN(d) && d.toUpperCase() in M1;
|
|
8327
8326
|
}
|
|
8328
8327
|
M.prototype.format = function(d, t) {
|
|
8329
|
-
if (
|
|
8328
|
+
if (p(d, 2) == 0 && B(d, 5)) {
|
|
8330
8329
|
var $ = v(d, 5);
|
|
8331
8330
|
if (0 < $.length) return $;
|
|
8332
8331
|
}
|
|
8333
8332
|
$ = v(d, 1);
|
|
8334
|
-
var
|
|
8335
|
-
if (t == 0) return U1($, 0,
|
|
8336
|
-
if (!($ in Q)) return
|
|
8337
|
-
var
|
|
8338
|
-
d = B(d, 3) &&
|
|
8333
|
+
var s = e1(d);
|
|
8334
|
+
if (t == 0) return U1($, 0, s, "");
|
|
8335
|
+
if (!($ in Q)) return s;
|
|
8336
|
+
var r = t1(this, $, $1($));
|
|
8337
|
+
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
8338
|
d: {
|
|
8340
|
-
|
|
8341
|
-
for (var
|
|
8342
|
-
|
|
8343
|
-
var _ = K(
|
|
8344
|
-
if ((_ == 0 ||
|
|
8345
|
-
|
|
8339
|
+
r = P(r, 20).length == 0 || t == 2 ? P(r, 19) : P(r, 20);
|
|
8340
|
+
for (var u, a = r.length, h = 0; h < a; ++h) {
|
|
8341
|
+
u = r[h];
|
|
8342
|
+
var _ = K(u, 3);
|
|
8343
|
+
if ((_ == 0 || s.search(p(u, 3, _ - 1)) == 0) && (_ = new RegExp(p(u, 1)), F(_, s))) {
|
|
8344
|
+
r = u;
|
|
8346
8345
|
break d;
|
|
8347
8346
|
}
|
|
8348
8347
|
}
|
|
8349
|
-
|
|
8348
|
+
r = null;
|
|
8350
8349
|
}
|
|
8351
|
-
return
|
|
8352
|
-
|
|
8350
|
+
return r != null && (a = r, r = v(a, 2), u = new RegExp(p(a, 1)), v(
|
|
8351
|
+
a,
|
|
8353
8352
|
5
|
|
8354
|
-
),
|
|
8353
|
+
), 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
8354
|
};
|
|
8356
8355
|
function t1(d, t, $) {
|
|
8357
8356
|
return $ == "001" ? j(d, "" + t) : j(d, $);
|
|
8358
8357
|
}
|
|
8359
8358
|
function e1(d) {
|
|
8360
8359
|
if (!B(d, 2)) return "";
|
|
8361
|
-
var t = "" +
|
|
8362
|
-
return B(d, 4) &&
|
|
8360
|
+
var t = "" + p(d, 2);
|
|
8361
|
+
return B(d, 4) && p(d, 4) && 0 < v(d, 8) ? Array(v(d, 8) + 1).join("0") + t : t;
|
|
8363
8362
|
}
|
|
8364
|
-
function U1(d, t, $,
|
|
8363
|
+
function U1(d, t, $, s) {
|
|
8365
8364
|
switch (t) {
|
|
8366
8365
|
case 0:
|
|
8367
|
-
return "+" + d + $ +
|
|
8366
|
+
return "+" + d + $ + s;
|
|
8368
8367
|
case 1:
|
|
8369
|
-
return "+" + d + " " + $ +
|
|
8368
|
+
return "+" + d + " " + $ + s;
|
|
8370
8369
|
case 3:
|
|
8371
|
-
return "tel:+" + d + "-" + $ +
|
|
8370
|
+
return "tel:+" + d + "-" + $ + s;
|
|
8372
8371
|
default:
|
|
8373
|
-
return $ +
|
|
8372
|
+
return $ + s;
|
|
8374
8373
|
}
|
|
8375
8374
|
}
|
|
8376
|
-
function
|
|
8375
|
+
function a1(d, t) {
|
|
8377
8376
|
switch (t) {
|
|
8378
8377
|
case 4:
|
|
8379
|
-
return
|
|
8378
|
+
return p(d, 5);
|
|
8380
8379
|
case 3:
|
|
8381
|
-
return
|
|
8380
|
+
return p(d, 4);
|
|
8382
8381
|
case 1:
|
|
8383
|
-
return
|
|
8382
|
+
return p(d, 3);
|
|
8384
8383
|
case 0:
|
|
8385
8384
|
case 2:
|
|
8386
|
-
return
|
|
8385
|
+
return p(d, 2);
|
|
8387
8386
|
case 5:
|
|
8388
|
-
return
|
|
8387
|
+
return p(d, 6);
|
|
8389
8388
|
case 6:
|
|
8390
|
-
return
|
|
8389
|
+
return p(d, 8);
|
|
8391
8390
|
case 7:
|
|
8392
|
-
return
|
|
8391
|
+
return p(d, 7);
|
|
8393
8392
|
case 8:
|
|
8394
|
-
return
|
|
8393
|
+
return p(d, 21);
|
|
8395
8394
|
case 9:
|
|
8396
|
-
return
|
|
8395
|
+
return p(d, 25);
|
|
8397
8396
|
case 10:
|
|
8398
|
-
return
|
|
8397
|
+
return p(d, 28);
|
|
8399
8398
|
default:
|
|
8400
|
-
return
|
|
8399
|
+
return p(d, 1);
|
|
8401
8400
|
}
|
|
8402
8401
|
}
|
|
8403
8402
|
function F1(d, t) {
|
|
@@ -8405,7 +8404,7 @@ const Z2 = (y) => {
|
|
|
8405
8404
|
return d = t1(d, v(t, 1), $), d == null ? -1 : (t = e1(t), m1(t, d));
|
|
8406
8405
|
}
|
|
8407
8406
|
function m1(d, t) {
|
|
8408
|
-
return O(d,
|
|
8407
|
+
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
8408
|
}
|
|
8410
8409
|
function j(d, t) {
|
|
8411
8410
|
if (t == null) return null;
|
|
@@ -8419,11 +8418,11 @@ const Z2 = (y) => {
|
|
|
8419
8418
|
}
|
|
8420
8419
|
function O(d, t) {
|
|
8421
8420
|
var $ = d.length;
|
|
8422
|
-
return 0 < K(t, 9) &&
|
|
8421
|
+
return 0 < K(t, 9) && P(t, 9).indexOf($) == -1 ? !1 : F(v(t, 2), d);
|
|
8423
8422
|
}
|
|
8424
8423
|
function T2(d, t) {
|
|
8425
|
-
var $ = V1(d, t),
|
|
8426
|
-
return
|
|
8424
|
+
var $ = V1(d, t), s = v(t, 1), r = t1(d, s, $);
|
|
8425
|
+
return r == null || $ != "001" && s != K1(d, $) ? r = !1 : (d = e1(t), r = m1(d, r) != -1), r;
|
|
8427
8426
|
}
|
|
8428
8427
|
function V1(d, t) {
|
|
8429
8428
|
if (t == null) return null;
|
|
@@ -8432,16 +8431,16 @@ const Z2 = (y) => {
|
|
|
8432
8431
|
else if ($.length == 1) d = $[0];
|
|
8433
8432
|
else d: {
|
|
8434
8433
|
t = e1(t);
|
|
8435
|
-
for (var
|
|
8436
|
-
|
|
8437
|
-
var
|
|
8438
|
-
if (B(
|
|
8439
|
-
if (t.search(
|
|
8440
|
-
d =
|
|
8434
|
+
for (var s, r = $.length, u = 0; u < r; u++) {
|
|
8435
|
+
s = $[u];
|
|
8436
|
+
var a = j(d, s);
|
|
8437
|
+
if (B(a, 23)) {
|
|
8438
|
+
if (t.search(p(a, 23)) == 0) {
|
|
8439
|
+
d = s;
|
|
8441
8440
|
break d;
|
|
8442
8441
|
}
|
|
8443
|
-
} else if (m1(t,
|
|
8444
|
-
d =
|
|
8442
|
+
} else if (m1(t, a) != -1) {
|
|
8443
|
+
d = s;
|
|
8445
8444
|
break d;
|
|
8446
8445
|
}
|
|
8447
8446
|
}
|
|
@@ -8456,102 +8455,102 @@ const Z2 = (y) => {
|
|
|
8456
8455
|
if (d = j(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8457
8456
|
return v(d, 10);
|
|
8458
8457
|
}
|
|
8459
|
-
function l1(d, t, $,
|
|
8460
|
-
var
|
|
8461
|
-
if (
|
|
8458
|
+
function l1(d, t, $, s) {
|
|
8459
|
+
var r = a1($, s), u = K(r, 9) == 0 ? P(p($, 1), 9) : P(r, 9);
|
|
8460
|
+
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
8461
|
else return l1(d, t, $, 1);
|
|
8463
|
-
return
|
|
8462
|
+
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
8463
|
}
|
|
8465
8464
|
function h1(d, t, $) {
|
|
8466
|
-
var
|
|
8467
|
-
return t = v(t, 1), t in Q ? (t = t1(d, t, $1(t)), l1(d,
|
|
8465
|
+
var s = e1(t);
|
|
8466
|
+
return t = v(t, 1), t in Q ? (t = t1(d, t, $1(t)), l1(d, s, t, $)) : 1;
|
|
8468
8467
|
}
|
|
8469
8468
|
function H1(d, t) {
|
|
8470
8469
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8471
|
-
for (var $,
|
|
8470
|
+
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
8471
|
return 0;
|
|
8473
8472
|
}
|
|
8474
|
-
function j1(d, t, $,
|
|
8473
|
+
function j1(d, t, $, s, r, u) {
|
|
8475
8474
|
if (t.length == 0) return 0;
|
|
8476
8475
|
t = new A(t);
|
|
8477
|
-
var
|
|
8478
|
-
$ != null && (
|
|
8476
|
+
var a;
|
|
8477
|
+
$ != null && (a = p($, 11)), a == null && (a = "NonMatch");
|
|
8479
8478
|
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)),
|
|
8479
|
+
if (h.length == 0) a = 20;
|
|
8480
|
+
else if (d1.test(h)) h = h.replace(d1, ""), k(t), t.g(B1(h)), a = 1;
|
|
8482
8481
|
else {
|
|
8483
|
-
if (h = new RegExp(
|
|
8484
|
-
h =
|
|
8485
|
-
var _ =
|
|
8486
|
-
_ && _[1] != null && 0 < _[1].length && o1(_[1], C1) == "0" ?
|
|
8487
|
-
} else
|
|
8488
|
-
|
|
8482
|
+
if (h = new RegExp(a), k1(t), a = t.toString(), a.search(h) == 0) {
|
|
8483
|
+
h = a.match(h)[0].length;
|
|
8484
|
+
var _ = a.substring(h).match(D1);
|
|
8485
|
+
_ && _[1] != null && 0 < _[1].length && o1(_[1], C1) == "0" ? a = !1 : (k(t), t.g(a.substring(h)), a = !0);
|
|
8486
|
+
} else a = !1;
|
|
8487
|
+
a = a ? 5 : 20;
|
|
8489
8488
|
}
|
|
8490
|
-
if (
|
|
8489
|
+
if (r && E(u, 6, a), a != 20) {
|
|
8491
8490
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8492
|
-
if (d = H1(t,
|
|
8491
|
+
if (d = H1(t, s), d != 0) return E(u, 1, d), d;
|
|
8493
8492
|
throw Error("Invalid country calling code");
|
|
8494
8493
|
}
|
|
8495
|
-
return $ != null && (
|
|
8494
|
+
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
8495
|
}
|
|
8497
8496
|
function W1(d, t, $) {
|
|
8498
|
-
var
|
|
8499
|
-
if (
|
|
8500
|
-
var
|
|
8501
|
-
if (
|
|
8502
|
-
|
|
8503
|
-
var h = F(
|
|
8504
|
-
t =
|
|
8497
|
+
var s = d.toString(), r = s.length, u = p(t, 15);
|
|
8498
|
+
if (r != 0 && u != null && u.length != 0) {
|
|
8499
|
+
var a = new RegExp("^(?:" + u + ")");
|
|
8500
|
+
if (r = a.exec(s)) {
|
|
8501
|
+
u = new RegExp(v(p(t, 1), 2));
|
|
8502
|
+
var h = F(u, s), _ = r.length - 1;
|
|
8503
|
+
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
8504
|
}
|
|
8506
8505
|
}
|
|
8507
8506
|
}
|
|
8508
8507
|
function Z(d, t, $) {
|
|
8509
|
-
if (!
|
|
8508
|
+
if (!u1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8510
8509
|
return z1(d, t, $, !0);
|
|
8511
8510
|
}
|
|
8512
|
-
function z1(d, t, $,
|
|
8511
|
+
function z1(d, t, $, s) {
|
|
8513
8512
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8514
8513
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8515
|
-
var
|
|
8516
|
-
if (
|
|
8517
|
-
else if (
|
|
8514
|
+
var r = new A(), u = t.indexOf(";phone-context=");
|
|
8515
|
+
if (u === -1) u = null;
|
|
8516
|
+
else if (u += 15, u >= t.length) u = "";
|
|
8518
8517
|
else {
|
|
8519
|
-
var
|
|
8520
|
-
|
|
8518
|
+
var a = t.indexOf(";", u);
|
|
8519
|
+
u = a !== -1 ? t.substring(u, a) : t.substring(u);
|
|
8521
8520
|
}
|
|
8522
|
-
var h =
|
|
8523
|
-
if (h == null ?
|
|
8524
|
-
if (
|
|
8525
|
-
|
|
8521
|
+
var h = u;
|
|
8522
|
+
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");
|
|
8523
|
+
if (u = r.toString(), !(u1($) || u != null && 0 < u.length && d1.test(u))) throw Error("Invalid country calling code");
|
|
8524
|
+
u = new H(), s && E(u, 5, t);
|
|
8526
8525
|
d: {
|
|
8527
|
-
if (t =
|
|
8528
|
-
h = t.match(
|
|
8526
|
+
if (t = r.toString(), a = t.search(x1), 0 <= a && R1(t.substring(0, a))) {
|
|
8527
|
+
h = t.match(x1);
|
|
8529
8528
|
for (var _ = h.length, V = 1; V < _; ++V) if (h[V] != null && 0 < h[V].length) {
|
|
8530
|
-
k(
|
|
8529
|
+
k(r), r.g(t.substring(0, a)), t = h[V];
|
|
8531
8530
|
break d;
|
|
8532
8531
|
}
|
|
8533
8532
|
}
|
|
8534
8533
|
t = "";
|
|
8535
8534
|
}
|
|
8536
|
-
0 < t.length && E(
|
|
8535
|
+
0 < t.length && E(u, 3, t), a = j(d, $), t = new A(), h = 0, _ = r.toString();
|
|
8537
8536
|
try {
|
|
8538
|
-
h = j1(d, _,
|
|
8537
|
+
h = j1(d, _, a, t, s, u);
|
|
8539
8538
|
} catch (I1) {
|
|
8540
8539
|
if (I1.message == "Invalid country calling code" && d1.test(_)) {
|
|
8541
|
-
if (_ = _.replace(d1, ""), h = j1(d, _,
|
|
8540
|
+
if (_ = _.replace(d1, ""), h = j1(d, _, a, t, s, u), h == 0) throw I1;
|
|
8542
8541
|
} else throw I1;
|
|
8543
8542
|
}
|
|
8544
|
-
if (h != 0 ? (
|
|
8545
|
-
|
|
8543
|
+
if (h != 0 ? (r = $1(h), r != $ && (a = t1(d, h, r))) : (k1(r), t.g(r.toString()), $ != null ? (h = v(a, 10), E(
|
|
8544
|
+
u,
|
|
8546
8545
|
1,
|
|
8547
8546
|
h
|
|
8548
|
-
)) :
|
|
8547
|
+
)) : 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
8548
|
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(
|
|
8549
|
+
if (1 < s.length && s.charAt(0) == "0") {
|
|
8550
|
+
for (E(u, 4, !0), d = 1; d < s.length - 1 && s.charAt(d) == "0"; ) d++;
|
|
8551
|
+
d != 1 && E(u, 8, d);
|
|
8553
8552
|
}
|
|
8554
|
-
return E(
|
|
8553
|
+
return E(u, 2, parseInt(s, 10)), u;
|
|
8555
8554
|
}
|
|
8556
8555
|
function F(d, t) {
|
|
8557
8556
|
return !!((d = t.match(new RegExp("^(?:" + (typeof d == "string" ? d : d.source) + ")$", "i"))) && d[0].length == t.length);
|
|
@@ -8564,25 +8563,25 @@ const Z2 = (y) => {
|
|
|
8564
8563
|
var E2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), Y1 = /[- ]/;
|
|
8565
8564
|
function J1(d, t) {
|
|
8566
8565
|
var $ = d.ga;
|
|
8567
|
-
return t =
|
|
8566
|
+
return t = u1(t) ? K1($, t) : 0, d = j(d.ga, $1(t)), d ?? Z1;
|
|
8568
8567
|
}
|
|
8569
8568
|
function q1(d) {
|
|
8570
8569
|
for (var t = d.j.length, $ = 0; $ < t; ++$) {
|
|
8571
|
-
var
|
|
8572
|
-
if (d.da ==
|
|
8573
|
-
var
|
|
8574
|
-
k(
|
|
8575
|
-
var _ =
|
|
8576
|
-
|
|
8570
|
+
var s = d.j[$], r = v(s, 1);
|
|
8571
|
+
if (d.da == r) return !1;
|
|
8572
|
+
var u = d, a = s, h = v(a, 1);
|
|
8573
|
+
k(u.v);
|
|
8574
|
+
var _ = u;
|
|
8575
|
+
a = v(a, 2);
|
|
8577
8576
|
var V = "999999999999999".match(h)[0];
|
|
8578
|
-
if (V.length < _.g.h.length ? _ = "" : (_ = V.replace(new RegExp(h, "g"),
|
|
8577
|
+
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
8578
|
}
|
|
8580
8579
|
return d.u = !1;
|
|
8581
8580
|
}
|
|
8582
8581
|
function X1(d, t) {
|
|
8583
|
-
for (var $ = [],
|
|
8584
|
-
var
|
|
8585
|
-
K(
|
|
8582
|
+
for (var $ = [], s = t.length - 3, r = d.j.length, u = 0; u < r; ++u) {
|
|
8583
|
+
var a = d.j[u];
|
|
8584
|
+
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
8585
|
}
|
|
8587
8586
|
d.j = $;
|
|
8588
8587
|
}
|
|
@@ -8613,9 +8612,9 @@ const Z2 = (y) => {
|
|
|
8613
8612
|
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, k(d.v), d.da = "", y1(d);
|
|
8614
8613
|
}
|
|
8615
8614
|
function d2(d) {
|
|
8616
|
-
for (var t = d.g.toString(), $ = d.j.length,
|
|
8617
|
-
var
|
|
8618
|
-
if (new RegExp("^(?:" +
|
|
8615
|
+
for (var t = d.g.toString(), $ = d.j.length, s = 0; s < $; ++s) {
|
|
8616
|
+
var r = d.j[s], u = v(r, 1);
|
|
8617
|
+
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
8618
|
}
|
|
8620
8619
|
return "";
|
|
8621
8620
|
}
|
|
@@ -8626,9 +8625,9 @@ const Z2 = (y) => {
|
|
|
8626
8625
|
function y1(d) {
|
|
8627
8626
|
var t = d.g.toString();
|
|
8628
8627
|
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(
|
|
8628
|
+
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) {
|
|
8629
|
+
var u = $[r];
|
|
8630
|
+
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
8631
|
}
|
|
8633
8632
|
return X1(d, t), t = d2(d), 0 < t.length ? t : q1(d) ? t2(d) : d.s.toString();
|
|
8634
8633
|
}
|
|
@@ -8637,19 +8636,19 @@ const Z2 = (y) => {
|
|
|
8637
8636
|
function t2(d) {
|
|
8638
8637
|
var t = d.g.toString(), $ = t.length;
|
|
8639
8638
|
if (0 < $) {
|
|
8640
|
-
for (var
|
|
8641
|
-
return d.u ? c1(d,
|
|
8639
|
+
for (var s = "", r = 0; r < $; r++) s = n2(d, t.charAt(r));
|
|
8640
|
+
return d.u ? c1(d, s) : d.s.toString();
|
|
8642
8641
|
}
|
|
8643
8642
|
return d.h.toString();
|
|
8644
8643
|
}
|
|
8645
8644
|
function e2(d) {
|
|
8646
8645
|
var t = d.g.toString(), $ = 0;
|
|
8647
|
-
if (
|
|
8648
|
-
else
|
|
8649
|
-
return
|
|
8646
|
+
if (p(d.l, 10) != 1) var s = !1;
|
|
8647
|
+
else s = d.g.toString(), s = s.charAt(0) == "1" && s.charAt(1) != "0" && s.charAt(1) != "1";
|
|
8648
|
+
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
8649
|
}
|
|
8651
8650
|
function $2(d) {
|
|
8652
|
-
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" +
|
|
8651
|
+
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + p(d.l, 11) + ")");
|
|
8653
8652
|
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
8653
|
}
|
|
8655
8654
|
function i2(d) {
|
|
@@ -8660,8 +8659,8 @@ const Z2 = (y) => {
|
|
|
8660
8659
|
function n2(d, t) {
|
|
8661
8660
|
var $ = d.v.toString();
|
|
8662
8661
|
if (0 <= $.substring(d.$).search(d.fa)) {
|
|
8663
|
-
var
|
|
8664
|
-
return t = $.replace(d.fa, t), k(d.v), d.v.g(t), d.$ =
|
|
8662
|
+
var s = $.search(d.fa);
|
|
8663
|
+
return t = $.replace(d.fa, t), k(d.v), d.v.g(t), d.$ = s, t.substring(0, d.$ + 1);
|
|
8665
8664
|
}
|
|
8666
8665
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
8667
8666
|
}
|
|
@@ -8671,31 +8670,31 @@ const Z2 = (y) => {
|
|
|
8671
8670
|
}, _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
8671
|
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
8673
8672
|
try {
|
|
8674
|
-
const $ = d.replace(/[^+0-9]/g, ""),
|
|
8673
|
+
const $ = d.replace(/[^+0-9]/g, ""), s = new A2(t);
|
|
8675
8674
|
t = "";
|
|
8676
|
-
for (let
|
|
8675
|
+
for (let r = 0; r < $.length; r++) s.ja = M2(s, $.charAt(r)), t = s.ja;
|
|
8677
8676
|
return t;
|
|
8678
8677
|
} catch {
|
|
8679
8678
|
return d;
|
|
8680
8679
|
}
|
|
8681
8680
|
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => {
|
|
8682
8681
|
try {
|
|
8683
|
-
const
|
|
8684
|
-
var
|
|
8685
|
-
return
|
|
8682
|
+
const r = M.g(), u = Z(r, d, t);
|
|
8683
|
+
var s = h1(r, u, -1);
|
|
8684
|
+
return s == 0 || s == 4 ? r.format(u, typeof $ > "u" ? 0 : $) : d;
|
|
8686
8685
|
} catch {
|
|
8687
8686
|
return d;
|
|
8688
8687
|
}
|
|
8689
|
-
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $,
|
|
8688
|
+
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, s) => {
|
|
8690
8689
|
try {
|
|
8691
8690
|
const _ = M.g();
|
|
8692
8691
|
d: {
|
|
8693
|
-
var
|
|
8694
|
-
if (
|
|
8695
|
-
var
|
|
8692
|
+
var r = _;
|
|
8693
|
+
if (u1(d)) {
|
|
8694
|
+
var u = a1(j(r, d), $);
|
|
8696
8695
|
try {
|
|
8697
|
-
if (B(
|
|
8698
|
-
var
|
|
8696
|
+
if (B(u, 6)) {
|
|
8697
|
+
var a = p(u, 6), h = z1(r, a, d, !1);
|
|
8699
8698
|
break d;
|
|
8700
8699
|
}
|
|
8701
8700
|
} catch {
|
|
@@ -8703,57 +8702,57 @@ const Z2 = (y) => {
|
|
|
8703
8702
|
}
|
|
8704
8703
|
h = null;
|
|
8705
8704
|
}
|
|
8706
|
-
return _.format(h,
|
|
8705
|
+
return _.format(h, s ? 0 : t ? 2 : 1);
|
|
8707
8706
|
} catch {
|
|
8708
8707
|
return "";
|
|
8709
8708
|
}
|
|
8710
8709
|
}), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
|
|
8711
8710
|
try {
|
|
8712
|
-
return
|
|
8711
|
+
return p(Z(M.g(), d, t), 3);
|
|
8713
8712
|
} catch {
|
|
8714
8713
|
return "";
|
|
8715
8714
|
}
|
|
8716
8715
|
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
8717
8716
|
try {
|
|
8718
|
-
const $ = M.g(),
|
|
8719
|
-
return F1($,
|
|
8717
|
+
const $ = M.g(), s = Z($, d, t);
|
|
8718
|
+
return F1($, s);
|
|
8720
8719
|
} catch {
|
|
8721
8720
|
return -99;
|
|
8722
8721
|
}
|
|
8723
8722
|
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
8724
8723
|
if (!t) return 1;
|
|
8725
8724
|
try {
|
|
8726
|
-
const $ = M.g(),
|
|
8727
|
-
return h1($,
|
|
8725
|
+
const $ = M.g(), s = Z($, d, t);
|
|
8726
|
+
return h1($, s, -1);
|
|
8728
8727
|
} catch ($) {
|
|
8729
8728
|
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
8729
|
}
|
|
8731
8730
|
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t, $) => {
|
|
8732
8731
|
try {
|
|
8733
|
-
const
|
|
8732
|
+
const s = M.g(), r = Z(s, d, t), u = T2(s, r);
|
|
8734
8733
|
if ($) {
|
|
8735
|
-
const
|
|
8736
|
-
return
|
|
8734
|
+
const a = s2($).map((h) => _1[h]);
|
|
8735
|
+
return u && a.includes(F1(s, r));
|
|
8737
8736
|
}
|
|
8738
|
-
return
|
|
8737
|
+
return u;
|
|
8739
8738
|
} catch {
|
|
8740
8739
|
return !1;
|
|
8741
8740
|
}
|
|
8742
8741
|
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => {
|
|
8743
8742
|
try {
|
|
8744
|
-
const
|
|
8743
|
+
const s = M.g(), r = Z(s, d, t);
|
|
8745
8744
|
if ($) {
|
|
8746
|
-
const
|
|
8747
|
-
for (let
|
|
8745
|
+
const u = s2($);
|
|
8746
|
+
for (let a of u) if (h1(s, r, _1[a]) === 0) return !0;
|
|
8748
8747
|
return !1;
|
|
8749
8748
|
}
|
|
8750
|
-
return h1(
|
|
8749
|
+
return h1(s, r, -1) === 0;
|
|
8751
8750
|
} catch {
|
|
8752
8751
|
return !1;
|
|
8753
8752
|
}
|
|
8754
8753
|
}), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
|
|
8755
8754
|
try {
|
|
8756
|
-
return
|
|
8755
|
+
return p(Z(M.g(), d, t), 2).toString();
|
|
8757
8756
|
} catch {
|
|
8758
8757
|
return "";
|
|
8759
8758
|
}
|
|
@@ -8795,41 +8794,41 @@ const q2 = {
|
|
|
8795
8794
|
"changeErrorCode"
|
|
8796
8795
|
], ["update:modelValue"]),
|
|
8797
8796
|
setup(y, { expose: e, emit: i }) {
|
|
8798
|
-
const
|
|
8799
|
-
let
|
|
8800
|
-
|
|
8797
|
+
const n = D2(y, "modelValue"), o = y, l = i, C = v1(), g = v1(), c = v1(!1), S = () => g.value ? o.options.strictMode ? g.value.isValidNumberPrecise() : g.value.isValidNumber() : null, w = () => {
|
|
8798
|
+
let f = S();
|
|
8799
|
+
c.value !== f && (c.value = f, l("changeValidity", !!f), l(
|
|
8801
8800
|
"changeErrorCode",
|
|
8802
|
-
|
|
8801
|
+
f ? null : g.value.getValidationError()
|
|
8803
8802
|
));
|
|
8804
8803
|
}, b = () => {
|
|
8805
|
-
var
|
|
8806
|
-
l("changeNumber", ((
|
|
8804
|
+
var f;
|
|
8805
|
+
l("changeNumber", ((f = g.value) == null ? void 0 : f.getNumber()) ?? ""), w();
|
|
8807
8806
|
}, L = () => {
|
|
8808
|
-
var
|
|
8809
|
-
l("changeCountry", ((
|
|
8807
|
+
var f;
|
|
8808
|
+
l("changeCountry", ((f = g.value) == null ? void 0 : f.getSelectedCountryData().iso2) ?? ""), b(), w();
|
|
8810
8809
|
};
|
|
8811
|
-
return
|
|
8812
|
-
|
|
8813
|
-
}),
|
|
8814
|
-
() =>
|
|
8815
|
-
(
|
|
8810
|
+
return P2(() => {
|
|
8811
|
+
C.value && (g.value = m(C.value, o.options), o.value && g.value.setNumber(o.value), o.disabled && g.value.setDisabled(o.disabled), c.value = S());
|
|
8812
|
+
}), x2(
|
|
8813
|
+
() => o.disabled,
|
|
8814
|
+
(f) => {
|
|
8816
8815
|
var I;
|
|
8817
|
-
return (I =
|
|
8816
|
+
return (I = g.value) == null ? void 0 : I.setDisabled(f);
|
|
8818
8817
|
}
|
|
8819
8818
|
), R2(() => {
|
|
8820
|
-
var
|
|
8821
|
-
return (
|
|
8822
|
-
}), e({ instance:
|
|
8819
|
+
var f;
|
|
8820
|
+
return (f = g.value) == null ? void 0 : f.destroy();
|
|
8821
|
+
}), e({ instance: g, input: C }), (f, I) => B2((O2(), k2("input", G2({
|
|
8823
8822
|
ref_key: "input",
|
|
8824
|
-
ref:
|
|
8825
|
-
"onUpdate:modelValue": I[0] || (I[0] = (G) =>
|
|
8823
|
+
ref: C,
|
|
8824
|
+
"onUpdate:modelValue": I[0] || (I[0] = (G) => n.value = G),
|
|
8826
8825
|
type: "tel",
|
|
8827
8826
|
onCountrychange: L,
|
|
8828
8827
|
onInput: b
|
|
8829
8828
|
}, y.inputProps), null, 16)), [
|
|
8830
8829
|
[
|
|
8831
8830
|
U2,
|
|
8832
|
-
|
|
8831
|
+
n.value,
|
|
8833
8832
|
void 0,
|
|
8834
8833
|
{ lazy: !0 }
|
|
8835
8834
|
]
|