intl-tel-input 25.10.12 → 25.11.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 +62 -59
- package/angular/README.md +1 -1
- package/angular/build/IntlTelInput.js +887 -688
- package/angular/build/IntlTelInputWithUtils.js +891 -692
- package/angular/build/types/intl-tel-input/data.d.ts +3 -3
- package/angular/build/types/intl-tel-input.d.ts +22 -70
- package/angular/build/types/modules/constants.d.ts +84 -0
- package/angular/build/types/modules/core/countrySearch.d.ts +17 -0
- package/angular/build/types/modules/core/icons.d.ts +7 -0
- package/angular/build/types/modules/core/options.d.ts +2 -1
- package/angular/build/types/modules/core/ui.d.ts +44 -0
- package/angular/build/types/modules/data/country-data.d.ts +5 -5
- package/angular/build/types/modules/format/caret.d.ts +1 -1
- package/angular/build/types/modules/format/formatting.d.ts +3 -3
- package/angular/build/types/modules/types/events.d.ts +9 -0
- package/angular/build/types/modules/types/public-api.d.ts +3 -0
- package/angular/build/types/modules/utils/dom.d.ts +5 -0
- package/build/js/data.js +8 -2
- package/build/js/data.min.js +2 -2
- package/build/js/intlTelInput.d.ts +214 -83
- package/build/js/intlTelInput.js +1034 -770
- package/build/js/intlTelInput.min.js +13 -13
- package/build/js/intlTelInputWithUtils.js +1038 -774
- package/build/js/intlTelInputWithUtils.min.js +13 -13
- package/build/js/utils.js +4 -4
- package/package.json +3 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +1033 -769
- package/react/build/IntlTelInput.d.ts +214 -83
- package/react/build/IntlTelInput.js +1033 -769
- package/react/build/IntlTelInputWithUtils.cjs +1037 -773
- package/react/build/IntlTelInputWithUtils.js +1037 -773
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +967 -739
- package/vue/build/IntlTelInputWithUtils.mjs +1279 -1051
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { mergeModels as
|
|
2
|
-
const
|
|
1
|
+
import { mergeModels as g0, useModel as j0, ref as A1, onMounted as Y0, watch as z0, onUnmounted as Z0, withDirectives as J0, createElementBlock as X0, openBlock as q0, mergeProps as Q0, vModelText as d2 } from "vue";
|
|
2
|
+
const t2 = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
5
5
|
// Afghanistan
|
|
@@ -1676,20 +1676,26 @@ const K0 = [
|
|
|
1676
1676
|
null,
|
|
1677
1677
|
"0"
|
|
1678
1678
|
]
|
|
1679
|
-
],
|
|
1680
|
-
for (const
|
|
1681
|
-
|
|
1679
|
+
], Q = [];
|
|
1680
|
+
for (const h of t2)
|
|
1681
|
+
Q.push({
|
|
1682
1682
|
name: "",
|
|
1683
1683
|
// populated in the plugin
|
|
1684
|
-
iso2:
|
|
1685
|
-
dialCode:
|
|
1686
|
-
priority:
|
|
1687
|
-
areaCodes:
|
|
1684
|
+
iso2: h[0],
|
|
1685
|
+
dialCode: h[1],
|
|
1686
|
+
priority: h[2] || 0,
|
|
1687
|
+
areaCodes: h[3] || null,
|
|
1688
1688
|
nodeById: {},
|
|
1689
1689
|
// populated by the plugin
|
|
1690
|
-
nationalPrefix:
|
|
1690
|
+
nationalPrefix: h[4] || null,
|
|
1691
|
+
normalisedName: "",
|
|
1692
|
+
// populated in the plugin
|
|
1693
|
+
initials: "",
|
|
1694
|
+
// populated in the plugin
|
|
1695
|
+
dialCodePlus: ""
|
|
1696
|
+
// populated in the plugin
|
|
1691
1697
|
});
|
|
1692
|
-
const
|
|
1698
|
+
const e2 = {
|
|
1693
1699
|
ad: "Andorra",
|
|
1694
1700
|
ae: "United Arab Emirates",
|
|
1695
1701
|
af: "Afghanistan",
|
|
@@ -1932,7 +1938,7 @@ const V0 = {
|
|
|
1932
1938
|
za: "South Africa",
|
|
1933
1939
|
zm: "Zambia",
|
|
1934
1940
|
zw: "Zimbabwe"
|
|
1935
|
-
},
|
|
1941
|
+
}, $2 = {
|
|
1936
1942
|
selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
|
|
1937
1943
|
noCountrySelected: "Select country",
|
|
1938
1944
|
countryListAriaLabel: "List of countries",
|
|
@@ -1944,19 +1950,95 @@ const V0 = {
|
|
|
1944
1950
|
// additional countries (not supported by country-list library)
|
|
1945
1951
|
ac: "Ascension Island",
|
|
1946
1952
|
xk: "Kosovo"
|
|
1947
|
-
},
|
|
1953
|
+
}, E0 = { ...e2, ...$2 }, g1 = {
|
|
1954
|
+
OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
|
|
1955
|
+
CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
|
|
1956
|
+
COUNTRY_CHANGE: "countrychange",
|
|
1957
|
+
INPUT: "input"
|
|
1958
|
+
// used for synthetic input trigger
|
|
1959
|
+
}, E = {
|
|
1960
|
+
HIDE: "iti__hide",
|
|
1961
|
+
V_HIDE: "iti__v-hide",
|
|
1962
|
+
ARROW_UP: "iti__arrow--up",
|
|
1963
|
+
GLOBE: "iti__globe",
|
|
1964
|
+
FLAG: "iti__flag",
|
|
1965
|
+
COUNTRY_ITEM: "iti__country",
|
|
1966
|
+
HIGHLIGHT: "iti__highlight"
|
|
1967
|
+
}, x = {
|
|
1968
|
+
ARROW_UP: "ArrowUp",
|
|
1969
|
+
ARROW_DOWN: "ArrowDown",
|
|
1970
|
+
SPACE: " ",
|
|
1971
|
+
ENTER: "Enter",
|
|
1972
|
+
ESC: "Escape",
|
|
1973
|
+
TAB: "Tab"
|
|
1974
|
+
}, m0 = {
|
|
1975
|
+
PASTE: "insertFromPaste",
|
|
1976
|
+
DELETE_FWD: "deleteContentForward"
|
|
1977
|
+
}, q = {
|
|
1978
|
+
ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
|
|
1979
|
+
// any kind of letter from any language
|
|
1980
|
+
NON_PLUS_NUMERIC: /[^+0-9]/,
|
|
1981
|
+
// chars that are NOT + or digit
|
|
1982
|
+
NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
|
|
1983
|
+
// chars that are NOT + or digit (global)
|
|
1984
|
+
HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
|
|
1985
|
+
// single acceptable hidden-search char
|
|
1986
|
+
}, n2 = {
|
|
1987
|
+
HIDDEN_SEARCH_RESET_MS: 1e3
|
|
1988
|
+
}, y0 = {
|
|
1989
|
+
UNKNOWN_NUMBER_TYPE: -99,
|
|
1990
|
+
UNKNOWN_VALIDATION_ERROR: -99
|
|
1991
|
+
}, w1 = {
|
|
1992
|
+
SANE_SELECTED_WITH_DIAL_WIDTH: 78,
|
|
1993
|
+
// px width fallback when separateDialCode enabled
|
|
1994
|
+
SANE_SELECTED_NO_DIAL_WIDTH: 42,
|
|
1995
|
+
// px width fallback when no separate dial code
|
|
1996
|
+
INPUT_PADDING_EXTRA_LEFT: 6
|
|
1997
|
+
// px gap between selected country container and input text
|
|
1998
|
+
}, N0 = {
|
|
1999
|
+
NANP: "1"
|
|
2000
|
+
// North American Numbering Plan
|
|
2001
|
+
}, b1 = {
|
|
2002
|
+
DIAL_CODE: "44",
|
|
2003
|
+
// +44 United Kingdom
|
|
2004
|
+
MOBILE_PREFIX: "7",
|
|
2005
|
+
// UK mobile numbers start with 7 after national trunk (0) or core section
|
|
2006
|
+
MOBILE_CORE_LENGTH: 10
|
|
2007
|
+
// core number length (excluding dial code / national prefix) for mobiles
|
|
2008
|
+
}, i2 = {
|
|
2009
|
+
ISO2: "us"
|
|
2010
|
+
}, s2 = {
|
|
2011
|
+
POLITE: "polite"
|
|
2012
|
+
}, T1 = {
|
|
2013
|
+
AUTO: "auto"
|
|
2014
|
+
}, I0 = {
|
|
2015
|
+
COUNTRY_CODE: "countryCode",
|
|
2016
|
+
DIAL_CODE: "dialCode"
|
|
2017
|
+
}, L = {
|
|
2018
|
+
EXPANDED: "aria-expanded",
|
|
2019
|
+
LABEL: "aria-label",
|
|
2020
|
+
SELECTED: "aria-selected",
|
|
2021
|
+
ACTIVE_DESCENDANT: "aria-activedescendant",
|
|
2022
|
+
HASPOPUP: "aria-haspopup",
|
|
2023
|
+
CONTROLS: "aria-controls",
|
|
2024
|
+
HIDDEN: "aria-hidden",
|
|
2025
|
+
AUTOCOMPLETE: "aria-autocomplete",
|
|
2026
|
+
MODAL: "aria-modal"
|
|
2027
|
+
}, D1 = (h) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(h).matches, r2 = () => {
|
|
1948
2028
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1949
|
-
const
|
|
1950
|
-
|
|
2029
|
+
const h = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
2030
|
+
navigator.userAgent
|
|
2031
|
+
), e = D1("(max-width: 500px)"), $ = D1("(max-height: 600px)"), i = D1("(pointer: coarse)");
|
|
2032
|
+
return h || e || i && $;
|
|
1951
2033
|
}
|
|
1952
2034
|
return !1;
|
|
1953
|
-
},
|
|
2035
|
+
}, S0 = {
|
|
1954
2036
|
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
1955
2037
|
allowPhonewords: !1,
|
|
1956
2038
|
//* Whether or not to allow the dropdown.
|
|
1957
2039
|
allowDropdown: !0,
|
|
1958
2040
|
//* Add a placeholder in the input with an example number for the selected country.
|
|
1959
|
-
autoPlaceholder:
|
|
2041
|
+
autoPlaceholder: s2.POLITE,
|
|
1960
2042
|
//* Modify the parentClass.
|
|
1961
2043
|
containerClass: "",
|
|
1962
2044
|
//* The order of the countries in the dropdown. Defaults to alphabetical.
|
|
@@ -1998,246 +2080,112 @@ const V0 = {
|
|
|
1998
2080
|
//* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
|
|
1999
2081
|
strictMode: !1,
|
|
2000
2082
|
//* Use full screen popup instead of dropdown for country list.
|
|
2001
|
-
useFullscreenPopup:
|
|
2083
|
+
useFullscreenPopup: r2(),
|
|
2002
2084
|
//* The number type to enforce during validation.
|
|
2003
2085
|
validationNumberTypes: ["MOBILE"]
|
|
2086
|
+
}, o2 = (h, e) => {
|
|
2087
|
+
h.useFullscreenPopup && (h.fixDropdownWidth = !1), h.onlyCountries.length === 1 && (h.initialCountry = h.onlyCountries[0]), h.separateDialCode && (h.nationalMode = !1), h.allowDropdown && !h.showFlags && !h.separateDialCode && (h.nationalMode = !1), h.useFullscreenPopup && !h.dropdownContainer && (h.dropdownContainer = document.body), h.i18n = { ...e, ...h.i18n };
|
|
2088
|
+
}, m1 = (h) => h.replace(/\D/g, ""), L0 = (h = "") => h.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), u2 = (h, e) => {
|
|
2089
|
+
const $ = L0(e), i = [], s = [], a = [], u = [], f = [], C = [];
|
|
2090
|
+
for (const _ of h)
|
|
2091
|
+
_.iso2 === $ ? i.push(_) : _.normalisedName.startsWith($) ? s.push(_) : _.normalisedName.includes($) ? a.push(_) : $ === _.dialCode || $ === _.dialCodePlus ? u.push(_) : _.dialCodePlus.includes($) ? f.push(_) : _.initials.includes($) && C.push(_);
|
|
2092
|
+
const I = (_, A) => _.priority - A.priority;
|
|
2093
|
+
return [
|
|
2094
|
+
...i.sort(I),
|
|
2095
|
+
...s.sort(I),
|
|
2096
|
+
...a.sort(I),
|
|
2097
|
+
...u.sort(I),
|
|
2098
|
+
...f.sort(I),
|
|
2099
|
+
...C.sort(I)
|
|
2100
|
+
];
|
|
2101
|
+
}, l2 = (h, e) => {
|
|
2102
|
+
const $ = e.toLowerCase();
|
|
2103
|
+
for (const i of h)
|
|
2104
|
+
if (i.name.toLowerCase().startsWith($))
|
|
2105
|
+
return i;
|
|
2106
|
+
return null;
|
|
2107
|
+
}, v1 = (h) => Object.keys(h).filter((e) => !!h[e]).join(" "), w = (h, e, $) => {
|
|
2108
|
+
const i = document.createElement(h);
|
|
2109
|
+
return e && Object.entries(e).forEach(
|
|
2110
|
+
([s, a]) => i.setAttribute(s, a)
|
|
2111
|
+
), $ && $.appendChild(i), i;
|
|
2112
|
+
}, a2 = () => `
|
|
2113
|
+
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${L.HIDDEN}="true">
|
|
2114
|
+
<circle cx="11" cy="11" r="7" />
|
|
2115
|
+
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2116
|
+
</svg>`, c2 = (h) => {
|
|
2117
|
+
const e = `iti-${h}-clear-mask`;
|
|
2118
|
+
return `
|
|
2119
|
+
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${L.HIDDEN}="true" focusable="false">
|
|
2120
|
+
<mask id="${e}" maskUnits="userSpaceOnUse">
|
|
2121
|
+
<rect width="16" height="16" fill="white" />
|
|
2122
|
+
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
|
|
2123
|
+
</mask>
|
|
2124
|
+
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${e})" />
|
|
2125
|
+
</svg>`;
|
|
2004
2126
|
};
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
const c1 = (f) => f.replace(/\D/g, ""), a0 = (f = "") => f.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), L = (f, e, $) => {
|
|
2009
|
-
const i = document.createElement(f);
|
|
2010
|
-
return e && Object.entries(e).forEach(([r, u]) => i.setAttribute(r, u)), $ && $.appendChild(i), i;
|
|
2011
|
-
};
|
|
2012
|
-
function z0(f) {
|
|
2013
|
-
const { onlyCountries: e, excludeCountries: $ } = f;
|
|
2014
|
-
if (e.length) {
|
|
2015
|
-
const i = e.map((r) => r.toLowerCase());
|
|
2016
|
-
return Y.filter((r) => i.includes(r.iso2));
|
|
2017
|
-
} else if ($.length) {
|
|
2018
|
-
const i = $.map((r) => r.toLowerCase());
|
|
2019
|
-
return Y.filter((r) => !i.includes(r.iso2));
|
|
2020
|
-
}
|
|
2021
|
-
return Y;
|
|
2022
|
-
}
|
|
2023
|
-
function Z0(f, e) {
|
|
2024
|
-
for (const $ of f) {
|
|
2025
|
-
const i = $.iso2.toLowerCase();
|
|
2026
|
-
e.i18n[i] && ($.name = e.i18n[i]);
|
|
2027
|
-
}
|
|
2028
|
-
}
|
|
2029
|
-
function Y0(f, e) {
|
|
2030
|
-
const $ = /* @__PURE__ */ new Set();
|
|
2031
|
-
let i = 0;
|
|
2032
|
-
const r = {}, u = (h, c, C) => {
|
|
2033
|
-
if (!h || !c)
|
|
2034
|
-
return;
|
|
2035
|
-
c.length > i && (i = c.length), r.hasOwnProperty(c) || (r[c] = []);
|
|
2036
|
-
const g = r[c];
|
|
2037
|
-
if (g.includes(h))
|
|
2038
|
-
return;
|
|
2039
|
-
const I = C !== void 0 ? C : g.length;
|
|
2040
|
-
g[I] = h;
|
|
2041
|
-
};
|
|
2042
|
-
for (const h of f) {
|
|
2043
|
-
$.has(h.dialCode) || $.add(h.dialCode);
|
|
2044
|
-
for (let c = 1; c < h.dialCode.length; c++) {
|
|
2045
|
-
const C = h.dialCode.substring(0, c);
|
|
2046
|
-
u(h.iso2, C);
|
|
2047
|
-
}
|
|
2048
|
-
u(h.iso2, h.dialCode, h.priority);
|
|
2049
|
-
}
|
|
2050
|
-
(e.onlyCountries.length || e.excludeCountries.length) && $.forEach((h) => {
|
|
2051
|
-
r[h] = r[h].filter(Boolean);
|
|
2052
|
-
});
|
|
2053
|
-
for (const h of f)
|
|
2054
|
-
if (h.areaCodes) {
|
|
2055
|
-
const c = r[h.dialCode][0];
|
|
2056
|
-
for (const C of h.areaCodes) {
|
|
2057
|
-
for (let g = 1; g < C.length; g++) {
|
|
2058
|
-
const I = C.substring(0, g), w = h.dialCode + I;
|
|
2059
|
-
u(c, w), u(h.iso2, w);
|
|
2060
|
-
}
|
|
2061
|
-
u(h.iso2, h.dialCode + C);
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: r };
|
|
2065
|
-
}
|
|
2066
|
-
function J0(f, e) {
|
|
2067
|
-
e.countryOrder && (e.countryOrder = e.countryOrder.map(($) => $.toLowerCase())), f.sort(($, i) => {
|
|
2068
|
-
const { countryOrder: r } = e;
|
|
2069
|
-
if (r) {
|
|
2070
|
-
const u = r.indexOf($.iso2), h = r.indexOf(i.iso2), c = u > -1, C = h > -1;
|
|
2071
|
-
if (c || C)
|
|
2072
|
-
return c && C ? u - h : c ? -1 : 1;
|
|
2073
|
-
}
|
|
2074
|
-
return $.name.localeCompare(i.name);
|
|
2075
|
-
});
|
|
2076
|
-
}
|
|
2077
|
-
function q0(f) {
|
|
2078
|
-
for (const e of f)
|
|
2079
|
-
e.normalisedName = a0(e.name), e.initials = e.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map(($) => $[0]).join("").toLowerCase(), e.dialCodePlus = `+${e.dialCode}`;
|
|
2080
|
-
}
|
|
2081
|
-
function X0(f, e, $, i) {
|
|
2082
|
-
let r = f;
|
|
2083
|
-
if ($ && e) {
|
|
2084
|
-
e = `+${i.dialCode}`;
|
|
2085
|
-
const u = r[e.length] === " " || r[e.length] === "-" ? e.length + 1 : e.length;
|
|
2086
|
-
r = r.substring(u);
|
|
2087
|
-
}
|
|
2088
|
-
return r;
|
|
2089
|
-
}
|
|
2090
|
-
function Q0(f, e, $, i, r) {
|
|
2091
|
-
const u = $ ? $.formatNumberAsYouType(f, i.iso2) : f, { dialCode: h } = i;
|
|
2092
|
-
return r && e.charAt(0) !== "+" && u.includes(`+${h}`) ? (u.split(`+${h}`)[1] || "").trim() : u;
|
|
2093
|
-
}
|
|
2094
|
-
function d2(f, e, $, i) {
|
|
2095
|
-
if ($ === 0 && !i)
|
|
2096
|
-
return 0;
|
|
2097
|
-
let r = 0;
|
|
2098
|
-
for (let u = 0; u < e.length; u++) {
|
|
2099
|
-
if (/[+0-9]/.test(e[u]) && r++, r === f && !i)
|
|
2100
|
-
return u + 1;
|
|
2101
|
-
if (i && r === f + 1)
|
|
2102
|
-
return u;
|
|
2103
|
-
}
|
|
2104
|
-
return e.length;
|
|
2105
|
-
}
|
|
2106
|
-
const t2 = [
|
|
2107
|
-
"800",
|
|
2108
|
-
"822",
|
|
2109
|
-
"833",
|
|
2110
|
-
"844",
|
|
2111
|
-
"855",
|
|
2112
|
-
"866",
|
|
2113
|
-
"877",
|
|
2114
|
-
"880",
|
|
2115
|
-
"881",
|
|
2116
|
-
"882",
|
|
2117
|
-
"883",
|
|
2118
|
-
"884",
|
|
2119
|
-
"885",
|
|
2120
|
-
"886",
|
|
2121
|
-
"887",
|
|
2122
|
-
"888",
|
|
2123
|
-
"889"
|
|
2124
|
-
], o0 = (f) => {
|
|
2125
|
-
const e = c1(f);
|
|
2126
|
-
if (e.charAt(0) === "1") {
|
|
2127
|
-
const $ = e.substring(1, 4);
|
|
2128
|
-
return t2.includes($);
|
|
2129
|
-
}
|
|
2130
|
-
return !1;
|
|
2131
|
-
};
|
|
2132
|
-
for (const f of Y)
|
|
2133
|
-
f.name = l0[f.iso2];
|
|
2134
|
-
let e2 = 0;
|
|
2135
|
-
const $2 = new Set(Y.map((f) => f.iso2)), w1 = (f) => $2.has(f), $1 = (f, ...e) => {
|
|
2136
|
-
const { instances: $ } = y;
|
|
2137
|
-
Object.values($).forEach((i) => i[f](...e));
|
|
2138
|
-
};
|
|
2139
|
-
class f1 {
|
|
2140
|
-
/**
|
|
2141
|
-
* Build a space-delimited class string from an object map of className -> truthy/falsey.
|
|
2142
|
-
* Only keys with truthy values are included.
|
|
2143
|
-
*/
|
|
2144
|
-
static _buildClassNames(e) {
|
|
2145
|
-
return Object.keys(e).filter(($) => !!e[$]).join(" ");
|
|
2146
|
-
}
|
|
2147
|
-
constructor(e, $ = {}) {
|
|
2148
|
-
this.id = e2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u0, $), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
|
|
2149
|
-
}
|
|
2150
|
-
_detectEnvironmentAndLayout() {
|
|
2151
|
-
this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
|
|
2152
|
-
}
|
|
2153
|
-
_createInitPromises() {
|
|
2154
|
-
const e = new Promise((i, r) => {
|
|
2155
|
-
this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = r;
|
|
2156
|
-
}), $ = new Promise((i, r) => {
|
|
2157
|
-
this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = r;
|
|
2158
|
-
});
|
|
2159
|
-
this.promise = Promise.all([e, $]);
|
|
2160
|
-
}
|
|
2161
|
-
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
2162
|
-
_init() {
|
|
2163
|
-
W0(this.options), this._detectEnvironmentAndLayout(), this._createInitPromises(), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
2164
|
-
}
|
|
2165
|
-
//********************
|
|
2166
|
-
//* PRIVATE METHODS
|
|
2167
|
-
//********************
|
|
2168
|
-
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
2169
|
-
_processCountryData() {
|
|
2170
|
-
this.countries = z0(this.options);
|
|
2171
|
-
const e = Y0(this.countries, this.options);
|
|
2172
|
-
this.dialCodes = e.dialCodes, this.dialCodeMaxLen = e.dialCodeMaxLen, this.dialCodeToIso2Map = e.dialCodeToIso2Map, Z0(this.countries, this.options), J0(this.countries, this.options), this.countryByIso2 = new Map(this.countries.map(($) => [$.iso2, $])), q0(this.countries);
|
|
2127
|
+
class h2 {
|
|
2128
|
+
constructor(e, $, i) {
|
|
2129
|
+
this.highlightedItem = null, e.dataset.intlTelInputId = i.toString(), this.telInput = e, this.options = $, this.id = i, this.hadInitialPlaceholder = !!e.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
|
|
2173
2130
|
}
|
|
2174
2131
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
2175
|
-
|
|
2176
|
-
this._prepareTelInput();
|
|
2177
|
-
const
|
|
2178
|
-
this._maybeBuildCountryContainer(
|
|
2132
|
+
generateMarkup(e) {
|
|
2133
|
+
this.countries = e, this._prepareTelInput();
|
|
2134
|
+
const $ = this._createWrapperAndInsert();
|
|
2135
|
+
this._maybeBuildCountryContainer($), $.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs($);
|
|
2179
2136
|
}
|
|
2180
2137
|
_prepareTelInput() {
|
|
2181
|
-
|
|
2138
|
+
var e;
|
|
2139
|
+
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((e = this.telInput.form) != null && e.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
2182
2140
|
}
|
|
2183
2141
|
_createWrapperAndInsert() {
|
|
2184
|
-
|
|
2185
|
-
const {
|
|
2186
|
-
allowDropdown: e,
|
|
2187
|
-
showFlags: $,
|
|
2188
|
-
containerClass: i,
|
|
2189
|
-
useFullscreenPopup: r
|
|
2190
|
-
} = this.options, u = f1._buildClassNames({
|
|
2142
|
+
const { allowDropdown: e, showFlags: $, containerClass: i, useFullscreenPopup: s } = this.options, a = v1({
|
|
2191
2143
|
iti: !0,
|
|
2192
2144
|
"iti--allow-dropdown": e,
|
|
2193
2145
|
"iti--show-flags": $,
|
|
2194
|
-
"iti--inline-dropdown": !
|
|
2146
|
+
"iti--inline-dropdown": !s,
|
|
2195
2147
|
[i]: !!i
|
|
2196
|
-
}),
|
|
2197
|
-
return this.isRTL &&
|
|
2148
|
+
}), u = w("div", { class: a });
|
|
2149
|
+
return this.isRTL && u.setAttribute("dir", "ltr"), this.telInput.before(u), u;
|
|
2198
2150
|
}
|
|
2199
2151
|
_maybeBuildCountryContainer(e) {
|
|
2200
|
-
const {
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
showFlags: r
|
|
2204
|
-
} = this.options;
|
|
2205
|
-
if ($ || r || i) {
|
|
2206
|
-
this.countryContainer = L(
|
|
2152
|
+
const { allowDropdown: $, separateDialCode: i, showFlags: s } = this.options;
|
|
2153
|
+
if ($ || s || i) {
|
|
2154
|
+
this.countryContainer = w(
|
|
2207
2155
|
"div",
|
|
2208
2156
|
// visibly hidden until we measure it's width to set the input padding correctly
|
|
2209
|
-
{ class:
|
|
2157
|
+
{ class: `iti__country-container ${E.V_HIDE}` },
|
|
2210
2158
|
e
|
|
2211
|
-
), $ ? (this.selectedCountry =
|
|
2159
|
+
), $ ? (this.selectedCountry = w(
|
|
2212
2160
|
"button",
|
|
2213
2161
|
{
|
|
2214
2162
|
type: "button",
|
|
2215
2163
|
class: "iti__selected-country",
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2164
|
+
[L.EXPANDED]: "false",
|
|
2165
|
+
[L.LABEL]: this.options.i18n.noCountrySelected,
|
|
2166
|
+
[L.HASPOPUP]: "dialog",
|
|
2167
|
+
[L.CONTROLS]: `iti-${this.id}__dropdown-content`
|
|
2220
2168
|
},
|
|
2221
2169
|
this.countryContainer
|
|
2222
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
2170
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = w(
|
|
2223
2171
|
"div",
|
|
2224
2172
|
{ class: "iti__selected-country" },
|
|
2225
2173
|
this.countryContainer
|
|
2226
2174
|
);
|
|
2227
|
-
const
|
|
2175
|
+
const a = w(
|
|
2228
2176
|
"div",
|
|
2229
2177
|
{ class: "iti__selected-country-primary" },
|
|
2230
2178
|
this.selectedCountry
|
|
2231
2179
|
);
|
|
2232
|
-
this.selectedCountryInner =
|
|
2180
|
+
this.selectedCountryInner = w(
|
|
2233
2181
|
"div",
|
|
2234
|
-
{ class:
|
|
2235
|
-
|
|
2236
|
-
), $ && (this.dropdownArrow =
|
|
2182
|
+
{ class: E.FLAG },
|
|
2183
|
+
a
|
|
2184
|
+
), $ && (this.dropdownArrow = w(
|
|
2237
2185
|
"div",
|
|
2238
|
-
{ class: "iti__arrow",
|
|
2239
|
-
|
|
2240
|
-
)), i && (this.selectedDialCode =
|
|
2186
|
+
{ class: "iti__arrow", [L.HIDDEN]: "true" },
|
|
2187
|
+
a
|
|
2188
|
+
)), i && (this.selectedDialCode = w(
|
|
2241
2189
|
"div",
|
|
2242
2190
|
{ class: "iti__selected-dial-code" },
|
|
2243
2191
|
this.selectedCountry
|
|
@@ -2249,54 +2197,50 @@ class f1 {
|
|
|
2249
2197
|
fixDropdownWidth: e,
|
|
2250
2198
|
useFullscreenPopup: $,
|
|
2251
2199
|
countrySearch: i,
|
|
2252
|
-
i18n:
|
|
2253
|
-
dropdownContainer:
|
|
2254
|
-
containerClass:
|
|
2255
|
-
} = this.options,
|
|
2256
|
-
if (this.dropdownContent =
|
|
2200
|
+
i18n: s,
|
|
2201
|
+
dropdownContainer: a,
|
|
2202
|
+
containerClass: u
|
|
2203
|
+
} = this.options, f = e ? "" : "iti--flexible-dropdown-width";
|
|
2204
|
+
if (this.dropdownContent = w("div", {
|
|
2257
2205
|
id: `iti-${this.id}__dropdown-content`,
|
|
2258
|
-
class: `iti__dropdown-content
|
|
2206
|
+
class: `iti__dropdown-content ${E.HIDE} ${f}`,
|
|
2259
2207
|
role: "dialog",
|
|
2260
|
-
|
|
2261
|
-
}), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList =
|
|
2208
|
+
[L.MODAL]: "true"
|
|
2209
|
+
}), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = w(
|
|
2262
2210
|
"ul",
|
|
2263
2211
|
{
|
|
2264
2212
|
class: "iti__country-list",
|
|
2265
2213
|
id: `iti-${this.id}__country-listbox`,
|
|
2266
2214
|
role: "listbox",
|
|
2267
|
-
|
|
2215
|
+
[L.LABEL]: s.countryListAriaLabel
|
|
2268
2216
|
},
|
|
2269
2217
|
this.dropdownContent
|
|
2270
|
-
), this._appendListItems(), i && this.
|
|
2271
|
-
const C =
|
|
2218
|
+
), this._appendListItems(), i && this.updateSearchResultsA11yText(), a) {
|
|
2219
|
+
const C = v1({
|
|
2272
2220
|
iti: !0,
|
|
2273
2221
|
"iti--container": !0,
|
|
2274
2222
|
"iti--fullscreen-popup": $,
|
|
2275
2223
|
"iti--inline-dropdown": !$,
|
|
2276
|
-
[
|
|
2224
|
+
[u]: !!u
|
|
2277
2225
|
});
|
|
2278
|
-
this.dropdown =
|
|
2226
|
+
this.dropdown = w("div", { class: C }), this.dropdown.appendChild(this.dropdownContent);
|
|
2279
2227
|
} else
|
|
2280
2228
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
2281
2229
|
}
|
|
2282
2230
|
_buildSearchUI() {
|
|
2283
|
-
const { i18n: e } = this.options, $ =
|
|
2231
|
+
const { i18n: e } = this.options, $ = w(
|
|
2284
2232
|
"div",
|
|
2285
2233
|
{ class: "iti__search-input-wrapper" },
|
|
2286
2234
|
this.dropdownContent
|
|
2287
2235
|
);
|
|
2288
|
-
this.searchIcon =
|
|
2236
|
+
this.searchIcon = w(
|
|
2289
2237
|
"span",
|
|
2290
2238
|
{
|
|
2291
2239
|
class: "iti__search-icon",
|
|
2292
|
-
|
|
2240
|
+
[L.HIDDEN]: "true"
|
|
2293
2241
|
},
|
|
2294
2242
|
$
|
|
2295
|
-
), this.searchIcon.innerHTML =
|
|
2296
|
-
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
2297
|
-
<circle cx="11" cy="11" r="7" />
|
|
2298
|
-
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2299
|
-
</svg>`, this.searchInput = L(
|
|
2243
|
+
), this.searchIcon.innerHTML = a2(), this.searchInput = w(
|
|
2300
2244
|
"input",
|
|
2301
2245
|
{
|
|
2302
2246
|
id: `iti-${this.id}__search-input`,
|
|
@@ -2306,356 +2250,687 @@ class f1 {
|
|
|
2306
2250
|
placeholder: e.searchPlaceholder,
|
|
2307
2251
|
// role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
|
|
2308
2252
|
role: "combobox",
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2253
|
+
[L.EXPANDED]: "true",
|
|
2254
|
+
[L.LABEL]: e.searchPlaceholder,
|
|
2255
|
+
[L.CONTROLS]: `iti-${this.id}__country-listbox`,
|
|
2256
|
+
[L.AUTOCOMPLETE]: "list",
|
|
2313
2257
|
autocomplete: "off"
|
|
2314
2258
|
},
|
|
2315
2259
|
$
|
|
2316
|
-
), this.searchClearButton =
|
|
2260
|
+
), this.searchClearButton = w(
|
|
2317
2261
|
"button",
|
|
2318
2262
|
{
|
|
2319
2263
|
type: "button",
|
|
2320
|
-
class:
|
|
2321
|
-
|
|
2264
|
+
class: `iti__search-clear ${E.HIDE}`,
|
|
2265
|
+
[L.LABEL]: e.clearSearchAriaLabel,
|
|
2322
2266
|
tabindex: "-1"
|
|
2323
2267
|
},
|
|
2324
2268
|
$
|
|
2325
|
-
)
|
|
2326
|
-
const i = `iti-${this.id}-clear-mask`;
|
|
2327
|
-
this.searchClearButton.innerHTML = `
|
|
2328
|
-
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
|
|
2329
|
-
<mask id="${i}" maskUnits="userSpaceOnUse">
|
|
2330
|
-
<rect width="16" height="16" fill="white" />
|
|
2331
|
-
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
|
|
2332
|
-
</mask>
|
|
2333
|
-
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${i})" />
|
|
2334
|
-
</svg>`, this.searchResultsA11yText = L(
|
|
2269
|
+
), this.searchClearButton.innerHTML = c2(this.id), this.searchResultsA11yText = w(
|
|
2335
2270
|
"span",
|
|
2336
2271
|
{ class: "iti__a11y-text" },
|
|
2337
2272
|
this.dropdownContent
|
|
2338
|
-
), this.searchNoResults =
|
|
2273
|
+
), this.searchNoResults = w(
|
|
2339
2274
|
"div",
|
|
2340
2275
|
{
|
|
2341
|
-
class:
|
|
2342
|
-
|
|
2276
|
+
class: `iti__no-results ${E.HIDE}`,
|
|
2277
|
+
[L.HIDDEN]: "true"
|
|
2343
2278
|
// all a11y messaging happens in this.searchResultsA11yText
|
|
2344
2279
|
},
|
|
2345
2280
|
this.dropdownContent
|
|
2346
2281
|
), this.searchNoResults.textContent = e.zeroSearchResults;
|
|
2347
2282
|
}
|
|
2348
2283
|
_maybeUpdateInputPaddingAndReveal() {
|
|
2349
|
-
this.countryContainer && (this.
|
|
2284
|
+
this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove(E.V_HIDE));
|
|
2350
2285
|
}
|
|
2351
2286
|
_maybeBuildHiddenInputs(e) {
|
|
2352
|
-
var i,
|
|
2287
|
+
var i, s;
|
|
2353
2288
|
const { hiddenInput: $ } = this.options;
|
|
2354
2289
|
if ($) {
|
|
2355
|
-
const
|
|
2356
|
-
if (
|
|
2357
|
-
const
|
|
2358
|
-
|
|
2290
|
+
const a = this.telInput.getAttribute("name") || "", u = $(a);
|
|
2291
|
+
if (u.phone) {
|
|
2292
|
+
const f = (i = this.telInput.form) == null ? void 0 : i.querySelector(
|
|
2293
|
+
`input[name="${u.phone}"]`
|
|
2294
|
+
);
|
|
2295
|
+
f ? this.hiddenInput = f : (this.hiddenInput = w("input", {
|
|
2359
2296
|
type: "hidden",
|
|
2360
|
-
name:
|
|
2297
|
+
name: u.phone
|
|
2361
2298
|
}), e.appendChild(this.hiddenInput));
|
|
2362
2299
|
}
|
|
2363
|
-
if (
|
|
2364
|
-
const
|
|
2365
|
-
|
|
2300
|
+
if (u.country) {
|
|
2301
|
+
const f = (s = this.telInput.form) == null ? void 0 : s.querySelector(
|
|
2302
|
+
`input[name="${u.country}"]`
|
|
2303
|
+
);
|
|
2304
|
+
f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = w("input", {
|
|
2366
2305
|
type: "hidden",
|
|
2367
|
-
name:
|
|
2306
|
+
name: u.country
|
|
2368
2307
|
}), e.appendChild(this.hiddenInputCountry));
|
|
2369
2308
|
}
|
|
2370
2309
|
}
|
|
2371
2310
|
}
|
|
2372
2311
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
2373
2312
|
_appendListItems() {
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2313
|
+
const e = document.createDocumentFragment();
|
|
2314
|
+
for (let $ = 0; $ < this.countries.length; $++) {
|
|
2315
|
+
const i = this.countries[$], s = v1({
|
|
2316
|
+
[E.COUNTRY_ITEM]: !0,
|
|
2317
|
+
[E.HIGHLIGHT]: $ === 0
|
|
2318
|
+
}), a = w("li", {
|
|
2319
|
+
id: `iti-${this.id}__item-${i.iso2}`,
|
|
2320
|
+
class: s,
|
|
2321
|
+
tabindex: "-1",
|
|
2322
|
+
role: "option",
|
|
2323
|
+
[L.SELECTED]: "false"
|
|
2324
|
+
});
|
|
2325
|
+
a.dataset.dialCode = i.dialCode, a.dataset.countryCode = i.iso2, i.nodeById[this.id] = a, this.options.showFlags && w("div", { class: `${E.FLAG} iti__${i.iso2}` }, a);
|
|
2326
|
+
const u = w("span", { class: "iti__country-name" }, a);
|
|
2327
|
+
u.textContent = i.name;
|
|
2328
|
+
const f = w("span", { class: "iti__dial-code" }, a);
|
|
2329
|
+
this.isRTL && f.setAttribute("dir", "ltr"), f.textContent = `+${i.dialCode}`, e.appendChild(a);
|
|
2330
|
+
}
|
|
2331
|
+
this.countryList.appendChild(e);
|
|
2332
|
+
}
|
|
2333
|
+
//* Update the input padding to make space for the selected country/dial code.
|
|
2334
|
+
updateInputPadding() {
|
|
2335
|
+
if (this.selectedCountry) {
|
|
2336
|
+
const e = this.options.separateDialCode ? w1.SANE_SELECTED_WITH_DIAL_WIDTH : w1.SANE_SELECTED_NO_DIAL_WIDTH, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + w1.INPUT_PADDING_EXTRA_LEFT;
|
|
2337
|
+
this.telInput.style.paddingLeft = `${i}px`;
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2341
|
+
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2342
|
+
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2343
|
+
//* and then to inject a deep clone of the selectedCountry element.
|
|
2344
|
+
_getHiddenSelectedCountryWidth() {
|
|
2345
|
+
if (this.telInput.parentNode) {
|
|
2346
|
+
let e;
|
|
2347
|
+
try {
|
|
2348
|
+
e = window.top.document.body;
|
|
2349
|
+
} catch {
|
|
2350
|
+
e = document.body;
|
|
2351
|
+
}
|
|
2352
|
+
const $ = this.telInput.parentNode.cloneNode(
|
|
2353
|
+
!1
|
|
2354
|
+
);
|
|
2355
|
+
$.style.visibility = "hidden", e.appendChild($);
|
|
2356
|
+
const i = this.countryContainer.cloneNode();
|
|
2357
|
+
$.appendChild(i);
|
|
2358
|
+
const s = this.selectedCountry.cloneNode(
|
|
2359
|
+
!0
|
|
2387
2360
|
);
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2361
|
+
i.appendChild(s);
|
|
2362
|
+
const a = s.offsetWidth;
|
|
2363
|
+
return e.removeChild($), a;
|
|
2364
|
+
}
|
|
2365
|
+
return 0;
|
|
2366
|
+
}
|
|
2367
|
+
//* Update search results text (for a11y).
|
|
2368
|
+
updateSearchResultsA11yText() {
|
|
2369
|
+
const { i18n: e } = this.options, $ = this.countryList.childElementCount;
|
|
2370
|
+
let i;
|
|
2371
|
+
$ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace(
|
|
2372
|
+
"${count}",
|
|
2373
|
+
$.toString()
|
|
2374
|
+
), this.searchResultsA11yText.textContent = i;
|
|
2375
|
+
}
|
|
2376
|
+
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2377
|
+
scrollTo(e) {
|
|
2378
|
+
const $ = this.countryList, i = document.documentElement.scrollTop, s = $.offsetHeight, a = $.getBoundingClientRect().top + i, u = a + s, f = e.offsetHeight, C = e.getBoundingClientRect().top + i, I = C + f, _ = C - a + $.scrollTop;
|
|
2379
|
+
if (C < a)
|
|
2380
|
+
$.scrollTop = _;
|
|
2381
|
+
else if (I > u) {
|
|
2382
|
+
const A = s - f;
|
|
2383
|
+
$.scrollTop = _ - A;
|
|
2391
2384
|
}
|
|
2392
2385
|
}
|
|
2386
|
+
//* Remove highlighting from other list items and highlight the given item.
|
|
2387
|
+
highlightListItem(e, $) {
|
|
2388
|
+
const i = this.highlightedItem;
|
|
2389
|
+
if (i && (i.classList.remove(E.HIGHLIGHT), i.setAttribute(L.SELECTED, "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add(E.HIGHLIGHT), this.highlightedItem.setAttribute(L.SELECTED, "true"), this.options.countrySearch)) {
|
|
2390
|
+
const s = this.highlightedItem.getAttribute("id") || "";
|
|
2391
|
+
this.searchInput.setAttribute(L.ACTIVE_DESCENDANT, s);
|
|
2392
|
+
}
|
|
2393
|
+
$ && this.highlightedItem.focus();
|
|
2394
|
+
}
|
|
2395
|
+
//* Country search: Filter the country list to the given array of countries.
|
|
2396
|
+
filterCountries(e) {
|
|
2397
|
+
this.countryList.innerHTML = "";
|
|
2398
|
+
let $ = !0;
|
|
2399
|
+
for (const i of e) {
|
|
2400
|
+
const s = i.nodeById[this.id];
|
|
2401
|
+
s && (this.countryList.appendChild(s), $ && (this.highlightListItem(s, !1), $ = !1));
|
|
2402
|
+
}
|
|
2403
|
+
$ ? (this.highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove(E.HIDE)) : this.searchNoResults && this.searchNoResults.classList.add(E.HIDE), this.countryList.scrollTop = 0, this.updateSearchResultsA11yText();
|
|
2404
|
+
}
|
|
2405
|
+
destroy() {
|
|
2406
|
+
this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2407
|
+
const e = this.telInput.parentNode;
|
|
2408
|
+
e.before(this.telInput), e.remove(), this.telInput = null, this.countryContainer = null, this.selectedCountry = null, this.selectedCountryInner = null, this.selectedDialCode = null, this.dropdownArrow = null, this.dropdownContent = null, this.searchInput = null, this.searchIcon = null, this.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null;
|
|
2409
|
+
for (const $ of this.countries)
|
|
2410
|
+
delete $.nodeById[this.id];
|
|
2411
|
+
this.countries = null;
|
|
2412
|
+
}
|
|
2413
|
+
}
|
|
2414
|
+
const f2 = (h) => {
|
|
2415
|
+
const { onlyCountries: e, excludeCountries: $ } = h;
|
|
2416
|
+
if (e.length) {
|
|
2417
|
+
const i = e.map(
|
|
2418
|
+
(s) => s.toLowerCase()
|
|
2419
|
+
);
|
|
2420
|
+
return Q.filter(
|
|
2421
|
+
(s) => i.includes(s.iso2)
|
|
2422
|
+
);
|
|
2423
|
+
} else if ($.length) {
|
|
2424
|
+
const i = $.map(
|
|
2425
|
+
(s) => s.toLowerCase()
|
|
2426
|
+
);
|
|
2427
|
+
return Q.filter(
|
|
2428
|
+
(s) => !i.includes(s.iso2)
|
|
2429
|
+
);
|
|
2430
|
+
}
|
|
2431
|
+
return Q;
|
|
2432
|
+
}, p2 = (h, e) => {
|
|
2433
|
+
for (const $ of h) {
|
|
2434
|
+
const i = $.iso2.toLowerCase();
|
|
2435
|
+
e.i18n[i] && ($.name = e.i18n[i]);
|
|
2436
|
+
}
|
|
2437
|
+
}, C2 = (h, e) => {
|
|
2438
|
+
const $ = /* @__PURE__ */ new Set();
|
|
2439
|
+
let i = 0;
|
|
2440
|
+
const s = {}, a = (u, f, C) => {
|
|
2441
|
+
if (!u || !f)
|
|
2442
|
+
return;
|
|
2443
|
+
f.length > i && (i = f.length), s.hasOwnProperty(f) || (s[f] = []);
|
|
2444
|
+
const I = s[f];
|
|
2445
|
+
if (I.includes(u))
|
|
2446
|
+
return;
|
|
2447
|
+
const _ = C !== void 0 ? C : I.length;
|
|
2448
|
+
I[_] = u;
|
|
2449
|
+
};
|
|
2450
|
+
for (const u of h) {
|
|
2451
|
+
$.has(u.dialCode) || $.add(u.dialCode);
|
|
2452
|
+
for (let f = 1; f < u.dialCode.length; f++) {
|
|
2453
|
+
const C = u.dialCode.substring(0, f);
|
|
2454
|
+
a(u.iso2, C);
|
|
2455
|
+
}
|
|
2456
|
+
a(u.iso2, u.dialCode, u.priority);
|
|
2457
|
+
}
|
|
2458
|
+
(e.onlyCountries.length || e.excludeCountries.length) && $.forEach((u) => {
|
|
2459
|
+
s[u] = s[u].filter(Boolean);
|
|
2460
|
+
});
|
|
2461
|
+
for (const u of h)
|
|
2462
|
+
if (u.areaCodes) {
|
|
2463
|
+
const f = s[u.dialCode][0];
|
|
2464
|
+
for (const C of u.areaCodes) {
|
|
2465
|
+
for (let I = 1; I < C.length; I++) {
|
|
2466
|
+
const _ = C.substring(0, I), A = u.dialCode + _;
|
|
2467
|
+
a(f, A), a(u.iso2, A);
|
|
2468
|
+
}
|
|
2469
|
+
a(u.iso2, u.dialCode + C);
|
|
2470
|
+
}
|
|
2471
|
+
}
|
|
2472
|
+
return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: s };
|
|
2473
|
+
}, g2 = (h, e) => {
|
|
2474
|
+
e.countryOrder && (e.countryOrder = e.countryOrder.map(
|
|
2475
|
+
($) => $.toLowerCase()
|
|
2476
|
+
)), h.sort(($, i) => {
|
|
2477
|
+
const { countryOrder: s } = e;
|
|
2478
|
+
if (s) {
|
|
2479
|
+
const a = s.indexOf($.iso2), u = s.indexOf(i.iso2), f = a > -1, C = u > -1;
|
|
2480
|
+
if (f || C)
|
|
2481
|
+
return f && C ? a - u : f ? -1 : 1;
|
|
2482
|
+
}
|
|
2483
|
+
return $.name.localeCompare(i.name);
|
|
2484
|
+
});
|
|
2485
|
+
}, m2 = (h) => {
|
|
2486
|
+
for (const e of h)
|
|
2487
|
+
e.normalisedName = L0(e.name), e.initials = e.normalisedName.split(/[^a-z]/).map(($) => $[0]).join(""), e.dialCodePlus = `+${e.dialCode}`;
|
|
2488
|
+
}, y2 = (h, e, $, i) => {
|
|
2489
|
+
let s = h;
|
|
2490
|
+
if ($ && e) {
|
|
2491
|
+
e = `+${i.dialCode}`;
|
|
2492
|
+
const a = s[e.length] === " " || s[e.length] === "-" ? e.length + 1 : e.length;
|
|
2493
|
+
s = s.substring(a);
|
|
2494
|
+
}
|
|
2495
|
+
return s;
|
|
2496
|
+
}, I2 = (h, e, $, i, s) => {
|
|
2497
|
+
const a = $ ? $.formatNumberAsYouType(h, i.iso2) : h, { dialCode: u } = i;
|
|
2498
|
+
return s && e.charAt(0) !== "+" && a.includes(`+${u}`) ? (a.split(`+${u}`)[1] || "").trim() : a;
|
|
2499
|
+
}, _2 = (h, e, $, i) => {
|
|
2500
|
+
if ($ === 0 && !i)
|
|
2501
|
+
return 0;
|
|
2502
|
+
let s = 0;
|
|
2503
|
+
for (let a = 0; a < e.length; a++) {
|
|
2504
|
+
if (/[+0-9]/.test(e[a]) && s++, s === h && !i)
|
|
2505
|
+
return a + 1;
|
|
2506
|
+
if (i && s === h + 1)
|
|
2507
|
+
return a;
|
|
2508
|
+
}
|
|
2509
|
+
return e.length;
|
|
2510
|
+
}, E2 = [
|
|
2511
|
+
"800",
|
|
2512
|
+
"822",
|
|
2513
|
+
"833",
|
|
2514
|
+
"844",
|
|
2515
|
+
"855",
|
|
2516
|
+
"866",
|
|
2517
|
+
"877",
|
|
2518
|
+
"880",
|
|
2519
|
+
"881",
|
|
2520
|
+
"882",
|
|
2521
|
+
"883",
|
|
2522
|
+
"884",
|
|
2523
|
+
"885",
|
|
2524
|
+
"886",
|
|
2525
|
+
"887",
|
|
2526
|
+
"888",
|
|
2527
|
+
"889"
|
|
2528
|
+
], _0 = (h) => {
|
|
2529
|
+
const e = m1(h);
|
|
2530
|
+
if (e.startsWith(N0.NANP) && e.length >= 4) {
|
|
2531
|
+
const $ = e.substring(1, 4);
|
|
2532
|
+
return E2.includes($);
|
|
2533
|
+
}
|
|
2534
|
+
return !1;
|
|
2535
|
+
};
|
|
2536
|
+
for (const h of Q)
|
|
2537
|
+
h.name = E0[h.iso2];
|
|
2538
|
+
let N2 = 0;
|
|
2539
|
+
const S2 = new Set(Q.map((h) => h.iso2)), P1 = (h) => S2.has(h);
|
|
2540
|
+
class M1 {
|
|
2541
|
+
constructor(e, $ = {}) {
|
|
2542
|
+
this.id = N2++, this.options = { ...S0, ...$ }, o2(this.options, E0), this.ui = new h2(e, this.options, this.id), this.isAndroid = M1._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = f2(this.options);
|
|
2543
|
+
const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: a } = C2(
|
|
2544
|
+
this.countries,
|
|
2545
|
+
this.options
|
|
2546
|
+
);
|
|
2547
|
+
this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = a, this.countryByIso2 = new Map(this.countries.map((u) => [u.iso2, u])), this._init();
|
|
2548
|
+
}
|
|
2549
|
+
static _getIsAndroid() {
|
|
2550
|
+
return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
|
|
2551
|
+
}
|
|
2552
|
+
_createInitPromises() {
|
|
2553
|
+
const e = new Promise((i, s) => {
|
|
2554
|
+
this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
|
|
2555
|
+
}), $ = new Promise((i, s) => {
|
|
2556
|
+
this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = s;
|
|
2557
|
+
});
|
|
2558
|
+
return Promise.all([e, $]);
|
|
2559
|
+
}
|
|
2560
|
+
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
2561
|
+
_init() {
|
|
2562
|
+
this.selectedCountryData = {}, this.abortController = new AbortController(), this._processCountryData(), this.ui.generateMarkup(this.countries), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
2563
|
+
}
|
|
2564
|
+
//********************
|
|
2565
|
+
//* PRIVATE METHODS
|
|
2566
|
+
//********************
|
|
2567
|
+
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
2568
|
+
_processCountryData() {
|
|
2569
|
+
p2(this.countries, this.options), g2(this.countries, this.options), m2(this.countries);
|
|
2570
|
+
}
|
|
2393
2571
|
//* Set the initial state of the input value and the selected country by:
|
|
2394
2572
|
//* 1. Extracting a dial code from the given number
|
|
2395
2573
|
//* 2. Using explicit initialCountry
|
|
2396
2574
|
_setInitialState(e = !1) {
|
|
2397
|
-
const $ = this.telInput.getAttribute("value"), i = this.telInput.value,
|
|
2398
|
-
if (
|
|
2399
|
-
this._updateCountryFromNumber(
|
|
2400
|
-
else if (!
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2575
|
+
const $ = this.ui.telInput.getAttribute("value"), i = this.ui.telInput.value, a = $ && $.startsWith("+") && (!i || !i.startsWith("+")) ? $ : i, u = this._getDialCode(a), f = _0(a), { initialCountry: C, geoIpLookup: I } = this.options, _ = C === T1.AUTO && I;
|
|
2576
|
+
if (u && !f)
|
|
2577
|
+
this._updateCountryFromNumber(a);
|
|
2578
|
+
else if (!_ || e) {
|
|
2579
|
+
const A = C ? C.toLowerCase() : "";
|
|
2580
|
+
P1(A) ? this._setCountry(A) : u && f ? this._setCountry(i2.ISO2) : this._setCountry("");
|
|
2403
2581
|
}
|
|
2404
|
-
|
|
2582
|
+
a && this._updateValFromNumber(a);
|
|
2405
2583
|
}
|
|
2406
2584
|
//* Initialise the main event listeners: input keyup, and click selected country.
|
|
2407
2585
|
_initListeners() {
|
|
2408
|
-
this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.hiddenInput || this.hiddenInputCountry) && this.telInput.form && this._initHiddenInputListener();
|
|
2586
|
+
this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.ui.hiddenInput || this.ui.hiddenInputCountry) && this.ui.telInput.form && this._initHiddenInputListener();
|
|
2409
2587
|
}
|
|
2410
2588
|
//* Update hidden input on form submit.
|
|
2411
2589
|
_initHiddenInputListener() {
|
|
2412
|
-
var
|
|
2413
|
-
|
|
2414
|
-
this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.
|
|
2415
|
-
}
|
|
2416
|
-
|
|
2417
|
-
this.
|
|
2418
|
-
);
|
|
2590
|
+
var $;
|
|
2591
|
+
const e = () => {
|
|
2592
|
+
this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
|
|
2593
|
+
};
|
|
2594
|
+
($ = this.ui.telInput.form) == null || $.addEventListener("submit", e, {
|
|
2595
|
+
signal: this.abortController.signal
|
|
2596
|
+
});
|
|
2419
2597
|
}
|
|
2420
2598
|
//* initialise the dropdown listeners.
|
|
2421
2599
|
_initDropdownListeners() {
|
|
2422
|
-
this.
|
|
2423
|
-
this.dropdownContent.classList.contains(
|
|
2600
|
+
const e = this.abortController.signal, $ = (u) => {
|
|
2601
|
+
this.ui.dropdownContent.classList.contains(E.HIDE) ? this.ui.telInput.focus() : u.preventDefault();
|
|
2602
|
+
}, i = this.ui.telInput.closest("label");
|
|
2603
|
+
i && i.addEventListener("click", $, { signal: e });
|
|
2604
|
+
const s = () => {
|
|
2605
|
+
this.ui.dropdownContent.classList.contains(
|
|
2606
|
+
E.HIDE
|
|
2607
|
+
) && !this.ui.telInput.disabled && !this.ui.telInput.readOnly && this._openDropdown();
|
|
2608
|
+
};
|
|
2609
|
+
this.ui.selectedCountry.addEventListener(
|
|
2610
|
+
"click",
|
|
2611
|
+
s,
|
|
2612
|
+
{
|
|
2613
|
+
signal: e
|
|
2614
|
+
}
|
|
2615
|
+
);
|
|
2616
|
+
const a = (u) => {
|
|
2617
|
+
this.ui.dropdownContent.classList.contains(
|
|
2618
|
+
E.HIDE
|
|
2619
|
+
) && [x.ARROW_UP, x.ARROW_DOWN, x.SPACE, x.ENTER].includes(u.key) && (u.preventDefault(), u.stopPropagation(), this._openDropdown()), u.key === x.TAB && this._closeDropdown();
|
|
2424
2620
|
};
|
|
2425
|
-
|
|
2426
|
-
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
2427
|
-
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
2428
|
-
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = ($) => {
|
|
2429
|
-
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes($.key) && ($.preventDefault(), $.stopPropagation(), this._openDropdown()), $.key === "Tab" && this._closeDropdown();
|
|
2430
|
-
}, this.countryContainer.addEventListener(
|
|
2621
|
+
this.ui.countryContainer.addEventListener(
|
|
2431
2622
|
"keydown",
|
|
2432
|
-
|
|
2623
|
+
a,
|
|
2624
|
+
{ signal: e }
|
|
2433
2625
|
);
|
|
2434
2626
|
}
|
|
2435
2627
|
//* Init many requests: utils script / geo ip lookup.
|
|
2436
2628
|
_initRequests() {
|
|
2437
|
-
|
|
2438
|
-
e && !
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2629
|
+
const { loadUtils: e, initialCountry: $, geoIpLookup: i } = this.options;
|
|
2630
|
+
if (e && !m.utils) {
|
|
2631
|
+
const a = () => {
|
|
2632
|
+
var u;
|
|
2633
|
+
(u = m.attachUtils(e)) == null || u.catch(() => {
|
|
2634
|
+
});
|
|
2635
|
+
};
|
|
2636
|
+
if (m.documentReady())
|
|
2637
|
+
a();
|
|
2638
|
+
else {
|
|
2639
|
+
const u = () => {
|
|
2640
|
+
a();
|
|
2641
|
+
};
|
|
2642
|
+
window.addEventListener("load", u, {
|
|
2643
|
+
signal: this.abortController.signal
|
|
2644
|
+
});
|
|
2645
|
+
}
|
|
2646
|
+
} else
|
|
2647
|
+
this.resolveUtilsScriptPromise();
|
|
2648
|
+
$ === T1.AUTO && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
2445
2649
|
}
|
|
2446
2650
|
//* Perform the geo ip lookup.
|
|
2447
2651
|
_loadAutoCountry() {
|
|
2448
|
-
|
|
2652
|
+
m.autoCountry ? this.handleAutoCountry() : m.startedLoadingAutoCountry || (m.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
2449
2653
|
(e = "") => {
|
|
2450
2654
|
const $ = e.toLowerCase();
|
|
2451
|
-
|
|
2655
|
+
P1($) ? (m.autoCountry = $, setTimeout(() => r1("handleAutoCountry"))) : (this._setInitialState(!0), r1("rejectAutoCountryPromise"));
|
|
2452
2656
|
},
|
|
2453
2657
|
() => {
|
|
2454
|
-
this._setInitialState(!0),
|
|
2658
|
+
this._setInitialState(!0), r1("rejectAutoCountryPromise");
|
|
2455
2659
|
}
|
|
2456
2660
|
));
|
|
2457
2661
|
}
|
|
2458
2662
|
_openDropdownWithPlus() {
|
|
2459
|
-
this._openDropdown(), this.searchInput.value = "+", this.
|
|
2663
|
+
this._openDropdown(), this.ui.searchInput.value = "+", this._filterCountriesByQuery("");
|
|
2460
2664
|
}
|
|
2461
2665
|
//* Initialize the tel input listeners.
|
|
2462
2666
|
_initTelInputListeners() {
|
|
2463
2667
|
this._bindInputListener(), this._maybeBindKeydownListener(), this._maybeBindPasteListener();
|
|
2464
2668
|
}
|
|
2465
2669
|
_bindInputListener() {
|
|
2466
|
-
const {
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2670
|
+
const {
|
|
2671
|
+
strictMode: e,
|
|
2672
|
+
formatAsYouType: $,
|
|
2673
|
+
separateDialCode: i,
|
|
2674
|
+
allowDropdown: s,
|
|
2675
|
+
countrySearch: a
|
|
2676
|
+
} = this.options;
|
|
2677
|
+
let u = !1;
|
|
2678
|
+
q.ALPHA_UNICODE.test(this.ui.telInput.value) && (u = !0);
|
|
2679
|
+
const f = (C) => {
|
|
2680
|
+
if (this.isAndroid && (C == null ? void 0 : C.data) === "+" && i && s && a) {
|
|
2681
|
+
const v = this.ui.telInput.selectionStart || 0, N = this.ui.telInput.value.substring(
|
|
2682
|
+
0,
|
|
2683
|
+
v - 1
|
|
2684
|
+
), T = this.ui.telInput.value.substring(v);
|
|
2685
|
+
this.ui.telInput.value = N + T, this._openDropdownWithPlus();
|
|
2472
2686
|
return;
|
|
2473
2687
|
}
|
|
2474
|
-
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
2475
|
-
const
|
|
2476
|
-
|
|
2477
|
-
const
|
|
2478
|
-
if ($ && !
|
|
2479
|
-
const
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2688
|
+
this._updateCountryFromNumber(this.ui.telInput.value) && this._triggerCountryChange();
|
|
2689
|
+
const I = (C == null ? void 0 : C.data) && q.NON_PLUS_NUMERIC.test(C.data), _ = (C == null ? void 0 : C.inputType) === m0.PASTE && this.ui.telInput.value;
|
|
2690
|
+
I || _ && !e ? u = !0 : q.NON_PLUS_NUMERIC.test(this.ui.telInput.value) || (u = !1);
|
|
2691
|
+
const A = (C == null ? void 0 : C.detail) && C.detail.isSetNumber;
|
|
2692
|
+
if ($ && !u && !A) {
|
|
2693
|
+
const v = this.ui.telInput.selectionStart || 0, T = this.ui.telInput.value.substring(
|
|
2694
|
+
0,
|
|
2695
|
+
v
|
|
2696
|
+
).replace(
|
|
2697
|
+
q.NON_PLUS_NUMERIC_GLOBAL,
|
|
2698
|
+
""
|
|
2699
|
+
).length, k = (C == null ? void 0 : C.inputType) === m0.DELETE_FWD, P = this._getFullNumber(), B = I2(
|
|
2700
|
+
P,
|
|
2701
|
+
this.ui.telInput.value,
|
|
2702
|
+
m.utils,
|
|
2483
2703
|
this.selectedCountryData,
|
|
2484
2704
|
this.options.separateDialCode
|
|
2485
|
-
),
|
|
2486
|
-
|
|
2705
|
+
), W = _2(
|
|
2706
|
+
T,
|
|
2707
|
+
B,
|
|
2708
|
+
v,
|
|
2709
|
+
k
|
|
2710
|
+
);
|
|
2711
|
+
this.ui.telInput.value = B, this.ui.telInput.setSelectionRange(W, W);
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2714
|
+
this.ui.telInput.addEventListener(
|
|
2715
|
+
"input",
|
|
2716
|
+
f,
|
|
2717
|
+
{
|
|
2718
|
+
signal: this.abortController.signal
|
|
2487
2719
|
}
|
|
2488
|
-
|
|
2720
|
+
);
|
|
2489
2721
|
}
|
|
2490
2722
|
_maybeBindKeydownListener() {
|
|
2491
|
-
const { strictMode: e, separateDialCode: $, allowDropdown: i, countrySearch:
|
|
2492
|
-
(e || $)
|
|
2493
|
-
|
|
2494
|
-
if (
|
|
2495
|
-
u.
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2723
|
+
const { strictMode: e, separateDialCode: $, allowDropdown: i, countrySearch: s } = this.options;
|
|
2724
|
+
if (e || $) {
|
|
2725
|
+
const a = (u) => {
|
|
2726
|
+
if (u.key && u.key.length === 1 && !u.altKey && !u.ctrlKey && !u.metaKey) {
|
|
2727
|
+
if ($ && i && s && u.key === "+") {
|
|
2728
|
+
u.preventDefault(), this._openDropdownWithPlus();
|
|
2729
|
+
return;
|
|
2730
|
+
}
|
|
2731
|
+
if (e) {
|
|
2732
|
+
const f = this.ui.telInput.value, I = !f.startsWith("+") && this.ui.telInput.selectionStart === 0 && u.key === "+", _ = /^[0-9]$/.test(u.key), A = $ ? _ : I || _, v = f.slice(0, this.ui.telInput.selectionStart) + u.key + f.slice(this.ui.telInput.selectionEnd), N = this._getFullNumber(v), T = m.utils.getCoreNumber(
|
|
2733
|
+
N,
|
|
2734
|
+
this.selectedCountryData.iso2
|
|
2735
|
+
), k = this.maxCoreNumberLength && T.length > this.maxCoreNumberLength, B = this._getNewCountryFromNumber(N) !== null;
|
|
2736
|
+
(!A || k && !B && !I) && u.preventDefault();
|
|
2737
|
+
}
|
|
2501
2738
|
}
|
|
2502
|
-
}
|
|
2503
|
-
|
|
2739
|
+
};
|
|
2740
|
+
this.ui.telInput.addEventListener("keydown", a, {
|
|
2741
|
+
signal: this.abortController.signal
|
|
2742
|
+
});
|
|
2743
|
+
}
|
|
2504
2744
|
}
|
|
2505
2745
|
_maybeBindPasteListener() {
|
|
2506
|
-
this.options.strictMode
|
|
2507
|
-
e
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
if (this.maxCoreNumberLength && P.length > this.maxCoreNumberLength)
|
|
2515
|
-
if ($.selectionEnd === $.value.length) {
|
|
2516
|
-
const j = P.length - this.maxCoreNumberLength;
|
|
2517
|
-
N = N.slice(0, N.length - j);
|
|
2518
|
-
} else
|
|
2746
|
+
if (this.options.strictMode) {
|
|
2747
|
+
const e = ($) => {
|
|
2748
|
+
$.preventDefault();
|
|
2749
|
+
const i = this.ui.telInput, s = i.selectionStart, a = i.selectionEnd, u = i.value.slice(0, s), f = i.value.slice(a), C = this.selectedCountryData.iso2, I = $.clipboardData.getData("text"), _ = s === 0 && a > 0, A = !i.value.startsWith("+") || _, v = I.replace(q.NON_PLUS_NUMERIC_GLOBAL, ""), N = v.startsWith("+"), T = v.replace(/\+/g, ""), k = N && A ? `+${T}` : T;
|
|
2750
|
+
let P = u + k + f, B = m.utils.getCoreNumber(P, C);
|
|
2751
|
+
for (; B.length === 0 && P.length > 0; )
|
|
2752
|
+
P = P.slice(0, -1), B = m.utils.getCoreNumber(P, C);
|
|
2753
|
+
if (!B)
|
|
2519
2754
|
return;
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2755
|
+
if (this.maxCoreNumberLength && B.length > this.maxCoreNumberLength)
|
|
2756
|
+
if (i.selectionEnd === i.value.length) {
|
|
2757
|
+
const y1 = B.length - this.maxCoreNumberLength;
|
|
2758
|
+
P = P.slice(0, P.length - y1);
|
|
2759
|
+
} else
|
|
2760
|
+
return;
|
|
2761
|
+
i.value = P;
|
|
2762
|
+
const W = s + k.length;
|
|
2763
|
+
i.setSelectionRange(W, W), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
|
|
2764
|
+
};
|
|
2765
|
+
this.ui.telInput.addEventListener("paste", e, {
|
|
2766
|
+
signal: this.abortController.signal
|
|
2767
|
+
});
|
|
2768
|
+
}
|
|
2524
2769
|
}
|
|
2525
2770
|
//* Adhere to the input's maxlength attr.
|
|
2526
2771
|
_cap(e) {
|
|
2527
|
-
const $ =
|
|
2772
|
+
const $ = Number(this.ui.telInput.getAttribute("maxlength"));
|
|
2528
2773
|
return $ && e.length > $ ? e.substring(0, $) : e;
|
|
2529
2774
|
}
|
|
2530
|
-
//* Trigger a custom event on the input.
|
|
2775
|
+
//* Trigger a custom event on the input (typed via ItiEventMap).
|
|
2531
2776
|
_trigger(e, $ = {}) {
|
|
2532
2777
|
const i = new CustomEvent(e, {
|
|
2533
2778
|
bubbles: !0,
|
|
2534
2779
|
cancelable: !0,
|
|
2535
2780
|
detail: $
|
|
2536
2781
|
});
|
|
2537
|
-
this.telInput.dispatchEvent(i);
|
|
2782
|
+
this.ui.telInput.dispatchEvent(i);
|
|
2538
2783
|
}
|
|
2539
2784
|
//* Open the dropdown.
|
|
2540
2785
|
_openDropdown() {
|
|
2541
2786
|
const { fixDropdownWidth: e, countrySearch: $ } = this.options;
|
|
2542
|
-
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove(
|
|
2543
|
-
const i = this.countryList.firstElementChild;
|
|
2544
|
-
i && (this.
|
|
2787
|
+
if (this.dropdownAbortController = new AbortController(), e && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(E.HIDE), this.ui.selectedCountry.setAttribute(L.EXPANDED, "true"), this._setDropdownPosition(), $) {
|
|
2788
|
+
const i = this.ui.countryList.firstElementChild;
|
|
2789
|
+
i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
|
|
2545
2790
|
}
|
|
2546
|
-
this._bindDropdownListeners(), this.dropdownArrow.classList.add(
|
|
2791
|
+
this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(E.ARROW_UP), this._trigger(g1.OPEN_COUNTRY_DROPDOWN);
|
|
2547
2792
|
}
|
|
2548
2793
|
//* Set the dropdown position
|
|
2549
2794
|
_setDropdownPosition() {
|
|
2550
|
-
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2551
|
-
const e = this.telInput.getBoundingClientRect(), $ = this.telInput.offsetHeight;
|
|
2552
|
-
this.options.dropdownContainer
|
|
2795
|
+
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
|
|
2796
|
+
const e = this.ui.telInput.getBoundingClientRect(), $ = this.ui.telInput.offsetHeight;
|
|
2797
|
+
if (this.options.dropdownContainer) {
|
|
2798
|
+
this.ui.dropdown.style.top = `${e.top + $}px`, this.ui.dropdown.style.left = `${e.left}px`;
|
|
2799
|
+
const i = () => this._closeDropdown();
|
|
2800
|
+
window.addEventListener("scroll", i, {
|
|
2801
|
+
signal: this.dropdownAbortController.signal
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2553
2804
|
}
|
|
2554
2805
|
}
|
|
2555
2806
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2556
2807
|
_bindDropdownListeners() {
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2808
|
+
const e = this.dropdownAbortController.signal;
|
|
2809
|
+
this._bindDropdownMouseoverListener(e), this._bindDropdownCountryClickListener(e), this._bindDropdownClickOffListener(e), this._bindDropdownKeydownListener(e), this.options.countrySearch && this._bindDropdownSearchListeners(e);
|
|
2810
|
+
}
|
|
2811
|
+
//* When mouse over a list item, just highlight that one
|
|
2812
|
+
//* we add the class "highlight", so if they hit "enter" we know which one to select.
|
|
2813
|
+
_bindDropdownMouseoverListener(e) {
|
|
2814
|
+
const $ = (i) => {
|
|
2815
|
+
var a;
|
|
2816
|
+
const s = (a = i.target) == null ? void 0 : a.closest(
|
|
2817
|
+
`.${E.COUNTRY_ITEM}`
|
|
2818
|
+
);
|
|
2819
|
+
s && this.ui.highlightListItem(s, !1);
|
|
2820
|
+
};
|
|
2821
|
+
this.ui.countryList.addEventListener(
|
|
2562
2822
|
"mouseover",
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2823
|
+
$,
|
|
2824
|
+
{
|
|
2825
|
+
signal: e
|
|
2826
|
+
}
|
|
2827
|
+
);
|
|
2828
|
+
}
|
|
2829
|
+
//* Listen for country selection.
|
|
2830
|
+
_bindDropdownCountryClickListener(e) {
|
|
2831
|
+
const $ = (i) => {
|
|
2832
|
+
var a;
|
|
2833
|
+
const s = (a = i.target) == null ? void 0 : a.closest(
|
|
2834
|
+
`.${E.COUNTRY_ITEM}`
|
|
2835
|
+
);
|
|
2836
|
+
s && this._selectListItem(s);
|
|
2837
|
+
};
|
|
2838
|
+
this.ui.countryList.addEventListener("click", $, {
|
|
2839
|
+
signal: e
|
|
2840
|
+
});
|
|
2841
|
+
}
|
|
2842
|
+
//* Click off to close (except when this initial opening click is bubbling up).
|
|
2843
|
+
//* We cannot just stopPropagation as it may be needed to close another instance.
|
|
2844
|
+
_bindDropdownClickOffListener(e) {
|
|
2845
|
+
const $ = (i) => {
|
|
2846
|
+
!!i.target.closest(
|
|
2847
|
+
`#iti-${this.id}__dropdown-content`
|
|
2848
|
+
) || this._closeDropdown();
|
|
2849
|
+
};
|
|
2850
|
+
setTimeout(() => {
|
|
2571
2851
|
document.documentElement.addEventListener(
|
|
2572
2852
|
"click",
|
|
2573
|
-
|
|
2853
|
+
$,
|
|
2854
|
+
{ signal: e }
|
|
2574
2855
|
);
|
|
2575
2856
|
}, 0);
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
},
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2857
|
+
}
|
|
2858
|
+
//* Listen for up/down scrolling, enter to select, or escape to close.
|
|
2859
|
+
//* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
|
|
2860
|
+
//* just hit down and hold it to scroll down (no keyup event).
|
|
2861
|
+
//* Listen on the document because that's where key events are triggered if no input has focus.
|
|
2862
|
+
_bindDropdownKeydownListener(e) {
|
|
2863
|
+
let $ = "", i = null;
|
|
2864
|
+
const s = (a) => {
|
|
2865
|
+
[
|
|
2866
|
+
x.ARROW_UP,
|
|
2867
|
+
x.ARROW_DOWN,
|
|
2868
|
+
x.ENTER,
|
|
2869
|
+
x.ESC
|
|
2870
|
+
].includes(a.key) && (a.preventDefault(), a.stopPropagation(), a.key === x.ARROW_UP || a.key === x.ARROW_DOWN ? this._handleUpDownKey(a.key) : a.key === x.ENTER ? this._handleEnterKey() : a.key === x.ESC && this._closeDropdown()), !this.options.countrySearch && q.HIDDEN_SEARCH_CHAR.test(a.key) && (a.stopPropagation(), i && clearTimeout(i), $ += a.key.toLowerCase(), this._searchForCountry($), i = setTimeout(() => {
|
|
2871
|
+
$ = "";
|
|
2872
|
+
}, n2.HIDDEN_SEARCH_RESET_MS));
|
|
2873
|
+
};
|
|
2874
|
+
document.addEventListener("keydown", s, { signal: e });
|
|
2875
|
+
}
|
|
2876
|
+
//* Search input listeners when countrySearch enabled.
|
|
2877
|
+
_bindDropdownSearchListeners(e) {
|
|
2878
|
+
const $ = () => {
|
|
2879
|
+
const u = this.ui.searchInput.value.trim();
|
|
2880
|
+
this._filterCountriesByQuery(u), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove(E.HIDE) : this.ui.searchClearButton.classList.add(E.HIDE);
|
|
2881
|
+
};
|
|
2882
|
+
let i = null;
|
|
2883
|
+
const s = () => {
|
|
2884
|
+
i && clearTimeout(i), i = setTimeout(() => {
|
|
2885
|
+
$(), i = null;
|
|
2886
|
+
}, 100);
|
|
2887
|
+
};
|
|
2888
|
+
this.ui.searchInput.addEventListener("input", s, {
|
|
2889
|
+
signal: e
|
|
2890
|
+
});
|
|
2891
|
+
const a = () => {
|
|
2892
|
+
this.ui.searchInput.value = "", this.ui.searchInput.focus(), $();
|
|
2893
|
+
};
|
|
2894
|
+
this.ui.searchClearButton.addEventListener("click", a, {
|
|
2895
|
+
signal: e
|
|
2896
|
+
});
|
|
2595
2897
|
}
|
|
2596
2898
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
2597
2899
|
_searchForCountry(e) {
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
break;
|
|
2603
|
-
}
|
|
2604
|
-
}
|
|
2605
|
-
//* Country search enabled: Filter the countries according to the search query.
|
|
2606
|
-
_filterCountries(e) {
|
|
2607
|
-
this.countryList.innerHTML = "";
|
|
2608
|
-
let $;
|
|
2609
|
-
e === "" ? $ = this.countries : $ = this._getMatchedCountries(e);
|
|
2610
|
-
let i = !0;
|
|
2611
|
-
for (const r of $) {
|
|
2612
|
-
const u = r.nodeById[this.id];
|
|
2613
|
-
u && (this.countryList.appendChild(u), i && (this._highlightListItem(u, !1), i = !1));
|
|
2900
|
+
const $ = l2(this.countries, e);
|
|
2901
|
+
if ($) {
|
|
2902
|
+
const i = $.nodeById[this.id];
|
|
2903
|
+
this.ui.highlightListItem(i, !1), this.ui.scrollTo(i);
|
|
2614
2904
|
}
|
|
2615
|
-
i ? (this._highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove("iti__hide")) : this.searchNoResults && this.searchNoResults.classList.add("iti__hide"), this.countryList.scrollTop = 0, this._updateSearchResultsA11yText();
|
|
2616
|
-
}
|
|
2617
|
-
_getMatchedCountries(e) {
|
|
2618
|
-
const $ = a0(e), i = [], r = [], u = [], h = [], c = [], C = [];
|
|
2619
|
-
for (const g of this.countries)
|
|
2620
|
-
g.iso2 === $ ? i.push(g) : g.normalisedName.startsWith($) ? r.push(g) : g.normalisedName.includes($) ? u.push(g) : $ === g.dialCode || $ === g.dialCodePlus ? h.push(g) : g.dialCodePlus.includes($) ? c.push(g) : g.initials.includes($) && C.push(g);
|
|
2621
|
-
return [
|
|
2622
|
-
...i.sort((g, I) => g.priority - I.priority),
|
|
2623
|
-
...r.sort((g, I) => g.priority - I.priority),
|
|
2624
|
-
...u.sort((g, I) => g.priority - I.priority),
|
|
2625
|
-
...h.sort((g, I) => g.priority - I.priority),
|
|
2626
|
-
...c.sort((g, I) => g.priority - I.priority),
|
|
2627
|
-
...C.sort((g, I) => g.priority - I.priority)
|
|
2628
|
-
];
|
|
2629
2905
|
}
|
|
2630
|
-
//*
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
$ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace("${count}", $.toString()), this.searchResultsA11yText.textContent = i;
|
|
2906
|
+
//* Country search: Filter the countries according to the search query.
|
|
2907
|
+
_filterCountriesByQuery(e) {
|
|
2908
|
+
let $;
|
|
2909
|
+
e === "" ? $ = this.countries : $ = u2(this.countries, e), this.ui.filterCountries($);
|
|
2635
2910
|
}
|
|
2636
2911
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2637
2912
|
_handleUpDownKey(e) {
|
|
2638
|
-
var i,
|
|
2639
|
-
let $ = e ===
|
|
2640
|
-
!$ && this.countryList.childElementCount > 1 && ($ = e ===
|
|
2913
|
+
var i, s;
|
|
2914
|
+
let $ = e === x.ARROW_UP ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
|
|
2915
|
+
!$ && this.ui.countryList.childElementCount > 1 && ($ = e === x.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), $ && (this.ui.scrollTo($), this.ui.highlightListItem($, !1));
|
|
2641
2916
|
}
|
|
2642
2917
|
//* Select the currently highlighted item.
|
|
2643
2918
|
_handleEnterKey() {
|
|
2644
|
-
this.highlightedItem && this._selectListItem(this.highlightedItem);
|
|
2919
|
+
this.ui.highlightedItem && this._selectListItem(this.ui.highlightedItem);
|
|
2645
2920
|
}
|
|
2646
2921
|
//* Update the input's value to the given val (format first if possible)
|
|
2647
2922
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2648
2923
|
_updateValFromNumber(e) {
|
|
2649
2924
|
let $ = e;
|
|
2650
|
-
if (this.options.formatOnDisplay &&
|
|
2651
|
-
const i = this.options.nationalMode ||
|
|
2652
|
-
$ =
|
|
2925
|
+
if (this.options.formatOnDisplay && m.utils && this.selectedCountryData) {
|
|
2926
|
+
const i = this.options.nationalMode || !$.startsWith("+") && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: a } = m.utils.numberFormat, u = i ? s : a;
|
|
2927
|
+
$ = m.utils.formatNumber(
|
|
2653
2928
|
$,
|
|
2654
2929
|
this.selectedCountryData.iso2,
|
|
2655
|
-
|
|
2930
|
+
u
|
|
2656
2931
|
);
|
|
2657
2932
|
}
|
|
2658
|
-
$ = this._beforeSetNumber($), this.telInput.value = $;
|
|
2933
|
+
$ = this._beforeSetNumber($), this.ui.telInput.value = $;
|
|
2659
2934
|
}
|
|
2660
2935
|
//* Check if need to select a new country based on the given number
|
|
2661
2936
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
@@ -2666,10 +2941,10 @@ class f1 {
|
|
|
2666
2941
|
// if there is a selected country, and the number doesn't start with a dial code, then add it
|
|
2667
2942
|
_ensureHasDialCode(e) {
|
|
2668
2943
|
const { dialCode: $, nationalPrefix: i } = this.selectedCountryData;
|
|
2669
|
-
if (e.
|
|
2944
|
+
if (e.startsWith("+") || !$)
|
|
2670
2945
|
return e;
|
|
2671
|
-
const
|
|
2672
|
-
return `+${$}${
|
|
2946
|
+
const u = i && e.startsWith(i) && !this.options.separateDialCode ? e.substring(1) : e;
|
|
2947
|
+
return `+${$}${u}`;
|
|
2673
2948
|
}
|
|
2674
2949
|
// Get the country ISO2 code from the given number
|
|
2675
2950
|
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
@@ -2677,186 +2952,137 @@ class f1 {
|
|
|
2677
2952
|
_getNewCountryFromNumber(e) {
|
|
2678
2953
|
const $ = e.indexOf("+");
|
|
2679
2954
|
let i = $ ? e.substring($) : e;
|
|
2680
|
-
const
|
|
2955
|
+
const s = this.selectedCountryData.iso2, a = this.selectedCountryData.dialCode;
|
|
2681
2956
|
i = this._ensureHasDialCode(i);
|
|
2682
|
-
const
|
|
2683
|
-
if (
|
|
2684
|
-
const C =
|
|
2685
|
-
if (
|
|
2686
|
-
return
|
|
2687
|
-
if (!
|
|
2957
|
+
const u = this._getDialCode(i, !0), f = m1(i);
|
|
2958
|
+
if (u) {
|
|
2959
|
+
const C = m1(u), I = this.dialCodeToIso2Map[C];
|
|
2960
|
+
if (I.length === 1)
|
|
2961
|
+
return I[0] === s ? null : I[0];
|
|
2962
|
+
if (!s && this.defaultCountry && I.includes(this.defaultCountry))
|
|
2688
2963
|
return this.defaultCountry;
|
|
2689
|
-
if (
|
|
2964
|
+
if (a === N0.NANP && _0(f))
|
|
2690
2965
|
return null;
|
|
2691
|
-
const { areaCodes:
|
|
2692
|
-
if (
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2695
|
-
|
|
2966
|
+
const { areaCodes: A, priority: v } = this.selectedCountryData;
|
|
2967
|
+
if (A) {
|
|
2968
|
+
const B = A.map(
|
|
2969
|
+
(W) => `${a}${W}`
|
|
2970
|
+
);
|
|
2971
|
+
for (const W of B)
|
|
2972
|
+
if (f.startsWith(W))
|
|
2696
2973
|
return null;
|
|
2697
2974
|
}
|
|
2698
|
-
const
|
|
2699
|
-
if (!
|
|
2700
|
-
return
|
|
2975
|
+
const T = A && !(v === 0) && f.length > C.length, k = s && I.includes(s) && !T, P = s === I[0];
|
|
2976
|
+
if (!k && !P)
|
|
2977
|
+
return I[0];
|
|
2701
2978
|
} else {
|
|
2702
|
-
if (i.
|
|
2979
|
+
if (i.startsWith("+") && f.length)
|
|
2703
2980
|
return "";
|
|
2704
|
-
if ((!i || i === "+") && !
|
|
2981
|
+
if ((!i || i === "+") && !s)
|
|
2705
2982
|
return this.defaultCountry;
|
|
2706
2983
|
}
|
|
2707
2984
|
return null;
|
|
2708
2985
|
}
|
|
2709
|
-
//* Remove highlighting from other list items and highlight the given item.
|
|
2710
|
-
_highlightListItem(e, $) {
|
|
2711
|
-
const i = this.highlightedItem;
|
|
2712
|
-
if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true"), this.options.countrySearch)) {
|
|
2713
|
-
const r = this.highlightedItem.getAttribute("id") || "";
|
|
2714
|
-
this.searchInput.setAttribute("aria-activedescendant", r);
|
|
2715
|
-
}
|
|
2716
|
-
$ && this.highlightedItem.focus();
|
|
2717
|
-
}
|
|
2718
2986
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2719
2987
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2720
2988
|
_setCountry(e) {
|
|
2721
|
-
const { separateDialCode: $, showFlags: i, i18n:
|
|
2722
|
-
if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
|
|
2723
|
-
const
|
|
2724
|
-
let
|
|
2989
|
+
const { separateDialCode: $, showFlags: i, i18n: s } = this.options, a = this.selectedCountryData.iso2 || "";
|
|
2990
|
+
if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
|
|
2991
|
+
const u = e && i ? `${E.FLAG} iti__${e}` : `${E.FLAG} ${E.GLOBE}`;
|
|
2992
|
+
let f, C;
|
|
2725
2993
|
if (e) {
|
|
2726
|
-
const { name:
|
|
2727
|
-
C =
|
|
2994
|
+
const { name: I, dialCode: _ } = this.selectedCountryData;
|
|
2995
|
+
C = I, f = s.selectedCountryAriaLabel.replace("${countryName}", I).replace("${dialCode}", `+${_}`);
|
|
2728
2996
|
} else
|
|
2729
|
-
C =
|
|
2730
|
-
this.selectedCountryInner.className =
|
|
2997
|
+
C = s.noCountrySelected, f = s.noCountrySelected;
|
|
2998
|
+
this.ui.selectedCountryInner.className = u, this.ui.selectedCountry.setAttribute("title", C), this.ui.selectedCountry.setAttribute(L.LABEL, f);
|
|
2731
2999
|
}
|
|
2732
3000
|
if ($) {
|
|
2733
|
-
const
|
|
2734
|
-
this.selectedDialCode.
|
|
2735
|
-
}
|
|
2736
|
-
return this._updatePlaceholder(), this._updateMaxLength(), u !== e;
|
|
2737
|
-
}
|
|
2738
|
-
//* Update the input padding to make space for the selected country/dial code.
|
|
2739
|
-
_updateInputPadding() {
|
|
2740
|
-
if (this.selectedCountry) {
|
|
2741
|
-
const e = this.options.separateDialCode ? 78 : 42, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + 6;
|
|
2742
|
-
this.telInput.style.paddingLeft = `${i}px`;
|
|
3001
|
+
const u = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
3002
|
+
this.ui.selectedDialCode.textContent = u, this.ui.updateInputPadding();
|
|
2743
3003
|
}
|
|
3004
|
+
return this._updatePlaceholder(), this._updateMaxLength(), a !== e;
|
|
2744
3005
|
}
|
|
2745
3006
|
//* Update the maximum valid number length for the currently selected country.
|
|
2746
3007
|
_updateMaxLength() {
|
|
2747
|
-
const { strictMode: e, placeholderNumberType: $, validationNumberTypes: i } = this.options, { iso2:
|
|
2748
|
-
if (e &&
|
|
2749
|
-
if (
|
|
2750
|
-
const
|
|
2751
|
-
let
|
|
2752
|
-
|
|
3008
|
+
const { strictMode: e, placeholderNumberType: $, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
|
|
3009
|
+
if (e && m.utils)
|
|
3010
|
+
if (s) {
|
|
3011
|
+
const a = m.utils.numberType[$];
|
|
3012
|
+
let u = m.utils.getExampleNumber(
|
|
3013
|
+
s,
|
|
2753
3014
|
!1,
|
|
2754
|
-
|
|
3015
|
+
a,
|
|
2755
3016
|
!0
|
|
2756
|
-
),
|
|
2757
|
-
for (;
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
3017
|
+
), f = u;
|
|
3018
|
+
for (; m.utils.isPossibleNumber(
|
|
3019
|
+
u,
|
|
3020
|
+
s,
|
|
3021
|
+
i
|
|
3022
|
+
); )
|
|
3023
|
+
f = u, u += "0";
|
|
3024
|
+
const C = m.utils.getCoreNumber(f, s);
|
|
3025
|
+
this.maxCoreNumberLength = C.length, s === "by" && (this.maxCoreNumberLength = C.length + 1);
|
|
2761
3026
|
} else
|
|
2762
3027
|
this.maxCoreNumberLength = null;
|
|
2763
3028
|
}
|
|
2764
|
-
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2765
|
-
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2766
|
-
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2767
|
-
//* and then to inject a deep clone of the selectedCountry element.
|
|
2768
|
-
_getHiddenSelectedCountryWidth() {
|
|
2769
|
-
if (this.telInput.parentNode) {
|
|
2770
|
-
let e;
|
|
2771
|
-
try {
|
|
2772
|
-
e = window.top.document.body;
|
|
2773
|
-
} catch {
|
|
2774
|
-
e = document.body;
|
|
2775
|
-
}
|
|
2776
|
-
const $ = this.telInput.parentNode.cloneNode(!1);
|
|
2777
|
-
$.style.visibility = "hidden", e.appendChild($);
|
|
2778
|
-
const i = this.countryContainer.cloneNode();
|
|
2779
|
-
$.appendChild(i);
|
|
2780
|
-
const r = this.selectedCountry.cloneNode(!0);
|
|
2781
|
-
i.appendChild(r);
|
|
2782
|
-
const u = r.offsetWidth;
|
|
2783
|
-
return e.removeChild($), u;
|
|
2784
|
-
}
|
|
2785
|
-
return 0;
|
|
2786
|
-
}
|
|
2787
3029
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
2788
3030
|
_updatePlaceholder() {
|
|
2789
3031
|
const {
|
|
2790
3032
|
autoPlaceholder: e,
|
|
2791
3033
|
placeholderNumberType: $,
|
|
2792
3034
|
nationalMode: i,
|
|
2793
|
-
customPlaceholder:
|
|
2794
|
-
} = this.options,
|
|
2795
|
-
if (
|
|
2796
|
-
const
|
|
2797
|
-
let
|
|
3035
|
+
customPlaceholder: s
|
|
3036
|
+
} = this.options, a = e === "aggressive" || !this.ui.hadInitialPlaceholder && e === "polite";
|
|
3037
|
+
if (m.utils && a) {
|
|
3038
|
+
const u = m.utils.numberType[$];
|
|
3039
|
+
let f = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
|
|
2798
3040
|
this.selectedCountryData.iso2,
|
|
2799
3041
|
i,
|
|
2800
|
-
|
|
3042
|
+
u
|
|
2801
3043
|
) : "";
|
|
2802
|
-
|
|
3044
|
+
f = this._beforeSetNumber(f), typeof s == "function" && (f = s(f, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", f);
|
|
2803
3045
|
}
|
|
2804
3046
|
}
|
|
2805
3047
|
//* Called when the user selects a list item from the dropdown.
|
|
2806
3048
|
_selectListItem(e) {
|
|
2807
|
-
const $ = e.
|
|
3049
|
+
const $ = e.dataset[I0.COUNTRY_CODE], i = this._setCountry($);
|
|
2808
3050
|
this._closeDropdown();
|
|
2809
|
-
const
|
|
2810
|
-
this._updateDialCode(
|
|
3051
|
+
const s = e.dataset[I0.DIAL_CODE];
|
|
3052
|
+
this._updateDialCode(s), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this.ui.telInput.focus(), i && this._triggerCountryChange();
|
|
2811
3053
|
}
|
|
2812
3054
|
//* Close the dropdown and unbind any listeners.
|
|
2813
3055
|
_closeDropdown() {
|
|
2814
|
-
this.dropdownContent.classList.add(
|
|
2815
|
-
"click",
|
|
2816
|
-
this._handleClickOffToClose
|
|
2817
|
-
), this.countryList.removeEventListener(
|
|
2818
|
-
"mouseover",
|
|
2819
|
-
this._handleMouseoverCountryList
|
|
2820
|
-
), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
|
|
2821
|
-
}
|
|
2822
|
-
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2823
|
-
_scrollTo(e) {
|
|
2824
|
-
const $ = this.countryList, i = document.documentElement.scrollTop, r = $.offsetHeight, u = $.getBoundingClientRect().top + i, h = u + r, c = e.offsetHeight, C = e.getBoundingClientRect().top + i, g = C + c, I = C - u + $.scrollTop;
|
|
2825
|
-
if (C < u)
|
|
2826
|
-
$.scrollTop = I;
|
|
2827
|
-
else if (g > h) {
|
|
2828
|
-
const w = r - c;
|
|
2829
|
-
$.scrollTop = I - w;
|
|
2830
|
-
}
|
|
3056
|
+
this.ui.dropdownContent.classList.contains(E.HIDE) || (this.ui.dropdownContent.classList.add(E.HIDE), this.ui.selectedCountry.setAttribute(L.EXPANDED, "false"), this.ui.highlightedItem && this.ui.highlightedItem.setAttribute(L.SELECTED, "false"), this.options.countrySearch && this.ui.searchInput.removeAttribute(L.ACTIVE_DESCENDANT), this.ui.dropdownArrow.classList.remove(E.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(g1.CLOSE_COUNTRY_DROPDOWN));
|
|
2831
3057
|
}
|
|
2832
3058
|
//* Replace any existing dial code with the new one
|
|
2833
3059
|
//* Note: called from _selectListItem and setCountry
|
|
2834
3060
|
_updateDialCode(e) {
|
|
2835
|
-
const $ = this.telInput.value, i = `+${e}`;
|
|
2836
|
-
let
|
|
2837
|
-
if ($.
|
|
2838
|
-
const
|
|
2839
|
-
|
|
3061
|
+
const $ = this.ui.telInput.value, i = `+${e}`;
|
|
3062
|
+
let s;
|
|
3063
|
+
if ($.startsWith("+")) {
|
|
3064
|
+
const a = this._getDialCode($);
|
|
3065
|
+
a ? s = $.replace(a, i) : s = i, this.ui.telInput.value = s;
|
|
2840
3066
|
}
|
|
2841
3067
|
}
|
|
2842
3068
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2843
3069
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2844
3070
|
_getDialCode(e, $) {
|
|
2845
3071
|
let i = "";
|
|
2846
|
-
if (e.
|
|
2847
|
-
let
|
|
2848
|
-
for (let
|
|
2849
|
-
const
|
|
2850
|
-
if (/[0-9]/.test(
|
|
2851
|
-
if (
|
|
3072
|
+
if (e.startsWith("+")) {
|
|
3073
|
+
let s = "";
|
|
3074
|
+
for (let a = 0; a < e.length; a++) {
|
|
3075
|
+
const u = e.charAt(a);
|
|
3076
|
+
if (/[0-9]/.test(u)) {
|
|
3077
|
+
if (s += u, !!!this.dialCodeToIso2Map[s])
|
|
2852
3078
|
break;
|
|
2853
3079
|
if ($)
|
|
2854
|
-
i = e.substring(0,
|
|
2855
|
-
else if (this.dialCodes.has(
|
|
2856
|
-
i = e.substring(0,
|
|
3080
|
+
i = e.substring(0, a + 1);
|
|
3081
|
+
else if (this.dialCodes.has(s)) {
|
|
3082
|
+
i = e.substring(0, a + 1);
|
|
2857
3083
|
break;
|
|
2858
3084
|
}
|
|
2859
|
-
if (
|
|
3085
|
+
if (s.length === this.dialCodeMaxLen)
|
|
2860
3086
|
break;
|
|
2861
3087
|
}
|
|
2862
3088
|
}
|
|
@@ -2865,14 +3091,14 @@ class f1 {
|
|
|
2865
3091
|
}
|
|
2866
3092
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2867
3093
|
_getFullNumber(e) {
|
|
2868
|
-
const $ = e || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
|
|
2869
|
-
let
|
|
2870
|
-
const
|
|
2871
|
-
return this.options.separateDialCode &&
|
|
3094
|
+
const $ = e || this.ui.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
|
|
3095
|
+
let s;
|
|
3096
|
+
const a = m1($);
|
|
3097
|
+
return this.options.separateDialCode && !$.startsWith("+") && i && a ? s = `+${i}` : s = "", s + $;
|
|
2872
3098
|
}
|
|
2873
3099
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2874
3100
|
_beforeSetNumber(e) {
|
|
2875
|
-
const $ = this._getDialCode(e), i =
|
|
3101
|
+
const $ = this._getDialCode(e), i = y2(
|
|
2876
3102
|
e,
|
|
2877
3103
|
$,
|
|
2878
3104
|
this.options.separateDialCode,
|
|
@@ -2882,55 +3108,38 @@ class f1 {
|
|
|
2882
3108
|
}
|
|
2883
3109
|
//* Trigger the 'countrychange' event.
|
|
2884
3110
|
_triggerCountryChange() {
|
|
2885
|
-
this._trigger(
|
|
3111
|
+
this._trigger(g1.COUNTRY_CHANGE);
|
|
2886
3112
|
}
|
|
2887
3113
|
//**************************
|
|
2888
3114
|
//* SECRET PUBLIC METHODS
|
|
2889
3115
|
//**************************
|
|
2890
3116
|
//* This is called when the geoip call returns.
|
|
2891
3117
|
handleAutoCountry() {
|
|
2892
|
-
this.options.initialCountry ===
|
|
3118
|
+
this.options.initialCountry === T1.AUTO && m.autoCountry && (this.defaultCountry = m.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(E.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2893
3119
|
}
|
|
2894
3120
|
//* This is called when the utils request completes.
|
|
2895
3121
|
handleUtils() {
|
|
2896
|
-
|
|
3122
|
+
m.utils && (this.ui.telInput.value && this._updateValFromNumber(this.ui.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2897
3123
|
}
|
|
2898
3124
|
//********************
|
|
2899
3125
|
//* PUBLIC METHODS
|
|
2900
3126
|
//********************
|
|
2901
3127
|
//* Remove plugin.
|
|
2902
3128
|
destroy() {
|
|
2903
|
-
|
|
2904
|
-
this.telInput.iti = void 0;
|
|
2905
|
-
const { allowDropdown: e, separateDialCode: $ } = this.options;
|
|
2906
|
-
if (e) {
|
|
2907
|
-
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2908
|
-
"click",
|
|
2909
|
-
this._handleClickSelectedCountry
|
|
2910
|
-
), this.countryContainer.removeEventListener(
|
|
2911
|
-
"keydown",
|
|
2912
|
-
this._handleCountryContainerKeydown
|
|
2913
|
-
);
|
|
2914
|
-
const c = this.telInput.closest("label");
|
|
2915
|
-
c && c.removeEventListener("click", this._handleLabelClick);
|
|
2916
|
-
}
|
|
2917
|
-
const { form: i } = this.telInput;
|
|
2918
|
-
this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this._handlePasteEvent && this.telInput.removeEventListener("paste", this._handlePasteEvent), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this.telInput.removeAttribute("data-intl-tel-input-id"), $ && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2919
|
-
const r = this.telInput.parentNode;
|
|
2920
|
-
(u = r == null ? void 0 : r.parentNode) == null || u.insertBefore(this.telInput, r), (h = r == null ? void 0 : r.parentNode) == null || h.removeChild(r), delete y.instances[this.id];
|
|
3129
|
+
this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), m.instances instanceof Map ? m.instances.delete(this.id) : delete m.instances[this.id]);
|
|
2921
3130
|
}
|
|
2922
3131
|
//* Get the extension from the current number.
|
|
2923
3132
|
getExtension() {
|
|
2924
|
-
return
|
|
3133
|
+
return m.utils ? m.utils.getExtension(
|
|
2925
3134
|
this._getFullNumber(),
|
|
2926
3135
|
this.selectedCountryData.iso2
|
|
2927
3136
|
) : "";
|
|
2928
3137
|
}
|
|
2929
3138
|
//* Format the number to the given format.
|
|
2930
3139
|
getNumber(e) {
|
|
2931
|
-
if (
|
|
3140
|
+
if (m.utils) {
|
|
2932
3141
|
const { iso2: $ } = this.selectedCountryData;
|
|
2933
|
-
return
|
|
3142
|
+
return m.utils.formatNumber(
|
|
2934
3143
|
this._getFullNumber(),
|
|
2935
3144
|
$,
|
|
2936
3145
|
e
|
|
@@ -2940,10 +3149,10 @@ class f1 {
|
|
|
2940
3149
|
}
|
|
2941
3150
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
2942
3151
|
getNumberType() {
|
|
2943
|
-
return
|
|
3152
|
+
return m.utils ? m.utils.getNumberType(
|
|
2944
3153
|
this._getFullNumber(),
|
|
2945
3154
|
this.selectedCountryData.iso2
|
|
2946
|
-
) :
|
|
3155
|
+
) : y0.UNKNOWN_NUMBER_TYPE;
|
|
2947
3156
|
}
|
|
2948
3157
|
//* Get the country data for the currently selected country.
|
|
2949
3158
|
getSelectedCountryData() {
|
|
@@ -2951,18 +3160,18 @@ class f1 {
|
|
|
2951
3160
|
}
|
|
2952
3161
|
//* Get the validation error.
|
|
2953
3162
|
getValidationError() {
|
|
2954
|
-
if (
|
|
3163
|
+
if (m.utils) {
|
|
2955
3164
|
const { iso2: e } = this.selectedCountryData;
|
|
2956
|
-
return
|
|
3165
|
+
return m.utils.getValidationError(this._getFullNumber(), e);
|
|
2957
3166
|
}
|
|
2958
|
-
return
|
|
3167
|
+
return y0.UNKNOWN_VALIDATION_ERROR;
|
|
2959
3168
|
}
|
|
2960
3169
|
//* Validate the input val using number length only
|
|
2961
3170
|
isValidNumber() {
|
|
2962
3171
|
const { dialCode: e, iso2: $ } = this.selectedCountryData;
|
|
2963
|
-
if (e ===
|
|
2964
|
-
const i = this._getFullNumber(),
|
|
2965
|
-
if (
|
|
3172
|
+
if (e === b1.DIAL_CODE && m.utils) {
|
|
3173
|
+
const i = this._getFullNumber(), s = m.utils.getCoreNumber(i, $);
|
|
3174
|
+
if (s[0] === b1.MOBILE_PREFIX && s.length !== b1.MOBILE_CORE_LENGTH)
|
|
2966
3175
|
return !1;
|
|
2967
3176
|
}
|
|
2968
3177
|
return this._validateNumber(!1);
|
|
@@ -2972,134 +3181,153 @@ class f1 {
|
|
|
2972
3181
|
return this._validateNumber(!0);
|
|
2973
3182
|
}
|
|
2974
3183
|
_utilsIsPossibleNumber(e) {
|
|
2975
|
-
return
|
|
3184
|
+
return m.utils ? m.utils.isPossibleNumber(
|
|
3185
|
+
e,
|
|
3186
|
+
this.selectedCountryData.iso2,
|
|
3187
|
+
this.options.validationNumberTypes
|
|
3188
|
+
) : null;
|
|
2976
3189
|
}
|
|
2977
3190
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
2978
3191
|
_validateNumber(e) {
|
|
2979
|
-
if (!
|
|
3192
|
+
if (!m.utils)
|
|
2980
3193
|
return null;
|
|
2981
3194
|
if (!this.selectedCountryData.iso2)
|
|
2982
3195
|
return !1;
|
|
2983
|
-
const $ = (
|
|
2984
|
-
if (
|
|
2985
|
-
const
|
|
2986
|
-
return
|
|
3196
|
+
const $ = (u) => e ? this._utilsIsValidNumber(u) : this._utilsIsPossibleNumber(u), i = this._getFullNumber(), s = i.search(q.ALPHA_UNICODE);
|
|
3197
|
+
if (s > -1 && !this.options.allowPhonewords) {
|
|
3198
|
+
const u = i.substring(0, s), f = $(u), C = $(i);
|
|
3199
|
+
return f && C;
|
|
2987
3200
|
}
|
|
2988
3201
|
return $(i);
|
|
2989
3202
|
}
|
|
2990
3203
|
_utilsIsValidNumber(e) {
|
|
2991
|
-
return
|
|
3204
|
+
return m.utils ? m.utils.isValidNumber(
|
|
3205
|
+
e,
|
|
3206
|
+
this.selectedCountryData.iso2,
|
|
3207
|
+
this.options.validationNumberTypes
|
|
3208
|
+
) : null;
|
|
2992
3209
|
}
|
|
2993
3210
|
//* Update the selected country, and update the input val accordingly.
|
|
2994
3211
|
setCountry(e) {
|
|
2995
3212
|
const $ = e == null ? void 0 : e.toLowerCase();
|
|
2996
|
-
if (!
|
|
3213
|
+
if (!P1($))
|
|
2997
3214
|
throw new Error(`Invalid country code: '${$}'`);
|
|
2998
3215
|
const i = this.selectedCountryData.iso2;
|
|
2999
|
-
(e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.telInput.value), this._triggerCountryChange());
|
|
3216
|
+
(e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this._triggerCountryChange());
|
|
3000
3217
|
}
|
|
3001
3218
|
//* Set the input value and update the country.
|
|
3002
3219
|
setNumber(e) {
|
|
3003
3220
|
const $ = this._updateCountryFromNumber(e);
|
|
3004
|
-
this._updateValFromNumber(e), $ && this._triggerCountryChange(), this._trigger(
|
|
3221
|
+
this._updateValFromNumber(e), $ && this._triggerCountryChange(), this._trigger(g1.INPUT, { isSetNumber: !0 });
|
|
3005
3222
|
}
|
|
3006
3223
|
//* Set the placeholder number typ
|
|
3007
3224
|
setPlaceholderNumberType(e) {
|
|
3008
3225
|
this.options.placeholderNumberType = e, this._updatePlaceholder();
|
|
3009
3226
|
}
|
|
3010
3227
|
setDisabled(e) {
|
|
3011
|
-
this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
3228
|
+
this.ui.telInput.disabled = e, e ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
|
|
3012
3229
|
}
|
|
3013
3230
|
}
|
|
3014
|
-
const
|
|
3015
|
-
if (!
|
|
3231
|
+
const L2 = (h) => {
|
|
3232
|
+
if (!m.utils && !m.startedLoadingUtilsScript) {
|
|
3016
3233
|
let e;
|
|
3017
|
-
if (typeof
|
|
3234
|
+
if (typeof h == "function")
|
|
3018
3235
|
try {
|
|
3019
|
-
e = Promise.resolve(
|
|
3236
|
+
e = Promise.resolve(h());
|
|
3020
3237
|
} catch ($) {
|
|
3021
3238
|
return Promise.reject($);
|
|
3022
3239
|
}
|
|
3023
3240
|
else
|
|
3024
|
-
return Promise.reject(
|
|
3025
|
-
|
|
3241
|
+
return Promise.reject(
|
|
3242
|
+
new TypeError(
|
|
3243
|
+
`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof h}`
|
|
3244
|
+
)
|
|
3245
|
+
);
|
|
3246
|
+
return m.startedLoadingUtilsScript = !0, e.then(($) => {
|
|
3026
3247
|
const i = $ == null ? void 0 : $.default;
|
|
3027
3248
|
if (!i || typeof i != "object")
|
|
3028
|
-
throw new TypeError(
|
|
3029
|
-
|
|
3249
|
+
throw new TypeError(
|
|
3250
|
+
"The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
|
|
3251
|
+
);
|
|
3252
|
+
return m.utils = i, r1("handleUtils"), !0;
|
|
3030
3253
|
}).catch(($) => {
|
|
3031
|
-
throw
|
|
3254
|
+
throw r1("rejectUtilsScriptPromise", $), $;
|
|
3032
3255
|
});
|
|
3033
3256
|
}
|
|
3034
3257
|
return null;
|
|
3035
|
-
},
|
|
3036
|
-
(
|
|
3037
|
-
const
|
|
3038
|
-
|
|
3258
|
+
}, r1 = (h, ...e) => {
|
|
3259
|
+
Object.values(m.instances).forEach(($) => {
|
|
3260
|
+
const i = $[h];
|
|
3261
|
+
typeof i == "function" && i.apply($, e);
|
|
3262
|
+
});
|
|
3263
|
+
}, m = Object.assign(
|
|
3264
|
+
(h, e) => {
|
|
3265
|
+
const $ = new M1(h, e);
|
|
3266
|
+
return m.instances[$.id] = $, h.iti = $, $;
|
|
3039
3267
|
},
|
|
3040
3268
|
{
|
|
3041
|
-
defaults:
|
|
3269
|
+
defaults: S0,
|
|
3042
3270
|
//* Using a static var like this allows us to mock it in the tests.
|
|
3043
3271
|
documentReady: () => document.readyState === "complete",
|
|
3044
3272
|
//* Get the country data object.
|
|
3045
|
-
getCountryData: () =>
|
|
3273
|
+
getCountryData: () => Q,
|
|
3046
3274
|
//* A getter for the plugin instance.
|
|
3047
|
-
getInstance: (
|
|
3048
|
-
const e =
|
|
3049
|
-
return e ?
|
|
3275
|
+
getInstance: (h) => {
|
|
3276
|
+
const e = h.dataset.intlTelInputId;
|
|
3277
|
+
return e ? m.instances[e] : null;
|
|
3050
3278
|
},
|
|
3051
3279
|
//* A map from instance ID to instance object.
|
|
3052
3280
|
instances: {},
|
|
3053
|
-
attachUtils:
|
|
3281
|
+
attachUtils: L2,
|
|
3054
3282
|
startedLoadingUtilsScript: !1,
|
|
3055
3283
|
startedLoadingAutoCountry: !1,
|
|
3056
|
-
version: "25.
|
|
3284
|
+
version: "25.11.1"
|
|
3057
3285
|
}
|
|
3058
3286
|
);
|
|
3059
3287
|
(function() {
|
|
3060
|
-
var
|
|
3288
|
+
var h = this || self;
|
|
3061
3289
|
function e(d, t) {
|
|
3062
3290
|
d = d.split(".");
|
|
3063
|
-
var n =
|
|
3291
|
+
var n = h;
|
|
3064
3292
|
d[0] in n || typeof n.execScript > "u" || n.execScript("var " + d[0]);
|
|
3065
|
-
for (var
|
|
3293
|
+
for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ? n[r] && n[r] !== Object.prototype[r] ? n = n[r] : n = n[r] = {} : n[r] = t;
|
|
3066
3294
|
}
|
|
3067
3295
|
function $(d, t) {
|
|
3068
3296
|
function n() {
|
|
3069
3297
|
}
|
|
3070
|
-
n.prototype = t.prototype, d.ma = t.prototype, d.prototype = new n(), d.prototype.constructor = d, d.sa = function(
|
|
3071
|
-
for (var
|
|
3072
|
-
return t.prototype[o].apply(
|
|
3298
|
+
n.prototype = t.prototype, d.ma = t.prototype, d.prototype = new n(), d.prototype.constructor = d, d.sa = function(r, o, l) {
|
|
3299
|
+
for (var c = Array(arguments.length - 2), p = 2; p < arguments.length; p++) c[p - 2] = arguments[p];
|
|
3300
|
+
return t.prototype[o].apply(r, c);
|
|
3073
3301
|
};
|
|
3074
3302
|
}
|
|
3075
3303
|
function i(d) {
|
|
3076
3304
|
const t = [];
|
|
3077
3305
|
let n = 0;
|
|
3078
|
-
for (const
|
|
3306
|
+
for (const r in d) t[n++] = d[r];
|
|
3079
3307
|
return t;
|
|
3080
3308
|
}
|
|
3081
|
-
var
|
|
3309
|
+
var s = class {
|
|
3082
3310
|
constructor(d) {
|
|
3083
|
-
if (
|
|
3311
|
+
if (a !== a) throw Error("SafeUrl is not meant to be built directly");
|
|
3084
3312
|
this.g = d;
|
|
3085
3313
|
}
|
|
3086
3314
|
toString() {
|
|
3087
3315
|
return this.g.toString();
|
|
3088
3316
|
}
|
|
3089
|
-
},
|
|
3090
|
-
new
|
|
3091
|
-
const
|
|
3092
|
-
class
|
|
3317
|
+
}, a = {};
|
|
3318
|
+
new s("about:invalid#zClosurez"), new s("about:blank");
|
|
3319
|
+
const u = {};
|
|
3320
|
+
class f {
|
|
3093
3321
|
constructor() {
|
|
3094
|
-
if (
|
|
3322
|
+
if (u !== u) throw Error("SafeStyle is not meant to be built directly");
|
|
3095
3323
|
}
|
|
3096
3324
|
toString() {
|
|
3097
3325
|
return "";
|
|
3098
3326
|
}
|
|
3099
3327
|
}
|
|
3100
|
-
new
|
|
3328
|
+
new f();
|
|
3101
3329
|
const C = {};
|
|
3102
|
-
class
|
|
3330
|
+
class I {
|
|
3103
3331
|
constructor() {
|
|
3104
3332
|
if (C !== C) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
3105
3333
|
}
|
|
@@ -3107,98 +3335,98 @@ const n2 = (f) => {
|
|
|
3107
3335
|
return "";
|
|
3108
3336
|
}
|
|
3109
3337
|
}
|
|
3110
|
-
new
|
|
3111
|
-
const
|
|
3112
|
-
class
|
|
3338
|
+
new I();
|
|
3339
|
+
const _ = {};
|
|
3340
|
+
class A {
|
|
3113
3341
|
constructor() {
|
|
3114
|
-
var t =
|
|
3115
|
-
if (
|
|
3342
|
+
var t = h.trustedTypes && h.trustedTypes.emptyHTML || "";
|
|
3343
|
+
if (_ !== _) throw Error("SafeHtml is not meant to be built directly");
|
|
3116
3344
|
this.g = t;
|
|
3117
3345
|
}
|
|
3118
3346
|
toString() {
|
|
3119
3347
|
return this.g.toString();
|
|
3120
3348
|
}
|
|
3121
3349
|
}
|
|
3122
|
-
new
|
|
3123
|
-
function
|
|
3350
|
+
new A();
|
|
3351
|
+
function v(d, t) {
|
|
3124
3352
|
switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
|
|
3125
|
-
case
|
|
3353
|
+
case k:
|
|
3126
3354
|
case P:
|
|
3127
|
-
case
|
|
3128
|
-
case
|
|
3129
|
-
case
|
|
3130
|
-
case
|
|
3131
|
-
case
|
|
3355
|
+
case B:
|
|
3356
|
+
case W:
|
|
3357
|
+
case y1:
|
|
3358
|
+
case T:
|
|
3359
|
+
case N:
|
|
3132
3360
|
this.o = !0;
|
|
3133
3361
|
}
|
|
3134
3362
|
this.j = t.defaultValue;
|
|
3135
3363
|
}
|
|
3136
|
-
var
|
|
3137
|
-
function
|
|
3364
|
+
var N = 1, T = 2, k = 3, P = 4, B = 6, W = 16, y1 = 18;
|
|
3365
|
+
function w0(d, t) {
|
|
3138
3366
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
3139
3367
|
var n = t[d];
|
|
3140
3368
|
this.g[n.g] = n;
|
|
3141
3369
|
}
|
|
3142
3370
|
}
|
|
3143
|
-
function
|
|
3371
|
+
function b0(d) {
|
|
3144
3372
|
return d = i(d.g), d.sort(function(t, n) {
|
|
3145
3373
|
return t.g - n.g;
|
|
3146
3374
|
}), d;
|
|
3147
3375
|
}
|
|
3148
|
-
function
|
|
3376
|
+
function U() {
|
|
3149
3377
|
this.h = {}, this.j = this.m().g, this.g = this.l = null;
|
|
3150
3378
|
}
|
|
3151
|
-
|
|
3152
|
-
return
|
|
3153
|
-
},
|
|
3154
|
-
return
|
|
3155
|
-
},
|
|
3156
|
-
|
|
3157
|
-
},
|
|
3158
|
-
|
|
3379
|
+
U.prototype.has = function(d) {
|
|
3380
|
+
return G(this, d.g);
|
|
3381
|
+
}, U.prototype.get = function(d, t) {
|
|
3382
|
+
return g(this, d.g, t);
|
|
3383
|
+
}, U.prototype.set = function(d, t) {
|
|
3384
|
+
M(this, d.g, t);
|
|
3385
|
+
}, U.prototype.add = function(d, t) {
|
|
3386
|
+
O1(this, d.g, t);
|
|
3159
3387
|
};
|
|
3160
|
-
function
|
|
3161
|
-
for (var n =
|
|
3162
|
-
var o = n[
|
|
3163
|
-
if (
|
|
3388
|
+
function R1(d, t) {
|
|
3389
|
+
for (var n = b0(d.m()), r = 0; r < n.length; r++) {
|
|
3390
|
+
var o = n[r], l = o.g;
|
|
3391
|
+
if (G(t, l)) {
|
|
3164
3392
|
d.g && delete d.g[o.g];
|
|
3165
|
-
var
|
|
3393
|
+
var c = o.h == 11 || o.h == 10;
|
|
3166
3394
|
if (o.l) {
|
|
3167
|
-
o =
|
|
3168
|
-
for (var p = 0; p < o.length; p++)
|
|
3169
|
-
} else o =
|
|
3395
|
+
o = O(t, l);
|
|
3396
|
+
for (var p = 0; p < o.length; p++) O1(d, l, c ? o[p].clone() : o[p]);
|
|
3397
|
+
} else o = o1(t, l), c ? (c = o1(d, l)) ? R1(c, o) : M(d, l, o.clone()) : M(d, l, o);
|
|
3170
3398
|
}
|
|
3171
3399
|
}
|
|
3172
3400
|
}
|
|
3173
|
-
|
|
3401
|
+
U.prototype.clone = function() {
|
|
3174
3402
|
var d = new this.constructor();
|
|
3175
|
-
return d != this && (d.h = {}, d.g && (d.g = {}),
|
|
3403
|
+
return d != this && (d.h = {}, d.g && (d.g = {}), R1(d, this)), d;
|
|
3176
3404
|
};
|
|
3177
|
-
function
|
|
3405
|
+
function G(d, t) {
|
|
3178
3406
|
return d.h[t] != null;
|
|
3179
3407
|
}
|
|
3180
|
-
function
|
|
3408
|
+
function o1(d, t) {
|
|
3181
3409
|
var n = d.h[t];
|
|
3182
3410
|
if (n == null) return null;
|
|
3183
3411
|
if (d.l) {
|
|
3184
3412
|
if (!(t in d.g)) {
|
|
3185
|
-
var
|
|
3413
|
+
var r = d.l, o = d.j[t];
|
|
3186
3414
|
if (n != null) if (o.l) {
|
|
3187
|
-
for (var l = [],
|
|
3415
|
+
for (var l = [], c = 0; c < n.length; c++) l[c] = r.h(o, n[c]);
|
|
3188
3416
|
n = l;
|
|
3189
|
-
} else n =
|
|
3417
|
+
} else n = r.h(o, n);
|
|
3190
3418
|
return d.g[t] = n;
|
|
3191
3419
|
}
|
|
3192
3420
|
return d.g[t];
|
|
3193
3421
|
}
|
|
3194
3422
|
return n;
|
|
3195
3423
|
}
|
|
3196
|
-
function
|
|
3197
|
-
var
|
|
3198
|
-
return d.j[t].l ?
|
|
3424
|
+
function g(d, t, n) {
|
|
3425
|
+
var r = o1(d, t);
|
|
3426
|
+
return d.j[t].l ? r[n || 0] : r;
|
|
3199
3427
|
}
|
|
3200
3428
|
function S(d, t) {
|
|
3201
|
-
if (
|
|
3429
|
+
if (G(d, t)) d = g(d, t);
|
|
3202
3430
|
else d: {
|
|
3203
3431
|
if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
|
|
3204
3432
|
else if (t === Number) d.j = 0;
|
|
@@ -3211,88 +3439,88 @@ const n2 = (f) => {
|
|
|
3211
3439
|
}
|
|
3212
3440
|
return d;
|
|
3213
3441
|
}
|
|
3214
|
-
function
|
|
3215
|
-
return
|
|
3442
|
+
function O(d, t) {
|
|
3443
|
+
return o1(d, t) || [];
|
|
3216
3444
|
}
|
|
3217
|
-
function
|
|
3218
|
-
return d.j[t].l ?
|
|
3445
|
+
function j(d, t) {
|
|
3446
|
+
return d.j[t].l ? G(d, t) ? d.h[t].length : 0 : G(d, t) ? 1 : 0;
|
|
3219
3447
|
}
|
|
3220
|
-
function
|
|
3448
|
+
function M(d, t, n) {
|
|
3221
3449
|
d.h[t] = n, d.g && (d.g[t] = n);
|
|
3222
3450
|
}
|
|
3223
|
-
function
|
|
3451
|
+
function O1(d, t, n) {
|
|
3224
3452
|
d.h[t] || (d.h[t] = []), d.h[t].push(n), d.g && delete d.g[t];
|
|
3225
3453
|
}
|
|
3226
|
-
function
|
|
3227
|
-
var n = [],
|
|
3228
|
-
for (
|
|
3229
|
-
return new
|
|
3454
|
+
function u1(d, t) {
|
|
3455
|
+
var n = [], r;
|
|
3456
|
+
for (r in t) r != 0 && n.push(new v(r, t[r]));
|
|
3457
|
+
return new w0(d, n);
|
|
3230
3458
|
}
|
|
3231
|
-
function
|
|
3459
|
+
function l1() {
|
|
3232
3460
|
}
|
|
3233
|
-
|
|
3461
|
+
l1.prototype.g = function(d) {
|
|
3234
3462
|
throw new d.h(), Error("Unimplemented");
|
|
3235
|
-
},
|
|
3236
|
-
if (d.h == 11 || d.h == 10) return t instanceof
|
|
3237
|
-
if (d.h == 14) return typeof t == "string" &&
|
|
3463
|
+
}, l1.prototype.h = function(d, t) {
|
|
3464
|
+
if (d.h == 11 || d.h == 10) return t instanceof U ? t : this.g(d.s.prototype.m(), t);
|
|
3465
|
+
if (d.h == 14) return typeof t == "string" && x1.test(t) && (d = Number(t), 0 < d) ? d : t;
|
|
3238
3466
|
if (!d.o) return t;
|
|
3239
3467
|
if (d = d.s, d === String) {
|
|
3240
3468
|
if (typeof t == "number") return String(t);
|
|
3241
|
-
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" ||
|
|
3469
|
+
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || x1.test(t))) return Number(t);
|
|
3242
3470
|
return t;
|
|
3243
3471
|
};
|
|
3244
|
-
var
|
|
3245
|
-
function
|
|
3472
|
+
var x1 = /^-?[0-9]+$/;
|
|
3473
|
+
function I1() {
|
|
3246
3474
|
}
|
|
3247
|
-
$(
|
|
3475
|
+
$(I1, l1), I1.prototype.g = function(d, t) {
|
|
3248
3476
|
return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
|
|
3249
3477
|
};
|
|
3250
|
-
function
|
|
3478
|
+
function t1() {
|
|
3251
3479
|
}
|
|
3252
|
-
$(
|
|
3253
|
-
return d.h == 8 ? !!t :
|
|
3254
|
-
},
|
|
3255
|
-
return
|
|
3480
|
+
$(t1, I1), t1.prototype.h = function(d, t) {
|
|
3481
|
+
return d.h == 8 ? !!t : l1.prototype.h.apply(this, arguments);
|
|
3482
|
+
}, t1.prototype.g = function(d, t) {
|
|
3483
|
+
return t1.ma.g.call(this, d, t);
|
|
3256
3484
|
};
|
|
3257
|
-
function
|
|
3485
|
+
function D(d, t) {
|
|
3258
3486
|
d != null && this.g.apply(this, arguments);
|
|
3259
3487
|
}
|
|
3260
|
-
|
|
3488
|
+
D.prototype.h = "", D.prototype.set = function(d) {
|
|
3261
3489
|
this.h = "" + d;
|
|
3262
|
-
},
|
|
3263
|
-
if (this.h += String(d), t != null) for (let
|
|
3490
|
+
}, D.prototype.g = function(d, t, n) {
|
|
3491
|
+
if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
|
|
3264
3492
|
return this;
|
|
3265
3493
|
};
|
|
3266
|
-
function
|
|
3494
|
+
function H(d) {
|
|
3267
3495
|
d.h = "";
|
|
3268
3496
|
}
|
|
3269
|
-
|
|
3497
|
+
D.prototype.toString = function() {
|
|
3270
3498
|
return this.h;
|
|
3271
3499
|
};
|
|
3272
|
-
function
|
|
3273
|
-
|
|
3500
|
+
function Z() {
|
|
3501
|
+
U.call(this);
|
|
3274
3502
|
}
|
|
3275
|
-
$(
|
|
3276
|
-
var
|
|
3503
|
+
$(Z, U);
|
|
3504
|
+
var B1 = null;
|
|
3277
3505
|
function b() {
|
|
3278
|
-
|
|
3279
|
-
}
|
|
3280
|
-
$(b,
|
|
3281
|
-
var
|
|
3282
|
-
function
|
|
3283
|
-
|
|
3284
|
-
}
|
|
3285
|
-
$(
|
|
3286
|
-
var
|
|
3287
|
-
|
|
3288
|
-
var d =
|
|
3289
|
-
return d || (
|
|
3290
|
-
},
|
|
3291
|
-
var d =
|
|
3292
|
-
return d || (
|
|
3293
|
-
}, b.m = b.prototype.m,
|
|
3294
|
-
var d =
|
|
3295
|
-
return d || (
|
|
3506
|
+
U.call(this);
|
|
3507
|
+
}
|
|
3508
|
+
$(b, U);
|
|
3509
|
+
var U1 = null;
|
|
3510
|
+
function J() {
|
|
3511
|
+
U.call(this);
|
|
3512
|
+
}
|
|
3513
|
+
$(J, U);
|
|
3514
|
+
var G1 = null;
|
|
3515
|
+
Z.prototype.m = function() {
|
|
3516
|
+
var d = B1;
|
|
3517
|
+
return d || (B1 = d = u1(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;
|
|
3518
|
+
}, Z.m = Z.prototype.m, b.prototype.m = function() {
|
|
3519
|
+
var d = U1;
|
|
3520
|
+
return d || (U1 = d = u1(b, { 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;
|
|
3521
|
+
}, b.m = b.prototype.m, J.prototype.m = function() {
|
|
3522
|
+
var d = G1;
|
|
3523
|
+
return d || (G1 = d = u1(J, {
|
|
3296
3524
|
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
|
|
3297
3525
|
1: { name: "general_desc", i: 11, type: b },
|
|
3298
3526
|
2: { name: "fixed_line", i: 11, type: b },
|
|
@@ -3324,26 +3552,26 @@ const n2 = (f) => {
|
|
|
3324
3552
|
},
|
|
3325
3553
|
16: { name: "national_prefix_transform_rule", i: 9, type: String },
|
|
3326
3554
|
18: { name: "same_mobile_and_fixed_line_pattern", i: 8, defaultValue: !1, type: Boolean },
|
|
3327
|
-
19: { name: "number_format", aa: !0, i: 11, type:
|
|
3328
|
-
20: { name: "intl_number_format", aa: !0, i: 11, type:
|
|
3555
|
+
19: { name: "number_format", aa: !0, i: 11, type: Z },
|
|
3556
|
+
20: { name: "intl_number_format", aa: !0, i: 11, type: Z },
|
|
3329
3557
|
22: { name: "main_country_for_code", i: 8, defaultValue: !1, type: Boolean },
|
|
3330
3558
|
23: { name: "leading_digits", i: 9, type: String }
|
|
3331
3559
|
})), d;
|
|
3332
|
-
},
|
|
3333
|
-
function
|
|
3334
|
-
|
|
3335
|
-
}
|
|
3336
|
-
$(
|
|
3337
|
-
var
|
|
3338
|
-
|
|
3339
|
-
var d =
|
|
3340
|
-
return d || (
|
|
3560
|
+
}, J.m = J.prototype.m;
|
|
3561
|
+
function Y() {
|
|
3562
|
+
U.call(this);
|
|
3563
|
+
}
|
|
3564
|
+
$(Y, U);
|
|
3565
|
+
var H1 = null, T0 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
|
|
3566
|
+
Y.prototype.m = function() {
|
|
3567
|
+
var d = H1;
|
|
3568
|
+
return d || (H1 = d = u1(Y, { 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: T0 }, 7: {
|
|
3341
3569
|
name: "preferred_domestic_carrier_code",
|
|
3342
3570
|
i: 9,
|
|
3343
3571
|
type: String
|
|
3344
3572
|
} })), d;
|
|
3345
|
-
},
|
|
3346
|
-
var
|
|
3573
|
+
}, Y.ctor = Y, Y.ctor.m = Y.prototype.m;
|
|
3574
|
+
var e1 = {
|
|
3347
3575
|
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(" "),
|
|
3348
3576
|
7: ["RU", "KZ"],
|
|
3349
3577
|
20: ["EG"],
|
|
@@ -3559,7 +3787,7 @@ const n2 = (f) => {
|
|
|
3559
3787
|
995: ["GE"],
|
|
3560
3788
|
996: ["KG"],
|
|
3561
3789
|
998: ["UZ"]
|
|
3562
|
-
},
|
|
3790
|
+
}, k1 = {
|
|
3563
3791
|
AC: [, [
|
|
3564
3792
|
,
|
|
3565
3793
|
,
|
|
@@ -6108,7 +6336,7 @@ const n2 = (f) => {
|
|
|
6108
6336
|
,
|
|
6109
6337
|
,
|
|
6110
6338
|
[7, 8, 9]
|
|
6111
|
-
], [, , "(?:1(?:0[0-8]|1
|
|
6339
|
+
], [, , "(?:1(?:0[0-8]|1\\d|2[014]|[34]0)|7\\d\\d)\\d{6}", , , , "712123456", , , [9]], [, , "800[02-8]\\d{5,6}", , , , "800223456", , , [9, 10]], [, , "900[02-9]\\d{5}", , , , "900223456", , , [9]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "KE", 254, "000", "0", , , "0", , , , [[, "(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], [, "(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
|
|
6112
6340
|
KG: [, [
|
|
6113
6341
|
,
|
|
6114
6342
|
,
|
|
@@ -8164,7 +8392,7 @@ const n2 = (f) => {
|
|
|
8164
8392
|
,
|
|
8165
8393
|
,
|
|
8166
8394
|
[5, 6, 7]
|
|
8167
|
-
], [, , "72[48]0\\d{5}|7(?:[014-8]\\d|2[067]|36|9[
|
|
8395
|
+
], [, , "72[48]0\\d{5}|7(?:[014-8]\\d|2[067]|36|9[0-289])\\d{6}", , , , "712345678"], [, , "800[1-3]\\d{5}", , , , "800123456"], [, , "90[1-3]\\d{6}", , , , "901123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "UG", 256, "00[057]", "0", , , "0", , , , [[, "(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], [, "(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
|
|
8168
8396
|
US: [, [
|
|
8169
8397
|
,
|
|
8170
8398
|
,
|
|
@@ -8180,7 +8408,7 @@ const n2 = (f) => {
|
|
|
8180
8408
|
], [
|
|
8181
8409
|
,
|
|
8182
8410
|
,
|
|
8183
|
-
"
|
|
8411
|
+
"3052(?:0[0-8]|[1-9]\\d)\\d{4}|(?:2742|305[3-9])\\d{6}|(?:472|983)[2-47-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
|
|
8184
8412
|
,
|
|
8185
8413
|
,
|
|
8186
8414
|
,
|
|
@@ -8192,7 +8420,7 @@ const n2 = (f) => {
|
|
|
8192
8420
|
], [
|
|
8193
8421
|
,
|
|
8194
8422
|
,
|
|
8195
|
-
"
|
|
8423
|
+
"3052(?:0[0-8]|[1-9]\\d)\\d{4}|(?:2742|305[3-9])\\d{6}|(?:472|983)[2-47-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
|
|
8196
8424
|
,
|
|
8197
8425
|
,
|
|
8198
8426
|
,
|
|
@@ -8693,13 +8921,13 @@ const n2 = (f) => {
|
|
|
8693
8921
|
], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 888, , , , , , , , 1, [[, "(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "\\d{11}", , , , "12345678901"], , , [, , , , , , , , , [-1]]],
|
|
8694
8922
|
979: [, [, , "[1359]\\d{8}", , , , , , , [9], [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "[1359]\\d{8}", , , , "123456789", , , , [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 979, , , , , , , , 1, [[, "(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]]
|
|
8695
8923
|
};
|
|
8696
|
-
function
|
|
8924
|
+
function R() {
|
|
8697
8925
|
this.g = {};
|
|
8698
8926
|
}
|
|
8699
|
-
|
|
8700
|
-
return
|
|
8927
|
+
R.h = void 0, R.g = function() {
|
|
8928
|
+
return R.h ? R.h : R.h = new R();
|
|
8701
8929
|
};
|
|
8702
|
-
var
|
|
8930
|
+
var _1 = { 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" }, D0 = {
|
|
8703
8931
|
0: "0",
|
|
8704
8932
|
1: "1",
|
|
8705
8933
|
2: "2",
|
|
@@ -8713,7 +8941,7 @@ const n2 = (f) => {
|
|
|
8713
8941
|
"+": "+",
|
|
8714
8942
|
"*": "*",
|
|
8715
8943
|
"#": "#"
|
|
8716
|
-
},
|
|
8944
|
+
}, v0 = {
|
|
8717
8945
|
0: "0",
|
|
8718
8946
|
1: "1",
|
|
8719
8947
|
2: "2",
|
|
@@ -8780,154 +9008,154 @@ const n2 = (f) => {
|
|
|
8780
9008
|
X: "9",
|
|
8781
9009
|
Y: "9",
|
|
8782
9010
|
Z: "9"
|
|
8783
|
-
},
|
|
8784
|
-
function
|
|
9011
|
+
}, P0 = RegExp("[++]+"), $1 = RegExp("^[++]+"), F1 = RegExp("([0-90-9٠-٩۰-۹])"), M0 = RegExp("[++0-90-9٠-٩۰-۹]"), R0 = /[\\\/] *x/, O0 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), x0 = /(?:.*?[A-Za-z]){3}.*/, B0 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), U0 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
|
|
9012
|
+
function d1(d) {
|
|
8785
9013
|
return "([0-90-9٠-٩۰-۹]{1," + d + "})";
|
|
8786
9014
|
}
|
|
8787
|
-
function
|
|
8788
|
-
return ";ext=" +
|
|
9015
|
+
function W1() {
|
|
9016
|
+
return ";ext=" + d1("20") + "|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[ \\t,-]*" + (d1("20") + "#?|[ \\t,]*(?:[xx##~~]|int|int)[:\\..]?[ \\t,-]*") + (d1("9") + "#?|[- ]+") + (d1("6") + "#|[ \\t]*(?:,{2}|;)[:\\..]?[ \\t,-]*") + (d1("15") + "#?|[ \\t]*(?:,)+[:\\..]?[ \\t,-]*") + (d1("9") + "#?");
|
|
8789
9017
|
}
|
|
8790
|
-
var
|
|
8791
|
-
function
|
|
8792
|
-
return 2 > d.length ? !1 :
|
|
9018
|
+
var V1 = new RegExp("(?:" + W1() + ")$", "i"), G0 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + W1() + ")?$", "i"), H0 = /(\$\d)/, k0 = /^\(?\$1\)?$/;
|
|
9019
|
+
function K1(d) {
|
|
9020
|
+
return 2 > d.length ? !1 : V(G0, d);
|
|
8793
9021
|
}
|
|
8794
|
-
function
|
|
8795
|
-
return
|
|
9022
|
+
function j1(d) {
|
|
9023
|
+
return V(x0, d) ? a1(d, v0) : a1(d, _1);
|
|
8796
9024
|
}
|
|
8797
|
-
function
|
|
8798
|
-
var t =
|
|
8799
|
-
|
|
9025
|
+
function Y1(d) {
|
|
9026
|
+
var t = j1(d.toString());
|
|
9027
|
+
H(d), d.g(t);
|
|
8800
9028
|
}
|
|
8801
|
-
function
|
|
8802
|
-
return d != null && (
|
|
9029
|
+
function z1(d) {
|
|
9030
|
+
return d != null && (j(d, 9) != 1 || O(d, 9)[0] != -1);
|
|
8803
9031
|
}
|
|
8804
|
-
function
|
|
8805
|
-
for (var n = new
|
|
9032
|
+
function a1(d, t) {
|
|
9033
|
+
for (var n = new D(), r, o = d.length, l = 0; l < o; ++l) r = d.charAt(l), r = t[r.toUpperCase()], r != null && n.g(r);
|
|
8806
9034
|
return n.toString();
|
|
8807
9035
|
}
|
|
8808
|
-
function
|
|
8809
|
-
return d.length == 0 ||
|
|
9036
|
+
function Z1(d) {
|
|
9037
|
+
return d.length == 0 || k0.test(d);
|
|
8810
9038
|
}
|
|
8811
|
-
function
|
|
8812
|
-
return d != null && isNaN(d) && d.toUpperCase() in
|
|
9039
|
+
function c1(d) {
|
|
9040
|
+
return d != null && isNaN(d) && d.toUpperCase() in k1;
|
|
8813
9041
|
}
|
|
8814
|
-
|
|
8815
|
-
if (
|
|
9042
|
+
R.prototype.format = function(d, t) {
|
|
9043
|
+
if (g(d, 2) == 0 && G(d, 5)) {
|
|
8816
9044
|
var n = S(d, 5);
|
|
8817
9045
|
if (0 < n.length) return n;
|
|
8818
9046
|
}
|
|
8819
9047
|
n = S(d, 1);
|
|
8820
|
-
var
|
|
8821
|
-
if (t == 0) return
|
|
8822
|
-
if (!(n in
|
|
8823
|
-
var o =
|
|
8824
|
-
d =
|
|
9048
|
+
var r = i1(d);
|
|
9049
|
+
if (t == 0) return J1(n, 0, r, "");
|
|
9050
|
+
if (!(n in e1)) return r;
|
|
9051
|
+
var o = n1(this, n, s1(n));
|
|
9052
|
+
d = G(d, 3) && g(d, 3).length != 0 ? t == 3 ? ";ext=" + g(d, 3) : G(o, 13) ? g(o, 13) + S(d, 3) : " ext. " + S(d, 3) : "";
|
|
8825
9053
|
d: {
|
|
8826
|
-
o =
|
|
8827
|
-
for (var l,
|
|
9054
|
+
o = O(o, 20).length == 0 || t == 2 ? O(o, 19) : O(o, 20);
|
|
9055
|
+
for (var l, c = o.length, p = 0; p < c; ++p) {
|
|
8828
9056
|
l = o[p];
|
|
8829
|
-
var
|
|
8830
|
-
if ((
|
|
9057
|
+
var y = j(l, 3);
|
|
9058
|
+
if ((y == 0 || r.search(g(l, 3, y - 1)) == 0) && (y = new RegExp(g(l, 1)), V(y, r))) {
|
|
8831
9059
|
o = l;
|
|
8832
9060
|
break d;
|
|
8833
9061
|
}
|
|
8834
9062
|
}
|
|
8835
9063
|
o = null;
|
|
8836
9064
|
}
|
|
8837
|
-
return o != null && (
|
|
8838
|
-
|
|
9065
|
+
return o != null && (c = o, o = S(c, 2), l = new RegExp(g(c, 1)), S(
|
|
9066
|
+
c,
|
|
8839
9067
|
5
|
|
8840
|
-
),
|
|
9068
|
+
), c = S(c, 4), r = t == 2 && c != null && 0 < c.length ? r.replace(l, o.replace(H0, c)) : r.replace(l, o), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), J1(n, t, r, d);
|
|
8841
9069
|
};
|
|
8842
|
-
function
|
|
8843
|
-
return n == "001" ?
|
|
9070
|
+
function n1(d, t, n) {
|
|
9071
|
+
return n == "001" ? z(d, "" + t) : z(d, n);
|
|
8844
9072
|
}
|
|
8845
|
-
function
|
|
8846
|
-
if (!
|
|
8847
|
-
var t = "" +
|
|
8848
|
-
return
|
|
9073
|
+
function i1(d) {
|
|
9074
|
+
if (!G(d, 2)) return "";
|
|
9075
|
+
var t = "" + g(d, 2);
|
|
9076
|
+
return G(d, 4) && g(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
|
|
8849
9077
|
}
|
|
8850
|
-
function
|
|
9078
|
+
function J1(d, t, n, r) {
|
|
8851
9079
|
switch (t) {
|
|
8852
9080
|
case 0:
|
|
8853
|
-
return "+" + d + n +
|
|
9081
|
+
return "+" + d + n + r;
|
|
8854
9082
|
case 1:
|
|
8855
|
-
return "+" + d + " " + n +
|
|
9083
|
+
return "+" + d + " " + n + r;
|
|
8856
9084
|
case 3:
|
|
8857
|
-
return "tel:+" + d + "-" + n +
|
|
9085
|
+
return "tel:+" + d + "-" + n + r;
|
|
8858
9086
|
default:
|
|
8859
|
-
return n +
|
|
9087
|
+
return n + r;
|
|
8860
9088
|
}
|
|
8861
9089
|
}
|
|
8862
|
-
function
|
|
9090
|
+
function h1(d, t) {
|
|
8863
9091
|
switch (t) {
|
|
8864
9092
|
case 4:
|
|
8865
|
-
return
|
|
9093
|
+
return g(d, 5);
|
|
8866
9094
|
case 3:
|
|
8867
|
-
return
|
|
9095
|
+
return g(d, 4);
|
|
8868
9096
|
case 1:
|
|
8869
|
-
return
|
|
9097
|
+
return g(d, 3);
|
|
8870
9098
|
case 0:
|
|
8871
9099
|
case 2:
|
|
8872
|
-
return
|
|
9100
|
+
return g(d, 2);
|
|
8873
9101
|
case 5:
|
|
8874
|
-
return
|
|
9102
|
+
return g(d, 6);
|
|
8875
9103
|
case 6:
|
|
8876
|
-
return
|
|
9104
|
+
return g(d, 8);
|
|
8877
9105
|
case 7:
|
|
8878
|
-
return
|
|
9106
|
+
return g(d, 7);
|
|
8879
9107
|
case 8:
|
|
8880
|
-
return
|
|
9108
|
+
return g(d, 21);
|
|
8881
9109
|
case 9:
|
|
8882
|
-
return
|
|
9110
|
+
return g(d, 25);
|
|
8883
9111
|
case 10:
|
|
8884
|
-
return
|
|
9112
|
+
return g(d, 28);
|
|
8885
9113
|
default:
|
|
8886
|
-
return
|
|
9114
|
+
return g(d, 1);
|
|
8887
9115
|
}
|
|
8888
9116
|
}
|
|
8889
|
-
function
|
|
8890
|
-
var n =
|
|
8891
|
-
return d =
|
|
9117
|
+
function X1(d, t) {
|
|
9118
|
+
var n = q1(d, t);
|
|
9119
|
+
return d = n1(d, S(t, 1), n), d == null ? -1 : (t = i1(t), E1(t, d));
|
|
8892
9120
|
}
|
|
8893
|
-
function
|
|
8894
|
-
return
|
|
9121
|
+
function E1(d, t) {
|
|
9122
|
+
return F(d, g(t, 1)) ? F(d, g(t, 5)) ? 4 : F(d, g(t, 4)) ? 3 : F(d, g(t, 6)) ? 5 : F(d, g(t, 8)) ? 6 : F(d, g(t, 7)) ? 7 : F(d, g(t, 21)) ? 8 : F(d, g(t, 25)) ? 9 : F(d, g(t, 28)) ? 10 : F(d, g(t, 2)) ? g(t, 18) || F(d, g(t, 3)) ? 2 : 0 : !g(t, 18) && F(d, g(t, 3)) ? 1 : -1 : -1;
|
|
8895
9123
|
}
|
|
8896
|
-
function
|
|
9124
|
+
function z(d, t) {
|
|
8897
9125
|
if (t == null) return null;
|
|
8898
9126
|
t = t.toUpperCase();
|
|
8899
9127
|
var n = d.g[t];
|
|
8900
9128
|
if (n == null) {
|
|
8901
|
-
if (n =
|
|
8902
|
-
n = new
|
|
9129
|
+
if (n = k1[t], n == null) return null;
|
|
9130
|
+
n = new t1().g(J.m(), n), d.g[t] = n;
|
|
8903
9131
|
}
|
|
8904
9132
|
return n;
|
|
8905
9133
|
}
|
|
8906
|
-
function
|
|
9134
|
+
function F(d, t) {
|
|
8907
9135
|
var n = d.length;
|
|
8908
|
-
return 0 <
|
|
9136
|
+
return 0 < j(t, 9) && O(t, 9).indexOf(n) == -1 ? !1 : V(S(t, 2), d);
|
|
8909
9137
|
}
|
|
8910
|
-
function
|
|
8911
|
-
var n =
|
|
8912
|
-
return o == null || n != "001" &&
|
|
9138
|
+
function F0(d, t) {
|
|
9139
|
+
var n = q1(d, t), r = S(t, 1), o = n1(d, r, n);
|
|
9140
|
+
return o == null || n != "001" && r != Q1(d, n) ? o = !1 : (d = i1(t), o = E1(d, o) != -1), o;
|
|
8913
9141
|
}
|
|
8914
|
-
function
|
|
9142
|
+
function q1(d, t) {
|
|
8915
9143
|
if (t == null) return null;
|
|
8916
9144
|
var n = S(t, 1);
|
|
8917
|
-
if (n =
|
|
9145
|
+
if (n = e1[n], n == null) d = null;
|
|
8918
9146
|
else if (n.length == 1) d = n[0];
|
|
8919
9147
|
else d: {
|
|
8920
|
-
t =
|
|
8921
|
-
for (var
|
|
8922
|
-
|
|
8923
|
-
var
|
|
8924
|
-
if (
|
|
8925
|
-
if (t.search(
|
|
8926
|
-
d =
|
|
9148
|
+
t = i1(t);
|
|
9149
|
+
for (var r, o = n.length, l = 0; l < o; l++) {
|
|
9150
|
+
r = n[l];
|
|
9151
|
+
var c = z(d, r);
|
|
9152
|
+
if (G(c, 23)) {
|
|
9153
|
+
if (t.search(g(c, 23)) == 0) {
|
|
9154
|
+
d = r;
|
|
8927
9155
|
break d;
|
|
8928
9156
|
}
|
|
8929
|
-
} else if (
|
|
8930
|
-
d =
|
|
9157
|
+
} else if (E1(t, c) != -1) {
|
|
9158
|
+
d = r;
|
|
8931
9159
|
break d;
|
|
8932
9160
|
}
|
|
8933
9161
|
}
|
|
@@ -8935,151 +9163,151 @@ const n2 = (f) => {
|
|
|
8935
9163
|
}
|
|
8936
9164
|
return d;
|
|
8937
9165
|
}
|
|
8938
|
-
function
|
|
8939
|
-
return d =
|
|
9166
|
+
function s1(d) {
|
|
9167
|
+
return d = e1[d], d == null ? "ZZ" : d[0];
|
|
8940
9168
|
}
|
|
8941
|
-
function
|
|
8942
|
-
if (d =
|
|
9169
|
+
function Q1(d, t) {
|
|
9170
|
+
if (d = z(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
8943
9171
|
return S(d, 10);
|
|
8944
9172
|
}
|
|
8945
|
-
function
|
|
8946
|
-
var o =
|
|
8947
|
-
if (o =
|
|
8948
|
-
else return
|
|
9173
|
+
function f1(d, t, n, r) {
|
|
9174
|
+
var o = h1(n, r), l = j(o, 9) == 0 ? O(g(n, 1), 9) : O(o, 9);
|
|
9175
|
+
if (o = O(o, 10), r == 2) if (z1(h1(n, 0))) d = h1(n, 1), z1(d) && (l = l.concat(j(d, 9) == 0 ? O(g(n, 1), 9) : O(d, 9)), l.sort(), o.length == 0 ? o = O(d, 10) : (o = o.concat(O(d, 10)), o.sort()));
|
|
9176
|
+
else return f1(d, t, n, 1);
|
|
8949
9177
|
return l[0] == -1 ? 5 : (t = t.length, -1 < o.indexOf(t) ? 4 : (n = l[0], n == t ? 0 : n > t ? 2 : l[l.length - 1] < t ? 3 : -1 < l.indexOf(t, 1) ? 0 : 5));
|
|
8950
9178
|
}
|
|
8951
|
-
function
|
|
8952
|
-
var
|
|
8953
|
-
return t = S(t, 1), t in
|
|
9179
|
+
function p1(d, t, n) {
|
|
9180
|
+
var r = i1(t);
|
|
9181
|
+
return t = S(t, 1), t in e1 ? (t = n1(d, t, s1(t)), f1(d, r, t, n)) : 1;
|
|
8954
9182
|
}
|
|
8955
|
-
function
|
|
9183
|
+
function d0(d, t) {
|
|
8956
9184
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8957
|
-
for (var n,
|
|
9185
|
+
for (var n, r = d.length, o = 1; 3 >= o && o <= r; ++o) if (n = parseInt(d.substring(0, o), 10), n in e1) return t.g(d.substring(o)), n;
|
|
8958
9186
|
return 0;
|
|
8959
9187
|
}
|
|
8960
|
-
function
|
|
9188
|
+
function t0(d, t, n, r, o, l) {
|
|
8961
9189
|
if (t.length == 0) return 0;
|
|
8962
|
-
t = new
|
|
8963
|
-
var
|
|
8964
|
-
n != null && (
|
|
9190
|
+
t = new D(t);
|
|
9191
|
+
var c;
|
|
9192
|
+
n != null && (c = g(n, 11)), c == null && (c = "NonMatch");
|
|
8965
9193
|
var p = t.toString();
|
|
8966
|
-
if (p.length == 0)
|
|
8967
|
-
else if (
|
|
9194
|
+
if (p.length == 0) c = 20;
|
|
9195
|
+
else if ($1.test(p)) p = p.replace($1, ""), H(t), t.g(j1(p)), c = 1;
|
|
8968
9196
|
else {
|
|
8969
|
-
if (p = new RegExp(
|
|
8970
|
-
p =
|
|
8971
|
-
var
|
|
8972
|
-
|
|
8973
|
-
} else
|
|
8974
|
-
|
|
9197
|
+
if (p = new RegExp(c), Y1(t), c = t.toString(), c.search(p) == 0) {
|
|
9198
|
+
p = c.match(p)[0].length;
|
|
9199
|
+
var y = c.substring(p).match(F1);
|
|
9200
|
+
y && y[1] != null && 0 < y[1].length && a1(y[1], _1) == "0" ? c = !1 : (H(t), t.g(c.substring(p)), c = !0);
|
|
9201
|
+
} else c = !1;
|
|
9202
|
+
c = c ? 5 : 20;
|
|
8975
9203
|
}
|
|
8976
|
-
if (o &&
|
|
9204
|
+
if (o && M(l, 6, c), c != 20) {
|
|
8977
9205
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8978
|
-
if (d =
|
|
9206
|
+
if (d = d0(t, r), d != 0) return M(l, 1, d), d;
|
|
8979
9207
|
throw Error("Invalid country calling code");
|
|
8980
9208
|
}
|
|
8981
|
-
return n != null && (
|
|
9209
|
+
return n != null && (c = S(n, 10), p = "" + c, y = t.toString(), y.lastIndexOf(p, 0) == 0 && (p = new D(y.substring(p.length)), y = g(n, 1), y = new RegExp(S(y, 2)), e0(p, n, null), p = p.toString(), !V(y, t.toString()) && V(y, p) || f1(d, t.toString(), n, -1) == 3)) ? (r.g(p), o && M(l, 6, 10), M(l, 1, c), c) : (M(l, 1, 0), 0);
|
|
8982
9210
|
}
|
|
8983
|
-
function
|
|
8984
|
-
var
|
|
9211
|
+
function e0(d, t, n) {
|
|
9212
|
+
var r = d.toString(), o = r.length, l = g(t, 15);
|
|
8985
9213
|
if (o != 0 && l != null && l.length != 0) {
|
|
8986
|
-
var
|
|
8987
|
-
if (o =
|
|
8988
|
-
l = new RegExp(S(
|
|
8989
|
-
var p =
|
|
8990
|
-
t =
|
|
9214
|
+
var c = new RegExp("^(?:" + l + ")");
|
|
9215
|
+
if (o = c.exec(r)) {
|
|
9216
|
+
l = new RegExp(S(g(t, 1), 2));
|
|
9217
|
+
var p = V(l, r), y = o.length - 1;
|
|
9218
|
+
t = g(t, 16), t == null || t.length == 0 || o[y] == null || o[y].length == 0 ? (!p || V(l, r.substring(o[0].length))) && (n != null && 0 < y && o[y] != null && n.g(o[1]), d.set(r.substring(o[0].length))) : (r = r.replace(c, t), (!p || V(l, r)) && (n != null && 0 < y && n.g(o[1]), d.set(r)));
|
|
8991
9219
|
}
|
|
8992
9220
|
}
|
|
8993
9221
|
}
|
|
8994
|
-
function
|
|
8995
|
-
if (!
|
|
8996
|
-
return
|
|
9222
|
+
function X(d, t, n) {
|
|
9223
|
+
if (!c1(n) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
9224
|
+
return $0(d, t, n, !0);
|
|
8997
9225
|
}
|
|
8998
|
-
function
|
|
9226
|
+
function $0(d, t, n, r) {
|
|
8999
9227
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
9000
9228
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
9001
|
-
var o = new
|
|
9229
|
+
var o = new D(), l = t.indexOf(";phone-context=");
|
|
9002
9230
|
if (l === -1) l = null;
|
|
9003
9231
|
else if (l += 15, l >= t.length) l = "";
|
|
9004
9232
|
else {
|
|
9005
|
-
var
|
|
9006
|
-
l =
|
|
9233
|
+
var c = t.indexOf(";", l);
|
|
9234
|
+
l = c !== -1 ? t.substring(l, c) : t.substring(l);
|
|
9007
9235
|
}
|
|
9008
9236
|
var p = l;
|
|
9009
|
-
if (p == null ?
|
|
9010
|
-
if (l = o.toString(), !(
|
|
9011
|
-
l = new
|
|
9237
|
+
if (p == null ? c = !0 : p.length === 0 ? c = !1 : (c = B0.exec(p), p = U0.exec(p), c = c !== null || p !== null), !c || (l != null ? (l.charAt(0) === "+" && o.g(l), l = t.indexOf("tel:"), o.g(t.substring(0 <= l ? l + 4 : 0, t.indexOf(";phone-context=")))) : (l = o.g, c = t ?? "", p = c.search(M0), 0 <= p ? (c = c.substring(p), c = c.replace(O0, ""), p = c.search(R0), 0 <= p && (c = c.substring(0, p))) : c = "", l.call(o, c)), l = o.toString(), c = l.indexOf(";isub="), 0 < c && (H(o), o.g(l.substring(0, c))), !K1(o.toString()))) throw Error("The string supplied did not seem to be a phone number");
|
|
9238
|
+
if (l = o.toString(), !(c1(n) || l != null && 0 < l.length && $1.test(l))) throw Error("Invalid country calling code");
|
|
9239
|
+
l = new Y(), r && M(l, 5, t);
|
|
9012
9240
|
d: {
|
|
9013
|
-
if (t = o.toString(),
|
|
9014
|
-
p = t.match(
|
|
9015
|
-
for (var
|
|
9016
|
-
|
|
9241
|
+
if (t = o.toString(), c = t.search(V1), 0 <= c && K1(t.substring(0, c))) {
|
|
9242
|
+
p = t.match(V1);
|
|
9243
|
+
for (var y = p.length, K = 1; K < y; ++K) if (p[K] != null && 0 < p[K].length) {
|
|
9244
|
+
H(o), o.g(t.substring(0, c)), t = p[K];
|
|
9017
9245
|
break d;
|
|
9018
9246
|
}
|
|
9019
9247
|
}
|
|
9020
9248
|
t = "";
|
|
9021
9249
|
}
|
|
9022
|
-
0 < t.length &&
|
|
9250
|
+
0 < t.length && M(l, 3, t), c = z(d, n), t = new D(), p = 0, y = o.toString();
|
|
9023
9251
|
try {
|
|
9024
|
-
p =
|
|
9025
|
-
} catch (
|
|
9026
|
-
if (
|
|
9027
|
-
if (
|
|
9028
|
-
} else throw
|
|
9252
|
+
p = t0(d, y, c, t, r, l);
|
|
9253
|
+
} catch (L1) {
|
|
9254
|
+
if (L1.message == "Invalid country calling code" && $1.test(y)) {
|
|
9255
|
+
if (y = y.replace($1, ""), p = t0(d, y, c, t, r, l), p == 0) throw L1;
|
|
9256
|
+
} else throw L1;
|
|
9029
9257
|
}
|
|
9030
|
-
if (p != 0 ? (o =
|
|
9258
|
+
if (p != 0 ? (o = s1(p), o != n && (c = n1(d, p, o))) : (Y1(o), t.g(o.toString()), n != null ? (p = S(c, 10), M(
|
|
9031
9259
|
l,
|
|
9032
9260
|
1,
|
|
9033
9261
|
p
|
|
9034
|
-
)) :
|
|
9262
|
+
)) : r && (delete l.h[6], l.g && delete l.g[6])), 2 > t.h.length || (c != null && (n = new D(), o = new D(t.toString()), e0(o, c, n), d = f1(d, o.toString(), c, -1), d != 2 && d != 4 && d != 5 && (t = o, r && 0 < n.toString().length && M(l, 7, n.toString()))), r = t.toString(), d = r.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
|
|
9035
9263
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
9036
|
-
if (1 <
|
|
9037
|
-
for (
|
|
9038
|
-
d != 1 &&
|
|
9264
|
+
if (1 < r.length && r.charAt(0) == "0") {
|
|
9265
|
+
for (M(l, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
|
|
9266
|
+
d != 1 && M(l, 8, d);
|
|
9039
9267
|
}
|
|
9040
|
-
return
|
|
9268
|
+
return M(l, 2, parseInt(r, 10)), l;
|
|
9041
9269
|
}
|
|
9042
|
-
function
|
|
9270
|
+
function V(d, t) {
|
|
9043
9271
|
return !!((d = t.match(new RegExp("^(?:" + (typeof d == "string" ? d : d.source) + ")$", "i"))) && d[0].length == t.length);
|
|
9044
9272
|
}
|
|
9045
|
-
function
|
|
9046
|
-
this.fa = RegExp(" "), this.ja = "", this.v = new
|
|
9273
|
+
function W0(d) {
|
|
9274
|
+
this.fa = RegExp(" "), this.ja = "", this.v = new D(), this.da = "", this.s = new D(), this.ba = new D(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = R.g(), this.$ = 0, this.h = new D(), this.ha = !1, this.o = "", this.g = new D(), this.j = [], this.ka = d, this.l = s0(this, this.ka);
|
|
9047
9275
|
}
|
|
9048
|
-
var
|
|
9049
|
-
|
|
9050
|
-
var
|
|
9051
|
-
function
|
|
9276
|
+
var n0 = new J();
|
|
9277
|
+
M(n0, 11, "NA");
|
|
9278
|
+
var V0 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), i0 = /[- ]/;
|
|
9279
|
+
function s0(d, t) {
|
|
9052
9280
|
var n = d.ga;
|
|
9053
|
-
return t =
|
|
9281
|
+
return t = c1(t) ? Q1(n, t) : 0, d = z(d.ga, s1(t)), d ?? n0;
|
|
9054
9282
|
}
|
|
9055
|
-
function
|
|
9283
|
+
function r0(d) {
|
|
9056
9284
|
for (var t = d.j.length, n = 0; n < t; ++n) {
|
|
9057
|
-
var
|
|
9285
|
+
var r = d.j[n], o = S(r, 1);
|
|
9058
9286
|
if (d.da == o) return !1;
|
|
9059
|
-
var l = d,
|
|
9060
|
-
|
|
9061
|
-
var
|
|
9062
|
-
|
|
9063
|
-
var
|
|
9064
|
-
if (
|
|
9287
|
+
var l = d, c = r, p = S(c, 1);
|
|
9288
|
+
H(l.v);
|
|
9289
|
+
var y = l;
|
|
9290
|
+
c = S(c, 2);
|
|
9291
|
+
var K = "999999999999999".match(p)[0];
|
|
9292
|
+
if (K.length < y.g.h.length ? y = "" : (y = K.replace(new RegExp(p, "g"), c), y = y.replace(RegExp("9", "g"), " ")), 0 < y.length ? (l.v.g(y), l = !0) : l = !1, l) return d.da = o, d.ha = i0.test(g(r, 4)), d.$ = 0, !0;
|
|
9065
9293
|
}
|
|
9066
9294
|
return d.u = !1;
|
|
9067
9295
|
}
|
|
9068
|
-
function
|
|
9069
|
-
for (var n = [],
|
|
9070
|
-
var
|
|
9071
|
-
|
|
9296
|
+
function o0(d, t) {
|
|
9297
|
+
for (var n = [], r = t.length - 3, o = d.j.length, l = 0; l < o; ++l) {
|
|
9298
|
+
var c = d.j[l];
|
|
9299
|
+
j(c, 3) == 0 ? n.push(d.j[l]) : (c = g(c, 3, Math.min(r, j(c, 3) - 1)), t.search(c) == 0 && n.push(d.j[l]));
|
|
9072
9300
|
}
|
|
9073
9301
|
d.j = n;
|
|
9074
9302
|
}
|
|
9075
|
-
function
|
|
9303
|
+
function K0(d, t) {
|
|
9076
9304
|
d.s.g(t);
|
|
9077
9305
|
var n = t;
|
|
9078
|
-
if (
|
|
9306
|
+
if (F1.test(n) || d.s.h.length == 1 && P0.test(n) ? (t == "+" ? (n = t, d.ba.g(t)) : (n = _1[t], d.ba.g(n), d.g.g(n)), t = n) : (d.u = !1, d.la = !0), !d.u) {
|
|
9079
9307
|
if (!d.la) {
|
|
9080
|
-
if (
|
|
9081
|
-
if (
|
|
9082
|
-
} else if (0 < d.o.length && (t = d.g.toString(),
|
|
9308
|
+
if (h0(d)) {
|
|
9309
|
+
if (f0(d)) return u0(d);
|
|
9310
|
+
} else if (0 < d.o.length && (t = d.g.toString(), H(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), n = t.lastIndexOf(d.o), H(d.h), d.h.g(t.substring(0, n))), d.o != c0(d)) return d.h.g(" "), u0(d);
|
|
9083
9311
|
}
|
|
9084
9312
|
return d.s.toString();
|
|
9085
9313
|
}
|
|
@@ -9089,99 +9317,99 @@ const n2 = (f) => {
|
|
|
9089
9317
|
case 2:
|
|
9090
9318
|
return d.s.toString();
|
|
9091
9319
|
case 3:
|
|
9092
|
-
if (
|
|
9093
|
-
else return d.o =
|
|
9320
|
+
if (h0(d)) d.ea = !0;
|
|
9321
|
+
else return d.o = c0(d), N1(d);
|
|
9094
9322
|
default:
|
|
9095
|
-
return d.ea ? (
|
|
9323
|
+
return d.ea ? (f0(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = p0(d, t), n = l0(d), 0 < n.length ? n : (o0(d, d.g.toString()), r0(d) ? a0(d) : d.u ? C1(d, t) : d.s.toString())) : N1(d);
|
|
9096
9324
|
}
|
|
9097
9325
|
}
|
|
9098
|
-
function
|
|
9099
|
-
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0,
|
|
9326
|
+
function u0(d) {
|
|
9327
|
+
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, H(d.v), d.da = "", N1(d);
|
|
9100
9328
|
}
|
|
9101
|
-
function
|
|
9102
|
-
for (var t = d.g.toString(), n = d.j.length,
|
|
9103
|
-
var o = d.j[
|
|
9104
|
-
if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha =
|
|
9329
|
+
function l0(d) {
|
|
9330
|
+
for (var t = d.g.toString(), n = d.j.length, r = 0; r < n; ++r) {
|
|
9331
|
+
var o = d.j[r], l = S(o, 1);
|
|
9332
|
+
if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha = i0.test(g(o, 4)), o = t.replace(new RegExp(l, "g"), g(o, 2)), o = C1(d, o), a1(o, D0) == d.ba)) return o;
|
|
9105
9333
|
}
|
|
9106
9334
|
return "";
|
|
9107
9335
|
}
|
|
9108
|
-
function
|
|
9336
|
+
function C1(d, t) {
|
|
9109
9337
|
var n = d.h.h.length;
|
|
9110
9338
|
return d.ha && 0 < n && d.h.toString().charAt(n - 1) != " " ? d.h + " " + t : d.h + t;
|
|
9111
9339
|
}
|
|
9112
|
-
function
|
|
9340
|
+
function N1(d) {
|
|
9113
9341
|
var t = d.g.toString();
|
|
9114
9342
|
if (3 <= t.length) {
|
|
9115
|
-
for (var n = d.ca && d.o.length == 0 && 0 <
|
|
9343
|
+
for (var n = d.ca && d.o.length == 0 && 0 < j(d.l, 20) ? O(d.l, 20) : O(d.l, 19), r = n.length, o = 0; o < r; ++o) {
|
|
9116
9344
|
var l = n[o];
|
|
9117
|
-
0 < d.o.length &&
|
|
9345
|
+
0 < d.o.length && Z1(S(l, 4)) && !g(l, 6) && !G(l, 5) || (d.o.length != 0 || d.ca || Z1(S(l, 4)) || g(l, 6)) && V0.test(S(l, 2)) && d.j.push(l);
|
|
9118
9346
|
}
|
|
9119
|
-
return
|
|
9347
|
+
return o0(d, t), t = l0(d), 0 < t.length ? t : r0(d) ? a0(d) : d.s.toString();
|
|
9120
9348
|
}
|
|
9121
|
-
return
|
|
9349
|
+
return C1(d, t);
|
|
9122
9350
|
}
|
|
9123
|
-
function
|
|
9351
|
+
function a0(d) {
|
|
9124
9352
|
var t = d.g.toString(), n = t.length;
|
|
9125
9353
|
if (0 < n) {
|
|
9126
|
-
for (var
|
|
9127
|
-
return d.u ?
|
|
9354
|
+
for (var r = "", o = 0; o < n; o++) r = p0(d, t.charAt(o));
|
|
9355
|
+
return d.u ? C1(d, r) : d.s.toString();
|
|
9128
9356
|
}
|
|
9129
9357
|
return d.h.toString();
|
|
9130
9358
|
}
|
|
9131
|
-
function
|
|
9359
|
+
function c0(d) {
|
|
9132
9360
|
var t = d.g.toString(), n = 0;
|
|
9133
|
-
if (
|
|
9134
|
-
else
|
|
9135
|
-
return
|
|
9361
|
+
if (g(d.l, 10) != 1) var r = !1;
|
|
9362
|
+
else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
|
|
9363
|
+
return r ? (n = 1, d.h.g("1").g(" "), d.ca = !0) : G(d.l, 15) && (r = new RegExp("^(?:" + g(d.l, 15) + ")"), r = t.match(r), r != null && r[0] != null && 0 < r[0].length && (d.ca = !0, n = r[0].length, d.h.g(t.substring(0, n)))), H(d.g), d.g.g(t.substring(n)), t.substring(0, n);
|
|
9136
9364
|
}
|
|
9137
|
-
function
|
|
9138
|
-
var t = d.ba.toString(), n = new RegExp("^(?:\\+|" +
|
|
9139
|
-
return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length,
|
|
9365
|
+
function h0(d) {
|
|
9366
|
+
var t = d.ba.toString(), n = new RegExp("^(?:\\+|" + g(d.l, 11) + ")");
|
|
9367
|
+
return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length, H(d.g), d.g.g(t.substring(n)), H(d.h), d.h.g(t.substring(0, n)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
|
|
9140
9368
|
}
|
|
9141
|
-
function
|
|
9369
|
+
function f0(d) {
|
|
9142
9370
|
if (d.g.h.length == 0) return !1;
|
|
9143
|
-
var t = new
|
|
9144
|
-
return n == 0 ? !1 : (
|
|
9371
|
+
var t = new D(), n = d0(d.g, t);
|
|
9372
|
+
return n == 0 ? !1 : (H(d.g), d.g.g(t.toString()), t = s1(n), t == "001" ? d.l = z(d.ga, "" + n) : t != d.ka && (d.l = s0(d, t)), d.h.g("" + n).g(" "), d.o = "", !0);
|
|
9145
9373
|
}
|
|
9146
|
-
function
|
|
9374
|
+
function p0(d, t) {
|
|
9147
9375
|
var n = d.v.toString();
|
|
9148
9376
|
if (0 <= n.substring(d.$).search(d.fa)) {
|
|
9149
|
-
var
|
|
9150
|
-
return t = n.replace(d.fa, t),
|
|
9377
|
+
var r = n.search(d.fa);
|
|
9378
|
+
return t = n.replace(d.fa, t), H(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
|
|
9151
9379
|
}
|
|
9152
9380
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
9153
9381
|
}
|
|
9154
|
-
const
|
|
9382
|
+
const C0 = (d) => {
|
|
9155
9383
|
const t = [];
|
|
9156
9384
|
return d.includes("FIXED_LINE_OR_MOBILE") ? (d.includes("MOBILE") || t.push("MOBILE"), d.includes("FIXED_LINE") || t.push("FIXED_LINE")) : (d.includes("MOBILE") || d.includes("FIXED_LINE")) && t.push("FIXED_LINE_OR_MOBILE"), d.concat(t);
|
|
9157
|
-
},
|
|
9385
|
+
}, S1 = { 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 };
|
|
9158
9386
|
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
9159
9387
|
try {
|
|
9160
|
-
const n = d.replace(/[^+0-9]/g, ""),
|
|
9388
|
+
const n = d.replace(/[^+0-9]/g, ""), r = new W0(t);
|
|
9161
9389
|
t = "";
|
|
9162
|
-
for (let o = 0; o < n.length; o++)
|
|
9390
|
+
for (let o = 0; o < n.length; o++) r.ja = K0(r, n.charAt(o)), t = r.ja;
|
|
9163
9391
|
return t;
|
|
9164
9392
|
} catch {
|
|
9165
9393
|
return d;
|
|
9166
9394
|
}
|
|
9167
9395
|
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, n) => {
|
|
9168
9396
|
try {
|
|
9169
|
-
const o =
|
|
9170
|
-
var
|
|
9171
|
-
return
|
|
9397
|
+
const o = R.g(), l = X(o, d, t);
|
|
9398
|
+
var r = p1(o, l, -1);
|
|
9399
|
+
return r == 0 || r == 4 ? o.format(l, typeof n > "u" ? 0 : n) : d;
|
|
9172
9400
|
} catch {
|
|
9173
9401
|
return d;
|
|
9174
9402
|
}
|
|
9175
|
-
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, n,
|
|
9403
|
+
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, n, r) => {
|
|
9176
9404
|
try {
|
|
9177
|
-
const
|
|
9405
|
+
const y = R.g();
|
|
9178
9406
|
d: {
|
|
9179
|
-
var o =
|
|
9180
|
-
if (
|
|
9181
|
-
var l =
|
|
9407
|
+
var o = y;
|
|
9408
|
+
if (c1(d)) {
|
|
9409
|
+
var l = h1(z(o, d), n);
|
|
9182
9410
|
try {
|
|
9183
|
-
if (
|
|
9184
|
-
var
|
|
9411
|
+
if (G(l, 6)) {
|
|
9412
|
+
var c = g(l, 6), p = $0(o, c, d, !1);
|
|
9185
9413
|
break d;
|
|
9186
9414
|
}
|
|
9187
9415
|
} catch {
|
|
@@ -9189,37 +9417,37 @@ const n2 = (f) => {
|
|
|
9189
9417
|
}
|
|
9190
9418
|
p = null;
|
|
9191
9419
|
}
|
|
9192
|
-
return
|
|
9420
|
+
return y.format(p, r ? 0 : t ? 2 : 1);
|
|
9193
9421
|
} catch {
|
|
9194
9422
|
return "";
|
|
9195
9423
|
}
|
|
9196
9424
|
}), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
|
|
9197
9425
|
try {
|
|
9198
|
-
return
|
|
9426
|
+
return g(X(R.g(), d, t), 3);
|
|
9199
9427
|
} catch {
|
|
9200
9428
|
return "";
|
|
9201
9429
|
}
|
|
9202
9430
|
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
9203
9431
|
try {
|
|
9204
|
-
const n =
|
|
9205
|
-
return
|
|
9432
|
+
const n = R.g(), r = X(n, d, t);
|
|
9433
|
+
return X1(n, r);
|
|
9206
9434
|
} catch {
|
|
9207
9435
|
return -99;
|
|
9208
9436
|
}
|
|
9209
9437
|
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
9210
9438
|
if (!t) return 1;
|
|
9211
9439
|
try {
|
|
9212
|
-
const n =
|
|
9213
|
-
return
|
|
9440
|
+
const n = R.g(), r = X(n, d, t);
|
|
9441
|
+
return p1(n, r, -1);
|
|
9214
9442
|
} catch (n) {
|
|
9215
9443
|
return n.message === "Invalid country calling code" ? 1 : 3 >= d.length || n.message === "Phone number too short after IDD" || n.message === "The string supplied is too short to be a phone number" ? 2 : n.message === "The string supplied is too long to be a phone number" ? 3 : -99;
|
|
9216
9444
|
}
|
|
9217
9445
|
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t, n) => {
|
|
9218
9446
|
try {
|
|
9219
|
-
const
|
|
9447
|
+
const r = R.g(), o = X(r, d, t), l = F0(r, o);
|
|
9220
9448
|
if (n) {
|
|
9221
|
-
const
|
|
9222
|
-
return l &&
|
|
9449
|
+
const c = C0(n).map((p) => S1[p]);
|
|
9450
|
+
return l && c.includes(X1(r, o));
|
|
9223
9451
|
}
|
|
9224
9452
|
return l;
|
|
9225
9453
|
} catch {
|
|
@@ -9227,30 +9455,30 @@ const n2 = (f) => {
|
|
|
9227
9455
|
}
|
|
9228
9456
|
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, n) => {
|
|
9229
9457
|
try {
|
|
9230
|
-
const
|
|
9458
|
+
const r = R.g(), o = X(r, d, t);
|
|
9231
9459
|
if (n) {
|
|
9232
|
-
const l =
|
|
9233
|
-
for (let
|
|
9460
|
+
const l = C0(n);
|
|
9461
|
+
for (let c of l) if (p1(r, o, S1[c]) === 0) return !0;
|
|
9234
9462
|
return !1;
|
|
9235
9463
|
}
|
|
9236
|
-
return
|
|
9464
|
+
return p1(r, o, -1) === 0;
|
|
9237
9465
|
} catch {
|
|
9238
9466
|
return !1;
|
|
9239
9467
|
}
|
|
9240
9468
|
}), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
|
|
9241
9469
|
try {
|
|
9242
|
-
return
|
|
9470
|
+
return g(X(R.g(), d, t), 2).toString();
|
|
9243
9471
|
} catch {
|
|
9244
9472
|
return "";
|
|
9245
9473
|
}
|
|
9246
|
-
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType",
|
|
9474
|
+
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", S1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
|
|
9247
9475
|
})();
|
|
9248
|
-
const
|
|
9249
|
-
delete
|
|
9250
|
-
|
|
9251
|
-
const
|
|
9476
|
+
const A0 = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : void 0, A2 = A0.intlTelInputUtilsTemp;
|
|
9477
|
+
delete A0.intlTelInputUtilsTemp;
|
|
9478
|
+
m.utils = A2;
|
|
9479
|
+
const b2 = {
|
|
9252
9480
|
__name: "IntlTelInputWithUtils",
|
|
9253
|
-
props: /* @__PURE__ */
|
|
9481
|
+
props: /* @__PURE__ */ g0({
|
|
9254
9482
|
disabled: {
|
|
9255
9483
|
type: Boolean,
|
|
9256
9484
|
default: !1
|
|
@@ -9274,47 +9502,47 @@ const s2 = {
|
|
|
9274
9502
|
},
|
|
9275
9503
|
modelModifiers: {}
|
|
9276
9504
|
}),
|
|
9277
|
-
emits: /* @__PURE__ */
|
|
9505
|
+
emits: /* @__PURE__ */ g0([
|
|
9278
9506
|
"changeNumber",
|
|
9279
9507
|
"changeCountry",
|
|
9280
9508
|
"changeValidity",
|
|
9281
9509
|
"changeErrorCode"
|
|
9282
9510
|
], ["update:modelValue"]),
|
|
9283
|
-
setup(
|
|
9284
|
-
const i =
|
|
9285
|
-
let
|
|
9286
|
-
C.value !==
|
|
9511
|
+
setup(h, { expose: e, emit: $ }) {
|
|
9512
|
+
const i = j0(h, "modelValue"), s = h, a = $, u = A1(), f = A1(), C = A1(!1), I = () => f.value ? s.options.strictMode ? f.value.isValidNumberPrecise() : f.value.isValidNumber() : null, _ = () => {
|
|
9513
|
+
let N = I();
|
|
9514
|
+
C.value !== N && (C.value = N, a("changeValidity", !!N), a(
|
|
9287
9515
|
"changeErrorCode",
|
|
9288
|
-
|
|
9516
|
+
N ? null : f.value.getValidationError()
|
|
9289
9517
|
));
|
|
9290
|
-
},
|
|
9291
|
-
var
|
|
9292
|
-
|
|
9293
|
-
},
|
|
9294
|
-
var
|
|
9295
|
-
|
|
9518
|
+
}, A = () => {
|
|
9519
|
+
var N;
|
|
9520
|
+
a("changeNumber", ((N = f.value) == null ? void 0 : N.getNumber()) ?? ""), _();
|
|
9521
|
+
}, v = () => {
|
|
9522
|
+
var N;
|
|
9523
|
+
a("changeCountry", ((N = f.value) == null ? void 0 : N.getSelectedCountryData().iso2) ?? ""), A(), _();
|
|
9296
9524
|
};
|
|
9297
|
-
return
|
|
9298
|
-
|
|
9299
|
-
}),
|
|
9300
|
-
() =>
|
|
9301
|
-
(
|
|
9302
|
-
var
|
|
9303
|
-
return (
|
|
9525
|
+
return Y0(() => {
|
|
9526
|
+
u.value && (f.value = m(u.value, s.options), s.value && f.value.setNumber(s.value), s.disabled && f.value.setDisabled(s.disabled), C.value = I());
|
|
9527
|
+
}), z0(
|
|
9528
|
+
() => s.disabled,
|
|
9529
|
+
(N) => {
|
|
9530
|
+
var T;
|
|
9531
|
+
return (T = f.value) == null ? void 0 : T.setDisabled(N);
|
|
9304
9532
|
}
|
|
9305
|
-
),
|
|
9306
|
-
var
|
|
9307
|
-
return (
|
|
9308
|
-
}), e({ instance:
|
|
9533
|
+
), Z0(() => {
|
|
9534
|
+
var N;
|
|
9535
|
+
return (N = f.value) == null ? void 0 : N.destroy();
|
|
9536
|
+
}), e({ instance: f, input: u }), (N, T) => J0((q0(), X0("input", Q0({
|
|
9309
9537
|
ref_key: "input",
|
|
9310
|
-
ref:
|
|
9311
|
-
"onUpdate:modelValue":
|
|
9538
|
+
ref: u,
|
|
9539
|
+
"onUpdate:modelValue": T[0] || (T[0] = (k) => i.value = k),
|
|
9312
9540
|
type: "tel",
|
|
9313
|
-
onCountrychange:
|
|
9314
|
-
onInput:
|
|
9315
|
-
},
|
|
9541
|
+
onCountrychange: v,
|
|
9542
|
+
onInput: A
|
|
9543
|
+
}, h.inputProps), null, 16)), [
|
|
9316
9544
|
[
|
|
9317
|
-
|
|
9545
|
+
d2,
|
|
9318
9546
|
i.value,
|
|
9319
9547
|
void 0,
|
|
9320
9548
|
{ lazy: !0 }
|
|
@@ -9323,5 +9551,5 @@ const s2 = {
|
|
|
9323
9551
|
}
|
|
9324
9552
|
};
|
|
9325
9553
|
export {
|
|
9326
|
-
|
|
9554
|
+
b2 as default
|
|
9327
9555
|
};
|