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