intl-tel-input 25.7.0 → 25.8.1
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 +11 -11
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +90 -40
- package/angular/build/IntlTelInputWithUtils.js +90 -40
- package/angular/build/types/intl-tel-input/i18n/types.d.ts +1 -0
- package/angular/build/types/intl-tel-input.d.ts +10 -1
- package/build/css/intlTelInput.css +70 -6
- 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 +1 -0
- package/build/js/intlTelInput.d.ts +11 -1
- package/build/js/intlTelInput.js +107 -41
- package/build/js/intlTelInput.min.js +13 -2
- package/build/js/intlTelInputWithUtils.js +107 -41
- package/build/js/intlTelInputWithUtils.min.js +13 -2
- package/package.json +7 -12
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +106 -40
- package/react/build/IntlTelInput.d.ts +11 -1
- package/react/build/IntlTelInput.js +106 -40
- package/react/build/IntlTelInputWithUtils.cjs +106 -40
- package/react/build/IntlTelInputWithUtils.js +106 -40
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +201 -134
- package/vue/build/IntlTelInputWithUtils.mjs +737 -670
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as r2, useModel as
|
|
1
|
+
import { mergeModels as r2, useModel as D2, ref as v1, onMounted as x2, watch as P2, 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",
|
|
@@ -1322,9 +1322,9 @@ const F2 = [
|
|
|
1322
1322
|
// Zimbabwe
|
|
1323
1323
|
"263"
|
|
1324
1324
|
]
|
|
1325
|
-
],
|
|
1325
|
+
], q = [];
|
|
1326
1326
|
for (const y of F2)
|
|
1327
|
-
|
|
1327
|
+
q.push({
|
|
1328
1328
|
name: "",
|
|
1329
1329
|
// populated in the plugin
|
|
1330
1330
|
iso2: y[0],
|
|
@@ -1335,7 +1335,7 @@ for (const y of F2)
|
|
|
1335
1335
|
// populated by the plugin
|
|
1336
1336
|
nationalPrefix: y[4] || null
|
|
1337
1337
|
});
|
|
1338
|
-
const
|
|
1338
|
+
const V2 = {
|
|
1339
1339
|
ad: "Andorra",
|
|
1340
1340
|
ae: "United Arab Emirates",
|
|
1341
1341
|
af: "Afghanistan",
|
|
@@ -1578,28 +1578,29 @@ const U2 = {
|
|
|
1578
1578
|
za: "South Africa",
|
|
1579
1579
|
zm: "Zambia",
|
|
1580
1580
|
zw: "Zimbabwe"
|
|
1581
|
-
},
|
|
1581
|
+
}, K2 = {
|
|
1582
1582
|
selectedCountryAriaLabel: "Selected country",
|
|
1583
1583
|
noCountrySelected: "No country selected",
|
|
1584
1584
|
countryListAriaLabel: "List of countries",
|
|
1585
1585
|
searchPlaceholder: "Search",
|
|
1586
|
+
clearSearchAriaLabel: "Clear search",
|
|
1586
1587
|
zeroSearchResults: "No results found",
|
|
1587
1588
|
oneSearchResult: "1 result found",
|
|
1588
1589
|
multipleSearchResults: "${count} results found",
|
|
1589
1590
|
// additional countries (not supported by country-list library)
|
|
1590
1591
|
ac: "Ascension Island",
|
|
1591
1592
|
xk: "Kosovo"
|
|
1592
|
-
}, u2 = { ...
|
|
1593
|
-
for (const y of
|
|
1593
|
+
}, u2 = { ...V2, ...K2 };
|
|
1594
|
+
for (const y of q)
|
|
1594
1595
|
y.name = u2[y.iso2];
|
|
1595
|
-
let
|
|
1596
|
-
const
|
|
1596
|
+
let H2 = 0;
|
|
1597
|
+
const S1 = (y) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(y).matches, j2 = () => {
|
|
1597
1598
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1598
|
-
const y = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), e =
|
|
1599
|
-
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)"), s = S1("(pointer: coarse)");
|
|
1600
|
+
return y || e || s && i;
|
|
1600
1601
|
}
|
|
1601
1602
|
return !1;
|
|
1602
|
-
},
|
|
1603
|
+
}, l2 = {
|
|
1603
1604
|
//* Whether or not to allow the dropdown.
|
|
1604
1605
|
allowDropdown: !0,
|
|
1605
1606
|
//* Add a placeholder in the input with an example number for the selected country.
|
|
@@ -1645,10 +1646,10 @@ const v1 = (y) => typeof window < "u" && typeof window.matchMedia == "function"
|
|
|
1645
1646
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
1646
1647
|
strictMode: !1,
|
|
1647
1648
|
//* Use full screen popup instead of dropdown for country list.
|
|
1648
|
-
useFullscreenPopup:
|
|
1649
|
+
useFullscreenPopup: j2(),
|
|
1649
1650
|
//* The number type to enforce during validation.
|
|
1650
1651
|
validationNumberTypes: ["MOBILE"]
|
|
1651
|
-
},
|
|
1652
|
+
}, W2 = [
|
|
1652
1653
|
"800",
|
|
1653
1654
|
"822",
|
|
1654
1655
|
"833",
|
|
@@ -1666,46 +1667,53 @@ const v1 = (y) => typeof window < "u" && typeof window.matchMedia == "function"
|
|
|
1666
1667
|
"887",
|
|
1667
1668
|
"888",
|
|
1668
1669
|
"889"
|
|
1669
|
-
],
|
|
1670
|
-
const e =
|
|
1670
|
+
], f1 = (y) => y.replace(/\D/g, ""), o2 = (y = "") => y.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), a2 = (y) => {
|
|
1671
|
+
const e = f1(y);
|
|
1671
1672
|
if (e.charAt(0) === "1") {
|
|
1672
|
-
const
|
|
1673
|
-
return
|
|
1673
|
+
const i = e.substring(1, 4);
|
|
1674
|
+
return W2.includes(i);
|
|
1674
1675
|
}
|
|
1675
1676
|
return !1;
|
|
1676
|
-
},
|
|
1677
|
-
if (
|
|
1677
|
+
}, z2 = (y, e, i, s) => {
|
|
1678
|
+
if (i === 0 && !s)
|
|
1678
1679
|
return 0;
|
|
1679
|
-
let
|
|
1680
|
+
let r = 0;
|
|
1680
1681
|
for (let l = 0; l < e.length; l++) {
|
|
1681
|
-
if (/[+0-9]/.test(e[l]) &&
|
|
1682
|
+
if (/[+0-9]/.test(e[l]) && r++, r === y && !s)
|
|
1682
1683
|
return l + 1;
|
|
1683
|
-
if (
|
|
1684
|
+
if (s && r === y + 1)
|
|
1684
1685
|
return l;
|
|
1685
1686
|
}
|
|
1686
1687
|
return e.length;
|
|
1687
|
-
},
|
|
1688
|
-
const
|
|
1689
|
-
return e && Object.entries(e).forEach(([
|
|
1690
|
-
},
|
|
1691
|
-
const { instances:
|
|
1692
|
-
Object.values(
|
|
1688
|
+
}, T = (y, e, i) => {
|
|
1689
|
+
const s = document.createElement(y);
|
|
1690
|
+
return e && Object.entries(e).forEach(([r, l]) => s.setAttribute(r, l)), i && i.appendChild(s), s;
|
|
1691
|
+
}, i1 = (y, ...e) => {
|
|
1692
|
+
const { instances: i } = m;
|
|
1693
|
+
Object.values(i).forEach((s) => s[y](...e));
|
|
1693
1694
|
};
|
|
1694
|
-
class
|
|
1695
|
-
|
|
1696
|
-
|
|
1695
|
+
class p1 {
|
|
1696
|
+
/**
|
|
1697
|
+
* Build a space-delimited class string from an object map of className -> truthy/falsey.
|
|
1698
|
+
* Only keys with truthy values are included.
|
|
1699
|
+
*/
|
|
1700
|
+
static _buildClassNames(e) {
|
|
1701
|
+
return Object.keys(e).filter((i) => !!e[i]).join(" ");
|
|
1702
|
+
}
|
|
1703
|
+
constructor(e, i = {}) {
|
|
1704
|
+
this.id = H2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, l2, i), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
|
|
1697
1705
|
}
|
|
1698
1706
|
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
1699
1707
|
_init() {
|
|
1700
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";
|
|
1701
1709
|
const e = this.options.allowDropdown || this.options.separateDialCode;
|
|
1702
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 = { ...u2, ...this.options.i18n };
|
|
1703
|
-
const
|
|
1704
|
-
this.resolveAutoCountryPromise =
|
|
1705
|
-
}),
|
|
1706
|
-
this.resolveUtilsScriptPromise =
|
|
1711
|
+
const i = new Promise((r, l) => {
|
|
1712
|
+
this.resolveAutoCountryPromise = r, this.rejectAutoCountryPromise = l;
|
|
1713
|
+
}), s = new Promise((r, l) => {
|
|
1714
|
+
this.resolveUtilsScriptPromise = r, this.rejectUtilsScriptPromise = l;
|
|
1707
1715
|
});
|
|
1708
|
-
this.promise = Promise.all([
|
|
1716
|
+
this.promise = Promise.all([i, s]), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
1709
1717
|
}
|
|
1710
1718
|
//********************
|
|
1711
1719
|
//* PRIVATE METHODS
|
|
@@ -1717,54 +1725,54 @@ class z2 {
|
|
|
1717
1725
|
//* Precompute and cache country search tokens to speed up filtering
|
|
1718
1726
|
_cacheSearchTokens() {
|
|
1719
1727
|
for (const e of this.countries)
|
|
1720
|
-
e.normalisedName =
|
|
1728
|
+
e.normalisedName = o2(e.name), e.initials = e.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map((i) => i[0]).join("").toLowerCase(), e.dialCodePlus = `+${e.dialCode}`;
|
|
1721
1729
|
}
|
|
1722
1730
|
//* Sort countries by countryOrder option (if present), then name.
|
|
1723
1731
|
_sortCountries() {
|
|
1724
|
-
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e,
|
|
1725
|
-
const { countryOrder:
|
|
1726
|
-
if (
|
|
1727
|
-
const
|
|
1732
|
+
this.options.countryOrder && (this.options.countryOrder = this.options.countryOrder.map((e) => e.toLowerCase())), this.countries.sort((e, i) => {
|
|
1733
|
+
const { countryOrder: s } = this.options;
|
|
1734
|
+
if (s) {
|
|
1735
|
+
const r = s.indexOf(e.iso2), l = s.indexOf(i.iso2), c = r > -1, C = l > -1;
|
|
1728
1736
|
if (c || C)
|
|
1729
|
-
return c && C ?
|
|
1737
|
+
return c && C ? r - l : c ? -1 : 1;
|
|
1730
1738
|
}
|
|
1731
|
-
return e.name.localeCompare(
|
|
1739
|
+
return e.name.localeCompare(i.name);
|
|
1732
1740
|
});
|
|
1733
1741
|
}
|
|
1734
1742
|
//* Add a dial code to this.dialCodeToIso2Map.
|
|
1735
|
-
_addToDialCodeMap(e,
|
|
1736
|
-
|
|
1737
|
-
const
|
|
1738
|
-
if (
|
|
1743
|
+
_addToDialCodeMap(e, i, s) {
|
|
1744
|
+
i.length > this.dialCodeMaxLen && (this.dialCodeMaxLen = i.length), this.dialCodeToIso2Map.hasOwnProperty(i) || (this.dialCodeToIso2Map[i] = []);
|
|
1745
|
+
const r = this.dialCodeToIso2Map[i];
|
|
1746
|
+
if (r.includes(e))
|
|
1739
1747
|
return;
|
|
1740
|
-
const l =
|
|
1741
|
-
|
|
1748
|
+
const l = s !== void 0 ? s : r.length;
|
|
1749
|
+
r[l] = e;
|
|
1742
1750
|
}
|
|
1743
1751
|
//* Process onlyCountries or excludeCountries array if present.
|
|
1744
1752
|
_processAllCountries() {
|
|
1745
|
-
const { onlyCountries: e, excludeCountries:
|
|
1753
|
+
const { onlyCountries: e, excludeCountries: i } = this.options;
|
|
1746
1754
|
if (e.length) {
|
|
1747
|
-
const
|
|
1748
|
-
(
|
|
1755
|
+
const s = e.map(
|
|
1756
|
+
(r) => r.toLowerCase()
|
|
1749
1757
|
);
|
|
1750
|
-
this.countries =
|
|
1751
|
-
(
|
|
1758
|
+
this.countries = q.filter(
|
|
1759
|
+
(r) => s.includes(r.iso2)
|
|
1752
1760
|
);
|
|
1753
|
-
} else if (
|
|
1754
|
-
const
|
|
1755
|
-
(
|
|
1761
|
+
} else if (i.length) {
|
|
1762
|
+
const s = i.map(
|
|
1763
|
+
(r) => r.toLowerCase()
|
|
1756
1764
|
);
|
|
1757
|
-
this.countries =
|
|
1758
|
-
(
|
|
1765
|
+
this.countries = q.filter(
|
|
1766
|
+
(r) => !s.includes(r.iso2)
|
|
1759
1767
|
);
|
|
1760
1768
|
} else
|
|
1761
|
-
this.countries =
|
|
1769
|
+
this.countries = q;
|
|
1762
1770
|
}
|
|
1763
1771
|
//* Translate Countries by object literal provided on config.
|
|
1764
1772
|
_translateCountryNames() {
|
|
1765
1773
|
for (const e of this.countries) {
|
|
1766
|
-
const
|
|
1767
|
-
this.options.i18n.hasOwnProperty(
|
|
1774
|
+
const i = e.iso2.toLowerCase();
|
|
1775
|
+
this.options.i18n.hasOwnProperty(i) && (e.name = this.options.i18n[i]);
|
|
1768
1776
|
}
|
|
1769
1777
|
}
|
|
1770
1778
|
//* Generate this.dialCodes and this.dialCodeToIso2Map.
|
|
@@ -1774,121 +1782,179 @@ class z2 {
|
|
|
1774
1782
|
this.dialCodes.has(e.dialCode) || this.dialCodes.add(e.dialCode), this._addToDialCodeMap(e.iso2, e.dialCode, e.priority);
|
|
1775
1783
|
for (const e of this.countries)
|
|
1776
1784
|
if (e.areaCodes) {
|
|
1777
|
-
const
|
|
1778
|
-
for (const
|
|
1779
|
-
for (let
|
|
1780
|
-
const l =
|
|
1781
|
-
this._addToDialCodeMap(
|
|
1785
|
+
const i = this.dialCodeToIso2Map[e.dialCode][0];
|
|
1786
|
+
for (const s of e.areaCodes) {
|
|
1787
|
+
for (let r = 1; r < s.length; r++) {
|
|
1788
|
+
const l = s.substring(0, r), c = e.dialCode + l;
|
|
1789
|
+
this._addToDialCodeMap(i, c), this._addToDialCodeMap(e.iso2, c);
|
|
1782
1790
|
}
|
|
1783
|
-
this._addToDialCodeMap(e.iso2, e.dialCode +
|
|
1791
|
+
this._addToDialCodeMap(e.iso2, e.dialCode + s);
|
|
1784
1792
|
}
|
|
1785
1793
|
}
|
|
1786
1794
|
}
|
|
1787
1795
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
1788
1796
|
_generateMarkup() {
|
|
1789
|
-
var
|
|
1797
|
+
var p, I, G;
|
|
1790
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");
|
|
1791
1799
|
const {
|
|
1792
1800
|
allowDropdown: e,
|
|
1793
|
-
separateDialCode:
|
|
1794
|
-
showFlags:
|
|
1795
|
-
containerClass:
|
|
1801
|
+
separateDialCode: i,
|
|
1802
|
+
showFlags: s,
|
|
1803
|
+
containerClass: r,
|
|
1796
1804
|
hiddenInput: l,
|
|
1797
1805
|
dropdownContainer: c,
|
|
1798
1806
|
fixDropdownWidth: C,
|
|
1799
|
-
useFullscreenPopup:
|
|
1800
|
-
countrySearch:
|
|
1801
|
-
i18n:
|
|
1802
|
-
} = this.options
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1807
|
+
useFullscreenPopup: f,
|
|
1808
|
+
countrySearch: S,
|
|
1809
|
+
i18n: w
|
|
1810
|
+
} = this.options, b = p1._buildClassNames({
|
|
1811
|
+
iti: !0,
|
|
1812
|
+
"iti--allow-dropdown": e,
|
|
1813
|
+
"iti--show-flags": s,
|
|
1814
|
+
"iti--inline-dropdown": !f,
|
|
1815
|
+
[r]: !!r
|
|
1816
|
+
}), L = T("div", { class: b });
|
|
1817
|
+
if ((p = this.telInput.parentNode) == null || p.insertBefore(L, this.telInput), e || s || i) {
|
|
1818
|
+
this.countryContainer = T(
|
|
1808
1819
|
"div",
|
|
1809
1820
|
{ class: "iti__country-container" },
|
|
1810
1821
|
L
|
|
1811
|
-
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry =
|
|
1822
|
+
), this.showSelectedCountryOnLeft ? this.countryContainer.style.left = "0px" : this.countryContainer.style.right = "0px", e ? (this.selectedCountry = T(
|
|
1812
1823
|
"button",
|
|
1813
1824
|
{
|
|
1814
1825
|
type: "button",
|
|
1815
1826
|
class: "iti__selected-country",
|
|
1816
1827
|
"aria-expanded": "false",
|
|
1817
1828
|
"aria-label": this.options.i18n.selectedCountryAriaLabel,
|
|
1818
|
-
"aria-haspopup": "
|
|
1819
|
-
"aria-controls": `iti-${this.id}__dropdown-content
|
|
1820
|
-
role: "combobox"
|
|
1829
|
+
"aria-haspopup": "dialog",
|
|
1830
|
+
"aria-controls": `iti-${this.id}__dropdown-content`
|
|
1821
1831
|
},
|
|
1822
1832
|
this.countryContainer
|
|
1823
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
1833
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = T(
|
|
1824
1834
|
"div",
|
|
1825
1835
|
{ class: "iti__selected-country" },
|
|
1826
1836
|
this.countryContainer
|
|
1827
1837
|
);
|
|
1828
|
-
const
|
|
1829
|
-
if (this.selectedCountryInner =
|
|
1838
|
+
const U = T("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1839
|
+
if (this.selectedCountryInner = T("div", { class: "iti__flag" }, U), this.selectedCountryA11yText = T(
|
|
1830
1840
|
"span",
|
|
1831
1841
|
{ class: "iti__a11y-text" },
|
|
1832
1842
|
this.selectedCountryInner
|
|
1833
|
-
), e && (this.dropdownArrow =
|
|
1843
|
+
), e && (this.dropdownArrow = T(
|
|
1834
1844
|
"div",
|
|
1835
1845
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
1836
|
-
|
|
1837
|
-
)),
|
|
1846
|
+
U
|
|
1847
|
+
)), i && (this.selectedDialCode = T(
|
|
1838
1848
|
"div",
|
|
1839
1849
|
{ class: "iti__selected-dial-code", "aria-hidden": "true", dir: "ltr" },
|
|
1840
1850
|
this.selectedCountry
|
|
1841
1851
|
)), e) {
|
|
1842
1852
|
const D = C ? "" : "iti--flexible-dropdown-width";
|
|
1843
|
-
if (this.dropdownContent =
|
|
1853
|
+
if (this.dropdownContent = T("div", {
|
|
1844
1854
|
id: `iti-${this.id}__dropdown-content`,
|
|
1845
|
-
class: `iti__dropdown-content iti__hide ${D}
|
|
1846
|
-
|
|
1847
|
-
"
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
"
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1855
|
+
class: `iti__dropdown-content iti__hide ${D}`,
|
|
1856
|
+
role: "dialog",
|
|
1857
|
+
"aria-modal": "true"
|
|
1858
|
+
}), S) {
|
|
1859
|
+
const P = T(
|
|
1860
|
+
"div",
|
|
1861
|
+
{ class: "iti__search-input-wrapper" },
|
|
1862
|
+
this.dropdownContent
|
|
1863
|
+
);
|
|
1864
|
+
this.searchIcon = T(
|
|
1865
|
+
"span",
|
|
1866
|
+
{
|
|
1867
|
+
class: "iti__search-icon",
|
|
1868
|
+
"aria-hidden": "true"
|
|
1869
|
+
},
|
|
1870
|
+
P
|
|
1871
|
+
), this.searchIcon.innerHTML = `
|
|
1872
|
+
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
1873
|
+
<circle cx="11" cy="11" r="7" />
|
|
1874
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1875
|
+
</svg>`, this.searchInput = T(
|
|
1876
|
+
"input",
|
|
1877
|
+
{
|
|
1878
|
+
id: `iti-${this.id}__search-input`,
|
|
1879
|
+
// Chrome says inputs need either a name or an id
|
|
1880
|
+
type: "search",
|
|
1881
|
+
class: "iti__search-input",
|
|
1882
|
+
placeholder: w.searchPlaceholder,
|
|
1883
|
+
// role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
|
|
1884
|
+
role: "combobox",
|
|
1885
|
+
"aria-expanded": "true",
|
|
1886
|
+
"aria-label": w.searchPlaceholder,
|
|
1887
|
+
"aria-controls": `iti-${this.id}__country-listbox`,
|
|
1888
|
+
"aria-autocomplete": "list",
|
|
1889
|
+
autocomplete: "off"
|
|
1890
|
+
},
|
|
1891
|
+
P
|
|
1892
|
+
), this.searchClearButton = T(
|
|
1893
|
+
"button",
|
|
1894
|
+
{
|
|
1895
|
+
type: "button",
|
|
1896
|
+
class: "iti__search-clear iti__hide",
|
|
1897
|
+
"aria-label": w.clearSearchAriaLabel,
|
|
1898
|
+
tabindex: "-1"
|
|
1899
|
+
},
|
|
1900
|
+
P
|
|
1901
|
+
);
|
|
1902
|
+
const Y = `iti-${this.id}-clear-mask`;
|
|
1903
|
+
this.searchClearButton.innerHTML = `
|
|
1904
|
+
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
1905
|
+
<mask id="${Y}" maskUnits="userSpaceOnUse">
|
|
1906
|
+
<rect width="16" height="16" fill="white" />
|
|
1907
|
+
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
|
|
1908
|
+
</mask>
|
|
1909
|
+
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${Y})" />
|
|
1910
|
+
</svg>`, this.searchResultsA11yText = T(
|
|
1911
|
+
"span",
|
|
1912
|
+
{ class: "iti__a11y-text" },
|
|
1913
|
+
this.dropdownContent
|
|
1914
|
+
), this.searchNoResults = T(
|
|
1915
|
+
"div",
|
|
1916
|
+
{
|
|
1917
|
+
class: "iti__no-results iti__hide",
|
|
1918
|
+
"aria-hidden": "true"
|
|
1919
|
+
// all a11y messaging happens in this.searchResultsA11yText
|
|
1920
|
+
},
|
|
1921
|
+
this.dropdownContent
|
|
1922
|
+
), this.searchNoResults.textContent = w.zeroSearchResults;
|
|
1923
|
+
}
|
|
1924
|
+
if (this.countryList = T(
|
|
1865
1925
|
"ul",
|
|
1866
1926
|
{
|
|
1867
1927
|
class: "iti__country-list",
|
|
1868
1928
|
id: `iti-${this.id}__country-listbox`,
|
|
1869
1929
|
role: "listbox",
|
|
1870
|
-
"aria-label":
|
|
1930
|
+
"aria-label": w.countryListAriaLabel
|
|
1871
1931
|
},
|
|
1872
1932
|
this.dropdownContent
|
|
1873
|
-
), this._appendListItems(),
|
|
1874
|
-
|
|
1875
|
-
|
|
1933
|
+
), this._appendListItems(), S && this._updateSearchResultsA11yText(), c) {
|
|
1934
|
+
const P = p1._buildClassNames({
|
|
1935
|
+
iti: !0,
|
|
1936
|
+
"iti--container": !0,
|
|
1937
|
+
"iti--fullscreen-popup": f,
|
|
1938
|
+
"iti--inline-dropdown": !f,
|
|
1939
|
+
[r]: !!r
|
|
1940
|
+
});
|
|
1941
|
+
this.dropdown = T("div", { class: P }), this.dropdown.appendChild(this.dropdownContent);
|
|
1876
1942
|
} else
|
|
1877
1943
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
1878
1944
|
}
|
|
1879
1945
|
}
|
|
1880
1946
|
if (L.appendChild(this.telInput), this._updateInputPadding(), l) {
|
|
1881
|
-
const
|
|
1947
|
+
const U = this.telInput.getAttribute("name") || "", D = l(U);
|
|
1882
1948
|
if (D.phone) {
|
|
1883
|
-
const
|
|
1884
|
-
|
|
1949
|
+
const P = (I = this.telInput.form) == null ? void 0 : I.querySelector(`input[name="${D.phone}"]`);
|
|
1950
|
+
P ? this.hiddenInput = P : (this.hiddenInput = T("input", {
|
|
1885
1951
|
type: "hidden",
|
|
1886
1952
|
name: D.phone
|
|
1887
1953
|
}), L.appendChild(this.hiddenInput));
|
|
1888
1954
|
}
|
|
1889
1955
|
if (D.country) {
|
|
1890
|
-
const
|
|
1891
|
-
|
|
1956
|
+
const P = (G = this.telInput.form) == null ? void 0 : G.querySelector(`input[name="${D.country}"]`);
|
|
1957
|
+
P ? this.hiddenInputCountry = P : (this.hiddenInputCountry = T("input", {
|
|
1892
1958
|
type: "hidden",
|
|
1893
1959
|
name: D.country
|
|
1894
1960
|
}), L.appendChild(this.hiddenInputCountry));
|
|
@@ -1898,34 +1964,34 @@ class z2 {
|
|
|
1898
1964
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
1899
1965
|
_appendListItems() {
|
|
1900
1966
|
for (let e = 0; e < this.countries.length; e++) {
|
|
1901
|
-
const
|
|
1967
|
+
const i = this.countries[e], s = e === 0 ? "iti__highlight" : "", r = T(
|
|
1902
1968
|
"li",
|
|
1903
1969
|
{
|
|
1904
|
-
id: `iti-${this.id}__item-${
|
|
1905
|
-
class: `iti__country ${
|
|
1970
|
+
id: `iti-${this.id}__item-${i.iso2}`,
|
|
1971
|
+
class: `iti__country ${s}`,
|
|
1906
1972
|
tabindex: "-1",
|
|
1907
1973
|
role: "option",
|
|
1908
|
-
"data-dial-code":
|
|
1909
|
-
"data-country-code":
|
|
1974
|
+
"data-dial-code": i.dialCode,
|
|
1975
|
+
"data-country-code": i.iso2,
|
|
1910
1976
|
"aria-selected": "false"
|
|
1911
1977
|
},
|
|
1912
1978
|
this.countryList
|
|
1913
1979
|
);
|
|
1914
|
-
|
|
1980
|
+
i.nodeById[this.id] = r;
|
|
1915
1981
|
let l = "";
|
|
1916
|
-
this.options.showFlags && (l += `<div class='iti__flag iti__${
|
|
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>`, r.insertAdjacentHTML("beforeend", l);
|
|
1917
1983
|
}
|
|
1918
1984
|
}
|
|
1919
1985
|
//* Set the initial state of the input value and the selected country by:
|
|
1920
1986
|
//* 1. Extracting a dial code from the given number
|
|
1921
1987
|
//* 2. Using explicit initialCountry
|
|
1922
1988
|
_setInitialState(e = !1) {
|
|
1923
|
-
const
|
|
1989
|
+
const i = this.telInput.getAttribute("value"), s = this.telInput.value, l = i && i.charAt(0) === "+" && (!s || s.charAt(0) !== "+") ? i : s, c = this._getDialCode(l), C = a2(l), { initialCountry: f, geoIpLookup: S } = this.options, w = f === "auto" && S;
|
|
1924
1990
|
if (c && !C)
|
|
1925
1991
|
this._updateCountryFromNumber(l);
|
|
1926
|
-
else if (!
|
|
1927
|
-
const
|
|
1928
|
-
|
|
1992
|
+
else if (!w || e) {
|
|
1993
|
+
const b = f ? f.toLowerCase() : "";
|
|
1994
|
+
b && this._getCountryData(b, !0) ? this._setCountry(b) : c && C ? this._setCountry("us") : this._setCountry();
|
|
1929
1995
|
}
|
|
1930
1996
|
l && this._updateValFromNumber(l);
|
|
1931
1997
|
}
|
|
@@ -1945,14 +2011,14 @@ class z2 {
|
|
|
1945
2011
|
}
|
|
1946
2012
|
//* initialise the dropdown listeners.
|
|
1947
2013
|
_initDropdownListeners() {
|
|
1948
|
-
this._handleLabelClick = (
|
|
1949
|
-
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() :
|
|
2014
|
+
this._handleLabelClick = (i) => {
|
|
2015
|
+
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : i.preventDefault();
|
|
1950
2016
|
};
|
|
1951
2017
|
const e = this.telInput.closest("label");
|
|
1952
2018
|
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
1953
2019
|
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
1954
|
-
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (
|
|
1955
|
-
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(
|
|
2020
|
+
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = (i) => {
|
|
2021
|
+
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), this._openDropdown()), i.key === "Tab" && this._closeDropdown();
|
|
1956
2022
|
}, this.countryContainer.addEventListener(
|
|
1957
2023
|
"keydown",
|
|
1958
2024
|
this._handleCountryContainerKeydown
|
|
@@ -1960,22 +2026,22 @@ class z2 {
|
|
|
1960
2026
|
}
|
|
1961
2027
|
//* Init many requests: utils script / geo ip lookup.
|
|
1962
2028
|
_initRequests() {
|
|
1963
|
-
let { loadUtils: e, initialCountry:
|
|
2029
|
+
let { loadUtils: e, initialCountry: i, geoIpLookup: s } = this.options;
|
|
1964
2030
|
e && !m.utils ? (this._handlePageLoad = () => {
|
|
1965
2031
|
var l;
|
|
1966
2032
|
window.removeEventListener("load", this._handlePageLoad), (l = m.attachUtils(e)) == null || l.catch(() => {
|
|
1967
2033
|
});
|
|
1968
|
-
}, m.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(),
|
|
2034
|
+
}, m.documentReady() ? this._handlePageLoad() : window.addEventListener("load", this._handlePageLoad)) : this.resolveUtilsScriptPromise(), i === "auto" && s && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
1969
2035
|
}
|
|
1970
2036
|
//* Perform the geo ip lookup.
|
|
1971
2037
|
_loadAutoCountry() {
|
|
1972
2038
|
m.autoCountry ? this.handleAutoCountry() : m.startedLoadingAutoCountry || (m.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
1973
2039
|
(e = "") => {
|
|
1974
|
-
const
|
|
1975
|
-
|
|
2040
|
+
const i = e.toLowerCase();
|
|
2041
|
+
i && this._getCountryData(i, !0) ? (m.autoCountry = i, setTimeout(() => i1("handleAutoCountry"))) : (this._setInitialState(!0), i1("rejectAutoCountryPromise"));
|
|
1976
2042
|
},
|
|
1977
2043
|
() => {
|
|
1978
|
-
this._setInitialState(!0),
|
|
2044
|
+
this._setInitialState(!0), i1("rejectAutoCountryPromise");
|
|
1979
2045
|
}
|
|
1980
2046
|
));
|
|
1981
2047
|
}
|
|
@@ -1984,77 +2050,77 @@ class z2 {
|
|
|
1984
2050
|
}
|
|
1985
2051
|
//* Initialize the tel input listeners.
|
|
1986
2052
|
_initTelInputListeners() {
|
|
1987
|
-
const { strictMode: e, formatAsYouType:
|
|
2053
|
+
const { strictMode: e, formatAsYouType: i, separateDialCode: s, formatOnDisplay: r, allowDropdown: l, countrySearch: c } = this.options;
|
|
1988
2054
|
let C = !1;
|
|
1989
|
-
new RegExp("\\p{L}", "u").test(this.telInput.value) && (C = !0), this._handleInputEvent = (
|
|
1990
|
-
if (this.isAndroid && (
|
|
1991
|
-
const L = this.telInput.selectionStart || 0,
|
|
1992
|
-
this.telInput.value =
|
|
2055
|
+
new RegExp("\\p{L}", "u").test(this.telInput.value) && (C = !0), this._handleInputEvent = (f) => {
|
|
2056
|
+
if (this.isAndroid && (f == null ? void 0 : f.data) === "+" && s && l && c) {
|
|
2057
|
+
const L = this.telInput.selectionStart || 0, p = this.telInput.value.substring(0, L - 1), I = this.telInput.value.substring(L);
|
|
2058
|
+
this.telInput.value = p + I, this._openDropdownWithPlus();
|
|
1993
2059
|
return;
|
|
1994
2060
|
}
|
|
1995
2061
|
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
1996
|
-
const
|
|
1997
|
-
|
|
1998
|
-
const
|
|
1999
|
-
if (
|
|
2000
|
-
const L = this.telInput.selectionStart || 0, I = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, G = (
|
|
2001
|
-
this.telInput.value =
|
|
2062
|
+
const S = (f == null ? void 0 : f.data) && /[^+0-9]/.test(f.data), w = (f == null ? void 0 : f.inputType) === "insertFromPaste" && this.telInput.value;
|
|
2063
|
+
S || w && !e ? C = !0 : /[^+0-9]/.test(this.telInput.value) || (C = !1);
|
|
2064
|
+
const b = (f == null ? void 0 : f.detail) && f.detail.isSetNumber && !r;
|
|
2065
|
+
if (i && !C && !b) {
|
|
2066
|
+
const L = this.telInput.selectionStart || 0, I = this.telInput.value.substring(0, L).replace(/[^+0-9]/g, "").length, G = (f == null ? void 0 : f.inputType) === "deleteContentForward", U = this._formatNumberAsYouType(), D = z2(I, U, L, G);
|
|
2067
|
+
this.telInput.value = U, this.telInput.setSelectionRange(D, D);
|
|
2002
2068
|
}
|
|
2003
|
-
}, this.telInput.addEventListener("input", this._handleInputEvent), (e ||
|
|
2004
|
-
if (
|
|
2005
|
-
if (
|
|
2006
|
-
|
|
2069
|
+
}, this.telInput.addEventListener("input", this._handleInputEvent), (e || s) && (this._handleKeydownEvent = (f) => {
|
|
2070
|
+
if (f.key && f.key.length === 1 && !f.altKey && !f.ctrlKey && !f.metaKey) {
|
|
2071
|
+
if (s && l && c && f.key === "+") {
|
|
2072
|
+
f.preventDefault(), this._openDropdownWithPlus();
|
|
2007
2073
|
return;
|
|
2008
2074
|
}
|
|
2009
2075
|
if (e) {
|
|
2010
|
-
const
|
|
2011
|
-
(!
|
|
2076
|
+
const S = this.telInput.value, b = !(S.charAt(0) === "+") && this.telInput.selectionStart === 0 && f.key === "+", L = /^[0-9]$/.test(f.key), p = s ? L : b || L, I = S.slice(0, this.telInput.selectionStart) + f.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;
|
|
2077
|
+
(!p || D && !Y && !b) && f.preventDefault();
|
|
2012
2078
|
}
|
|
2013
2079
|
}
|
|
2014
2080
|
}, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
|
|
2015
2081
|
}
|
|
2016
2082
|
//* Adhere to the input's maxlength attr.
|
|
2017
2083
|
_cap(e) {
|
|
2018
|
-
const
|
|
2019
|
-
return
|
|
2084
|
+
const i = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
|
|
2085
|
+
return i && e.length > i ? e.substring(0, i) : e;
|
|
2020
2086
|
}
|
|
2021
2087
|
//* Trigger a custom event on the input.
|
|
2022
|
-
_trigger(e,
|
|
2023
|
-
const
|
|
2088
|
+
_trigger(e, i = {}) {
|
|
2089
|
+
const s = new CustomEvent(e, {
|
|
2024
2090
|
bubbles: !0,
|
|
2025
2091
|
cancelable: !0,
|
|
2026
|
-
detail:
|
|
2092
|
+
detail: i
|
|
2027
2093
|
});
|
|
2028
|
-
this.telInput.dispatchEvent(
|
|
2094
|
+
this.telInput.dispatchEvent(s);
|
|
2029
2095
|
}
|
|
2030
2096
|
//* Open the dropdown.
|
|
2031
2097
|
_openDropdown() {
|
|
2032
|
-
const { fixDropdownWidth: e, countrySearch:
|
|
2033
|
-
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(),
|
|
2034
|
-
const
|
|
2035
|
-
|
|
2098
|
+
const { fixDropdownWidth: e, countrySearch: i } = this.options;
|
|
2099
|
+
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 s = this.countryList.firstElementChild;
|
|
2101
|
+
s && (this._highlightListItem(s, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
|
|
2036
2102
|
}
|
|
2037
2103
|
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2038
2104
|
}
|
|
2039
2105
|
//* Set the dropdown position
|
|
2040
2106
|
_setDropdownPosition() {
|
|
2041
2107
|
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2042
|
-
const e = this.telInput.getBoundingClientRect(),
|
|
2043
|
-
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top +
|
|
2108
|
+
const e = this.telInput.getBoundingClientRect(), i = this.telInput.offsetHeight;
|
|
2109
|
+
this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + i}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
|
|
2044
2110
|
}
|
|
2045
2111
|
}
|
|
2046
2112
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2047
2113
|
_bindDropdownListeners() {
|
|
2048
|
-
this._handleMouseoverCountryList = (
|
|
2114
|
+
this._handleMouseoverCountryList = (r) => {
|
|
2049
2115
|
var c;
|
|
2050
|
-
const l = (c =
|
|
2116
|
+
const l = (c = r.target) == null ? void 0 : c.closest(".iti__country");
|
|
2051
2117
|
l && this._highlightListItem(l, !1);
|
|
2052
2118
|
}, this.countryList.addEventListener(
|
|
2053
2119
|
"mouseover",
|
|
2054
2120
|
this._handleMouseoverCountryList
|
|
2055
|
-
), this._handleClickCountryList = (
|
|
2121
|
+
), this._handleClickCountryList = (r) => {
|
|
2056
2122
|
var c;
|
|
2057
|
-
const l = (c =
|
|
2123
|
+
const l = (c = r.target) == null ? void 0 : c.closest(".iti__country");
|
|
2058
2124
|
l && this._selectListItem(l);
|
|
2059
2125
|
}, this.countryList.addEventListener("click", this._handleClickCountryList);
|
|
2060
2126
|
let e = !0;
|
|
@@ -2064,65 +2130,67 @@ class z2 {
|
|
|
2064
2130
|
"click",
|
|
2065
2131
|
this._handleClickOffToClose
|
|
2066
2132
|
);
|
|
2067
|
-
let
|
|
2068
|
-
if (this._handleKeydownOnDropdown = (
|
|
2069
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(
|
|
2070
|
-
|
|
2133
|
+
let i = "", s = null;
|
|
2134
|
+
if (this._handleKeydownOnDropdown = (r) => {
|
|
2135
|
+
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(r.key) && (r.preventDefault(), r.stopPropagation(), r.key === "ArrowUp" || r.key === "ArrowDown" ? this._handleUpDownKey(r.key) : r.key === "Enter" ? this._handleEnterKey() : r.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(r.key) && (r.stopPropagation(), s && clearTimeout(s), i += r.key.toLowerCase(), this._searchForCountry(i), s = setTimeout(() => {
|
|
2136
|
+
i = "";
|
|
2071
2137
|
}, 1e3));
|
|
2072
2138
|
}, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
|
|
2073
|
-
const
|
|
2139
|
+
const r = () => {
|
|
2074
2140
|
const c = this.searchInput.value.trim();
|
|
2075
|
-
c ? this._filterCountries(c) : this._filterCountries("", !0);
|
|
2141
|
+
c ? this._filterCountries(c) : this._filterCountries("", !0), this.searchInput.value ? this.searchClearButton.classList.remove("iti__hide") : this.searchClearButton.classList.add("iti__hide");
|
|
2076
2142
|
};
|
|
2077
2143
|
let l = null;
|
|
2078
2144
|
this._handleSearchChange = () => {
|
|
2079
2145
|
l && clearTimeout(l), l = setTimeout(() => {
|
|
2080
|
-
|
|
2146
|
+
r(), l = null;
|
|
2081
2147
|
}, 100);
|
|
2082
|
-
}, this.searchInput.addEventListener("input", this._handleSearchChange), this.
|
|
2148
|
+
}, this.searchInput.addEventListener("input", this._handleSearchChange), this._handleSearchClear = (c) => {
|
|
2149
|
+
c.stopPropagation(), this.searchInput.value = "", this.searchInput.focus(), r();
|
|
2150
|
+
}, this.searchClearButton.addEventListener("click", this._handleSearchClear), this.searchInput.addEventListener("click", (c) => c.stopPropagation());
|
|
2083
2151
|
}
|
|
2084
2152
|
}
|
|
2085
2153
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2086
2154
|
_searchForCountry(e) {
|
|
2087
|
-
for (const
|
|
2088
|
-
if (
|
|
2089
|
-
const
|
|
2090
|
-
this._highlightListItem(
|
|
2155
|
+
for (const i of this.countries)
|
|
2156
|
+
if (i.name.substring(0, e.length).toLowerCase() === e) {
|
|
2157
|
+
const r = i.nodeById[this.id];
|
|
2158
|
+
this._highlightListItem(r, !1), this._scrollTo(r);
|
|
2091
2159
|
break;
|
|
2092
2160
|
}
|
|
2093
2161
|
}
|
|
2094
2162
|
//* Country search enabled: Filter the countries according to the search query.
|
|
2095
|
-
_filterCountries(e,
|
|
2096
|
-
let
|
|
2163
|
+
_filterCountries(e, i = !1) {
|
|
2164
|
+
let s = !0;
|
|
2097
2165
|
this.countryList.innerHTML = "";
|
|
2098
|
-
const
|
|
2099
|
-
for (const
|
|
2100
|
-
|
|
2166
|
+
const r = o2(e), l = r.length, c = [], C = [], f = [], S = [], w = [], b = [];
|
|
2167
|
+
for (const p of this.countries)
|
|
2168
|
+
i || l === 0 ? f.push(p) : p.iso2 === r ? c.push(p) : p.normalisedName.startsWith(r) ? C.push(p) : p.normalisedName.includes(r) ? f.push(p) : r === p.dialCode || r === p.dialCodePlus ? S.push(p) : p.dialCodePlus.includes(r) ? w.push(p) : p.initials.includes(r) && b.push(p);
|
|
2101
2169
|
const L = [
|
|
2102
|
-
...c.sort((
|
|
2103
|
-
...C.sort((
|
|
2104
|
-
...
|
|
2105
|
-
...
|
|
2106
|
-
...
|
|
2107
|
-
...
|
|
2170
|
+
...c.sort((p, I) => p.priority - I.priority),
|
|
2171
|
+
...C.sort((p, I) => p.priority - I.priority),
|
|
2172
|
+
...f.sort((p, I) => p.priority - I.priority),
|
|
2173
|
+
...S.sort((p, I) => p.priority - I.priority),
|
|
2174
|
+
...w.sort((p, I) => p.priority - I.priority),
|
|
2175
|
+
...b.sort((p, I) => p.priority - I.priority)
|
|
2108
2176
|
];
|
|
2109
|
-
for (const
|
|
2110
|
-
const I =
|
|
2111
|
-
I && (this.countryList.appendChild(I),
|
|
2177
|
+
for (const p of L) {
|
|
2178
|
+
const I = p.nodeById[this.id];
|
|
2179
|
+
I && (this.countryList.appendChild(I), s && (this._highlightListItem(I, !1), s = !1));
|
|
2112
2180
|
}
|
|
2113
|
-
|
|
2181
|
+
s ? (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();
|
|
2114
2182
|
}
|
|
2115
2183
|
//* Update search results text (for a11y).
|
|
2116
|
-
|
|
2117
|
-
const { i18n: e } = this.options,
|
|
2118
|
-
let
|
|
2119
|
-
"searchResultsText" in e ?
|
|
2184
|
+
_updateSearchResultsA11yText() {
|
|
2185
|
+
const { i18n: e } = this.options, i = this.countryList.childElementCount;
|
|
2186
|
+
let s;
|
|
2187
|
+
"searchResultsText" in e ? s = e.searchResultsText(i) : i === 0 ? s = e.zeroSearchResults : i === 1 ? s = e.oneSearchResult : s = e.multipleSearchResults.replace("${count}", i.toString()), this.searchResultsA11yText.textContent = s;
|
|
2120
2188
|
}
|
|
2121
2189
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2122
2190
|
_handleUpDownKey(e) {
|
|
2123
|
-
var
|
|
2124
|
-
let
|
|
2125
|
-
!
|
|
2191
|
+
var s, r;
|
|
2192
|
+
let i = e === "ArrowUp" ? (s = this.highlightedItem) == null ? void 0 : s.previousElementSibling : (r = this.highlightedItem) == null ? void 0 : r.nextElementSibling;
|
|
2193
|
+
!i && this.countryList.childElementCount > 1 && (i = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), i && (this._scrollTo(i), this._highlightListItem(i, !1));
|
|
2126
2194
|
}
|
|
2127
2195
|
//* Select the currently highlighted item.
|
|
2128
2196
|
_handleEnterKey() {
|
|
@@ -2131,86 +2199,85 @@ class z2 {
|
|
|
2131
2199
|
//* Update the input's value to the given val (format first if possible)
|
|
2132
2200
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2133
2201
|
_updateValFromNumber(e) {
|
|
2134
|
-
let
|
|
2202
|
+
let i = e;
|
|
2135
2203
|
if (this.options.formatOnDisplay && m.utils && this.selectedCountryData) {
|
|
2136
|
-
const
|
|
2137
|
-
|
|
2138
|
-
|
|
2204
|
+
const s = this.options.nationalMode || i.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: r, INTERNATIONAL: l } = m.utils.numberFormat, c = s ? r : l;
|
|
2205
|
+
i = m.utils.formatNumber(
|
|
2206
|
+
i,
|
|
2139
2207
|
this.selectedCountryData.iso2,
|
|
2140
2208
|
c
|
|
2141
2209
|
);
|
|
2142
2210
|
}
|
|
2143
|
-
|
|
2211
|
+
i = this._beforeSetNumber(i), this.telInput.value = i;
|
|
2144
2212
|
}
|
|
2145
2213
|
//* Check if need to select a new country based on the given number
|
|
2146
2214
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
2147
2215
|
_updateCountryFromNumber(e) {
|
|
2148
|
-
const
|
|
2149
|
-
return
|
|
2216
|
+
const i = this._getNewCountryFromNumber(e);
|
|
2217
|
+
return i !== null ? this._setCountry(i) : !1;
|
|
2150
2218
|
}
|
|
2151
2219
|
_ensureHasDialCode(e) {
|
|
2152
|
-
const { dialCode:
|
|
2153
|
-
if (e.charAt(0) === "+" || !
|
|
2220
|
+
const { dialCode: i, nationalPrefix: s } = this.selectedCountryData;
|
|
2221
|
+
if (e.charAt(0) === "+" || !i)
|
|
2154
2222
|
return e;
|
|
2155
|
-
const c =
|
|
2156
|
-
return `+${
|
|
2223
|
+
const c = s && e.charAt(0) === s && !this.options.separateDialCode ? e.substring(1) : e;
|
|
2224
|
+
return `+${i}${c}`;
|
|
2157
2225
|
}
|
|
2158
2226
|
// Get the country ISO2 code from the given number
|
|
2159
2227
|
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
2160
2228
|
// NOTE: consider refactoring this to be more clear
|
|
2161
2229
|
_getNewCountryFromNumber(e) {
|
|
2162
|
-
const
|
|
2163
|
-
let
|
|
2164
|
-
const
|
|
2165
|
-
|
|
2166
|
-
const c = this._getDialCode(
|
|
2230
|
+
const i = e.indexOf("+");
|
|
2231
|
+
let s = i ? e.substring(i) : e;
|
|
2232
|
+
const r = this.selectedCountryData.iso2, l = this.selectedCountryData.dialCode;
|
|
2233
|
+
s = this._ensureHasDialCode(s);
|
|
2234
|
+
const c = this._getDialCode(s, !0), C = f1(s);
|
|
2167
2235
|
if (c) {
|
|
2168
|
-
const
|
|
2169
|
-
if (!
|
|
2236
|
+
const f = f1(c), S = this.dialCodeToIso2Map[f];
|
|
2237
|
+
if (!r && this.defaultCountry && S.includes(this.defaultCountry))
|
|
2170
2238
|
return this.defaultCountry;
|
|
2171
|
-
const
|
|
2172
|
-
if (!(l === "1" &&
|
|
2173
|
-
for (const
|
|
2174
|
-
if (
|
|
2175
|
-
return
|
|
2239
|
+
const w = this.selectedCountryData.areaCodes && C.length > f.length, b = r && S.includes(r) && !w;
|
|
2240
|
+
if (!(l === "1" && a2(C)) && !b) {
|
|
2241
|
+
for (const p of S)
|
|
2242
|
+
if (p)
|
|
2243
|
+
return p;
|
|
2176
2244
|
}
|
|
2177
2245
|
} else {
|
|
2178
|
-
if (
|
|
2246
|
+
if (s.charAt(0) === "+" && C.length)
|
|
2179
2247
|
return "";
|
|
2180
|
-
if ((!
|
|
2248
|
+
if ((!s || s === "+") && !this.selectedCountryData.iso2)
|
|
2181
2249
|
return this.defaultCountry;
|
|
2182
2250
|
}
|
|
2183
2251
|
return null;
|
|
2184
2252
|
}
|
|
2185
2253
|
//* Remove highlighting from other list items and highlight the given item.
|
|
2186
|
-
_highlightListItem(e,
|
|
2187
|
-
const
|
|
2188
|
-
if (
|
|
2189
|
-
this.highlightedItem.
|
|
2190
|
-
|
|
2191
|
-
this.selectedCountry.setAttribute("aria-activedescendant", s), this.options.countrySearch && this.searchInput.setAttribute("aria-activedescendant", s);
|
|
2254
|
+
_highlightListItem(e, i) {
|
|
2255
|
+
const s = this.highlightedItem;
|
|
2256
|
+
if (s && (s.classList.remove("iti__highlight"), s.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true"), this.options.countrySearch)) {
|
|
2257
|
+
const r = this.highlightedItem.getAttribute("id") || "";
|
|
2258
|
+
this.searchInput.setAttribute("aria-activedescendant", r);
|
|
2192
2259
|
}
|
|
2193
|
-
|
|
2260
|
+
i && this.highlightedItem.focus();
|
|
2194
2261
|
}
|
|
2195
2262
|
//* Find the country data for the given iso2 code
|
|
2196
2263
|
//* 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
|
|
2197
|
-
_getCountryData(e,
|
|
2198
|
-
const
|
|
2199
|
-
if (
|
|
2200
|
-
return
|
|
2201
|
-
if (
|
|
2264
|
+
_getCountryData(e, i) {
|
|
2265
|
+
const s = this.countryByIso2.get(e);
|
|
2266
|
+
if (s)
|
|
2267
|
+
return s;
|
|
2268
|
+
if (i)
|
|
2202
2269
|
return null;
|
|
2203
2270
|
throw new Error(`No country data for '${e}'`);
|
|
2204
2271
|
}
|
|
2205
2272
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2206
2273
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2207
2274
|
_setCountry(e) {
|
|
2208
|
-
const { separateDialCode:
|
|
2275
|
+
const { separateDialCode: i, showFlags: s, i18n: r } = this.options, l = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
|
|
2209
2276
|
if (this.selectedCountryData = e ? this._getCountryData(e, !1) || {} : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountryInner) {
|
|
2210
2277
|
let c = "", C = "";
|
|
2211
|
-
e &&
|
|
2278
|
+
e && s ? (c = `iti__flag iti__${e}`, C = `${this.selectedCountryData.name} +${this.selectedCountryData.dialCode}`) : (c = "iti__flag iti__globe", C = r.noCountrySelected), this.selectedCountryInner.className = c, this.selectedCountryA11yText.textContent = C;
|
|
2212
2279
|
}
|
|
2213
|
-
if (this._setSelectedCountryTitleAttribute(e,
|
|
2280
|
+
if (this._setSelectedCountryTitleAttribute(e, i), i) {
|
|
2214
2281
|
const c = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2215
2282
|
this.selectedDialCode.innerHTML = c, this._updateInputPadding();
|
|
2216
2283
|
}
|
|
@@ -2219,34 +2286,34 @@ class z2 {
|
|
|
2219
2286
|
//* Update the input padding to make space for the selected country/dial code.
|
|
2220
2287
|
_updateInputPadding() {
|
|
2221
2288
|
if (this.selectedCountry) {
|
|
2222
|
-
const
|
|
2223
|
-
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${
|
|
2289
|
+
const i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth()) + 6;
|
|
2290
|
+
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${i}px` : this.telInput.style.paddingRight = `${i}px`;
|
|
2224
2291
|
}
|
|
2225
2292
|
}
|
|
2226
2293
|
//* Update the maximum valid number length for the currently selected country.
|
|
2227
2294
|
_updateMaxLength() {
|
|
2228
|
-
const { strictMode: e, placeholderNumberType:
|
|
2295
|
+
const { strictMode: e, placeholderNumberType: i, validationNumberTypes: s } = this.options, { iso2: r } = this.selectedCountryData;
|
|
2229
2296
|
if (e && m.utils)
|
|
2230
|
-
if (
|
|
2231
|
-
const l = m.utils.numberType[
|
|
2297
|
+
if (r) {
|
|
2298
|
+
const l = m.utils.numberType[i];
|
|
2232
2299
|
let c = m.utils.getExampleNumber(
|
|
2233
|
-
|
|
2300
|
+
r,
|
|
2234
2301
|
!1,
|
|
2235
2302
|
l,
|
|
2236
2303
|
!0
|
|
2237
2304
|
), C = c;
|
|
2238
|
-
for (; m.utils.isPossibleNumber(c,
|
|
2305
|
+
for (; m.utils.isPossibleNumber(c, r, s); )
|
|
2239
2306
|
C = c, c += "0";
|
|
2240
|
-
const
|
|
2241
|
-
this.maxCoreNumberLength =
|
|
2307
|
+
const f = m.utils.getCoreNumber(C, r);
|
|
2308
|
+
this.maxCoreNumberLength = f.length, r === "by" && (this.maxCoreNumberLength = f.length + 1);
|
|
2242
2309
|
} else
|
|
2243
2310
|
this.maxCoreNumberLength = null;
|
|
2244
2311
|
}
|
|
2245
|
-
_setSelectedCountryTitleAttribute(e = null,
|
|
2312
|
+
_setSelectedCountryTitleAttribute(e = null, i) {
|
|
2246
2313
|
if (!this.selectedCountry)
|
|
2247
2314
|
return;
|
|
2248
|
-
let
|
|
2249
|
-
e && !
|
|
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);
|
|
2250
2317
|
}
|
|
2251
2318
|
//* When the input is in a hidden container during initialisation, we must inject some markup
|
|
2252
2319
|
//* into the end of the DOM to calculate the correct offsetWidth.
|
|
@@ -2256,12 +2323,12 @@ class z2 {
|
|
|
2256
2323
|
if (this.telInput.parentNode) {
|
|
2257
2324
|
const e = this.telInput.parentNode.cloneNode(!1);
|
|
2258
2325
|
e.style.visibility = "hidden", document.body.appendChild(e);
|
|
2259
|
-
const
|
|
2260
|
-
e.appendChild(
|
|
2261
|
-
const
|
|
2262
|
-
|
|
2263
|
-
const
|
|
2264
|
-
return document.body.removeChild(e),
|
|
2326
|
+
const i = this.countryContainer.cloneNode();
|
|
2327
|
+
e.appendChild(i);
|
|
2328
|
+
const s = this.selectedCountry.cloneNode(!0);
|
|
2329
|
+
i.appendChild(s);
|
|
2330
|
+
const r = s.offsetWidth;
|
|
2331
|
+
return document.body.removeChild(e), r;
|
|
2265
2332
|
}
|
|
2266
2333
|
return 0;
|
|
2267
2334
|
}
|
|
@@ -2269,30 +2336,30 @@ class z2 {
|
|
|
2269
2336
|
_updatePlaceholder() {
|
|
2270
2337
|
const {
|
|
2271
2338
|
autoPlaceholder: e,
|
|
2272
|
-
placeholderNumberType:
|
|
2273
|
-
nationalMode:
|
|
2274
|
-
customPlaceholder:
|
|
2339
|
+
placeholderNumberType: i,
|
|
2340
|
+
nationalMode: s,
|
|
2341
|
+
customPlaceholder: r
|
|
2275
2342
|
} = this.options, l = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
|
|
2276
2343
|
if (m.utils && l) {
|
|
2277
|
-
const c = m.utils.numberType[
|
|
2344
|
+
const c = m.utils.numberType[i];
|
|
2278
2345
|
let C = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
|
|
2279
2346
|
this.selectedCountryData.iso2,
|
|
2280
|
-
|
|
2347
|
+
s,
|
|
2281
2348
|
c
|
|
2282
2349
|
) : "";
|
|
2283
|
-
C = this._beforeSetNumber(C), typeof
|
|
2350
|
+
C = this._beforeSetNumber(C), typeof r == "function" && (C = r(C, this.selectedCountryData)), this.telInput.setAttribute("placeholder", C);
|
|
2284
2351
|
}
|
|
2285
2352
|
}
|
|
2286
2353
|
//* Called when the user selects a list item from the dropdown.
|
|
2287
2354
|
_selectListItem(e) {
|
|
2288
|
-
const
|
|
2355
|
+
const i = this._setCountry(
|
|
2289
2356
|
e.getAttribute("data-country-code")
|
|
2290
2357
|
);
|
|
2291
|
-
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(),
|
|
2358
|
+
this._closeDropdown(), this._updateDialCode(e.getAttribute("data-dial-code")), this.telInput.focus(), i && this._triggerCountryChange();
|
|
2292
2359
|
}
|
|
2293
2360
|
//* Close the dropdown and unbind any listeners.
|
|
2294
2361
|
_closeDropdown() {
|
|
2295
|
-
this.dropdownContent.classList.add("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "false"), this.
|
|
2362
|
+
this.dropdownContent.classList.add("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "false"), this.highlightedItem && this.highlightedItem.setAttribute("aria-selected", "false"), this.options.countrySearch && this.searchInput.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), this.options.countrySearch && (this.searchInput.removeEventListener("input", this._handleSearchChange), this.searchClearButton.removeEventListener("click", this._handleSearchClear)), document.documentElement.removeEventListener(
|
|
2296
2363
|
"click",
|
|
2297
2364
|
this._handleClickOffToClose
|
|
2298
2365
|
), this.countryList.removeEventListener(
|
|
@@ -2302,65 +2369,65 @@ class z2 {
|
|
|
2302
2369
|
}
|
|
2303
2370
|
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2304
2371
|
_scrollTo(e) {
|
|
2305
|
-
const
|
|
2306
|
-
if (
|
|
2307
|
-
|
|
2308
|
-
else if (
|
|
2309
|
-
const
|
|
2310
|
-
|
|
2372
|
+
const i = this.countryList, s = document.documentElement.scrollTop, r = i.offsetHeight, l = i.getBoundingClientRect().top + s, c = l + r, C = e.offsetHeight, f = e.getBoundingClientRect().top + s, S = f + C, w = f - l + i.scrollTop;
|
|
2373
|
+
if (f < l)
|
|
2374
|
+
i.scrollTop = w;
|
|
2375
|
+
else if (S > c) {
|
|
2376
|
+
const b = r - C;
|
|
2377
|
+
i.scrollTop = w - b;
|
|
2311
2378
|
}
|
|
2312
2379
|
}
|
|
2313
2380
|
//* Replace any existing dial code with the new one
|
|
2314
2381
|
//* Note: called from _selectListItem and setCountry
|
|
2315
2382
|
_updateDialCode(e) {
|
|
2316
|
-
const
|
|
2317
|
-
let
|
|
2318
|
-
if (
|
|
2319
|
-
const l = this._getDialCode(
|
|
2320
|
-
l ?
|
|
2383
|
+
const i = this.telInput.value, s = `+${e}`;
|
|
2384
|
+
let r;
|
|
2385
|
+
if (i.charAt(0) === "+") {
|
|
2386
|
+
const l = this._getDialCode(i);
|
|
2387
|
+
l ? r = i.replace(l, s) : r = s, this.telInput.value = r;
|
|
2321
2388
|
}
|
|
2322
2389
|
}
|
|
2323
2390
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2324
2391
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2325
|
-
_getDialCode(e,
|
|
2326
|
-
let
|
|
2392
|
+
_getDialCode(e, i) {
|
|
2393
|
+
let s = "";
|
|
2327
2394
|
if (e.charAt(0) === "+") {
|
|
2328
|
-
let
|
|
2395
|
+
let r = "";
|
|
2329
2396
|
for (let l = 0; l < e.length; l++) {
|
|
2330
2397
|
const c = e.charAt(l);
|
|
2331
2398
|
if (!isNaN(parseInt(c, 10))) {
|
|
2332
|
-
if (
|
|
2333
|
-
this.dialCodeToIso2Map[
|
|
2334
|
-
else if (this.dialCodes.has(
|
|
2335
|
-
|
|
2399
|
+
if (r += c, i)
|
|
2400
|
+
this.dialCodeToIso2Map[r] && (s = e.substring(0, l + 1));
|
|
2401
|
+
else if (this.dialCodes.has(r)) {
|
|
2402
|
+
s = e.substring(0, l + 1);
|
|
2336
2403
|
break;
|
|
2337
2404
|
}
|
|
2338
|
-
if (
|
|
2405
|
+
if (r.length === this.dialCodeMaxLen)
|
|
2339
2406
|
break;
|
|
2340
2407
|
}
|
|
2341
2408
|
}
|
|
2342
2409
|
}
|
|
2343
|
-
return
|
|
2410
|
+
return s;
|
|
2344
2411
|
}
|
|
2345
2412
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2346
2413
|
_getFullNumber(e) {
|
|
2347
|
-
const
|
|
2348
|
-
let
|
|
2349
|
-
const l =
|
|
2350
|
-
return this.options.separateDialCode &&
|
|
2414
|
+
const i = e || this.telInput.value.trim(), { dialCode: s } = this.selectedCountryData;
|
|
2415
|
+
let r;
|
|
2416
|
+
const l = f1(i);
|
|
2417
|
+
return this.options.separateDialCode && i.charAt(0) !== "+" && s && l ? r = `+${s}` : r = "", r + i;
|
|
2351
2418
|
}
|
|
2352
2419
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2353
2420
|
_beforeSetNumber(e) {
|
|
2354
|
-
let
|
|
2421
|
+
let i = e;
|
|
2355
2422
|
if (this.options.separateDialCode) {
|
|
2356
|
-
let
|
|
2357
|
-
if (
|
|
2358
|
-
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2423
|
+
let s = this._getDialCode(i);
|
|
2424
|
+
if (s) {
|
|
2425
|
+
s = `+${this.selectedCountryData.dialCode}`;
|
|
2426
|
+
const r = i[s.length] === " " || i[s.length] === "-" ? s.length + 1 : s.length;
|
|
2427
|
+
i = i.substring(r);
|
|
2361
2428
|
}
|
|
2362
2429
|
}
|
|
2363
|
-
return this._cap(
|
|
2430
|
+
return this._cap(i);
|
|
2364
2431
|
}
|
|
2365
2432
|
//* Trigger the 'countrychange' event.
|
|
2366
2433
|
_triggerCountryChange() {
|
|
@@ -2368,8 +2435,8 @@ class z2 {
|
|
|
2368
2435
|
}
|
|
2369
2436
|
//* Format the number as the user types.
|
|
2370
2437
|
_formatNumberAsYouType() {
|
|
2371
|
-
const e = this._getFullNumber(),
|
|
2372
|
-
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" &&
|
|
2438
|
+
const e = this._getFullNumber(), i = m.utils ? m.utils.formatNumberAsYouType(e, this.selectedCountryData.iso2) : e, { dialCode: s } = this.selectedCountryData;
|
|
2439
|
+
return this.options.separateDialCode && this.telInput.value.charAt(0) !== "+" && i.includes(`+${s}`) ? (i.split(`+${s}`)[1] || "").trim() : i;
|
|
2373
2440
|
}
|
|
2374
2441
|
//**************************
|
|
2375
2442
|
//* SECRET PUBLIC METHODS
|
|
@@ -2389,7 +2456,7 @@ class z2 {
|
|
|
2389
2456
|
destroy() {
|
|
2390
2457
|
var l, c;
|
|
2391
2458
|
this.telInput.iti = void 0;
|
|
2392
|
-
const { allowDropdown: e, separateDialCode:
|
|
2459
|
+
const { allowDropdown: e, separateDialCode: i } = this.options;
|
|
2393
2460
|
if (e) {
|
|
2394
2461
|
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2395
2462
|
"click",
|
|
@@ -2401,10 +2468,10 @@ class z2 {
|
|
|
2401
2468
|
const C = this.telInput.closest("label");
|
|
2402
2469
|
C && C.removeEventListener("click", this._handleLabelClick);
|
|
2403
2470
|
}
|
|
2404
|
-
const { form:
|
|
2405
|
-
this._handleHiddenInputSubmit &&
|
|
2406
|
-
const
|
|
2407
|
-
(l =
|
|
2471
|
+
const { form: s } = this.telInput;
|
|
2472
|
+
this._handleHiddenInputSubmit && s && s.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);
|
|
2473
|
+
const r = this.telInput.parentNode;
|
|
2474
|
+
(l = r == null ? void 0 : r.parentNode) == null || l.insertBefore(this.telInput, r), (c = r == null ? void 0 : r.parentNode) == null || c.removeChild(r), delete m.instances[this.id];
|
|
2408
2475
|
}
|
|
2409
2476
|
//* Get the extension from the current number.
|
|
2410
2477
|
getExtension() {
|
|
@@ -2416,10 +2483,10 @@ class z2 {
|
|
|
2416
2483
|
//* Format the number to the given format.
|
|
2417
2484
|
getNumber(e) {
|
|
2418
2485
|
if (m.utils) {
|
|
2419
|
-
const { iso2:
|
|
2486
|
+
const { iso2: i } = this.selectedCountryData;
|
|
2420
2487
|
return m.utils.formatNumber(
|
|
2421
2488
|
this._getFullNumber(),
|
|
2422
|
-
|
|
2489
|
+
i,
|
|
2423
2490
|
e
|
|
2424
2491
|
);
|
|
2425
2492
|
}
|
|
@@ -2459,25 +2526,25 @@ class z2 {
|
|
|
2459
2526
|
_validateNumber(e) {
|
|
2460
2527
|
if (!this.selectedCountryData.iso2)
|
|
2461
2528
|
return !1;
|
|
2462
|
-
const
|
|
2463
|
-
if (
|
|
2464
|
-
const l =
|
|
2529
|
+
const i = this._getFullNumber(), s = i.search(new RegExp("\\p{L}", "u")), r = (l) => e ? this._utilsIsValidNumber(l) : this._utilsIsPossibleNumber(l);
|
|
2530
|
+
if (s > -1) {
|
|
2531
|
+
const l = i.substring(0, s), c = r(l), C = r(i);
|
|
2465
2532
|
return c && C;
|
|
2466
2533
|
}
|
|
2467
|
-
return
|
|
2534
|
+
return r(i);
|
|
2468
2535
|
}
|
|
2469
2536
|
_utilsIsValidNumber(e) {
|
|
2470
2537
|
return m.utils ? m.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
|
|
2471
2538
|
}
|
|
2472
2539
|
//* Update the selected country, and update the input val accordingly.
|
|
2473
2540
|
setCountry(e) {
|
|
2474
|
-
const
|
|
2475
|
-
(e &&
|
|
2541
|
+
const i = e == null ? void 0 : e.toLowerCase(), s = this.selectedCountryData.iso2;
|
|
2542
|
+
(e && i !== s || !e && s) && (this._setCountry(i), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
|
|
2476
2543
|
}
|
|
2477
2544
|
//* Set the input value and update the country.
|
|
2478
2545
|
setNumber(e) {
|
|
2479
|
-
const
|
|
2480
|
-
this._updateValFromNumber(e),
|
|
2546
|
+
const i = this._updateCountryFromNumber(e);
|
|
2547
|
+
this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
|
|
2481
2548
|
}
|
|
2482
2549
|
//* Set the placeholder number typ
|
|
2483
2550
|
setPlaceholderNumberType(e) {
|
|
@@ -2493,32 +2560,32 @@ const Z2 = (y) => {
|
|
|
2493
2560
|
if (typeof y == "function")
|
|
2494
2561
|
try {
|
|
2495
2562
|
e = Promise.resolve(y());
|
|
2496
|
-
} catch (
|
|
2497
|
-
return Promise.reject(
|
|
2563
|
+
} catch (i) {
|
|
2564
|
+
return Promise.reject(i);
|
|
2498
2565
|
}
|
|
2499
2566
|
else
|
|
2500
2567
|
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}`));
|
|
2501
|
-
return m.startedLoadingUtilsScript = !0, e.then((
|
|
2502
|
-
const
|
|
2503
|
-
if (!
|
|
2568
|
+
return m.startedLoadingUtilsScript = !0, e.then((i) => {
|
|
2569
|
+
const s = i == null ? void 0 : i.default;
|
|
2570
|
+
if (!s || typeof s != "object")
|
|
2504
2571
|
throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
|
|
2505
|
-
return m.utils =
|
|
2506
|
-
}).catch((
|
|
2507
|
-
throw
|
|
2572
|
+
return m.utils = s, i1("handleUtils"), !0;
|
|
2573
|
+
}).catch((i) => {
|
|
2574
|
+
throw i1("rejectUtilsScriptPromise", i), i;
|
|
2508
2575
|
});
|
|
2509
2576
|
}
|
|
2510
2577
|
return null;
|
|
2511
2578
|
}, m = Object.assign(
|
|
2512
2579
|
(y, e) => {
|
|
2513
|
-
const
|
|
2514
|
-
return
|
|
2580
|
+
const i = new p1(y, e);
|
|
2581
|
+
return i._init(), y.setAttribute("data-intl-tel-input-id", i.id.toString()), m.instances[i.id] = i, y.iti = i, i;
|
|
2515
2582
|
},
|
|
2516
2583
|
{
|
|
2517
|
-
defaults:
|
|
2584
|
+
defaults: l2,
|
|
2518
2585
|
//* Using a static var like this allows us to mock it in the tests.
|
|
2519
2586
|
documentReady: () => document.readyState === "complete",
|
|
2520
2587
|
//* Get the country data object.
|
|
2521
|
-
getCountryData: () =>
|
|
2588
|
+
getCountryData: () => q,
|
|
2522
2589
|
//* A getter for the plugin instance.
|
|
2523
2590
|
getInstance: (y) => {
|
|
2524
2591
|
const e = y.getAttribute("data-intl-tel-input-id");
|
|
@@ -2529,7 +2596,7 @@ const Z2 = (y) => {
|
|
|
2529
2596
|
attachUtils: Z2,
|
|
2530
2597
|
startedLoadingUtilsScript: !1,
|
|
2531
2598
|
startedLoadingAutoCountry: !1,
|
|
2532
|
-
version: "25.
|
|
2599
|
+
version: "25.8.1"
|
|
2533
2600
|
}
|
|
2534
2601
|
);
|
|
2535
2602
|
(function() {
|
|
@@ -2538,23 +2605,23 @@ const Z2 = (y) => {
|
|
|
2538
2605
|
d = d.split(".");
|
|
2539
2606
|
var $ = y;
|
|
2540
2607
|
d[0] in $ || typeof $.execScript > "u" || $.execScript("var " + d[0]);
|
|
2541
|
-
for (var
|
|
2608
|
+
for (var n; d.length && (n = d.shift()); ) d.length || t === void 0 ? $[n] && $[n] !== Object.prototype[n] ? $ = $[n] : $ = $[n] = {} : $[n] = t;
|
|
2542
2609
|
}
|
|
2543
|
-
function
|
|
2610
|
+
function i(d, t) {
|
|
2544
2611
|
function $() {
|
|
2545
2612
|
}
|
|
2546
|
-
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(
|
|
2547
|
-
for (var
|
|
2548
|
-
return t.prototype[o].apply(
|
|
2613
|
+
$.prototype = t.prototype, d.ma = t.prototype, d.prototype = new $(), d.prototype.constructor = d, d.sa = function(n, o, a) {
|
|
2614
|
+
for (var u = Array(arguments.length - 2), h = 2; h < arguments.length; h++) u[h - 2] = arguments[h];
|
|
2615
|
+
return t.prototype[o].apply(n, u);
|
|
2549
2616
|
};
|
|
2550
2617
|
}
|
|
2551
|
-
function
|
|
2618
|
+
function s(d) {
|
|
2552
2619
|
const t = [];
|
|
2553
2620
|
let $ = 0;
|
|
2554
|
-
for (const
|
|
2621
|
+
for (const n in d) t[$++] = d[n];
|
|
2555
2622
|
return t;
|
|
2556
2623
|
}
|
|
2557
|
-
var
|
|
2624
|
+
var r = class {
|
|
2558
2625
|
constructor(d) {
|
|
2559
2626
|
if (l !== l) throw Error("SafeUrl is not meant to be built directly");
|
|
2560
2627
|
this.g = d;
|
|
@@ -2563,7 +2630,7 @@ const Z2 = (y) => {
|
|
|
2563
2630
|
return this.g.toString();
|
|
2564
2631
|
}
|
|
2565
2632
|
}, l = {};
|
|
2566
|
-
new
|
|
2633
|
+
new r("about:invalid#zClosurez"), new r("about:blank");
|
|
2567
2634
|
const c = {};
|
|
2568
2635
|
class C {
|
|
2569
2636
|
constructor() {
|
|
@@ -2574,83 +2641,83 @@ const Z2 = (y) => {
|
|
|
2574
2641
|
}
|
|
2575
2642
|
}
|
|
2576
2643
|
new C();
|
|
2577
|
-
const
|
|
2578
|
-
class
|
|
2644
|
+
const f = {};
|
|
2645
|
+
class S {
|
|
2579
2646
|
constructor() {
|
|
2580
|
-
if (
|
|
2647
|
+
if (f !== f) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
2581
2648
|
}
|
|
2582
2649
|
toString() {
|
|
2583
2650
|
return "";
|
|
2584
2651
|
}
|
|
2585
2652
|
}
|
|
2586
|
-
new
|
|
2587
|
-
const
|
|
2588
|
-
class
|
|
2653
|
+
new S();
|
|
2654
|
+
const w = {};
|
|
2655
|
+
class b {
|
|
2589
2656
|
constructor() {
|
|
2590
2657
|
var t = y.trustedTypes && y.trustedTypes.emptyHTML || "";
|
|
2591
|
-
if (
|
|
2658
|
+
if (w !== w) throw Error("SafeHtml is not meant to be built directly");
|
|
2592
2659
|
this.g = t;
|
|
2593
2660
|
}
|
|
2594
2661
|
toString() {
|
|
2595
2662
|
return this.g.toString();
|
|
2596
2663
|
}
|
|
2597
2664
|
}
|
|
2598
|
-
new
|
|
2665
|
+
new b();
|
|
2599
2666
|
function L(d, t) {
|
|
2600
2667
|
switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
|
|
2601
2668
|
case G:
|
|
2602
|
-
case
|
|
2669
|
+
case U:
|
|
2603
2670
|
case D:
|
|
2604
|
-
case
|
|
2605
|
-
case
|
|
2671
|
+
case P:
|
|
2672
|
+
case Y:
|
|
2606
2673
|
case I:
|
|
2607
|
-
case
|
|
2674
|
+
case p:
|
|
2608
2675
|
this.o = !0;
|
|
2609
2676
|
}
|
|
2610
2677
|
this.j = t.defaultValue;
|
|
2611
2678
|
}
|
|
2612
|
-
var
|
|
2613
|
-
function
|
|
2679
|
+
var p = 1, I = 2, G = 3, U = 4, D = 6, P = 16, Y = 18;
|
|
2680
|
+
function c2(d, t) {
|
|
2614
2681
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
2615
2682
|
var $ = t[d];
|
|
2616
2683
|
this.g[$.g] = $;
|
|
2617
2684
|
}
|
|
2618
2685
|
}
|
|
2619
|
-
function
|
|
2620
|
-
return d =
|
|
2686
|
+
function f2(d) {
|
|
2687
|
+
return d = s(d.g), d.sort(function(t, $) {
|
|
2621
2688
|
return t.g - $.g;
|
|
2622
2689
|
}), d;
|
|
2623
2690
|
}
|
|
2624
|
-
function
|
|
2691
|
+
function R() {
|
|
2625
2692
|
this.h = {}, this.j = this.m().g, this.g = this.l = null;
|
|
2626
2693
|
}
|
|
2627
|
-
|
|
2628
|
-
return
|
|
2629
|
-
},
|
|
2694
|
+
R.prototype.has = function(d) {
|
|
2695
|
+
return B(this, d.g);
|
|
2696
|
+
}, R.prototype.get = function(d, t) {
|
|
2630
2697
|
return g(this, d.g, t);
|
|
2631
|
-
},
|
|
2698
|
+
}, R.prototype.set = function(d, t) {
|
|
2632
2699
|
E(this, d.g, t);
|
|
2633
|
-
},
|
|
2634
|
-
|
|
2700
|
+
}, R.prototype.add = function(d, t) {
|
|
2701
|
+
b1(this, d.g, t);
|
|
2635
2702
|
};
|
|
2636
|
-
function
|
|
2637
|
-
for (var $ =
|
|
2638
|
-
var o = $[
|
|
2639
|
-
if (
|
|
2703
|
+
function w1(d, t) {
|
|
2704
|
+
for (var $ = f2(d.m()), n = 0; n < $.length; n++) {
|
|
2705
|
+
var o = $[n], a = o.g;
|
|
2706
|
+
if (B(t, a)) {
|
|
2640
2707
|
d.g && delete d.g[o.g];
|
|
2641
|
-
var
|
|
2708
|
+
var u = o.h == 11 || o.h == 10;
|
|
2642
2709
|
if (o.l) {
|
|
2643
|
-
o =
|
|
2644
|
-
for (var h = 0; h < o.length; h++)
|
|
2645
|
-
} else o = n1(t,
|
|
2710
|
+
o = x(t, a);
|
|
2711
|
+
for (var h = 0; h < o.length; h++) b1(d, a, u ? o[h].clone() : o[h]);
|
|
2712
|
+
} else o = n1(t, a), u ? (u = n1(d, a)) ? w1(u, o) : E(d, a, o.clone()) : E(d, a, o);
|
|
2646
2713
|
}
|
|
2647
2714
|
}
|
|
2648
2715
|
}
|
|
2649
|
-
|
|
2716
|
+
R.prototype.clone = function() {
|
|
2650
2717
|
var d = new this.constructor();
|
|
2651
|
-
return d != this && (d.h = {}, d.g && (d.g = {}),
|
|
2718
|
+
return d != this && (d.h = {}, d.g && (d.g = {}), w1(d, this)), d;
|
|
2652
2719
|
};
|
|
2653
|
-
function
|
|
2720
|
+
function B(d, t) {
|
|
2654
2721
|
return d.h[t] != null;
|
|
2655
2722
|
}
|
|
2656
2723
|
function n1(d, t) {
|
|
@@ -2658,11 +2725,11 @@ const Z2 = (y) => {
|
|
|
2658
2725
|
if ($ == null) return null;
|
|
2659
2726
|
if (d.l) {
|
|
2660
2727
|
if (!(t in d.g)) {
|
|
2661
|
-
var
|
|
2728
|
+
var n = d.l, o = d.j[t];
|
|
2662
2729
|
if ($ != null) if (o.l) {
|
|
2663
|
-
for (var
|
|
2664
|
-
$ =
|
|
2665
|
-
} else $ =
|
|
2730
|
+
for (var a = [], u = 0; u < $.length; u++) a[u] = n.h(o, $[u]);
|
|
2731
|
+
$ = a;
|
|
2732
|
+
} else $ = n.h(o, $);
|
|
2666
2733
|
return d.g[t] = $;
|
|
2667
2734
|
}
|
|
2668
2735
|
return d.g[t];
|
|
@@ -2670,11 +2737,11 @@ const Z2 = (y) => {
|
|
|
2670
2737
|
return $;
|
|
2671
2738
|
}
|
|
2672
2739
|
function g(d, t, $) {
|
|
2673
|
-
var
|
|
2674
|
-
return d.j[t].l ?
|
|
2740
|
+
var n = n1(d, t);
|
|
2741
|
+
return d.j[t].l ? n[$ || 0] : n;
|
|
2675
2742
|
}
|
|
2676
|
-
function
|
|
2677
|
-
if (
|
|
2743
|
+
function v(d, t) {
|
|
2744
|
+
if (B(d, t)) d = g(d, t);
|
|
2678
2745
|
else d: {
|
|
2679
2746
|
if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
|
|
2680
2747
|
else if (t === Number) d.j = 0;
|
|
@@ -2687,88 +2754,88 @@ const Z2 = (y) => {
|
|
|
2687
2754
|
}
|
|
2688
2755
|
return d;
|
|
2689
2756
|
}
|
|
2690
|
-
function
|
|
2757
|
+
function x(d, t) {
|
|
2691
2758
|
return n1(d, t) || [];
|
|
2692
2759
|
}
|
|
2693
2760
|
function K(d, t) {
|
|
2694
|
-
return d.j[t].l ?
|
|
2761
|
+
return d.j[t].l ? B(d, t) ? d.h[t].length : 0 : B(d, t) ? 1 : 0;
|
|
2695
2762
|
}
|
|
2696
2763
|
function E(d, t, $) {
|
|
2697
2764
|
d.h[t] = $, d.g && (d.g[t] = $);
|
|
2698
2765
|
}
|
|
2699
|
-
function
|
|
2766
|
+
function b1(d, t, $) {
|
|
2700
2767
|
d.h[t] || (d.h[t] = []), d.h[t].push($), d.g && delete d.g[t];
|
|
2701
2768
|
}
|
|
2702
|
-
function
|
|
2703
|
-
var $ = [],
|
|
2704
|
-
for (
|
|
2705
|
-
return new
|
|
2769
|
+
function s1(d, t) {
|
|
2770
|
+
var $ = [], n;
|
|
2771
|
+
for (n in t) n != 0 && $.push(new L(n, t[n]));
|
|
2772
|
+
return new c2(d, $);
|
|
2706
2773
|
}
|
|
2707
2774
|
function r1() {
|
|
2708
2775
|
}
|
|
2709
2776
|
r1.prototype.g = function(d) {
|
|
2710
2777
|
throw new d.h(), Error("Unimplemented");
|
|
2711
2778
|
}, r1.prototype.h = function(d, t) {
|
|
2712
|
-
if (d.h == 11 || d.h == 10) return t instanceof
|
|
2713
|
-
if (d.h == 14) return typeof t == "string" &&
|
|
2779
|
+
if (d.h == 11 || d.h == 10) return t instanceof R ? t : this.g(d.s.prototype.m(), t);
|
|
2780
|
+
if (d.h == 14) return typeof t == "string" && L1.test(t) && (d = Number(t), 0 < d) ? d : t;
|
|
2714
2781
|
if (!d.o) return t;
|
|
2715
2782
|
if (d = d.s, d === String) {
|
|
2716
2783
|
if (typeof t == "number") return String(t);
|
|
2717
|
-
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" ||
|
|
2784
|
+
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || L1.test(t))) return Number(t);
|
|
2718
2785
|
return t;
|
|
2719
2786
|
};
|
|
2720
|
-
var
|
|
2721
|
-
function
|
|
2787
|
+
var L1 = /^-?[0-9]+$/;
|
|
2788
|
+
function g1() {
|
|
2722
2789
|
}
|
|
2723
|
-
|
|
2790
|
+
i(g1, r1), g1.prototype.g = function(d, t) {
|
|
2724
2791
|
return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
|
|
2725
2792
|
};
|
|
2726
|
-
function
|
|
2793
|
+
function X() {
|
|
2727
2794
|
}
|
|
2728
|
-
|
|
2795
|
+
i(X, g1), X.prototype.h = function(d, t) {
|
|
2729
2796
|
return d.h == 8 ? !!t : r1.prototype.h.apply(this, arguments);
|
|
2730
|
-
},
|
|
2731
|
-
return
|
|
2797
|
+
}, X.prototype.g = function(d, t) {
|
|
2798
|
+
return X.ma.g.call(this, d, t);
|
|
2732
2799
|
};
|
|
2733
|
-
function
|
|
2800
|
+
function A(d, t) {
|
|
2734
2801
|
d != null && this.g.apply(this, arguments);
|
|
2735
2802
|
}
|
|
2736
|
-
|
|
2803
|
+
A.prototype.h = "", A.prototype.set = function(d) {
|
|
2737
2804
|
this.h = "" + d;
|
|
2738
|
-
},
|
|
2739
|
-
if (this.h += String(d), t != null) for (let
|
|
2805
|
+
}, A.prototype.g = function(d, t, $) {
|
|
2806
|
+
if (this.h += String(d), t != null) for (let n = 1; n < arguments.length; n++) this.h += arguments[n];
|
|
2740
2807
|
return this;
|
|
2741
2808
|
};
|
|
2742
|
-
function
|
|
2809
|
+
function k(d) {
|
|
2743
2810
|
d.h = "";
|
|
2744
2811
|
}
|
|
2745
|
-
|
|
2812
|
+
A.prototype.toString = function() {
|
|
2746
2813
|
return this.h;
|
|
2747
2814
|
};
|
|
2748
2815
|
function W() {
|
|
2749
|
-
|
|
2816
|
+
R.call(this);
|
|
2750
2817
|
}
|
|
2751
|
-
|
|
2752
|
-
var
|
|
2818
|
+
i(W, R);
|
|
2819
|
+
var N1 = null;
|
|
2753
2820
|
function N() {
|
|
2754
|
-
|
|
2821
|
+
R.call(this);
|
|
2755
2822
|
}
|
|
2756
|
-
|
|
2757
|
-
var
|
|
2823
|
+
i(N, R);
|
|
2824
|
+
var T1 = null;
|
|
2758
2825
|
function z() {
|
|
2759
|
-
|
|
2826
|
+
R.call(this);
|
|
2760
2827
|
}
|
|
2761
|
-
|
|
2762
|
-
var
|
|
2828
|
+
i(z, R);
|
|
2829
|
+
var A1 = null;
|
|
2763
2830
|
W.prototype.m = function() {
|
|
2764
|
-
var d = L1;
|
|
2765
|
-
return d || (L1 = d = i1(W, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
|
|
2766
|
-
}, W.m = W.prototype.m, N.prototype.m = function() {
|
|
2767
2831
|
var d = N1;
|
|
2768
|
-
return d || (N1 = d =
|
|
2769
|
-
},
|
|
2832
|
+
return d || (N1 = d = s1(W, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
|
|
2833
|
+
}, W.m = W.prototype.m, N.prototype.m = function() {
|
|
2770
2834
|
var d = T1;
|
|
2771
|
-
return d || (T1 = d =
|
|
2835
|
+
return d || (T1 = d = s1(N, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
|
|
2836
|
+
}, N.m = N.prototype.m, z.prototype.m = function() {
|
|
2837
|
+
var d = A1;
|
|
2838
|
+
return d || (A1 = d = s1(z, {
|
|
2772
2839
|
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
|
|
2773
2840
|
1: { name: "general_desc", i: 11, type: N },
|
|
2774
2841
|
2: { name: "fixed_line", i: 11, type: N },
|
|
@@ -2807,19 +2874,19 @@ const Z2 = (y) => {
|
|
|
2807
2874
|
})), d;
|
|
2808
2875
|
}, z.m = z.prototype.m;
|
|
2809
2876
|
function H() {
|
|
2810
|
-
|
|
2877
|
+
R.call(this);
|
|
2811
2878
|
}
|
|
2812
|
-
|
|
2813
|
-
var
|
|
2879
|
+
i(H, R);
|
|
2880
|
+
var E1 = null, p2 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
|
|
2814
2881
|
H.prototype.m = function() {
|
|
2815
|
-
var d =
|
|
2816
|
-
return d || (
|
|
2882
|
+
var d = E1;
|
|
2883
|
+
return d || (E1 = d = s1(H, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: p2 }, 7: {
|
|
2817
2884
|
name: "preferred_domestic_carrier_code",
|
|
2818
2885
|
i: 9,
|
|
2819
2886
|
type: String
|
|
2820
2887
|
} })), d;
|
|
2821
2888
|
}, H.ctor = H, H.ctor.m = H.prototype.m;
|
|
2822
|
-
var
|
|
2889
|
+
var Q = {
|
|
2823
2890
|
1: "US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),
|
|
2824
2891
|
7: ["RU", "KZ"],
|
|
2825
2892
|
20: ["EG"],
|
|
@@ -3035,7 +3102,7 @@ const Z2 = (y) => {
|
|
|
3035
3102
|
995: ["GE"],
|
|
3036
3103
|
996: ["KG"],
|
|
3037
3104
|
998: ["UZ"]
|
|
3038
|
-
},
|
|
3105
|
+
}, M1 = {
|
|
3039
3106
|
AC: [, [
|
|
3040
3107
|
,
|
|
3041
3108
|
,
|
|
@@ -8146,7 +8213,7 @@ const Z2 = (y) => {
|
|
|
8146
8213
|
M.h = void 0, M.g = function() {
|
|
8147
8214
|
return M.h ? M.h : M.h = new M();
|
|
8148
8215
|
};
|
|
8149
|
-
var
|
|
8216
|
+
var C1 = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "0": "0", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8", "9": "9", "٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9", "۰": "0", "۱": "1", "۲": "2", "۳": "3", "۴": "4", "۵": "5", "۶": "6", "۷": "7", "۸": "8", "۹": "9" }, g2 = {
|
|
8150
8217
|
0: "0",
|
|
8151
8218
|
1: "1",
|
|
8152
8219
|
2: "2",
|
|
@@ -8160,7 +8227,7 @@ const Z2 = (y) => {
|
|
|
8160
8227
|
"+": "+",
|
|
8161
8228
|
"*": "*",
|
|
8162
8229
|
"#": "#"
|
|
8163
|
-
},
|
|
8230
|
+
}, C2 = {
|
|
8164
8231
|
0: "0",
|
|
8165
8232
|
1: "1",
|
|
8166
8233
|
2: "2",
|
|
@@ -8227,83 +8294,83 @@ const Z2 = (y) => {
|
|
|
8227
8294
|
X: "9",
|
|
8228
8295
|
Y: "9",
|
|
8229
8296
|
Z: "9"
|
|
8230
|
-
},
|
|
8231
|
-
function
|
|
8297
|
+
}, m2 = RegExp("[++]+"), d1 = RegExp("^[++]+"), D1 = RegExp("([0-90-9٠-٩۰-۹])"), y2 = RegExp("[++0-90-9٠-٩۰-۹]"), _2 = /[\\\/] *x/, I2 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), v2 = /(?:.*?[A-Za-z]){3}.*/, S2 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), w2 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
|
|
8298
|
+
function J(d) {
|
|
8232
8299
|
return "([0-90-9٠-٩۰-۹]{1," + d + "})";
|
|
8233
8300
|
}
|
|
8234
|
-
function
|
|
8235
|
-
return ";ext=" +
|
|
8236
|
-
}
|
|
8237
|
-
var P1 = new RegExp("(?:" + D1() + ")$", "i"), w2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + D1() + ")?$", "i"), b2 = /(\$\d)/, L2 = /^\(?\$1\)?$/;
|
|
8238
|
-
function x1(d) {
|
|
8239
|
-
return 2 > d.length ? !1 : U(w2, d);
|
|
8301
|
+
function x1() {
|
|
8302
|
+
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") + "#?");
|
|
8240
8303
|
}
|
|
8304
|
+
var P1 = new RegExp("(?:" + x1() + ")$", "i"), b2 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + x1() + ")?$", "i"), L2 = /(\$\d)/, N2 = /^\(?\$1\)?$/;
|
|
8241
8305
|
function R1(d) {
|
|
8242
|
-
return
|
|
8306
|
+
return 2 > d.length ? !1 : F(b2, d);
|
|
8243
8307
|
}
|
|
8244
8308
|
function B1(d) {
|
|
8245
|
-
|
|
8246
|
-
B(d), d.g(t);
|
|
8309
|
+
return F(v2, d) ? o1(d, C2) : o1(d, C1);
|
|
8247
8310
|
}
|
|
8248
8311
|
function k1(d) {
|
|
8249
|
-
|
|
8312
|
+
var t = B1(d.toString());
|
|
8313
|
+
k(d), d.g(t);
|
|
8250
8314
|
}
|
|
8251
|
-
function
|
|
8252
|
-
|
|
8315
|
+
function O1(d) {
|
|
8316
|
+
return d != null && (K(d, 9) != 1 || x(d, 9)[0] != -1);
|
|
8317
|
+
}
|
|
8318
|
+
function o1(d, t) {
|
|
8319
|
+
for (var $ = new A(), n, o = d.length, a = 0; a < o; ++a) n = d.charAt(a), n = t[n.toUpperCase()], n != null && $.g(n);
|
|
8253
8320
|
return $.toString();
|
|
8254
8321
|
}
|
|
8255
|
-
function
|
|
8256
|
-
return d.length == 0 ||
|
|
8322
|
+
function G1(d) {
|
|
8323
|
+
return d.length == 0 || N2.test(d);
|
|
8257
8324
|
}
|
|
8258
|
-
function
|
|
8259
|
-
return d != null && isNaN(d) && d.toUpperCase() in
|
|
8325
|
+
function a1(d) {
|
|
8326
|
+
return d != null && isNaN(d) && d.toUpperCase() in M1;
|
|
8260
8327
|
}
|
|
8261
8328
|
M.prototype.format = function(d, t) {
|
|
8262
|
-
if (g(d, 2) == 0 &&
|
|
8263
|
-
var $ =
|
|
8329
|
+
if (g(d, 2) == 0 && B(d, 5)) {
|
|
8330
|
+
var $ = v(d, 5);
|
|
8264
8331
|
if (0 < $.length) return $;
|
|
8265
8332
|
}
|
|
8266
|
-
$ =
|
|
8267
|
-
var
|
|
8268
|
-
if (t == 0) return
|
|
8269
|
-
if (!($ in
|
|
8270
|
-
var o =
|
|
8271
|
-
d =
|
|
8333
|
+
$ = v(d, 1);
|
|
8334
|
+
var n = e1(d);
|
|
8335
|
+
if (t == 0) return U1($, 0, n, "");
|
|
8336
|
+
if (!($ in Q)) return n;
|
|
8337
|
+
var o = t1(this, $, $1($));
|
|
8338
|
+
d = B(d, 3) && g(d, 3).length != 0 ? t == 3 ? ";ext=" + g(d, 3) : B(o, 13) ? g(o, 13) + v(d, 3) : " ext. " + v(d, 3) : "";
|
|
8272
8339
|
d: {
|
|
8273
|
-
o =
|
|
8274
|
-
for (var
|
|
8275
|
-
|
|
8276
|
-
var _ = K(
|
|
8277
|
-
if ((_ == 0 ||
|
|
8278
|
-
o =
|
|
8340
|
+
o = x(o, 20).length == 0 || t == 2 ? x(o, 19) : x(o, 20);
|
|
8341
|
+
for (var a, u = o.length, h = 0; h < u; ++h) {
|
|
8342
|
+
a = o[h];
|
|
8343
|
+
var _ = K(a, 3);
|
|
8344
|
+
if ((_ == 0 || n.search(g(a, 3, _ - 1)) == 0) && (_ = new RegExp(g(a, 1)), F(_, n))) {
|
|
8345
|
+
o = a;
|
|
8279
8346
|
break d;
|
|
8280
8347
|
}
|
|
8281
8348
|
}
|
|
8282
8349
|
o = null;
|
|
8283
8350
|
}
|
|
8284
|
-
return o != null && (
|
|
8285
|
-
|
|
8351
|
+
return o != null && (u = o, o = v(u, 2), a = new RegExp(g(u, 1)), v(
|
|
8352
|
+
u,
|
|
8286
8353
|
5
|
|
8287
|
-
),
|
|
8354
|
+
), u = v(u, 4), n = t == 2 && u != null && 0 < u.length ? n.replace(a, o.replace(L2, u)) : n.replace(a, o), t == 3 && (n = n.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), n = n.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), U1($, t, n, d);
|
|
8288
8355
|
};
|
|
8289
|
-
function
|
|
8356
|
+
function t1(d, t, $) {
|
|
8290
8357
|
return $ == "001" ? j(d, "" + t) : j(d, $);
|
|
8291
8358
|
}
|
|
8292
|
-
function
|
|
8293
|
-
if (!
|
|
8359
|
+
function e1(d) {
|
|
8360
|
+
if (!B(d, 2)) return "";
|
|
8294
8361
|
var t = "" + g(d, 2);
|
|
8295
|
-
return
|
|
8362
|
+
return B(d, 4) && g(d, 4) && 0 < v(d, 8) ? Array(v(d, 8) + 1).join("0") + t : t;
|
|
8296
8363
|
}
|
|
8297
|
-
function
|
|
8364
|
+
function U1(d, t, $, n) {
|
|
8298
8365
|
switch (t) {
|
|
8299
8366
|
case 0:
|
|
8300
|
-
return "+" + d + $ +
|
|
8367
|
+
return "+" + d + $ + n;
|
|
8301
8368
|
case 1:
|
|
8302
|
-
return "+" + d + " " + $ +
|
|
8369
|
+
return "+" + d + " " + $ + n;
|
|
8303
8370
|
case 3:
|
|
8304
|
-
return "tel:+" + d + "-" + $ +
|
|
8371
|
+
return "tel:+" + d + "-" + $ + n;
|
|
8305
8372
|
default:
|
|
8306
|
-
return $ +
|
|
8373
|
+
return $ + n;
|
|
8307
8374
|
}
|
|
8308
8375
|
}
|
|
8309
8376
|
function u1(d, t) {
|
|
@@ -8334,10 +8401,10 @@ const Z2 = (y) => {
|
|
|
8334
8401
|
}
|
|
8335
8402
|
}
|
|
8336
8403
|
function F1(d, t) {
|
|
8337
|
-
var $ =
|
|
8338
|
-
return d =
|
|
8404
|
+
var $ = V1(d, t);
|
|
8405
|
+
return d = t1(d, v(t, 1), $), d == null ? -1 : (t = e1(t), m1(t, d));
|
|
8339
8406
|
}
|
|
8340
|
-
function
|
|
8407
|
+
function m1(d, t) {
|
|
8341
8408
|
return O(d, g(t, 1)) ? O(d, g(t, 5)) ? 4 : O(d, g(t, 4)) ? 3 : O(d, g(t, 6)) ? 5 : O(d, g(t, 8)) ? 6 : O(d, g(t, 7)) ? 7 : O(d, g(t, 21)) ? 8 : O(d, g(t, 25)) ? 9 : O(d, g(t, 28)) ? 10 : O(d, g(t, 2)) ? g(t, 18) || O(d, g(t, 3)) ? 2 : 0 : !g(t, 18) && O(d, g(t, 3)) ? 1 : -1 : -1;
|
|
8342
8409
|
}
|
|
8343
8410
|
function j(d, t) {
|
|
@@ -8345,36 +8412,36 @@ const Z2 = (y) => {
|
|
|
8345
8412
|
t = t.toUpperCase();
|
|
8346
8413
|
var $ = d.g[t];
|
|
8347
8414
|
if ($ == null) {
|
|
8348
|
-
if ($ =
|
|
8349
|
-
$ = new
|
|
8415
|
+
if ($ = M1[t], $ == null) return null;
|
|
8416
|
+
$ = new X().g(z.m(), $), d.g[t] = $;
|
|
8350
8417
|
}
|
|
8351
8418
|
return $;
|
|
8352
8419
|
}
|
|
8353
8420
|
function O(d, t) {
|
|
8354
8421
|
var $ = d.length;
|
|
8355
|
-
return 0 < K(t, 9) &&
|
|
8422
|
+
return 0 < K(t, 9) && x(t, 9).indexOf($) == -1 ? !1 : F(v(t, 2), d);
|
|
8356
8423
|
}
|
|
8357
|
-
function
|
|
8358
|
-
var $ =
|
|
8359
|
-
return o == null || $ != "001" &&
|
|
8424
|
+
function T2(d, t) {
|
|
8425
|
+
var $ = V1(d, t), n = v(t, 1), o = t1(d, n, $);
|
|
8426
|
+
return o == null || $ != "001" && n != K1(d, $) ? o = !1 : (d = e1(t), o = m1(d, o) != -1), o;
|
|
8360
8427
|
}
|
|
8361
|
-
function
|
|
8428
|
+
function V1(d, t) {
|
|
8362
8429
|
if (t == null) return null;
|
|
8363
|
-
var $ =
|
|
8364
|
-
if ($ =
|
|
8430
|
+
var $ = v(t, 1);
|
|
8431
|
+
if ($ = Q[$], $ == null) d = null;
|
|
8365
8432
|
else if ($.length == 1) d = $[0];
|
|
8366
8433
|
else d: {
|
|
8367
|
-
t =
|
|
8368
|
-
for (var
|
|
8369
|
-
|
|
8370
|
-
var
|
|
8371
|
-
if (
|
|
8372
|
-
if (t.search(g(
|
|
8373
|
-
d =
|
|
8434
|
+
t = e1(t);
|
|
8435
|
+
for (var n, o = $.length, a = 0; a < o; a++) {
|
|
8436
|
+
n = $[a];
|
|
8437
|
+
var u = j(d, n);
|
|
8438
|
+
if (B(u, 23)) {
|
|
8439
|
+
if (t.search(g(u, 23)) == 0) {
|
|
8440
|
+
d = n;
|
|
8374
8441
|
break d;
|
|
8375
8442
|
}
|
|
8376
|
-
} else if (
|
|
8377
|
-
d =
|
|
8443
|
+
} else if (m1(t, u) != -1) {
|
|
8444
|
+
d = n;
|
|
8378
8445
|
break d;
|
|
8379
8446
|
}
|
|
8380
8447
|
}
|
|
@@ -8382,151 +8449,151 @@ const Z2 = (y) => {
|
|
|
8382
8449
|
}
|
|
8383
8450
|
return d;
|
|
8384
8451
|
}
|
|
8385
|
-
function
|
|
8386
|
-
return d =
|
|
8452
|
+
function $1(d) {
|
|
8453
|
+
return d = Q[d], d == null ? "ZZ" : d[0];
|
|
8387
8454
|
}
|
|
8388
|
-
function
|
|
8455
|
+
function K1(d, t) {
|
|
8389
8456
|
if (d = j(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8390
|
-
return
|
|
8457
|
+
return v(d, 10);
|
|
8391
8458
|
}
|
|
8392
|
-
function
|
|
8393
|
-
var o = u1($,
|
|
8394
|
-
if (o =
|
|
8395
|
-
else return
|
|
8396
|
-
return
|
|
8459
|
+
function l1(d, t, $, n) {
|
|
8460
|
+
var o = u1($, n), a = K(o, 9) == 0 ? x(g($, 1), 9) : x(o, 9);
|
|
8461
|
+
if (o = x(o, 10), n == 2) if (O1(u1($, 0))) d = u1($, 1), O1(d) && (a = a.concat(K(d, 9) == 0 ? x(g($, 1), 9) : x(d, 9)), a.sort(), o.length == 0 ? o = x(d, 10) : (o = o.concat(x(d, 10)), o.sort()));
|
|
8462
|
+
else return l1(d, t, $, 1);
|
|
8463
|
+
return a[0] == -1 ? 5 : (t = t.length, -1 < o.indexOf(t) ? 4 : ($ = a[0], $ == t ? 0 : $ > t ? 2 : a[a.length - 1] < t ? 3 : -1 < a.indexOf(t, 1) ? 0 : 5));
|
|
8397
8464
|
}
|
|
8398
|
-
function
|
|
8399
|
-
var
|
|
8400
|
-
return t =
|
|
8465
|
+
function h1(d, t, $) {
|
|
8466
|
+
var n = e1(t);
|
|
8467
|
+
return t = v(t, 1), t in Q ? (t = t1(d, t, $1(t)), l1(d, n, t, $)) : 1;
|
|
8401
8468
|
}
|
|
8402
|
-
function
|
|
8469
|
+
function H1(d, t) {
|
|
8403
8470
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8404
|
-
for (var $,
|
|
8471
|
+
for (var $, n = d.length, o = 1; 3 >= o && o <= n; ++o) if ($ = parseInt(d.substring(0, o), 10), $ in Q) return t.g(d.substring(o)), $;
|
|
8405
8472
|
return 0;
|
|
8406
8473
|
}
|
|
8407
|
-
function
|
|
8474
|
+
function j1(d, t, $, n, o, a) {
|
|
8408
8475
|
if (t.length == 0) return 0;
|
|
8409
|
-
t = new
|
|
8410
|
-
var
|
|
8411
|
-
$ != null && (
|
|
8476
|
+
t = new A(t);
|
|
8477
|
+
var u;
|
|
8478
|
+
$ != null && (u = g($, 11)), u == null && (u = "NonMatch");
|
|
8412
8479
|
var h = t.toString();
|
|
8413
|
-
if (h.length == 0)
|
|
8414
|
-
else if (
|
|
8480
|
+
if (h.length == 0) u = 20;
|
|
8481
|
+
else if (d1.test(h)) h = h.replace(d1, ""), k(t), t.g(B1(h)), u = 1;
|
|
8415
8482
|
else {
|
|
8416
|
-
if (h = new RegExp(
|
|
8417
|
-
h =
|
|
8418
|
-
var _ =
|
|
8419
|
-
_ && _[1] != null && 0 < _[1].length &&
|
|
8420
|
-
} else
|
|
8421
|
-
|
|
8483
|
+
if (h = new RegExp(u), k1(t), u = t.toString(), u.search(h) == 0) {
|
|
8484
|
+
h = u.match(h)[0].length;
|
|
8485
|
+
var _ = u.substring(h).match(D1);
|
|
8486
|
+
_ && _[1] != null && 0 < _[1].length && o1(_[1], C1) == "0" ? u = !1 : (k(t), t.g(u.substring(h)), u = !0);
|
|
8487
|
+
} else u = !1;
|
|
8488
|
+
u = u ? 5 : 20;
|
|
8422
8489
|
}
|
|
8423
|
-
if (o && E(
|
|
8490
|
+
if (o && E(a, 6, u), u != 20) {
|
|
8424
8491
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8425
|
-
if (d =
|
|
8492
|
+
if (d = H1(t, n), d != 0) return E(a, 1, d), d;
|
|
8426
8493
|
throw Error("Invalid country calling code");
|
|
8427
8494
|
}
|
|
8428
|
-
return $ != null && (
|
|
8429
|
-
}
|
|
8430
|
-
function
|
|
8431
|
-
var
|
|
8432
|
-
if (o != 0 &&
|
|
8433
|
-
var
|
|
8434
|
-
if (o =
|
|
8435
|
-
|
|
8436
|
-
var h =
|
|
8437
|
-
t = g(t, 16), t == null || t.length == 0 || o[_] == null || o[_].length == 0 ? (!h ||
|
|
8495
|
+
return $ != null && (u = v($, 10), h = "" + u, _ = t.toString(), _.lastIndexOf(h, 0) == 0 && (h = new A(_.substring(h.length)), _ = g($, 1), _ = new RegExp(v(_, 2)), W1(h, $, null), h = h.toString(), !F(_, t.toString()) && F(_, h) || l1(d, t.toString(), $, -1) == 3)) ? (n.g(h), o && E(a, 6, 10), E(a, 1, u), u) : (E(a, 1, 0), 0);
|
|
8496
|
+
}
|
|
8497
|
+
function W1(d, t, $) {
|
|
8498
|
+
var n = d.toString(), o = n.length, a = g(t, 15);
|
|
8499
|
+
if (o != 0 && a != null && a.length != 0) {
|
|
8500
|
+
var u = new RegExp("^(?:" + a + ")");
|
|
8501
|
+
if (o = u.exec(n)) {
|
|
8502
|
+
a = new RegExp(v(g(t, 1), 2));
|
|
8503
|
+
var h = F(a, n), _ = o.length - 1;
|
|
8504
|
+
t = g(t, 16), t == null || t.length == 0 || o[_] == null || o[_].length == 0 ? (!h || F(a, n.substring(o[0].length))) && ($ != null && 0 < _ && o[_] != null && $.g(o[1]), d.set(n.substring(o[0].length))) : (n = n.replace(u, t), (!h || F(a, n)) && ($ != null && 0 < _ && $.g(o[1]), d.set(n)));
|
|
8438
8505
|
}
|
|
8439
8506
|
}
|
|
8440
8507
|
}
|
|
8441
8508
|
function Z(d, t, $) {
|
|
8442
|
-
if (!
|
|
8443
|
-
return
|
|
8509
|
+
if (!a1($) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8510
|
+
return z1(d, t, $, !0);
|
|
8444
8511
|
}
|
|
8445
|
-
function
|
|
8512
|
+
function z1(d, t, $, n) {
|
|
8446
8513
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8447
8514
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8448
|
-
var o = new
|
|
8449
|
-
if (
|
|
8450
|
-
else if (
|
|
8515
|
+
var o = new A(), a = t.indexOf(";phone-context=");
|
|
8516
|
+
if (a === -1) a = null;
|
|
8517
|
+
else if (a += 15, a >= t.length) a = "";
|
|
8451
8518
|
else {
|
|
8452
|
-
var
|
|
8453
|
-
|
|
8519
|
+
var u = t.indexOf(";", a);
|
|
8520
|
+
a = u !== -1 ? t.substring(a, u) : t.substring(a);
|
|
8454
8521
|
}
|
|
8455
|
-
var h =
|
|
8456
|
-
if (h == null ?
|
|
8457
|
-
if (
|
|
8458
|
-
|
|
8522
|
+
var h = a;
|
|
8523
|
+
if (h == null ? u = !0 : h.length === 0 ? u = !1 : (u = S2.exec(h), h = w2.exec(h), u = u !== null || h !== null), !u || (a != null ? (a.charAt(0) === "+" && o.g(a), a = t.indexOf("tel:"), o.g(t.substring(0 <= a ? a + 4 : 0, t.indexOf(";phone-context=")))) : (a = o.g, u = t ?? "", h = u.search(y2), 0 <= h ? (u = u.substring(h), u = u.replace(I2, ""), h = u.search(_2), 0 <= h && (u = u.substring(0, h))) : u = "", a.call(o, u)), a = o.toString(), u = a.indexOf(";isub="), 0 < u && (k(o), o.g(a.substring(0, u))), !R1(o.toString()))) throw Error("The string supplied did not seem to be a phone number");
|
|
8524
|
+
if (a = o.toString(), !(a1($) || a != null && 0 < a.length && d1.test(a))) throw Error("Invalid country calling code");
|
|
8525
|
+
a = new H(), n && E(a, 5, t);
|
|
8459
8526
|
d: {
|
|
8460
|
-
if (t = o.toString(),
|
|
8527
|
+
if (t = o.toString(), u = t.search(P1), 0 <= u && R1(t.substring(0, u))) {
|
|
8461
8528
|
h = t.match(P1);
|
|
8462
8529
|
for (var _ = h.length, V = 1; V < _; ++V) if (h[V] != null && 0 < h[V].length) {
|
|
8463
|
-
|
|
8530
|
+
k(o), o.g(t.substring(0, u)), t = h[V];
|
|
8464
8531
|
break d;
|
|
8465
8532
|
}
|
|
8466
8533
|
}
|
|
8467
8534
|
t = "";
|
|
8468
8535
|
}
|
|
8469
|
-
0 < t.length && E(
|
|
8536
|
+
0 < t.length && E(a, 3, t), u = j(d, $), t = new A(), h = 0, _ = o.toString();
|
|
8470
8537
|
try {
|
|
8471
|
-
h =
|
|
8472
|
-
} catch (
|
|
8473
|
-
if (
|
|
8474
|
-
if (_ = _.replace(
|
|
8475
|
-
} else throw
|
|
8538
|
+
h = j1(d, _, u, t, n, a);
|
|
8539
|
+
} catch (I1) {
|
|
8540
|
+
if (I1.message == "Invalid country calling code" && d1.test(_)) {
|
|
8541
|
+
if (_ = _.replace(d1, ""), h = j1(d, _, u, t, n, a), h == 0) throw I1;
|
|
8542
|
+
} else throw I1;
|
|
8476
8543
|
}
|
|
8477
|
-
if (h != 0 ? (o =
|
|
8478
|
-
|
|
8544
|
+
if (h != 0 ? (o = $1(h), o != $ && (u = t1(d, h, o))) : (k1(o), t.g(o.toString()), $ != null ? (h = v(u, 10), E(
|
|
8545
|
+
a,
|
|
8479
8546
|
1,
|
|
8480
8547
|
h
|
|
8481
|
-
)) :
|
|
8548
|
+
)) : n && (delete a.h[6], a.g && delete a.g[6])), 2 > t.h.length || (u != null && ($ = new A(), o = new A(t.toString()), W1(o, u, $), d = l1(d, o.toString(), u, -1), d != 2 && d != 4 && d != 5 && (t = o, n && 0 < $.toString().length && E(a, 7, $.toString()))), n = t.toString(), d = n.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
|
|
8482
8549
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
8483
|
-
if (1 <
|
|
8484
|
-
for (E(
|
|
8485
|
-
d != 1 && E(
|
|
8550
|
+
if (1 < n.length && n.charAt(0) == "0") {
|
|
8551
|
+
for (E(a, 4, !0), d = 1; d < n.length - 1 && n.charAt(d) == "0"; ) d++;
|
|
8552
|
+
d != 1 && E(a, 8, d);
|
|
8486
8553
|
}
|
|
8487
|
-
return E(
|
|
8554
|
+
return E(a, 2, parseInt(n, 10)), a;
|
|
8488
8555
|
}
|
|
8489
|
-
function
|
|
8556
|
+
function F(d, t) {
|
|
8490
8557
|
return !!((d = t.match(new RegExp("^(?:" + (typeof d == "string" ? d : d.source) + ")$", "i"))) && d[0].length == t.length);
|
|
8491
8558
|
}
|
|
8492
|
-
function
|
|
8493
|
-
this.fa = RegExp(" "), this.ja = "", this.v = new
|
|
8559
|
+
function A2(d) {
|
|
8560
|
+
this.fa = RegExp(" "), this.ja = "", this.v = new A(), this.da = "", this.s = new A(), this.ba = new A(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = M.g(), this.$ = 0, this.h = new A(), this.ha = !1, this.o = "", this.g = new A(), this.j = [], this.ka = d, this.l = J1(this, this.ka);
|
|
8494
8561
|
}
|
|
8495
|
-
var
|
|
8496
|
-
E(
|
|
8497
|
-
var
|
|
8498
|
-
function
|
|
8562
|
+
var Z1 = new z();
|
|
8563
|
+
E(Z1, 11, "NA");
|
|
8564
|
+
var E2 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), Y1 = /[- ]/;
|
|
8565
|
+
function J1(d, t) {
|
|
8499
8566
|
var $ = d.ga;
|
|
8500
|
-
return t =
|
|
8567
|
+
return t = a1(t) ? K1($, t) : 0, d = j(d.ga, $1(t)), d ?? Z1;
|
|
8501
8568
|
}
|
|
8502
|
-
function
|
|
8569
|
+
function q1(d) {
|
|
8503
8570
|
for (var t = d.j.length, $ = 0; $ < t; ++$) {
|
|
8504
|
-
var
|
|
8571
|
+
var n = d.j[$], o = v(n, 1);
|
|
8505
8572
|
if (d.da == o) return !1;
|
|
8506
|
-
var
|
|
8507
|
-
|
|
8508
|
-
var _ =
|
|
8509
|
-
|
|
8573
|
+
var a = d, u = n, h = v(u, 1);
|
|
8574
|
+
k(a.v);
|
|
8575
|
+
var _ = a;
|
|
8576
|
+
u = v(u, 2);
|
|
8510
8577
|
var V = "999999999999999".match(h)[0];
|
|
8511
|
-
if (V.length < _.g.h.length ? _ = "" : (_ = V.replace(new RegExp(h, "g"),
|
|
8578
|
+
if (V.length < _.g.h.length ? _ = "" : (_ = V.replace(new RegExp(h, "g"), u), _ = _.replace(RegExp("9", "g"), " ")), 0 < _.length ? (a.v.g(_), a = !0) : a = !1, a) return d.da = o, d.ha = Y1.test(g(n, 4)), d.$ = 0, !0;
|
|
8512
8579
|
}
|
|
8513
8580
|
return d.u = !1;
|
|
8514
8581
|
}
|
|
8515
|
-
function
|
|
8516
|
-
for (var $ = [],
|
|
8517
|
-
var
|
|
8518
|
-
K(
|
|
8582
|
+
function X1(d, t) {
|
|
8583
|
+
for (var $ = [], n = t.length - 3, o = d.j.length, a = 0; a < o; ++a) {
|
|
8584
|
+
var u = d.j[a];
|
|
8585
|
+
K(u, 3) == 0 ? $.push(d.j[a]) : (u = g(u, 3, Math.min(n, K(u, 3) - 1)), t.search(u) == 0 && $.push(d.j[a]));
|
|
8519
8586
|
}
|
|
8520
8587
|
d.j = $;
|
|
8521
8588
|
}
|
|
8522
|
-
function
|
|
8589
|
+
function M2(d, t) {
|
|
8523
8590
|
d.s.g(t);
|
|
8524
8591
|
var $ = t;
|
|
8525
|
-
if (
|
|
8592
|
+
if (D1.test($) || d.s.h.length == 1 && m2.test($) ? (t == "+" ? ($ = t, d.ba.g(t)) : ($ = C1[t], d.ba.g($), d.g.g($)), t = $) : (d.u = !1, d.la = !0), !d.u) {
|
|
8526
8593
|
if (!d.la) {
|
|
8527
|
-
if (
|
|
8528
|
-
if (
|
|
8529
|
-
} else if (0 < d.o.length && (t = d.g.toString(),
|
|
8594
|
+
if ($2(d)) {
|
|
8595
|
+
if (i2(d)) return Q1(d);
|
|
8596
|
+
} else if (0 < d.o.length && (t = d.g.toString(), k(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), $ = t.lastIndexOf(d.o), k(d.h), d.h.g(t.substring(0, $))), d.o != e2(d)) return d.h.g(" "), Q1(d);
|
|
8530
8597
|
}
|
|
8531
8598
|
return d.s.toString();
|
|
8532
8599
|
}
|
|
@@ -8536,99 +8603,99 @@ const Z2 = (y) => {
|
|
|
8536
8603
|
case 2:
|
|
8537
8604
|
return d.s.toString();
|
|
8538
8605
|
case 3:
|
|
8539
|
-
if (
|
|
8540
|
-
else return d.o =
|
|
8606
|
+
if ($2(d)) d.ea = !0;
|
|
8607
|
+
else return d.o = e2(d), y1(d);
|
|
8541
8608
|
default:
|
|
8542
|
-
return d.ea ? (
|
|
8609
|
+
return d.ea ? (i2(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = n2(d, t), $ = d2(d), 0 < $.length ? $ : (X1(d, d.g.toString()), q1(d) ? t2(d) : d.u ? c1(d, t) : d.s.toString())) : y1(d);
|
|
8543
8610
|
}
|
|
8544
8611
|
}
|
|
8545
|
-
function X1(d) {
|
|
8546
|
-
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, B(d.v), d.da = "", m1(d);
|
|
8547
|
-
}
|
|
8548
8612
|
function Q1(d) {
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8613
|
+
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, k(d.v), d.da = "", y1(d);
|
|
8614
|
+
}
|
|
8615
|
+
function d2(d) {
|
|
8616
|
+
for (var t = d.g.toString(), $ = d.j.length, n = 0; n < $; ++n) {
|
|
8617
|
+
var o = d.j[n], a = v(o, 1);
|
|
8618
|
+
if (new RegExp("^(?:" + a + ")$").test(t) && (d.ha = Y1.test(g(o, 4)), o = t.replace(new RegExp(a, "g"), g(o, 2)), o = c1(d, o), o1(o, g2) == d.ba)) return o;
|
|
8552
8619
|
}
|
|
8553
8620
|
return "";
|
|
8554
8621
|
}
|
|
8555
|
-
function
|
|
8622
|
+
function c1(d, t) {
|
|
8556
8623
|
var $ = d.h.h.length;
|
|
8557
8624
|
return d.ha && 0 < $ && d.h.toString().charAt($ - 1) != " " ? d.h + " " + t : d.h + t;
|
|
8558
8625
|
}
|
|
8559
|
-
function
|
|
8626
|
+
function y1(d) {
|
|
8560
8627
|
var t = d.g.toString();
|
|
8561
8628
|
if (3 <= t.length) {
|
|
8562
|
-
for (var $ = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ?
|
|
8563
|
-
var
|
|
8564
|
-
0 < d.o.length &&
|
|
8629
|
+
for (var $ = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ? x(d.l, 20) : x(d.l, 19), n = $.length, o = 0; o < n; ++o) {
|
|
8630
|
+
var a = $[o];
|
|
8631
|
+
0 < d.o.length && G1(v(a, 4)) && !g(a, 6) && !B(a, 5) || (d.o.length != 0 || d.ca || G1(v(a, 4)) || g(a, 6)) && E2.test(v(a, 2)) && d.j.push(a);
|
|
8565
8632
|
}
|
|
8566
|
-
return
|
|
8633
|
+
return X1(d, t), t = d2(d), 0 < t.length ? t : q1(d) ? t2(d) : d.s.toString();
|
|
8567
8634
|
}
|
|
8568
|
-
return
|
|
8635
|
+
return c1(d, t);
|
|
8569
8636
|
}
|
|
8570
|
-
function
|
|
8637
|
+
function t2(d) {
|
|
8571
8638
|
var t = d.g.toString(), $ = t.length;
|
|
8572
8639
|
if (0 < $) {
|
|
8573
|
-
for (var
|
|
8574
|
-
return d.u ?
|
|
8640
|
+
for (var n = "", o = 0; o < $; o++) n = n2(d, t.charAt(o));
|
|
8641
|
+
return d.u ? c1(d, n) : d.s.toString();
|
|
8575
8642
|
}
|
|
8576
8643
|
return d.h.toString();
|
|
8577
8644
|
}
|
|
8578
|
-
function
|
|
8645
|
+
function e2(d) {
|
|
8579
8646
|
var t = d.g.toString(), $ = 0;
|
|
8580
|
-
if (g(d.l, 10) != 1) var
|
|
8581
|
-
else
|
|
8582
|
-
return
|
|
8647
|
+
if (g(d.l, 10) != 1) var n = !1;
|
|
8648
|
+
else n = d.g.toString(), n = n.charAt(0) == "1" && n.charAt(1) != "0" && n.charAt(1) != "1";
|
|
8649
|
+
return n ? ($ = 1, d.h.g("1").g(" "), d.ca = !0) : B(d.l, 15) && (n = new RegExp("^(?:" + g(d.l, 15) + ")"), n = t.match(n), n != null && n[0] != null && 0 < n[0].length && (d.ca = !0, $ = n[0].length, d.h.g(t.substring(0, $)))), k(d.g), d.g.g(t.substring($)), t.substring(0, $);
|
|
8583
8650
|
}
|
|
8584
|
-
function
|
|
8651
|
+
function $2(d) {
|
|
8585
8652
|
var t = d.ba.toString(), $ = new RegExp("^(?:\\+|" + g(d.l, 11) + ")");
|
|
8586
|
-
return $ = t.match($), $ != null && $[0] != null && 0 < $[0].length ? (d.ca = !0, $ = $[0].length,
|
|
8653
|
+
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;
|
|
8587
8654
|
}
|
|
8588
|
-
function
|
|
8655
|
+
function i2(d) {
|
|
8589
8656
|
if (d.g.h.length == 0) return !1;
|
|
8590
|
-
var t = new
|
|
8591
|
-
return $ == 0 ? !1 : (
|
|
8657
|
+
var t = new A(), $ = H1(d.g, t);
|
|
8658
|
+
return $ == 0 ? !1 : (k(d.g), d.g.g(t.toString()), t = $1($), t == "001" ? d.l = j(d.ga, "" + $) : t != d.ka && (d.l = J1(d, t)), d.h.g("" + $).g(" "), d.o = "", !0);
|
|
8592
8659
|
}
|
|
8593
8660
|
function n2(d, t) {
|
|
8594
8661
|
var $ = d.v.toString();
|
|
8595
8662
|
if (0 <= $.substring(d.$).search(d.fa)) {
|
|
8596
|
-
var
|
|
8597
|
-
return t = $.replace(d.fa, t),
|
|
8663
|
+
var n = $.search(d.fa);
|
|
8664
|
+
return t = $.replace(d.fa, t), k(d.v), d.v.g(t), d.$ = n, t.substring(0, d.$ + 1);
|
|
8598
8665
|
}
|
|
8599
8666
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
8600
8667
|
}
|
|
8601
|
-
const
|
|
8668
|
+
const s2 = (d) => {
|
|
8602
8669
|
const t = [];
|
|
8603
8670
|
return d.includes("FIXED_LINE_OR_MOBILE") ? (d.includes("MOBILE") || t.push("MOBILE"), d.includes("FIXED_LINE") || t.push("FIXED_LINE")) : (d.includes("MOBILE") || d.includes("FIXED_LINE")) && t.push("FIXED_LINE_OR_MOBILE"), d.concat(t);
|
|
8604
|
-
},
|
|
8671
|
+
}, _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 };
|
|
8605
8672
|
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
8606
8673
|
try {
|
|
8607
|
-
const $ = d.replace(/[^+0-9]/g, ""),
|
|
8674
|
+
const $ = d.replace(/[^+0-9]/g, ""), n = new A2(t);
|
|
8608
8675
|
t = "";
|
|
8609
|
-
for (let o = 0; o < $.length; o++)
|
|
8676
|
+
for (let o = 0; o < $.length; o++) n.ja = M2(n, $.charAt(o)), t = n.ja;
|
|
8610
8677
|
return t;
|
|
8611
8678
|
} catch {
|
|
8612
8679
|
return d;
|
|
8613
8680
|
}
|
|
8614
8681
|
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, $) => {
|
|
8615
8682
|
try {
|
|
8616
|
-
const o = M.g(),
|
|
8617
|
-
var
|
|
8618
|
-
return
|
|
8683
|
+
const o = M.g(), a = Z(o, d, t);
|
|
8684
|
+
var n = h1(o, a, -1);
|
|
8685
|
+
return n == 0 || n == 4 ? o.format(a, typeof $ > "u" ? 0 : $) : d;
|
|
8619
8686
|
} catch {
|
|
8620
8687
|
return d;
|
|
8621
8688
|
}
|
|
8622
|
-
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $,
|
|
8689
|
+
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, $, n) => {
|
|
8623
8690
|
try {
|
|
8624
8691
|
const _ = M.g();
|
|
8625
8692
|
d: {
|
|
8626
8693
|
var o = _;
|
|
8627
|
-
if (
|
|
8628
|
-
var
|
|
8694
|
+
if (a1(d)) {
|
|
8695
|
+
var a = u1(j(o, d), $);
|
|
8629
8696
|
try {
|
|
8630
|
-
if (
|
|
8631
|
-
var
|
|
8697
|
+
if (B(a, 6)) {
|
|
8698
|
+
var u = g(a, 6), h = z1(o, u, d, !1);
|
|
8632
8699
|
break d;
|
|
8633
8700
|
}
|
|
8634
8701
|
} catch {
|
|
@@ -8636,7 +8703,7 @@ const Z2 = (y) => {
|
|
|
8636
8703
|
}
|
|
8637
8704
|
h = null;
|
|
8638
8705
|
}
|
|
8639
|
-
return _.format(h,
|
|
8706
|
+
return _.format(h, n ? 0 : t ? 2 : 1);
|
|
8640
8707
|
} catch {
|
|
8641
8708
|
return "";
|
|
8642
8709
|
}
|
|
@@ -8648,39 +8715,39 @@ const Z2 = (y) => {
|
|
|
8648
8715
|
}
|
|
8649
8716
|
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
8650
8717
|
try {
|
|
8651
|
-
const $ = M.g(),
|
|
8652
|
-
return F1($,
|
|
8718
|
+
const $ = M.g(), n = Z($, d, t);
|
|
8719
|
+
return F1($, n);
|
|
8653
8720
|
} catch {
|
|
8654
8721
|
return -99;
|
|
8655
8722
|
}
|
|
8656
8723
|
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
8657
8724
|
if (!t) return 1;
|
|
8658
8725
|
try {
|
|
8659
|
-
const $ = M.g(),
|
|
8660
|
-
return
|
|
8726
|
+
const $ = M.g(), n = Z($, d, t);
|
|
8727
|
+
return h1($, n, -1);
|
|
8661
8728
|
} catch ($) {
|
|
8662
8729
|
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;
|
|
8663
8730
|
}
|
|
8664
8731
|
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t, $) => {
|
|
8665
8732
|
try {
|
|
8666
|
-
const
|
|
8733
|
+
const n = M.g(), o = Z(n, d, t), a = T2(n, o);
|
|
8667
8734
|
if ($) {
|
|
8668
|
-
const
|
|
8669
|
-
return
|
|
8735
|
+
const u = s2($).map((h) => _1[h]);
|
|
8736
|
+
return a && u.includes(F1(n, o));
|
|
8670
8737
|
}
|
|
8671
|
-
return
|
|
8738
|
+
return a;
|
|
8672
8739
|
} catch {
|
|
8673
8740
|
return !1;
|
|
8674
8741
|
}
|
|
8675
8742
|
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, $) => {
|
|
8676
8743
|
try {
|
|
8677
|
-
const
|
|
8744
|
+
const n = M.g(), o = Z(n, d, t);
|
|
8678
8745
|
if ($) {
|
|
8679
|
-
const
|
|
8680
|
-
for (let
|
|
8746
|
+
const a = s2($);
|
|
8747
|
+
for (let u of a) if (h1(n, o, _1[u]) === 0) return !0;
|
|
8681
8748
|
return !1;
|
|
8682
8749
|
}
|
|
8683
|
-
return
|
|
8750
|
+
return h1(n, o, -1) === 0;
|
|
8684
8751
|
} catch {
|
|
8685
8752
|
return !1;
|
|
8686
8753
|
}
|
|
@@ -8690,10 +8757,10 @@ const Z2 = (y) => {
|
|
|
8690
8757
|
} catch {
|
|
8691
8758
|
return "";
|
|
8692
8759
|
}
|
|
8693
|
-
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType",
|
|
8760
|
+
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", _1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
|
|
8694
8761
|
})();
|
|
8695
|
-
const
|
|
8696
|
-
delete
|
|
8762
|
+
const h2 = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : void 0, Y2 = h2.intlTelInputUtilsTemp;
|
|
8763
|
+
delete h2.intlTelInputUtilsTemp;
|
|
8697
8764
|
m.utils = Y2;
|
|
8698
8765
|
const q2 = {
|
|
8699
8766
|
__name: "IntlTelInputWithUtils",
|
|
@@ -8727,42 +8794,42 @@ const q2 = {
|
|
|
8727
8794
|
"changeValidity",
|
|
8728
8795
|
"changeErrorCode"
|
|
8729
8796
|
], ["update:modelValue"]),
|
|
8730
|
-
setup(y, { expose: e, emit:
|
|
8731
|
-
const
|
|
8732
|
-
let
|
|
8733
|
-
|
|
8797
|
+
setup(y, { expose: e, emit: i }) {
|
|
8798
|
+
const s = D2(y, "modelValue"), r = y, l = i, c = v1(), C = v1(), f = v1(!1), S = () => C.value ? r.options.strictMode ? C.value.isValidNumberPrecise() : C.value.isValidNumber() : null, w = () => {
|
|
8799
|
+
let p = S();
|
|
8800
|
+
f.value !== p && (f.value = p, l("changeValidity", !!p), l(
|
|
8734
8801
|
"changeErrorCode",
|
|
8735
|
-
|
|
8802
|
+
p ? null : C.value.getValidationError()
|
|
8736
8803
|
));
|
|
8737
|
-
},
|
|
8738
|
-
var
|
|
8739
|
-
l("changeNumber", ((
|
|
8804
|
+
}, b = () => {
|
|
8805
|
+
var p;
|
|
8806
|
+
l("changeNumber", ((p = C.value) == null ? void 0 : p.getNumber()) ?? ""), w();
|
|
8740
8807
|
}, L = () => {
|
|
8741
|
-
var
|
|
8742
|
-
l("changeCountry", ((
|
|
8808
|
+
var p;
|
|
8809
|
+
l("changeCountry", ((p = C.value) == null ? void 0 : p.getSelectedCountryData().iso2) ?? ""), b(), w();
|
|
8743
8810
|
};
|
|
8744
|
-
return
|
|
8745
|
-
c.value && (C.value = m(c.value,
|
|
8811
|
+
return x2(() => {
|
|
8812
|
+
c.value && (C.value = m(c.value, r.options), r.value && C.value.setNumber(r.value), r.disabled && C.value.setDisabled(r.disabled), f.value = S());
|
|
8746
8813
|
}), P2(
|
|
8747
|
-
() =>
|
|
8748
|
-
(
|
|
8814
|
+
() => r.disabled,
|
|
8815
|
+
(p) => {
|
|
8749
8816
|
var I;
|
|
8750
|
-
return (I = C.value) == null ? void 0 : I.setDisabled(
|
|
8817
|
+
return (I = C.value) == null ? void 0 : I.setDisabled(p);
|
|
8751
8818
|
}
|
|
8752
|
-
),
|
|
8753
|
-
var
|
|
8754
|
-
return (
|
|
8755
|
-
}), e({ instance: C, input: c }), (
|
|
8819
|
+
), R2(() => {
|
|
8820
|
+
var p;
|
|
8821
|
+
return (p = C.value) == null ? void 0 : p.destroy();
|
|
8822
|
+
}), e({ instance: C, input: c }), (p, I) => B2((O2(), k2("input", G2({
|
|
8756
8823
|
ref_key: "input",
|
|
8757
8824
|
ref: c,
|
|
8758
|
-
"onUpdate:modelValue": I[0] || (I[0] = (G) =>
|
|
8825
|
+
"onUpdate:modelValue": I[0] || (I[0] = (G) => s.value = G),
|
|
8759
8826
|
type: "tel",
|
|
8760
8827
|
onCountrychange: L,
|
|
8761
|
-
onInput:
|
|
8828
|
+
onInput: b
|
|
8762
8829
|
}, y.inputProps), null, 16)), [
|
|
8763
8830
|
[
|
|
8764
|
-
|
|
8765
|
-
|
|
8831
|
+
U2,
|
|
8832
|
+
s.value,
|
|
8766
8833
|
void 0,
|
|
8767
8834
|
{ lazy: !0 }
|
|
8768
8835
|
]
|