intl-tel-input 27.0.0 → 27.0.2
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 +2 -1
- package/angular/dist/IntlTelInput.js +484 -367
- package/angular/dist/IntlTelInputWithUtils.js +484 -367
- package/dist/js/data.d.ts +1 -1
- package/dist/js/data.js +58 -2
- package/dist/js/data.min.js +1 -1
- package/dist/js/data.mjs +57 -1
- package/dist/js/i18n.d.ts +1 -1
- package/dist/js/intlTelInput.d.ts +1 -1
- package/dist/js/intlTelInput.js +485 -368
- package/dist/js/intlTelInput.min.js +3 -3
- package/dist/js/intlTelInput.mjs +484 -367
- package/dist/js/intlTelInputWithUtils.js +485 -368
- package/dist/js/intlTelInputWithUtils.min.js +3 -3
- package/dist/js/intlTelInputWithUtils.mjs +484 -367
- package/dist/js/utils.d.ts +6 -0
- package/package.json +2 -2
- package/react/dist/IntlTelInput.js +484 -367
- package/react/dist/IntlTelInputWithUtils.js +484 -367
- package/vue/dist/{IntlTelInput-D7r449B2.js → IntlTelInput-D7BKnLyx.js} +289 -286
- package/vue/dist/IntlTelInput.js +1 -1
- package/vue/dist/IntlTelInputWithUtils.js +1 -1
|
@@ -1270,7 +1270,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1270
1270
|
HIDDEN: "aria-hidden",
|
|
1271
1271
|
AUTOCOMPLETE: "aria-autocomplete",
|
|
1272
1272
|
MODAL: "aria-modal"
|
|
1273
|
-
},
|
|
1273
|
+
}, ee = {
|
|
1274
1274
|
selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
|
|
1275
1275
|
noCountrySelected: "Select country for phone number",
|
|
1276
1276
|
countryListAriaLabel: "List of countries",
|
|
@@ -1280,7 +1280,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1280
1280
|
searchSummaryAria(e) {
|
|
1281
1281
|
return e === 0 ? "No results found" : e === 1 ? "1 result found" : `${e} results found`;
|
|
1282
1282
|
}
|
|
1283
|
-
},
|
|
1283
|
+
}, M = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, N = () => M(`(max-width: ${C.NARROW_VIEWPORT_WIDTH}px)`), P = {
|
|
1284
1284
|
allowDropdown: !0,
|
|
1285
1285
|
allowedNumberTypes: ["MOBILE", "FIXED_LINE"],
|
|
1286
1286
|
allowNumberExtensions: !1,
|
|
@@ -1311,35 +1311,35 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1311
1311
|
strictMode: !1,
|
|
1312
1312
|
useFullscreenPopup: (() => {
|
|
1313
1313
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1314
|
-
let e =
|
|
1315
|
-
return
|
|
1314
|
+
let e = M("(max-height: 600px)"), t = M("(pointer: coarse)");
|
|
1315
|
+
return N() || t && e;
|
|
1316
1316
|
}
|
|
1317
1317
|
return !1;
|
|
1318
1318
|
})()
|
|
1319
|
-
},
|
|
1319
|
+
}, te = (e) => JSON.stringify(e), F = (e) => !!e && typeof e == "object" && !Array.isArray(e), ne = (e) => typeof e == "function", re = (e) => {
|
|
1320
1320
|
if (!e || typeof e != "object") return !1;
|
|
1321
1321
|
let t = e;
|
|
1322
1322
|
return t.nodeType === 1 && typeof t.tagName == "string" && typeof t.appendChild == "function";
|
|
1323
|
-
},
|
|
1323
|
+
}, I = new Set(Object.values(D)), L = (e) => {
|
|
1324
1324
|
console.warn(`[intl-tel-input] ${e}`);
|
|
1325
|
-
},
|
|
1326
|
-
|
|
1327
|
-
},
|
|
1325
|
+
}, R = (e, t, n) => {
|
|
1326
|
+
L(`Option '${e}' must be ${t}; got ${te(n)}. Ignoring.`);
|
|
1327
|
+
}, z = (e, t) => {
|
|
1328
1328
|
let n = "an array of ISO2 country code strings";
|
|
1329
|
-
if (!Array.isArray(t)) return
|
|
1329
|
+
if (!Array.isArray(t)) return R(e, n, t), !1;
|
|
1330
1330
|
let r = [];
|
|
1331
1331
|
for (let i of t) {
|
|
1332
|
-
if (typeof i != "string") return
|
|
1333
|
-
m(i.toLowerCase()) ? r.push(i) :
|
|
1332
|
+
if (typeof i != "string") return R(e, n, t), !1;
|
|
1333
|
+
m(i.toLowerCase()) ? r.push(i) : L(`Invalid country code in '${e}': '${i}'. Skipping.`);
|
|
1334
1334
|
}
|
|
1335
1335
|
return r;
|
|
1336
|
-
},
|
|
1336
|
+
}, ie = (e) => {
|
|
1337
1337
|
if (e === void 0) return {};
|
|
1338
|
-
if (!
|
|
1338
|
+
if (!F(e)) return L(`The second argument must be an options object; got ${te(e)}. Using defaults.`), {};
|
|
1339
1339
|
let t = {};
|
|
1340
1340
|
for (let [n, r] of Object.entries(e)) {
|
|
1341
|
-
if (!
|
|
1342
|
-
|
|
1341
|
+
if (!Object.hasOwn(P, n)) {
|
|
1342
|
+
L(`Unknown option '${n}'. Ignoring.`);
|
|
1343
1343
|
continue;
|
|
1344
1344
|
}
|
|
1345
1345
|
switch (n) {
|
|
@@ -1357,14 +1357,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1357
1357
|
case "strictMode":
|
|
1358
1358
|
case "useFullscreenPopup":
|
|
1359
1359
|
if (typeof r != "boolean") {
|
|
1360
|
-
|
|
1360
|
+
R(n, "a boolean", r);
|
|
1361
1361
|
break;
|
|
1362
1362
|
}
|
|
1363
1363
|
t[n] = r;
|
|
1364
1364
|
break;
|
|
1365
1365
|
case "autoPlaceholder":
|
|
1366
|
-
if (typeof r != "string" || !
|
|
1367
|
-
|
|
1366
|
+
if (typeof r != "string" || !I.has(r)) {
|
|
1367
|
+
R("autoPlaceholder", `one of ${Array.from(I).join(", ")}`, r);
|
|
1368
1368
|
break;
|
|
1369
1369
|
}
|
|
1370
1370
|
t[n] = r;
|
|
@@ -1373,7 +1373,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1373
1373
|
case "searchInputClass":
|
|
1374
1374
|
case "countryNameLocale":
|
|
1375
1375
|
if (typeof r != "string") {
|
|
1376
|
-
|
|
1376
|
+
R(n, "a string", r);
|
|
1377
1377
|
break;
|
|
1378
1378
|
}
|
|
1379
1379
|
t[n] = r;
|
|
@@ -1381,7 +1381,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1381
1381
|
case "countryOrder":
|
|
1382
1382
|
if (r === null) t[n] = r;
|
|
1383
1383
|
else {
|
|
1384
|
-
let e =
|
|
1384
|
+
let e = z(n, r);
|
|
1385
1385
|
e !== !1 && (t[n] = e);
|
|
1386
1386
|
}
|
|
1387
1387
|
break;
|
|
@@ -1389,15 +1389,15 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1389
1389
|
case "geoIpLookup":
|
|
1390
1390
|
case "hiddenInput":
|
|
1391
1391
|
case "loadUtils":
|
|
1392
|
-
if (r !== null && !
|
|
1393
|
-
|
|
1392
|
+
if (r !== null && !ne(r)) {
|
|
1393
|
+
R(n, "a function or null", r);
|
|
1394
1394
|
break;
|
|
1395
1395
|
}
|
|
1396
1396
|
t[n] = r;
|
|
1397
1397
|
break;
|
|
1398
1398
|
case "dropdownContainer":
|
|
1399
|
-
if (r !== null && !
|
|
1400
|
-
|
|
1399
|
+
if (r !== null && !re(r)) {
|
|
1400
|
+
R("dropdownContainer", "an HTMLElement or null", r);
|
|
1401
1401
|
break;
|
|
1402
1402
|
}
|
|
1403
1403
|
t[n] = r;
|
|
@@ -1406,25 +1406,25 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1406
1406
|
case "onlyCountries":
|
|
1407
1407
|
if (r === null) t[n] = r;
|
|
1408
1408
|
else {
|
|
1409
|
-
let e =
|
|
1409
|
+
let e = z(n, r);
|
|
1410
1410
|
e !== !1 && (t[n] = e);
|
|
1411
1411
|
}
|
|
1412
1412
|
break;
|
|
1413
1413
|
case "i18n":
|
|
1414
|
-
if (r && !
|
|
1415
|
-
|
|
1414
|
+
if (r && !F(r)) {
|
|
1415
|
+
R("i18n", "an object", r);
|
|
1416
1416
|
break;
|
|
1417
1417
|
}
|
|
1418
1418
|
t[n] = r;
|
|
1419
1419
|
break;
|
|
1420
1420
|
case "initialCountry": {
|
|
1421
1421
|
if (typeof r != "string") {
|
|
1422
|
-
|
|
1422
|
+
R("initialCountry", "a string", r);
|
|
1423
1423
|
break;
|
|
1424
1424
|
}
|
|
1425
1425
|
let e = r.toLowerCase();
|
|
1426
1426
|
if (e && e !== O.AUTO && !m(e)) {
|
|
1427
|
-
|
|
1427
|
+
R("initialCountry", "a valid ISO2 country code or 'auto'", r);
|
|
1428
1428
|
break;
|
|
1429
1429
|
}
|
|
1430
1430
|
t[n] = r;
|
|
@@ -1432,7 +1432,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
case "placeholderNumberType":
|
|
1434
1434
|
if (typeof r != "string" || !k.has(r)) {
|
|
1435
|
-
|
|
1435
|
+
R("placeholderNumberType", `one of ${Array.from(k).join(", ")}`, r);
|
|
1436
1436
|
break;
|
|
1437
1437
|
}
|
|
1438
1438
|
t[n] = r;
|
|
@@ -1440,12 +1440,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1440
1440
|
case "allowedNumberTypes":
|
|
1441
1441
|
if (r !== null) {
|
|
1442
1442
|
if (!Array.isArray(r)) {
|
|
1443
|
-
|
|
1443
|
+
R("allowedNumberTypes", "an array of number types or null", r);
|
|
1444
1444
|
break;
|
|
1445
1445
|
}
|
|
1446
1446
|
let e = !0;
|
|
1447
1447
|
for (let t of r) if (typeof t != "string" || !k.has(t)) {
|
|
1448
|
-
|
|
1448
|
+
R("allowedNumberTypes", `an array of valid number types (${Array.from(k).join(", ")})`, t), e = !1;
|
|
1449
1449
|
break;
|
|
1450
1450
|
}
|
|
1451
1451
|
e && (t[n] = r);
|
|
@@ -1454,15 +1454,15 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1454
1454
|
}
|
|
1455
1455
|
}
|
|
1456
1456
|
return t;
|
|
1457
|
-
}, ie = (e) => {
|
|
1458
|
-
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());
|
|
1459
1457
|
}, ae = (e) => {
|
|
1460
|
-
e.
|
|
1461
|
-
|
|
1458
|
+
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());
|
|
1459
|
+
}, oe = (e) => {
|
|
1460
|
+
e.dropdownAlwaysOpen && (e.useFullscreenPopup = !1, e.allowDropdown = !0), e.useFullscreenPopup ? e.fixDropdownWidth = !1 : N() && (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 = {
|
|
1461
|
+
...ee,
|
|
1462
1462
|
...e.i18n
|
|
1463
1463
|
};
|
|
1464
|
-
},
|
|
1465
|
-
let n =
|
|
1464
|
+
}, B = (e) => e.replace(/\D/g, ""), V = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), se = () => typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, ce = (e, t) => {
|
|
1465
|
+
let n = V(t), r = [], i = [], a = [], o = [], s = [], c = [];
|
|
1466
1466
|
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);
|
|
1467
1467
|
let l = (e, t) => e.priority - t.priority;
|
|
1468
1468
|
return [
|
|
@@ -1473,18 +1473,18 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1473
1473
|
...s.sort(l),
|
|
1474
1474
|
...c
|
|
1475
1475
|
];
|
|
1476
|
-
},
|
|
1477
|
-
let n =
|
|
1476
|
+
}, le = (e, t) => {
|
|
1477
|
+
let n = V(t);
|
|
1478
1478
|
for (let t of e) if (t.normalisedName.startsWith(n)) return t;
|
|
1479
1479
|
return null;
|
|
1480
|
-
},
|
|
1480
|
+
}, H = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), U = (e, t, n) => {
|
|
1481
1481
|
let r = document.createElement(e);
|
|
1482
1482
|
return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
|
|
1483
|
-
},
|
|
1483
|
+
}, ue = () => `
|
|
1484
1484
|
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${j.HIDDEN}="true">
|
|
1485
1485
|
<circle cx="11" cy="11" r="7" />
|
|
1486
1486
|
<line x1="21" y1="21" x2="16.65" y2="16.65" />
|
|
1487
|
-
</svg>`,
|
|
1487
|
+
</svg>`, de = (e) => {
|
|
1488
1488
|
let t = `iti-${e}-clear-mask`;
|
|
1489
1489
|
return `
|
|
1490
1490
|
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${j.HIDDEN}="true" focusable="false">
|
|
@@ -1494,10 +1494,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1494
1494
|
</mask>
|
|
1495
1495
|
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
|
|
1496
1496
|
</svg>`;
|
|
1497
|
-
},
|
|
1497
|
+
}, fe = () => `
|
|
1498
1498
|
<svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${j.HIDDEN}="true">
|
|
1499
1499
|
<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"/>
|
|
1500
|
-
</svg>`,
|
|
1500
|
+
</svg>`, W = () => "\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>", G = class e {
|
|
1501
1501
|
#e;
|
|
1502
1502
|
#t;
|
|
1503
1503
|
#n;
|
|
@@ -1513,6 +1513,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1513
1513
|
#f;
|
|
1514
1514
|
#p;
|
|
1515
1515
|
#m = null;
|
|
1516
|
+
#h = null;
|
|
1516
1517
|
telInput;
|
|
1517
1518
|
countryContainer;
|
|
1518
1519
|
selectedCountry;
|
|
@@ -1536,11 +1537,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1536
1537
|
}
|
|
1537
1538
|
generateMarkup(e) {
|
|
1538
1539
|
this.#i = e, this.telInput.classList.add("iti__tel-input"), this.telInput.hasAttribute("type") || this.telInput.setAttribute("type", "tel"), this.telInput.hasAttribute("autocomplete") || this.telInput.setAttribute("autocomplete", "tel"), this.telInput.hasAttribute("inputmode") || this.telInput.setAttribute("inputmode", "tel");
|
|
1539
|
-
let t = this.#
|
|
1540
|
-
this.#
|
|
1540
|
+
let t = this.#g();
|
|
1541
|
+
this.#_(t), t.appendChild(this.telInput), this.#v(), this.#x(), this.#S(t);
|
|
1541
1542
|
}
|
|
1542
|
-
#
|
|
1543
|
-
let { allowDropdown: e, showFlags: t, containerClass: n, useFullscreenPopup: r } = this.#e, i =
|
|
1543
|
+
#g() {
|
|
1544
|
+
let { allowDropdown: e, showFlags: t, containerClass: n, useFullscreenPopup: r } = this.#e, i = U("div", { class: H({
|
|
1544
1545
|
iti: !0,
|
|
1545
1546
|
"iti--allow-dropdown": e,
|
|
1546
1547
|
"iti--show-flags": t,
|
|
@@ -1549,44 +1550,42 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1549
1550
|
}) });
|
|
1550
1551
|
return this.#n && i.setAttribute("dir", "ltr"), this.telInput.before(i), i;
|
|
1551
1552
|
}
|
|
1552
|
-
#
|
|
1553
|
+
#_(e) {
|
|
1553
1554
|
let { allowDropdown: t, separateDialCode: n, showFlags: r } = this.#e;
|
|
1554
|
-
if (t
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
#_() {
|
|
1571
|
-
let { fixDropdownWidth: e } = this.#e;
|
|
1572
|
-
if (e && !this.#l.style.width) {
|
|
1573
|
-
let e = this.telInput.offsetWidth;
|
|
1574
|
-
e > 0 && (this.#l.style.width = `${e}px`);
|
|
1575
|
-
}
|
|
1555
|
+
if (!t && !r && !n) return;
|
|
1556
|
+
this.countryContainer = U("div", { class: `iti__country-container ${_.V_HIDE}` }, e), t ? (this.selectedCountry = U("button", {
|
|
1557
|
+
type: "button",
|
|
1558
|
+
class: "iti__selected-country",
|
|
1559
|
+
[j.EXPANDED]: "false",
|
|
1560
|
+
[j.LABEL]: this.#e.i18n.noCountrySelected,
|
|
1561
|
+
[j.HASPOPUP]: "dialog",
|
|
1562
|
+
[j.CONTROLS]: `iti-${this.#t}__dropdown-content`
|
|
1563
|
+
}, this.countryContainer), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = U("div", { class: "iti__selected-country" }, this.countryContainer);
|
|
1564
|
+
let i = U("div", { class: "iti__selected-country-primary" }, this.selectedCountry);
|
|
1565
|
+
this.selectedCountryInner = U("div", { class: _.FLAG }, i), t && (this.#c = U("div", {
|
|
1566
|
+
class: "iti__arrow",
|
|
1567
|
+
[j.HIDDEN]: "true"
|
|
1568
|
+
}, i)), n && (this.#s = U("div", { class: "iti__selected-dial-code" }, this.selectedCountry)), t && this.#y();
|
|
1576
1569
|
}
|
|
1577
1570
|
#v() {
|
|
1571
|
+
let { fixDropdownWidth: e, allowDropdown: t } = this.#e;
|
|
1572
|
+
if (!t || !e || this.#l.style.width) return;
|
|
1573
|
+
let n = this.telInput.offsetWidth;
|
|
1574
|
+
n > 0 && (this.#l.style.width = `${n}px`);
|
|
1575
|
+
}
|
|
1576
|
+
#y() {
|
|
1578
1577
|
let { fixDropdownWidth: e, useFullscreenPopup: t, countrySearch: n, i18n: r, dropdownContainer: i, containerClass: a } = this.#e, o = e ? "" : "iti--flexible-dropdown-width";
|
|
1579
|
-
this.#l =
|
|
1578
|
+
this.#l = U("div", {
|
|
1580
1579
|
id: `iti-${this.#t}__dropdown-content`,
|
|
1581
1580
|
class: `iti__dropdown-content ${_.HIDE} ${o}`,
|
|
1582
1581
|
role: "dialog",
|
|
1583
1582
|
[j.MODAL]: "true"
|
|
1584
|
-
}), this.#n && this.#l.setAttribute("dir", "rtl"), n && this.#
|
|
1583
|
+
}), this.#n && this.#l.setAttribute("dir", "rtl"), n && this.#b(), this.countryList = U("ul", {
|
|
1585
1584
|
class: "iti__country-list",
|
|
1586
1585
|
id: `iti-${this.#t}__country-listbox`,
|
|
1587
1586
|
role: "listbox",
|
|
1588
1587
|
[j.LABEL]: r.countryListAriaLabel
|
|
1589
|
-
}, this.#l), this.#
|
|
1588
|
+
}, this.#l), this.#C(), n && this.#O(), t || (this.#o = this.#D(), n && (this.#l.style.height = `${this.#o}px`)), i ? (this.#p = U("div", { class: H({
|
|
1590
1589
|
iti: !0,
|
|
1591
1590
|
"iti--container": !0,
|
|
1592
1591
|
"iti--fullscreen-popup": t,
|
|
@@ -1594,12 +1593,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1594
1593
|
[a]: !!a
|
|
1595
1594
|
}) }), this.#p.appendChild(this.#l)) : this.countryContainer.appendChild(this.#l);
|
|
1596
1595
|
}
|
|
1597
|
-
#
|
|
1598
|
-
let { i18n: e, searchInputClass: t } = this.#e, n =
|
|
1599
|
-
this.#u =
|
|
1596
|
+
#b() {
|
|
1597
|
+
let { i18n: e, searchInputClass: t } = this.#e, n = U("div", { class: "iti__search-input-wrapper" }, this.#l);
|
|
1598
|
+
this.#u = U("span", {
|
|
1600
1599
|
class: "iti__search-icon",
|
|
1601
1600
|
[j.HIDDEN]: "true"
|
|
1602
|
-
}, n), this.#u.innerHTML =
|
|
1601
|
+
}, n), this.#u.innerHTML = ue(), this.searchInput = U("input", {
|
|
1603
1602
|
id: `iti-${this.#t}__search-input`,
|
|
1604
1603
|
type: "search",
|
|
1605
1604
|
class: `iti__search-input ${t}`,
|
|
@@ -1610,64 +1609,63 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1610
1609
|
[j.CONTROLS]: `iti-${this.#t}__country-listbox`,
|
|
1611
1610
|
[j.AUTOCOMPLETE]: "list",
|
|
1612
1611
|
autocomplete: "off"
|
|
1613
|
-
}, n), this.searchClearButton =
|
|
1612
|
+
}, n), this.searchClearButton = U("button", {
|
|
1614
1613
|
type: "button",
|
|
1615
1614
|
class: `iti__search-clear ${_.HIDE}`,
|
|
1616
1615
|
[j.LABEL]: e.clearSearchAriaLabel,
|
|
1617
1616
|
tabindex: "-1"
|
|
1618
|
-
}, n), this.searchClearButton.innerHTML =
|
|
1617
|
+
}, n), this.searchClearButton.innerHTML = de(this.#t), this.#f = U("span", { class: "iti__a11y-text" }, this.#l), this.#d = U("div", {
|
|
1619
1618
|
class: `iti__no-results ${_.HIDE}`,
|
|
1620
1619
|
[j.HIDDEN]: "true"
|
|
1621
1620
|
}, this.#l), this.#d.textContent = e.searchEmptyState ?? null;
|
|
1622
1621
|
}
|
|
1623
|
-
#
|
|
1624
|
-
this.countryContainer && (this.#
|
|
1622
|
+
#x() {
|
|
1623
|
+
this.countryContainer && (this.#w(), this.countryContainer.classList.remove(_.V_HIDE));
|
|
1625
1624
|
}
|
|
1626
|
-
#
|
|
1625
|
+
#S(e) {
|
|
1627
1626
|
let { hiddenInput: t } = this.#e;
|
|
1628
|
-
if (t)
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
}
|
|
1627
|
+
if (!t) return;
|
|
1628
|
+
let n = t(this.telInput.getAttribute("name") || "");
|
|
1629
|
+
if (n.phone) {
|
|
1630
|
+
let t = this.telInput.form?.querySelector(`input[name="${n.phone}"]`);
|
|
1631
|
+
t ? this.hiddenInputPhone = t : (this.hiddenInputPhone = U("input", {
|
|
1632
|
+
type: "hidden",
|
|
1633
|
+
name: n.phone
|
|
1634
|
+
}), e.appendChild(this.hiddenInputPhone));
|
|
1635
|
+
}
|
|
1636
|
+
if (n.country) {
|
|
1637
|
+
let t = this.telInput.form?.querySelector(`input[name="${n.country}"]`);
|
|
1638
|
+
t ? this.hiddenInputCountry = t : (this.hiddenInputCountry = U("input", {
|
|
1639
|
+
type: "hidden",
|
|
1640
|
+
name: n.country
|
|
1641
|
+
}), e.appendChild(this.hiddenInputCountry));
|
|
1644
1642
|
}
|
|
1645
1643
|
}
|
|
1646
|
-
#
|
|
1644
|
+
#C() {
|
|
1647
1645
|
let e = document.createDocumentFragment();
|
|
1648
1646
|
for (let t = 0; t < this.#i.length; t++) {
|
|
1649
|
-
let n = this.#i[t], r =
|
|
1647
|
+
let n = this.#i[t], r = H({ [_.COUNTRY_ITEM]: !0 }), i = U("li", {
|
|
1650
1648
|
id: `iti-${this.#t}__item-${n.iso2}`,
|
|
1651
1649
|
class: r,
|
|
1652
1650
|
tabindex: "-1",
|
|
1653
1651
|
role: "option",
|
|
1654
1652
|
[j.SELECTED]: "false"
|
|
1655
1653
|
});
|
|
1656
|
-
i.dataset.dialCode = n.dialCode, i.dataset.countryCode = n.iso2, n.nodeById[this.#t] = i, this.#e.showFlags &&
|
|
1657
|
-
let a =
|
|
1654
|
+
i.dataset.dialCode = n.dialCode, i.dataset.countryCode = n.iso2, n.nodeById[this.#t] = i, this.#e.showFlags && U("div", { class: `${_.FLAG} iti__${n.iso2}` }, i);
|
|
1655
|
+
let a = U("span", { class: "iti__country-name" }, i);
|
|
1658
1656
|
a.textContent = `${n.name} `;
|
|
1659
|
-
let o =
|
|
1657
|
+
let o = U("span", { class: "iti__dial-code" }, a);
|
|
1660
1658
|
this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${n.dialCode})`, e.appendChild(i);
|
|
1661
1659
|
}
|
|
1662
1660
|
this.countryList.appendChild(e);
|
|
1663
1661
|
}
|
|
1664
|
-
#
|
|
1662
|
+
#w() {
|
|
1665
1663
|
if (this.selectedCountry) {
|
|
1666
|
-
let e = this.#e.separateDialCode ? C.SANE_SELECTED_WITH_DIAL_WIDTH : C.SANE_SELECTED_NO_DIAL_WIDTH, t = (this.selectedCountry.offsetWidth || this.#
|
|
1664
|
+
let e = this.#e.separateDialCode ? C.SANE_SELECTED_WITH_DIAL_WIDTH : C.SANE_SELECTED_NO_DIAL_WIDTH, t = (this.selectedCountry.offsetWidth || this.#E() || e) + C.INPUT_PADDING_EXTRA_LEFT;
|
|
1667
1665
|
this.telInput.style.paddingLeft = `${t}px`;
|
|
1668
1666
|
}
|
|
1669
1667
|
}
|
|
1670
|
-
static #
|
|
1668
|
+
static #T() {
|
|
1671
1669
|
let e;
|
|
1672
1670
|
try {
|
|
1673
1671
|
e = window.top.document.body;
|
|
@@ -1676,46 +1674,44 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1676
1674
|
}
|
|
1677
1675
|
return e;
|
|
1678
1676
|
}
|
|
1679
|
-
#T() {
|
|
1680
|
-
if (this.telInput.parentNode) {
|
|
1681
|
-
let t = e.#w(), n = this.telInput.parentNode.cloneNode(!1);
|
|
1682
|
-
n.style.visibility = "hidden", t.appendChild(n);
|
|
1683
|
-
let r = this.countryContainer.cloneNode();
|
|
1684
|
-
n.appendChild(r);
|
|
1685
|
-
let i = this.selectedCountry.cloneNode(!0);
|
|
1686
|
-
r.appendChild(i);
|
|
1687
|
-
let a = i.offsetWidth;
|
|
1688
|
-
return t.removeChild(n), a;
|
|
1689
|
-
}
|
|
1690
|
-
return 0;
|
|
1691
|
-
}
|
|
1692
1677
|
#E() {
|
|
1693
|
-
|
|
1678
|
+
if (!this.telInput.parentNode) return 0;
|
|
1679
|
+
let t = e.#T(), n = this.telInput.parentNode.cloneNode(!1);
|
|
1680
|
+
n.style.visibility = "hidden", t.appendChild(n);
|
|
1681
|
+
let r = this.countryContainer.cloneNode();
|
|
1682
|
+
n.appendChild(r);
|
|
1683
|
+
let i = this.selectedCountry.cloneNode(!0);
|
|
1684
|
+
r.appendChild(i);
|
|
1685
|
+
let a = i.offsetWidth;
|
|
1686
|
+
return t.removeChild(n), a;
|
|
1687
|
+
}
|
|
1688
|
+
#D() {
|
|
1689
|
+
let t = e.#T();
|
|
1694
1690
|
this.#l.classList.remove(_.HIDE);
|
|
1695
|
-
let n =
|
|
1691
|
+
let n = U("div", { class: "iti iti--inline-dropdown" });
|
|
1696
1692
|
n.appendChild(this.#l), n.style.visibility = "hidden", t.appendChild(n);
|
|
1697
1693
|
let r = this.#l.offsetHeight;
|
|
1698
1694
|
return t.removeChild(n), n.style.visibility = "", this.#l.classList.add(_.HIDE), r > 0 ? r : C.SANE_DROPDOWN_HEIGHT;
|
|
1699
1695
|
}
|
|
1700
|
-
#
|
|
1696
|
+
#O() {
|
|
1701
1697
|
let { i18n: e } = this.#e, t = this.countryList.childElementCount;
|
|
1702
1698
|
this.#f.textContent = e.searchSummaryAria(t);
|
|
1703
1699
|
}
|
|
1704
1700
|
filterCountriesByQuery(e) {
|
|
1705
1701
|
let t;
|
|
1706
|
-
t = e === "" ? this.#i :
|
|
1702
|
+
t = e === "" ? this.#i : ce(this.#i, e), this.#j(t);
|
|
1707
1703
|
}
|
|
1708
|
-
#
|
|
1704
|
+
#k() {
|
|
1709
1705
|
let e = this.searchInput.value.trim();
|
|
1710
1706
|
this.filterCountriesByQuery(e), this.searchInput.value ? this.searchClearButton.classList.remove(_.HIDE) : this.searchClearButton.classList.add(_.HIDE);
|
|
1711
1707
|
}
|
|
1712
1708
|
handleSearchChange() {
|
|
1713
1709
|
this.#a && clearTimeout(this.#a), this.#a = setTimeout(() => {
|
|
1714
|
-
this.#
|
|
1710
|
+
this.#k(), this.#a = null;
|
|
1715
1711
|
}, x.SEARCH_DEBOUNCE_MS);
|
|
1716
1712
|
}
|
|
1717
1713
|
handleSearchClear() {
|
|
1718
|
-
this.searchInput.value = "", this.searchInput.focus(), this.#
|
|
1714
|
+
this.searchInput.value = "", this.searchInput.focus(), this.#k();
|
|
1719
1715
|
}
|
|
1720
1716
|
scrollCountryListToItem(e) {
|
|
1721
1717
|
let t = this.countryList, n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), i = r.top - n.top + t.scrollTop;
|
|
@@ -1735,27 +1731,27 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1735
1731
|
let t = e === v.ARROW_UP ? this.highlightedItem?.previousElementSibling : this.highlightedItem?.nextElementSibling;
|
|
1736
1732
|
!t && this.countryList.childElementCount > 1 && (t = e === v.ARROW_UP ? this.countryList.lastElementChild : this.countryList.firstElementChild), t && (this.scrollCountryListToItem(t), this.highlightListItem(t, !1));
|
|
1737
1733
|
}
|
|
1738
|
-
#
|
|
1734
|
+
#A(e) {
|
|
1739
1735
|
if (this.#m && this.#m.dataset.countryCode !== e && (this.#m.setAttribute(j.SELECTED, "false"), this.#m.querySelector(".iti__country-check")?.remove(), this.#m = null), e && !this.#m) {
|
|
1740
1736
|
let t = this.countryList.querySelector(`[data-country-code="${e}"]`);
|
|
1741
1737
|
if (t) {
|
|
1742
1738
|
t.setAttribute(j.SELECTED, "true");
|
|
1743
|
-
let e =
|
|
1739
|
+
let e = U("span", {
|
|
1744
1740
|
class: "iti__country-check",
|
|
1745
1741
|
[j.HIDDEN]: "true"
|
|
1746
1742
|
}, t);
|
|
1747
|
-
e.innerHTML =
|
|
1743
|
+
e.innerHTML = fe(), this.#m = t;
|
|
1748
1744
|
}
|
|
1749
1745
|
}
|
|
1750
1746
|
}
|
|
1751
|
-
#
|
|
1747
|
+
#j(e) {
|
|
1752
1748
|
this.countryList.replaceChildren();
|
|
1753
1749
|
let t = !0;
|
|
1754
1750
|
for (let n of e) {
|
|
1755
1751
|
let e = n.nodeById[this.#t];
|
|
1756
1752
|
e && (this.countryList.appendChild(e), t &&= (this.highlightListItem(e, !1), !1));
|
|
1757
1753
|
}
|
|
1758
|
-
t ? (this.highlightListItem(null, !1), this.#d && this.#d.classList.remove(_.HIDE)) : this.#d && this.#d.classList.add(_.HIDE), this.countryList.scrollTop = 0, this.#
|
|
1754
|
+
t ? (this.highlightListItem(null, !1), this.#d && this.#d.classList.remove(_.HIDE)) : this.#d && this.#d.classList.add(_.HIDE), this.countryList.scrollTop = 0, this.#O();
|
|
1759
1755
|
}
|
|
1760
1756
|
destroy() {
|
|
1761
1757
|
this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.#e.separateDialCode && (this.telInput.style.paddingLeft = this.#r);
|
|
@@ -1765,27 +1761,27 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1765
1761
|
}
|
|
1766
1762
|
openDropdown() {
|
|
1767
1763
|
let { countrySearch: e, dropdownAlwaysOpen: t, dropdownContainer: n } = this.#e;
|
|
1768
|
-
if (this.#
|
|
1764
|
+
if (this.#v(), n) this.#N();
|
|
1769
1765
|
else {
|
|
1770
|
-
let e = this.#
|
|
1766
|
+
let e = this.#M(), t = this.telInput.offsetHeight + C.DROPDOWN_MARGIN;
|
|
1771
1767
|
e ? this.#l.style.top = `${t}px` : this.#l.style.bottom = `${t}px`;
|
|
1772
1768
|
}
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
this.#c.classList.add(_.ARROW_UP);
|
|
1769
|
+
this.#l.classList.remove(_.HIDE), this.selectedCountry.setAttribute(j.EXPANDED, "true");
|
|
1770
|
+
let r = this.#m ?? this.countryList.firstElementChild;
|
|
1771
|
+
r && (this.highlightListItem(r, !1), this.scrollCountryListToItem(r)), e && !t && this.searchInput.focus(), this.#e.useFullscreenPopup && this.#p && window.visualViewport && (this.#h = () => {
|
|
1772
|
+
this.#P(), this.highlightedItem && this.scrollCountryListToItem(this.highlightedItem);
|
|
1773
|
+
}, window.visualViewport.addEventListener("resize", this.#h)), this.#c.classList.add(_.ARROW_UP);
|
|
1778
1774
|
}
|
|
1779
1775
|
closeDropdown() {
|
|
1780
1776
|
let { countrySearch: e, dropdownContainer: t } = this.#e;
|
|
1781
|
-
this.#l.classList.add(_.HIDE), this.selectedCountry.setAttribute(j.EXPANDED, "false"), e && (this.searchInput.removeAttribute(j.ACTIVE_DESCENDANT), this.searchInput.value = "", this.#
|
|
1777
|
+
this.#l.classList.add(_.HIDE), this.selectedCountry.setAttribute(j.EXPANDED, "false"), e && (this.searchInput.removeAttribute(j.ACTIVE_DESCENDANT), this.searchInput.value = "", this.#k(), this.highlightedItem &&= (this.highlightedItem.classList.remove(_.HIGHLIGHT), null)), this.#c.classList.remove(_.ARROW_UP), this.#h && window.visualViewport && (window.visualViewport.removeEventListener("resize", this.#h), this.#h = null), t ? (this.#p.remove(), this.#p.style.top = "", this.#p.style.bottom = "", this.#p.style.paddingLeft = "", this.#p.style.paddingRight = "") : (this.#l.style.top = "", this.#l.style.bottom = "");
|
|
1782
1778
|
}
|
|
1783
|
-
#
|
|
1779
|
+
#M() {
|
|
1784
1780
|
if (this.#e.dropdownAlwaysOpen) return !0;
|
|
1785
1781
|
let e = this.telInput.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom;
|
|
1786
1782
|
return n >= this.#o || n >= t;
|
|
1787
1783
|
}
|
|
1788
|
-
#
|
|
1784
|
+
#N() {
|
|
1789
1785
|
let { dropdownContainer: e, useFullscreenPopup: t } = this.#e;
|
|
1790
1786
|
if (t) {
|
|
1791
1787
|
if (window.innerWidth >= C.NARROW_VIEWPORT_WIDTH) {
|
|
@@ -1794,28 +1790,34 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1794
1790
|
}
|
|
1795
1791
|
} else {
|
|
1796
1792
|
let e = this.telInput.getBoundingClientRect();
|
|
1797
|
-
this.#p.style.left = `${e.left}px`, this.#
|
|
1793
|
+
this.#p.style.left = `${e.left}px`, this.#M() ? this.#p.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#p.style.top = "unset", this.#p.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
|
|
1798
1794
|
}
|
|
1799
1795
|
e.appendChild(this.#p);
|
|
1800
1796
|
}
|
|
1797
|
+
#P() {
|
|
1798
|
+
let e = window.visualViewport;
|
|
1799
|
+
if (!e || !this.#p) return;
|
|
1800
|
+
let t = window.innerHeight - e.height;
|
|
1801
|
+
this.#p.style.bottom = `${t}px`;
|
|
1802
|
+
}
|
|
1801
1803
|
isDropdownClosed() {
|
|
1802
1804
|
return this.#l.classList.contains(_.HIDE);
|
|
1803
1805
|
}
|
|
1804
1806
|
setCountry(e) {
|
|
1805
1807
|
let { allowDropdown: t, showFlags: n, separateDialCode: r, i18n: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
1806
|
-
if (t && this.#
|
|
1808
|
+
if (t && this.#A(s), this.selectedCountry) {
|
|
1807
1809
|
let e = s && n ? `${_.FLAG} iti__${s}` : `${_.FLAG} ${_.GLOBE}`, t, r, c;
|
|
1808
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), c = n ? "" :
|
|
1810
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), c = n ? "" : W()) : (r = i.noCountrySelected, t = i.noCountrySelected, c = W()), this.selectedCountryInner.className = e, this.selectedCountry.setAttribute("title", r), this.selectedCountry.setAttribute(j.LABEL, t), this.selectedCountryInner.innerHTML = c;
|
|
1809
1811
|
}
|
|
1810
1812
|
if (r) {
|
|
1811
1813
|
let e = o ? `+${o}` : "";
|
|
1812
|
-
this.#s.textContent = e, this.#
|
|
1814
|
+
this.#s.textContent = e, this.#w();
|
|
1813
1815
|
}
|
|
1814
1816
|
}
|
|
1815
|
-
},
|
|
1817
|
+
}, pe = (e) => {
|
|
1816
1818
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
1817
|
-
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : h;
|
|
1818
|
-
},
|
|
1819
|
+
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
|
|
1820
|
+
}, me = (e, t) => {
|
|
1819
1821
|
let { countryNameLocale: n, i18n: r } = t, i;
|
|
1820
1822
|
try {
|
|
1821
1823
|
i = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
|
|
@@ -1823,10 +1825,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1823
1825
|
console.error(e), i = null;
|
|
1824
1826
|
}
|
|
1825
1827
|
for (let t of e) t.name = r[t.iso2] || i?.of(t.iso2.toUpperCase()) || "";
|
|
1826
|
-
},
|
|
1828
|
+
}, he = (e) => {
|
|
1827
1829
|
let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
|
|
1828
1830
|
if (!e || !t) return;
|
|
1829
|
-
t.length > n && (n = t.length),
|
|
1831
|
+
t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
|
|
1830
1832
|
let i = r[t];
|
|
1831
1833
|
i.includes(e) || i.push(e);
|
|
1832
1834
|
}, a = [...e].sort((e, t) => e.priority - t.priority);
|
|
@@ -1852,7 +1854,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1852
1854
|
dialCodeMaxLen: n,
|
|
1853
1855
|
dialCodeToIso2Map: r
|
|
1854
1856
|
};
|
|
1855
|
-
},
|
|
1857
|
+
}, ge = (e, t) => {
|
|
1856
1858
|
let { countryOrder: n } = t;
|
|
1857
1859
|
e.sort((e, t) => {
|
|
1858
1860
|
if (n) {
|
|
@@ -1861,9 +1863,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1861
1863
|
}
|
|
1862
1864
|
return e.name.localeCompare(t.name);
|
|
1863
1865
|
});
|
|
1864
|
-
},
|
|
1865
|
-
for (let t of e) t.normalisedName =
|
|
1866
|
-
},
|
|
1866
|
+
}, _e = (e) => {
|
|
1867
|
+
for (let t of e) t.normalisedName = V(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
|
|
1868
|
+
}, ve = /* @__PURE__ */ new Set([
|
|
1867
1869
|
"800",
|
|
1868
1870
|
"808",
|
|
1869
1871
|
"870",
|
|
@@ -1872,20 +1874,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1872
1874
|
"883",
|
|
1873
1875
|
"888",
|
|
1874
1876
|
"979"
|
|
1875
|
-
]),
|
|
1876
|
-
let t =
|
|
1877
|
-
return e.startsWith("+") &&
|
|
1878
|
-
},
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
}
|
|
1884
|
-
return i;
|
|
1885
|
-
}, ve = (e, t, n, r, i) => {
|
|
1877
|
+
]), K = (e) => {
|
|
1878
|
+
let t = B(e).slice(0, 3);
|
|
1879
|
+
return e.startsWith("+") && ve.has(t);
|
|
1880
|
+
}, q = (e, t, n, r) => {
|
|
1881
|
+
if (!n || !t) return e;
|
|
1882
|
+
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
1883
|
+
return e.substring(a);
|
|
1884
|
+
}, ye = (e, t, n, r, i) => {
|
|
1886
1885
|
let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
|
|
1887
1886
|
return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
|
|
1888
|
-
},
|
|
1887
|
+
}, be = (e, t, n, r) => {
|
|
1889
1888
|
if (n === 0 && !r) return 0;
|
|
1890
1889
|
let i = 0;
|
|
1891
1890
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -1893,7 +1892,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1893
1892
|
if (r && i === e + 1) return n;
|
|
1894
1893
|
}
|
|
1895
1894
|
return t.length;
|
|
1896
|
-
},
|
|
1895
|
+
}, xe = /* @__PURE__ */ new Set([
|
|
1897
1896
|
"800",
|
|
1898
1897
|
"822",
|
|
1899
1898
|
"833",
|
|
@@ -1911,11 +1910,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1911
1910
|
"887",
|
|
1912
1911
|
"888",
|
|
1913
1912
|
"889"
|
|
1914
|
-
]),
|
|
1915
|
-
let t =
|
|
1913
|
+
]), J = (e) => {
|
|
1914
|
+
let t = B(e);
|
|
1916
1915
|
if (t.startsWith(w.NANP) && t.length >= 4) {
|
|
1917
1916
|
let e = t.substring(1, 4);
|
|
1918
|
-
return
|
|
1917
|
+
return xe.has(e);
|
|
1919
1918
|
}
|
|
1920
1919
|
return !1;
|
|
1921
1920
|
}, Se = class {
|
|
@@ -1940,9 +1939,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1940
1939
|
isAscii() {
|
|
1941
1940
|
return !this.#e || this.#e === "ascii";
|
|
1942
1941
|
}
|
|
1943
|
-
}, Ce = 0,
|
|
1942
|
+
}, Ce = 0, Y = (e) => {
|
|
1944
1943
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
1945
|
-
},
|
|
1944
|
+
}, X = () => {
|
|
1946
1945
|
let e, t;
|
|
1947
1946
|
return {
|
|
1948
1947
|
promise: new Promise((n, r) => {
|
|
@@ -1972,13 +1971,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1972
1971
|
#h;
|
|
1973
1972
|
#g;
|
|
1974
1973
|
constructor(e, t = {}) {
|
|
1975
|
-
this.id = Ce++,
|
|
1976
|
-
let n =
|
|
1974
|
+
this.id = Ce++, G.validateInput(e);
|
|
1975
|
+
let n = ie(t);
|
|
1977
1976
|
this.#t = {
|
|
1978
|
-
...
|
|
1977
|
+
...P,
|
|
1979
1978
|
...n
|
|
1980
|
-
},
|
|
1981
|
-
let { dialCodes: r, dialCodeMaxLen: i, dialCodeToIso2Map: a } =
|
|
1979
|
+
}, ae(this.#t), oe(this.#t), this.#e = new G(e, this.#t, this.id), this.#n = se(), this.#m = new Se(e.value), this.promise = this.#y(this.#t), this.#r = pe(this.#t);
|
|
1980
|
+
let { dialCodes: r, dialCodeMaxLen: i, dialCodeToIso2Map: a } = he(this.#r);
|
|
1982
1981
|
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#b();
|
|
1983
1982
|
}
|
|
1984
1983
|
#_() {
|
|
@@ -1990,16 +1989,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1990
1989
|
}
|
|
1991
1990
|
#y(e) {
|
|
1992
1991
|
let { initialCountry: t, geoIpLookup: n, loadUtils: r } = e, i = t === O.AUTO && !!n, a = !!r && !Q.utils;
|
|
1993
|
-
return i && (this.#h =
|
|
1992
|
+
return i && (this.#h = X()), a && (this.#g = X()), Promise.all([this.#h?.promise, this.#g?.promise]).then(() => {});
|
|
1994
1993
|
}
|
|
1995
1994
|
#b() {
|
|
1996
1995
|
this.#f = new AbortController(), this.#x(), this.#e.generateMarkup(this.#r), this.#S(), this.#C(), this.#E(), this.#t.dropdownAlwaysOpen && this.#F();
|
|
1997
1996
|
}
|
|
1998
1997
|
#x() {
|
|
1999
|
-
|
|
1998
|
+
me(this.#r, this.#t), ge(this.#r, this.#t), _e(this.#r);
|
|
2000
1999
|
}
|
|
2001
2000
|
#S(e = !1) {
|
|
2002
|
-
let t = this.#e.telInput.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#_(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#ee(i), o =
|
|
2001
|
+
let t = this.#e.telInput.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#_(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#ee(i), o = J(i), { initialCountry: s, geoIpLookup: c } = this.#t, l = s === O.AUTO && c && !e, u = m(s);
|
|
2003
2002
|
a ? o ? u ? this.#J(s) : l || this.#J(E.ISO2) : this.#G(i) : u ? this.#J(s) : l || this.#J(""), i && this.#W(i);
|
|
2004
2003
|
}
|
|
2005
2004
|
#C() {
|
|
@@ -2027,23 +2026,26 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2027
2026
|
}, { signal: e });
|
|
2028
2027
|
}
|
|
2029
2028
|
#E() {
|
|
2030
|
-
|
|
2031
|
-
|
|
2032
|
-
let t = () => {
|
|
2029
|
+
if (this.#g) {
|
|
2030
|
+
let { loadUtils: e } = this.#t, t = () => {
|
|
2033
2031
|
Q.attachUtils(e)?.catch(() => {});
|
|
2034
2032
|
};
|
|
2035
2033
|
Q.documentReady() ? t() : window.addEventListener("load", t, { signal: this.#f.signal });
|
|
2036
|
-
}
|
|
2037
|
-
|
|
2034
|
+
}
|
|
2035
|
+
this.#h && (this.#c ? this.#h.resolve() : this.#D());
|
|
2038
2036
|
}
|
|
2039
2037
|
#D() {
|
|
2040
|
-
|
|
2038
|
+
if (Q.autoCountry) {
|
|
2039
|
+
this.#ae();
|
|
2040
|
+
return;
|
|
2041
|
+
}
|
|
2042
|
+
this.#e.selectedCountryInner.classList.add(_.LOADING), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.geoIpLookup == "function" && this.#t.geoIpLookup((t = "") => {
|
|
2041
2043
|
this.#e.selectedCountryInner.classList.remove(_.LOADING);
|
|
2042
2044
|
let n = t.toLowerCase();
|
|
2043
2045
|
m(n) ? (Q.autoCountry = n, setTimeout(() => e.forEachInstance("handleAutoCountry"))) : e.forEachInstance("handleAutoCountryFailure");
|
|
2044
2046
|
}, () => {
|
|
2045
2047
|
this.#e.selectedCountryInner.classList.remove(_.LOADING), e.forEachInstance("handleAutoCountryFailure");
|
|
2046
|
-
}))
|
|
2048
|
+
}));
|
|
2047
2049
|
}
|
|
2048
2050
|
#O() {
|
|
2049
2051
|
this.#F(), this.#e.searchInput.value = "+", this.#e.filterCountriesByQuery("");
|
|
@@ -2065,30 +2067,28 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2065
2067
|
c || l && !e ? a = !0 : b.NON_PLUS_NUMERIC.test(s) || (a = !1);
|
|
2066
2068
|
let u = o?.detail && o.detail.isSetNumber, d = this.#m.isAscii();
|
|
2067
2069
|
if (t && !a && !u && d) {
|
|
2068
|
-
let e = this.#e.telInput.selectionStart || 0, t = s.substring(0, e).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, r = o?.inputType === y.DELETE_FWD, i =
|
|
2070
|
+
let e = this.#e.telInput.selectionStart || 0, t = s.substring(0, e).replace(b.NON_PLUS_NUMERIC_GLOBAL, "").length, r = o?.inputType === y.DELETE_FWD, i = ye(this.#te(), s, Q.utils, this.#c, n), a = be(t, i, e, r);
|
|
2069
2071
|
this.#v(i), this.#e.telInput.setSelectionRange(a, a);
|
|
2070
2072
|
}
|
|
2071
2073
|
if (n && s.startsWith("+") && this.#c?.dialCode) {
|
|
2072
|
-
let e =
|
|
2074
|
+
let e = q(s, !0, n, this.#c);
|
|
2073
2075
|
this.#v(e);
|
|
2074
2076
|
}
|
|
2075
2077
|
}, { signal: this.#f.signal });
|
|
2076
2078
|
}
|
|
2077
2079
|
#j() {
|
|
2078
2080
|
let { strictMode: e, separateDialCode: t, allowDropdown: n, countrySearch: r } = this.#t;
|
|
2079
|
-
|
|
2080
|
-
if (i.key
|
|
2081
|
-
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
}
|
|
2085
|
-
if (e) {
|
|
2086
|
-
let e = this.#_(), n = !e.startsWith("+") && this.#e.telInput.selectionStart === 0 && i.key === "+", r = this.#m.normalise(i.key), a = /^[0-9]$/.test(r), o = t ? a : n || a, s = this.#e.telInput, c = s.selectionStart, l = s.selectionEnd, u = e.slice(0, c ?? void 0), d = e.slice(l ?? void 0), f = u + i.key + d, p = this.#te(f), m = !1;
|
|
2087
|
-
Q.utils && this.#l && (m = Q.utils.getCoreNumber(p, this.#c?.iso2).length > this.#l);
|
|
2088
|
-
let h = this.#q(p) !== null;
|
|
2089
|
-
(!o || m && !h && !n) && i.preventDefault();
|
|
2090
|
-
}
|
|
2081
|
+
!e && !t || this.#e.telInput.addEventListener("keydown", (i) => {
|
|
2082
|
+
if (!i.key || i.key.length !== 1 || i.altKey || i.ctrlKey || i.metaKey) return;
|
|
2083
|
+
if (t && n && r && i.key === "+") {
|
|
2084
|
+
i.preventDefault(), this.#O();
|
|
2085
|
+
return;
|
|
2091
2086
|
}
|
|
2087
|
+
if (!e) return;
|
|
2088
|
+
let a = this.#_(), o = !a.startsWith("+") && this.#e.telInput.selectionStart === 0 && i.key === "+", s = this.#m.normalise(i.key), c = /^[0-9]$/.test(s), l = t ? c : o || c, u = this.#e.telInput, d = u.selectionStart, f = u.selectionEnd, p = a.slice(0, d ?? void 0), m = a.slice(f ?? void 0), h = p + i.key + m, g = this.#te(h), _ = !1;
|
|
2089
|
+
Q.utils && this.#l && (_ = Q.utils.getCoreNumber(g, this.#c?.iso2).length > this.#l);
|
|
2090
|
+
let v = this.#q(g) !== null;
|
|
2091
|
+
(!l || _ && !v && !o) && i.preventDefault();
|
|
2092
2092
|
}, { signal: this.#f.signal });
|
|
2093
2093
|
}
|
|
2094
2094
|
#M() {
|
|
@@ -2166,7 +2166,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2166
2166
|
this.#e.searchInput.addEventListener("input", () => this.#e.handleSearchChange(), { signal: e }), this.#e.searchClearButton.addEventListener("click", () => this.#e.handleSearchClear(), { signal: e });
|
|
2167
2167
|
}
|
|
2168
2168
|
#H(e) {
|
|
2169
|
-
let t =
|
|
2169
|
+
let t = le(this.#r, e);
|
|
2170
2170
|
if (t) {
|
|
2171
2171
|
let e = t.nodeById[this.id];
|
|
2172
2172
|
this.#e.highlightListItem(e, !1), this.#e.scrollCountryListToItem(e);
|
|
@@ -2178,7 +2178,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2178
2178
|
#W(e) {
|
|
2179
2179
|
let { formatOnDisplay: t, nationalMode: n, separateDialCode: r } = this.#t, i = e;
|
|
2180
2180
|
if (t && Q.utils && this.#c) {
|
|
2181
|
-
let t =
|
|
2181
|
+
let t = K(e), a = n && !t || !i.startsWith("+") && !r, { NATIONAL: o, INTERNATIONAL: s } = Q.utils.numberFormat, c = a ? o : s;
|
|
2182
2182
|
i = Q.utils.formatNumber(i, this.#c?.iso2, c);
|
|
2183
2183
|
}
|
|
2184
2184
|
i = this.#ne(i), this.#v(i);
|
|
@@ -2192,14 +2192,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2192
2192
|
return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
|
|
2193
2193
|
}
|
|
2194
2194
|
#q(e) {
|
|
2195
|
-
let t = e.indexOf("+"), n = t ? e.substring(t) : e, r = this.#c?.iso2, i = this.#c?.dialCode;
|
|
2195
|
+
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#c?.iso2, i = this.#c?.dialCode;
|
|
2196
2196
|
n = this.#K(n);
|
|
2197
|
-
let a = this.#ee(n, !0), o =
|
|
2197
|
+
let a = this.#ee(n, !0), o = B(n);
|
|
2198
2198
|
if (a) {
|
|
2199
|
-
let e =
|
|
2199
|
+
let e = B(a), t = this.#a[e];
|
|
2200
2200
|
if (t.length === 1) return t[0] === r ? null : t[0];
|
|
2201
2201
|
if (!r && this.#u && t.includes(this.#u)) return this.#u;
|
|
2202
|
-
if (i === w.NANP &&
|
|
2202
|
+
if (i === w.NANP && J(o)) return null;
|
|
2203
2203
|
let n = this.#c?.areaCodes, s = this.#c?.priority;
|
|
2204
2204
|
if (n) {
|
|
2205
2205
|
let e = n.map((e) => `${i}${e}`);
|
|
@@ -2218,20 +2218,23 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2218
2218
|
return this.#c = e ? this.#s.get(e) : null, this.#c && (this.#u = this.#c.iso2), this.#e.setCountry(this.#c), this.#X(), this.#Y(), t !== e;
|
|
2219
2219
|
}
|
|
2220
2220
|
#Y() {
|
|
2221
|
-
let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t
|
|
2222
|
-
if (e
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
}
|
|
2221
|
+
let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
|
|
2222
|
+
if (!e || !Q.utils) return;
|
|
2223
|
+
let r = this.#c?.iso2;
|
|
2224
|
+
if (!r) {
|
|
2225
|
+
this.#l = null;
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
let i = Q.utils.numberType[t], a = Q.utils.getExampleNumber(r, !1, i, !0), o = a;
|
|
2229
|
+
for (; Q.utils.isPossibleNumber(a, r, n);) o = a, a += "0";
|
|
2230
|
+
let s = Q.utils.getCoreNumber(o, r);
|
|
2231
|
+
this.#l = s.length, r === "by" && (this.#l = s.length + 1);
|
|
2228
2232
|
}
|
|
2229
2233
|
#X() {
|
|
2230
2234
|
let { autoPlaceholder: e, placeholderNumberType: t, nationalMode: n, customPlaceholder: r } = this.#t, i = e === D.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === D.POLITE;
|
|
2231
|
-
if (Q.utils
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
}
|
|
2235
|
+
if (!Q.utils || !i) return;
|
|
2236
|
+
let a = Q.utils.numberType[t], o = this.#c ? Q.utils.getExampleNumber(this.#c.iso2, n, a) : "";
|
|
2237
|
+
o = this.#ne(o), typeof r == "function" && (o = r(o, this.#c)), this.#e.telInput.setAttribute("placeholder", o);
|
|
2235
2238
|
}
|
|
2236
2239
|
#Z(e) {
|
|
2237
2240
|
let t = e.dataset[A.COUNTRY_CODE], n = this.#J(t);
|
|
@@ -2247,35 +2250,32 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2247
2250
|
this.#e.isDropdownClosed() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeDropdown(), this.#p.abort(), this.#p = null, this.#P(g.CLOSE_COUNTRY_DROPDOWN));
|
|
2248
2251
|
}
|
|
2249
2252
|
#$(e) {
|
|
2250
|
-
let t = this.#_()
|
|
2251
|
-
if (t.startsWith("+"))
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
}
|
|
2253
|
+
let t = this.#_();
|
|
2254
|
+
if (!t.startsWith("+")) return;
|
|
2255
|
+
let n = `+${e}`, r = this.#ee(t), i;
|
|
2256
|
+
i = r ? t.replace(r, n) : n, this.#v(i);
|
|
2255
2257
|
}
|
|
2256
2258
|
#ee(e, t) {
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
if (
|
|
2263
|
-
|
|
2264
|
-
if (
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
if (r.length === this.#i) break;
|
|
2268
|
-
}
|
|
2259
|
+
if (!e.startsWith("+")) return "";
|
|
2260
|
+
let n = "", r = "", i = !1;
|
|
2261
|
+
for (let a = 0; a < e.length; a++) {
|
|
2262
|
+
let o = e.charAt(a);
|
|
2263
|
+
if (/[0-9]/.test(o)) {
|
|
2264
|
+
if (r += o, !this.#a[r]) break;
|
|
2265
|
+
if (this.#o.has(r)) {
|
|
2266
|
+
if (n = e.substring(0, a + 1), i = !0, !t) break;
|
|
2267
|
+
} else t && i && (n = e.substring(0, a + 1));
|
|
2268
|
+
if (r.length === this.#i) break;
|
|
2269
2269
|
}
|
|
2270
2270
|
}
|
|
2271
2271
|
return n;
|
|
2272
2272
|
}
|
|
2273
2273
|
#te(e) {
|
|
2274
|
-
let t = e ? this.#m.normalise(e) : this.#_(), n = this.#c?.dialCode, r, i =
|
|
2274
|
+
let t = e ? this.#m.normalise(e) : this.#_(), n = this.#c?.dialCode, r, i = B(t);
|
|
2275
2275
|
return r = this.#t.separateDialCode && !t.startsWith("+") && n && i ? `+${n}` : "", r + t;
|
|
2276
2276
|
}
|
|
2277
2277
|
#ne(e) {
|
|
2278
|
-
let t =
|
|
2278
|
+
let t = q(e, !!this.#ee(e), this.#t.separateDialCode, this.#c);
|
|
2279
2279
|
return this.#N(t);
|
|
2280
2280
|
}
|
|
2281
2281
|
#re() {
|
|
@@ -2293,11 +2293,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2293
2293
|
this.#P(g.COUNTRY_CHANGE, e);
|
|
2294
2294
|
}
|
|
2295
2295
|
#ae() {
|
|
2296
|
-
if (this.#
|
|
2297
|
-
this.#
|
|
2298
|
-
|
|
2296
|
+
if (!(!this.#h || !Q.autoCountry)) {
|
|
2297
|
+
if (this.#d) {
|
|
2298
|
+
this.#h.resolve();
|
|
2299
|
+
return;
|
|
2300
|
+
}
|
|
2301
|
+
this.#u = Q.autoCountry, this.#c || this.#e.selectedCountryInner.classList.contains(_.GLOBE) || this.setCountry(this.#u), this.#h.resolve();
|
|
2299
2302
|
}
|
|
2300
|
-
this.#t.initialCountry === O.AUTO && Q.autoCountry && (this.#u = Q.autoCountry, this.#c || this.#e.selectedCountryInner.classList.contains(_.GLOBE) || this.setCountry(this.#u), this.#h?.resolve());
|
|
2301
2303
|
}
|
|
2302
2304
|
#oe() {
|
|
2303
2305
|
if (this.#d) {
|
|
@@ -2311,11 +2313,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2311
2313
|
this.#g?.resolve();
|
|
2312
2314
|
return;
|
|
2313
2315
|
}
|
|
2314
|
-
if (Q.utils) {
|
|
2315
|
-
|
|
2316
|
-
|
|
2316
|
+
if (!Q.utils) {
|
|
2317
|
+
this.#g?.resolve();
|
|
2318
|
+
return;
|
|
2317
2319
|
}
|
|
2318
|
-
this.#
|
|
2320
|
+
let e = this.#_();
|
|
2321
|
+
e && this.#W(e), this.#c && (this.#X(), this.#Y()), this.#g?.resolve();
|
|
2319
2322
|
}
|
|
2320
2323
|
#ce(e) {
|
|
2321
2324
|
if (this.#d) {
|
|
@@ -2331,48 +2334,48 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2331
2334
|
return !this.#d;
|
|
2332
2335
|
}
|
|
2333
2336
|
getExtension() {
|
|
2334
|
-
return this.#d ? "" : (
|
|
2337
|
+
return this.#d ? "" : (Y("getExtension"), Q.utils.getExtension(this.#te(), this.#c?.iso2));
|
|
2335
2338
|
}
|
|
2336
2339
|
getNumber(e) {
|
|
2337
2340
|
if (this.#d) return "";
|
|
2338
|
-
|
|
2341
|
+
Y("getNumber");
|
|
2339
2342
|
let t = this.#c?.iso2, n = this.#te(), r = Q.utils.formatNumber(n, t, e);
|
|
2340
2343
|
return this.#m.denormalise(r);
|
|
2341
2344
|
}
|
|
2342
2345
|
getNumberType() {
|
|
2343
|
-
return this.#d ? S.UNKNOWN_NUMBER_TYPE : (
|
|
2346
|
+
return this.#d ? S.UNKNOWN_NUMBER_TYPE : (Y("getNumberType"), Q.utils.getNumberType(this.#te(), this.#c?.iso2));
|
|
2344
2347
|
}
|
|
2345
2348
|
getSelectedCountryData() {
|
|
2346
2349
|
return this.#re();
|
|
2347
2350
|
}
|
|
2348
2351
|
getValidationError() {
|
|
2349
2352
|
if (this.#d) return S.UNKNOWN_VALIDATION_ERROR;
|
|
2350
|
-
|
|
2353
|
+
Y("getValidationError");
|
|
2351
2354
|
let e = this.#c?.iso2;
|
|
2352
2355
|
return Q.utils.getValidationError(this.#te(), e);
|
|
2353
2356
|
}
|
|
2354
2357
|
isValidNumber() {
|
|
2355
2358
|
if (this.#d) return null;
|
|
2356
|
-
|
|
2359
|
+
Y("isValidNumber");
|
|
2357
2360
|
let e = this.#c?.dialCode, t = this.#c?.iso2, n = this.#te(), r = Q.utils.getCoreNumber(n, t);
|
|
2358
2361
|
if (r) {
|
|
2359
2362
|
if (e === T.DIAL_CODE && r[0] === T.MOBILE_PREFIX && r.length !== T.MOBILE_CORE_LENGTH) return !1;
|
|
2360
2363
|
if (!b.ALPHA_UNICODE.test(n) && e) {
|
|
2361
|
-
let t =
|
|
2364
|
+
let t = B(n.startsWith("+") ? n.slice(1 + e.length) : n).length;
|
|
2362
2365
|
if (r.length > t) return !1;
|
|
2363
2366
|
}
|
|
2364
2367
|
}
|
|
2365
2368
|
return this.#ue(!1);
|
|
2366
2369
|
}
|
|
2367
2370
|
isValidNumberPrecise() {
|
|
2368
|
-
return this.#d ? null : (
|
|
2371
|
+
return this.#d ? null : (Y("isValidNumberPrecise"), this.#ue(!0));
|
|
2369
2372
|
}
|
|
2370
2373
|
#le(e) {
|
|
2371
2374
|
return Q.utils ? Q.utils.isPossibleNumber(e, this.#c?.iso2, this.#t.allowedNumberTypes) : null;
|
|
2372
2375
|
}
|
|
2373
2376
|
#ue(e) {
|
|
2374
2377
|
let { allowNumberExtensions: t, allowPhonewords: n } = this.#t, r = (t) => e ? this.#de(t) : this.#le(t), i = this.#te();
|
|
2375
|
-
if (!this.#c && !
|
|
2378
|
+
if (!this.#c && !K(i) || !r(i)) return !1;
|
|
2376
2379
|
if (i.search(b.ALPHA_UNICODE) > -1) {
|
|
2377
2380
|
let e = this.#c?.iso2;
|
|
2378
2381
|
return Q.utils.getExtension(i, e) ? t : n;
|
|
@@ -2432,7 +2435,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2432
2435
|
let n = new Z(e, t);
|
|
2433
2436
|
return Q.instances.set(String(n.id), n), e.iti = n, n;
|
|
2434
2437
|
}, {
|
|
2435
|
-
defaults:
|
|
2438
|
+
defaults: P,
|
|
2436
2439
|
documentReady: () => document.readyState === "complete",
|
|
2437
2440
|
getCountryData: () => h,
|
|
2438
2441
|
getInstance: (e) => {
|
|
@@ -2461,8 +2464,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2461
2464
|
},
|
|
2462
2465
|
startedLoadingUtilsScript: !1,
|
|
2463
2466
|
startedLoadingAutoCountry: !1,
|
|
2464
|
-
version: "27.0.
|
|
2465
|
-
}), $ = Q,
|
|
2467
|
+
version: "27.0.2"
|
|
2468
|
+
}), $ = Q, we = /* @__PURE__ */ n({
|
|
2466
2469
|
inheritAttrs: !1,
|
|
2467
2470
|
__name: "IntlTelInput",
|
|
2468
2471
|
props: {
|
|
@@ -2532,46 +2535,46 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2532
2535
|
let e = p.inputProps ?? {}, t = {};
|
|
2533
2536
|
for (let [n, r] of Object.entries(e)) g.has(n) ? h(n) : t[n] = r;
|
|
2534
2537
|
return t;
|
|
2535
|
-
}), v = e(() => p.modelValue ?? p.initialValue ?? ""), y = r(), b =
|
|
2538
|
+
}), v = e(() => p.modelValue ?? p.initialValue ?? ""), y = r(), b = Object.keys($.defaults), x = e(() => {
|
|
2536
2539
|
let e = y?.vnode.props ?? {}, t = {};
|
|
2537
|
-
return
|
|
2538
|
-
if (!
|
|
2540
|
+
return b.forEach((n) => {
|
|
2541
|
+
if (!Object.hasOwn(e, n)) return;
|
|
2539
2542
|
let r = p[n];
|
|
2540
2543
|
r !== void 0 && (t[n] = r);
|
|
2541
2544
|
}), t;
|
|
2542
|
-
}),
|
|
2543
|
-
let e =
|
|
2544
|
-
e !==
|
|
2545
|
+
}), S = c(null), C = l(null), w = c(), T = c(), E = c(), D = c(), O = () => (p.usePreciseValidation ? C.value.isValidNumberPrecise() : C.value.isValidNumber()) ?? !1, k = () => {
|
|
2546
|
+
let e = O(), t = e ? null : C.value.getValidationError();
|
|
2547
|
+
e !== E.value && (E.value = e, m("changeValidity", e)), t !== D.value && (D.value = t, m("changeErrorCode", t));
|
|
2548
|
+
}, A = () => {
|
|
2549
|
+
if (!C.value?.isActive()) return;
|
|
2550
|
+
let e = C.value.getNumber() ?? "";
|
|
2551
|
+
e !== w.value && (w.value = e, m("changeNumber", e), m("update:modelValue", e)), k();
|
|
2545
2552
|
}, j = () => {
|
|
2546
|
-
if (!
|
|
2547
|
-
let e =
|
|
2548
|
-
e !== T.value && (T.value = e, m("
|
|
2549
|
-
}, M = () => {
|
|
2550
|
-
if (!w.value?.isActive()) return;
|
|
2551
|
-
let e = w.value.getSelectedCountryData()?.iso2 ?? "";
|
|
2552
|
-
e !== E.value && (E.value = e, m("changeCountry", e)), j();
|
|
2553
|
+
if (!C.value?.isActive()) return;
|
|
2554
|
+
let e = C.value.getSelectedCountryData()?.iso2 ?? "";
|
|
2555
|
+
e !== T.value && (T.value = e, m("changeCountry", e)), A();
|
|
2553
2556
|
};
|
|
2554
2557
|
return a(() => {
|
|
2555
|
-
|
|
2556
|
-
|
|
2558
|
+
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(() => {
|
|
2559
|
+
C.value?.isActive() && (v.value && C.value.setNumber(v.value), w.value = C.value.getNumber() ?? "", E.value = O(), D.value = E.value ? null : C.value.getValidationError(), j());
|
|
2557
2560
|
}));
|
|
2558
|
-
}), u(() => p.disabled, (e) =>
|
|
2559
|
-
|
|
2560
|
-
if (!
|
|
2561
|
-
let t = e ?? "", n =
|
|
2562
|
-
document.activeElement ===
|
|
2561
|
+
}), u(() => p.disabled, (e) => C.value?.setDisabled(e)), u(() => p.readonly, (e) => C.value?.setReadonly(e)), u(() => v.value, (e) => {
|
|
2562
|
+
C.value && C.value.promise.then(() => {
|
|
2563
|
+
if (!C.value?.isActive()) return;
|
|
2564
|
+
let t = e ?? "", n = C.value.getNumber() ?? "";
|
|
2565
|
+
document.activeElement === S.value || n === t || (C.value.setNumber(t), k());
|
|
2563
2566
|
});
|
|
2564
|
-
}, { flush: "post" }), o(() =>
|
|
2565
|
-
instance:
|
|
2566
|
-
input:
|
|
2567
|
+
}, { flush: "post" }), o(() => C.value?.destroy()), d({
|
|
2568
|
+
instance: C,
|
|
2569
|
+
input: S
|
|
2567
2570
|
}), (e, n) => (s(), t("input", i(_.value, {
|
|
2568
2571
|
ref_key: "input",
|
|
2569
|
-
ref:
|
|
2572
|
+
ref: S,
|
|
2570
2573
|
type: "tel",
|
|
2571
|
-
onCountrychange:
|
|
2572
|
-
onInput:
|
|
2574
|
+
onCountrychange: j,
|
|
2575
|
+
onInput: A
|
|
2573
2576
|
}), null, 16));
|
|
2574
2577
|
}
|
|
2575
2578
|
});
|
|
2576
2579
|
//#endregion
|
|
2577
|
-
export { $ as n,
|
|
2580
|
+
export { $ as n, we as t };
|