intl-tel-input 25.10.11 → 25.11.0
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 +671 -624
- package/angular/build/IntlTelInputWithUtils.js +674 -627
- package/angular/build/types/intl-tel-input.d.ts +17 -71
- package/angular/build/types/modules/core/ui.d.ts +44 -0
- package/angular/build/types/modules/format/formatting.d.ts +3 -3
- package/angular/build/types/modules/types/events.d.ts +8 -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/css/intlTelInput.css +1 -13
- package/build/css/intlTelInput.min.css +1 -1
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +83 -74
- package/build/js/intlTelInput.js +759 -669
- package/build/js/intlTelInput.min.js +4 -4
- package/build/js/intlTelInputWithUtils.js +763 -673
- package/build/js/intlTelInputWithUtils.min.js +4 -4
- package/build/js/utils.js +4 -4
- package/package.json +2 -1
- package/react/README.md +1 -1
- package/react/build/IntlTelInput.cjs +758 -668
- package/react/build/IntlTelInput.d.ts +83 -74
- package/react/build/IntlTelInput.js +758 -668
- package/react/build/IntlTelInputWithUtils.cjs +762 -672
- package/react/build/IntlTelInputWithUtils.js +762 -672
- package/vue/README.md +1 -1
- package/vue/build/IntlTelInput.mjs +710 -600
- package/vue/build/IntlTelInputWithUtils.mjs +989 -879
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mergeModels as
|
|
1
|
+
import { mergeModels as u0, useModel as P0, ref as _1, onMounted as B0, watch as R0, onUnmounted as k0, withDirectives as G0, createElementBlock as O0, openBlock as U0, mergeProps as F0, vModelText as V0 } from "vue";
|
|
2
2
|
const K0 = [
|
|
3
3
|
[
|
|
4
4
|
"af",
|
|
@@ -1677,19 +1677,19 @@ const K0 = [
|
|
|
1677
1677
|
"0"
|
|
1678
1678
|
]
|
|
1679
1679
|
], Y = [];
|
|
1680
|
-
for (const
|
|
1680
|
+
for (const p of K0)
|
|
1681
1681
|
Y.push({
|
|
1682
1682
|
name: "",
|
|
1683
1683
|
// populated in the plugin
|
|
1684
|
-
iso2:
|
|
1685
|
-
dialCode:
|
|
1686
|
-
priority:
|
|
1687
|
-
areaCodes:
|
|
1684
|
+
iso2: p[0],
|
|
1685
|
+
dialCode: p[1],
|
|
1686
|
+
priority: p[2] || 0,
|
|
1687
|
+
areaCodes: p[3] || null,
|
|
1688
1688
|
nodeById: {},
|
|
1689
1689
|
// populated by the plugin
|
|
1690
|
-
nationalPrefix:
|
|
1690
|
+
nationalPrefix: p[4] || null
|
|
1691
1691
|
});
|
|
1692
|
-
const
|
|
1692
|
+
const a0 = {
|
|
1693
1693
|
ad: "Andorra",
|
|
1694
1694
|
ae: "United Arab Emirates",
|
|
1695
1695
|
af: "Afghanistan",
|
|
@@ -1944,13 +1944,13 @@ const V0 = {
|
|
|
1944
1944
|
// additional countries (not supported by country-list library)
|
|
1945
1945
|
ac: "Ascension Island",
|
|
1946
1946
|
xk: "Kosovo"
|
|
1947
|
-
},
|
|
1947
|
+
}, W0 = { ...a0, ...H0 }, b1 = (p) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(p).matches, j0 = () => {
|
|
1948
1948
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1949
|
-
const
|
|
1950
|
-
return
|
|
1949
|
+
const p = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), e = b1("(max-width: 500px)"), $ = b1("(max-height: 600px)"), i = b1("(pointer: coarse)");
|
|
1950
|
+
return p || e || i && $;
|
|
1951
1951
|
}
|
|
1952
1952
|
return !1;
|
|
1953
|
-
},
|
|
1953
|
+
}, h0 = {
|
|
1954
1954
|
// Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
|
|
1955
1955
|
allowPhonewords: !1,
|
|
1956
1956
|
//* Whether or not to allow the dropdown.
|
|
@@ -2002,215 +2002,51 @@ const V0 = {
|
|
|
2002
2002
|
//* The number type to enforce during validation.
|
|
2003
2003
|
validationNumberTypes: ["MOBILE"]
|
|
2004
2004
|
};
|
|
2005
|
-
function
|
|
2006
|
-
|
|
2005
|
+
function z0(p) {
|
|
2006
|
+
p.useFullscreenPopup && (p.fixDropdownWidth = !1), p.onlyCountries.length === 1 && (p.initialCountry = p.onlyCountries[0]), p.separateDialCode && (p.nationalMode = !1), p.allowDropdown && !p.showFlags && !p.separateDialCode && (p.nationalMode = !1), p.useFullscreenPopup && !p.dropdownContainer && (p.dropdownContainer = document.body), p.i18n = { ...W0, ...p.i18n };
|
|
2007
2007
|
}
|
|
2008
|
-
const c1 = (
|
|
2009
|
-
const i = document.createElement(
|
|
2010
|
-
return e && Object.entries(e).forEach(([s,
|
|
2008
|
+
const c1 = (p) => p.replace(/\D/g, ""), c0 = (p = "") => p.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), w1 = (p) => Object.keys(p).filter((e) => !!p[e]).join(" "), v = (p, e, $) => {
|
|
2009
|
+
const i = document.createElement(p);
|
|
2010
|
+
return e && Object.entries(e).forEach(([s, h]) => i.setAttribute(s, h)), $ && $.appendChild(i), i;
|
|
2011
2011
|
};
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
const i = e.map((s) => s.toLowerCase());
|
|
2016
|
-
return Y.filter((s) => i.includes(s.iso2));
|
|
2017
|
-
} else if ($.length) {
|
|
2018
|
-
const i = $.map((s) => s.toLowerCase());
|
|
2019
|
-
return Y.filter((s) => !i.includes(s.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 s = {}, u = (h, c, m) => {
|
|
2033
|
-
if (!h || !c)
|
|
2034
|
-
return;
|
|
2035
|
-
c.length > i && (i = c.length), s.hasOwnProperty(c) || (s[c] = []);
|
|
2036
|
-
const g = s[c];
|
|
2037
|
-
if (g.includes(h))
|
|
2038
|
-
return;
|
|
2039
|
-
const I = m !== void 0 ? m : 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 m = h.dialCode.substring(0, c);
|
|
2046
|
-
u(h.iso2, m);
|
|
2047
|
-
}
|
|
2048
|
-
u(h.iso2, h.dialCode, h.priority);
|
|
2049
|
-
}
|
|
2050
|
-
(e.onlyCountries.length || e.excludeCountries.length) && $.forEach((h) => {
|
|
2051
|
-
s[h] = s[h].filter(Boolean);
|
|
2052
|
-
});
|
|
2053
|
-
for (const h of f)
|
|
2054
|
-
if (h.areaCodes) {
|
|
2055
|
-
const c = s[h.dialCode][0];
|
|
2056
|
-
for (const m of h.areaCodes) {
|
|
2057
|
-
for (let g = 1; g < m.length; g++) {
|
|
2058
|
-
const I = m.substring(0, g), w = h.dialCode + I;
|
|
2059
|
-
u(c, w), u(h.iso2, w);
|
|
2060
|
-
}
|
|
2061
|
-
u(h.iso2, h.dialCode + m);
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: s };
|
|
2065
|
-
}
|
|
2066
|
-
function J0(f, e) {
|
|
2067
|
-
e.countryOrder && (e.countryOrder = e.countryOrder.map(($) => $.toLowerCase())), f.sort(($, i) => {
|
|
2068
|
-
const { countryOrder: s } = e;
|
|
2069
|
-
if (s) {
|
|
2070
|
-
const u = s.indexOf($.iso2), h = s.indexOf(i.iso2), c = u > -1, m = h > -1;
|
|
2071
|
-
if (c || m)
|
|
2072
|
-
return c && m ? 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 s = f;
|
|
2083
|
-
if ($ && e) {
|
|
2084
|
-
e = `+${i.dialCode}`;
|
|
2085
|
-
const u = s[e.length] === " " || s[e.length] === "-" ? e.length + 1 : e.length;
|
|
2086
|
-
s = s.substring(u);
|
|
2087
|
-
}
|
|
2088
|
-
return s;
|
|
2089
|
-
}
|
|
2090
|
-
function Q0(f, e, $, i, s) {
|
|
2091
|
-
const u = $ ? $.formatNumberAsYouType(f, i.iso2) : f, { dialCode: h } = i;
|
|
2092
|
-
return s && 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 s = 0;
|
|
2098
|
-
for (let u = 0; u < e.length; u++) {
|
|
2099
|
-
if (/[+0-9]/.test(e[u]) && s++, s === f && !i)
|
|
2100
|
-
return u + 1;
|
|
2101
|
-
if (i && s === 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.telInput.dir = "ltr";
|
|
2152
|
-
const e = this.options.allowDropdown || this.options.separateDialCode;
|
|
2153
|
-
this.showSelectedCountryOnLeft = this.isRTL ? !e : e, this.options.separateDialCode && (this.isRTL ? this.originalPaddingRight = this.telInput.style.paddingRight : this.originalPaddingLeft = this.telInput.style.paddingLeft);
|
|
2154
|
-
}
|
|
2155
|
-
_createInitPromises() {
|
|
2156
|
-
const e = new Promise((i, s) => {
|
|
2157
|
-
this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
|
|
2158
|
-
}), $ = new Promise((i, s) => {
|
|
2159
|
-
this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = s;
|
|
2160
|
-
});
|
|
2161
|
-
this.promise = Promise.all([e, $]);
|
|
2162
|
-
}
|
|
2163
|
-
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
2164
|
-
_init() {
|
|
2165
|
-
W0(this.options), this._detectEnvironmentAndLayout(), this._createInitPromises(), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
2166
|
-
}
|
|
2167
|
-
//********************
|
|
2168
|
-
//* PRIVATE METHODS
|
|
2169
|
-
//********************
|
|
2170
|
-
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
2171
|
-
_processCountryData() {
|
|
2172
|
-
this.countries = z0(this.options);
|
|
2173
|
-
const e = Y0(this.countries, this.options);
|
|
2174
|
-
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);
|
|
2012
|
+
class Z0 {
|
|
2013
|
+
constructor(e, $, i) {
|
|
2014
|
+
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);
|
|
2175
2015
|
}
|
|
2176
2016
|
//* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
|
|
2177
|
-
|
|
2178
|
-
this._prepareTelInput();
|
|
2179
|
-
const
|
|
2180
|
-
this._maybeBuildCountryContainer(
|
|
2017
|
+
generateMarkup(e) {
|
|
2018
|
+
this.countries = e, this._prepareTelInput();
|
|
2019
|
+
const $ = this._createWrapperAndInsert();
|
|
2020
|
+
this._maybeBuildCountryContainer($), $.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs($);
|
|
2181
2021
|
}
|
|
2182
2022
|
_prepareTelInput() {
|
|
2183
|
-
|
|
2023
|
+
var e;
|
|
2024
|
+
this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((e = this.telInput.form) != null && e.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
|
|
2184
2025
|
}
|
|
2185
2026
|
_createWrapperAndInsert() {
|
|
2186
|
-
var c;
|
|
2187
2027
|
const {
|
|
2188
2028
|
allowDropdown: e,
|
|
2189
2029
|
showFlags: $,
|
|
2190
2030
|
containerClass: i,
|
|
2191
2031
|
useFullscreenPopup: s
|
|
2192
|
-
} = this.options,
|
|
2032
|
+
} = this.options, h = w1({
|
|
2193
2033
|
iti: !0,
|
|
2194
2034
|
"iti--allow-dropdown": e,
|
|
2195
2035
|
"iti--show-flags": $,
|
|
2196
2036
|
"iti--inline-dropdown": !s,
|
|
2197
2037
|
[i]: !!i
|
|
2198
|
-
}),
|
|
2199
|
-
return
|
|
2038
|
+
}), u = v("div", { class: h });
|
|
2039
|
+
return this.isRTL && u.setAttribute("dir", "ltr"), this.telInput.before(u), u;
|
|
2200
2040
|
}
|
|
2201
2041
|
_maybeBuildCountryContainer(e) {
|
|
2202
|
-
const {
|
|
2203
|
-
allowDropdown: $,
|
|
2204
|
-
separateDialCode: i,
|
|
2205
|
-
showFlags: s
|
|
2206
|
-
} = this.options;
|
|
2042
|
+
const { allowDropdown: $, separateDialCode: i, showFlags: s } = this.options;
|
|
2207
2043
|
if ($ || s || i) {
|
|
2208
|
-
this.countryContainer =
|
|
2044
|
+
this.countryContainer = v(
|
|
2209
2045
|
"div",
|
|
2210
2046
|
// visibly hidden until we measure it's width to set the input padding correctly
|
|
2211
2047
|
{ class: "iti__country-container iti__v-hide" },
|
|
2212
2048
|
e
|
|
2213
|
-
),
|
|
2049
|
+
), $ ? (this.selectedCountry = v(
|
|
2214
2050
|
"button",
|
|
2215
2051
|
{
|
|
2216
2052
|
type: "button",
|
|
@@ -2221,27 +2057,27 @@ class f1 {
|
|
|
2221
2057
|
"aria-controls": `iti-${this.id}__dropdown-content`
|
|
2222
2058
|
},
|
|
2223
2059
|
this.countryContainer
|
|
2224
|
-
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry =
|
|
2060
|
+
), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = v(
|
|
2225
2061
|
"div",
|
|
2226
2062
|
{ class: "iti__selected-country" },
|
|
2227
2063
|
this.countryContainer
|
|
2228
2064
|
);
|
|
2229
|
-
const
|
|
2065
|
+
const h = v(
|
|
2230
2066
|
"div",
|
|
2231
2067
|
{ class: "iti__selected-country-primary" },
|
|
2232
2068
|
this.selectedCountry
|
|
2233
2069
|
);
|
|
2234
|
-
this.selectedCountryInner =
|
|
2070
|
+
this.selectedCountryInner = v(
|
|
2235
2071
|
"div",
|
|
2236
2072
|
{ class: "iti__flag" },
|
|
2237
|
-
|
|
2238
|
-
), $ && (this.dropdownArrow =
|
|
2073
|
+
h
|
|
2074
|
+
), $ && (this.dropdownArrow = v(
|
|
2239
2075
|
"div",
|
|
2240
2076
|
{ class: "iti__arrow", "aria-hidden": "true" },
|
|
2241
|
-
|
|
2242
|
-
)), i && (this.selectedDialCode =
|
|
2077
|
+
h
|
|
2078
|
+
)), i && (this.selectedDialCode = v(
|
|
2243
2079
|
"div",
|
|
2244
|
-
{ class: "iti__selected-dial-code"
|
|
2080
|
+
{ class: "iti__selected-dial-code" },
|
|
2245
2081
|
this.selectedCountry
|
|
2246
2082
|
)), $ && this._buildDropdownContent();
|
|
2247
2083
|
}
|
|
@@ -2252,15 +2088,15 @@ class f1 {
|
|
|
2252
2088
|
useFullscreenPopup: $,
|
|
2253
2089
|
countrySearch: i,
|
|
2254
2090
|
i18n: s,
|
|
2255
|
-
dropdownContainer:
|
|
2256
|
-
containerClass:
|
|
2257
|
-
} = this.options,
|
|
2258
|
-
if (this.dropdownContent =
|
|
2091
|
+
dropdownContainer: h,
|
|
2092
|
+
containerClass: u
|
|
2093
|
+
} = this.options, f = e ? "" : "iti--flexible-dropdown-width";
|
|
2094
|
+
if (this.dropdownContent = v("div", {
|
|
2259
2095
|
id: `iti-${this.id}__dropdown-content`,
|
|
2260
|
-
class: `iti__dropdown-content iti__hide ${
|
|
2096
|
+
class: `iti__dropdown-content iti__hide ${f}`,
|
|
2261
2097
|
role: "dialog",
|
|
2262
2098
|
"aria-modal": "true"
|
|
2263
|
-
}), i && this._buildSearchUI(), this.countryList =
|
|
2099
|
+
}), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = v(
|
|
2264
2100
|
"ul",
|
|
2265
2101
|
{
|
|
2266
2102
|
class: "iti__country-list",
|
|
@@ -2269,25 +2105,25 @@ class f1 {
|
|
|
2269
2105
|
"aria-label": s.countryListAriaLabel
|
|
2270
2106
|
},
|
|
2271
2107
|
this.dropdownContent
|
|
2272
|
-
), this._appendListItems(),
|
|
2273
|
-
const
|
|
2108
|
+
), this._appendListItems(), this.options.countrySearch && this.updateSearchResultsA11yText(), h) {
|
|
2109
|
+
const c = w1({
|
|
2274
2110
|
iti: !0,
|
|
2275
2111
|
"iti--container": !0,
|
|
2276
2112
|
"iti--fullscreen-popup": $,
|
|
2277
2113
|
"iti--inline-dropdown": !$,
|
|
2278
|
-
[
|
|
2114
|
+
[u]: !!u
|
|
2279
2115
|
});
|
|
2280
|
-
this.dropdown =
|
|
2116
|
+
this.dropdown = v("div", { class: c }), this.dropdown.appendChild(this.dropdownContent);
|
|
2281
2117
|
} else
|
|
2282
2118
|
this.countryContainer.appendChild(this.dropdownContent);
|
|
2283
2119
|
}
|
|
2284
2120
|
_buildSearchUI() {
|
|
2285
|
-
const { i18n: e } = this.options, $ =
|
|
2121
|
+
const { i18n: e } = this.options, $ = v(
|
|
2286
2122
|
"div",
|
|
2287
2123
|
{ class: "iti__search-input-wrapper" },
|
|
2288
2124
|
this.dropdownContent
|
|
2289
2125
|
);
|
|
2290
|
-
this.searchIcon =
|
|
2126
|
+
this.searchIcon = v(
|
|
2291
2127
|
"span",
|
|
2292
2128
|
{
|
|
2293
2129
|
class: "iti__search-icon",
|
|
@@ -2298,7 +2134,7 @@ class f1 {
|
|
|
2298
2134
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
|
|
2299
2135
|
<circle cx="11" cy="11" r="7" />
|
|
2300
2136
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
2301
|
-
</svg>`, this.searchInput =
|
|
2137
|
+
</svg>`, this.searchInput = v(
|
|
2302
2138
|
"input",
|
|
2303
2139
|
{
|
|
2304
2140
|
id: `iti-${this.id}__search-input`,
|
|
@@ -2315,7 +2151,7 @@ class f1 {
|
|
|
2315
2151
|
autocomplete: "off"
|
|
2316
2152
|
},
|
|
2317
2153
|
$
|
|
2318
|
-
), this.searchClearButton =
|
|
2154
|
+
), this.searchClearButton = v(
|
|
2319
2155
|
"button",
|
|
2320
2156
|
{
|
|
2321
2157
|
type: "button",
|
|
@@ -2333,11 +2169,11 @@ class f1 {
|
|
|
2333
2169
|
<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" />
|
|
2334
2170
|
</mask>
|
|
2335
2171
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${i})" />
|
|
2336
|
-
</svg>`, this.searchResultsA11yText =
|
|
2172
|
+
</svg>`, this.searchResultsA11yText = v(
|
|
2337
2173
|
"span",
|
|
2338
2174
|
{ class: "iti__a11y-text" },
|
|
2339
2175
|
this.dropdownContent
|
|
2340
|
-
), this.searchNoResults =
|
|
2176
|
+
), this.searchNoResults = v(
|
|
2341
2177
|
"div",
|
|
2342
2178
|
{
|
|
2343
2179
|
class: "iti__no-results iti__hide",
|
|
@@ -2348,109 +2184,371 @@ class f1 {
|
|
|
2348
2184
|
), this.searchNoResults.textContent = e.zeroSearchResults;
|
|
2349
2185
|
}
|
|
2350
2186
|
_maybeUpdateInputPaddingAndReveal() {
|
|
2351
|
-
this.countryContainer && (this.
|
|
2187
|
+
this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove("iti__v-hide"));
|
|
2352
2188
|
}
|
|
2353
2189
|
_maybeBuildHiddenInputs(e) {
|
|
2354
2190
|
var i, s;
|
|
2355
2191
|
const { hiddenInput: $ } = this.options;
|
|
2356
2192
|
if ($) {
|
|
2357
|
-
const
|
|
2358
|
-
if (
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2193
|
+
const h = this.telInput.getAttribute("name") || "", u = $(h);
|
|
2194
|
+
if (u.phone) {
|
|
2195
|
+
const f = (i = this.telInput.form) == null ? void 0 : i.querySelector(
|
|
2196
|
+
`input[name="${u.phone}"]`
|
|
2197
|
+
);
|
|
2198
|
+
f ? this.hiddenInput = f : (this.hiddenInput = v("input", {
|
|
2361
2199
|
type: "hidden",
|
|
2362
|
-
name:
|
|
2200
|
+
name: u.phone
|
|
2363
2201
|
}), e.appendChild(this.hiddenInput));
|
|
2364
2202
|
}
|
|
2365
|
-
if (
|
|
2366
|
-
const
|
|
2367
|
-
|
|
2203
|
+
if (u.country) {
|
|
2204
|
+
const f = (s = this.telInput.form) == null ? void 0 : s.querySelector(
|
|
2205
|
+
`input[name="${u.country}"]`
|
|
2206
|
+
);
|
|
2207
|
+
f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = v("input", {
|
|
2368
2208
|
type: "hidden",
|
|
2369
|
-
name:
|
|
2209
|
+
name: u.country
|
|
2370
2210
|
}), e.appendChild(this.hiddenInputCountry));
|
|
2371
2211
|
}
|
|
2372
2212
|
}
|
|
2373
2213
|
}
|
|
2374
2214
|
//* For each country: add a country list item <li> to the countryList <ul> container.
|
|
2375
2215
|
_appendListItems() {
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2216
|
+
const e = document.createDocumentFragment();
|
|
2217
|
+
for (let $ = 0; $ < this.countries.length; $++) {
|
|
2218
|
+
const i = this.countries[$], s = w1({
|
|
2219
|
+
iti__country: !0,
|
|
2220
|
+
iti__highlight: $ === 0
|
|
2221
|
+
}), h = v("li", {
|
|
2222
|
+
id: `iti-${this.id}__item-${i.iso2}`,
|
|
2223
|
+
class: s,
|
|
2224
|
+
tabindex: "-1",
|
|
2225
|
+
role: "option",
|
|
2226
|
+
"aria-selected": "false"
|
|
2227
|
+
});
|
|
2228
|
+
h.dataset.dialCode = i.dialCode, h.dataset.countryCode = i.iso2, i.nodeById[this.id] = h, this.options.showFlags && v("div", { class: `iti__flag iti__${i.iso2}` }, h);
|
|
2229
|
+
const u = v("span", { class: "iti__country-name" }, h);
|
|
2230
|
+
u.textContent = i.name;
|
|
2231
|
+
const f = v("span", { class: "iti__dial-code" }, h);
|
|
2232
|
+
this.isRTL && f.setAttribute("dir", "ltr"), f.textContent = `+${i.dialCode}`, e.appendChild(h);
|
|
2233
|
+
}
|
|
2234
|
+
this.countryList.appendChild(e);
|
|
2235
|
+
}
|
|
2236
|
+
//* Update the input padding to make space for the selected country/dial code.
|
|
2237
|
+
updateInputPadding() {
|
|
2238
|
+
if (this.selectedCountry) {
|
|
2239
|
+
const e = this.options.separateDialCode ? 78 : 42, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + 6;
|
|
2240
|
+
this.telInput.style.paddingLeft = `${i}px`;
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2244
|
+
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2245
|
+
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2246
|
+
//* and then to inject a deep clone of the selectedCountry element.
|
|
2247
|
+
_getHiddenSelectedCountryWidth() {
|
|
2248
|
+
if (this.telInput.parentNode) {
|
|
2249
|
+
let e;
|
|
2250
|
+
try {
|
|
2251
|
+
e = window.top.document.body;
|
|
2252
|
+
} catch {
|
|
2253
|
+
e = document.body;
|
|
2254
|
+
}
|
|
2255
|
+
const $ = this.telInput.parentNode.cloneNode(
|
|
2256
|
+
!1
|
|
2257
|
+
);
|
|
2258
|
+
$.style.visibility = "hidden", e.appendChild($);
|
|
2259
|
+
const i = this.countryContainer.cloneNode();
|
|
2260
|
+
$.appendChild(i);
|
|
2261
|
+
const s = this.selectedCountry.cloneNode(
|
|
2262
|
+
!0
|
|
2263
|
+
);
|
|
2264
|
+
i.appendChild(s);
|
|
2265
|
+
const h = s.offsetWidth;
|
|
2266
|
+
return e.removeChild($), h;
|
|
2267
|
+
}
|
|
2268
|
+
return 0;
|
|
2269
|
+
}
|
|
2270
|
+
//* Update search results text (for a11y).
|
|
2271
|
+
updateSearchResultsA11yText() {
|
|
2272
|
+
const { i18n: e } = this.options, $ = this.countryList.childElementCount;
|
|
2273
|
+
let i;
|
|
2274
|
+
$ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace(
|
|
2275
|
+
"${count}",
|
|
2276
|
+
$.toString()
|
|
2277
|
+
), this.searchResultsA11yText.textContent = i;
|
|
2278
|
+
}
|
|
2279
|
+
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2280
|
+
scrollTo(e) {
|
|
2281
|
+
const $ = this.countryList, i = document.documentElement.scrollTop, s = $.offsetHeight, h = $.getBoundingClientRect().top + i, u = h + s, f = e.offsetHeight, c = e.getBoundingClientRect().top + i, g = c + f, I = c - h + $.scrollTop;
|
|
2282
|
+
if (c < h)
|
|
2283
|
+
$.scrollTop = I;
|
|
2284
|
+
else if (g > u) {
|
|
2285
|
+
const S = s - f;
|
|
2286
|
+
$.scrollTop = I - S;
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
//* Remove highlighting from other list items and highlight the given item.
|
|
2290
|
+
highlightListItem(e, $) {
|
|
2291
|
+
const i = this.highlightedItem;
|
|
2292
|
+
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)) {
|
|
2293
|
+
const s = this.highlightedItem.getAttribute("id") || "";
|
|
2294
|
+
this.searchInput.setAttribute(
|
|
2295
|
+
"aria-activedescendant",
|
|
2296
|
+
s
|
|
2389
2297
|
);
|
|
2390
|
-
$.nodeById[this.id] = s;
|
|
2391
|
-
let u = "";
|
|
2392
|
-
this.options.showFlags && (u += `<div class='iti__flag iti__${$.iso2}'></div>`), u += `<span class='iti__country-name'>${$.name}</span>`, u += `<span class='iti__dial-code' dir='ltr'>+${$.dialCode}</span>`, s.insertAdjacentHTML("beforeend", u);
|
|
2393
2298
|
}
|
|
2299
|
+
$ && this.highlightedItem.focus();
|
|
2300
|
+
}
|
|
2301
|
+
//* Country search: Filter the country list to the given array of countries.
|
|
2302
|
+
filterCountries(e) {
|
|
2303
|
+
this.countryList.innerHTML = "";
|
|
2304
|
+
let $ = !0;
|
|
2305
|
+
for (const i of e) {
|
|
2306
|
+
const s = i.nodeById[this.id];
|
|
2307
|
+
s && (this.countryList.appendChild(s), $ && (this.highlightListItem(s, !1), $ = !1));
|
|
2308
|
+
}
|
|
2309
|
+
$ ? (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();
|
|
2310
|
+
}
|
|
2311
|
+
destroy() {
|
|
2312
|
+
this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2313
|
+
const e = this.telInput.parentNode;
|
|
2314
|
+
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;
|
|
2315
|
+
for (const $ of this.countries)
|
|
2316
|
+
delete $.nodeById[this.id];
|
|
2317
|
+
this.countries = null;
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
function Y0(p) {
|
|
2321
|
+
const { onlyCountries: e, excludeCountries: $ } = p;
|
|
2322
|
+
if (e.length) {
|
|
2323
|
+
const i = e.map((s) => s.toLowerCase());
|
|
2324
|
+
return Y.filter((s) => i.includes(s.iso2));
|
|
2325
|
+
} else if ($.length) {
|
|
2326
|
+
const i = $.map((s) => s.toLowerCase());
|
|
2327
|
+
return Y.filter((s) => !i.includes(s.iso2));
|
|
2328
|
+
}
|
|
2329
|
+
return Y;
|
|
2330
|
+
}
|
|
2331
|
+
function J0(p, e) {
|
|
2332
|
+
for (const $ of p) {
|
|
2333
|
+
const i = $.iso2.toLowerCase();
|
|
2334
|
+
e.i18n[i] && ($.name = e.i18n[i]);
|
|
2335
|
+
}
|
|
2336
|
+
}
|
|
2337
|
+
function q0(p, e) {
|
|
2338
|
+
const $ = /* @__PURE__ */ new Set();
|
|
2339
|
+
let i = 0;
|
|
2340
|
+
const s = {}, h = (u, f, c) => {
|
|
2341
|
+
if (!u || !f)
|
|
2342
|
+
return;
|
|
2343
|
+
f.length > i && (i = f.length), s.hasOwnProperty(f) || (s[f] = []);
|
|
2344
|
+
const g = s[f];
|
|
2345
|
+
if (g.includes(u))
|
|
2346
|
+
return;
|
|
2347
|
+
const I = c !== void 0 ? c : g.length;
|
|
2348
|
+
g[I] = u;
|
|
2349
|
+
};
|
|
2350
|
+
for (const u of p) {
|
|
2351
|
+
$.has(u.dialCode) || $.add(u.dialCode);
|
|
2352
|
+
for (let f = 1; f < u.dialCode.length; f++) {
|
|
2353
|
+
const c = u.dialCode.substring(0, f);
|
|
2354
|
+
h(u.iso2, c);
|
|
2355
|
+
}
|
|
2356
|
+
h(u.iso2, u.dialCode, u.priority);
|
|
2357
|
+
}
|
|
2358
|
+
(e.onlyCountries.length || e.excludeCountries.length) && $.forEach((u) => {
|
|
2359
|
+
s[u] = s[u].filter(Boolean);
|
|
2360
|
+
});
|
|
2361
|
+
for (const u of p)
|
|
2362
|
+
if (u.areaCodes) {
|
|
2363
|
+
const f = s[u.dialCode][0];
|
|
2364
|
+
for (const c of u.areaCodes) {
|
|
2365
|
+
for (let g = 1; g < c.length; g++) {
|
|
2366
|
+
const I = c.substring(0, g), S = u.dialCode + I;
|
|
2367
|
+
h(f, S), h(u.iso2, S);
|
|
2368
|
+
}
|
|
2369
|
+
h(u.iso2, u.dialCode + c);
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: s };
|
|
2373
|
+
}
|
|
2374
|
+
function X0(p, e) {
|
|
2375
|
+
e.countryOrder && (e.countryOrder = e.countryOrder.map(($) => $.toLowerCase())), p.sort(($, i) => {
|
|
2376
|
+
const { countryOrder: s } = e;
|
|
2377
|
+
if (s) {
|
|
2378
|
+
const h = s.indexOf($.iso2), u = s.indexOf(i.iso2), f = h > -1, c = u > -1;
|
|
2379
|
+
if (f || c)
|
|
2380
|
+
return f && c ? h - u : f ? -1 : 1;
|
|
2381
|
+
}
|
|
2382
|
+
return $.name.localeCompare(i.name);
|
|
2383
|
+
});
|
|
2384
|
+
}
|
|
2385
|
+
function Q0(p) {
|
|
2386
|
+
for (const e of p)
|
|
2387
|
+
e.normalisedName = c0(e.name), e.initials = e.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map(($) => $[0]).join("").toLowerCase(), e.dialCodePlus = `+${e.dialCode}`;
|
|
2388
|
+
}
|
|
2389
|
+
function d2(p, e, $, i) {
|
|
2390
|
+
let s = p;
|
|
2391
|
+
if ($ && e) {
|
|
2392
|
+
e = `+${i.dialCode}`;
|
|
2393
|
+
const h = s[e.length] === " " || s[e.length] === "-" ? e.length + 1 : e.length;
|
|
2394
|
+
s = s.substring(h);
|
|
2395
|
+
}
|
|
2396
|
+
return s;
|
|
2397
|
+
}
|
|
2398
|
+
function t2(p, e, $, i, s) {
|
|
2399
|
+
const h = $ ? $.formatNumberAsYouType(p, i.iso2) : p, { dialCode: u } = i;
|
|
2400
|
+
return s && e.charAt(0) !== "+" && h.includes(`+${u}`) ? (h.split(`+${u}`)[1] || "").trim() : h;
|
|
2401
|
+
}
|
|
2402
|
+
function e2(p, e, $, i) {
|
|
2403
|
+
if ($ === 0 && !i)
|
|
2404
|
+
return 0;
|
|
2405
|
+
let s = 0;
|
|
2406
|
+
for (let h = 0; h < e.length; h++) {
|
|
2407
|
+
if (/[+0-9]/.test(e[h]) && s++, s === p && !i)
|
|
2408
|
+
return h + 1;
|
|
2409
|
+
if (i && s === p + 1)
|
|
2410
|
+
return h;
|
|
2411
|
+
}
|
|
2412
|
+
return e.length;
|
|
2413
|
+
}
|
|
2414
|
+
const $2 = [
|
|
2415
|
+
"800",
|
|
2416
|
+
"822",
|
|
2417
|
+
"833",
|
|
2418
|
+
"844",
|
|
2419
|
+
"855",
|
|
2420
|
+
"866",
|
|
2421
|
+
"877",
|
|
2422
|
+
"880",
|
|
2423
|
+
"881",
|
|
2424
|
+
"882",
|
|
2425
|
+
"883",
|
|
2426
|
+
"884",
|
|
2427
|
+
"885",
|
|
2428
|
+
"886",
|
|
2429
|
+
"887",
|
|
2430
|
+
"888",
|
|
2431
|
+
"889"
|
|
2432
|
+
], l0 = (p) => {
|
|
2433
|
+
const e = c1(p);
|
|
2434
|
+
if (e.charAt(0) === "1") {
|
|
2435
|
+
const $ = e.substring(1, 4);
|
|
2436
|
+
return $2.includes($);
|
|
2437
|
+
}
|
|
2438
|
+
return !1;
|
|
2439
|
+
};
|
|
2440
|
+
for (const p of Y)
|
|
2441
|
+
p.name = a0[p.iso2];
|
|
2442
|
+
let n2 = 0;
|
|
2443
|
+
const i2 = new Set(Y.map((p) => p.iso2)), S1 = (p) => i2.has(p);
|
|
2444
|
+
class v1 {
|
|
2445
|
+
constructor(e, $ = {}) {
|
|
2446
|
+
this.id = n2++, this.options = { ...h0, ...$ }, z0(this.options), this.ui = new Z0(e, this.options, this.id), this.isAndroid = v1._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = Y0(this.options);
|
|
2447
|
+
const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: h } = q0(
|
|
2448
|
+
this.countries,
|
|
2449
|
+
this.options
|
|
2450
|
+
);
|
|
2451
|
+
this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = h, this.countryByIso2 = new Map(this.countries.map((u) => [u.iso2, u])), this._init();
|
|
2452
|
+
}
|
|
2453
|
+
static _getIsAndroid() {
|
|
2454
|
+
return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
|
|
2455
|
+
}
|
|
2456
|
+
_createInitPromises() {
|
|
2457
|
+
const e = new Promise((i, s) => {
|
|
2458
|
+
this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
|
|
2459
|
+
}), $ = new Promise((i, s) => {
|
|
2460
|
+
this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = s;
|
|
2461
|
+
});
|
|
2462
|
+
return Promise.all([e, $]);
|
|
2463
|
+
}
|
|
2464
|
+
//* Can't be private as it's called from intlTelInput convenience wrapper.
|
|
2465
|
+
_init() {
|
|
2466
|
+
this.selectedCountryData = {}, this.abortController = new AbortController(), this._processCountryData(), this.ui.generateMarkup(this.countries), this._setInitialState(), this._initListeners(), this._initRequests();
|
|
2467
|
+
}
|
|
2468
|
+
//********************
|
|
2469
|
+
//* PRIVATE METHODS
|
|
2470
|
+
//********************
|
|
2471
|
+
//* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
|
|
2472
|
+
_processCountryData() {
|
|
2473
|
+
J0(this.countries, this.options), X0(this.countries, this.options), Q0(this.countries);
|
|
2394
2474
|
}
|
|
2395
2475
|
//* Set the initial state of the input value and the selected country by:
|
|
2396
2476
|
//* 1. Extracting a dial code from the given number
|
|
2397
2477
|
//* 2. Using explicit initialCountry
|
|
2398
2478
|
_setInitialState(e = !1) {
|
|
2399
|
-
const $ = this.telInput.getAttribute("value"), i = this.telInput.value,
|
|
2400
|
-
if (
|
|
2401
|
-
this._updateCountryFromNumber(
|
|
2479
|
+
const $ = this.ui.telInput.getAttribute("value"), i = this.ui.telInput.value, h = $ && $.startsWith("+") && (!i || !i.startsWith("+")) ? $ : i, u = this._getDialCode(h), f = l0(h), { initialCountry: c, geoIpLookup: g } = this.options, I = c === "auto" && g;
|
|
2480
|
+
if (u && !f)
|
|
2481
|
+
this._updateCountryFromNumber(h);
|
|
2402
2482
|
else if (!I || e) {
|
|
2403
|
-
const
|
|
2404
|
-
|
|
2483
|
+
const S = c ? c.toLowerCase() : "";
|
|
2484
|
+
S1(S) ? this._setCountry(S) : u && f ? this._setCountry("us") : this._setCountry("");
|
|
2405
2485
|
}
|
|
2406
|
-
|
|
2486
|
+
h && this._updateValFromNumber(h);
|
|
2407
2487
|
}
|
|
2408
2488
|
//* Initialise the main event listeners: input keyup, and click selected country.
|
|
2409
2489
|
_initListeners() {
|
|
2410
|
-
this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.hiddenInput || this.hiddenInputCountry) && this.telInput.form && this._initHiddenInputListener();
|
|
2490
|
+
this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.ui.hiddenInput || this.ui.hiddenInputCountry) && this.ui.telInput.form && this._initHiddenInputListener();
|
|
2411
2491
|
}
|
|
2412
2492
|
//* Update hidden input on form submit.
|
|
2413
2493
|
_initHiddenInputListener() {
|
|
2414
|
-
var
|
|
2415
|
-
|
|
2416
|
-
this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2419
|
-
this.
|
|
2420
|
-
);
|
|
2494
|
+
var $;
|
|
2495
|
+
const e = () => {
|
|
2496
|
+
this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
|
|
2497
|
+
};
|
|
2498
|
+
($ = this.ui.telInput.form) == null || $.addEventListener("submit", e, {
|
|
2499
|
+
signal: this.abortController.signal
|
|
2500
|
+
});
|
|
2421
2501
|
}
|
|
2422
2502
|
//* initialise the dropdown listeners.
|
|
2423
2503
|
_initDropdownListeners() {
|
|
2424
|
-
this.
|
|
2425
|
-
this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() :
|
|
2504
|
+
const e = this.abortController.signal, $ = (u) => {
|
|
2505
|
+
this.ui.dropdownContent.classList.contains("iti__hide") ? this.ui.telInput.focus() : u.preventDefault();
|
|
2506
|
+
}, i = this.ui.telInput.closest("label");
|
|
2507
|
+
i && i.addEventListener("click", $, { signal: e });
|
|
2508
|
+
const s = () => {
|
|
2509
|
+
this.ui.dropdownContent.classList.contains("iti__hide") && !this.ui.telInput.disabled && !this.ui.telInput.readOnly && this._openDropdown();
|
|
2510
|
+
};
|
|
2511
|
+
this.ui.selectedCountry.addEventListener("click", s, {
|
|
2512
|
+
signal: e
|
|
2513
|
+
});
|
|
2514
|
+
const h = (u) => {
|
|
2515
|
+
this.ui.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(u.key) && (u.preventDefault(), u.stopPropagation(), this._openDropdown()), u.key === "Tab" && this._closeDropdown();
|
|
2426
2516
|
};
|
|
2427
|
-
|
|
2428
|
-
e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
|
|
2429
|
-
this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
|
|
2430
|
-
}, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = ($) => {
|
|
2431
|
-
this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes($.key) && ($.preventDefault(), $.stopPropagation(), this._openDropdown()), $.key === "Tab" && this._closeDropdown();
|
|
2432
|
-
}, this.countryContainer.addEventListener(
|
|
2517
|
+
this.ui.countryContainer.addEventListener(
|
|
2433
2518
|
"keydown",
|
|
2434
|
-
|
|
2519
|
+
h,
|
|
2520
|
+
{ signal: e }
|
|
2435
2521
|
);
|
|
2436
2522
|
}
|
|
2437
2523
|
//* Init many requests: utils script / geo ip lookup.
|
|
2438
2524
|
_initRequests() {
|
|
2439
|
-
|
|
2440
|
-
e && !y.utils
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2525
|
+
const { loadUtils: e, initialCountry: $, geoIpLookup: i } = this.options;
|
|
2526
|
+
if (e && !y.utils) {
|
|
2527
|
+
const h = () => {
|
|
2528
|
+
var u;
|
|
2529
|
+
(u = y.attachUtils(e)) == null || u.catch(() => {
|
|
2530
|
+
});
|
|
2531
|
+
};
|
|
2532
|
+
if (y.documentReady())
|
|
2533
|
+
h();
|
|
2534
|
+
else {
|
|
2535
|
+
const u = () => {
|
|
2536
|
+
h();
|
|
2537
|
+
};
|
|
2538
|
+
window.addEventListener("load", u, {
|
|
2539
|
+
signal: this.abortController.signal
|
|
2540
|
+
});
|
|
2541
|
+
}
|
|
2542
|
+
} else
|
|
2543
|
+
this.resolveUtilsScriptPromise();
|
|
2544
|
+
$ === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
|
|
2447
2545
|
}
|
|
2448
2546
|
//* Perform the geo ip lookup.
|
|
2449
2547
|
_loadAutoCountry() {
|
|
2450
2548
|
y.autoCountry ? this.handleAutoCountry() : y.startedLoadingAutoCountry || (y.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
|
|
2451
2549
|
(e = "") => {
|
|
2452
2550
|
const $ = e.toLowerCase();
|
|
2453
|
-
|
|
2551
|
+
S1($) ? (y.autoCountry = $, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
|
|
2454
2552
|
},
|
|
2455
2553
|
() => {
|
|
2456
2554
|
this._setInitialState(!0), $1("rejectAutoCountryPromise");
|
|
@@ -2458,141 +2556,205 @@ class f1 {
|
|
|
2458
2556
|
));
|
|
2459
2557
|
}
|
|
2460
2558
|
_openDropdownWithPlus() {
|
|
2461
|
-
this._openDropdown(), this.searchInput.value = "+", this.
|
|
2559
|
+
this._openDropdown(), this.ui.searchInput.value = "+", this._filterCountriesByQuery("");
|
|
2462
2560
|
}
|
|
2463
2561
|
//* Initialize the tel input listeners.
|
|
2464
2562
|
_initTelInputListeners() {
|
|
2465
2563
|
this._bindInputListener(), this._maybeBindKeydownListener(), this._maybeBindPasteListener();
|
|
2466
2564
|
}
|
|
2467
2565
|
_bindInputListener() {
|
|
2468
|
-
const {
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2566
|
+
const {
|
|
2567
|
+
strictMode: e,
|
|
2568
|
+
formatAsYouType: $,
|
|
2569
|
+
separateDialCode: i,
|
|
2570
|
+
allowDropdown: s,
|
|
2571
|
+
countrySearch: h
|
|
2572
|
+
} = this.options;
|
|
2573
|
+
let u = !1;
|
|
2574
|
+
new RegExp("\\p{L}", "u").test(this.ui.telInput.value) && (u = !0);
|
|
2575
|
+
const f = (c) => {
|
|
2576
|
+
if (this.isAndroid && (c == null ? void 0 : c.data) === "+" && i && s && h) {
|
|
2577
|
+
const L = this.ui.telInput.selectionStart || 0, b = this.ui.telInput.value.substring(
|
|
2578
|
+
0,
|
|
2579
|
+
L - 1
|
|
2580
|
+
), A = this.ui.telInput.value.substring(L);
|
|
2581
|
+
this.ui.telInput.value = b + A, this._openDropdownWithPlus();
|
|
2474
2582
|
return;
|
|
2475
2583
|
}
|
|
2476
|
-
this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
|
|
2477
|
-
const
|
|
2478
|
-
|
|
2479
|
-
const
|
|
2480
|
-
if ($ && !
|
|
2481
|
-
const
|
|
2482
|
-
|
|
2483
|
-
|
|
2584
|
+
this._updateCountryFromNumber(this.ui.telInput.value) && this._triggerCountryChange();
|
|
2585
|
+
const g = (c == null ? void 0 : c.data) && /[^+0-9]/.test(c.data), I = (c == null ? void 0 : c.inputType) === "insertFromPaste" && this.ui.telInput.value;
|
|
2586
|
+
g || I && !e ? u = !0 : /[^+0-9]/.test(this.ui.telInput.value) || (u = !1);
|
|
2587
|
+
const S = (c == null ? void 0 : c.detail) && c.detail.isSetNumber;
|
|
2588
|
+
if ($ && !u && !S) {
|
|
2589
|
+
const L = this.ui.telInput.selectionStart || 0, A = this.ui.telInput.value.substring(
|
|
2590
|
+
0,
|
|
2591
|
+
L
|
|
2592
|
+
).replace(
|
|
2593
|
+
/[^+0-9]/g,
|
|
2594
|
+
""
|
|
2595
|
+
).length, G = (c == null ? void 0 : c.inputType) === "deleteContentForward", E = this._getFullNumber(), P = t2(
|
|
2596
|
+
E,
|
|
2597
|
+
this.ui.telInput.value,
|
|
2484
2598
|
y.utils,
|
|
2485
2599
|
this.selectedCountryData,
|
|
2486
2600
|
this.options.separateDialCode
|
|
2487
|
-
),
|
|
2488
|
-
|
|
2601
|
+
), U = e2(
|
|
2602
|
+
A,
|
|
2603
|
+
P,
|
|
2604
|
+
L,
|
|
2605
|
+
G
|
|
2606
|
+
);
|
|
2607
|
+
this.ui.telInput.value = P, this.ui.telInput.setSelectionRange(U, U);
|
|
2489
2608
|
}
|
|
2490
|
-
}
|
|
2609
|
+
};
|
|
2610
|
+
this.ui.telInput.addEventListener("input", f, {
|
|
2611
|
+
signal: this.abortController.signal
|
|
2612
|
+
});
|
|
2491
2613
|
}
|
|
2492
2614
|
_maybeBindKeydownListener() {
|
|
2493
2615
|
const { strictMode: e, separateDialCode: $, allowDropdown: i, countrySearch: s } = this.options;
|
|
2494
|
-
(e || $)
|
|
2495
|
-
|
|
2496
|
-
if (
|
|
2497
|
-
u.
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2616
|
+
if (e || $) {
|
|
2617
|
+
const h = (u) => {
|
|
2618
|
+
if (u.key && u.key.length === 1 && !u.altKey && !u.ctrlKey && !u.metaKey) {
|
|
2619
|
+
if ($ && i && s && u.key === "+") {
|
|
2620
|
+
u.preventDefault(), this._openDropdownWithPlus();
|
|
2621
|
+
return;
|
|
2622
|
+
}
|
|
2623
|
+
if (e) {
|
|
2624
|
+
const f = this.ui.telInput.value, g = !f.startsWith("+") && this.ui.telInput.selectionStart === 0 && u.key === "+", I = /^[0-9]$/.test(u.key), S = $ ? I : g || I, L = f.slice(0, this.ui.telInput.selectionStart) + u.key + f.slice(this.ui.telInput.selectionEnd), b = this._getFullNumber(L), A = y.utils.getCoreNumber(
|
|
2625
|
+
b,
|
|
2626
|
+
this.selectedCountryData.iso2
|
|
2627
|
+
), G = this.maxCoreNumberLength && A.length > this.maxCoreNumberLength, P = this._getNewCountryFromNumber(b) !== null;
|
|
2628
|
+
(!S || G && !P && !g) && u.preventDefault();
|
|
2629
|
+
}
|
|
2503
2630
|
}
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2631
|
+
};
|
|
2632
|
+
this.ui.telInput.addEventListener("keydown", h, {
|
|
2633
|
+
signal: this.abortController.signal
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2506
2636
|
}
|
|
2507
2637
|
_maybeBindPasteListener() {
|
|
2508
|
-
this.options.strictMode
|
|
2509
|
-
e
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
if (this.maxCoreNumberLength && P.length > this.maxCoreNumberLength)
|
|
2517
|
-
if ($.selectionEnd === $.value.length) {
|
|
2518
|
-
const j = P.length - this.maxCoreNumberLength;
|
|
2519
|
-
N = N.slice(0, N.length - j);
|
|
2520
|
-
} else
|
|
2638
|
+
if (this.options.strictMode) {
|
|
2639
|
+
const e = ($) => {
|
|
2640
|
+
$.preventDefault();
|
|
2641
|
+
const i = this.ui.telInput, s = i.selectionStart, h = i.selectionEnd, u = i.value.slice(0, s), f = i.value.slice(h), c = this.selectedCountryData.iso2, g = $.clipboardData.getData("text"), I = s === 0 && h > 0, S = !i.value.startsWith("+") || I, L = g.replace(/[^0-9+]/g, ""), b = L.startsWith("+"), A = L.replace(/\+/g, ""), G = b && S ? `+${A}` : A;
|
|
2642
|
+
let E = u + G + f, P = y.utils.getCoreNumber(E, c);
|
|
2643
|
+
for (; P.length === 0 && E.length > 0; )
|
|
2644
|
+
E = E.slice(0, -1), P = y.utils.getCoreNumber(E, c);
|
|
2645
|
+
if (!P)
|
|
2521
2646
|
return;
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2647
|
+
if (this.maxCoreNumberLength && P.length > this.maxCoreNumberLength)
|
|
2648
|
+
if (i.selectionEnd === i.value.length) {
|
|
2649
|
+
const f1 = P.length - this.maxCoreNumberLength;
|
|
2650
|
+
E = E.slice(0, E.length - f1);
|
|
2651
|
+
} else
|
|
2652
|
+
return;
|
|
2653
|
+
i.value = E;
|
|
2654
|
+
const U = s + G.length;
|
|
2655
|
+
i.setSelectionRange(U, U), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
|
|
2656
|
+
};
|
|
2657
|
+
this.ui.telInput.addEventListener("paste", e, {
|
|
2658
|
+
signal: this.abortController.signal
|
|
2659
|
+
});
|
|
2660
|
+
}
|
|
2526
2661
|
}
|
|
2527
2662
|
//* Adhere to the input's maxlength attr.
|
|
2528
2663
|
_cap(e) {
|
|
2529
|
-
const $ =
|
|
2664
|
+
const $ = Number(this.ui.telInput.getAttribute("maxlength"));
|
|
2530
2665
|
return $ && e.length > $ ? e.substring(0, $) : e;
|
|
2531
2666
|
}
|
|
2532
|
-
//* Trigger a custom event on the input.
|
|
2667
|
+
//* Trigger a custom event on the input (typed via ItiEventMap).
|
|
2533
2668
|
_trigger(e, $ = {}) {
|
|
2534
2669
|
const i = new CustomEvent(e, {
|
|
2535
2670
|
bubbles: !0,
|
|
2536
2671
|
cancelable: !0,
|
|
2537
2672
|
detail: $
|
|
2538
2673
|
});
|
|
2539
|
-
this.telInput.dispatchEvent(i);
|
|
2674
|
+
this.ui.telInput.dispatchEvent(i);
|
|
2540
2675
|
}
|
|
2541
2676
|
//* Open the dropdown.
|
|
2542
2677
|
_openDropdown() {
|
|
2543
2678
|
const { fixDropdownWidth: e, countrySearch: $ } = this.options;
|
|
2544
|
-
if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), $) {
|
|
2545
|
-
const i = this.countryList.firstElementChild;
|
|
2546
|
-
i && (this.
|
|
2679
|
+
if (this.dropdownAbortController = new AbortController(), e && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove("iti__hide"), this.ui.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), $) {
|
|
2680
|
+
const i = this.ui.countryList.firstElementChild;
|
|
2681
|
+
i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
|
|
2547
2682
|
}
|
|
2548
|
-
this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2683
|
+
this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
|
|
2549
2684
|
}
|
|
2550
2685
|
//* Set the dropdown position
|
|
2551
2686
|
_setDropdownPosition() {
|
|
2552
|
-
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
|
|
2553
|
-
const e = this.telInput.getBoundingClientRect(), $ = this.telInput.offsetHeight;
|
|
2554
|
-
this.options.dropdownContainer
|
|
2687
|
+
if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
|
|
2688
|
+
const e = this.ui.telInput.getBoundingClientRect(), $ = this.ui.telInput.offsetHeight;
|
|
2689
|
+
if (this.options.dropdownContainer) {
|
|
2690
|
+
this.ui.dropdown.style.top = `${e.top + $}px`, this.ui.dropdown.style.left = `${e.left}px`;
|
|
2691
|
+
const i = () => this._closeDropdown();
|
|
2692
|
+
window.addEventListener("scroll", i, {
|
|
2693
|
+
signal: this.dropdownAbortController.signal
|
|
2694
|
+
});
|
|
2695
|
+
}
|
|
2555
2696
|
}
|
|
2556
2697
|
}
|
|
2557
2698
|
//* We only bind dropdown listeners when the dropdown is open.
|
|
2558
2699
|
_bindDropdownListeners() {
|
|
2559
|
-
this.
|
|
2560
|
-
var
|
|
2561
|
-
const
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2700
|
+
const e = this.dropdownAbortController.signal, $ = (c) => {
|
|
2701
|
+
var I;
|
|
2702
|
+
const g = (I = c.target) == null ? void 0 : I.closest(
|
|
2703
|
+
".iti__country"
|
|
2704
|
+
);
|
|
2705
|
+
g && this.ui.highlightListItem(g, !1);
|
|
2706
|
+
};
|
|
2707
|
+
this.ui.countryList.addEventListener("mouseover", $, {
|
|
2708
|
+
signal: e
|
|
2709
|
+
});
|
|
2710
|
+
const i = (c) => {
|
|
2711
|
+
var I;
|
|
2712
|
+
const g = (I = c.target) == null ? void 0 : I.closest(
|
|
2713
|
+
".iti__country"
|
|
2714
|
+
);
|
|
2715
|
+
g && this._selectListItem(g);
|
|
2716
|
+
};
|
|
2717
|
+
this.ui.countryList.addEventListener("click", i, {
|
|
2718
|
+
signal: e
|
|
2719
|
+
});
|
|
2720
|
+
const s = (c) => {
|
|
2721
|
+
!!c.target.closest(
|
|
2722
|
+
`#iti-${this.id}__dropdown-content`
|
|
2723
|
+
) || this._closeDropdown();
|
|
2724
|
+
};
|
|
2725
|
+
setTimeout(() => {
|
|
2573
2726
|
document.documentElement.addEventListener(
|
|
2574
2727
|
"click",
|
|
2575
|
-
|
|
2728
|
+
s,
|
|
2729
|
+
{ signal: e }
|
|
2576
2730
|
);
|
|
2577
2731
|
}, 0);
|
|
2578
|
-
let
|
|
2579
|
-
|
|
2580
|
-
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(
|
|
2581
|
-
|
|
2732
|
+
let h = "", u = null;
|
|
2733
|
+
const f = (c) => {
|
|
2734
|
+
["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(c.key) && (c.preventDefault(), c.stopPropagation(), c.key === "ArrowUp" || c.key === "ArrowDown" ? this._handleUpDownKey(c.key) : c.key === "Enter" ? this._handleEnterKey() : c.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(c.key) && (c.stopPropagation(), u && clearTimeout(u), h += c.key.toLowerCase(), this._searchForCountry(h), u = setTimeout(() => {
|
|
2735
|
+
h = "";
|
|
2582
2736
|
}, 1e3));
|
|
2583
|
-
}
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2737
|
+
};
|
|
2738
|
+
if (document.addEventListener("keydown", f, { signal: e }), this.options.countrySearch) {
|
|
2739
|
+
const c = () => {
|
|
2740
|
+
const L = this.ui.searchInput.value.trim();
|
|
2741
|
+
this._filterCountriesByQuery(L), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove("iti__hide") : this.ui.searchClearButton.classList.add("iti__hide");
|
|
2587
2742
|
};
|
|
2588
|
-
let
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2743
|
+
let g = null;
|
|
2744
|
+
const I = () => {
|
|
2745
|
+
g && clearTimeout(g), g = setTimeout(() => {
|
|
2746
|
+
c(), g = null;
|
|
2592
2747
|
}, 100);
|
|
2593
|
-
}
|
|
2594
|
-
|
|
2595
|
-
|
|
2748
|
+
};
|
|
2749
|
+
this.ui.searchInput.addEventListener("input", I, {
|
|
2750
|
+
signal: e
|
|
2751
|
+
});
|
|
2752
|
+
const S = () => {
|
|
2753
|
+
this.ui.searchInput.value = "", this.ui.searchInput.focus(), c();
|
|
2754
|
+
};
|
|
2755
|
+
this.ui.searchClearButton.addEventListener("click", S, {
|
|
2756
|
+
signal: e
|
|
2757
|
+
});
|
|
2596
2758
|
}
|
|
2597
2759
|
}
|
|
2598
2760
|
//* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
|
|
@@ -2600,64 +2762,51 @@ class f1 {
|
|
|
2600
2762
|
for (const $ of this.countries)
|
|
2601
2763
|
if ($.name.substring(0, e.length).toLowerCase() === e) {
|
|
2602
2764
|
const s = $.nodeById[this.id];
|
|
2603
|
-
this.
|
|
2765
|
+
this.ui.highlightListItem(s, !1), this.ui.scrollTo(s);
|
|
2604
2766
|
break;
|
|
2605
2767
|
}
|
|
2606
2768
|
}
|
|
2607
|
-
//* Country search
|
|
2608
|
-
|
|
2609
|
-
this.countryList.innerHTML = "";
|
|
2769
|
+
//* Country search: Filter the countries according to the search query.
|
|
2770
|
+
_filterCountriesByQuery(e) {
|
|
2610
2771
|
let $;
|
|
2611
|
-
e === "" ? $ = this.countries : $ = this._getMatchedCountries(e);
|
|
2612
|
-
let i = !0;
|
|
2613
|
-
for (const s of $) {
|
|
2614
|
-
const u = s.nodeById[this.id];
|
|
2615
|
-
u && (this.countryList.appendChild(u), i && (this._highlightListItem(u, !1), i = !1));
|
|
2616
|
-
}
|
|
2617
|
-
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();
|
|
2772
|
+
e === "" ? $ = this.countries : $ = this._getMatchedCountries(e), this.ui.filterCountries($);
|
|
2618
2773
|
}
|
|
2619
2774
|
_getMatchedCountries(e) {
|
|
2620
|
-
const $ =
|
|
2775
|
+
const $ = c0(e), i = [], s = [], h = [], u = [], f = [], c = [];
|
|
2621
2776
|
for (const g of this.countries)
|
|
2622
|
-
g.iso2 === $ ? i.push(g) : g.normalisedName.startsWith($) ? s.push(g) : g.normalisedName.includes($) ?
|
|
2777
|
+
g.iso2 === $ ? i.push(g) : g.normalisedName.startsWith($) ? s.push(g) : g.normalisedName.includes($) ? h.push(g) : $ === g.dialCode || $ === g.dialCodePlus ? u.push(g) : g.dialCodePlus.includes($) ? f.push(g) : g.initials.includes($) && c.push(g);
|
|
2623
2778
|
return [
|
|
2624
2779
|
...i.sort((g, I) => g.priority - I.priority),
|
|
2625
2780
|
...s.sort((g, I) => g.priority - I.priority),
|
|
2626
|
-
...u.sort((g, I) => g.priority - I.priority),
|
|
2627
2781
|
...h.sort((g, I) => g.priority - I.priority),
|
|
2628
|
-
...
|
|
2629
|
-
...
|
|
2782
|
+
...u.sort((g, I) => g.priority - I.priority),
|
|
2783
|
+
...f.sort((g, I) => g.priority - I.priority),
|
|
2784
|
+
...c.sort((g, I) => g.priority - I.priority)
|
|
2630
2785
|
];
|
|
2631
2786
|
}
|
|
2632
|
-
//* Update search results text (for a11y).
|
|
2633
|
-
_updateSearchResultsA11yText() {
|
|
2634
|
-
const { i18n: e } = this.options, $ = this.countryList.childElementCount;
|
|
2635
|
-
let i;
|
|
2636
|
-
$ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace("${count}", $.toString()), this.searchResultsA11yText.textContent = i;
|
|
2637
|
-
}
|
|
2638
2787
|
//* Highlight the next/prev item in the list (and ensure it is visible).
|
|
2639
2788
|
_handleUpDownKey(e) {
|
|
2640
2789
|
var i, s;
|
|
2641
|
-
let $ = e === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.highlightedItem) == null ? void 0 : s.nextElementSibling;
|
|
2642
|
-
!$ && this.countryList.childElementCount > 1 && ($ = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), $ && (this.
|
|
2790
|
+
let $ = e === "ArrowUp" ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
|
|
2791
|
+
!$ && this.ui.countryList.childElementCount > 1 && ($ = e === "ArrowUp" ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), $ && (this.ui.scrollTo($), this.ui.highlightListItem($, !1));
|
|
2643
2792
|
}
|
|
2644
2793
|
//* Select the currently highlighted item.
|
|
2645
2794
|
_handleEnterKey() {
|
|
2646
|
-
this.highlightedItem && this._selectListItem(this.highlightedItem);
|
|
2795
|
+
this.ui.highlightedItem && this._selectListItem(this.ui.highlightedItem);
|
|
2647
2796
|
}
|
|
2648
2797
|
//* Update the input's value to the given val (format first if possible)
|
|
2649
2798
|
//* NOTE: this is called from _setInitialState, handleUtils and setNumber.
|
|
2650
2799
|
_updateValFromNumber(e) {
|
|
2651
2800
|
let $ = e;
|
|
2652
2801
|
if (this.options.formatOnDisplay && y.utils && this.selectedCountryData) {
|
|
2653
|
-
const i = this.options.nationalMode ||
|
|
2802
|
+
const i = this.options.nationalMode || !$.startsWith("+") && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: h } = y.utils.numberFormat, u = i ? s : h;
|
|
2654
2803
|
$ = y.utils.formatNumber(
|
|
2655
2804
|
$,
|
|
2656
2805
|
this.selectedCountryData.iso2,
|
|
2657
|
-
|
|
2806
|
+
u
|
|
2658
2807
|
);
|
|
2659
2808
|
}
|
|
2660
|
-
$ = this._beforeSetNumber($), this.telInput.value = $;
|
|
2809
|
+
$ = this._beforeSetNumber($), this.ui.telInput.value = $;
|
|
2661
2810
|
}
|
|
2662
2811
|
//* Check if need to select a new country based on the given number
|
|
2663
2812
|
//* Note: called from _setInitialState, keyup handler, setNumber.
|
|
@@ -2668,10 +2817,10 @@ class f1 {
|
|
|
2668
2817
|
// if there is a selected country, and the number doesn't start with a dial code, then add it
|
|
2669
2818
|
_ensureHasDialCode(e) {
|
|
2670
2819
|
const { dialCode: $, nationalPrefix: i } = this.selectedCountryData;
|
|
2671
|
-
if (e.
|
|
2820
|
+
if (e.startsWith("+") || !$)
|
|
2672
2821
|
return e;
|
|
2673
|
-
const
|
|
2674
|
-
return `+${$}${
|
|
2822
|
+
const u = i && e.startsWith(i) && !this.options.separateDialCode ? e.substring(1) : e;
|
|
2823
|
+
return `+${$}${u}`;
|
|
2675
2824
|
}
|
|
2676
2825
|
// Get the country ISO2 code from the given number
|
|
2677
2826
|
// BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
|
|
@@ -2679,113 +2828,80 @@ class f1 {
|
|
|
2679
2828
|
_getNewCountryFromNumber(e) {
|
|
2680
2829
|
const $ = e.indexOf("+");
|
|
2681
2830
|
let i = $ ? e.substring($) : e;
|
|
2682
|
-
const s = this.selectedCountryData.iso2,
|
|
2831
|
+
const s = this.selectedCountryData.iso2, h = this.selectedCountryData.dialCode;
|
|
2683
2832
|
i = this._ensureHasDialCode(i);
|
|
2684
|
-
const
|
|
2685
|
-
if (
|
|
2686
|
-
const
|
|
2833
|
+
const u = this._getDialCode(i, !0), f = c1(i);
|
|
2834
|
+
if (u) {
|
|
2835
|
+
const c = c1(u), g = this.dialCodeToIso2Map[c];
|
|
2687
2836
|
if (g.length === 1)
|
|
2688
2837
|
return g[0] === s ? null : g[0];
|
|
2689
2838
|
if (!s && this.defaultCountry && g.includes(this.defaultCountry))
|
|
2690
2839
|
return this.defaultCountry;
|
|
2691
|
-
if (
|
|
2840
|
+
if (h === "1" && l0(f))
|
|
2692
2841
|
return null;
|
|
2693
|
-
const { areaCodes:
|
|
2694
|
-
if (
|
|
2695
|
-
const
|
|
2696
|
-
|
|
2697
|
-
|
|
2842
|
+
const { areaCodes: S, priority: L } = this.selectedCountryData;
|
|
2843
|
+
if (S) {
|
|
2844
|
+
const P = S.map(
|
|
2845
|
+
(U) => `${h}${U}`
|
|
2846
|
+
);
|
|
2847
|
+
for (const U of P)
|
|
2848
|
+
if (f.startsWith(U))
|
|
2698
2849
|
return null;
|
|
2699
2850
|
}
|
|
2700
|
-
const
|
|
2701
|
-
if (!
|
|
2851
|
+
const A = S && !(L === 0) && f.length > c.length, G = s && g.includes(s) && !A, E = s === g[0];
|
|
2852
|
+
if (!G && !E)
|
|
2702
2853
|
return g[0];
|
|
2703
2854
|
} else {
|
|
2704
|
-
if (i.
|
|
2855
|
+
if (i.startsWith("+") && f.length)
|
|
2705
2856
|
return "";
|
|
2706
2857
|
if ((!i || i === "+") && !s)
|
|
2707
2858
|
return this.defaultCountry;
|
|
2708
2859
|
}
|
|
2709
2860
|
return null;
|
|
2710
2861
|
}
|
|
2711
|
-
//* Remove highlighting from other list items and highlight the given item.
|
|
2712
|
-
_highlightListItem(e, $) {
|
|
2713
|
-
const i = this.highlightedItem;
|
|
2714
|
-
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)) {
|
|
2715
|
-
const s = this.highlightedItem.getAttribute("id") || "";
|
|
2716
|
-
this.searchInput.setAttribute("aria-activedescendant", s);
|
|
2717
|
-
}
|
|
2718
|
-
$ && this.highlightedItem.focus();
|
|
2719
|
-
}
|
|
2720
2862
|
//* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
|
|
2721
2863
|
//* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
|
|
2722
2864
|
_setCountry(e) {
|
|
2723
|
-
const { separateDialCode: $, showFlags: i, i18n: s } = this.options,
|
|
2724
|
-
if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
|
|
2725
|
-
const
|
|
2726
|
-
let
|
|
2865
|
+
const { separateDialCode: $, showFlags: i, i18n: s } = this.options, h = this.selectedCountryData.iso2 || "";
|
|
2866
|
+
if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
|
|
2867
|
+
const u = e && i ? `iti__flag iti__${e}` : "iti__flag iti__globe";
|
|
2868
|
+
let f, c;
|
|
2727
2869
|
if (e) {
|
|
2728
2870
|
const { name: g, dialCode: I } = this.selectedCountryData;
|
|
2729
|
-
|
|
2871
|
+
c = g, f = s.selectedCountryAriaLabel.replace("${countryName}", g).replace("${dialCode}", `+${I}`);
|
|
2730
2872
|
} else
|
|
2731
|
-
|
|
2732
|
-
this.selectedCountryInner.className =
|
|
2873
|
+
c = s.noCountrySelected, f = s.noCountrySelected;
|
|
2874
|
+
this.ui.selectedCountryInner.className = u, this.ui.selectedCountry.setAttribute("title", c), this.ui.selectedCountry.setAttribute("aria-label", f);
|
|
2733
2875
|
}
|
|
2734
2876
|
if ($) {
|
|
2735
|
-
const
|
|
2736
|
-
this.selectedDialCode.
|
|
2737
|
-
}
|
|
2738
|
-
return this._updatePlaceholder(), this._updateMaxLength(), u !== e;
|
|
2739
|
-
}
|
|
2740
|
-
//* Update the input padding to make space for the selected country/dial code.
|
|
2741
|
-
_updateInputPadding() {
|
|
2742
|
-
if (this.selectedCountry) {
|
|
2743
|
-
const e = this.options.separateDialCode ? 78 : 42, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + 6;
|
|
2744
|
-
this.showSelectedCountryOnLeft ? this.telInput.style.paddingLeft = `${i}px` : this.telInput.style.paddingRight = `${i}px`;
|
|
2877
|
+
const u = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
|
|
2878
|
+
this.ui.selectedDialCode.textContent = u, this.ui.updateInputPadding();
|
|
2745
2879
|
}
|
|
2880
|
+
return this._updatePlaceholder(), this._updateMaxLength(), h !== e;
|
|
2746
2881
|
}
|
|
2747
2882
|
//* Update the maximum valid number length for the currently selected country.
|
|
2748
2883
|
_updateMaxLength() {
|
|
2749
2884
|
const { strictMode: e, placeholderNumberType: $, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
|
|
2750
2885
|
if (e && y.utils)
|
|
2751
2886
|
if (s) {
|
|
2752
|
-
const
|
|
2753
|
-
let
|
|
2887
|
+
const h = y.utils.numberType[$];
|
|
2888
|
+
let u = y.utils.getExampleNumber(
|
|
2754
2889
|
s,
|
|
2755
2890
|
!1,
|
|
2756
|
-
|
|
2891
|
+
h,
|
|
2757
2892
|
!0
|
|
2758
|
-
),
|
|
2759
|
-
for (; y.utils.isPossibleNumber(
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2893
|
+
), f = u;
|
|
2894
|
+
for (; y.utils.isPossibleNumber(
|
|
2895
|
+
u,
|
|
2896
|
+
s,
|
|
2897
|
+
i
|
|
2898
|
+
); )
|
|
2899
|
+
f = u, u += "0";
|
|
2900
|
+
const c = y.utils.getCoreNumber(f, s);
|
|
2901
|
+
this.maxCoreNumberLength = c.length, s === "by" && (this.maxCoreNumberLength = c.length + 1);
|
|
2763
2902
|
} else
|
|
2764
2903
|
this.maxCoreNumberLength = null;
|
|
2765
2904
|
}
|
|
2766
|
-
//* When input is in a hidden container during init, we cannot calculate the selected country width.
|
|
2767
|
-
//* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
|
|
2768
|
-
//* To get the right styling to apply, all we need is a shallow clone of the container,
|
|
2769
|
-
//* and then to inject a deep clone of the selectedCountry element.
|
|
2770
|
-
_getHiddenSelectedCountryWidth() {
|
|
2771
|
-
if (this.telInput.parentNode) {
|
|
2772
|
-
let e;
|
|
2773
|
-
try {
|
|
2774
|
-
e = window.top.document.body;
|
|
2775
|
-
} catch {
|
|
2776
|
-
e = document.body;
|
|
2777
|
-
}
|
|
2778
|
-
const $ = this.telInput.parentNode.cloneNode(!1);
|
|
2779
|
-
$.style.visibility = "hidden", e.appendChild($);
|
|
2780
|
-
const i = this.countryContainer.cloneNode();
|
|
2781
|
-
$.appendChild(i);
|
|
2782
|
-
const s = this.selectedCountry.cloneNode(!0);
|
|
2783
|
-
i.appendChild(s);
|
|
2784
|
-
const u = s.offsetWidth;
|
|
2785
|
-
return e.removeChild($), u;
|
|
2786
|
-
}
|
|
2787
|
-
return 0;
|
|
2788
|
-
}
|
|
2789
2905
|
//* Update the input placeholder to an example number from the currently selected country.
|
|
2790
2906
|
_updatePlaceholder() {
|
|
2791
2907
|
const {
|
|
@@ -2793,69 +2909,53 @@ class f1 {
|
|
|
2793
2909
|
placeholderNumberType: $,
|
|
2794
2910
|
nationalMode: i,
|
|
2795
2911
|
customPlaceholder: s
|
|
2796
|
-
} = this.options,
|
|
2797
|
-
if (y.utils &&
|
|
2798
|
-
const
|
|
2799
|
-
let
|
|
2912
|
+
} = this.options, h = e === "aggressive" || !this.ui.hadInitialPlaceholder && e === "polite";
|
|
2913
|
+
if (y.utils && h) {
|
|
2914
|
+
const u = y.utils.numberType[$];
|
|
2915
|
+
let f = this.selectedCountryData.iso2 ? y.utils.getExampleNumber(
|
|
2800
2916
|
this.selectedCountryData.iso2,
|
|
2801
2917
|
i,
|
|
2802
|
-
|
|
2918
|
+
u
|
|
2803
2919
|
) : "";
|
|
2804
|
-
|
|
2920
|
+
f = this._beforeSetNumber(f), typeof s == "function" && (f = s(f, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", f);
|
|
2805
2921
|
}
|
|
2806
2922
|
}
|
|
2807
2923
|
//* Called when the user selects a list item from the dropdown.
|
|
2808
2924
|
_selectListItem(e) {
|
|
2809
|
-
const $ = e.
|
|
2925
|
+
const $ = e.dataset.countryCode, i = this._setCountry($);
|
|
2810
2926
|
this._closeDropdown();
|
|
2811
|
-
const s = e.
|
|
2812
|
-
this._updateDialCode(s), this.options.formatOnDisplay && this._updateValFromNumber(this.telInput.value), this.telInput.focus(), i && this._triggerCountryChange();
|
|
2927
|
+
const s = e.dataset.dialCode;
|
|
2928
|
+
this._updateDialCode(s), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this.ui.telInput.focus(), i && this._triggerCountryChange();
|
|
2813
2929
|
}
|
|
2814
2930
|
//* Close the dropdown and unbind any listeners.
|
|
2815
2931
|
_closeDropdown() {
|
|
2816
|
-
this.dropdownContent.classList.add("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "false"), this.highlightedItem && this.highlightedItem.setAttribute("aria-selected", "false"), this.options.countrySearch && this.searchInput.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), this.
|
|
2817
|
-
"click",
|
|
2818
|
-
this._handleClickOffToClose
|
|
2819
|
-
), this.countryList.removeEventListener(
|
|
2820
|
-
"mouseover",
|
|
2821
|
-
this._handleMouseoverCountryList
|
|
2822
|
-
), 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");
|
|
2823
|
-
}
|
|
2824
|
-
//* Check if an element is visible within it's container, else scroll until it is.
|
|
2825
|
-
_scrollTo(e) {
|
|
2826
|
-
const $ = this.countryList, i = document.documentElement.scrollTop, s = $.offsetHeight, u = $.getBoundingClientRect().top + i, h = u + s, c = e.offsetHeight, m = e.getBoundingClientRect().top + i, g = m + c, I = m - u + $.scrollTop;
|
|
2827
|
-
if (m < u)
|
|
2828
|
-
$.scrollTop = I;
|
|
2829
|
-
else if (g > h) {
|
|
2830
|
-
const w = s - c;
|
|
2831
|
-
$.scrollTop = I - w;
|
|
2832
|
-
}
|
|
2932
|
+
this.ui.dropdownContent.classList.contains("iti__hide") || (this.ui.dropdownContent.classList.add("iti__hide"), this.ui.selectedCountry.setAttribute("aria-expanded", "false"), this.ui.highlightedItem && this.ui.highlightedItem.setAttribute("aria-selected", "false"), this.options.countrySearch && this.ui.searchInput.removeAttribute("aria-activedescendant"), this.ui.dropdownArrow.classList.remove("iti__arrow--up"), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger("close:countrydropdown"));
|
|
2833
2933
|
}
|
|
2834
2934
|
//* Replace any existing dial code with the new one
|
|
2835
2935
|
//* Note: called from _selectListItem and setCountry
|
|
2836
2936
|
_updateDialCode(e) {
|
|
2837
|
-
const $ = this.telInput.value, i = `+${e}`;
|
|
2937
|
+
const $ = this.ui.telInput.value, i = `+${e}`;
|
|
2838
2938
|
let s;
|
|
2839
|
-
if ($.
|
|
2840
|
-
const
|
|
2841
|
-
|
|
2939
|
+
if ($.startsWith("+")) {
|
|
2940
|
+
const h = this._getDialCode($);
|
|
2941
|
+
h ? s = $.replace(h, i) : s = i, this.ui.telInput.value = s;
|
|
2842
2942
|
}
|
|
2843
2943
|
}
|
|
2844
2944
|
//* Try and extract a valid international dial code from a full telephone number.
|
|
2845
2945
|
//* Note: returns the raw string inc plus character and any whitespace/dots etc.
|
|
2846
2946
|
_getDialCode(e, $) {
|
|
2847
2947
|
let i = "";
|
|
2848
|
-
if (e.
|
|
2948
|
+
if (e.startsWith("+")) {
|
|
2849
2949
|
let s = "";
|
|
2850
|
-
for (let
|
|
2851
|
-
const
|
|
2852
|
-
if (/[0-9]/.test(
|
|
2853
|
-
if (s +=
|
|
2950
|
+
for (let h = 0; h < e.length; h++) {
|
|
2951
|
+
const u = e.charAt(h);
|
|
2952
|
+
if (/[0-9]/.test(u)) {
|
|
2953
|
+
if (s += u, !!!this.dialCodeToIso2Map[s])
|
|
2854
2954
|
break;
|
|
2855
2955
|
if ($)
|
|
2856
|
-
i = e.substring(0,
|
|
2956
|
+
i = e.substring(0, h + 1);
|
|
2857
2957
|
else if (this.dialCodes.has(s)) {
|
|
2858
|
-
i = e.substring(0,
|
|
2958
|
+
i = e.substring(0, h + 1);
|
|
2859
2959
|
break;
|
|
2860
2960
|
}
|
|
2861
2961
|
if (s.length === this.dialCodeMaxLen)
|
|
@@ -2867,14 +2967,14 @@ class f1 {
|
|
|
2867
2967
|
}
|
|
2868
2968
|
//* Get the input val, adding the dial code if separateDialCode is enabled.
|
|
2869
2969
|
_getFullNumber(e) {
|
|
2870
|
-
const $ = e || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
|
|
2970
|
+
const $ = e || this.ui.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
|
|
2871
2971
|
let s;
|
|
2872
|
-
const
|
|
2873
|
-
return this.options.separateDialCode &&
|
|
2972
|
+
const h = c1($);
|
|
2973
|
+
return this.options.separateDialCode && !$.startsWith("+") && i && h ? s = `+${i}` : s = "", s + $;
|
|
2874
2974
|
}
|
|
2875
2975
|
//* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
|
|
2876
2976
|
_beforeSetNumber(e) {
|
|
2877
|
-
const $ = this._getDialCode(e), i =
|
|
2977
|
+
const $ = this._getDialCode(e), i = d2(
|
|
2878
2978
|
e,
|
|
2879
2979
|
$,
|
|
2880
2980
|
this.options.separateDialCode,
|
|
@@ -2891,35 +2991,18 @@ class f1 {
|
|
|
2891
2991
|
//**************************
|
|
2892
2992
|
//* This is called when the geoip call returns.
|
|
2893
2993
|
handleAutoCountry() {
|
|
2894
|
-
this.options.initialCountry === "auto" && y.autoCountry && (this.defaultCountry = y.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2994
|
+
this.options.initialCountry === "auto" && y.autoCountry && (this.defaultCountry = y.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
|
|
2895
2995
|
}
|
|
2896
2996
|
//* This is called when the utils request completes.
|
|
2897
2997
|
handleUtils() {
|
|
2898
|
-
y.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2998
|
+
y.utils && (this.ui.telInput.value && this._updateValFromNumber(this.ui.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
|
|
2899
2999
|
}
|
|
2900
3000
|
//********************
|
|
2901
3001
|
//* PUBLIC METHODS
|
|
2902
3002
|
//********************
|
|
2903
3003
|
//* Remove plugin.
|
|
2904
3004
|
destroy() {
|
|
2905
|
-
|
|
2906
|
-
this.telInput.iti = void 0;
|
|
2907
|
-
const { allowDropdown: e, separateDialCode: $ } = this.options;
|
|
2908
|
-
if (e) {
|
|
2909
|
-
this._closeDropdown(), this.selectedCountry.removeEventListener(
|
|
2910
|
-
"click",
|
|
2911
|
-
this._handleClickSelectedCountry
|
|
2912
|
-
), this.countryContainer.removeEventListener(
|
|
2913
|
-
"keydown",
|
|
2914
|
-
this._handleCountryContainerKeydown
|
|
2915
|
-
);
|
|
2916
|
-
const c = this.telInput.closest("label");
|
|
2917
|
-
c && c.removeEventListener("click", this._handleLabelClick);
|
|
2918
|
-
}
|
|
2919
|
-
const { form: i } = this.telInput;
|
|
2920
|
-
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.isRTL ? this.telInput.style.paddingRight = this.originalPaddingRight : this.telInput.style.paddingLeft = this.originalPaddingLeft);
|
|
2921
|
-
const s = this.telInput.parentNode;
|
|
2922
|
-
(u = s == null ? void 0 : s.parentNode) == null || u.insertBefore(this.telInput, s), (h = s == null ? void 0 : s.parentNode) == null || h.removeChild(s), delete y.instances[this.id];
|
|
3005
|
+
this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), y.instances instanceof Map ? y.instances.delete(this.id) : delete y.instances[this.id]);
|
|
2923
3006
|
}
|
|
2924
3007
|
//* Get the extension from the current number.
|
|
2925
3008
|
getExtension() {
|
|
@@ -2959,38 +3042,54 @@ class f1 {
|
|
|
2959
3042
|
}
|
|
2960
3043
|
return -99;
|
|
2961
3044
|
}
|
|
2962
|
-
//* Validate the input val
|
|
3045
|
+
//* Validate the input val using number length only
|
|
2963
3046
|
isValidNumber() {
|
|
3047
|
+
const { dialCode: e, iso2: $ } = this.selectedCountryData;
|
|
3048
|
+
if (e === "44" && y.utils) {
|
|
3049
|
+
const i = this._getFullNumber(), s = y.utils.getCoreNumber(i, $);
|
|
3050
|
+
if (s[0] === "7" && s.length !== 10)
|
|
3051
|
+
return !1;
|
|
3052
|
+
}
|
|
2964
3053
|
return this._validateNumber(!1);
|
|
2965
3054
|
}
|
|
2966
|
-
//* Validate the input val
|
|
3055
|
+
//* Validate the input val with precise validation
|
|
2967
3056
|
isValidNumberPrecise() {
|
|
2968
3057
|
return this._validateNumber(!0);
|
|
2969
3058
|
}
|
|
2970
3059
|
_utilsIsPossibleNumber(e) {
|
|
2971
|
-
return y.utils ? y.utils.isPossibleNumber(
|
|
3060
|
+
return y.utils ? y.utils.isPossibleNumber(
|
|
3061
|
+
e,
|
|
3062
|
+
this.selectedCountryData.iso2,
|
|
3063
|
+
this.options.validationNumberTypes
|
|
3064
|
+
) : null;
|
|
2972
3065
|
}
|
|
2973
3066
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
2974
3067
|
_validateNumber(e) {
|
|
3068
|
+
if (!y.utils)
|
|
3069
|
+
return null;
|
|
2975
3070
|
if (!this.selectedCountryData.iso2)
|
|
2976
3071
|
return !1;
|
|
2977
|
-
const $ = (
|
|
3072
|
+
const $ = (u) => e ? this._utilsIsValidNumber(u) : this._utilsIsPossibleNumber(u), i = this._getFullNumber(), s = i.search(new RegExp("\\p{L}", "u"));
|
|
2978
3073
|
if (s > -1 && !this.options.allowPhonewords) {
|
|
2979
|
-
const
|
|
2980
|
-
return
|
|
3074
|
+
const u = i.substring(0, s), f = $(u), c = $(i);
|
|
3075
|
+
return f && c;
|
|
2981
3076
|
}
|
|
2982
3077
|
return $(i);
|
|
2983
3078
|
}
|
|
2984
3079
|
_utilsIsValidNumber(e) {
|
|
2985
|
-
return y.utils ? y.utils.isValidNumber(
|
|
3080
|
+
return y.utils ? y.utils.isValidNumber(
|
|
3081
|
+
e,
|
|
3082
|
+
this.selectedCountryData.iso2,
|
|
3083
|
+
this.options.validationNumberTypes
|
|
3084
|
+
) : null;
|
|
2986
3085
|
}
|
|
2987
3086
|
//* Update the selected country, and update the input val accordingly.
|
|
2988
3087
|
setCountry(e) {
|
|
2989
3088
|
const $ = e == null ? void 0 : e.toLowerCase();
|
|
2990
|
-
if (!
|
|
3089
|
+
if (!S1($))
|
|
2991
3090
|
throw new Error(`Invalid country code: '${$}'`);
|
|
2992
3091
|
const i = this.selectedCountryData.iso2;
|
|
2993
|
-
(e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.telInput.value), this._triggerCountryChange());
|
|
3092
|
+
(e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this._triggerCountryChange());
|
|
2994
3093
|
}
|
|
2995
3094
|
//* Set the input value and update the country.
|
|
2996
3095
|
setNumber(e) {
|
|
@@ -3002,59 +3101,70 @@ class f1 {
|
|
|
3002
3101
|
this.options.placeholderNumberType = e, this._updatePlaceholder();
|
|
3003
3102
|
}
|
|
3004
3103
|
setDisabled(e) {
|
|
3005
|
-
this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
|
|
3104
|
+
this.ui.telInput.disabled = e, e ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
|
|
3006
3105
|
}
|
|
3007
3106
|
}
|
|
3008
|
-
const
|
|
3107
|
+
const r2 = (p) => {
|
|
3009
3108
|
if (!y.utils && !y.startedLoadingUtilsScript) {
|
|
3010
3109
|
let e;
|
|
3011
|
-
if (typeof
|
|
3110
|
+
if (typeof p == "function")
|
|
3012
3111
|
try {
|
|
3013
|
-
e = Promise.resolve(
|
|
3112
|
+
e = Promise.resolve(p());
|
|
3014
3113
|
} catch ($) {
|
|
3015
3114
|
return Promise.reject($);
|
|
3016
3115
|
}
|
|
3017
3116
|
else
|
|
3018
|
-
return Promise.reject(
|
|
3117
|
+
return Promise.reject(
|
|
3118
|
+
new TypeError(
|
|
3119
|
+
`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof p}`
|
|
3120
|
+
)
|
|
3121
|
+
);
|
|
3019
3122
|
return y.startedLoadingUtilsScript = !0, e.then(($) => {
|
|
3020
3123
|
const i = $ == null ? void 0 : $.default;
|
|
3021
3124
|
if (!i || typeof i != "object")
|
|
3022
|
-
throw new TypeError(
|
|
3125
|
+
throw new TypeError(
|
|
3126
|
+
"The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
|
|
3127
|
+
);
|
|
3023
3128
|
return y.utils = i, $1("handleUtils"), !0;
|
|
3024
3129
|
}).catch(($) => {
|
|
3025
3130
|
throw $1("rejectUtilsScriptPromise", $), $;
|
|
3026
3131
|
});
|
|
3027
3132
|
}
|
|
3028
3133
|
return null;
|
|
3134
|
+
}, $1 = (p, ...e) => {
|
|
3135
|
+
Object.values(y.instances).forEach(($) => {
|
|
3136
|
+
const i = $[p];
|
|
3137
|
+
typeof i == "function" && i.apply($, e);
|
|
3138
|
+
});
|
|
3029
3139
|
}, y = Object.assign(
|
|
3030
|
-
(
|
|
3031
|
-
const $ = new
|
|
3032
|
-
return
|
|
3140
|
+
(p, e) => {
|
|
3141
|
+
const $ = new v1(p, e);
|
|
3142
|
+
return y.instances[$.id] = $, p.iti = $, $;
|
|
3033
3143
|
},
|
|
3034
3144
|
{
|
|
3035
|
-
defaults:
|
|
3145
|
+
defaults: h0,
|
|
3036
3146
|
//* Using a static var like this allows us to mock it in the tests.
|
|
3037
3147
|
documentReady: () => document.readyState === "complete",
|
|
3038
3148
|
//* Get the country data object.
|
|
3039
3149
|
getCountryData: () => Y,
|
|
3040
3150
|
//* A getter for the plugin instance.
|
|
3041
|
-
getInstance: (
|
|
3042
|
-
const e =
|
|
3151
|
+
getInstance: (p) => {
|
|
3152
|
+
const e = p.dataset.intlTelInputId;
|
|
3043
3153
|
return e ? y.instances[e] : null;
|
|
3044
3154
|
},
|
|
3045
3155
|
//* A map from instance ID to instance object.
|
|
3046
3156
|
instances: {},
|
|
3047
|
-
attachUtils:
|
|
3157
|
+
attachUtils: r2,
|
|
3048
3158
|
startedLoadingUtilsScript: !1,
|
|
3049
3159
|
startedLoadingAutoCountry: !1,
|
|
3050
|
-
version: "25.
|
|
3160
|
+
version: "25.11.0"
|
|
3051
3161
|
}
|
|
3052
3162
|
);
|
|
3053
3163
|
(function() {
|
|
3054
|
-
var
|
|
3164
|
+
var p = this || self;
|
|
3055
3165
|
function e(d, t) {
|
|
3056
3166
|
d = d.split(".");
|
|
3057
|
-
var n =
|
|
3167
|
+
var n = p;
|
|
3058
3168
|
d[0] in n || typeof n.execScript > "u" || n.execScript("var " + d[0]);
|
|
3059
3169
|
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;
|
|
3060
3170
|
}
|
|
@@ -3062,7 +3172,7 @@ const n2 = (f) => {
|
|
|
3062
3172
|
function n() {
|
|
3063
3173
|
}
|
|
3064
3174
|
n.prototype = t.prototype, d.ma = t.prototype, d.prototype = new n(), d.prototype.constructor = d, d.sa = function(r, o, l) {
|
|
3065
|
-
for (var a = Array(arguments.length - 2),
|
|
3175
|
+
for (var a = Array(arguments.length - 2), C = 2; C < arguments.length; C++) a[C - 2] = arguments[C];
|
|
3066
3176
|
return t.prototype[o].apply(r, a);
|
|
3067
3177
|
};
|
|
3068
3178
|
}
|
|
@@ -3074,28 +3184,28 @@ const n2 = (f) => {
|
|
|
3074
3184
|
}
|
|
3075
3185
|
var s = class {
|
|
3076
3186
|
constructor(d) {
|
|
3077
|
-
if (
|
|
3187
|
+
if (h !== h) throw Error("SafeUrl is not meant to be built directly");
|
|
3078
3188
|
this.g = d;
|
|
3079
3189
|
}
|
|
3080
3190
|
toString() {
|
|
3081
3191
|
return this.g.toString();
|
|
3082
3192
|
}
|
|
3083
|
-
},
|
|
3193
|
+
}, h = {};
|
|
3084
3194
|
new s("about:invalid#zClosurez"), new s("about:blank");
|
|
3085
|
-
const
|
|
3086
|
-
class
|
|
3195
|
+
const u = {};
|
|
3196
|
+
class f {
|
|
3087
3197
|
constructor() {
|
|
3088
|
-
if (
|
|
3198
|
+
if (u !== u) throw Error("SafeStyle is not meant to be built directly");
|
|
3089
3199
|
}
|
|
3090
3200
|
toString() {
|
|
3091
3201
|
return "";
|
|
3092
3202
|
}
|
|
3093
3203
|
}
|
|
3094
|
-
new
|
|
3095
|
-
const
|
|
3204
|
+
new f();
|
|
3205
|
+
const c = {};
|
|
3096
3206
|
class g {
|
|
3097
3207
|
constructor() {
|
|
3098
|
-
if (
|
|
3208
|
+
if (c !== c) throw Error("SafeStyleSheet is not meant to be built directly");
|
|
3099
3209
|
}
|
|
3100
3210
|
toString() {
|
|
3101
3211
|
return "";
|
|
@@ -3103,9 +3213,9 @@ const n2 = (f) => {
|
|
|
3103
3213
|
}
|
|
3104
3214
|
new g();
|
|
3105
3215
|
const I = {};
|
|
3106
|
-
class
|
|
3216
|
+
class S {
|
|
3107
3217
|
constructor() {
|
|
3108
|
-
var t =
|
|
3218
|
+
var t = p.trustedTypes && p.trustedTypes.emptyHTML || "";
|
|
3109
3219
|
if (I !== I) throw Error("SafeHtml is not meant to be built directly");
|
|
3110
3220
|
this.g = t;
|
|
3111
3221
|
}
|
|
@@ -3113,62 +3223,62 @@ const n2 = (f) => {
|
|
|
3113
3223
|
return this.g.toString();
|
|
3114
3224
|
}
|
|
3115
3225
|
}
|
|
3116
|
-
new
|
|
3117
|
-
function
|
|
3226
|
+
new S();
|
|
3227
|
+
function L(d, t) {
|
|
3118
3228
|
switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
|
|
3119
|
-
case N:
|
|
3120
|
-
case P:
|
|
3121
3229
|
case G:
|
|
3122
|
-
case j:
|
|
3123
|
-
case c0:
|
|
3124
3230
|
case E:
|
|
3125
|
-
case
|
|
3231
|
+
case P:
|
|
3232
|
+
case U:
|
|
3233
|
+
case f1:
|
|
3234
|
+
case A:
|
|
3235
|
+
case b:
|
|
3126
3236
|
this.o = !0;
|
|
3127
3237
|
}
|
|
3128
3238
|
this.j = t.defaultValue;
|
|
3129
3239
|
}
|
|
3130
|
-
var
|
|
3131
|
-
function
|
|
3240
|
+
var b = 1, A = 2, G = 3, E = 4, P = 6, U = 16, f1 = 18;
|
|
3241
|
+
function p0(d, t) {
|
|
3132
3242
|
for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
|
|
3133
3243
|
var n = t[d];
|
|
3134
3244
|
this.g[n.g] = n;
|
|
3135
3245
|
}
|
|
3136
3246
|
}
|
|
3137
|
-
function
|
|
3247
|
+
function g0(d) {
|
|
3138
3248
|
return d = i(d.g), d.sort(function(t, n) {
|
|
3139
3249
|
return t.g - n.g;
|
|
3140
3250
|
}), d;
|
|
3141
3251
|
}
|
|
3142
|
-
function
|
|
3252
|
+
function B() {
|
|
3143
3253
|
this.h = {}, this.j = this.m().g, this.g = this.l = null;
|
|
3144
3254
|
}
|
|
3145
|
-
|
|
3146
|
-
return
|
|
3147
|
-
},
|
|
3148
|
-
return
|
|
3149
|
-
},
|
|
3150
|
-
|
|
3151
|
-
},
|
|
3152
|
-
|
|
3255
|
+
B.prototype.has = function(d) {
|
|
3256
|
+
return R(this, d.g);
|
|
3257
|
+
}, B.prototype.get = function(d, t) {
|
|
3258
|
+
return m(this, d.g, t);
|
|
3259
|
+
}, B.prototype.set = function(d, t) {
|
|
3260
|
+
M(this, d.g, t);
|
|
3261
|
+
}, B.prototype.add = function(d, t) {
|
|
3262
|
+
L1(this, d.g, t);
|
|
3153
3263
|
};
|
|
3154
|
-
function
|
|
3155
|
-
for (var n =
|
|
3264
|
+
function N1(d, t) {
|
|
3265
|
+
for (var n = g0(d.m()), r = 0; r < n.length; r++) {
|
|
3156
3266
|
var o = n[r], l = o.g;
|
|
3157
|
-
if (
|
|
3267
|
+
if (R(t, l)) {
|
|
3158
3268
|
d.g && delete d.g[o.g];
|
|
3159
3269
|
var a = o.h == 11 || o.h == 10;
|
|
3160
3270
|
if (o.l) {
|
|
3161
|
-
o =
|
|
3162
|
-
for (var
|
|
3163
|
-
} else o = n1(t, l), a ? (a = n1(d, l)) ?
|
|
3271
|
+
o = x(t, l);
|
|
3272
|
+
for (var C = 0; C < o.length; C++) L1(d, l, a ? o[C].clone() : o[C]);
|
|
3273
|
+
} else o = n1(t, l), a ? (a = n1(d, l)) ? N1(a, o) : M(d, l, o.clone()) : M(d, l, o);
|
|
3164
3274
|
}
|
|
3165
3275
|
}
|
|
3166
3276
|
}
|
|
3167
|
-
|
|
3277
|
+
B.prototype.clone = function() {
|
|
3168
3278
|
var d = new this.constructor();
|
|
3169
|
-
return d != this && (d.h = {}, d.g && (d.g = {}),
|
|
3279
|
+
return d != this && (d.h = {}, d.g && (d.g = {}), N1(d, this)), d;
|
|
3170
3280
|
};
|
|
3171
|
-
function
|
|
3281
|
+
function R(d, t) {
|
|
3172
3282
|
return d.h[t] != null;
|
|
3173
3283
|
}
|
|
3174
3284
|
function n1(d, t) {
|
|
@@ -3187,12 +3297,12 @@ const n2 = (f) => {
|
|
|
3187
3297
|
}
|
|
3188
3298
|
return n;
|
|
3189
3299
|
}
|
|
3190
|
-
function
|
|
3300
|
+
function m(d, t, n) {
|
|
3191
3301
|
var r = n1(d, t);
|
|
3192
3302
|
return d.j[t].l ? r[n || 0] : r;
|
|
3193
3303
|
}
|
|
3194
|
-
function
|
|
3195
|
-
if (
|
|
3304
|
+
function w(d, t) {
|
|
3305
|
+
if (R(d, t)) d = m(d, t);
|
|
3196
3306
|
else d: {
|
|
3197
3307
|
if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
|
|
3198
3308
|
else if (t === Number) d.j = 0;
|
|
@@ -3205,106 +3315,106 @@ const n2 = (f) => {
|
|
|
3205
3315
|
}
|
|
3206
3316
|
return d;
|
|
3207
3317
|
}
|
|
3208
|
-
function
|
|
3318
|
+
function x(d, t) {
|
|
3209
3319
|
return n1(d, t) || [];
|
|
3210
3320
|
}
|
|
3211
3321
|
function K(d, t) {
|
|
3212
|
-
return d.j[t].l ?
|
|
3322
|
+
return d.j[t].l ? R(d, t) ? d.h[t].length : 0 : R(d, t) ? 1 : 0;
|
|
3213
3323
|
}
|
|
3214
|
-
function
|
|
3324
|
+
function M(d, t, n) {
|
|
3215
3325
|
d.h[t] = n, d.g && (d.g[t] = n);
|
|
3216
3326
|
}
|
|
3217
|
-
function
|
|
3327
|
+
function L1(d, t, n) {
|
|
3218
3328
|
d.h[t] || (d.h[t] = []), d.h[t].push(n), d.g && delete d.g[t];
|
|
3219
3329
|
}
|
|
3220
3330
|
function i1(d, t) {
|
|
3221
3331
|
var n = [], r;
|
|
3222
|
-
for (r in t) r != 0 && n.push(new
|
|
3223
|
-
return new
|
|
3332
|
+
for (r in t) r != 0 && n.push(new L(r, t[r]));
|
|
3333
|
+
return new p0(d, n);
|
|
3224
3334
|
}
|
|
3225
|
-
function
|
|
3335
|
+
function r1() {
|
|
3226
3336
|
}
|
|
3227
|
-
|
|
3337
|
+
r1.prototype.g = function(d) {
|
|
3228
3338
|
throw new d.h(), Error("Unimplemented");
|
|
3229
|
-
},
|
|
3230
|
-
if (d.h == 11 || d.h == 10) return t instanceof
|
|
3231
|
-
if (d.h == 14) return typeof t == "string" &&
|
|
3339
|
+
}, r1.prototype.h = function(d, t) {
|
|
3340
|
+
if (d.h == 11 || d.h == 10) return t instanceof B ? t : this.g(d.s.prototype.m(), t);
|
|
3341
|
+
if (d.h == 14) return typeof t == "string" && A1.test(t) && (d = Number(t), 0 < d) ? d : t;
|
|
3232
3342
|
if (!d.o) return t;
|
|
3233
3343
|
if (d = d.s, d === String) {
|
|
3234
3344
|
if (typeof t == "number") return String(t);
|
|
3235
|
-
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" ||
|
|
3345
|
+
} else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || A1.test(t))) return Number(t);
|
|
3236
3346
|
return t;
|
|
3237
3347
|
};
|
|
3238
|
-
var
|
|
3348
|
+
var A1 = /^-?[0-9]+$/;
|
|
3239
3349
|
function p1() {
|
|
3240
3350
|
}
|
|
3241
|
-
$(p1,
|
|
3351
|
+
$(p1, r1), p1.prototype.g = function(d, t) {
|
|
3242
3352
|
return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
|
|
3243
3353
|
};
|
|
3244
3354
|
function q() {
|
|
3245
3355
|
}
|
|
3246
3356
|
$(q, p1), q.prototype.h = function(d, t) {
|
|
3247
|
-
return d.h == 8 ? !!t :
|
|
3357
|
+
return d.h == 8 ? !!t : r1.prototype.h.apply(this, arguments);
|
|
3248
3358
|
}, q.prototype.g = function(d, t) {
|
|
3249
3359
|
return q.ma.g.call(this, d, t);
|
|
3250
3360
|
};
|
|
3251
|
-
function
|
|
3361
|
+
function T(d, t) {
|
|
3252
3362
|
d != null && this.g.apply(this, arguments);
|
|
3253
3363
|
}
|
|
3254
|
-
|
|
3364
|
+
T.prototype.h = "", T.prototype.set = function(d) {
|
|
3255
3365
|
this.h = "" + d;
|
|
3256
|
-
},
|
|
3366
|
+
}, T.prototype.g = function(d, t, n) {
|
|
3257
3367
|
if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
|
|
3258
3368
|
return this;
|
|
3259
3369
|
};
|
|
3260
|
-
function
|
|
3370
|
+
function k(d) {
|
|
3261
3371
|
d.h = "";
|
|
3262
3372
|
}
|
|
3263
|
-
|
|
3373
|
+
T.prototype.toString = function() {
|
|
3264
3374
|
return this.h;
|
|
3265
3375
|
};
|
|
3266
|
-
function
|
|
3267
|
-
|
|
3376
|
+
function j() {
|
|
3377
|
+
B.call(this);
|
|
3268
3378
|
}
|
|
3269
|
-
$(
|
|
3270
|
-
var
|
|
3271
|
-
function
|
|
3272
|
-
|
|
3379
|
+
$(j, B);
|
|
3380
|
+
var T1 = null;
|
|
3381
|
+
function N() {
|
|
3382
|
+
B.call(this);
|
|
3273
3383
|
}
|
|
3274
|
-
$(
|
|
3275
|
-
var
|
|
3384
|
+
$(N, B);
|
|
3385
|
+
var E1 = null;
|
|
3276
3386
|
function z() {
|
|
3277
|
-
|
|
3387
|
+
B.call(this);
|
|
3278
3388
|
}
|
|
3279
|
-
$(z,
|
|
3280
|
-
var
|
|
3281
|
-
|
|
3282
|
-
var d =
|
|
3283
|
-
return d || (
|
|
3284
|
-
},
|
|
3285
|
-
var d = A1;
|
|
3286
|
-
return d || (A1 = d = i1(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;
|
|
3287
|
-
}, b.m = b.prototype.m, z.prototype.m = function() {
|
|
3389
|
+
$(z, B);
|
|
3390
|
+
var M1 = null;
|
|
3391
|
+
j.prototype.m = function() {
|
|
3392
|
+
var d = T1;
|
|
3393
|
+
return d || (T1 = d = i1(j, { 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;
|
|
3394
|
+
}, j.m = j.prototype.m, N.prototype.m = function() {
|
|
3288
3395
|
var d = E1;
|
|
3289
|
-
return d || (E1 = d = i1(
|
|
3396
|
+
return d || (E1 = d = i1(N, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
|
|
3397
|
+
}, N.m = N.prototype.m, z.prototype.m = function() {
|
|
3398
|
+
var d = M1;
|
|
3399
|
+
return d || (M1 = d = i1(z, {
|
|
3290
3400
|
0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
|
|
3291
|
-
1: { name: "general_desc", i: 11, type:
|
|
3292
|
-
2: { name: "fixed_line", i: 11, type:
|
|
3293
|
-
3: { name: "mobile", i: 11, type:
|
|
3294
|
-
4: { name: "toll_free", i: 11, type:
|
|
3295
|
-
5: { name: "premium_rate", i: 11, type:
|
|
3296
|
-
6: { name: "shared_cost", i: 11, type:
|
|
3297
|
-
7: { name: "personal_number", i: 11, type:
|
|
3298
|
-
8: { name: "voip", i: 11, type:
|
|
3299
|
-
21: { name: "pager", i: 11, type:
|
|
3300
|
-
25: { name: "uan", i: 11, type:
|
|
3301
|
-
27: { name: "emergency", i: 11, type:
|
|
3302
|
-
28: { name: "voicemail", i: 11, type:
|
|
3303
|
-
29: { name: "short_code", i: 11, type:
|
|
3304
|
-
30: { name: "standard_rate", i: 11, type:
|
|
3305
|
-
31: { name: "carrier_specific", i: 11, type:
|
|
3306
|
-
33: { name: "sms_services", i: 11, type:
|
|
3307
|
-
24: { name: "no_international_dialling", i: 11, type:
|
|
3401
|
+
1: { name: "general_desc", i: 11, type: N },
|
|
3402
|
+
2: { name: "fixed_line", i: 11, type: N },
|
|
3403
|
+
3: { name: "mobile", i: 11, type: N },
|
|
3404
|
+
4: { name: "toll_free", i: 11, type: N },
|
|
3405
|
+
5: { name: "premium_rate", i: 11, type: N },
|
|
3406
|
+
6: { name: "shared_cost", i: 11, type: N },
|
|
3407
|
+
7: { name: "personal_number", i: 11, type: N },
|
|
3408
|
+
8: { name: "voip", i: 11, type: N },
|
|
3409
|
+
21: { name: "pager", i: 11, type: N },
|
|
3410
|
+
25: { name: "uan", i: 11, type: N },
|
|
3411
|
+
27: { name: "emergency", i: 11, type: N },
|
|
3412
|
+
28: { name: "voicemail", i: 11, type: N },
|
|
3413
|
+
29: { name: "short_code", i: 11, type: N },
|
|
3414
|
+
30: { name: "standard_rate", i: 11, type: N },
|
|
3415
|
+
31: { name: "carrier_specific", i: 11, type: N },
|
|
3416
|
+
33: { name: "sms_services", i: 11, type: N },
|
|
3417
|
+
24: { name: "no_international_dialling", i: 11, type: N },
|
|
3308
3418
|
9: { name: "id", required: !0, i: 9, type: String },
|
|
3309
3419
|
10: { name: "country_code", i: 5, type: Number },
|
|
3310
3420
|
11: { name: "international_prefix", i: 9, type: String },
|
|
@@ -3318,25 +3428,25 @@ const n2 = (f) => {
|
|
|
3318
3428
|
},
|
|
3319
3429
|
16: { name: "national_prefix_transform_rule", i: 9, type: String },
|
|
3320
3430
|
18: { name: "same_mobile_and_fixed_line_pattern", i: 8, defaultValue: !1, type: Boolean },
|
|
3321
|
-
19: { name: "number_format", aa: !0, i: 11, type:
|
|
3322
|
-
20: { name: "intl_number_format", aa: !0, i: 11, type:
|
|
3431
|
+
19: { name: "number_format", aa: !0, i: 11, type: j },
|
|
3432
|
+
20: { name: "intl_number_format", aa: !0, i: 11, type: j },
|
|
3323
3433
|
22: { name: "main_country_for_code", i: 8, defaultValue: !1, type: Boolean },
|
|
3324
3434
|
23: { name: "leading_digits", i: 9, type: String }
|
|
3325
3435
|
})), d;
|
|
3326
3436
|
}, z.m = z.prototype.m;
|
|
3327
|
-
function
|
|
3328
|
-
|
|
3329
|
-
}
|
|
3330
|
-
$(
|
|
3331
|
-
var
|
|
3332
|
-
|
|
3333
|
-
var d =
|
|
3334
|
-
return d || (
|
|
3437
|
+
function H() {
|
|
3438
|
+
B.call(this);
|
|
3439
|
+
}
|
|
3440
|
+
$(H, B);
|
|
3441
|
+
var D1 = null, C0 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
|
|
3442
|
+
H.prototype.m = function() {
|
|
3443
|
+
var d = D1;
|
|
3444
|
+
return d || (D1 = d = i1(H, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: C0 }, 7: {
|
|
3335
3445
|
name: "preferred_domestic_carrier_code",
|
|
3336
3446
|
i: 9,
|
|
3337
3447
|
type: String
|
|
3338
3448
|
} })), d;
|
|
3339
|
-
},
|
|
3449
|
+
}, H.ctor = H, H.ctor.m = H.prototype.m;
|
|
3340
3450
|
var X = {
|
|
3341
3451
|
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(" "),
|
|
3342
3452
|
7: ["RU", "KZ"],
|
|
@@ -3553,7 +3663,7 @@ const n2 = (f) => {
|
|
|
3553
3663
|
995: ["GE"],
|
|
3554
3664
|
996: ["KG"],
|
|
3555
3665
|
998: ["UZ"]
|
|
3556
|
-
},
|
|
3666
|
+
}, x1 = {
|
|
3557
3667
|
AC: [, [
|
|
3558
3668
|
,
|
|
3559
3669
|
,
|
|
@@ -6102,7 +6212,7 @@ const n2 = (f) => {
|
|
|
6102
6212
|
,
|
|
6103
6213
|
,
|
|
6104
6214
|
[7, 8, 9]
|
|
6105
|
-
], [, , "(?:1(?:0[0-8]|1
|
|
6215
|
+
], [, , "(?: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]]],
|
|
6106
6216
|
KG: [, [
|
|
6107
6217
|
,
|
|
6108
6218
|
,
|
|
@@ -8158,7 +8268,7 @@ const n2 = (f) => {
|
|
|
8158
8268
|
,
|
|
8159
8269
|
,
|
|
8160
8270
|
[5, 6, 7]
|
|
8161
|
-
], [, , "72[48]0\\d{5}|7(?:[014-8]\\d|2[067]|36|9[
|
|
8271
|
+
], [, , "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]]],
|
|
8162
8272
|
US: [, [
|
|
8163
8273
|
,
|
|
8164
8274
|
,
|
|
@@ -8174,7 +8284,7 @@ const n2 = (f) => {
|
|
|
8174
8284
|
], [
|
|
8175
8285
|
,
|
|
8176
8286
|
,
|
|
8177
|
-
"
|
|
8287
|
+
"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}",
|
|
8178
8288
|
,
|
|
8179
8289
|
,
|
|
8180
8290
|
,
|
|
@@ -8186,7 +8296,7 @@ const n2 = (f) => {
|
|
|
8186
8296
|
], [
|
|
8187
8297
|
,
|
|
8188
8298
|
,
|
|
8189
|
-
"
|
|
8299
|
+
"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}",
|
|
8190
8300
|
,
|
|
8191
8301
|
,
|
|
8192
8302
|
,
|
|
@@ -8687,13 +8797,13 @@ const n2 = (f) => {
|
|
|
8687
8797
|
], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 888, , , , , , , , 1, [[, "(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "\\d{11}", , , , "12345678901"], , , [, , , , , , , , , [-1]]],
|
|
8688
8798
|
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]]]
|
|
8689
8799
|
};
|
|
8690
|
-
function
|
|
8800
|
+
function D() {
|
|
8691
8801
|
this.g = {};
|
|
8692
8802
|
}
|
|
8693
|
-
|
|
8694
|
-
return
|
|
8803
|
+
D.h = void 0, D.g = function() {
|
|
8804
|
+
return D.h ? D.h : D.h = new D();
|
|
8695
8805
|
};
|
|
8696
|
-
var g1 = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "0": "0", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8", "9": "9", "٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9", "۰": "0", "۱": "1", "۲": "2", "۳": "3", "۴": "4", "۵": "5", "۶": "6", "۷": "7", "۸": "8", "۹": "9" },
|
|
8806
|
+
var g1 = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "0": "0", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8", "9": "9", "٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9", "۰": "0", "۱": "1", "۲": "2", "۳": "3", "۴": "4", "۵": "5", "۶": "6", "۷": "7", "۸": "8", "۹": "9" }, m0 = {
|
|
8697
8807
|
0: "0",
|
|
8698
8808
|
1: "1",
|
|
8699
8809
|
2: "2",
|
|
@@ -8707,7 +8817,7 @@ const n2 = (f) => {
|
|
|
8707
8817
|
"+": "+",
|
|
8708
8818
|
"*": "*",
|
|
8709
8819
|
"#": "#"
|
|
8710
|
-
},
|
|
8820
|
+
}, y0 = {
|
|
8711
8821
|
0: "0",
|
|
8712
8822
|
1: "1",
|
|
8713
8823
|
2: "2",
|
|
@@ -8774,74 +8884,74 @@ const n2 = (f) => {
|
|
|
8774
8884
|
X: "9",
|
|
8775
8885
|
Y: "9",
|
|
8776
8886
|
Z: "9"
|
|
8777
|
-
},
|
|
8887
|
+
}, I0 = RegExp("[++]+"), Q = RegExp("^[++]+"), P1 = RegExp("([0-90-9٠-٩۰-۹])"), _0 = RegExp("[++0-90-9٠-٩۰-۹]"), b0 = /[\\\/] *x/, w0 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), S0 = /(?:.*?[A-Za-z]){3}.*/, v0 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), N0 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
|
|
8778
8888
|
function J(d) {
|
|
8779
8889
|
return "([0-90-9٠-٩۰-۹]{1," + d + "})";
|
|
8780
8890
|
}
|
|
8781
|
-
function
|
|
8891
|
+
function B1() {
|
|
8782
8892
|
return ";ext=" + J("20") + "|[ \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[ \\t,-]*" + (J("20") + "#?|[ \\t,]*(?:[xx##~~]|int|int)[:\\..]?[ \\t,-]*") + (J("9") + "#?|[- ]+") + (J("6") + "#|[ \\t]*(?:,{2}|;)[:\\..]?[ \\t,-]*") + (J("15") + "#?|[ \\t]*(?:,)+[:\\..]?[ \\t,-]*") + (J("9") + "#?");
|
|
8783
8893
|
}
|
|
8784
|
-
var
|
|
8785
|
-
function B1(d) {
|
|
8786
|
-
return 2 > d.length ? !1 : U(L0, d);
|
|
8787
|
-
}
|
|
8788
|
-
function R1(d) {
|
|
8789
|
-
return U(w0, d) ? r1(d, m0) : r1(d, g1);
|
|
8790
|
-
}
|
|
8894
|
+
var R1 = new RegExp("(?:" + B1() + ")$", "i"), L0 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + B1() + ")?$", "i"), A0 = /(\$\d)/, T0 = /^\(?\$1\)?$/;
|
|
8791
8895
|
function k1(d) {
|
|
8792
|
-
|
|
8793
|
-
|
|
8896
|
+
return 2 > d.length ? !1 : F(L0, d);
|
|
8897
|
+
}
|
|
8898
|
+
function G1(d) {
|
|
8899
|
+
return F(S0, d) ? s1(d, y0) : s1(d, g1);
|
|
8794
8900
|
}
|
|
8795
8901
|
function O1(d) {
|
|
8796
|
-
|
|
8902
|
+
var t = G1(d.toString());
|
|
8903
|
+
k(d), d.g(t);
|
|
8904
|
+
}
|
|
8905
|
+
function U1(d) {
|
|
8906
|
+
return d != null && (K(d, 9) != 1 || x(d, 9)[0] != -1);
|
|
8797
8907
|
}
|
|
8798
|
-
function
|
|
8799
|
-
for (var n = new
|
|
8908
|
+
function s1(d, t) {
|
|
8909
|
+
for (var n = new T(), r, o = d.length, l = 0; l < o; ++l) r = d.charAt(l), r = t[r.toUpperCase()], r != null && n.g(r);
|
|
8800
8910
|
return n.toString();
|
|
8801
8911
|
}
|
|
8802
|
-
function
|
|
8803
|
-
return d.length == 0 ||
|
|
8912
|
+
function F1(d) {
|
|
8913
|
+
return d.length == 0 || T0.test(d);
|
|
8804
8914
|
}
|
|
8805
8915
|
function o1(d) {
|
|
8806
|
-
return d != null && isNaN(d) && d.toUpperCase() in
|
|
8916
|
+
return d != null && isNaN(d) && d.toUpperCase() in x1;
|
|
8807
8917
|
}
|
|
8808
|
-
|
|
8809
|
-
if (
|
|
8810
|
-
var n =
|
|
8918
|
+
D.prototype.format = function(d, t) {
|
|
8919
|
+
if (m(d, 2) == 0 && R(d, 5)) {
|
|
8920
|
+
var n = w(d, 5);
|
|
8811
8921
|
if (0 < n.length) return n;
|
|
8812
8922
|
}
|
|
8813
|
-
n =
|
|
8923
|
+
n = w(d, 1);
|
|
8814
8924
|
var r = t1(d);
|
|
8815
|
-
if (t == 0) return
|
|
8925
|
+
if (t == 0) return V1(n, 0, r, "");
|
|
8816
8926
|
if (!(n in X)) return r;
|
|
8817
8927
|
var o = d1(this, n, e1(n));
|
|
8818
|
-
d =
|
|
8928
|
+
d = R(d, 3) && m(d, 3).length != 0 ? t == 3 ? ";ext=" + m(d, 3) : R(o, 13) ? m(o, 13) + w(d, 3) : " ext. " + w(d, 3) : "";
|
|
8819
8929
|
d: {
|
|
8820
|
-
o =
|
|
8821
|
-
for (var l, a = o.length,
|
|
8822
|
-
l = o[
|
|
8930
|
+
o = x(o, 20).length == 0 || t == 2 ? x(o, 19) : x(o, 20);
|
|
8931
|
+
for (var l, a = o.length, C = 0; C < a; ++C) {
|
|
8932
|
+
l = o[C];
|
|
8823
8933
|
var _ = K(l, 3);
|
|
8824
|
-
if ((_ == 0 || r.search(
|
|
8934
|
+
if ((_ == 0 || r.search(m(l, 3, _ - 1)) == 0) && (_ = new RegExp(m(l, 1)), F(_, r))) {
|
|
8825
8935
|
o = l;
|
|
8826
8936
|
break d;
|
|
8827
8937
|
}
|
|
8828
8938
|
}
|
|
8829
8939
|
o = null;
|
|
8830
8940
|
}
|
|
8831
|
-
return o != null && (a = o, o =
|
|
8941
|
+
return o != null && (a = o, o = w(a, 2), l = new RegExp(m(a, 1)), w(
|
|
8832
8942
|
a,
|
|
8833
8943
|
5
|
|
8834
|
-
), a =
|
|
8944
|
+
), a = w(a, 4), r = t == 2 && a != null && 0 < a.length ? r.replace(l, o.replace(A0, a)) : r.replace(l, o), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), V1(n, t, r, d);
|
|
8835
8945
|
};
|
|
8836
8946
|
function d1(d, t, n) {
|
|
8837
|
-
return n == "001" ?
|
|
8947
|
+
return n == "001" ? W(d, "" + t) : W(d, n);
|
|
8838
8948
|
}
|
|
8839
8949
|
function t1(d) {
|
|
8840
|
-
if (!
|
|
8841
|
-
var t = "" +
|
|
8842
|
-
return
|
|
8950
|
+
if (!R(d, 2)) return "";
|
|
8951
|
+
var t = "" + m(d, 2);
|
|
8952
|
+
return R(d, 4) && m(d, 4) && 0 < w(d, 8) ? Array(w(d, 8) + 1).join("0") + t : t;
|
|
8843
8953
|
}
|
|
8844
|
-
function
|
|
8954
|
+
function V1(d, t, n, r) {
|
|
8845
8955
|
switch (t) {
|
|
8846
8956
|
case 0:
|
|
8847
8957
|
return "+" + d + n + r;
|
|
@@ -8853,70 +8963,70 @@ const n2 = (f) => {
|
|
|
8853
8963
|
return n + r;
|
|
8854
8964
|
}
|
|
8855
8965
|
}
|
|
8856
|
-
function
|
|
8966
|
+
function u1(d, t) {
|
|
8857
8967
|
switch (t) {
|
|
8858
8968
|
case 4:
|
|
8859
|
-
return
|
|
8969
|
+
return m(d, 5);
|
|
8860
8970
|
case 3:
|
|
8861
|
-
return
|
|
8971
|
+
return m(d, 4);
|
|
8862
8972
|
case 1:
|
|
8863
|
-
return
|
|
8973
|
+
return m(d, 3);
|
|
8864
8974
|
case 0:
|
|
8865
8975
|
case 2:
|
|
8866
|
-
return
|
|
8976
|
+
return m(d, 2);
|
|
8867
8977
|
case 5:
|
|
8868
|
-
return
|
|
8978
|
+
return m(d, 6);
|
|
8869
8979
|
case 6:
|
|
8870
|
-
return
|
|
8980
|
+
return m(d, 8);
|
|
8871
8981
|
case 7:
|
|
8872
|
-
return
|
|
8982
|
+
return m(d, 7);
|
|
8873
8983
|
case 8:
|
|
8874
|
-
return
|
|
8984
|
+
return m(d, 21);
|
|
8875
8985
|
case 9:
|
|
8876
|
-
return
|
|
8986
|
+
return m(d, 25);
|
|
8877
8987
|
case 10:
|
|
8878
|
-
return
|
|
8988
|
+
return m(d, 28);
|
|
8879
8989
|
default:
|
|
8880
|
-
return
|
|
8990
|
+
return m(d, 1);
|
|
8881
8991
|
}
|
|
8882
8992
|
}
|
|
8883
|
-
function
|
|
8884
|
-
var n =
|
|
8885
|
-
return d = d1(d,
|
|
8993
|
+
function K1(d, t) {
|
|
8994
|
+
var n = H1(d, t);
|
|
8995
|
+
return d = d1(d, w(t, 1), n), d == null ? -1 : (t = t1(t), C1(t, d));
|
|
8886
8996
|
}
|
|
8887
8997
|
function C1(d, t) {
|
|
8888
|
-
return O(d,
|
|
8998
|
+
return O(d, m(t, 1)) ? O(d, m(t, 5)) ? 4 : O(d, m(t, 4)) ? 3 : O(d, m(t, 6)) ? 5 : O(d, m(t, 8)) ? 6 : O(d, m(t, 7)) ? 7 : O(d, m(t, 21)) ? 8 : O(d, m(t, 25)) ? 9 : O(d, m(t, 28)) ? 10 : O(d, m(t, 2)) ? m(t, 18) || O(d, m(t, 3)) ? 2 : 0 : !m(t, 18) && O(d, m(t, 3)) ? 1 : -1 : -1;
|
|
8889
8999
|
}
|
|
8890
|
-
function
|
|
9000
|
+
function W(d, t) {
|
|
8891
9001
|
if (t == null) return null;
|
|
8892
9002
|
t = t.toUpperCase();
|
|
8893
9003
|
var n = d.g[t];
|
|
8894
9004
|
if (n == null) {
|
|
8895
|
-
if (n =
|
|
9005
|
+
if (n = x1[t], n == null) return null;
|
|
8896
9006
|
n = new q().g(z.m(), n), d.g[t] = n;
|
|
8897
9007
|
}
|
|
8898
9008
|
return n;
|
|
8899
9009
|
}
|
|
8900
9010
|
function O(d, t) {
|
|
8901
9011
|
var n = d.length;
|
|
8902
|
-
return 0 < K(t, 9) &&
|
|
9012
|
+
return 0 < K(t, 9) && x(t, 9).indexOf(n) == -1 ? !1 : F(w(t, 2), d);
|
|
8903
9013
|
}
|
|
8904
9014
|
function E0(d, t) {
|
|
8905
|
-
var n =
|
|
8906
|
-
return o == null || n != "001" && r !=
|
|
9015
|
+
var n = H1(d, t), r = w(t, 1), o = d1(d, r, n);
|
|
9016
|
+
return o == null || n != "001" && r != W1(d, n) ? o = !1 : (d = t1(t), o = C1(d, o) != -1), o;
|
|
8907
9017
|
}
|
|
8908
|
-
function
|
|
9018
|
+
function H1(d, t) {
|
|
8909
9019
|
if (t == null) return null;
|
|
8910
|
-
var n =
|
|
9020
|
+
var n = w(t, 1);
|
|
8911
9021
|
if (n = X[n], n == null) d = null;
|
|
8912
9022
|
else if (n.length == 1) d = n[0];
|
|
8913
9023
|
else d: {
|
|
8914
9024
|
t = t1(t);
|
|
8915
9025
|
for (var r, o = n.length, l = 0; l < o; l++) {
|
|
8916
9026
|
r = n[l];
|
|
8917
|
-
var a =
|
|
8918
|
-
if (
|
|
8919
|
-
if (t.search(
|
|
9027
|
+
var a = W(d, r);
|
|
9028
|
+
if (R(a, 23)) {
|
|
9029
|
+
if (t.search(m(a, 23)) == 0) {
|
|
8920
9030
|
d = r;
|
|
8921
9031
|
break d;
|
|
8922
9032
|
}
|
|
@@ -8932,148 +9042,148 @@ const n2 = (f) => {
|
|
|
8932
9042
|
function e1(d) {
|
|
8933
9043
|
return d = X[d], d == null ? "ZZ" : d[0];
|
|
8934
9044
|
}
|
|
8935
|
-
function
|
|
8936
|
-
if (d =
|
|
8937
|
-
return
|
|
9045
|
+
function W1(d, t) {
|
|
9046
|
+
if (d = W(d, t), d == null) throw Error("Invalid region code: " + t);
|
|
9047
|
+
return w(d, 10);
|
|
8938
9048
|
}
|
|
8939
|
-
function
|
|
8940
|
-
var o =
|
|
8941
|
-
if (o =
|
|
8942
|
-
else return
|
|
9049
|
+
function l1(d, t, n, r) {
|
|
9050
|
+
var o = u1(n, r), l = K(o, 9) == 0 ? x(m(n, 1), 9) : x(o, 9);
|
|
9051
|
+
if (o = x(o, 10), r == 2) if (U1(u1(n, 0))) d = u1(n, 1), U1(d) && (l = l.concat(K(d, 9) == 0 ? x(m(n, 1), 9) : x(d, 9)), l.sort(), o.length == 0 ? o = x(d, 10) : (o = o.concat(x(d, 10)), o.sort()));
|
|
9052
|
+
else return l1(d, t, n, 1);
|
|
8943
9053
|
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));
|
|
8944
9054
|
}
|
|
8945
9055
|
function a1(d, t, n) {
|
|
8946
9056
|
var r = t1(t);
|
|
8947
|
-
return t =
|
|
9057
|
+
return t = w(t, 1), t in X ? (t = d1(d, t, e1(t)), l1(d, r, t, n)) : 1;
|
|
8948
9058
|
}
|
|
8949
|
-
function
|
|
9059
|
+
function j1(d, t) {
|
|
8950
9060
|
if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
|
|
8951
9061
|
for (var n, r = d.length, o = 1; 3 >= o && o <= r; ++o) if (n = parseInt(d.substring(0, o), 10), n in X) return t.g(d.substring(o)), n;
|
|
8952
9062
|
return 0;
|
|
8953
9063
|
}
|
|
8954
|
-
function
|
|
9064
|
+
function z1(d, t, n, r, o, l) {
|
|
8955
9065
|
if (t.length == 0) return 0;
|
|
8956
|
-
t = new
|
|
9066
|
+
t = new T(t);
|
|
8957
9067
|
var a;
|
|
8958
|
-
n != null && (a =
|
|
8959
|
-
var
|
|
8960
|
-
if (
|
|
8961
|
-
else if (Q.test(
|
|
9068
|
+
n != null && (a = m(n, 11)), a == null && (a = "NonMatch");
|
|
9069
|
+
var C = t.toString();
|
|
9070
|
+
if (C.length == 0) a = 20;
|
|
9071
|
+
else if (Q.test(C)) C = C.replace(Q, ""), k(t), t.g(G1(C)), a = 1;
|
|
8962
9072
|
else {
|
|
8963
|
-
if (
|
|
8964
|
-
|
|
8965
|
-
var _ = a.substring(
|
|
8966
|
-
_ && _[1] != null && 0 < _[1].length &&
|
|
9073
|
+
if (C = new RegExp(a), O1(t), a = t.toString(), a.search(C) == 0) {
|
|
9074
|
+
C = a.match(C)[0].length;
|
|
9075
|
+
var _ = a.substring(C).match(P1);
|
|
9076
|
+
_ && _[1] != null && 0 < _[1].length && s1(_[1], g1) == "0" ? a = !1 : (k(t), t.g(a.substring(C)), a = !0);
|
|
8967
9077
|
} else a = !1;
|
|
8968
9078
|
a = a ? 5 : 20;
|
|
8969
9079
|
}
|
|
8970
|
-
if (o &&
|
|
9080
|
+
if (o && M(l, 6, a), a != 20) {
|
|
8971
9081
|
if (2 >= t.h.length) throw Error("Phone number too short after IDD");
|
|
8972
|
-
if (d =
|
|
9082
|
+
if (d = j1(t, r), d != 0) return M(l, 1, d), d;
|
|
8973
9083
|
throw Error("Invalid country calling code");
|
|
8974
9084
|
}
|
|
8975
|
-
return n != null && (a =
|
|
9085
|
+
return n != null && (a = w(n, 10), C = "" + a, _ = t.toString(), _.lastIndexOf(C, 0) == 0 && (C = new T(_.substring(C.length)), _ = m(n, 1), _ = new RegExp(w(_, 2)), Z1(C, n, null), C = C.toString(), !F(_, t.toString()) && F(_, C) || l1(d, t.toString(), n, -1) == 3)) ? (r.g(C), o && M(l, 6, 10), M(l, 1, a), a) : (M(l, 1, 0), 0);
|
|
8976
9086
|
}
|
|
8977
|
-
function
|
|
8978
|
-
var r = d.toString(), o = r.length, l =
|
|
9087
|
+
function Z1(d, t, n) {
|
|
9088
|
+
var r = d.toString(), o = r.length, l = m(t, 15);
|
|
8979
9089
|
if (o != 0 && l != null && l.length != 0) {
|
|
8980
9090
|
var a = new RegExp("^(?:" + l + ")");
|
|
8981
9091
|
if (o = a.exec(r)) {
|
|
8982
|
-
l = new RegExp(
|
|
8983
|
-
var
|
|
8984
|
-
t =
|
|
9092
|
+
l = new RegExp(w(m(t, 1), 2));
|
|
9093
|
+
var C = F(l, r), _ = o.length - 1;
|
|
9094
|
+
t = m(t, 16), t == null || t.length == 0 || o[_] == null || o[_].length == 0 ? (!C || F(l, r.substring(o[0].length))) && (n != null && 0 < _ && o[_] != null && n.g(o[1]), d.set(r.substring(o[0].length))) : (r = r.replace(a, t), (!C || F(l, r)) && (n != null && 0 < _ && n.g(o[1]), d.set(r)));
|
|
8985
9095
|
}
|
|
8986
9096
|
}
|
|
8987
9097
|
}
|
|
8988
9098
|
function Z(d, t, n) {
|
|
8989
9099
|
if (!o1(n) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
|
|
8990
|
-
return
|
|
9100
|
+
return Y1(d, t, n, !0);
|
|
8991
9101
|
}
|
|
8992
|
-
function
|
|
9102
|
+
function Y1(d, t, n, r) {
|
|
8993
9103
|
if (t == null) throw Error("The string supplied did not seem to be a phone number");
|
|
8994
9104
|
if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
|
|
8995
|
-
var o = new
|
|
9105
|
+
var o = new T(), l = t.indexOf(";phone-context=");
|
|
8996
9106
|
if (l === -1) l = null;
|
|
8997
9107
|
else if (l += 15, l >= t.length) l = "";
|
|
8998
9108
|
else {
|
|
8999
9109
|
var a = t.indexOf(";", l);
|
|
9000
9110
|
l = a !== -1 ? t.substring(l, a) : t.substring(l);
|
|
9001
9111
|
}
|
|
9002
|
-
var
|
|
9003
|
-
if (
|
|
9112
|
+
var C = l;
|
|
9113
|
+
if (C == null ? a = !0 : C.length === 0 ? a = !1 : (a = v0.exec(C), C = N0.exec(C), a = a !== null || C !== null), !a || (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, a = t ?? "", C = a.search(_0), 0 <= C ? (a = a.substring(C), a = a.replace(w0, ""), C = a.search(b0), 0 <= C && (a = a.substring(0, C))) : a = "", l.call(o, a)), l = o.toString(), a = l.indexOf(";isub="), 0 < a && (k(o), o.g(l.substring(0, a))), !k1(o.toString()))) throw Error("The string supplied did not seem to be a phone number");
|
|
9004
9114
|
if (l = o.toString(), !(o1(n) || l != null && 0 < l.length && Q.test(l))) throw Error("Invalid country calling code");
|
|
9005
|
-
l = new
|
|
9115
|
+
l = new H(), r && M(l, 5, t);
|
|
9006
9116
|
d: {
|
|
9007
|
-
if (t = o.toString(), a = t.search(
|
|
9008
|
-
|
|
9009
|
-
for (var _ =
|
|
9010
|
-
|
|
9117
|
+
if (t = o.toString(), a = t.search(R1), 0 <= a && k1(t.substring(0, a))) {
|
|
9118
|
+
C = t.match(R1);
|
|
9119
|
+
for (var _ = C.length, V = 1; V < _; ++V) if (C[V] != null && 0 < C[V].length) {
|
|
9120
|
+
k(o), o.g(t.substring(0, a)), t = C[V];
|
|
9011
9121
|
break d;
|
|
9012
9122
|
}
|
|
9013
9123
|
}
|
|
9014
9124
|
t = "";
|
|
9015
9125
|
}
|
|
9016
|
-
0 < t.length &&
|
|
9126
|
+
0 < t.length && M(l, 3, t), a = W(d, n), t = new T(), C = 0, _ = o.toString();
|
|
9017
9127
|
try {
|
|
9018
|
-
|
|
9019
|
-
} catch (
|
|
9020
|
-
if (
|
|
9021
|
-
if (_ = _.replace(Q, ""),
|
|
9022
|
-
} else throw
|
|
9128
|
+
C = z1(d, _, a, t, r, l);
|
|
9129
|
+
} catch (I1) {
|
|
9130
|
+
if (I1.message == "Invalid country calling code" && Q.test(_)) {
|
|
9131
|
+
if (_ = _.replace(Q, ""), C = z1(d, _, a, t, r, l), C == 0) throw I1;
|
|
9132
|
+
} else throw I1;
|
|
9023
9133
|
}
|
|
9024
|
-
if (
|
|
9134
|
+
if (C != 0 ? (o = e1(C), o != n && (a = d1(d, C, o))) : (O1(o), t.g(o.toString()), n != null ? (C = w(a, 10), M(
|
|
9025
9135
|
l,
|
|
9026
9136
|
1,
|
|
9027
|
-
|
|
9028
|
-
)) : r && (delete l.h[6], l.g && delete l.g[6])), 2 > t.h.length || (a != null && (n = new
|
|
9137
|
+
C
|
|
9138
|
+
)) : r && (delete l.h[6], l.g && delete l.g[6])), 2 > t.h.length || (a != null && (n = new T(), o = new T(t.toString()), Z1(o, a, n), d = l1(d, o.toString(), a, -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");
|
|
9029
9139
|
if (17 < d) throw Error("The string supplied is too long to be a phone number");
|
|
9030
9140
|
if (1 < r.length && r.charAt(0) == "0") {
|
|
9031
|
-
for (
|
|
9032
|
-
d != 1 &&
|
|
9141
|
+
for (M(l, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
|
|
9142
|
+
d != 1 && M(l, 8, d);
|
|
9033
9143
|
}
|
|
9034
|
-
return
|
|
9144
|
+
return M(l, 2, parseInt(r, 10)), l;
|
|
9035
9145
|
}
|
|
9036
|
-
function
|
|
9146
|
+
function F(d, t) {
|
|
9037
9147
|
return !!((d = t.match(new RegExp("^(?:" + (typeof d == "string" ? d : d.source) + ")$", "i"))) && d[0].length == t.length);
|
|
9038
9148
|
}
|
|
9039
|
-
function
|
|
9040
|
-
this.fa = RegExp(" "), this.ja = "", this.v = new
|
|
9149
|
+
function M0(d) {
|
|
9150
|
+
this.fa = RegExp(" "), this.ja = "", this.v = new T(), this.da = "", this.s = new T(), this.ba = new T(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = D.g(), this.$ = 0, this.h = new T(), this.ha = !1, this.o = "", this.g = new T(), this.j = [], this.ka = d, this.l = X1(this, this.ka);
|
|
9041
9151
|
}
|
|
9042
|
-
var
|
|
9043
|
-
|
|
9044
|
-
var
|
|
9045
|
-
function
|
|
9152
|
+
var J1 = new z();
|
|
9153
|
+
M(J1, 11, "NA");
|
|
9154
|
+
var D0 = RegExp("^[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/ ()()[].\\[\\]/~⁓∼~]*)*$"), q1 = /[- ]/;
|
|
9155
|
+
function X1(d, t) {
|
|
9046
9156
|
var n = d.ga;
|
|
9047
|
-
return t = o1(t) ?
|
|
9157
|
+
return t = o1(t) ? W1(n, t) : 0, d = W(d.ga, e1(t)), d ?? J1;
|
|
9048
9158
|
}
|
|
9049
|
-
function
|
|
9159
|
+
function Q1(d) {
|
|
9050
9160
|
for (var t = d.j.length, n = 0; n < t; ++n) {
|
|
9051
|
-
var r = d.j[n], o =
|
|
9161
|
+
var r = d.j[n], o = w(r, 1);
|
|
9052
9162
|
if (d.da == o) return !1;
|
|
9053
|
-
var l = d, a = r,
|
|
9054
|
-
|
|
9163
|
+
var l = d, a = r, C = w(a, 1);
|
|
9164
|
+
k(l.v);
|
|
9055
9165
|
var _ = l;
|
|
9056
|
-
a =
|
|
9057
|
-
var
|
|
9058
|
-
if (
|
|
9166
|
+
a = w(a, 2);
|
|
9167
|
+
var V = "999999999999999".match(C)[0];
|
|
9168
|
+
if (V.length < _.g.h.length ? _ = "" : (_ = V.replace(new RegExp(C, "g"), a), _ = _.replace(RegExp("9", "g"), " ")), 0 < _.length ? (l.v.g(_), l = !0) : l = !1, l) return d.da = o, d.ha = q1.test(m(r, 4)), d.$ = 0, !0;
|
|
9059
9169
|
}
|
|
9060
9170
|
return d.u = !1;
|
|
9061
9171
|
}
|
|
9062
|
-
function
|
|
9172
|
+
function d0(d, t) {
|
|
9063
9173
|
for (var n = [], r = t.length - 3, o = d.j.length, l = 0; l < o; ++l) {
|
|
9064
9174
|
var a = d.j[l];
|
|
9065
|
-
K(a, 3) == 0 ? n.push(d.j[l]) : (a =
|
|
9175
|
+
K(a, 3) == 0 ? n.push(d.j[l]) : (a = m(a, 3, Math.min(r, K(a, 3) - 1)), t.search(a) == 0 && n.push(d.j[l]));
|
|
9066
9176
|
}
|
|
9067
9177
|
d.j = n;
|
|
9068
9178
|
}
|
|
9069
|
-
function
|
|
9179
|
+
function x0(d, t) {
|
|
9070
9180
|
d.s.g(t);
|
|
9071
9181
|
var n = t;
|
|
9072
|
-
if (
|
|
9182
|
+
if (P1.test(n) || d.s.h.length == 1 && I0.test(n) ? (t == "+" ? (n = t, d.ba.g(t)) : (n = g1[t], d.ba.g(n), d.g.g(n)), t = n) : (d.u = !1, d.la = !0), !d.u) {
|
|
9073
9183
|
if (!d.la) {
|
|
9074
|
-
if (
|
|
9075
|
-
if (
|
|
9076
|
-
} else if (0 < d.o.length && (t = d.g.toString(),
|
|
9184
|
+
if (i0(d)) {
|
|
9185
|
+
if (r0(d)) return t0(d);
|
|
9186
|
+
} else if (0 < d.o.length && (t = d.g.toString(), k(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), n = t.lastIndexOf(d.o), k(d.h), d.h.g(t.substring(0, n))), d.o != n0(d)) return d.h.g(" "), t0(d);
|
|
9077
9187
|
}
|
|
9078
9188
|
return d.s.toString();
|
|
9079
9189
|
}
|
|
@@ -9083,19 +9193,19 @@ const n2 = (f) => {
|
|
|
9083
9193
|
case 2:
|
|
9084
9194
|
return d.s.toString();
|
|
9085
9195
|
case 3:
|
|
9086
|
-
if (
|
|
9087
|
-
else return d.o =
|
|
9196
|
+
if (i0(d)) d.ea = !0;
|
|
9197
|
+
else return d.o = n0(d), m1(d);
|
|
9088
9198
|
default:
|
|
9089
|
-
return d.ea ? (
|
|
9199
|
+
return d.ea ? (r0(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = s0(d, t), n = e0(d), 0 < n.length ? n : (d0(d, d.g.toString()), Q1(d) ? $0(d) : d.u ? h1(d, t) : d.s.toString())) : m1(d);
|
|
9090
9200
|
}
|
|
9091
9201
|
}
|
|
9092
|
-
function
|
|
9093
|
-
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0,
|
|
9202
|
+
function t0(d) {
|
|
9203
|
+
return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, k(d.v), d.da = "", m1(d);
|
|
9094
9204
|
}
|
|
9095
|
-
function
|
|
9205
|
+
function e0(d) {
|
|
9096
9206
|
for (var t = d.g.toString(), n = d.j.length, r = 0; r < n; ++r) {
|
|
9097
|
-
var o = d.j[r], l =
|
|
9098
|
-
if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha =
|
|
9207
|
+
var o = d.j[r], l = w(o, 1);
|
|
9208
|
+
if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha = q1.test(m(o, 4)), o = t.replace(new RegExp(l, "g"), m(o, 2)), o = h1(d, o), s1(o, m0) == d.ba)) return o;
|
|
9099
9209
|
}
|
|
9100
9210
|
return "";
|
|
9101
9211
|
}
|
|
@@ -9106,61 +9216,61 @@ const n2 = (f) => {
|
|
|
9106
9216
|
function m1(d) {
|
|
9107
9217
|
var t = d.g.toString();
|
|
9108
9218
|
if (3 <= t.length) {
|
|
9109
|
-
for (var n = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ?
|
|
9219
|
+
for (var n = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ? x(d.l, 20) : x(d.l, 19), r = n.length, o = 0; o < r; ++o) {
|
|
9110
9220
|
var l = n[o];
|
|
9111
|
-
0 < d.o.length &&
|
|
9221
|
+
0 < d.o.length && F1(w(l, 4)) && !m(l, 6) && !R(l, 5) || (d.o.length != 0 || d.ca || F1(w(l, 4)) || m(l, 6)) && D0.test(w(l, 2)) && d.j.push(l);
|
|
9112
9222
|
}
|
|
9113
|
-
return
|
|
9223
|
+
return d0(d, t), t = e0(d), 0 < t.length ? t : Q1(d) ? $0(d) : d.s.toString();
|
|
9114
9224
|
}
|
|
9115
9225
|
return h1(d, t);
|
|
9116
9226
|
}
|
|
9117
|
-
function
|
|
9227
|
+
function $0(d) {
|
|
9118
9228
|
var t = d.g.toString(), n = t.length;
|
|
9119
9229
|
if (0 < n) {
|
|
9120
|
-
for (var r = "", o = 0; o < n; o++) r =
|
|
9230
|
+
for (var r = "", o = 0; o < n; o++) r = s0(d, t.charAt(o));
|
|
9121
9231
|
return d.u ? h1(d, r) : d.s.toString();
|
|
9122
9232
|
}
|
|
9123
9233
|
return d.h.toString();
|
|
9124
9234
|
}
|
|
9125
|
-
function
|
|
9235
|
+
function n0(d) {
|
|
9126
9236
|
var t = d.g.toString(), n = 0;
|
|
9127
|
-
if (
|
|
9237
|
+
if (m(d.l, 10) != 1) var r = !1;
|
|
9128
9238
|
else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
|
|
9129
|
-
return r ? (n = 1, d.h.g("1").g(" "), d.ca = !0) :
|
|
9239
|
+
return r ? (n = 1, d.h.g("1").g(" "), d.ca = !0) : R(d.l, 15) && (r = new RegExp("^(?:" + m(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)))), k(d.g), d.g.g(t.substring(n)), t.substring(0, n);
|
|
9130
9240
|
}
|
|
9131
|
-
function
|
|
9132
|
-
var t = d.ba.toString(), n = new RegExp("^(?:\\+|" +
|
|
9133
|
-
return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length,
|
|
9241
|
+
function i0(d) {
|
|
9242
|
+
var t = d.ba.toString(), n = new RegExp("^(?:\\+|" + m(d.l, 11) + ")");
|
|
9243
|
+
return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length, k(d.g), d.g.g(t.substring(n)), k(d.h), d.h.g(t.substring(0, n)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
|
|
9134
9244
|
}
|
|
9135
|
-
function
|
|
9245
|
+
function r0(d) {
|
|
9136
9246
|
if (d.g.h.length == 0) return !1;
|
|
9137
|
-
var t = new
|
|
9138
|
-
return n == 0 ? !1 : (
|
|
9247
|
+
var t = new T(), n = j1(d.g, t);
|
|
9248
|
+
return n == 0 ? !1 : (k(d.g), d.g.g(t.toString()), t = e1(n), t == "001" ? d.l = W(d.ga, "" + n) : t != d.ka && (d.l = X1(d, t)), d.h.g("" + n).g(" "), d.o = "", !0);
|
|
9139
9249
|
}
|
|
9140
|
-
function
|
|
9250
|
+
function s0(d, t) {
|
|
9141
9251
|
var n = d.v.toString();
|
|
9142
9252
|
if (0 <= n.substring(d.$).search(d.fa)) {
|
|
9143
9253
|
var r = n.search(d.fa);
|
|
9144
|
-
return t = n.replace(d.fa, t),
|
|
9254
|
+
return t = n.replace(d.fa, t), k(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
|
|
9145
9255
|
}
|
|
9146
9256
|
return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
|
|
9147
9257
|
}
|
|
9148
|
-
const
|
|
9258
|
+
const o0 = (d) => {
|
|
9149
9259
|
const t = [];
|
|
9150
9260
|
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);
|
|
9151
9261
|
}, y1 = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
|
|
9152
9262
|
e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
|
|
9153
9263
|
try {
|
|
9154
|
-
const n = d.replace(/[^+0-9]/g, ""), r = new
|
|
9264
|
+
const n = d.replace(/[^+0-9]/g, ""), r = new M0(t);
|
|
9155
9265
|
t = "";
|
|
9156
|
-
for (let o = 0; o < n.length; o++) r.ja =
|
|
9266
|
+
for (let o = 0; o < n.length; o++) r.ja = x0(r, n.charAt(o)), t = r.ja;
|
|
9157
9267
|
return t;
|
|
9158
9268
|
} catch {
|
|
9159
9269
|
return d;
|
|
9160
9270
|
}
|
|
9161
9271
|
}), e("intlTelInputUtilsTemp.formatNumber", (d, t, n) => {
|
|
9162
9272
|
try {
|
|
9163
|
-
const o =
|
|
9273
|
+
const o = D.g(), l = Z(o, d, t);
|
|
9164
9274
|
var r = a1(o, l, -1);
|
|
9165
9275
|
return r == 0 || r == 4 ? o.format(l, typeof n > "u" ? 0 : n) : d;
|
|
9166
9276
|
} catch {
|
|
@@ -9168,52 +9278,52 @@ const n2 = (f) => {
|
|
|
9168
9278
|
}
|
|
9169
9279
|
}), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, n, r) => {
|
|
9170
9280
|
try {
|
|
9171
|
-
const _ =
|
|
9281
|
+
const _ = D.g();
|
|
9172
9282
|
d: {
|
|
9173
9283
|
var o = _;
|
|
9174
9284
|
if (o1(d)) {
|
|
9175
|
-
var l =
|
|
9285
|
+
var l = u1(W(o, d), n);
|
|
9176
9286
|
try {
|
|
9177
|
-
if (
|
|
9178
|
-
var a =
|
|
9287
|
+
if (R(l, 6)) {
|
|
9288
|
+
var a = m(l, 6), C = Y1(o, a, d, !1);
|
|
9179
9289
|
break d;
|
|
9180
9290
|
}
|
|
9181
9291
|
} catch {
|
|
9182
9292
|
}
|
|
9183
9293
|
}
|
|
9184
|
-
|
|
9294
|
+
C = null;
|
|
9185
9295
|
}
|
|
9186
|
-
return _.format(
|
|
9296
|
+
return _.format(C, r ? 0 : t ? 2 : 1);
|
|
9187
9297
|
} catch {
|
|
9188
9298
|
return "";
|
|
9189
9299
|
}
|
|
9190
9300
|
}), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
|
|
9191
9301
|
try {
|
|
9192
|
-
return
|
|
9302
|
+
return m(Z(D.g(), d, t), 3);
|
|
9193
9303
|
} catch {
|
|
9194
9304
|
return "";
|
|
9195
9305
|
}
|
|
9196
9306
|
}), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
|
|
9197
9307
|
try {
|
|
9198
|
-
const n =
|
|
9199
|
-
return
|
|
9308
|
+
const n = D.g(), r = Z(n, d, t);
|
|
9309
|
+
return K1(n, r);
|
|
9200
9310
|
} catch {
|
|
9201
9311
|
return -99;
|
|
9202
9312
|
}
|
|
9203
9313
|
}), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
|
|
9204
9314
|
if (!t) return 1;
|
|
9205
9315
|
try {
|
|
9206
|
-
const n =
|
|
9316
|
+
const n = D.g(), r = Z(n, d, t);
|
|
9207
9317
|
return a1(n, r, -1);
|
|
9208
9318
|
} catch (n) {
|
|
9209
9319
|
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;
|
|
9210
9320
|
}
|
|
9211
9321
|
}), e("intlTelInputUtilsTemp.isValidNumber", (d, t, n) => {
|
|
9212
9322
|
try {
|
|
9213
|
-
const r =
|
|
9323
|
+
const r = D.g(), o = Z(r, d, t), l = E0(r, o);
|
|
9214
9324
|
if (n) {
|
|
9215
|
-
const a =
|
|
9216
|
-
return l && a.includes(
|
|
9325
|
+
const a = o0(n).map((C) => y1[C]);
|
|
9326
|
+
return l && a.includes(K1(r, o));
|
|
9217
9327
|
}
|
|
9218
9328
|
return l;
|
|
9219
9329
|
} catch {
|
|
@@ -9221,9 +9331,9 @@ const n2 = (f) => {
|
|
|
9221
9331
|
}
|
|
9222
9332
|
}), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, n) => {
|
|
9223
9333
|
try {
|
|
9224
|
-
const r =
|
|
9334
|
+
const r = D.g(), o = Z(r, d, t);
|
|
9225
9335
|
if (n) {
|
|
9226
|
-
const l =
|
|
9336
|
+
const l = o0(n);
|
|
9227
9337
|
for (let a of l) if (a1(r, o, y1[a]) === 0) return !0;
|
|
9228
9338
|
return !1;
|
|
9229
9339
|
}
|
|
@@ -9233,18 +9343,18 @@ const n2 = (f) => {
|
|
|
9233
9343
|
}
|
|
9234
9344
|
}), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
|
|
9235
9345
|
try {
|
|
9236
|
-
return
|
|
9346
|
+
return m(Z(D.g(), d, t), 2).toString();
|
|
9237
9347
|
} catch {
|
|
9238
9348
|
return "";
|
|
9239
9349
|
}
|
|
9240
9350
|
}), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", y1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
|
|
9241
9351
|
})();
|
|
9242
|
-
const
|
|
9243
|
-
delete
|
|
9244
|
-
y.utils =
|
|
9245
|
-
const
|
|
9352
|
+
const f0 = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : void 0, s2 = f0.intlTelInputUtilsTemp;
|
|
9353
|
+
delete f0.intlTelInputUtilsTemp;
|
|
9354
|
+
y.utils = s2;
|
|
9355
|
+
const u2 = {
|
|
9246
9356
|
__name: "IntlTelInputWithUtils",
|
|
9247
|
-
props: /* @__PURE__ */
|
|
9357
|
+
props: /* @__PURE__ */ u0({
|
|
9248
9358
|
disabled: {
|
|
9249
9359
|
type: Boolean,
|
|
9250
9360
|
default: !1
|
|
@@ -9268,47 +9378,47 @@ const r2 = {
|
|
|
9268
9378
|
},
|
|
9269
9379
|
modelModifiers: {}
|
|
9270
9380
|
}),
|
|
9271
|
-
emits: /* @__PURE__ */
|
|
9381
|
+
emits: /* @__PURE__ */ u0([
|
|
9272
9382
|
"changeNumber",
|
|
9273
9383
|
"changeCountry",
|
|
9274
9384
|
"changeValidity",
|
|
9275
9385
|
"changeErrorCode"
|
|
9276
9386
|
], ["update:modelValue"]),
|
|
9277
|
-
setup(
|
|
9278
|
-
const i = P0(
|
|
9279
|
-
let
|
|
9280
|
-
|
|
9387
|
+
setup(p, { expose: e, emit: $ }) {
|
|
9388
|
+
const i = P0(p, "modelValue"), s = p, h = $, u = _1(), f = _1(), c = _1(!1), g = () => f.value ? s.options.strictMode ? f.value.isValidNumberPrecise() : f.value.isValidNumber() : null, I = () => {
|
|
9389
|
+
let b = g();
|
|
9390
|
+
c.value !== b && (c.value = b, h("changeValidity", !!b), h(
|
|
9281
9391
|
"changeErrorCode",
|
|
9282
|
-
|
|
9392
|
+
b ? null : f.value.getValidationError()
|
|
9283
9393
|
));
|
|
9284
|
-
},
|
|
9285
|
-
var
|
|
9286
|
-
|
|
9287
|
-
},
|
|
9288
|
-
var
|
|
9289
|
-
|
|
9394
|
+
}, S = () => {
|
|
9395
|
+
var b;
|
|
9396
|
+
h("changeNumber", ((b = f.value) == null ? void 0 : b.getNumber()) ?? ""), I();
|
|
9397
|
+
}, L = () => {
|
|
9398
|
+
var b;
|
|
9399
|
+
h("changeCountry", ((b = f.value) == null ? void 0 : b.getSelectedCountryData().iso2) ?? ""), S(), I();
|
|
9290
9400
|
};
|
|
9291
|
-
return
|
|
9292
|
-
|
|
9293
|
-
}),
|
|
9401
|
+
return B0(() => {
|
|
9402
|
+
u.value && (f.value = y(u.value, s.options), s.value && f.value.setNumber(s.value), s.disabled && f.value.setDisabled(s.disabled), c.value = g());
|
|
9403
|
+
}), R0(
|
|
9294
9404
|
() => s.disabled,
|
|
9295
|
-
(
|
|
9296
|
-
var
|
|
9297
|
-
return (
|
|
9405
|
+
(b) => {
|
|
9406
|
+
var A;
|
|
9407
|
+
return (A = f.value) == null ? void 0 : A.setDisabled(b);
|
|
9298
9408
|
}
|
|
9299
|
-
),
|
|
9300
|
-
var
|
|
9301
|
-
return (
|
|
9302
|
-
}), e({ instance:
|
|
9409
|
+
), k0(() => {
|
|
9410
|
+
var b;
|
|
9411
|
+
return (b = f.value) == null ? void 0 : b.destroy();
|
|
9412
|
+
}), e({ instance: f, input: u }), (b, A) => G0((U0(), O0("input", F0({
|
|
9303
9413
|
ref_key: "input",
|
|
9304
|
-
ref:
|
|
9305
|
-
"onUpdate:modelValue":
|
|
9414
|
+
ref: u,
|
|
9415
|
+
"onUpdate:modelValue": A[0] || (A[0] = (G) => i.value = G),
|
|
9306
9416
|
type: "tel",
|
|
9307
|
-
onCountrychange:
|
|
9308
|
-
onInput:
|
|
9309
|
-
},
|
|
9417
|
+
onCountrychange: L,
|
|
9418
|
+
onInput: S
|
|
9419
|
+
}, p.inputProps), null, 16)), [
|
|
9310
9420
|
[
|
|
9311
|
-
|
|
9421
|
+
V0,
|
|
9312
9422
|
i.value,
|
|
9313
9423
|
void 0,
|
|
9314
9424
|
{ lazy: !0 }
|
|
@@ -9317,5 +9427,5 @@ const r2 = {
|
|
|
9317
9427
|
}
|
|
9318
9428
|
};
|
|
9319
9429
|
export {
|
|
9320
|
-
|
|
9430
|
+
u2 as default
|
|
9321
9431
|
};
|