@intl-tel-input/vue 29.2.0 → 29.2.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.
|
@@ -1261,29 +1261,29 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1261
1261
|
}, w = {
|
|
1262
1262
|
PLUS: "+",
|
|
1263
1263
|
NANP: "1"
|
|
1264
|
-
}, T = {
|
|
1264
|
+
}, T = 15, E = {
|
|
1265
1265
|
ISO2: "gb",
|
|
1266
1266
|
DIAL_CODE: "44",
|
|
1267
1267
|
MOBILE_PREFIX: "7",
|
|
1268
1268
|
MOBILE_CORE_LENGTH: 10
|
|
1269
|
-
},
|
|
1269
|
+
}, D = {
|
|
1270
1270
|
ISO2: "us",
|
|
1271
1271
|
DIAL_CODE: "1"
|
|
1272
|
-
},
|
|
1272
|
+
}, O = {
|
|
1273
1273
|
AGGRESSIVE: "AGGRESSIVE",
|
|
1274
1274
|
POLITE: "POLITE",
|
|
1275
1275
|
OFF: "OFF"
|
|
1276
|
-
},
|
|
1276
|
+
}, k = [
|
|
1277
1277
|
"OFF",
|
|
1278
1278
|
"DROPDOWN",
|
|
1279
1279
|
"FULLSCREEN",
|
|
1280
1280
|
"AUTO"
|
|
1281
|
-
],
|
|
1281
|
+
], A = [
|
|
1282
1282
|
"E164",
|
|
1283
1283
|
"INTERNATIONAL",
|
|
1284
1284
|
"NATIONAL",
|
|
1285
1285
|
"RFC3966"
|
|
1286
|
-
],
|
|
1286
|
+
], j = [
|
|
1287
1287
|
"FIXED_LINE",
|
|
1288
1288
|
"MOBILE",
|
|
1289
1289
|
"FIXED_LINE_OR_MOBILE",
|
|
@@ -1296,14 +1296,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1296
1296
|
"UAN",
|
|
1297
1297
|
"VOICEMAIL",
|
|
1298
1298
|
"UNKNOWN"
|
|
1299
|
-
],
|
|
1299
|
+
], ee = [
|
|
1300
1300
|
"IS_POSSIBLE",
|
|
1301
1301
|
"INVALID_COUNTRY_CODE",
|
|
1302
1302
|
"TOO_SHORT",
|
|
1303
1303
|
"TOO_LONG",
|
|
1304
1304
|
"IS_POSSIBLE_LOCAL_ONLY",
|
|
1305
1305
|
"INVALID_LENGTH"
|
|
1306
|
-
], M = (e) => Object.fromEntries(e.map((e) => [e, e])), N = M(
|
|
1306
|
+
], M = (e) => Object.fromEntries(e.map((e) => [e, e])), N = M(A), P = M(j), F = M(ee), I = M(k), L = {
|
|
1307
1307
|
ISO2: "iso2",
|
|
1308
1308
|
DIAL_CODE: "dialCode",
|
|
1309
1309
|
INSTANCE_ID: "intlTelInputId"
|
|
@@ -1317,7 +1317,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1317
1317
|
HIDDEN: "aria-hidden",
|
|
1318
1318
|
AUTOCOMPLETE: "aria-autocomplete",
|
|
1319
1319
|
MODAL: "aria-modal"
|
|
1320
|
-
},
|
|
1320
|
+
}, te = {
|
|
1321
1321
|
selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
|
|
1322
1322
|
noCountrySelected: "Select country for phone number",
|
|
1323
1323
|
countryListAriaLabel: "List of countries",
|
|
@@ -1327,10 +1327,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1327
1327
|
searchSummaryAria(e) {
|
|
1328
1328
|
return e === 0 ? "No results found" : e === 1 ? "1 result found" : `${e} results found`;
|
|
1329
1329
|
}
|
|
1330
|
-
}, z = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches,
|
|
1330
|
+
}, z = (e) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(e).matches, ne = () => z(`(max-width: ${C.NARROW_VIEWPORT_WIDTH}px)`), re = () => {
|
|
1331
1331
|
if (typeof navigator < "u" && typeof window < "u") {
|
|
1332
1332
|
let e = z("(max-height: 600px)"), t = z("(pointer: coarse)");
|
|
1333
|
-
if (
|
|
1333
|
+
if (ne() || t && e) return I.FULLSCREEN;
|
|
1334
1334
|
}
|
|
1335
1335
|
return I.DROPDOWN;
|
|
1336
1336
|
}, B = {
|
|
@@ -1357,22 +1357,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1357
1357
|
loadUtils: null,
|
|
1358
1358
|
numberDisplayFormat: N.INTERNATIONAL,
|
|
1359
1359
|
onlyCountries: null,
|
|
1360
|
-
placeholderNumberPolicy:
|
|
1360
|
+
placeholderNumberPolicy: O.POLITE,
|
|
1361
1361
|
placeholderNumberType: P.MOBILE,
|
|
1362
1362
|
searchInputClass: "",
|
|
1363
1363
|
separateDialCode: !0,
|
|
1364
1364
|
strictRejectAnimation: !0,
|
|
1365
1365
|
showFlags: !0,
|
|
1366
1366
|
strictMode: !0
|
|
1367
|
-
},
|
|
1367
|
+
}, V = (e) => JSON.stringify(e), H = (e) => !!e && typeof e == "object" && !Array.isArray(e), ie = (e) => typeof e == "function", ae = (e) => {
|
|
1368
1368
|
if (!e || typeof e != "object") return !1;
|
|
1369
1369
|
let t = e;
|
|
1370
1370
|
return t.nodeType === 1 && typeof t.tagName == "string" && typeof t.appendChild == "function";
|
|
1371
|
-
},
|
|
1371
|
+
}, oe = new Set(Object.values(O)), se = new Set(_), U = (e) => {
|
|
1372
1372
|
console.warn(`[intl-tel-input] ${e}`);
|
|
1373
1373
|
}, W = (e, t, n) => {
|
|
1374
|
-
U(`Option '${e}' must be ${t}; got ${
|
|
1375
|
-
},
|
|
1374
|
+
U(`Option '${e}' must be ${t}; got ${V(n)}. Ignoring.`);
|
|
1375
|
+
}, ce = (e, t) => {
|
|
1376
1376
|
let n = "an array of iso2 country code strings";
|
|
1377
1377
|
if (!Array.isArray(t)) return W(e, n, t), !1;
|
|
1378
1378
|
let r = [];
|
|
@@ -1381,9 +1381,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1381
1381
|
m(i.toLowerCase()) ? r.push(i) : U(`Invalid iso2 code in '${e}': '${i}'. Skipping.`);
|
|
1382
1382
|
}
|
|
1383
1383
|
return r;
|
|
1384
|
-
},
|
|
1384
|
+
}, le = (e) => {
|
|
1385
1385
|
if (e === void 0) return {};
|
|
1386
|
-
if (!
|
|
1386
|
+
if (!H(e)) return U(`The second argument must be an options object; got ${V(e)}. Using defaults.`), {};
|
|
1387
1387
|
let t = {};
|
|
1388
1388
|
for (let [n, r] of Object.entries(e)) {
|
|
1389
1389
|
if (!Object.hasOwn(B, n)) {
|
|
@@ -1408,8 +1408,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1408
1408
|
t[n] = r;
|
|
1409
1409
|
break;
|
|
1410
1410
|
case "countrySelectorMode":
|
|
1411
|
-
if (typeof r != "string" || !
|
|
1412
|
-
W("countrySelectorMode", `one of ${
|
|
1411
|
+
if (typeof r != "string" || !k.includes(r)) {
|
|
1412
|
+
W("countrySelectorMode", `one of ${k.map((e) => `"${e}"`).join(", ")}`, r);
|
|
1413
1413
|
break;
|
|
1414
1414
|
}
|
|
1415
1415
|
t[n] = r;
|
|
@@ -1422,8 +1422,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1422
1422
|
t[n] = r;
|
|
1423
1423
|
break;
|
|
1424
1424
|
case "placeholderNumberPolicy":
|
|
1425
|
-
if (typeof r != "string" || !
|
|
1426
|
-
W("placeholderNumberPolicy", `one of ${Array.from(
|
|
1425
|
+
if (typeof r != "string" || !oe.has(r)) {
|
|
1426
|
+
W("placeholderNumberPolicy", `one of ${Array.from(oe).join(", ")}`, r);
|
|
1427
1427
|
break;
|
|
1428
1428
|
}
|
|
1429
1429
|
t[n] = r;
|
|
@@ -1438,19 +1438,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1438
1438
|
t[n] = r;
|
|
1439
1439
|
break;
|
|
1440
1440
|
case "classNames": {
|
|
1441
|
-
if (!
|
|
1441
|
+
if (!H(r)) {
|
|
1442
1442
|
W("classNames", "an object", r);
|
|
1443
1443
|
break;
|
|
1444
1444
|
}
|
|
1445
1445
|
let e = {};
|
|
1446
|
-
for (let [t, n] of Object.entries(r))
|
|
1446
|
+
for (let [t, n] of Object.entries(r)) se.has(t) ? typeof n == "string" ? e[t] = n.trim().replace(/\s+/g, " ") : W(`classNames.${t}`, "a string", n) : U(`Unknown slot '${t}' in 'classNames'. Valid slots: ${_.join(", ")}. Skipping.`);
|
|
1447
1447
|
t[n] = e;
|
|
1448
1448
|
break;
|
|
1449
1449
|
}
|
|
1450
1450
|
case "countryOrder":
|
|
1451
1451
|
if (r === null) t[n] = r;
|
|
1452
1452
|
else {
|
|
1453
|
-
let e =
|
|
1453
|
+
let e = ce(n, r);
|
|
1454
1454
|
e !== !1 && (t[n] = e);
|
|
1455
1455
|
}
|
|
1456
1456
|
break;
|
|
@@ -1475,19 +1475,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1475
1475
|
case "onlyCountries":
|
|
1476
1476
|
if (r === null) t[n] = r;
|
|
1477
1477
|
else {
|
|
1478
|
-
let e =
|
|
1478
|
+
let e = ce(n, r);
|
|
1479
1479
|
e !== !1 && (t[n] = e);
|
|
1480
1480
|
}
|
|
1481
1481
|
break;
|
|
1482
1482
|
case "uiTranslations":
|
|
1483
|
-
if (r && !
|
|
1483
|
+
if (r && !H(r)) {
|
|
1484
1484
|
W("uiTranslations", "an object", r);
|
|
1485
1485
|
break;
|
|
1486
1486
|
}
|
|
1487
1487
|
t[n] = r;
|
|
1488
1488
|
break;
|
|
1489
1489
|
case "countryNameOverrides":
|
|
1490
|
-
if (r && !
|
|
1490
|
+
if (r && !H(r)) {
|
|
1491
1491
|
W("countryNameOverrides", "an object", r);
|
|
1492
1492
|
break;
|
|
1493
1493
|
}
|
|
@@ -1507,8 +1507,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1507
1507
|
break;
|
|
1508
1508
|
}
|
|
1509
1509
|
case "placeholderNumberType":
|
|
1510
|
-
if (typeof r != "string" || !
|
|
1511
|
-
W("placeholderNumberType", `one of ${
|
|
1510
|
+
if (typeof r != "string" || !j.includes(r)) {
|
|
1511
|
+
W("placeholderNumberType", `one of ${j.join(", ")}`, r);
|
|
1512
1512
|
break;
|
|
1513
1513
|
}
|
|
1514
1514
|
t[n] = r;
|
|
@@ -1520,8 +1520,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1520
1520
|
break;
|
|
1521
1521
|
}
|
|
1522
1522
|
let e = !0;
|
|
1523
|
-
for (let t of r) if (typeof t != "string" || !
|
|
1524
|
-
W("allowedNumberTypes", `an array of valid number types (${
|
|
1523
|
+
for (let t of r) if (typeof t != "string" || !j.includes(t)) {
|
|
1524
|
+
W("allowedNumberTypes", `an array of valid number types (${j.join(", ")})`, t), e = !1;
|
|
1525
1525
|
break;
|
|
1526
1526
|
}
|
|
1527
1527
|
e && (t[n] = r);
|
|
@@ -1530,22 +1530,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1530
1530
|
}
|
|
1531
1531
|
}
|
|
1532
1532
|
return t;
|
|
1533
|
-
},
|
|
1533
|
+
}, ue = (e) => {
|
|
1534
1534
|
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());
|
|
1535
|
-
},
|
|
1536
|
-
e.countrySelectorMode === I.AUTO && (e.countrySelectorMode =
|
|
1537
|
-
...
|
|
1535
|
+
}, de = (e) => {
|
|
1536
|
+
e.countrySelectorMode === I.AUTO && (e.countrySelectorMode = re()), e.dropdownAlwaysOpen && (e.countrySelectorMode = I.DROPDOWN), e.countrySelectorMode === I.FULLSCREEN ? e.matchDropdownWidth = !1 : ne() && (e.matchDropdownWidth = !0), e.onlyCountries?.length === 1 && (e.initialCountry = e.onlyCountries[0]), e.separateDialCode && e.numberDisplayFormat === N.NATIONAL && (e.numberDisplayFormat = N.INTERNATIONAL), e.countrySelectorMode !== I.OFF && !e.showFlags && !e.separateDialCode && e.numberDisplayFormat === N.NATIONAL && (e.numberDisplayFormat = N.INTERNATIONAL), e.uiTranslations = {
|
|
1537
|
+
...te,
|
|
1538
1538
|
...e.uiTranslations
|
|
1539
1539
|
};
|
|
1540
|
-
},
|
|
1540
|
+
}, G = (e) => e.replace(/\D/g, ""), fe = (e = "") => e.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), pe = (e) => Object.keys(e).filter((t) => !!e[t]).join(" "), K = (e, t, n) => {
|
|
1541
1541
|
let r = document.createElement(e);
|
|
1542
1542
|
return t && Object.entries(t).forEach(([e, t]) => r.setAttribute(e, t)), n && n.appendChild(r), r;
|
|
1543
|
-
},
|
|
1544
|
-
let r = document.createElementNS(
|
|
1543
|
+
}, me = "http://www.w3.org/2000/svg", q = ([e, t, n]) => {
|
|
1544
|
+
let r = document.createElementNS(me, e);
|
|
1545
1545
|
if (t) for (let e in t) r.setAttribute(e, String(t[e]));
|
|
1546
|
-
if (n) for (let e of n) r.appendChild(
|
|
1546
|
+
if (n) for (let e of n) r.appendChild(q(e));
|
|
1547
1547
|
return r;
|
|
1548
|
-
},
|
|
1548
|
+
}, he = () => q([
|
|
1549
1549
|
"svg",
|
|
1550
1550
|
{
|
|
1551
1551
|
class: "iti__search-icon-svg",
|
|
@@ -1565,9 +1565,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1565
1565
|
x2: 16.65,
|
|
1566
1566
|
y2: 16.65
|
|
1567
1567
|
}]]
|
|
1568
|
-
]),
|
|
1568
|
+
]), ge = (e) => {
|
|
1569
1569
|
let t = `iti-${e}-clear-mask`;
|
|
1570
|
-
return
|
|
1570
|
+
return q([
|
|
1571
1571
|
"svg",
|
|
1572
1572
|
{
|
|
1573
1573
|
class: "iti__search-clear-svg",
|
|
@@ -1601,7 +1601,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1601
1601
|
mask: `url(#${t})`
|
|
1602
1602
|
}]]
|
|
1603
1603
|
]);
|
|
1604
|
-
},
|
|
1604
|
+
}, _e = () => q([
|
|
1605
1605
|
"svg",
|
|
1606
1606
|
{
|
|
1607
1607
|
class: "iti__country-check-svg",
|
|
@@ -1613,7 +1613,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1613
1613
|
[R.HIDDEN]: "true"
|
|
1614
1614
|
},
|
|
1615
1615
|
[["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" }]]
|
|
1616
|
-
]),
|
|
1616
|
+
]), J = () => q([
|
|
1617
1617
|
"svg",
|
|
1618
1618
|
{
|
|
1619
1619
|
width: 256,
|
|
@@ -1622,7 +1622,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1622
1622
|
class: "iti__globe-svg"
|
|
1623
1623
|
},
|
|
1624
1624
|
[["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" }], ["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" }]]
|
|
1625
|
-
]), Y = (e) =>
|
|
1625
|
+
]), Y = (e) => fe(e).replace(/[^\p{L}]+/gu, " ").trim(), ve = (e) => {
|
|
1626
1626
|
let t = /* @__PURE__ */ new Map();
|
|
1627
1627
|
for (let n of e) {
|
|
1628
1628
|
let e = Y(n.name), r = e.split(" ").filter(Boolean), i = r.map((e) => e[0] || "").join("");
|
|
@@ -1634,8 +1634,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1634
1634
|
});
|
|
1635
1635
|
}
|
|
1636
1636
|
return t;
|
|
1637
|
-
},
|
|
1638
|
-
let r =
|
|
1637
|
+
}, ye = (e, t, n) => {
|
|
1638
|
+
let r = fe(n), i = Y(n), a = r !== "" && i === "", o = [], s = [], c = [], l = [], u = [], d = [], f = [];
|
|
1639
1639
|
for (let n of e) {
|
|
1640
1640
|
let e = t.get(n.iso2);
|
|
1641
1641
|
n.iso2 === r ? o.push(n) : !a && e.normalisedName.startsWith(i) ? s.push(n) : !a && e.normalisedName.includes(i) ? c.push(n) : r === n.dialCode || r === e.dialCodePlus ? l.push(n) : e.dialCodePlus.includes(r) ? u.push(n) : e.initials.includes(r) && d.push(n);
|
|
@@ -1663,14 +1663,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1663
1663
|
...d,
|
|
1664
1664
|
...f
|
|
1665
1665
|
];
|
|
1666
|
-
},
|
|
1666
|
+
}, be = (e, t, n) => {
|
|
1667
1667
|
let r = Y(n);
|
|
1668
1668
|
for (let n of e) {
|
|
1669
1669
|
let { normalisedName: e } = t.get(n.iso2);
|
|
1670
1670
|
if (e.startsWith(r)) return n;
|
|
1671
1671
|
}
|
|
1672
1672
|
return null;
|
|
1673
|
-
},
|
|
1673
|
+
}, xe = class e {
|
|
1674
1674
|
#e;
|
|
1675
1675
|
static toAscii(e) {
|
|
1676
1676
|
return e ? e.replace(/[٠-٩]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1632))).replace(/[۰-۹]/g, (e) => String.fromCharCode(48 + (e.charCodeAt(0) - 1776))) : "";
|
|
@@ -1692,7 +1692,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1692
1692
|
isAscii() {
|
|
1693
1693
|
return !this.#e || this.#e === "ascii";
|
|
1694
1694
|
}
|
|
1695
|
-
},
|
|
1695
|
+
}, Se = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --x"), Ce = class {
|
|
1696
1696
|
#e;
|
|
1697
1697
|
#t;
|
|
1698
1698
|
#n;
|
|
@@ -1744,32 +1744,32 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1744
1744
|
this.#j(n), n.appendChild(this.telInputEl), this.#F(), this.#z(), this.#I(n), this.ensureDropdownWidthSet();
|
|
1745
1745
|
}
|
|
1746
1746
|
#A() {
|
|
1747
|
-
let { countrySelectorMode: e, showFlags: t, containerClass: n } = this.#e, r =
|
|
1747
|
+
let { countrySelectorMode: e, showFlags: t, containerClass: n } = this.#e, r = pe({
|
|
1748
1748
|
iti: !0,
|
|
1749
1749
|
"iti--input-container": !0,
|
|
1750
1750
|
"iti--has-country-selector": e !== I.OFF,
|
|
1751
1751
|
"iti--show-flags": t,
|
|
1752
1752
|
"iti--inline-country-selector": e !== I.FULLSCREEN,
|
|
1753
1753
|
[n]: !!n
|
|
1754
|
-
}), i =
|
|
1754
|
+
}), i = K("div", { class: this.#k("container", r) });
|
|
1755
1755
|
return this.#n && i.setAttribute("dir", "ltr"), this.telInputEl.before(i), i;
|
|
1756
1756
|
}
|
|
1757
1757
|
#j(e) {
|
|
1758
1758
|
let { countrySelectorMode: t, separateDialCode: n, showFlags: r } = this.#e, i = t !== I.OFF;
|
|
1759
1759
|
if (!i && !r && !n) return;
|
|
1760
|
-
this.#l =
|
|
1760
|
+
this.#l = K("div", { class: this.#k("countryContainer", `iti__country-container ${v.V_HIDE}`) }, e), i ? (this.#u = K("button", {
|
|
1761
1761
|
type: "button",
|
|
1762
1762
|
class: this.#k("selectedCountry", "iti__selected-country"),
|
|
1763
1763
|
[R.EXPANDED]: "false",
|
|
1764
1764
|
[R.LABEL]: this.#e.uiTranslations.noCountrySelected,
|
|
1765
1765
|
[R.HASPOPUP]: "dialog",
|
|
1766
1766
|
[R.CONTROLS]: `iti-${this.#t}__country-selector`
|
|
1767
|
-
}, this.#l), this.telInputEl.disabled && this.#u.setAttribute("disabled", "true")) : this.#u =
|
|
1768
|
-
let a =
|
|
1769
|
-
this.#d =
|
|
1767
|
+
}, this.#l), this.telInputEl.disabled && this.#u.setAttribute("disabled", "true")) : this.#u = K("div", { class: this.#k("selectedCountry", "iti__selected-country") }, this.#l);
|
|
1768
|
+
let a = K("div", { class: this.#k("selectedCountryPrimary", "iti__selected-country-primary") }, this.#u);
|
|
1769
|
+
this.#d = K("div", { class: this.#k("selectedFlag", v.FLAG) }, a), i && (this.#p = K("div", {
|
|
1770
1770
|
class: this.#k("arrow", "iti__arrow"),
|
|
1771
1771
|
[R.HIDDEN]: "true"
|
|
1772
|
-
}, a)), n && (this.#f =
|
|
1772
|
+
}, a)), n && (this.#f = K("div", { class: this.#k("selectedDialCode", "iti__selected-dial-code") }, this.#u)), i && this.#M();
|
|
1773
1773
|
}
|
|
1774
1774
|
ensureDropdownWidthSet() {
|
|
1775
1775
|
let { matchDropdownWidth: e, countrySelectorMode: t } = this.#e;
|
|
@@ -1779,25 +1779,25 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1779
1779
|
}
|
|
1780
1780
|
#M() {
|
|
1781
1781
|
let { matchDropdownWidth: e, countrySelectorMode: t, countrySearch: n, uiTranslations: r, containerClass: i } = this.#e, a = t === I.FULLSCREEN, o = this.#N(), s = e ? "" : "iti--flexible-dropdown-width";
|
|
1782
|
-
if (this.#m =
|
|
1782
|
+
if (this.#m = K("div", {
|
|
1783
1783
|
id: `iti-${this.#t}__country-selector`,
|
|
1784
1784
|
class: this.#k("countrySelector", `iti__country-selector ${v.HIDE} ${s}`),
|
|
1785
1785
|
role: "dialog",
|
|
1786
1786
|
[R.MODAL]: "true"
|
|
1787
|
-
}), this.#n && this.#m.setAttribute("dir", "rtl"), n && this.#P(), this.#v =
|
|
1787
|
+
}), this.#n && this.#m.setAttribute("dir", "rtl"), n && this.#P(), this.#v = K("ul", {
|
|
1788
1788
|
class: this.#k("countryList", "iti__country-list"),
|
|
1789
1789
|
id: `iti-${this.#t}__country-listbox`,
|
|
1790
1790
|
role: "listbox",
|
|
1791
1791
|
[R.LABEL]: r.countryListAriaLabel
|
|
1792
1792
|
}, this.#m), this.#L(), n && this.#U(), o) {
|
|
1793
|
-
let e =
|
|
1793
|
+
let e = pe({
|
|
1794
1794
|
iti: !0,
|
|
1795
1795
|
"iti--detached-country-selector": !0,
|
|
1796
1796
|
"iti--fullscreen-popup": a,
|
|
1797
1797
|
"iti--inline-country-selector": !a,
|
|
1798
1798
|
[i]: !!i
|
|
1799
1799
|
});
|
|
1800
|
-
this.#C =
|
|
1800
|
+
this.#C = K("div", { class: this.#k("countrySelectorContainer", e) }), this.#C.appendChild(this.#m);
|
|
1801
1801
|
} else this.#l.appendChild(this.#m);
|
|
1802
1802
|
}
|
|
1803
1803
|
#N() {
|
|
@@ -1805,11 +1805,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1805
1805
|
return e === I.FULLSCREEN ? document.body : e === I.DROPDOWN ? t : null;
|
|
1806
1806
|
}
|
|
1807
1807
|
#P() {
|
|
1808
|
-
let { uiTranslations: e, searchInputClass: t } = this.#e, n =
|
|
1809
|
-
this.#h =
|
|
1808
|
+
let { uiTranslations: e, searchInputClass: t } = this.#e, n = K("div", { class: this.#k("searchWrapper", "iti__search-input-wrapper") }, this.#m);
|
|
1809
|
+
this.#h = K("span", {
|
|
1810
1810
|
class: this.#k("searchIcon", "iti__search-icon"),
|
|
1811
1811
|
[R.HIDDEN]: "true"
|
|
1812
|
-
}, n), this.#h.appendChild(
|
|
1812
|
+
}, n), this.#h.appendChild(he()), this.#g = K("input", {
|
|
1813
1813
|
id: `iti-${this.#t}__search-input`,
|
|
1814
1814
|
type: "search",
|
|
1815
1815
|
class: this.#k("searchInput", `iti__search-input ${t}`),
|
|
@@ -1820,12 +1820,12 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1820
1820
|
[R.CONTROLS]: `iti-${this.#t}__country-listbox`,
|
|
1821
1821
|
[R.AUTOCOMPLETE]: "list",
|
|
1822
1822
|
autocomplete: "off"
|
|
1823
|
-
}, n), this.#_ =
|
|
1823
|
+
}, n), this.#_ = K("button", {
|
|
1824
1824
|
type: "button",
|
|
1825
1825
|
class: this.#k("searchClear", `iti__search-clear ${v.HIDE}`),
|
|
1826
1826
|
[R.LABEL]: e.clearSearchAriaLabel,
|
|
1827
1827
|
tabindex: "-1"
|
|
1828
|
-
}, n), this.#_.appendChild(
|
|
1828
|
+
}, n), this.#_.appendChild(ge(this.#t)), this.#S = K("span", { class: "iti__a11y-text" }, this.#m), this.#x = K("div", {
|
|
1829
1829
|
class: this.#k("noResults", `iti__no-results ${v.HIDE}`),
|
|
1830
1830
|
[R.HIDDEN]: "true"
|
|
1831
1831
|
}, this.#m), this.#x.textContent = e.searchEmptyState ?? null;
|
|
@@ -1839,14 +1839,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1839
1839
|
let n = t(this.telInputEl.getAttribute("name") || "");
|
|
1840
1840
|
if (n.phone) {
|
|
1841
1841
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.phone}"]`);
|
|
1842
|
-
t ? this.#y = t : (this.#y =
|
|
1842
|
+
t ? this.#y = t : (this.#y = K("input", {
|
|
1843
1843
|
type: "hidden",
|
|
1844
1844
|
name: n.phone
|
|
1845
1845
|
}), e.appendChild(this.#y));
|
|
1846
1846
|
}
|
|
1847
1847
|
if (n.country) {
|
|
1848
1848
|
let t = this.telInputEl.form?.querySelector(`input[name="${n.country}"]`);
|
|
1849
|
-
t ? this.#b = t : (this.#b =
|
|
1849
|
+
t ? this.#b = t : (this.#b = K("input", {
|
|
1850
1850
|
type: "hidden",
|
|
1851
1851
|
name: n.country
|
|
1852
1852
|
}), e.appendChild(this.#b));
|
|
@@ -1855,17 +1855,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1855
1855
|
#L() {
|
|
1856
1856
|
let e = document.createDocumentFragment(), t = this.#k("countryListItem", v.COUNTRY_ITEM);
|
|
1857
1857
|
for (let n = 0; n < this.#i.length; n++) {
|
|
1858
|
-
let r = this.#i[n], i =
|
|
1858
|
+
let r = this.#i[n], i = K("li", {
|
|
1859
1859
|
id: `iti-${this.#t}__item-${r.iso2}`,
|
|
1860
1860
|
class: t,
|
|
1861
1861
|
tabindex: "-1",
|
|
1862
1862
|
role: "option",
|
|
1863
1863
|
[R.SELECTED]: "false"
|
|
1864
1864
|
});
|
|
1865
|
-
i.dataset[L.DIAL_CODE] = r.dialCode, i.dataset[L.ISO2] = r.iso2, this.#E.set(r.iso2, i), this.#e.showFlags &&
|
|
1866
|
-
let a =
|
|
1865
|
+
i.dataset[L.DIAL_CODE] = r.dialCode, i.dataset[L.ISO2] = r.iso2, this.#E.set(r.iso2, i), this.#e.showFlags && K("div", { class: this.#k("countryListItemFlag", `${v.FLAG} iti__${r.iso2}`) }, i);
|
|
1866
|
+
let a = K("span", { class: this.#k("countryName", "iti__country-name") }, i);
|
|
1867
1867
|
a.textContent = `${r.name} `;
|
|
1868
|
-
let o =
|
|
1868
|
+
let o = K("span", { class: this.#k("dialCode", "iti__dial-code") }, a);
|
|
1869
1869
|
this.#n && o.setAttribute("dir", "ltr"), o.textContent = `(+${r.dialCode})`, e.appendChild(i);
|
|
1870
1870
|
}
|
|
1871
1871
|
this.#v.appendChild(e);
|
|
@@ -1900,7 +1900,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1900
1900
|
#H() {
|
|
1901
1901
|
let e = document.body, t = this.#m, n = t.parentNode, r = t.nextSibling;
|
|
1902
1902
|
t.classList.remove(v.HIDE);
|
|
1903
|
-
let i =
|
|
1903
|
+
let i = K("div", { class: "iti iti--inline-country-selector" });
|
|
1904
1904
|
i.appendChild(t), i.style.visibility = "hidden", e.appendChild(i);
|
|
1905
1905
|
let a = t.offsetHeight, o = t.offsetWidth;
|
|
1906
1906
|
return e.removeChild(i), t.classList.add(v.HIDE), n && n.insertBefore(t, r), {
|
|
@@ -1916,8 +1916,8 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1916
1916
|
let t;
|
|
1917
1917
|
if (e === "") t = this.#i;
|
|
1918
1918
|
else {
|
|
1919
|
-
let n =
|
|
1920
|
-
t =
|
|
1919
|
+
let n = xe.toAscii(e);
|
|
1920
|
+
t = ye(this.#i, this.#a, n);
|
|
1921
1921
|
}
|
|
1922
1922
|
this.#ae(t);
|
|
1923
1923
|
}
|
|
@@ -1986,7 +1986,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
1986
1986
|
}
|
|
1987
1987
|
#X(e, t) {
|
|
1988
1988
|
let n = this.#D.signal;
|
|
1989
|
-
this.#Z(n), this.#Q(n, e), this.#e.dropdownAlwaysOpen || this.#$(n, t), this.#ee(n, e, t), this.#e.countrySearch && this.#te(n), this.#e.countrySelectorMode === I.DROPDOWN && this.#e.dropdownParent && !
|
|
1989
|
+
this.#Z(n), this.#Q(n, e), this.#e.dropdownAlwaysOpen || this.#$(n, t), this.#ee(n, e, t), this.#e.countrySearch && this.#te(n), this.#e.countrySelectorMode === I.DROPDOWN && this.#e.dropdownParent && !Se && document.addEventListener("scroll", t, {
|
|
1990
1990
|
signal: n,
|
|
1991
1991
|
capture: !0,
|
|
1992
1992
|
passive: !0
|
|
@@ -2028,7 +2028,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2028
2028
|
this.#g.addEventListener("input", () => this.#K(), { signal: e }), this.#_.addEventListener("click", () => this.#q(), { signal: e });
|
|
2029
2029
|
}
|
|
2030
2030
|
#ne(e) {
|
|
2031
|
-
let t =
|
|
2031
|
+
let t = be(this.#i, this.#a, e);
|
|
2032
2032
|
if (t) {
|
|
2033
2033
|
let e = this.#E.get(t.iso2);
|
|
2034
2034
|
this.#Y(e);
|
|
@@ -2041,10 +2041,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2041
2041
|
#ie(e) {
|
|
2042
2042
|
if (this.#w && this.#w.dataset[L.ISO2] !== e && (this.#w.setAttribute(R.SELECTED, "false"), this.#w.querySelector(".iti__country-check")?.remove(), this.#w = null), e && !this.#w) {
|
|
2043
2043
|
let t = this.#v.querySelector(`[data-iso2="${e}"]`);
|
|
2044
|
-
t && (t.setAttribute(R.SELECTED, "true"),
|
|
2044
|
+
t && (t.setAttribute(R.SELECTED, "true"), K("span", {
|
|
2045
2045
|
class: this.#k("countryCheck", "iti__country-check"),
|
|
2046
2046
|
[R.HIDDEN]: "true"
|
|
2047
|
-
}, t).appendChild(
|
|
2047
|
+
}, t).appendChild(_e()), this.#w = t, this.#e.dropdownAlwaysOpen && this.#Y(t));
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
2050
|
#ae(e) {
|
|
@@ -2073,7 +2073,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2073
2073
|
this.#C.style.paddingLeft = `${e.left}px`, this.#C.style.paddingRight = `${window.innerWidth - e.right}px`;
|
|
2074
2074
|
}
|
|
2075
2075
|
} else this.#ce();
|
|
2076
|
-
if (!e && !
|
|
2076
|
+
if (!e && !Se) {
|
|
2077
2077
|
let e = this.telInputEl.getBoundingClientRect();
|
|
2078
2078
|
this.#C.style.left = `${e.left}px`, this.#oe() ? this.#C.style.top = `${e.bottom + C.DROPDOWN_MARGIN}px` : (this.#C.style.top = "unset", this.#C.style.bottom = `${window.innerHeight - e.top + C.DROPDOWN_MARGIN}px`);
|
|
2079
2079
|
}
|
|
@@ -2115,7 +2115,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2115
2115
|
let { countrySelectorMode: t, showFlags: n, separateDialCode: r, uiTranslations: i } = this.#e, a = e?.name, o = e?.dialCode, s = e?.iso2 ?? "";
|
|
2116
2116
|
if (t !== I.OFF && this.#ie(s), this.#u) {
|
|
2117
2117
|
let e = this.#k("selectedFlag", s && n ? `${v.FLAG} iti__${s}` : `${v.FLAG} ${v.GLOBE}`), t, r, c = null;
|
|
2118
|
-
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c =
|
|
2118
|
+
s ? (r = a, t = i.selectedCountryAriaLabel.replace("${countryName}", a).replace("${dialCode}", `+${o}`), n || (c = J())) : (r = i.noCountrySelected, t = i.noCountrySelected, c = J()), this.#d.className = e, this.#u.setAttribute("title", r), this.#u.setAttribute(R.LABEL, t), c ? this.#d.replaceChildren(c) : this.#d.replaceChildren();
|
|
2119
2119
|
}
|
|
2120
2120
|
if (r) {
|
|
2121
2121
|
let e = o ? `+${o}` : "";
|
|
@@ -2127,10 +2127,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2127
2127
|
let e = this.telInputEl.parentNode;
|
|
2128
2128
|
e && (e.before(this.telInputEl), e.remove()), this.#E.clear();
|
|
2129
2129
|
}
|
|
2130
|
-
},
|
|
2130
|
+
}, we = (e) => {
|
|
2131
2131
|
let { onlyCountries: t, excludeCountries: n } = e;
|
|
2132
2132
|
return t?.length ? h.filter((e) => t.includes(e.iso2)) : n?.length ? h.filter((e) => !n.includes(e.iso2)) : [...h];
|
|
2133
|
-
},
|
|
2133
|
+
}, Te = (e, t) => {
|
|
2134
2134
|
let { countryNameLocale: n, countryNameOverrides: r, uiTranslations: i } = t, a = i?.countryNames, o;
|
|
2135
2135
|
try {
|
|
2136
2136
|
o = typeof Intl < "u" && typeof Intl.DisplayNames == "function" ? new Intl.DisplayNames(n, { type: "region" }) : null;
|
|
@@ -2138,7 +2138,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2138
2138
|
console.error(e), o = null;
|
|
2139
2139
|
}
|
|
2140
2140
|
for (let t of e) t.name = r[t.iso2] || a?.[t.iso2] || o?.of(t.iso2.toUpperCase()) || "";
|
|
2141
|
-
},
|
|
2141
|
+
}, Ee = (e) => {
|
|
2142
2142
|
let t = /* @__PURE__ */ new Set(), n = 0, r = {}, i = (e, t) => {
|
|
2143
2143
|
if (!e || !t) return;
|
|
2144
2144
|
t.length > n && (n = t.length), Object.hasOwn(r, t) || (r[t] = []);
|
|
@@ -2167,7 +2167,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2167
2167
|
dialCodeMaxLength: n,
|
|
2168
2168
|
dialCodeToIso2Map: r
|
|
2169
2169
|
};
|
|
2170
|
-
},
|
|
2170
|
+
}, De = (e, t) => {
|
|
2171
2171
|
let { countryOrder: n } = t;
|
|
2172
2172
|
e.sort((e, t) => {
|
|
2173
2173
|
if (n) {
|
|
@@ -2176,7 +2176,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2176
2176
|
}
|
|
2177
2177
|
return e.name.localeCompare(t.name);
|
|
2178
2178
|
});
|
|
2179
|
-
},
|
|
2179
|
+
}, Oe = /* @__PURE__ */ new Set([
|
|
2180
2180
|
"800",
|
|
2181
2181
|
"808",
|
|
2182
2182
|
"870",
|
|
@@ -2185,17 +2185,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2185
2185
|
"883",
|
|
2186
2186
|
"888",
|
|
2187
2187
|
"979"
|
|
2188
|
-
]),
|
|
2189
|
-
let t =
|
|
2190
|
-
return e.startsWith("+") &&
|
|
2191
|
-
},
|
|
2188
|
+
]), ke = (e) => {
|
|
2189
|
+
let t = G(e).slice(0, 3);
|
|
2190
|
+
return e.startsWith("+") && Oe.has(t);
|
|
2191
|
+
}, Ae = (e, t, n, r) => {
|
|
2192
2192
|
if (!n || !t) return e;
|
|
2193
2193
|
let i = `+${r.dialCode}`, a = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
|
|
2194
2194
|
return e.substring(a);
|
|
2195
|
-
},
|
|
2195
|
+
}, je = (e, t, n, r, i) => {
|
|
2196
2196
|
let a = n ? n.formatNumberAsYouType(e, r?.iso2) : e, o = r?.dialCode;
|
|
2197
2197
|
return i && t.charAt(0) !== "+" && a.includes(`+${o}`) ? (a.split(`+${o}`)[1] || "").trim() : a;
|
|
2198
|
-
},
|
|
2198
|
+
}, Me = (e, t, n, r) => {
|
|
2199
2199
|
if (n === 0 && !r) return 0;
|
|
2200
2200
|
let i = 0;
|
|
2201
2201
|
for (let n = 0; n < t.length; n++) {
|
|
@@ -2203,7 +2203,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2203
2203
|
if (r && i === e + 1) return n;
|
|
2204
2204
|
}
|
|
2205
2205
|
return t.length;
|
|
2206
|
-
},
|
|
2206
|
+
}, Ne = /* @__PURE__ */ new Set([
|
|
2207
2207
|
"800",
|
|
2208
2208
|
"822",
|
|
2209
2209
|
"833",
|
|
@@ -2221,16 +2221,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2221
2221
|
"887",
|
|
2222
2222
|
"888",
|
|
2223
2223
|
"889"
|
|
2224
|
-
]),
|
|
2225
|
-
let t =
|
|
2224
|
+
]), Pe = (e) => {
|
|
2225
|
+
let t = G(e);
|
|
2226
2226
|
if (t.startsWith(w.NANP) && t.length >= 4) {
|
|
2227
2227
|
let e = t.substring(1, 4);
|
|
2228
|
-
return
|
|
2228
|
+
return Ne.has(e);
|
|
2229
2229
|
}
|
|
2230
2230
|
return !1;
|
|
2231
|
-
},
|
|
2231
|
+
}, Fe = 0, X = (e) => {
|
|
2232
2232
|
if (!Q.utils) throw Error(`intlTelInput.utils is required for ${e}(). See: https://intl-tel-input.com/docs/utils`);
|
|
2233
|
-
},
|
|
2233
|
+
}, Ie = () => {
|
|
2234
2234
|
let e, t;
|
|
2235
2235
|
return {
|
|
2236
2236
|
promise: new Promise((n, r) => {
|
|
@@ -2262,13 +2262,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2262
2262
|
#_;
|
|
2263
2263
|
#v;
|
|
2264
2264
|
constructor(e, t = {}) {
|
|
2265
|
-
this.id =
|
|
2266
|
-
let n =
|
|
2265
|
+
this.id = Fe++, Ce.validateInput(e);
|
|
2266
|
+
let n = le(t);
|
|
2267
2267
|
this.#t = {
|
|
2268
2268
|
...B,
|
|
2269
2269
|
...n
|
|
2270
|
-
},
|
|
2271
|
-
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } =
|
|
2270
|
+
}, ue(this.#t), de(this.#t), this.#e = new Ce(e, this.#t, this.id), this.#n = typeof navigator < "u" && /Android/i.test(navigator.userAgent), this.#m = new xe(e.value), this.promise = this.#x(this.#t), this.#r = we(this.#t);
|
|
2271
|
+
let { dialCodes: r, dialCodeMaxLength: i, dialCodeToIso2Map: a } = Ee(this.#r);
|
|
2272
2272
|
this.#o = r, this.#i = i, this.#a = a, this.#s = new Map(this.#r.map((e) => [e.iso2, e])), this.#S();
|
|
2273
2273
|
}
|
|
2274
2274
|
#y() {
|
|
@@ -2280,20 +2280,20 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2280
2280
|
}
|
|
2281
2281
|
#x(e) {
|
|
2282
2282
|
let { initialCountry: t, initialCountryLookup: n, loadUtils: r } = e, i = !t && !!n, a = !!r && !Q.utils;
|
|
2283
|
-
return i && (this.#_ =
|
|
2283
|
+
return i && (this.#_ = Ie()), a && (this.#v = Ie()), Promise.all([this.#_?.promise, this.#v?.promise]).then(() => {});
|
|
2284
2284
|
}
|
|
2285
2285
|
#S() {
|
|
2286
2286
|
this.#p = new AbortController(), this.#C(), this.#e.buildMarkup(this.#r, this.#c), this.#w(), this.#T(), this.#E(), this.#t.dropdownAlwaysOpen && this.openCountrySelector();
|
|
2287
2287
|
}
|
|
2288
2288
|
#C() {
|
|
2289
|
-
|
|
2289
|
+
Te(this.#r, this.#t), De(this.#r, this.#t), this.#c = ve(this.#r);
|
|
2290
2290
|
}
|
|
2291
2291
|
#w(e = !1) {
|
|
2292
|
-
let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#y(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#
|
|
2293
|
-
a ? o ? f ? this.#
|
|
2292
|
+
let t = this.#e.telInputEl.getAttribute("value"), n = this.#m.normalise(t ?? ""), r = this.#y(), i = n && n.startsWith("+") && (!r || !r.startsWith("+")) ? n : r, a = this.#re(i), o = Pe(i), { initialCountry: s, initialCountryLookup: c } = this.#t, l = !s && !!c, u = l && Q.autoCountry ? Q.autoCountry : s, d = l && !e && !Q.autoCountry, f = m(u);
|
|
2293
|
+
a ? o ? f ? this.#Z(u) : d || this.#Z(D.ISO2) : (f && this.#Z(u), this.#q(i)) : f ? this.#Z(u) : d || this.#Z(""), i && this.#K(i);
|
|
2294
2294
|
}
|
|
2295
2295
|
#T() {
|
|
2296
|
-
this.#A(), this.#t.countrySelectorMode !== I.OFF && this.#e.bindAllInitialCountrySelectorListeners(this.#p.signal, () => this.openCountrySelector(), () => this.#
|
|
2296
|
+
this.#A(), this.#t.countrySelectorMode !== I.OFF && this.#e.bindAllInitialCountrySelectorListeners(this.#p.signal, () => this.openCountrySelector(), () => this.#te()), this.#e.bindHiddenInputSubmitListener(this.#p.signal, () => this.getNumber(), () => this.#l?.iso2 || "");
|
|
2297
2297
|
}
|
|
2298
2298
|
#E() {
|
|
2299
2299
|
if (this.#v) {
|
|
@@ -2306,7 +2306,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2306
2306
|
}
|
|
2307
2307
|
async #D() {
|
|
2308
2308
|
if (Q.autoCountry) {
|
|
2309
|
-
this.#
|
|
2309
|
+
this.#ce();
|
|
2310
2310
|
return;
|
|
2311
2311
|
}
|
|
2312
2312
|
if (this.#e.setLoading(!0), !Q.startedLoadingAutoCountry && (Q.startedLoadingAutoCountry = !0, typeof this.#t.initialCountryLookup == "function")) {
|
|
@@ -2342,19 +2342,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2342
2342
|
}
|
|
2343
2343
|
#M(e, t) {
|
|
2344
2344
|
let n = this.#k(e);
|
|
2345
|
-
this.#e.telInputEl.setSelectionRange(n, n), this.#e.playStrictRejectAnimation(), this.#
|
|
2345
|
+
this.#e.telInputEl.setSelectionRange(n, n), this.#e.playStrictRejectAnimation(), this.#G(g.STRICT_REJECT, {
|
|
2346
2346
|
source: "key",
|
|
2347
2347
|
rejectedInput: t,
|
|
2348
2348
|
reason: "invalid"
|
|
2349
2349
|
});
|
|
2350
2350
|
}
|
|
2351
2351
|
#N(e, t) {
|
|
2352
|
-
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(x.NON_PLUS_NUMERIC_GLOBAL, "").length, i =
|
|
2352
|
+
let n = this.#e.telInputEl.selectionStart || 0, r = e.substring(0, n).replace(x.NON_PLUS_NUMERIC_GLOBAL, "").length, i = je(this.#ae(), e, Q.utils, this.#l, this.#t.separateDialCode), a = Me(r, i, n, t);
|
|
2353
2353
|
this.#b(i), this.#e.telInputEl.setSelectionRange(a, a);
|
|
2354
2354
|
}
|
|
2355
2355
|
#P(e) {
|
|
2356
|
-
if (e.startsWith("+") && this.#l && this.#
|
|
2357
|
-
let t =
|
|
2356
|
+
if (e.startsWith("+") && this.#l && this.#re(e)) {
|
|
2357
|
+
let t = Ae(e, !0, !0, this.#l);
|
|
2358
2358
|
this.#b(t);
|
|
2359
2359
|
}
|
|
2360
2360
|
}
|
|
@@ -2377,7 +2377,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2377
2377
|
if (this.#V()) return;
|
|
2378
2378
|
s = this.#y();
|
|
2379
2379
|
}
|
|
2380
|
-
this.#
|
|
2380
|
+
this.#q(s) && (this.#se(), this.#G(g.INPUT, { isCountryChange: !0 })), !l && e?.data && x.NON_PLUS_NUMERIC.test(e.data) || c && s && !t ? this.#h = !0 : x.NON_PLUS_NUMERIC.test(s) || (this.#h = !1), n && !this.#h && !o?.isSetNumber && this.#m.isAscii() && this.#N(s, e?.inputType === b.DELETE_FORWARD), r && this.#P(s);
|
|
2381
2381
|
};
|
|
2382
2382
|
#L() {
|
|
2383
2383
|
let { strictMode: e, separateDialCode: t } = this.#t;
|
|
@@ -2391,10 +2391,10 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2391
2391
|
return;
|
|
2392
2392
|
}
|
|
2393
2393
|
if (!t) return;
|
|
2394
|
-
let a = this.#y(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#m.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.#
|
|
2395
|
-
Q.utils && this.#u && (v = Q.utils.getCoreNumber(_, this.#l?.iso2).length > this.#u);
|
|
2396
|
-
let y = this.#
|
|
2397
|
-
(!l || v && !y && !o) && (this.#e.playStrictRejectAnimation(), this.#
|
|
2394
|
+
let a = this.#y(), o = !a.startsWith("+") && this.#e.telInputEl.selectionStart === 0 && e.key === "+", s = this.#m.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.#ie(h), v = G(_).length > T;
|
|
2395
|
+
!v && Q.utils && this.#u && (v = Q.utils.getCoreNumber(_, this.#l?.iso2).length > this.#u);
|
|
2396
|
+
let y = this.#Y(_) !== null;
|
|
2397
|
+
(!l || v && !y && !o) && (this.#e.playStrictRejectAnimation(), this.#G(g.STRICT_REJECT, {
|
|
2398
2398
|
source: "key",
|
|
2399
2399
|
rejectedInput: e.key,
|
|
2400
2400
|
reason: l ? "max-length" : "invalid"
|
|
@@ -2416,44 +2416,44 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2416
2416
|
let e = this.#e.telInputEl, t = this.#g;
|
|
2417
2417
|
if (this.#g = null, !t) return !1;
|
|
2418
2418
|
let n = t.pastedRaw, r = t.value, i = t.selectionStart, a = t.selectionEnd, o = r.slice(0, i), s = r.slice(a), c = this.#l?.iso2, l = this.#m.normalise(n), u = i === 0 && a > 0, d = !r.startsWith("+") || u, f = l.replace(x.NON_PLUS_NUMERIC_GLOBAL, ""), p = f.startsWith("+"), m = f.replace(/\+/g, ""), h = p && d ? `+${m}` : m, _ = o + h + s, v = h === l ? null : "invalid";
|
|
2419
|
-
if (_.length > 30) return this.#
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2419
|
+
if (_.length > 30) return this.#H(t), !0;
|
|
2420
|
+
let y = G(this.#ie(_)).length - T;
|
|
2421
|
+
if (y > 0) {
|
|
2422
|
+
if (a !== r.length) return this.#H(t), !0;
|
|
2423
|
+
_ = _.slice(0, _.length - y), v = "max-length";
|
|
2424
|
+
}
|
|
2425
|
+
if (this.#u && _.length > 5 && Q.utils) {
|
|
2425
2426
|
let e = Q.utils.getCoreNumber(_, c);
|
|
2426
2427
|
for (; e.length === 0 && _.length > 0;) _ = _.slice(0, -1), e = Q.utils.getCoreNumber(_, c);
|
|
2427
|
-
if (!e) return this.#
|
|
2428
|
-
|
|
2429
|
-
rejectedInput: n,
|
|
2430
|
-
reason: "max-length"
|
|
2431
|
-
}), this.#H(t), !0;
|
|
2432
|
-
if (this.#u && e.length > this.#u) if (a === r.length) {
|
|
2428
|
+
if (!e) return this.#H(t), !0;
|
|
2429
|
+
if (e.length > this.#u) if (a === r.length) {
|
|
2433
2430
|
let t = e.length - this.#u;
|
|
2434
2431
|
_ = _.slice(0, _.length - t), v = "max-length";
|
|
2435
|
-
} else return this.#
|
|
2436
|
-
source: "paste",
|
|
2437
|
-
rejectedInput: n,
|
|
2438
|
-
reason: "max-length"
|
|
2439
|
-
}), this.#H(t), !0;
|
|
2432
|
+
} else return this.#H(t), !0;
|
|
2440
2433
|
}
|
|
2441
2434
|
this.#b(_);
|
|
2442
|
-
let
|
|
2443
|
-
return e.setSelectionRange(
|
|
2435
|
+
let b = i + h.length;
|
|
2436
|
+
return e.setSelectionRange(b, b), v && (l.length > 0 && h.length === 0 && this.#e.playStrictRejectAnimation(), this.#G(g.STRICT_REJECT, {
|
|
2444
2437
|
source: "paste",
|
|
2445
2438
|
rejectedInput: n,
|
|
2446
2439
|
reason: v
|
|
2447
2440
|
})), !1;
|
|
2448
2441
|
}
|
|
2449
2442
|
#H(e) {
|
|
2450
|
-
this.#
|
|
2443
|
+
this.#e.playStrictRejectAnimation(), this.#G(g.STRICT_REJECT, {
|
|
2444
|
+
source: "paste",
|
|
2445
|
+
rejectedInput: e.pastedRaw,
|
|
2446
|
+
reason: "max-length"
|
|
2447
|
+
}), this.#U(e);
|
|
2451
2448
|
}
|
|
2452
2449
|
#U(e) {
|
|
2450
|
+
this.#b(e.value), this.#e.telInputEl.setSelectionRange(e.selectionStart, e.selectionEnd);
|
|
2451
|
+
}
|
|
2452
|
+
#W(e) {
|
|
2453
2453
|
let t = Number(this.#e.telInputEl.getAttribute("maxlength"));
|
|
2454
2454
|
return t && e.length > t ? e.substring(0, t) : e;
|
|
2455
2455
|
}
|
|
2456
|
-
#
|
|
2456
|
+
#G(e, t = {}) {
|
|
2457
2457
|
let n = new CustomEvent(e, {
|
|
2458
2458
|
bubbles: !0,
|
|
2459
2459
|
cancelable: !0,
|
|
@@ -2462,41 +2462,41 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2462
2462
|
this.#e.telInputEl.dispatchEvent(n);
|
|
2463
2463
|
}
|
|
2464
2464
|
openCountrySelector() {
|
|
2465
|
-
this.#e.isCountrySelectorOpen() || (this.#e.openCountrySelector((e) => this
|
|
2465
|
+
this.#e.isCountrySelectorOpen() || (this.#e.openCountrySelector((e) => this.#ee(e), () => this.#te()), this.#G(g.OPEN_COUNTRY_SELECTOR));
|
|
2466
2466
|
}
|
|
2467
|
-
#
|
|
2467
|
+
#K(e) {
|
|
2468
2468
|
let { numberDisplayFormat: t, separateDialCode: n } = this.#t, r = e;
|
|
2469
2469
|
if (Q.utils && this.#l) {
|
|
2470
|
-
let i =
|
|
2470
|
+
let i = ke(e), a = !r.startsWith("+") && !n, o = t === N.NATIONAL && !i || a, s;
|
|
2471
2471
|
s = o ? N.NATIONAL : t === N.E164 && !i ? N.E164 : N.INTERNATIONAL, r = Q.utils.formatNumber(r, this.#l?.iso2, s);
|
|
2472
2472
|
}
|
|
2473
|
-
r = this.#
|
|
2474
|
-
}
|
|
2475
|
-
#K(e) {
|
|
2476
|
-
let t = this.#J(e);
|
|
2477
|
-
return t === null ? !1 : this.#X(t);
|
|
2473
|
+
r = this.#oe(r), this.#b(r);
|
|
2478
2474
|
}
|
|
2479
2475
|
#q(e) {
|
|
2476
|
+
let t = this.#Y(e);
|
|
2477
|
+
return t === null ? !1 : this.#Z(t);
|
|
2478
|
+
}
|
|
2479
|
+
#J(e) {
|
|
2480
2480
|
let t = this.#l?.dialCode, n = this.#l?.nationalPrefix;
|
|
2481
2481
|
return e.startsWith("+") || !t ? e : `+${t}${n && e.startsWith(n) && !this.#t.separateDialCode ? e.substring(1) : e}`;
|
|
2482
2482
|
}
|
|
2483
|
-
#
|
|
2483
|
+
#Y(e) {
|
|
2484
2484
|
let t = e.indexOf("+"), n = t > 0 ? e.substring(t) : e, r = this.#l?.iso2;
|
|
2485
|
-
n = this.#
|
|
2486
|
-
let i = this.#
|
|
2485
|
+
n = this.#J(n);
|
|
2486
|
+
let i = this.#re(n, !0), a = G(n);
|
|
2487
2487
|
if (i) {
|
|
2488
|
-
let e =
|
|
2489
|
-
return t.length === 1 ? t[0] === r ? null : t[0] : this.#
|
|
2488
|
+
let e = G(i), t = this.#a[e];
|
|
2489
|
+
return t.length === 1 ? t[0] === r ? null : t[0] : this.#X(t, e, a);
|
|
2490
2490
|
} else if (n.startsWith("+") && a.length) {
|
|
2491
2491
|
let e = this.#l?.dialCode || "";
|
|
2492
|
-
return e && e.startsWith(a) ? null : "";
|
|
2492
|
+
return e && e.startsWith(a) || !r ? null : "";
|
|
2493
2493
|
} else if ((!n || n === "+") && !r && this.#d) return this.#d;
|
|
2494
2494
|
return null;
|
|
2495
2495
|
}
|
|
2496
|
-
#
|
|
2496
|
+
#X(e, t, n) {
|
|
2497
2497
|
let r = this.#l?.iso2, i = this.#l?.dialCode;
|
|
2498
2498
|
if (!r && this.#d && e.includes(this.#d)) return this.#d;
|
|
2499
|
-
if (i === w.NANP &&
|
|
2499
|
+
if (i === w.NANP && Pe(n)) return null;
|
|
2500
2500
|
let a = this.#l?.areaCodes, o = this.#l?.priority;
|
|
2501
2501
|
if (a) {
|
|
2502
2502
|
let e = a.map((e) => `${i}${e}`);
|
|
@@ -2505,11 +2505,11 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2505
2505
|
let s = a && o !== 0 && n.length > t.length, c = r && e.includes(r) && !s, l = r === e[0];
|
|
2506
2506
|
return !c && !l ? e[0] : null;
|
|
2507
2507
|
}
|
|
2508
|
-
#
|
|
2508
|
+
#Z(e) {
|
|
2509
2509
|
let t = this.#l?.iso2 || "";
|
|
2510
|
-
return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.setSelectedCountry(this.#l), this
|
|
2510
|
+
return this.#l = e ? this.#s.get(e) : null, this.#l && (this.#d = this.#l.iso2), this.#e.setSelectedCountry(this.#l), this.#$(), this.#Q(), t !== e;
|
|
2511
2511
|
}
|
|
2512
|
-
#
|
|
2512
|
+
#Q() {
|
|
2513
2513
|
let { strictMode: e, placeholderNumberType: t, allowedNumberTypes: n } = this.#t;
|
|
2514
2514
|
if (!e || !Q.utils) return;
|
|
2515
2515
|
let r = this.#l?.iso2;
|
|
@@ -2522,34 +2522,34 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2522
2522
|
let o = Q.utils.getCoreNumber(a, r);
|
|
2523
2523
|
this.#u = o.length, r === "by" && (this.#u = o.length + 1);
|
|
2524
2524
|
}
|
|
2525
|
-
|
|
2526
|
-
let { placeholderNumberPolicy: e, placeholderNumberType: t, numberDisplayFormat: n, customPlaceholder: r } = this.#t, i = e ===
|
|
2525
|
+
#$() {
|
|
2526
|
+
let { placeholderNumberPolicy: e, placeholderNumberType: t, numberDisplayFormat: n, customPlaceholder: r } = this.#t, i = e === O.AGGRESSIVE || !this.#e.hadInitialPlaceholder && e === O.POLITE;
|
|
2527
2527
|
if (!Q.utils || !i) return;
|
|
2528
2528
|
let a = this.#l ? Q.utils.getExampleNumber(this.#l.iso2, t, n) : "";
|
|
2529
|
-
a = this.#
|
|
2529
|
+
a = this.#oe(a), typeof r == "function" && (a = r(a, this.#l)), this.#e.telInputEl.setAttribute("placeholder", a);
|
|
2530
2530
|
}
|
|
2531
|
-
|
|
2531
|
+
#ee(e) {
|
|
2532
2532
|
if (!e) return;
|
|
2533
|
-
let t = e.dataset[L.ISO2], n = this.#
|
|
2534
|
-
this.#
|
|
2533
|
+
let t = e.dataset[L.ISO2], n = this.#Z(t);
|
|
2534
|
+
this.#te();
|
|
2535
2535
|
let r = e.dataset[L.DIAL_CODE];
|
|
2536
|
-
this.#
|
|
2536
|
+
this.#ne(r);
|
|
2537
2537
|
let i = this.#y();
|
|
2538
|
-
this.#
|
|
2538
|
+
this.#K(i), this.#e.telInputEl.focus(), n && (this.#se(), this.#G(g.INPUT, { isCountryChange: !0 }));
|
|
2539
2539
|
}
|
|
2540
2540
|
closeCountrySelector() {
|
|
2541
|
-
this.#
|
|
2542
|
-
}
|
|
2543
|
-
#ee(e) {
|
|
2544
|
-
!this.#e.isCountrySelectorOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeCountrySelector(), this.#W(g.CLOSE_COUNTRY_SELECTOR));
|
|
2541
|
+
this.#te();
|
|
2545
2542
|
}
|
|
2546
2543
|
#te(e) {
|
|
2544
|
+
!this.#e.isCountrySelectorOpen() || this.#t.dropdownAlwaysOpen && !e || (this.#e.closeCountrySelector(), this.#G(g.CLOSE_COUNTRY_SELECTOR));
|
|
2545
|
+
}
|
|
2546
|
+
#ne(e) {
|
|
2547
2547
|
let t = this.#y();
|
|
2548
2548
|
if (!t.startsWith("+")) return;
|
|
2549
|
-
let n = `+${e}`, r = this.#
|
|
2549
|
+
let n = `+${e}`, r = this.#re(t), i;
|
|
2550
2550
|
i = r ? t.replace(r, n) : n, this.#b(i);
|
|
2551
2551
|
}
|
|
2552
|
-
#
|
|
2552
|
+
#re(e, t) {
|
|
2553
2553
|
if (!e.startsWith("+")) return "";
|
|
2554
2554
|
let n = "", r = "", i = !1;
|
|
2555
2555
|
for (let a = 0; a < e.length; a++) {
|
|
@@ -2564,22 +2564,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2564
2564
|
}
|
|
2565
2565
|
return n;
|
|
2566
2566
|
}
|
|
2567
|
-
#
|
|
2568
|
-
let t = this.#l?.dialCode, n =
|
|
2567
|
+
#ie(e) {
|
|
2568
|
+
let t = this.#l?.dialCode, n = G(e);
|
|
2569
2569
|
return (this.#t.separateDialCode && !e.startsWith("+") && t && n ? `+${t}` : "") + e;
|
|
2570
2570
|
}
|
|
2571
|
-
#
|
|
2571
|
+
#ae() {
|
|
2572
2572
|
let e = this.#y();
|
|
2573
|
-
return this.#
|
|
2573
|
+
return this.#ie(e);
|
|
2574
2574
|
}
|
|
2575
|
-
#
|
|
2576
|
-
let t =
|
|
2577
|
-
return this.#
|
|
2578
|
-
}
|
|
2579
|
-
#oe() {
|
|
2580
|
-
this.#W(g.COUNTRY_CHANGE, this.#l ?? null);
|
|
2575
|
+
#oe(e) {
|
|
2576
|
+
let t = Ae(e, !!this.#re(e), this.#t.separateDialCode, this.#l);
|
|
2577
|
+
return this.#W(t);
|
|
2581
2578
|
}
|
|
2582
2579
|
#se() {
|
|
2580
|
+
this.#G(g.COUNTRY_CHANGE, this.#l ?? null);
|
|
2581
|
+
}
|
|
2582
|
+
#ce() {
|
|
2583
2583
|
if (!this.#_ || !Q.autoCountry) return;
|
|
2584
2584
|
if (!this.#f) {
|
|
2585
2585
|
this.#_.resolve();
|
|
@@ -2588,14 +2588,14 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2588
2588
|
let e = document.activeElement === this.#e.telInputEl, t = !!this.#y();
|
|
2589
2589
|
this.#e.isLoading() && !(e && t) ? this.setSelectedCountry(Q.autoCountry) : this.#d = Q.autoCountry, this.#e.setLoading(!1), this.#_.resolve();
|
|
2590
2590
|
}
|
|
2591
|
-
#
|
|
2591
|
+
#le() {
|
|
2592
2592
|
if (!this.#f) {
|
|
2593
2593
|
this.#_?.reject();
|
|
2594
2594
|
return;
|
|
2595
2595
|
}
|
|
2596
|
-
this.#w(!0), this.#e.setLoading(!1), this.#_?.reject();
|
|
2596
|
+
this.#e.isLoading() && this.#w(!0), this.#e.setLoading(!1), this.#_?.reject();
|
|
2597
2597
|
}
|
|
2598
|
-
#
|
|
2598
|
+
#ue() {
|
|
2599
2599
|
if (!this.#f) {
|
|
2600
2600
|
this.#v?.resolve();
|
|
2601
2601
|
return;
|
|
@@ -2605,9 +2605,9 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2605
2605
|
return;
|
|
2606
2606
|
}
|
|
2607
2607
|
let e = this.#y(), t = document.activeElement === this.#e.telInputEl;
|
|
2608
|
-
e && !t && this.#
|
|
2608
|
+
e && !t && this.#K(e), this.#l && (this.#$(), this.#Q()), this.#v?.resolve();
|
|
2609
2609
|
}
|
|
2610
|
-
#
|
|
2610
|
+
#de(e) {
|
|
2611
2611
|
if (!this.#f) {
|
|
2612
2612
|
this.#v?.reject(e);
|
|
2613
2613
|
return;
|
|
@@ -2615,22 +2615,22 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2615
2615
|
this.#v?.reject(e);
|
|
2616
2616
|
}
|
|
2617
2617
|
destroy() {
|
|
2618
|
-
this.#f && (this.#f = !1, this.#t.countrySelectorMode !== I.OFF && this.#
|
|
2618
|
+
this.#f && (this.#f = !1, this.#t.countrySelectorMode !== I.OFF && this.#te(!0), this.#p.abort(), this.#e.destroy(), Q.instances.delete(String(this.id)));
|
|
2619
2619
|
}
|
|
2620
2620
|
isActive() {
|
|
2621
2621
|
return this.#f;
|
|
2622
2622
|
}
|
|
2623
2623
|
getExtension() {
|
|
2624
|
-
return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#
|
|
2624
|
+
return this.#f ? (X("getExtension"), Q.utils.getExtension(this.#ae(), this.#l?.iso2)) : "";
|
|
2625
2625
|
}
|
|
2626
2626
|
getNumber(e) {
|
|
2627
2627
|
if (!this.#f) return "";
|
|
2628
2628
|
X("getNumber");
|
|
2629
|
-
let t = this.#l?.iso2, n = this.#
|
|
2629
|
+
let t = this.#l?.iso2, n = this.#ae(), r = Q.utils.formatNumber(n, t, e);
|
|
2630
2630
|
return this.#m.denormalise(r);
|
|
2631
2631
|
}
|
|
2632
2632
|
getNumberType() {
|
|
2633
|
-
return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#
|
|
2633
|
+
return this.#f ? (X("getNumberType"), Q.utils.getNumberType(this.#ae(), this.#l?.iso2)) : null;
|
|
2634
2634
|
}
|
|
2635
2635
|
getSelectedCountry() {
|
|
2636
2636
|
return this.#l ?? null;
|
|
@@ -2639,27 +2639,27 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2639
2639
|
if (!this.#f) return null;
|
|
2640
2640
|
X("getValidationError");
|
|
2641
2641
|
let e = this.#l?.iso2;
|
|
2642
|
-
return Q.utils.getValidationError(this.#
|
|
2642
|
+
return Q.utils.getValidationError(this.#ae(), e);
|
|
2643
2643
|
}
|
|
2644
2644
|
isValidNumber() {
|
|
2645
2645
|
if (!this.#f) return null;
|
|
2646
2646
|
X("isValidNumber");
|
|
2647
|
-
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#
|
|
2647
|
+
let e = this.#l?.dialCode, t = this.#l?.iso2, n = this.#ae(), r = Q.utils.getCoreNumber(n, t);
|
|
2648
2648
|
if (r) {
|
|
2649
|
-
if (e ===
|
|
2649
|
+
if (e === E.DIAL_CODE && r[0] === E.MOBILE_PREFIX && r.length !== E.MOBILE_CORE_LENGTH) return !1;
|
|
2650
2650
|
if (!x.ALPHA_UNICODE.test(n) && e) {
|
|
2651
|
-
let t =
|
|
2651
|
+
let t = G(n.startsWith("+") ? n.slice(1 + e.length) : n).length;
|
|
2652
2652
|
if (r.length > t) return !1;
|
|
2653
2653
|
}
|
|
2654
2654
|
}
|
|
2655
|
-
return this.#
|
|
2655
|
+
return this.#fe("possible");
|
|
2656
2656
|
}
|
|
2657
2657
|
isValidNumberPrecise() {
|
|
2658
|
-
return this.#f ? (X("isValidNumberPrecise"), this.#
|
|
2658
|
+
return this.#f ? (X("isValidNumberPrecise"), this.#fe("precise")) : null;
|
|
2659
2659
|
}
|
|
2660
|
-
#
|
|
2661
|
-
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#
|
|
2662
|
-
return !this.#l && !
|
|
2660
|
+
#fe(e) {
|
|
2661
|
+
let { allowNumberExtensions: t, allowPhonewords: n, allowedNumberTypes: r } = this.#t, i = this.#l?.iso2, a = this.#ae();
|
|
2662
|
+
return !this.#l && !ke(a) || !(e === "precise" ? Q.utils.isValidNumberPrecise : Q.utils.isValidNumber)(a, i, r) ? !1 : x.ALPHA_UNICODE.test(a) ? Q.utils.getExtension(a, i) ? t : n : !0;
|
|
2663
2663
|
}
|
|
2664
2664
|
setSelectedCountry(e) {
|
|
2665
2665
|
if (!this.#f) return;
|
|
@@ -2667,17 +2667,17 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2667
2667
|
if (!m(t)) throw Error(`Invalid iso2 code: '${t}'`);
|
|
2668
2668
|
let n = this.#l?.iso2;
|
|
2669
2669
|
if (!(e && t !== n || !e && n)) return;
|
|
2670
|
-
this.#
|
|
2670
|
+
this.#Z(t), this.#ne(this.#l?.dialCode || "");
|
|
2671
2671
|
let r = this.#y();
|
|
2672
|
-
this.#
|
|
2672
|
+
this.#K(r), this.#se(), this.#G(g.INPUT, { isCountryChange: !0 });
|
|
2673
2673
|
}
|
|
2674
2674
|
setNumber(e) {
|
|
2675
2675
|
if (!this.#f) return;
|
|
2676
|
-
let t = this.#m.normalise(e), n = this.#
|
|
2677
|
-
this.#
|
|
2676
|
+
let t = this.#m.normalise(e), n = this.#q(t);
|
|
2677
|
+
this.#K(t), n && this.#se(), this.#G(g.INPUT, { isSetNumber: !0 });
|
|
2678
2678
|
}
|
|
2679
2679
|
setPlaceholderNumberType(e) {
|
|
2680
|
-
this.#f && (this.#t.placeholderNumberType = e, this
|
|
2680
|
+
this.#f && (this.#t.placeholderNumberType = e, this.#$());
|
|
2681
2681
|
}
|
|
2682
2682
|
setDisabled(e) {
|
|
2683
2683
|
this.#f && this.#e.setDisabled(e);
|
|
@@ -2690,16 +2690,16 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2690
2690
|
r.forEach((n) => {
|
|
2691
2691
|
if (n instanceof e) switch (t) {
|
|
2692
2692
|
case "handleUtilsLoaded":
|
|
2693
|
-
n.#
|
|
2693
|
+
n.#ue();
|
|
2694
2694
|
break;
|
|
2695
2695
|
case "handleUtilsFailure":
|
|
2696
|
-
n.#
|
|
2696
|
+
n.#de(i);
|
|
2697
2697
|
break;
|
|
2698
2698
|
case "handleAutoCountryLoaded":
|
|
2699
|
-
n.#
|
|
2699
|
+
n.#ce();
|
|
2700
2700
|
break;
|
|
2701
2701
|
case "handleAutoCountryFailure":
|
|
2702
|
-
n.#
|
|
2702
|
+
n.#le();
|
|
2703
2703
|
break;
|
|
2704
2704
|
}
|
|
2705
2705
|
});
|
|
@@ -2730,13 +2730,13 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2730
2730
|
},
|
|
2731
2731
|
startedLoadingUtils: !1,
|
|
2732
2732
|
startedLoadingAutoCountry: !1,
|
|
2733
|
-
version: "29.2.
|
|
2733
|
+
version: "29.2.2",
|
|
2734
2734
|
NUMBER_FORMAT: N,
|
|
2735
2735
|
NUMBER_TYPE: P,
|
|
2736
2736
|
VALIDATION_ERROR: F,
|
|
2737
|
-
PLACEHOLDER_POLICY:
|
|
2737
|
+
PLACEHOLDER_POLICY: O,
|
|
2738
2738
|
COUNTRY_SELECTOR_MODE: I
|
|
2739
|
-
}), $ = Q,
|
|
2739
|
+
}), $ = Q, Le = /* @__PURE__ */ n({
|
|
2740
2740
|
inheritAttrs: !1,
|
|
2741
2741
|
__name: "IntlTelInput",
|
|
2742
2742
|
props: {
|
|
@@ -2825,7 +2825,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2825
2825
|
}
|
|
2826
2826
|
let e = A(), t = e ? null : w.value.getValidationError();
|
|
2827
2827
|
e !== D.value && (D.value = e, m("changeValidity", e)), t !== O.value && (O.value = t, m("changeErrorCode", t));
|
|
2828
|
-
},
|
|
2828
|
+
}, ee = () => {
|
|
2829
2829
|
if (!w.value?.isActive()) return;
|
|
2830
2830
|
if (!$.utils) {
|
|
2831
2831
|
k = !0;
|
|
@@ -2833,19 +2833,19 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2833
2833
|
}
|
|
2834
2834
|
let e = w.value.getNumber() ?? "";
|
|
2835
2835
|
e !== T.value && (T.value = e, m("changeNumber", e), m("update:modelValue", e)), j();
|
|
2836
|
-
},
|
|
2836
|
+
}, M = () => {
|
|
2837
2837
|
if (!w.value?.isActive()) return;
|
|
2838
2838
|
let e = w.value.getSelectedCountry()?.iso2 ?? "";
|
|
2839
|
-
e !== E.value && (E.value = e, m("changeCountry", e)),
|
|
2840
|
-
},
|
|
2839
|
+
e !== E.value && (E.value = e, m("changeCountry", e)), ee();
|
|
2840
|
+
}, N = () => m("openCountrySelector"), P = () => m("closeCountrySelector"), F = (e) => {
|
|
2841
2841
|
let { source: t, rejectedInput: n, reason: r } = e.detail;
|
|
2842
2842
|
m("strictReject", t, n, r);
|
|
2843
2843
|
};
|
|
2844
2844
|
return a(() => {
|
|
2845
2845
|
if (!C.value) return;
|
|
2846
2846
|
let e = new Set(C.value.classList);
|
|
2847
|
-
w.value = $(C.value, S.value), _.value = Array.from(C.value.classList).filter((t) => !e.has(t)).join(" "), C.value.addEventListener("input",
|
|
2848
|
-
w.value?.isActive() && (y.value && w.value.setNumber(y.value), k ? (k = !1,
|
|
2847
|
+
w.value = $(C.value, S.value), _.value = Array.from(C.value.classList).filter((t) => !e.has(t)).join(" "), C.value.addEventListener("input", M), C.value.addEventListener("open:countryselector", N), C.value.addEventListener("close:countryselector", P), C.value.addEventListener("strict:reject", F), p.disabled && w.value.setDisabled(p.disabled), p.readonly && w.value.setReadonly(p.readonly), E.value = w.value.getSelectedCountry()?.iso2 ?? "", w.value.promise.then(() => {
|
|
2848
|
+
w.value?.isActive() && (y.value && w.value.setNumber(y.value), k ? (k = !1, M()) : (T.value = w.value.getNumber() ?? "", D.value = A(), O.value = D.value ? null : w.value.getValidationError()));
|
|
2849
2849
|
});
|
|
2850
2850
|
}), u(() => p.disabled, (e) => w.value?.setDisabled(e)), u(() => p.readonly, (e) => w.value?.setReadonly(e)), u(() => y.value, (e) => {
|
|
2851
2851
|
w.value && w.value.promise.then(() => {
|
|
@@ -2854,7 +2854,7 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2854
2854
|
document.activeElement === C.value || n === t || (w.value.setNumber(t), j());
|
|
2855
2855
|
});
|
|
2856
2856
|
}, { flush: "post" }), o(() => {
|
|
2857
|
-
C.value && (C.value.removeEventListener("input",
|
|
2857
|
+
C.value && (C.value.removeEventListener("input", M), C.value.removeEventListener("open:countryselector", N), C.value.removeEventListener("close:countryselector", P), C.value.removeEventListener("strict:reject", F)), w.value?.destroy();
|
|
2858
2858
|
}), d({
|
|
2859
2859
|
instance: w,
|
|
2860
2860
|
input: C
|
|
@@ -2866,4 +2866,4 @@ var p = new Set(f.map((e) => e.iso2)), m = (e) => p.has(e), h = f, g = {
|
|
|
2866
2866
|
}
|
|
2867
2867
|
});
|
|
2868
2868
|
//#endregion
|
|
2869
|
-
export { $ as n,
|
|
2869
|
+
export { $ as n, Le as t };
|
package/dist/IntlTelInput.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intl-tel-input/vue",
|
|
3
|
-
"version": "29.2.
|
|
3
|
+
"version": "29.2.2",
|
|
4
4
|
"description": "A Vue component for intl-tel-input, for entering, formatting, and validating international telephone numbers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"README.md"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"intl-tel-input": "^29.2.
|
|
27
|
+
"intl-tel-input": "^29.2.2"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"vue": "^3.0.0"
|