intl-tel-input 27.1.2 → 27.2.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/CHANGELOG.md +1 -1
- package/README.md +2 -2
- package/angular/README.md +8 -0
- package/angular/dist/IntlTelInput.d.ts +13 -1
- package/angular/dist/IntlTelInput.js +238 -186
- package/angular/dist/IntlTelInputWithUtils.js +238 -186
- package/dist/js/data.js +1 -1
- package/dist/js/data.min.js +1 -1
- package/dist/js/intlTelInput.js +204 -184
- package/dist/js/intlTelInput.min.js +9 -9
- package/dist/js/intlTelInput.mjs +203 -183
- package/dist/js/intlTelInputWithUtils.js +204 -184
- package/dist/js/intlTelInputWithUtils.min.js +7 -7
- package/dist/js/intlTelInputWithUtils.mjs +203 -183
- package/package.json +1 -1
- package/react/README.md +8 -0
- package/react/dist/IntlTelInput.d.ts +5 -0
- package/react/dist/IntlTelInput.js +246 -188
- package/react/dist/IntlTelInputWithUtils.js +246 -188
- package/svelte/README.md +9 -0
- package/svelte/src/IntlTelInput.svelte +49 -7
- package/svelte/src/IntlTelInput.svelte.d.ts +6 -0
- package/vue/README.md +9 -0
- package/vue/dist/{IntlTelInput-6eM889WB.js → IntlTelInput-DTtMkd4-.js} +338 -309
- package/vue/dist/IntlTelInput.js +1 -1
- package/vue/dist/IntlTelInput.vue.d.ts +19 -11
- package/vue/dist/IntlTelInputWithUtils.js +1 -1
|
@@ -1271,7 +1271,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1271
1271
|
HIDDEN: "aria-hidden",
|
|
1272
1272
|
AUTOCOMPLETE: "aria-autocomplete",
|
|
1273
1273
|
MODAL: "aria-modal"
|
|
1274
|
-
},
|
|
1274
|
+
}, M = {
|
|
1275
1275
|
selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
|
|
1276
1276
|
noCountrySelected: "Select country for phone number",
|
|
1277
1277
|
countryListAriaLabel: "List of countries",
|
|
@@ -1281,7 +1281,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1281
1281
|
searchSummaryAria(e) {
|
|
1282
1282
|
return e === 0 ? "No results found" : e === 1 ? "1 result found" : `${e} results found`;
|
|
1283
1283
|
}
|
|
1284
|
-
},
|
|
1284
|
+
}, N = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, P = () => N(`(max-width: ${C.NARROW_VIEWPORT_WIDTH}px)`), F = {
|
|
1285
1285
|
allowDropdown: !0,
|
|
1286
1286
|
allowedNumberTypes: ["MOBILE", "FIXED_LINE"],
|
|
1287
1287
|
allowNumberExtensions: !1,
|
|
@@ -1312,35 +1312,35 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1312
1312
|
strictMode: !1,
|
|
1313
1313
|
useFullscreenPopup: (() => {
|
|
1314
1314
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1315
|
-
let e =
|
|
1316
|
-
return
|
|
1315
|
+
let e = N("(max-height: 600px)"), t = N("(pointer: coarse)");
|
|
1316
|
+
return P() || t && e;
|
|
1317
1317
|
}
|
|
1318
1318
|
return !1;
|
|
1319
1319
|
})()
|
|
1320
|
-
},
|
|
1320
|
+
}, I = (e) => JSON.stringify(e), L = (e) => !!e && typeof e == "object" && !Array.isArray(e), ee = (e) => typeof e == "function", te = (e) => {
|
|
1321
1321
|
if (!e || typeof e != "object") return !1;
|
|
1322
1322
|
let t = e;
|
|
1323
1323
|
return t.nodeType === 1 && typeof t.tagName == "string" && typeof t.appendChild == "function";
|
|
1324
|
-
},
|
|
1324
|
+
}, R = new Set(Object.values(D)), z = (e) => {
|
|
1325
1325
|
console.warn(`[intl-tel-input] ${e}`);
|
|
1326
|
-
},
|
|
1327
|
-
|
|
1328
|
-
},
|
|
1326
|
+
}, B = (e, t, n) => {
|
|
1327
|
+
z(`Option '${e}' must be ${t}; got ${I(n)}. Ignoring.`);
|
|
1328
|
+
}, ne = (e, t) => {
|
|
1329
1329
|
let n = "an array of iso2 country code strings";
|
|
1330
|
-
if (!Array.isArray(t)) return
|
|
1330
|
+
if (!Array.isArray(t)) return B(e, n, t), !1;
|
|
1331
1331
|
let r = [];
|
|
1332
1332
|
for (let i of t) {
|
|
1333
|
-
if (typeof i != "string") return
|
|
1334
|
-
m(i.toLowerCase()) ? r.push(i) :
|
|
1333
|
+
if (typeof i != "string") return B(e, n, t), !1;
|
|
1334
|
+
m(i.toLowerCase()) ? r.push(i) : z(`Invalid iso2 code in '${e}': '${i}'. Skipping.`);
|
|
1335
1335
|
}
|
|
1336
1336
|
return r;
|
|
1337
|
-
},
|
|
1337
|
+
}, re = (e) => {
|
|
1338
1338
|
if (e === void 0) return {};
|
|
1339
|
-
if (!
|
|
1339
|
+
if (!L(e)) return z(`The second argument must be an options object; got ${I(e)}. Using defaults.`), {};
|
|
1340
1340
|
let t = {};
|
|
1341
1341
|
for (let [n, r] of Object.entries(e)) {
|
|
1342
|
-
if (!Object.hasOwn(
|
|
1343
|
-
|
|
1342
|
+
if (!Object.hasOwn(F, n)) {
|
|
1343
|
+
z(`Unknown option '${n}'. Ignoring.`);
|
|
1344
1344
|
continue;
|
|
1345
1345
|
}
|
|
1346
1346
|
switch (n) {
|
|
@@ -1358,14 +1358,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1358
1358
|
case "strictMode":
|
|
1359
1359
|
case "useFullscreenPopup":
|
|
1360
1360
|
if (typeof r != "boolean") {
|
|
1361
|
-
|
|
1361
|
+
B(n, "a boolean", r);
|
|
1362
1362
|
break;
|
|
1363
1363
|
}
|
|
1364
1364
|
t[n] = r;
|
|
1365
1365
|
break;
|
|
1366
1366
|
case "autoPlaceholder":
|
|
1367
|
-
if (typeof r != "string" || !
|
|
1368
|
-
|
|
1367
|
+
if (typeof r != "string" || !R.has(r)) {
|
|
1368
|
+
B("autoPlaceholder", `one of ${Array.from(R).join(", ")}`, r);
|
|
1369
1369
|
break;
|
|
1370
1370
|
}
|
|
1371
1371
|
t[n] = r;
|
|
@@ -1374,7 +1374,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1374
1374
|
case "searchInputClass":
|
|
1375
1375
|
case "countryNameLocale":
|
|
1376
1376
|
if (typeof r != "string") {
|
|
1377
|
-
|
|
1377
|
+
B(n, "a string", r);
|
|
1378
1378
|
break;
|
|
1379
1379
|
}
|
|
1380
1380
|
t[n] = r;
|
|
@@ -1382,7 +1382,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1382
1382
|
case "countryOrder":
|
|
1383
1383
|
if (r === null) t[n] = r;
|
|
1384
1384
|
else {
|
|
1385
|
-
let e =
|
|
1385
|
+
let e = ne(n, r);
|
|
1386
1386
|
e !== !1 && (t[n] = e);
|
|
1387
1387
|
}
|
|
1388
1388
|
break;
|
|
@@ -1390,15 +1390,15 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1390
1390
|
case "geoIpLookup":
|
|
1391
1391
|
case "hiddenInput":
|
|
1392
1392
|
case "loadUtils":
|
|
1393
|
-
if (r !== null && !
|
|
1394
|
-
|
|
1393
|
+
if (r !== null && !ee(r)) {
|
|
1394
|
+
B(n, "a function or null", r);
|
|
1395
1395
|
break;
|
|
1396
1396
|
}
|
|
1397
1397
|
t[n] = r;
|
|
1398
1398
|
break;
|
|
1399
1399
|
case "dropdownContainer":
|
|
1400
|
-
if (r !== null && !
|
|
1401
|
-
|
|
1400
|
+
if (r !== null && !te(r)) {
|
|
1401
|
+
B("dropdownContainer", "an HTMLElement or null", r);
|
|
1402
1402
|
break;
|
|
1403
1403
|
}
|
|
1404
1404
|
t[n] = r;
|
|
@@ -1407,25 +1407,25 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1407
1407
|
case "onlyCountries":
|
|
1408
1408
|
if (r === null) t[n] = r;
|
|
1409
1409
|
else {
|
|
1410
|
-
let e =
|
|
1410
|
+
let e = ne(n, r);
|
|
1411
1411
|
e !== !1 && (t[n] = e);
|
|
1412
1412
|
}
|
|
1413
1413
|
break;
|
|
1414
1414
|
case "i18n":
|
|
1415
|
-
if (r && !
|
|
1416
|
-
|
|
1415
|
+
if (r && !L(r)) {
|
|
1416
|
+
B("i18n", "an object", r);
|
|
1417
1417
|
break;
|
|
1418
1418
|
}
|
|
1419
1419
|
t[n] = r;
|
|
1420
1420
|
break;
|
|
1421
1421
|
case "initialCountry": {
|
|
1422
1422
|
if (typeof r != "string") {
|
|
1423
|
-
|
|
1423
|
+
B("initialCountry", "a string", r);
|
|
1424
1424
|
break;
|
|
1425
1425
|
}
|
|
1426
1426
|
let e = r.toLowerCase();
|
|
1427
1427
|
if (e && e !== O.AUTO && !m(e)) {
|
|
1428
|
-
|
|
1428
|
+
B("initialCountry", "a valid iso2 country code or 'auto'", r);
|
|
1429
1429
|
break;
|
|
1430
1430
|
}
|
|
1431
1431
|
t[n] = r;
|
|
@@ -1433,7 +1433,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1433
1433
|
}
|
|
1434
1434
|
case "placeholderNumberType":
|
|
1435
1435
|
if (typeof r != "string" || !k.has(r)) {
|
|
1436
|
-
|
|
1436
|
+
B("placeholderNumberType", `one of ${Array.from(k).join(", ")}`, r);
|
|
1437
1437
|
break;
|
|
1438
1438
|
}
|
|
1439
1439
|
t[n] = r;
|
|
@@ -1441,12 +1441,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1441
1441
|
case "allowedNumberTypes":
|
|
1442
1442
|
if (r !== null) {
|
|
1443
1443
|
if (!Array.isArray(r)) {
|
|
1444
|
-
|
|
1444
|
+
B("allowedNumberTypes", "an array of number types or null", r);
|
|
1445
1445
|
break;
|
|
1446
1446
|
}
|
|
1447
1447
|
let e = !0;
|
|
1448
1448
|
for (let t of r) if (typeof t != "string" || !k.has(t)) {
|
|
1449
|
-
|
|
1449
|
+
B("allowedNumberTypes", `an array of valid number types (${Array.from(k).join(", ")})`, t), e = !1;
|
|
1450
1450
|
break;
|
|
1451
1451
|
}
|
|
1452
1452
|
e && (t[n] = r);
|
|
@@ -1455,21 +1455,21 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
1457
|
return t;
|
|
1458
|
-
},
|
|
1458
|
+
}, ie = (e) => {
|
|
1459
1459
|
e.initialCountry &&= e.initialCountry.toLowerCase(), e.onlyCountries?.length && (e.onlyCountries = e.onlyCountries.map((e) => e.toLowerCase())), e.excludeCountries?.length && (e.excludeCountries = e.excludeCountries.map((e) => e.toLowerCase())), e.countryOrder &&= e.countryOrder.map((e) => e.toLowerCase());
|
|
1460
|
-
},
|
|
1461
|
-
e.dropdownAlwaysOpen && (e.useFullscreenPopup = !1, e.allowDropdown = !0), e.useFullscreenPopup ? e.fixDropdownWidth = !1 :
|
|
1462
|
-
...
|
|
1460
|
+
}, ae = (e) => {
|
|
1461
|
+
e.dropdownAlwaysOpen && (e.useFullscreenPopup = !1, e.allowDropdown = !0), e.useFullscreenPopup ? e.fixDropdownWidth = !1 : P() && (e.fixDropdownWidth = !0), e.onlyCountries?.length === 1 && (e.initialCountry = e.onlyCountries[0]), e.separateDialCode && (e.nationalMode = !1), e.allowDropdown && !e.showFlags && !e.separateDialCode && (e.nationalMode = !1), e.useFullscreenPopup && !e.dropdownContainer && (e.dropdownContainer = document.body), e.i18n = {
|
|
1462
|
+
...M,
|
|
1463
1463
|
...e.i18n
|
|
1464
1464
|
};
|
|
1465
|
-
},
|
|
1465
|
+
}, V = (e) => e.replace(/\D/g, ""), H = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), U = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), W = (e, t, n) => {
|
|
1466
1466
|
let r = document.createElement(e);
|
|
1467
1467
|
return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
|
|
1468
|
-
},
|
|
1468
|
+
}, oe = () => `
|
|
1469
1469
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${j.HIDDEN}="true">
|
|
1470
1470
|
<circle cx="11" cy="11" r="7" />
|
|
1471
1471
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1472
|
-
</svg>`,
|
|
1472
|
+
</svg>`, se = (e) => {
|
|
1473
1473
|
let t = `iti-${e}-clear-mask`;
|
|
1474
1474
|
return `
|
|
1475
1475
|
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${j.HIDDEN}="true" focusable="false">
|
|
@@ -1479,11 +1479,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1479
1479
|
</mask>
|
|
1480
1480
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
|
|
1481
1481
|
</svg>`;
|
|
1482
|
-
},
|
|
1482
|
+
}, ce = () => `
|
|
1483
1483
|
<svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${j.HIDDEN}="true">
|
|
1484
1484
|
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
|
|
1485
|
-
</svg>`,
|
|
1486
|
-
let n =
|
|
1485
|
+
</svg>`, G = () => "\n <svg width=\"256\" height=\"256\" viewBox=\"0 0 512 512\" class=\"iti__globe-svg\">\n <path d=\"M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39\"/>\n <path d=\"m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40\"/>\n </svg>", le = (e, t) => {
|
|
1486
|
+
let n = H(t), r = [], i = [], a = [], o = [], s = [], c = [];
|
|
1487
1487
|
for (let t of e) t.iso2 === n ? r.push(t) : t.normalisedName.startsWith(n) ? i.push(t) : t.normalisedName.includes(n) ? a.push(t) : n === t.dialCode || n === t.dialCodePlus ? o.push(t) : t.dialCodePlus.includes(n) ? s.push(t) : t.initials.includes(n) && c.push(t);
|
|
1488
1488
|
let l = (e, t) => e.priority - t.priority;
|
|
1489
1489
|
return [
|
|
@@ -1494,11 +1494,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1494
1494
|
...s.sort(l),
|
|
1495
1495
|
...c
|
|
1496
1496
|
];
|
|
1497
|
-
},
|
|
1498
|
-
let n =
|
|
1497
|
+
}, ue = (e, t) => {
|
|
1498
|
+
let n = H(t);
|
|
1499
1499
|
for (let t of e) if (t.normalisedName.startsWith(n)) return t;
|
|
1500
1500
|
return null;
|
|
1501
|
-
},
|
|
1501
|
+
}, K = class e {
|
|
1502
1502
|
#e;
|
|
1503
1503
|
#t;
|
|
1504
1504
|
#n;
|
|
@@ -1543,7 +1543,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1543
1543
|
this.#D(t), t.appendChild(this.telInputEl), this.#A(), this.#j(t), this.ensureDropdownWidthSet();
|
|
1544
1544
|
}
|
|
1545
1545
|
#E() {
|
|
1546
|
-
let { allowDropdown: e, showFlags: t, containerClass: n, useFullscreenPopup: r } = this.#e, i =
|
|
1546
|
+
let { allowDropdown: e, showFlags: t, containerClass: n, useFullscreenPopup: r } = this.#e, i = W("div", { class: U({
|
|
1547
1547
|
iti: !0,
|
|
1548
1548
|
"iti--allow-dropdown": e,
|
|
1549
1549
|
"iti--show-flags": t,
|
|
@@ -1555,19 +1555,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1555
1555
|
#D(e) {
|
|
1556
1556
|
let { allowDropdown: t, separateDialCode: n, showFlags: r } = this.#e;
|
|
1557
1557
|
if (!t && !r && !n) return;
|
|
1558
|
-
this.#s =
|
|
1558
|
+
this.#s = W("div", { class: `iti__country-container ${_.V_HIDE}` }, e), t ? (this.#c = W("button", {
|
|
1559
1559
|
type: "button",
|
|
1560
1560
|
class: "iti__selected-country",
|
|
1561
1561
|
[j.EXPANDED]: "false",
|
|
1562
1562
|
[j.LABEL]: this.#e.i18n.noCountrySelected,
|
|
1563
1563
|
[j.HASPOPUP]: "dialog",
|
|
1564
1564
|
[j.CONTROLS]: `iti-${this.#t}__dropdown-content`
|
|
1565
|
-
}, this.#s), this.telInputEl.disabled && this.#c.setAttribute("disabled", "true")) : this.#c =
|
|
1566
|
-
let i =
|
|
1567
|
-
this.#l =
|
|
1565
|
+
}, this.#s), this.telInputEl.disabled && this.#c.setAttribute("disabled", "true")) : this.#c = W("div", { class: "iti__selected-country" }, this.#s);
|
|
1566
|
+
let i = W("div", { class: "iti__selected-country-primary" }, this.#c);
|
|
1567
|
+
this.#l = W("div", { class: _.FLAG }, i), t && (this.#d = W("div", {
|
|
1568
1568
|
class: "iti__arrow",
|
|
1569
1569
|
[j.HIDDEN]: "true"
|
|
1570
|
-
}, i)), n && (this.#u =
|
|
1570
|
+
}, i)), n && (this.#u = W("div", { class: "iti__selected-dial-code" }, this.#c)), t && this.#O();
|
|
1571
1571
|
}
|
|
1572
1572
|
ensureDropdownWidthSet() {
|
|
1573
1573
|
let { fixDropdownWidth: e, allowDropdown: t } = this.#e;
|
|
@@ -1577,17 +1577,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1577
1577
|
}
|
|
1578
1578
|
#O() {
|
|
1579
1579
|
let { fixDropdownWidth: e, useFullscreenPopup: t, countrySearch: n, i18n: r, dropdownContainer: i, containerClass: a } = this.#e, o = e ? "" : "iti--flexible-dropdown-width";
|
|
1580
|
-
this.#f =
|
|
1580
|
+
this.#f = W("div", {
|
|
1581
1581
|
id: `iti-${this.#t}__dropdown-content`,
|
|
1582
1582
|
class: `iti__dropdown-content ${_.HIDE} ${o}`,
|
|
1583
1583
|
role: "dialog",
|
|
1584
1584
|
[j.MODAL]: "true"
|
|
1585
|
-
}), this.#n && this.#f.setAttribute("dir", "rtl"), n && this.#k(), this.#g =
|
|
1585
|
+
}), this.#n && this.#f.setAttribute("dir", "rtl"), n && this.#k(), this.#g = W("ul", {
|
|
1586
1586
|
class: "iti__country-list",
|
|
1587
1587
|
id: `iti-${this.#t}__country-listbox`,
|
|
1588
1588
|
role: "listbox",
|
|
1589
1589
|
[j.LABEL]: r.countryListAriaLabel
|
|
1590
|
-
}, this.#f), this.#M(), n && this.#L(), t || (this.#o = this.#I(), n && (this.#f.style.height = `${this.#o}px`)), i ? (this.#x =
|
|
1590
|
+
}, this.#f), this.#M(), n && this.#L(), t || (this.#o = this.#I(), n && (this.#f.style.height = `${this.#o}px`)), i ? (this.#x = W("div", { class: U({
|
|
1591
1591
|
iti: !0,
|
|
1592
1592
|
"iti--container": !0,
|
|
1593
1593
|
"iti--fullscreen-popup": t,
|
|
@@ -1596,11 +1596,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1596
1596
|
}) }), this.#x.appendChild(this.#f)) : this.#s.appendChild(this.#f);
|
|
1597
1597
|
}
|
|
1598
1598
|
#k() {
|
|
1599
|
-
let { i18n: e, searchInputClass: t } = this.#e, n =
|
|
1600
|
-
this.#p =
|
|
1599
|
+
let { i18n: e, searchInputClass: t } = this.#e, n = W("div", { class: "iti__search-input-wrapper" }, this.#f);
|
|
1600
|
+
this.#p = W("span", {
|
|
1601
1601
|
class: "iti__search-icon",
|
|
1602
1602
|
[j.HIDDEN]: "true"
|
|
1603
|
-
}, n), this.#p.innerHTML =
|
|
1603
|
+
}, n), this.#p.innerHTML = oe(), this.#m = W("input", {
|
|
1604
1604
|
id: `iti-${this.#t}__search-input`,
|
|
1605
1605
|
type: "search",
|
|
1606
1606
|
class: `iti__search-input ${t}`,
|
|
@@ -1611,12 +1611,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1611
1611
|
[j.CONTROLS]: `iti-${this.#t}__country-listbox`,
|
|
1612
1612
|
[j.AUTOCOMPLETE]: "list",
|
|
1613
1613
|
autocomplete: "off"
|
|
1614
|
-
}, n), this.#h =
|
|
1614
|
+
}, n), this.#h = W("button", {
|
|
1615
1615
|
type: "button",
|
|
1616
1616
|
class: `iti__search-clear ${_.HIDE}`,
|
|
1617
1617
|
[j.LABEL]: e.clearSearchAriaLabel,
|
|
1618
1618
|
tabindex: "-1"
|
|
1619
|
-
}, n), this.#h.innerHTML =
|
|
1619
|
+
}, n), this.#h.innerHTML = se(this.#t), this.#b = W("span", { class: "iti__a11y-text" }, this.#f), this.#y = W("div", {
|
|
1620
1620
|
class: `iti__no-results ${_.HIDE}`,
|
|
1621
1621
|
[j.HIDDEN]: "true"
|
|
1622
1622
|
}, this.#f), this.#y.textContent = e.searchEmptyState ?? null;
|
|
@@ -1630,14 +1630,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1630
1630
|
let n = t(this.telInputEl.getAttribute("name") || "");
|
|
1631
1631
|
if (n.phone) {
|
|
1632
1632
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.phone}"]`);
|
|
1633
|
-
t ? this.#_ = t : (this.#_ =
|
|
1633
|
+
t ? this.#_ = t : (this.#_ = W("input", {
|
|
1634
1634
|
type: "hidden",
|
|
1635
1635
|
name: n.phone
|
|
1636
1636
|
}), e.appendChild(this.#_));
|
|
1637
1637
|
}
|
|
1638
1638
|
if (n.country) {
|
|
1639
1639
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.country}"]`);
|
|
1640
|
-
t ? this.#v = t : (this.#v =
|
|
1640
|
+
t ? this.#v = t : (this.#v = W("input", {
|
|
1641
1641
|
type: "hidden",
|
|
1642
1642
|
name: n.country
|
|
1643
1643
|
}), e.appendChild(this.#v));
|
|
@@ -1646,17 +1646,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1646
1646
|
#M() {
|
|
1647
1647
|
let e = document.createDocumentFragment();
|
|
1648
1648
|
for (let t = 0; t < this.#i.length; t++) {
|
|
1649
|
-
let n = this.#i[t], r =
|
|
1649
|
+
let n = this.#i[t], r = U({ [_.COUNTRY_ITEM]: !0 }), i = W("li", {
|
|
1650
1650
|
id: `iti-${this.#t}__item-${n.iso2}`,
|
|
1651
1651
|
class: r,
|
|
1652
1652
|
tabindex: "-1",
|
|
1653
1653
|
role: "option",
|
|
1654
1654
|
[j.SELECTED]: "false"
|
|
1655
1655
|
});
|
|
1656
|
-
i.dataset[A.DIAL_CODE] = n.dialCode, i.dataset[A.ISO2] = n.iso2, this.#w.set(n.iso2, i), this.#e.showFlags &&
|
|
1657
|
-
let a =
|
|
1656
|
+
i.dataset[A.DIAL_CODE] = n.dialCode, i.dataset[A.ISO2] = n.iso2, this.#w.set(n.iso2, i), this.#e.showFlags && W("div", { class: `${_.FLAG} iti__${n.iso2}` }, i);
|
|
1657
|
+
let a = W("span", { class: "iti__country-name" }, i);
|
|
1658
1658
|
a.textContent = `${n.name} `;
|
|
1659
|
-
let o =
|
|
1659
|
+
let o = W("span", { class: "iti__dial-code" }, a);
|
|
1660
1660
|
this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${n.dialCode})`, e.appendChild(i);
|
|
1661
1661
|
}
|
|
1662
1662
|
this.#g.appendChild(e);
|
|
@@ -1690,7 +1690,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1690
1690
|
#I() {
|
|
1691
1691
|
let t = e.#P();
|
|
1692
1692
|
this.#f.classList.remove(_.HIDE);
|
|
1693
|
-
let n =
|
|
1693
|
+
let n = W("div", { class: "iti iti--inline-dropdown" });
|
|
1694
1694
|
n.appendChild(this.#f), n.style.visibility = "hidden", t.appendChild(n);
|
|
1695
1695
|
let r = this.#f.offsetHeight;
|
|
1696
1696
|
return t.removeChild(n), n.style.visibility = "", this.#f.classList.add(_.HIDE), r > 0 ? r : C.FALLBACK_DROPDOWN_HEIGHT;
|
|
@@ -1701,7 +1701,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1701
1701
|
}
|
|
1702
1702
|
#R(e) {
|
|
1703
1703
|
let t;
|
|
1704
|
-
t = e === "" ? this.#i :
|
|
1704
|
+
t = e === "" ? this.#i : le(this.#i, e), this.#$(t);
|
|
1705
1705
|
}
|
|
1706
1706
|
prefillSearchWithPlus() {
|
|
1707
1707
|
this.#m.value = "+", this.#m.focus(), this.#R("");
|
|
@@ -1797,7 +1797,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1797
1797
|
v.ARROW_DOWN,
|
|
1798
1798
|
v.ENTER,
|
|
1799
1799
|
v.ESC
|
|
1800
|
-
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#Z(e.key) : e.key === v.ENTER && !e.isComposing ? t(this.#C) : e.key === v.ESC && (n(), this.#c.focus())), !this.#e.countrySearch && b.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#X(r), i = setTimeout(() => {
|
|
1800
|
+
].includes(e.key) && (e.preventDefault(), e.stopPropagation(), e.key === v.ARROW_UP || e.key === v.ARROW_DOWN ? this.#Z(e.key) : e.key === v.ENTER && !e.isComposing ? t(this.#C) : e.key === v.ESC && (n(), this.#c.focus())), !this.#e.countrySearch && e.target !== this.telInputEl && b.HIDDEN_SEARCH_CHAR.test(e.key) && (e.stopPropagation(), i && clearTimeout(i), r += e.key.toLowerCase(), this.#X(r), i = setTimeout(() => {
|
|
1801
1801
|
r = "";
|
|
1802
1802
|
}, x.HIDDEN_SEARCH_RESET_MS));
|
|
1803
1803
|
}, { signal: e });
|
|
@@ -1806,7 +1806,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1806
1806
|
this.#m.addEventListener("input", () => this.#B(), { signal: e }), this.#h.addEventListener("click", () => this.#V(), { signal: e });
|
|
1807
1807
|
}
|
|
1808
1808
|
#X(e) {
|
|
1809
|
-
let t =
|
|
1809
|
+
let t = ue(this.#i, e);
|
|
1810
1810
|
if (t) {
|
|
1811
1811
|
let e = this.#w.get(t.iso2);
|
|
1812
1812
|
this.#U(e);
|
|
@@ -1821,11 +1821,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1821
1821
|
let t = this.#g.querySelector(`[data-country-code="${e}"]`);
|
|
1822
1822
|
if (t) {
|
|
1823
1823
|
t.setAttribute(j.SELECTED, "true");
|
|
1824
|
-
let e =
|
|
1824
|
+
let e = W("span", {
|
|
1825
1825
|
class: "iti__country-check",
|
|
1826
1826
|
[j.HIDDEN]: "true"
|
|
1827
1827
|
}, t);
|
|
1828
|
-
e.innerHTML =
|
|
1828
|
+
e.innerHTML = ce(), this.#S = t, this.#e.dropdownAlwaysOpen && this.#U(t);
|
|
1829
1829
|
}
|
|
1830
1830
|
}
|
|
1831
1831
|
}
|
|
@@ -1885,7 +1885,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1885
1885
|
let { allowDropdown: t, showFlags: n, separateDialCode: r, i18n: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
1886
1886
|
if (t && this.#Q(s), this.#c) {
|
|
1887
1887
|
let e = s && n ? `${_.FLAG} iti__${s}` : `${_.FLAG} ${_.GLOBE}`, t, r, c;
|
|
1888
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), c = n ? "" :
|
|
1888
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), c = n ? "" : G()) : (r = i.noCountrySelected, t = i.noCountrySelected, c = G()), this.#l.className = e, this.#c.setAttribute("title", r), this.#c.setAttribute(j.LABEL, t), this.#l.innerHTML = c;
|
|
1889
1889
|
}
|
|
1890
1890
|
if (r) {
|
|
1891
1891
|
let e = o ? `+${o}` : "";
|
|
@@ -1897,10 +1897,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1897
1897
|
let e = this.telInputEl.parentNode;
|
|
1898
1898
|
e && (e.before(this.telInputEl), e.remove()), this.#w.clear();
|
|
1899
1899
|
}
|
|
1900
|
-
},
|
|
1900
|
+
}, de = (e) => {
|
|
1901
1901
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
1902
1902
|
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
|
|
1903
|
-
},
|
|
1903
|
+
}, fe = (e, t) => {
|
|
1904
1904
|
let { countryNameLocale: n, i18n: r } = t, i;
|
|
1905
1905
|
try {
|
|
1906
1906
|
i = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
|
|
@@ -1908,7 +1908,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1908
1908
|
console.error(e), i = null;
|
|
1909
1909
|
}
|
|
1910
1910
|
for (let t of e) t.name = r[t.iso2] || i?.of(t.iso2.toUpperCase()) || "";
|
|
1911
|
-
},
|
|
1911
|
+
}, pe = (e) => {
|
|
1912
1912
|
let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
|
|
1913
1913
|
if (!e || !t) return;
|
|
1914
1914
|
t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
|
|
@@ -1937,7 +1937,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1937
1937
|
dialCodeMaxLength: n,
|
|
1938
1938
|
dialCodeToIso2Map: r
|
|
1939
1939
|
};
|
|
1940
|
-
},
|
|
1940
|
+
}, me = (e, t) => {
|
|
1941
1941
|
let { countryOrder: n } = t;
|
|
1942
1942
|
e.sort((e, t) => {
|
|
1943
1943
|
if (n) {
|
|
@@ -1946,9 +1946,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1946
1946
|
}
|
|
1947
1947
|
return e.name.localeCompare(t.name);
|
|
1948
1948
|
});
|
|
1949
|
-
},
|
|
1950
|
-
for (let t of e) t.normalisedName =
|
|
1951
|
-
},
|
|
1949
|
+
}, he = (e) => {
|
|
1950
|
+
for (let t of e) t.normalisedName = H(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
|
|
1951
|
+
}, ge = /* @__PURE__ */ new Set([
|
|
1952
1952
|
"800",
|
|
1953
1953
|
"808",
|
|
1954
1954
|
"870",
|
|
@@ -1957,17 +1957,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1957
1957
|
"883",
|
|
1958
1958
|
"888",
|
|
1959
1959
|
"979"
|
|
1960
|
-
]),
|
|
1961
|
-
let t =
|
|
1962
|
-
return e.startsWith("+") &&
|
|
1963
|
-
},
|
|
1960
|
+
]), q = (e) => {
|
|
1961
|
+
let t = V(e).slice(0, 3);
|
|
1962
|
+
return e.startsWith("+") && ge.has(t);
|
|
1963
|
+
}, J = (e, t, n, r) => {
|
|
1964
1964
|
if (!n || !t) return e;
|
|
1965
1965
|
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
1966
1966
|
return e.substring(a);
|
|
1967
|
-
},
|
|
1967
|
+
}, _e = (e, t, n, r, i) => {
|
|
1968
1968
|
let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
|
|
1969
1969
|
return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
|
|
1970
|
-
},
|
|
1970
|
+
}, ve = (e, t, n, r) => {
|
|
1971
1971
|
if (n === 0 && !r) return 0;
|
|
1972
1972
|
let i = 0;
|
|
1973
1973
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -1975,7 +1975,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1975
1975
|
if (r && i === e + 1) return n;
|
|
1976
1976
|
}
|
|
1977
1977
|
return t.length;
|
|
1978
|
-
},
|
|
1978
|
+
}, ye = /* @__PURE__ */ new Set([
|
|
1979
1979
|
"800",
|
|
1980
1980
|
"822",
|
|
1981
1981
|
"833",
|
|
@@ -1993,14 +1993,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1993
1993
|
"887",
|
|
1994
1994
|
"888",
|
|
1995
1995
|
"889"
|
|
1996
|
-
]),
|
|
1997
|
-
let t =
|
|
1996
|
+
]), Y = (e) => {
|
|
1997
|
+
let t = V(e);
|
|
1998
1998
|
if (t.startsWith(w.NANP) && t.length >= 4) {
|
|
1999
1999
|
let e = t.substring(1, 4);
|
|
2000
|
-
return
|
|
2000
|
+
return ye.has(e);
|
|
2001
2001
|
}
|
|
2002
2002
|
return !1;
|
|
2003
|
-
},
|
|
2003
|
+
}, be = class {
|
|
2004
2004
|
#e;
|
|
2005
2005
|
constructor(e) {
|
|
2006
2006
|
e && this.#t(e);
|
|
@@ -2022,9 +2022,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2022
2022
|
isAscii() {
|
|
2023
2023
|
return !this.#e || this.#e === "ascii";
|
|
2024
2024
|
}
|
|
2025
|
-
},
|
|
2025
|
+
}, xe = 0, X = (e) => {
|
|
2026
2026
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
2027
|
-
},
|
|
2027
|
+
}, Se = () => {
|
|
2028
2028
|
let e, t;
|
|
2029
2029
|
return {
|
|
2030
2030
|
promise: new Promise((n, r) => {
|
|
@@ -2050,54 +2050,55 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2050
2050
|
#d = !0;
|
|
2051
2051
|
#f;
|
|
2052
2052
|
#p;
|
|
2053
|
-
#m;
|
|
2053
|
+
#m = !1;
|
|
2054
2054
|
#h;
|
|
2055
|
+
#g;
|
|
2055
2056
|
constructor(e, t = {}) {
|
|
2056
|
-
this.id =
|
|
2057
|
-
let n =
|
|
2057
|
+
this.id = xe++, K.validateInput(e);
|
|
2058
|
+
let n = re(t);
|
|
2058
2059
|
this.#t = {
|
|
2059
|
-
...
|
|
2060
|
+
...F,
|
|
2060
2061
|
...n
|
|
2061
|
-
},
|
|
2062
|
-
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } =
|
|
2063
|
-
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#
|
|
2062
|
+
}, ie(this.#t), ae(this.#t), this.#e = new K(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#p = new be(e.value), this.promise = this.#y(this.#t), this.#r = de(this.#t);
|
|
2063
|
+
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = pe(this.#r);
|
|
2064
|
+
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#b();
|
|
2064
2065
|
}
|
|
2065
|
-
#
|
|
2066
|
+
#_() {
|
|
2066
2067
|
let e = this.#e.telInputEl.value.trim();
|
|
2067
2068
|
return this.#p.normalise(e);
|
|
2068
2069
|
}
|
|
2069
|
-
#
|
|
2070
|
+
#v(e) {
|
|
2070
2071
|
this.#e.telInputEl.value = this.#p.denormalise(e);
|
|
2071
2072
|
}
|
|
2072
|
-
#
|
|
2073
|
+
#y(e) {
|
|
2073
2074
|
let { initialCountry: t, geoIpLookup: n, loadUtils: r } = e, i = t === O.AUTO && !!n, a = !!r && !Q.utils;
|
|
2074
|
-
return i && (this.#
|
|
2075
|
-
}
|
|
2076
|
-
#y() {
|
|
2077
|
-
this.#f = new AbortController(), this.#b(), this.#e.buildMarkup(this.#r), this.#x(), this.#S(), this.#C(), this.#t.dropdownAlwaysOpen && this.#N();
|
|
2075
|
+
return i && (this.#h = Se()), a && (this.#g = Se()), Promise.all([this.#h?.promise, this.#g?.promise]).then(() => {});
|
|
2078
2076
|
}
|
|
2079
2077
|
#b() {
|
|
2080
|
-
|
|
2078
|
+
this.#f = new AbortController(), this.#x(), this.#e.buildMarkup(this.#r), this.#S(), this.#C(), this.#w(), this.#t.dropdownAlwaysOpen && this.#V();
|
|
2081
2079
|
}
|
|
2082
|
-
#x(
|
|
2083
|
-
|
|
2084
|
-
a ? o ? f ? this.#z(u) : d || this.#z(E.ISO2) : (f && this.#z(u), this.#F(i)) : f ? this.#z(u) : d || this.#z(""), i && this.#P(i);
|
|
2080
|
+
#x() {
|
|
2081
|
+
fe(this.#r, this.#t), me(this.#r, this.#t), he(this.#r);
|
|
2085
2082
|
}
|
|
2086
|
-
#S() {
|
|
2087
|
-
|
|
2083
|
+
#S(e = !1) {
|
|
2084
|
+
let t = this.#e.telInputEl.getAttribute("value"), n = this.#p.normalise(t ?? ""), r = this.#_(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#$(i), o = Y(i), { initialCountry: s, geoIpLookup: c } = this.#t, l = s === O.AUTO && c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
|
|
2085
|
+
a ? o ? f ? this.#q(u) : d || this.#q(E.ISO2) : (f && this.#q(u), this.#U(i)) : f ? this.#q(u) : d || this.#q(""), i && this.#H(i);
|
|
2088
2086
|
}
|
|
2089
2087
|
#C() {
|
|
2090
|
-
|
|
2088
|
+
this.#O(), this.#t.allowDropdown && this.#e.bindAllInitialDropdownListeners(this.#f.signal, () => this.#V(), () => this.#Z()), this.#e.bindHiddenInputSubmitListener(this.#f.signal, () => this.getNumber(), () => this.#c?.iso2 || "");
|
|
2089
|
+
}
|
|
2090
|
+
#w() {
|
|
2091
|
+
if (this.#g) {
|
|
2091
2092
|
let { loadUtils: e } = this.#t, t = () => {
|
|
2092
2093
|
Q.attachUtils(e)?.catch(() => {});
|
|
2093
2094
|
};
|
|
2094
2095
|
Q.documentReady() ? t() : window.addEventListener("load", t, { signal: this.#f.signal });
|
|
2095
2096
|
}
|
|
2096
|
-
this.#
|
|
2097
|
+
this.#h && (this.#c ? this.#h.resolve() : this.#T());
|
|
2097
2098
|
}
|
|
2098
|
-
#
|
|
2099
|
+
#T() {
|
|
2099
2100
|
if (Q.autoCountry) {
|
|
2100
|
-
this.#
|
|
2101
|
+
this.#ae();
|
|
2101
2102
|
return;
|
|
2102
2103
|
}
|
|
2103
2104
|
this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.geoIpLookup == "function" && this.#t.geoIpLookup((t = "") => {
|
|
@@ -2107,108 +2108,119 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2107
2108
|
e.forEachInstance("handleAutoCountryFailure");
|
|
2108
2109
|
}));
|
|
2109
2110
|
}
|
|
2110
|
-
#
|
|
2111
|
-
this.#
|
|
2111
|
+
#E() {
|
|
2112
|
+
this.#V(), this.#e.prefillSearchWithPlus();
|
|
2112
2113
|
}
|
|
2113
|
-
#
|
|
2114
|
+
#D(e) {
|
|
2114
2115
|
let t = this.#e.telInputEl.selectionStart || 0, n = e.substring(0, t - 1), r = e.substring(t);
|
|
2115
|
-
return this.#
|
|
2116
|
-
}
|
|
2117
|
-
#D() {
|
|
2118
|
-
this.#O(), this.#k(), this.#A();
|
|
2116
|
+
return this.#v(n + r), t - 1;
|
|
2119
2117
|
}
|
|
2120
2118
|
#O() {
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2119
|
+
this.#N(), this.#F(), this.#L();
|
|
2120
|
+
}
|
|
2121
|
+
#k(e) {
|
|
2122
|
+
this.#D(e), this.#E();
|
|
2123
|
+
}
|
|
2124
|
+
#A(e, t) {
|
|
2125
|
+
let n = this.#D(e);
|
|
2126
|
+
this.#e.telInputEl.setSelectionRange(n, n), this.#B(g.STRICT_REJECT, {
|
|
2127
|
+
source: "key",
|
|
2128
|
+
rejectedInput: t,
|
|
2129
|
+
reason: "invalid"
|
|
2130
|
+
});
|
|
2131
|
+
}
|
|
2132
|
+
#j(e, t) {
|
|
2133
|
+
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, i = _e(this.#te(), e, Q.utils, this.#c, this.#t.separateDialCode), a = ve(r, i, n, t);
|
|
2134
|
+
this.#v(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2135
|
+
}
|
|
2136
|
+
#M(e) {
|
|
2137
|
+
if (e.startsWith("+") && this.#c && this.#$(e)) {
|
|
2138
|
+
let t = J(e, !0, !0, this.#c);
|
|
2139
|
+
this.#v(t);
|
|
2140
|
+
}
|
|
2141
|
+
}
|
|
2142
|
+
#N() {
|
|
2143
|
+
this.#m = b.ALPHA_UNICODE.test(this.#_()), this.#e.telInputEl.addEventListener("input", this.#P, { signal: this.#f.signal });
|
|
2144
|
+
}
|
|
2145
|
+
#P = (e) => {
|
|
2146
|
+
let { strictMode: t, formatAsYouType: n, separateDialCode: r, allowDropdown: i, countrySearch: a } = this.#t, o = e?.detail;
|
|
2147
|
+
if (o?.isCountryChange) return;
|
|
2148
|
+
let s = this.#_();
|
|
2149
|
+
if (this.#n && e?.data === "+" && r && i && a) {
|
|
2150
|
+
this.#k(s);
|
|
2151
|
+
return;
|
|
2152
|
+
}
|
|
2153
|
+
if (this.#n && t && (e?.data === " " || e?.data === "-" || e?.data === ".")) {
|
|
2154
|
+
this.#A(s, e.data);
|
|
2155
|
+
return;
|
|
2156
|
+
}
|
|
2157
|
+
this.#U(s) && this.#ie();
|
|
2158
|
+
let c = e?.data && b.NON_PLUS_NUMERIC.test(e.data), l = e?.inputType === y.PASTE && s;
|
|
2159
|
+
c || l && !t ? this.#m = !0 : b.NON_PLUS_NUMERIC.test(s) || (this.#m = !1), n && !this.#m && !o?.isSetNumber && this.#p.isAscii() && this.#j(s, e?.inputType === y.DELETE_FORWARD), r && this.#M(s);
|
|
2160
|
+
};
|
|
2161
|
+
#F() {
|
|
2162
|
+
let { strictMode: e, separateDialCode: t } = this.#t;
|
|
2163
|
+
!e && !t || this.#e.telInputEl.addEventListener("keydown", this.#I, { signal: this.#f.signal });
|
|
2164
|
+
}
|
|
2165
|
+
#I = (e) => {
|
|
2166
|
+
let { strictMode: t, separateDialCode: n, allowDropdown: r, countrySearch: i } = this.#t;
|
|
2167
|
+
if (!e.key || e.key.length !== 1 || e.altKey || e.ctrlKey || e.metaKey) return;
|
|
2168
|
+
if (n && r && i && e.key === "+") {
|
|
2169
|
+
e.preventDefault(), this.#E();
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
if (!t) return;
|
|
2173
|
+
let a = this.#_(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#p.normalise(e.key), c = /^[0-9]$/.test(s), l = n ? c : o || c, u = this.#e.telInputEl, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + s + m, _ = this.#ee(h), v = !1;
|
|
2174
|
+
Q.utils && this.#l && (v = Q.utils.getCoreNumber(_, this.#c?.iso2).length > this.#l);
|
|
2175
|
+
let y = this.#G(_) !== null;
|
|
2176
|
+
(!l || v && !y && !o) && (this.#B(g.STRICT_REJECT, {
|
|
2177
|
+
source: "key",
|
|
2178
|
+
rejectedInput: e.key,
|
|
2179
|
+
reason: l ? "max-length" : "invalid"
|
|
2180
|
+
}), e.preventDefault());
|
|
2181
|
+
};
|
|
2182
|
+
#L() {
|
|
2183
|
+
this.#t.strictMode && this.#e.telInputEl.addEventListener("paste", this.#R, { signal: this.#f.signal });
|
|
2184
|
+
}
|
|
2185
|
+
#R = (e) => {
|
|
2186
|
+
e.preventDefault();
|
|
2187
|
+
let t = this.#e.telInputEl, n = t.selectionStart, r = t.selectionEnd, i = this.#_(), a = i.slice(0, n ?? void 0), o = i.slice(r ?? void 0), s = this.#c?.iso2, c = e.clipboardData.getData("text"), l = this.#p.normalise(c), u = n === 0 && r > 0, d = !i.startsWith("+") || u, f = l.replace(b.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = a + h + o, v = h === l ? null : "invalid";
|
|
2188
|
+
if (_.length > 5 && Q.utils) {
|
|
2189
|
+
let e = Q.utils.getCoreNumber(_, s);
|
|
2190
|
+
for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, s);
|
|
2191
|
+
if (!e) {
|
|
2192
|
+
this.#B(g.STRICT_REJECT, {
|
|
2193
|
+
source: "paste",
|
|
2194
|
+
rejectedInput: c,
|
|
2195
|
+
reason: "max-length"
|
|
2135
2196
|
});
|
|
2136
2197
|
return;
|
|
2137
2198
|
}
|
|
2138
|
-
this.#
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
let e = q(s, !0, n, this.#c);
|
|
2148
|
-
this.#_(e);
|
|
2149
|
-
}
|
|
2150
|
-
}, { signal: this.#f.signal });
|
|
2151
|
-
}
|
|
2152
|
-
#k() {
|
|
2153
|
-
let { strictMode: e, separateDialCode: t, allowDropdown: n, countrySearch: r } = this.#t;
|
|
2154
|
-
!e && !t || this.#e.telInputEl.addEventListener("keydown", (i) => {
|
|
2155
|
-
if (!i.key || i.key.length !== 1 || i.altKey || i.ctrlKey || i.metaKey) return;
|
|
2156
|
-
if (t && n && r && i.key === "+") {
|
|
2157
|
-
i.preventDefault(), this.#T();
|
|
2199
|
+
if (this.#l && e.length > this.#l) if (t.selectionEnd === i.length) {
|
|
2200
|
+
let t = e.length - this.#l;
|
|
2201
|
+
_ = _.slice(0, _.length - t), v = "max-length";
|
|
2202
|
+
} else {
|
|
2203
|
+
this.#B(g.STRICT_REJECT, {
|
|
2204
|
+
source: "paste",
|
|
2205
|
+
rejectedInput: c,
|
|
2206
|
+
reason: "max-length"
|
|
2207
|
+
});
|
|
2158
2208
|
return;
|
|
2159
2209
|
}
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
}
|
|
2171
|
-
#A() {
|
|
2172
|
-
this.#t.strictMode && this.#e.telInputEl.addEventListener("paste", (e) => {
|
|
2173
|
-
e.preventDefault();
|
|
2174
|
-
let t = this.#e.telInputEl, n = t.selectionStart, r = t.selectionEnd, i = this.#g(), a = i.slice(0, n ?? void 0), o = i.slice(r ?? void 0), s = this.#c?.iso2, c = e.clipboardData.getData("text"), l = this.#p.normalise(c), u = n === 0 && r > 0, d = !i.startsWith("+") || u, f = l.replace(b.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = a + h + o, v = h === l ? null : "invalid";
|
|
2175
|
-
if (_.length > 5 && Q.utils) {
|
|
2176
|
-
let e = Q.utils.getCoreNumber(_, s);
|
|
2177
|
-
for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, s);
|
|
2178
|
-
if (!e) {
|
|
2179
|
-
this.#M(g.STRICT_REJECT, {
|
|
2180
|
-
source: "paste",
|
|
2181
|
-
rejectedInput: c,
|
|
2182
|
-
reason: "max-length"
|
|
2183
|
-
});
|
|
2184
|
-
return;
|
|
2185
|
-
}
|
|
2186
|
-
if (this.#l && e.length > this.#l) if (t.selectionEnd === i.length) {
|
|
2187
|
-
let t = e.length - this.#l;
|
|
2188
|
-
_ = _.slice(0, _.length - t), v = "max-length";
|
|
2189
|
-
} else {
|
|
2190
|
-
this.#M(g.STRICT_REJECT, {
|
|
2191
|
-
source: "paste",
|
|
2192
|
-
rejectedInput: c,
|
|
2193
|
-
reason: "max-length"
|
|
2194
|
-
});
|
|
2195
|
-
return;
|
|
2196
|
-
}
|
|
2197
|
-
}
|
|
2198
|
-
this.#_(_);
|
|
2199
|
-
let y = n + h.length;
|
|
2200
|
-
t.setSelectionRange(y, y), t.dispatchEvent(new InputEvent("input", { bubbles: !0 })), v && this.#M(g.STRICT_REJECT, {
|
|
2201
|
-
source: "paste",
|
|
2202
|
-
rejectedInput: c,
|
|
2203
|
-
reason: v
|
|
2204
|
-
});
|
|
2205
|
-
}, { signal: this.#f.signal });
|
|
2206
|
-
}
|
|
2207
|
-
#j(e) {
|
|
2210
|
+
}
|
|
2211
|
+
this.#v(_);
|
|
2212
|
+
let y = n + h.length;
|
|
2213
|
+
t.setSelectionRange(y, y), t.dispatchEvent(new InputEvent("input", { bubbles: !0 })), v && this.#B(g.STRICT_REJECT, {
|
|
2214
|
+
source: "paste",
|
|
2215
|
+
rejectedInput: c,
|
|
2216
|
+
reason: v
|
|
2217
|
+
});
|
|
2218
|
+
};
|
|
2219
|
+
#z(e) {
|
|
2208
2220
|
let t = Number(this.#e.telInputEl.getAttribute("maxlength"));
|
|
2209
2221
|
return t && e.length > t ? e.substring(0, t) : e;
|
|
2210
2222
|
}
|
|
2211
|
-
#
|
|
2223
|
+
#B(e, t = {}) {
|
|
2212
2224
|
let n = new CustomEvent(e, {
|
|
2213
2225
|
bubbles: !0,
|
|
2214
2226
|
cancelable: !0,
|
|
@@ -2216,42 +2228,42 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2216
2228
|
});
|
|
2217
2229
|
this.#e.telInputEl.dispatchEvent(n);
|
|
2218
2230
|
}
|
|
2219
|
-
#
|
|
2220
|
-
this.#e.openDropdown((e) => this.#
|
|
2231
|
+
#V() {
|
|
2232
|
+
this.#e.openDropdown((e) => this.#X(e), () => this.#Z()), this.#B(g.OPEN_COUNTRY_DROPDOWN);
|
|
2221
2233
|
}
|
|
2222
|
-
#
|
|
2234
|
+
#H(e) {
|
|
2223
2235
|
let { formatOnDisplay: t, nationalMode: n, separateDialCode: r } = this.#t, i = e;
|
|
2224
2236
|
if (t && Q.utils && this.#c) {
|
|
2225
|
-
let t =
|
|
2237
|
+
let t = q(e), a = n && !t || !i.startsWith("+") && !r, { NATIONAL: o, INTERNATIONAL: s } = Q.utils.numberFormat, c = a ? o : s;
|
|
2226
2238
|
i = Q.utils.formatNumber(i, this.#c?.iso2, c);
|
|
2227
2239
|
}
|
|
2228
|
-
i = this.#
|
|
2240
|
+
i = this.#ne(i), this.#v(i);
|
|
2229
2241
|
}
|
|
2230
|
-
#
|
|
2231
|
-
let t = this.#
|
|
2232
|
-
return t === null ? !1 : this.#
|
|
2242
|
+
#U(e) {
|
|
2243
|
+
let t = this.#G(e);
|
|
2244
|
+
return t === null ? !1 : this.#q(t);
|
|
2233
2245
|
}
|
|
2234
|
-
#
|
|
2246
|
+
#W(e) {
|
|
2235
2247
|
let t = this.#c?.dialCode, n = this.#c?.nationalPrefix;
|
|
2236
2248
|
return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
|
|
2237
2249
|
}
|
|
2238
|
-
#
|
|
2250
|
+
#G(e) {
|
|
2239
2251
|
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#c?.iso2;
|
|
2240
|
-
n = this.#
|
|
2241
|
-
let i = this
|
|
2252
|
+
n = this.#W(n);
|
|
2253
|
+
let i = this.#$(n, !0), a = V(n);
|
|
2242
2254
|
if (i) {
|
|
2243
|
-
let e =
|
|
2244
|
-
return t.length === 1 ? t[0] === r ? null : t[0] : this.#
|
|
2255
|
+
let e = V(i), t = this.#a[e];
|
|
2256
|
+
return t.length === 1 ? t[0] === r ? null : t[0] : this.#K(t, e, a);
|
|
2245
2257
|
} else if (n.startsWith("+") && a.length) {
|
|
2246
2258
|
let e = this.#c?.dialCode || "";
|
|
2247
2259
|
return e && e.startsWith(a) ? null : "";
|
|
2248
2260
|
} else if ((!n || n === "+") && !r && this.#u) return this.#u;
|
|
2249
2261
|
return null;
|
|
2250
2262
|
}
|
|
2251
|
-
#
|
|
2263
|
+
#K(e, t, n) {
|
|
2252
2264
|
let r = this.#c?.iso2, i = this.#c?.dialCode;
|
|
2253
2265
|
if (!r && this.#u && e.includes(this.#u)) return this.#u;
|
|
2254
|
-
if (i === w.NANP &&
|
|
2266
|
+
if (i === w.NANP && Y(n)) return null;
|
|
2255
2267
|
let a = this.#c?.areaCodes, o = this.#c?.priority;
|
|
2256
2268
|
if (a) {
|
|
2257
2269
|
let e = a.map((e) => `${i}${e}`);
|
|
@@ -2260,11 +2272,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2260
2272
|
let s = a && o !== 0 && n.length > t.length, c = r && e.includes(r) && !s, l = r === e[0];
|
|
2261
2273
|
return !c && !l ? e[0] : null;
|
|
2262
2274
|
}
|
|
2263
|
-
#
|
|
2275
|
+
#q(e) {
|
|
2264
2276
|
let t = this.#c?.iso2 || "";
|
|
2265
|
-
return this.#c = e ? this.#s.get(e) : null, this.#c && (this.#u = this.#c.iso2), this.#e.setCountry(this.#c), this.#
|
|
2277
|
+
return this.#c = e ? this.#s.get(e) : null, this.#c && (this.#u = this.#c.iso2), this.#e.setCountry(this.#c), this.#Y(), this.#J(), t !== e;
|
|
2266
2278
|
}
|
|
2267
|
-
#
|
|
2279
|
+
#J() {
|
|
2268
2280
|
let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
|
|
2269
2281
|
if (!e || !Q.utils) return;
|
|
2270
2282
|
let r = this.#c?.iso2;
|
|
@@ -2277,33 +2289,33 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2277
2289
|
let s = Q.utils.getCoreNumber(o, r);
|
|
2278
2290
|
this.#l = s.length, r === "by" && (this.#l = s.length + 1);
|
|
2279
2291
|
}
|
|
2280
|
-
#
|
|
2292
|
+
#Y() {
|
|
2281
2293
|
let { autoPlaceholder: e, placeholderNumberType: t, nationalMode: n, customPlaceholder: r } = this.#t, i = e === D.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === D.POLITE;
|
|
2282
2294
|
if (!Q.utils || !i) return;
|
|
2283
2295
|
let a = Q.utils.numberType[t], o = this.#c ? Q.utils.getExampleNumber(this.#c.iso2, n, a) : "";
|
|
2284
|
-
o = this.#
|
|
2296
|
+
o = this.#ne(o), typeof r == "function" && (o = r(o, this.#c)), this.#e.telInputEl.setAttribute("placeholder", o);
|
|
2285
2297
|
}
|
|
2286
|
-
#
|
|
2298
|
+
#X(e) {
|
|
2287
2299
|
if (!e) return;
|
|
2288
|
-
let t = e.dataset[A.ISO2], n = this.#
|
|
2289
|
-
this.#
|
|
2300
|
+
let t = e.dataset[A.ISO2], n = this.#q(t);
|
|
2301
|
+
this.#Z();
|
|
2290
2302
|
let r = e.dataset[A.DIAL_CODE];
|
|
2291
|
-
if (this.#
|
|
2292
|
-
let e = this.#
|
|
2293
|
-
this.#
|
|
2303
|
+
if (this.#Q(r), this.#t.formatOnDisplay) {
|
|
2304
|
+
let e = this.#_();
|
|
2305
|
+
this.#H(e);
|
|
2294
2306
|
}
|
|
2295
|
-
this.#e.telInputEl.focus(), n && (this.#
|
|
2307
|
+
this.#e.telInputEl.focus(), n && (this.#ie(), this.#B(g.INPUT, { isCountryChange: !0 }));
|
|
2296
2308
|
}
|
|
2297
|
-
#
|
|
2298
|
-
!this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#
|
|
2309
|
+
#Z(e) {
|
|
2310
|
+
!this.#e.isDropdownOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#B(g.CLOSE_COUNTRY_DROPDOWN));
|
|
2299
2311
|
}
|
|
2300
|
-
#
|
|
2301
|
-
let t = this.#
|
|
2312
|
+
#Q(e) {
|
|
2313
|
+
let t = this.#_();
|
|
2302
2314
|
if (!t.startsWith("+")) return;
|
|
2303
|
-
let n = `+${e}`, r = this
|
|
2304
|
-
i = r ? t.replace(r, n) : n, this.#
|
|
2315
|
+
let n = `+${e}`, r = this.#$(t), i;
|
|
2316
|
+
i = r ? t.replace(r, n) : n, this.#v(i);
|
|
2305
2317
|
}
|
|
2306
|
-
|
|
2318
|
+
#$(e, t) {
|
|
2307
2319
|
if (!e.startsWith("+")) return "";
|
|
2308
2320
|
let n = "", r = "", i = !1;
|
|
2309
2321
|
for (let a = 0; a < e.length; a++) {
|
|
@@ -2318,19 +2330,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2318
2330
|
}
|
|
2319
2331
|
return n;
|
|
2320
2332
|
}
|
|
2321
|
-
#
|
|
2322
|
-
let t = this.#c?.dialCode, n =
|
|
2333
|
+
#ee(e) {
|
|
2334
|
+
let t = this.#c?.dialCode, n = V(e);
|
|
2323
2335
|
return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
|
|
2324
2336
|
}
|
|
2325
|
-
#
|
|
2326
|
-
let e = this.#
|
|
2327
|
-
return this.#
|
|
2337
|
+
#te() {
|
|
2338
|
+
let e = this.#_();
|
|
2339
|
+
return this.#ee(e);
|
|
2328
2340
|
}
|
|
2329
|
-
#
|
|
2330
|
-
let t =
|
|
2331
|
-
return this.#
|
|
2341
|
+
#ne(e) {
|
|
2342
|
+
let t = J(e, !!this.#$(e), this.#t.separateDialCode, this.#c);
|
|
2343
|
+
return this.#z(t);
|
|
2332
2344
|
}
|
|
2333
|
-
#
|
|
2345
|
+
#re() {
|
|
2334
2346
|
let e = this.#c;
|
|
2335
2347
|
if (!e) return null;
|
|
2336
2348
|
let { iso2: t, dialCode: n, name: r } = e;
|
|
@@ -2340,91 +2352,91 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2340
2352
|
name: r
|
|
2341
2353
|
};
|
|
2342
2354
|
}
|
|
2343
|
-
#
|
|
2344
|
-
let e = this.#
|
|
2345
|
-
this.#
|
|
2355
|
+
#ie() {
|
|
2356
|
+
let e = this.#re();
|
|
2357
|
+
this.#B(g.COUNTRY_CHANGE, e);
|
|
2346
2358
|
}
|
|
2347
|
-
#
|
|
2348
|
-
if (!(!this.#
|
|
2359
|
+
#ae() {
|
|
2360
|
+
if (!(!this.#h || !Q.autoCountry)) {
|
|
2349
2361
|
if (!this.#d) {
|
|
2350
|
-
this.#
|
|
2362
|
+
this.#h.resolve();
|
|
2351
2363
|
return;
|
|
2352
2364
|
}
|
|
2353
|
-
this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#u = Q.autoCountry, this.#e.setLoading(!1), this.#
|
|
2365
|
+
this.#e.isLoading() ? this.setCountry(Q.autoCountry) : this.#u = Q.autoCountry, this.#e.setLoading(!1), this.#h.resolve();
|
|
2354
2366
|
}
|
|
2355
2367
|
}
|
|
2356
|
-
#
|
|
2368
|
+
#oe() {
|
|
2357
2369
|
if (!this.#d) {
|
|
2358
|
-
this.#
|
|
2370
|
+
this.#h?.reject();
|
|
2359
2371
|
return;
|
|
2360
2372
|
}
|
|
2361
|
-
this.#
|
|
2373
|
+
this.#S(!0), this.#e.setLoading(!1), this.#h?.reject();
|
|
2362
2374
|
}
|
|
2363
|
-
|
|
2375
|
+
#se() {
|
|
2364
2376
|
if (!this.#d) {
|
|
2365
|
-
this.#
|
|
2377
|
+
this.#g?.resolve();
|
|
2366
2378
|
return;
|
|
2367
2379
|
}
|
|
2368
2380
|
if (!Q.utils) {
|
|
2369
|
-
this.#
|
|
2381
|
+
this.#g?.resolve();
|
|
2370
2382
|
return;
|
|
2371
2383
|
}
|
|
2372
|
-
let e = this.#
|
|
2373
|
-
e && this.#
|
|
2384
|
+
let e = this.#_();
|
|
2385
|
+
e && this.#H(e), this.#c && (this.#Y(), this.#J()), this.#g?.resolve();
|
|
2374
2386
|
}
|
|
2375
|
-
#
|
|
2387
|
+
#ce(e) {
|
|
2376
2388
|
if (!this.#d) {
|
|
2377
|
-
this.#
|
|
2389
|
+
this.#g?.reject(e);
|
|
2378
2390
|
return;
|
|
2379
2391
|
}
|
|
2380
|
-
this.#
|
|
2392
|
+
this.#g?.reject(e);
|
|
2381
2393
|
}
|
|
2382
2394
|
destroy() {
|
|
2383
|
-
this.#d && (this.#d = !1, this.#t.allowDropdown && this.#
|
|
2395
|
+
this.#d && (this.#d = !1, this.#t.allowDropdown && this.#Z(!0), this.#f.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
|
|
2384
2396
|
}
|
|
2385
2397
|
isActive() {
|
|
2386
2398
|
return this.#d;
|
|
2387
2399
|
}
|
|
2388
2400
|
getExtension() {
|
|
2389
|
-
return this.#d ? (
|
|
2401
|
+
return this.#d ? (X("getExtension"), Q.utils.getExtension(this.#te(), this.#c?.iso2)) : "";
|
|
2390
2402
|
}
|
|
2391
2403
|
getNumber(e) {
|
|
2392
2404
|
if (!this.#d) return "";
|
|
2393
|
-
|
|
2394
|
-
let t = this.#c?.iso2, n = this.#
|
|
2405
|
+
X("getNumber");
|
|
2406
|
+
let t = this.#c?.iso2, n = this.#te(), r = Q.utils.formatNumber(n, t, e);
|
|
2395
2407
|
return this.#p.denormalise(r);
|
|
2396
2408
|
}
|
|
2397
2409
|
getNumberType() {
|
|
2398
|
-
return this.#d ? (
|
|
2410
|
+
return this.#d ? (X("getNumberType"), Q.utils.getNumberType(this.#te(), this.#c?.iso2)) : S.UNKNOWN_NUMBER_TYPE;
|
|
2399
2411
|
}
|
|
2400
2412
|
getSelectedCountryData() {
|
|
2401
|
-
return this.#
|
|
2413
|
+
return this.#re();
|
|
2402
2414
|
}
|
|
2403
2415
|
getValidationError() {
|
|
2404
2416
|
if (!this.#d) return S.UNKNOWN_VALIDATION_ERROR;
|
|
2405
|
-
|
|
2417
|
+
X("getValidationError");
|
|
2406
2418
|
let e = this.#c?.iso2;
|
|
2407
|
-
return Q.utils.getValidationError(this.#
|
|
2419
|
+
return Q.utils.getValidationError(this.#te(), e);
|
|
2408
2420
|
}
|
|
2409
2421
|
isValidNumber() {
|
|
2410
2422
|
if (!this.#d) return null;
|
|
2411
|
-
|
|
2412
|
-
let e = this.#c?.dialCode, t = this.#c?.iso2, n = this.#
|
|
2423
|
+
X("isValidNumber");
|
|
2424
|
+
let e = this.#c?.dialCode, t = this.#c?.iso2, n = this.#te(), r = Q.utils.getCoreNumber(n, t);
|
|
2413
2425
|
if (r) {
|
|
2414
2426
|
if (e === T.DIAL_CODE && r[0] === T.MOBILE_PREFIX && r.length !== T.MOBILE_CORE_LENGTH) return !1;
|
|
2415
2427
|
if (!b.ALPHA_UNICODE.test(n) && e) {
|
|
2416
|
-
let t =
|
|
2428
|
+
let t = V(n.startsWith("+") ? n.slice(1 + e.length) : n).length;
|
|
2417
2429
|
if (r.length > t) return !1;
|
|
2418
2430
|
}
|
|
2419
2431
|
}
|
|
2420
|
-
return this.#
|
|
2432
|
+
return this.#le("possible");
|
|
2421
2433
|
}
|
|
2422
2434
|
isValidNumberPrecise() {
|
|
2423
|
-
return this.#d ? (
|
|
2435
|
+
return this.#d ? (X("isValidNumberPrecise"), this.#le("precise")) : null;
|
|
2424
2436
|
}
|
|
2425
|
-
#
|
|
2426
|
-
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#c?.iso2, a = this.#
|
|
2427
|
-
return !this.#c && !
|
|
2437
|
+
#le(e) {
|
|
2438
|
+
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#c?.iso2, a = this.#te();
|
|
2439
|
+
return !this.#c && !q(a) || !(e === "precise" ? Q.utils.isValidNumber : Q.utils.isPossibleNumber)(a, i, r) ? !1 : b.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
|
|
2428
2440
|
}
|
|
2429
2441
|
setCountry(e) {
|
|
2430
2442
|
if (!this.#d) return;
|
|
@@ -2432,20 +2444,20 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2432
2444
|
if (!m(t)) throw Error(`Invalid iso2 code: '${t}'`);
|
|
2433
2445
|
let n = this.#c?.iso2;
|
|
2434
2446
|
if (e && t !== n || !e && n) {
|
|
2435
|
-
if (this.#
|
|
2436
|
-
let e = this.#
|
|
2437
|
-
this.#
|
|
2447
|
+
if (this.#q(t), this.#Q(this.#c?.dialCode || ""), this.#t.formatOnDisplay) {
|
|
2448
|
+
let e = this.#_();
|
|
2449
|
+
this.#H(e);
|
|
2438
2450
|
}
|
|
2439
|
-
this.#
|
|
2451
|
+
this.#ie(), this.#B(g.INPUT, { isCountryChange: !0 });
|
|
2440
2452
|
}
|
|
2441
2453
|
}
|
|
2442
2454
|
setNumber(e) {
|
|
2443
2455
|
if (!this.#d) return;
|
|
2444
|
-
let t = this.#p.normalise(e), n = this.#
|
|
2445
|
-
this.#
|
|
2456
|
+
let t = this.#p.normalise(e), n = this.#U(t);
|
|
2457
|
+
this.#H(t), n && this.#ie(), this.#B(g.INPUT, { isSetNumber: !0 });
|
|
2446
2458
|
}
|
|
2447
2459
|
setPlaceholderNumberType(e) {
|
|
2448
|
-
this.#d && (this.#t.placeholderNumberType = e, this.#
|
|
2460
|
+
this.#d && (this.#t.placeholderNumberType = e, this.#Y());
|
|
2449
2461
|
}
|
|
2450
2462
|
setDisabled(e) {
|
|
2451
2463
|
this.#d && this.#e.setDisabled(e);
|
|
@@ -2458,16 +2470,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2458
2470
|
r.forEach((n) => {
|
|
2459
2471
|
if (n instanceof e) switch (t) {
|
|
2460
2472
|
case "handleUtilsLoaded":
|
|
2461
|
-
n
|
|
2473
|
+
n.#se();
|
|
2462
2474
|
break;
|
|
2463
2475
|
case "handleUtilsFailure":
|
|
2464
|
-
n.#
|
|
2476
|
+
n.#ce(i);
|
|
2465
2477
|
break;
|
|
2466
2478
|
case "handleAutoCountryLoaded":
|
|
2467
|
-
n.#
|
|
2479
|
+
n.#ae();
|
|
2468
2480
|
break;
|
|
2469
2481
|
case "handleAutoCountryFailure":
|
|
2470
|
-
n.#
|
|
2482
|
+
n.#oe();
|
|
2471
2483
|
break;
|
|
2472
2484
|
}
|
|
2473
2485
|
});
|
|
@@ -2476,7 +2488,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2476
2488
|
let n = new Z(e, t);
|
|
2477
2489
|
return Q.instances.set(String(n.id), n), e.iti = n, n;
|
|
2478
2490
|
}, {
|
|
2479
|
-
defaults:
|
|
2491
|
+
defaults: F,
|
|
2480
2492
|
documentReady: () => document.readyState === "complete",
|
|
2481
2493
|
getCountryData: () => h,
|
|
2482
2494
|
getInstance: (e) => {
|
|
@@ -2505,7 +2517,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2505
2517
|
},
|
|
2506
2518
|
startedLoadingUtils: !1,
|
|
2507
2519
|
startedLoadingAutoCountry: !1,
|
|
2508
|
-
version: "27.
|
|
2520
|
+
version: "27.2.0"
|
|
2509
2521
|
}), $ = Q, Ce = /* @__PURE__ */ n({
|
|
2510
2522
|
inheritAttrs: !1,
|
|
2511
2523
|
__name: "IntlTelInput",
|
|
@@ -2560,6 +2572,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2560
2572
|
"changeCountry",
|
|
2561
2573
|
"changeValidity",
|
|
2562
2574
|
"changeErrorCode",
|
|
2575
|
+
"openCountryDropdown",
|
|
2576
|
+
"closeCountryDropdown",
|
|
2577
|
+
"strictReject",
|
|
2563
2578
|
"update:modelValue"
|
|
2564
2579
|
],
|
|
2565
2580
|
setup(n, { expose: d, emit: f }) {
|
|
@@ -2583,36 +2598,50 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2583
2598
|
let r = p[e];
|
|
2584
2599
|
r !== void 0 && (n[e] = r);
|
|
2585
2600
|
}), n;
|
|
2586
|
-
}), S = c(null), C = l(null), w = c(), T = c(), E = c(), D = c(), O = () => (p.usePreciseValidation ? C.value.isValidNumberPrecise() : C.value.isValidNumber()) ?? !1,
|
|
2587
|
-
|
|
2601
|
+
}), S = c(null), C = l(null), w = c(), T = c(), E = c(), D = c(), O = !1, k = () => (p.usePreciseValidation ? C.value.isValidNumberPrecise() : C.value.isValidNumber()) ?? !1, A = () => {
|
|
2602
|
+
if (!C.value?.isActive()) return;
|
|
2603
|
+
if (!$.utils) {
|
|
2604
|
+
O = !0;
|
|
2605
|
+
return;
|
|
2606
|
+
}
|
|
2607
|
+
let e = k(), t = e ? null : C.value.getValidationError();
|
|
2588
2608
|
e !== E.value && (E.value = e, m("changeValidity", e)), t !== D.value && (D.value = t, m("changeErrorCode", t));
|
|
2589
|
-
},
|
|
2609
|
+
}, j = () => {
|
|
2590
2610
|
if (!C.value?.isActive()) return;
|
|
2611
|
+
if (!$.utils) {
|
|
2612
|
+
O = !0;
|
|
2613
|
+
return;
|
|
2614
|
+
}
|
|
2591
2615
|
let e = C.value.getNumber() ?? "";
|
|
2592
|
-
e !== w.value && (w.value = e, m("changeNumber", e), m("update:modelValue", e)),
|
|
2593
|
-
},
|
|
2616
|
+
e !== w.value && (w.value = e, m("changeNumber", e), m("update:modelValue", e)), A();
|
|
2617
|
+
}, M = () => {
|
|
2594
2618
|
if (!C.value?.isActive()) return;
|
|
2595
2619
|
let e = C.value.getSelectedCountryData()?.iso2 ?? "";
|
|
2596
|
-
e !== T.value && (T.value = e, m("changeCountry", e)),
|
|
2620
|
+
e !== T.value && (T.value = e, m("changeCountry", e)), j();
|
|
2621
|
+
}, N = () => m("openCountryDropdown"), P = () => m("closeCountryDropdown"), F = (e) => {
|
|
2622
|
+
let { source: t, rejectedInput: n, reason: r } = e.detail;
|
|
2623
|
+
m("strictReject", t, n, r);
|
|
2597
2624
|
};
|
|
2598
2625
|
return a(() => {
|
|
2599
|
-
S.value && (C.value = $(S.value, x.value), p.disabled && C.value.setDisabled(p.disabled), p.readonly && C.value.setReadonly(p.readonly), T.value = C.value.getSelectedCountryData()?.iso2 ?? "", C.value.promise.then(() => {
|
|
2600
|
-
C.value?.isActive() && (v.value && C.value.setNumber(v.value), w.value = C.value.getNumber() ?? "", E.value =
|
|
2626
|
+
S.value && (C.value = $(S.value, x.value), S.value.addEventListener("open:countrydropdown", N), S.value.addEventListener("close:countrydropdown", P), S.value.addEventListener("strict:reject", F), p.disabled && C.value.setDisabled(p.disabled), p.readonly && C.value.setReadonly(p.readonly), T.value = C.value.getSelectedCountryData()?.iso2 ?? "", C.value.promise.then(() => {
|
|
2627
|
+
C.value?.isActive() && (v.value && C.value.setNumber(v.value), O ? (O = !1, M()) : (w.value = C.value.getNumber() ?? "", E.value = k(), D.value = E.value ? null : C.value.getValidationError()));
|
|
2601
2628
|
}));
|
|
2602
2629
|
}), u(() => p.disabled, (e) => C.value?.setDisabled(e)), u(() => p.readonly, (e) => C.value?.setReadonly(e)), u(() => v.value, (e) => {
|
|
2603
2630
|
C.value && C.value.promise.then(() => {
|
|
2604
2631
|
if (!C.value?.isActive()) return;
|
|
2605
2632
|
let t = e ?? "", n = C.value.getNumber() ?? "";
|
|
2606
|
-
document.activeElement === S.value || n === t || (C.value.setNumber(t),
|
|
2633
|
+
document.activeElement === S.value || n === t || (C.value.setNumber(t), A());
|
|
2607
2634
|
});
|
|
2608
|
-
}, { flush: "post" }), o(() =>
|
|
2635
|
+
}, { flush: "post" }), o(() => {
|
|
2636
|
+
S.value && (S.value.removeEventListener("open:countrydropdown", N), S.value.removeEventListener("close:countrydropdown", P), S.value.removeEventListener("strict:reject", F)), C.value?.destroy();
|
|
2637
|
+
}), d({
|
|
2609
2638
|
instance: C,
|
|
2610
2639
|
input: S
|
|
2611
2640
|
}), (e, n) => (s(), t("input", i(_.value, {
|
|
2612
2641
|
ref_key: "input",
|
|
2613
2642
|
ref: S,
|
|
2614
2643
|
type: "tel",
|
|
2615
|
-
onInput:
|
|
2644
|
+
onInput: M
|
|
2616
2645
|
}), null, 16));
|
|
2617
2646
|
}
|
|
2618
2647
|
});
|