intl-tel-input 25.12.6 → 25.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { mergeModels as B, useModel as Y, ref as S, onMounted as q, watch as X, onUnmounted as Q, withDirectives as J, createElementBlock as Z, openBlock as tt, mergeProps as et, vModelText as it } from "vue";
2
- const st = [
1
+ import { mergeModels as W, useModel as Q, ref as O, onMounted as J, watch as Z, onUnmounted as tt, withDirectives as et, createElementBlock as it, openBlock as st, mergeProps as nt, vModelText as ot } from "vue";
2
+ const rt = [
3
3
  [
4
4
  "af",
5
5
  // Afghanistan
@@ -1676,9 +1676,9 @@ const st = [
1676
1676
  null,
1677
1677
  "0"
1678
1678
  ]
1679
- ], E = [];
1680
- for (const l of st)
1681
- E.push({
1679
+ ], A = [];
1680
+ for (const l of rt)
1681
+ A.push({
1682
1682
  name: "",
1683
1683
  // populated in the plugin
1684
1684
  iso2: l[0],
@@ -1695,7 +1695,7 @@ for (const l of st)
1695
1695
  dialCodePlus: ""
1696
1696
  // populated in the plugin
1697
1697
  });
1698
- const nt = {
1698
+ const lt = {
1699
1699
  ad: "Andorra",
1700
1700
  ae: "United Arab Emirates",
1701
1701
  af: "Afghanistan",
@@ -1938,7 +1938,7 @@ const nt = {
1938
1938
  za: "South Africa",
1939
1939
  zm: "Zambia",
1940
1940
  zw: "Zimbabwe"
1941
- }, ot = {
1941
+ }, at = {
1942
1942
  selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1943
1943
  noCountrySelected: "Select country",
1944
1944
  countryListAriaLabel: "List of countries",
@@ -1950,7 +1950,7 @@ const nt = {
1950
1950
  // additional countries (not supported by country-list library)
1951
1951
  ac: "Ascension Island",
1952
1952
  xk: "Kosovo"
1953
- }, $ = { ...nt, ...ot }, A = {
1953
+ }, j = { ...lt, ...at }, S = {
1954
1954
  OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1955
1955
  CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1956
1956
  COUNTRY_CHANGE: "countrychange",
@@ -1964,17 +1964,17 @@ const nt = {
1964
1964
  FLAG: "iti__flag",
1965
1965
  COUNTRY_ITEM: "iti__country",
1966
1966
  HIGHLIGHT: "iti__highlight"
1967
- }, g = {
1967
+ }, _ = {
1968
1968
  ARROW_UP: "ArrowUp",
1969
1969
  ARROW_DOWN: "ArrowDown",
1970
1970
  SPACE: " ",
1971
1971
  ENTER: "Enter",
1972
1972
  ESC: "Escape",
1973
1973
  TAB: "Tab"
1974
- }, H = {
1974
+ }, F = {
1975
1975
  PASTE: "insertFromPaste",
1976
1976
  DELETE_FWD: "deleteContentForward"
1977
- }, N = {
1977
+ }, L = {
1978
1978
  ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
1979
1979
  // any kind of letter from any language
1980
1980
  NON_PLUS_NUMERIC: /[^+0-9]/,
@@ -1983,39 +1983,39 @@ const nt = {
1983
1983
  // chars that are NOT + or digit (global)
1984
1984
  HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
1985
1985
  // single acceptable hidden-search char
1986
- }, lt = {
1986
+ }, ut = {
1987
1987
  HIDDEN_SEARCH_RESET_MS: 1e3
1988
- }, W = {
1988
+ }, $ = {
1989
1989
  UNKNOWN_NUMBER_TYPE: -99,
1990
1990
  UNKNOWN_VALIDATION_ERROR: -99
1991
- }, T = {
1991
+ }, R = {
1992
1992
  SANE_SELECTED_WITH_DIAL_WIDTH: 78,
1993
1993
  // px width fallback when separateDialCode enabled
1994
1994
  SANE_SELECTED_NO_DIAL_WIDTH: 42,
1995
1995
  // px width fallback when no separate dial code
1996
1996
  INPUT_PADDING_EXTRA_LEFT: 6
1997
1997
  // px gap between selected country container and input text
1998
- }, G = {
1998
+ }, K = {
1999
1999
  NANP: "1"
2000
2000
  // North American Numbering Plan
2001
- }, P = {
2001
+ }, k = {
2002
2002
  DIAL_CODE: "44",
2003
2003
  // +44 United Kingdom
2004
2004
  MOBILE_PREFIX: "7",
2005
2005
  // UK mobile numbers start with 7 after national trunk (0) or core section
2006
2006
  MOBILE_CORE_LENGTH: 10
2007
2007
  // core number length (excluding dial code / national prefix) for mobiles
2008
- }, rt = {
2008
+ }, dt = {
2009
2009
  ISO2: "us"
2010
- }, x = {
2010
+ }, H = {
2011
2011
  AGGRESSIVE: "aggressive",
2012
2012
  POLITE: "polite"
2013
- }, O = {
2013
+ }, M = {
2014
2014
  AUTO: "auto"
2015
- }, F = {
2015
+ }, G = {
2016
2016
  COUNTRY_CODE: "countryCode",
2017
2017
  DIAL_CODE: "dialCode"
2018
- }, C = {
2018
+ }, p = {
2019
2019
  EXPANDED: "aria-expanded",
2020
2020
  LABEL: "aria-label",
2021
2021
  SELECTED: "aria-selected",
@@ -2025,21 +2025,21 @@ const nt = {
2025
2025
  HIDDEN: "aria-hidden",
2026
2026
  AUTOCOMPLETE: "aria-autocomplete",
2027
2027
  MODAL: "aria-modal"
2028
- }, R = (l) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(l).matches, at = () => {
2028
+ }, x = (l) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(l).matches, ct = () => {
2029
2029
  if (typeof navigator < "u" && typeof window < "u") {
2030
2030
  const l = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
2031
2031
  navigator.userAgent
2032
- ), t = R("(max-width: 500px)"), e = R("(max-height: 600px)"), i = R("(pointer: coarse)");
2032
+ ), t = x("(max-width: 500px)"), e = x("(max-height: 600px)"), i = x("(pointer: coarse)");
2033
2033
  return l || t || i && e;
2034
2034
  }
2035
2035
  return !1;
2036
- }, z = {
2036
+ }, Y = {
2037
2037
  // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
2038
2038
  allowPhonewords: !1,
2039
2039
  //* Whether or not to allow the dropdown.
2040
2040
  allowDropdown: !0,
2041
2041
  //* Add a placeholder in the input with an example number for the selected country.
2042
- autoPlaceholder: x.POLITE,
2042
+ autoPlaceholder: H.POLITE,
2043
2043
  //* Modify the parentClass.
2044
2044
  containerClass: "",
2045
2045
  //* The order of the countries in the dropdown. Defaults to alphabetical.
@@ -2081,13 +2081,13 @@ const nt = {
2081
2081
  //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
2082
2082
  strictMode: !1,
2083
2083
  //* Use full screen popup instead of dropdown for country list.
2084
- useFullscreenPopup: at(),
2084
+ useFullscreenPopup: ct(),
2085
2085
  //* The number type to enforce during validation.
2086
2086
  validationNumberTypes: ["MOBILE"]
2087
- }, ut = (l, t) => {
2087
+ }, ht = (l, t) => {
2088
2088
  l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...t, ...l.i18n };
2089
- }, v = (l) => l.replace(/\D/g, ""), j = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), dt = (l, t) => {
2090
- const e = j(t), i = [], s = [], o = [], n = [], r = [], a = [];
2089
+ }, P = (l) => l.replace(/\D/g, ""), q = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), pt = (l, t) => {
2090
+ const e = q(t), i = [], s = [], o = [], n = [], r = [], a = [];
2091
2091
  for (const c of l)
2092
2092
  c.iso2 === e ? i.push(c) : c.normalisedName.startsWith(e) ? s.push(c) : c.normalisedName.includes(e) ? o.push(c) : e === c.dialCode || e === c.dialCodePlus ? n.push(c) : c.dialCodePlus.includes(e) ? r.push(c) : c.initials.includes(e) && a.push(c);
2093
2093
  const d = (c, f) => c.priority - f.priority;
@@ -2099,25 +2099,25 @@ const nt = {
2099
2099
  ...r.sort(d),
2100
2100
  ...a.sort(d)
2101
2101
  ];
2102
- }, ct = (l, t) => {
2102
+ }, Ct = (l, t) => {
2103
2103
  const e = t.toLowerCase();
2104
2104
  for (const i of l)
2105
2105
  if (i.name.toLowerCase().startsWith(e))
2106
2106
  return i;
2107
2107
  return null;
2108
- }, k = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), m = (l, t, e) => {
2108
+ }, U = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), m = (l, t, e) => {
2109
2109
  const i = document.createElement(l);
2110
2110
  return t && Object.entries(t).forEach(
2111
2111
  ([s, o]) => i.setAttribute(s, o)
2112
2112
  ), e && e.appendChild(i), i;
2113
- }, ht = () => `
2114
- <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${C.HIDDEN}="true">
2113
+ }, mt = () => `
2114
+ <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${p.HIDDEN}="true">
2115
2115
  <circle cx="11" cy="11" r="7" />
2116
2116
  <line x1="21" y1="21" x2="16.65" y2="16.65" />
2117
- </svg>`, pt = (l) => {
2117
+ </svg>`, ft = (l) => {
2118
2118
  const t = `iti-${l}-clear-mask`;
2119
2119
  return `
2120
- <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${C.HIDDEN}="true" focusable="false">
2120
+ <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${p.HIDDEN}="true" focusable="false">
2121
2121
  <mask id="${t}" maskUnits="userSpaceOnUse">
2122
2122
  <rect width="16" height="16" fill="white" />
2123
2123
  <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
@@ -2125,7 +2125,7 @@ const nt = {
2125
2125
  <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
2126
2126
  </svg>`;
2127
2127
  };
2128
- class Ct {
2128
+ class yt {
2129
2129
  constructor(t, e, i) {
2130
2130
  this.highlightedItem = null, t.dataset.intlTelInputId = i.toString(), this.telInput = t, this.options = e, this.id = i, this.hadInitialPlaceholder = !!t.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2131
2131
  }
@@ -2140,7 +2140,7 @@ class Ct {
2140
2140
  this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((t = this.telInput.form) != null && t.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
2141
2141
  }
2142
2142
  _createWrapperAndInsert() {
2143
- const { allowDropdown: t, showFlags: e, containerClass: i, useFullscreenPopup: s } = this.options, o = k({
2143
+ const { allowDropdown: t, showFlags: e, containerClass: i, useFullscreenPopup: s } = this.options, o = U({
2144
2144
  iti: !0,
2145
2145
  "iti--allow-dropdown": t,
2146
2146
  "iti--show-flags": e,
@@ -2162,10 +2162,10 @@ class Ct {
2162
2162
  {
2163
2163
  type: "button",
2164
2164
  class: "iti__selected-country",
2165
- [C.EXPANDED]: "false",
2166
- [C.LABEL]: this.options.i18n.noCountrySelected,
2167
- [C.HASPOPUP]: "dialog",
2168
- [C.CONTROLS]: `iti-${this.id}__dropdown-content`
2165
+ [p.EXPANDED]: "false",
2166
+ [p.LABEL]: this.options.i18n.noCountrySelected,
2167
+ [p.HASPOPUP]: "dialog",
2168
+ [p.CONTROLS]: `iti-${this.id}__dropdown-content`
2169
2169
  },
2170
2170
  this.countryContainer
2171
2171
  ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = m(
@@ -2184,7 +2184,7 @@ class Ct {
2184
2184
  o
2185
2185
  ), e && (this.dropdownArrow = m(
2186
2186
  "div",
2187
- { class: "iti__arrow", [C.HIDDEN]: "true" },
2187
+ { class: "iti__arrow", [p.HIDDEN]: "true" },
2188
2188
  o
2189
2189
  )), i && (this.selectedDialCode = m(
2190
2190
  "div",
@@ -2206,18 +2206,18 @@ class Ct {
2206
2206
  id: `iti-${this.id}__dropdown-content`,
2207
2207
  class: `iti__dropdown-content ${h.HIDE} ${r}`,
2208
2208
  role: "dialog",
2209
- [C.MODAL]: "true"
2209
+ [p.MODAL]: "true"
2210
2210
  }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = m(
2211
2211
  "ul",
2212
2212
  {
2213
2213
  class: "iti__country-list",
2214
2214
  id: `iti-${this.id}__country-listbox`,
2215
2215
  role: "listbox",
2216
- [C.LABEL]: s.countryListAriaLabel
2216
+ [p.LABEL]: s.countryListAriaLabel
2217
2217
  },
2218
2218
  this.dropdownContent
2219
2219
  ), this._appendListItems(), i && this.updateSearchResultsA11yText(), o) {
2220
- const a = k({
2220
+ const a = U({
2221
2221
  iti: !0,
2222
2222
  "iti--container": !0,
2223
2223
  "iti--fullscreen-popup": e,
@@ -2238,10 +2238,10 @@ class Ct {
2238
2238
  "span",
2239
2239
  {
2240
2240
  class: "iti__search-icon",
2241
- [C.HIDDEN]: "true"
2241
+ [p.HIDDEN]: "true"
2242
2242
  },
2243
2243
  e
2244
- ), this.searchIcon.innerHTML = ht(), this.searchInput = m(
2244
+ ), this.searchIcon.innerHTML = mt(), this.searchInput = m(
2245
2245
  "input",
2246
2246
  {
2247
2247
  id: `iti-${this.id}__search-input`,
@@ -2251,10 +2251,10 @@ class Ct {
2251
2251
  placeholder: t.searchPlaceholder,
2252
2252
  // role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
2253
2253
  role: "combobox",
2254
- [C.EXPANDED]: "true",
2255
- [C.LABEL]: t.searchPlaceholder,
2256
- [C.CONTROLS]: `iti-${this.id}__country-listbox`,
2257
- [C.AUTOCOMPLETE]: "list",
2254
+ [p.EXPANDED]: "true",
2255
+ [p.LABEL]: t.searchPlaceholder,
2256
+ [p.CONTROLS]: `iti-${this.id}__country-listbox`,
2257
+ [p.AUTOCOMPLETE]: "list",
2258
2258
  autocomplete: "off"
2259
2259
  },
2260
2260
  e
@@ -2263,11 +2263,11 @@ class Ct {
2263
2263
  {
2264
2264
  type: "button",
2265
2265
  class: `iti__search-clear ${h.HIDE}`,
2266
- [C.LABEL]: t.clearSearchAriaLabel,
2266
+ [p.LABEL]: t.clearSearchAriaLabel,
2267
2267
  tabindex: "-1"
2268
2268
  },
2269
2269
  e
2270
- ), this.searchClearButton.innerHTML = pt(this.id), this.searchResultsA11yText = m(
2270
+ ), this.searchClearButton.innerHTML = ft(this.id), this.searchResultsA11yText = m(
2271
2271
  "span",
2272
2272
  { class: "iti__a11y-text" },
2273
2273
  this.dropdownContent
@@ -2275,7 +2275,7 @@ class Ct {
2275
2275
  "div",
2276
2276
  {
2277
2277
  class: `iti__no-results ${h.HIDE}`,
2278
- [C.HIDDEN]: "true"
2278
+ [p.HIDDEN]: "true"
2279
2279
  // all a11y messaging happens in this.searchResultsA11yText
2280
2280
  },
2281
2281
  this.dropdownContent
@@ -2313,7 +2313,7 @@ class Ct {
2313
2313
  _appendListItems() {
2314
2314
  const t = document.createDocumentFragment();
2315
2315
  for (let e = 0; e < this.countries.length; e++) {
2316
- const i = this.countries[e], s = k({
2316
+ const i = this.countries[e], s = U({
2317
2317
  [h.COUNTRY_ITEM]: !0,
2318
2318
  [h.HIGHLIGHT]: e === 0
2319
2319
  }), o = m("li", {
@@ -2321,7 +2321,7 @@ class Ct {
2321
2321
  class: s,
2322
2322
  tabindex: "-1",
2323
2323
  role: "option",
2324
- [C.SELECTED]: "false"
2324
+ [p.SELECTED]: "false"
2325
2325
  });
2326
2326
  o.dataset.dialCode = i.dialCode, o.dataset.countryCode = i.iso2, i.nodeById[this.id] = o, this.options.showFlags && m("div", { class: `${h.FLAG} iti__${i.iso2}` }, o);
2327
2327
  const n = m("span", { class: "iti__country-name" }, o);
@@ -2334,7 +2334,7 @@ class Ct {
2334
2334
  //* Update the input padding to make space for the selected country/dial code.
2335
2335
  updateInputPadding() {
2336
2336
  if (this.selectedCountry) {
2337
- const t = this.options.separateDialCode ? T.SANE_SELECTED_WITH_DIAL_WIDTH : T.SANE_SELECTED_NO_DIAL_WIDTH, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || t) + T.INPUT_PADDING_EXTRA_LEFT;
2337
+ const t = this.options.separateDialCode ? R.SANE_SELECTED_WITH_DIAL_WIDTH : R.SANE_SELECTED_NO_DIAL_WIDTH, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || t) + R.INPUT_PADDING_EXTRA_LEFT;
2338
2338
  this.telInput.style.paddingLeft = `${i}px`;
2339
2339
  }
2340
2340
  }
@@ -2387,9 +2387,9 @@ class Ct {
2387
2387
  //* Remove highlighting from other list items and highlight the given item.
2388
2388
  highlightListItem(t, e) {
2389
2389
  const i = this.highlightedItem;
2390
- if (i && (i.classList.remove(h.HIGHLIGHT), i.setAttribute(C.SELECTED, "false")), this.highlightedItem = t, this.highlightedItem && (this.highlightedItem.classList.add(h.HIGHLIGHT), this.highlightedItem.setAttribute(C.SELECTED, "true"), this.options.countrySearch)) {
2390
+ if (i && (i.classList.remove(h.HIGHLIGHT), i.setAttribute(p.SELECTED, "false")), this.highlightedItem = t, this.highlightedItem && (this.highlightedItem.classList.add(h.HIGHLIGHT), this.highlightedItem.setAttribute(p.SELECTED, "true"), this.options.countrySearch)) {
2391
2391
  const s = this.highlightedItem.getAttribute("id") || "";
2392
- this.searchInput.setAttribute(C.ACTIVE_DESCENDANT, s);
2392
+ this.searchInput.setAttribute(p.ACTIVE_DESCENDANT, s);
2393
2393
  }
2394
2394
  e && this.highlightedItem.focus();
2395
2395
  }
@@ -2412,66 +2412,58 @@ class Ct {
2412
2412
  this.countries = null;
2413
2413
  }
2414
2414
  }
2415
- const mt = (l) => {
2415
+ const gt = (l) => {
2416
2416
  const { onlyCountries: t, excludeCountries: e } = l;
2417
2417
  if (t.length) {
2418
2418
  const i = t.map(
2419
2419
  (s) => s.toLowerCase()
2420
2420
  );
2421
- return E.filter(
2421
+ return A.filter(
2422
2422
  (s) => i.includes(s.iso2)
2423
2423
  );
2424
2424
  } else if (e.length) {
2425
2425
  const i = e.map(
2426
2426
  (s) => s.toLowerCase()
2427
2427
  );
2428
- return E.filter(
2428
+ return A.filter(
2429
2429
  (s) => !i.includes(s.iso2)
2430
2430
  );
2431
2431
  }
2432
- return E;
2433
- }, ft = (l, t) => {
2432
+ return A;
2433
+ }, _t = (l, t) => {
2434
2434
  for (const e of l) {
2435
2435
  const i = e.iso2.toLowerCase();
2436
2436
  t.i18n[i] && (e.name = t.i18n[i]);
2437
2437
  }
2438
- }, yt = (l, t) => {
2439
- const e = /* @__PURE__ */ new Set();
2440
- let i = 0;
2441
- const s = {}, o = (n, r, a) => {
2438
+ }, bt = (l) => {
2439
+ const t = /* @__PURE__ */ new Set();
2440
+ let e = 0;
2441
+ const i = {}, s = (n, r) => {
2442
2442
  if (!n || !r)
2443
2443
  return;
2444
- r.length > i && (i = r.length), s.hasOwnProperty(r) || (s[r] = []);
2445
- const d = s[r];
2446
- if (d.includes(n))
2447
- return;
2448
- const c = a !== void 0 ? a : d.length;
2449
- d[c] = n;
2450
- };
2451
- for (const n of l) {
2452
- e.has(n.dialCode) || e.add(n.dialCode);
2444
+ r.length > e && (e = r.length), i.hasOwnProperty(r) || (i[r] = []);
2445
+ const a = i[r];
2446
+ a.includes(n) || a.push(n);
2447
+ }, o = [...l].sort((n, r) => n.priority - r.priority);
2448
+ for (const n of o) {
2449
+ t.has(n.dialCode) || t.add(n.dialCode);
2453
2450
  for (let r = 1; r < n.dialCode.length; r++) {
2454
2451
  const a = n.dialCode.substring(0, r);
2455
- o(n.iso2, a);
2452
+ s(n.iso2, a);
2456
2453
  }
2457
- o(n.iso2, n.dialCode, n.priority);
2458
- }
2459
- (t.onlyCountries.length || t.excludeCountries.length) && e.forEach((n) => {
2460
- s[n] = s[n].filter(Boolean);
2461
- });
2462
- for (const n of l)
2463
- if (n.areaCodes) {
2464
- const r = s[n.dialCode][0];
2454
+ if (s(n.iso2, n.dialCode), n.areaCodes) {
2455
+ const r = i[n.dialCode][0];
2465
2456
  for (const a of n.areaCodes) {
2466
2457
  for (let d = 1; d < a.length; d++) {
2467
2458
  const c = a.substring(0, d), f = n.dialCode + c;
2468
- o(r, f), o(n.iso2, f);
2459
+ s(r, f), s(n.iso2, f);
2469
2460
  }
2470
- o(n.iso2, n.dialCode + a);
2461
+ s(n.iso2, n.dialCode + a);
2471
2462
  }
2472
2463
  }
2473
- return { dialCodes: e, dialCodeMaxLen: i, dialCodeToIso2Map: s };
2474
- }, gt = (l, t) => {
2464
+ }
2465
+ return { dialCodes: t, dialCodeMaxLen: e, dialCodeToIso2Map: i };
2466
+ }, It = (l, t) => {
2475
2467
  t.countryOrder && (t.countryOrder = t.countryOrder.map(
2476
2468
  (e) => e.toLowerCase()
2477
2469
  )), l.sort((e, i) => {
@@ -2483,10 +2475,10 @@ const mt = (l) => {
2483
2475
  }
2484
2476
  return e.name.localeCompare(i.name);
2485
2477
  });
2486
- }, bt = (l) => {
2478
+ }, Nt = (l) => {
2487
2479
  for (const t of l)
2488
- t.normalisedName = j(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
2489
- }, It = (l, t, e, i) => {
2480
+ t.normalisedName = q(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
2481
+ }, wt = (l, t, e, i) => {
2490
2482
  let s = l;
2491
2483
  if (e && t) {
2492
2484
  t = `+${i.dialCode}`;
@@ -2494,10 +2486,10 @@ const mt = (l) => {
2494
2486
  s = s.substring(o);
2495
2487
  }
2496
2488
  return s;
2497
- }, _t = (l, t, e, i, s) => {
2489
+ }, Dt = (l, t, e, i, s) => {
2498
2490
  const o = e ? e.formatNumberAsYouType(l, i.iso2) : l, { dialCode: n } = i;
2499
2491
  return s && t.charAt(0) !== "+" && o.includes(`+${n}`) ? (o.split(`+${n}`)[1] || "").trim() : o;
2500
- }, wt = (l, t, e, i) => {
2492
+ }, Et = (l, t, e, i) => {
2501
2493
  if (e === 0 && !i)
2502
2494
  return 0;
2503
2495
  let s = 0;
@@ -2508,7 +2500,7 @@ const mt = (l) => {
2508
2500
  return o;
2509
2501
  }
2510
2502
  return t.length;
2511
- }, Dt = [
2503
+ }, Lt = [
2512
2504
  "800",
2513
2505
  "822",
2514
2506
  "833",
@@ -2526,30 +2518,54 @@ const mt = (l) => {
2526
2518
  "887",
2527
2519
  "888",
2528
2520
  "889"
2529
- ], V = (l) => {
2530
- const t = v(l);
2531
- if (t.startsWith(G.NANP) && t.length >= 4) {
2521
+ ], z = (l) => {
2522
+ const t = P(l);
2523
+ if (t.startsWith(K.NANP) && t.length >= 4) {
2532
2524
  const e = t.substring(1, 4);
2533
- return Dt.includes(e);
2525
+ return Lt.includes(e);
2534
2526
  }
2535
2527
  return !1;
2536
2528
  };
2537
- for (const l of E)
2538
- l.name = $[l.iso2];
2539
- let Nt = 0;
2540
- const Et = new Set(E.map((l) => l.iso2)), M = (l) => Et.has(l);
2541
- class U {
2529
+ for (const l of A)
2530
+ l.name = j[l.iso2];
2531
+ let At = 0;
2532
+ const Tt = new Set(A.map((l) => l.iso2)), B = (l) => Tt.has(l);
2533
+ class V {
2542
2534
  constructor(t, e = {}) {
2543
- this.id = Nt++, this.options = { ...z, ...e }, ut(this.options, $), this.ui = new Ct(t, this.options, this.id), this.isAndroid = U._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = mt(this.options);
2544
- const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: o } = yt(
2545
- this.countries,
2546
- this.options
2535
+ this.id = At++, this.options = { ...Y, ...e }, ht(this.options, j), this.ui = new yt(t, this.options, this.id), this.isAndroid = V._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = gt(this.options);
2536
+ const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: o } = bt(
2537
+ this.countries
2547
2538
  );
2548
2539
  this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = o, this.countryByIso2 = new Map(this.countries.map((n) => [n.iso2, n])), this._init();
2549
2540
  }
2550
2541
  static _getIsAndroid() {
2551
2542
  return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
2552
2543
  }
2544
+ _updateNumeralSet(t) {
2545
+ /[\u0660-\u0669]/.test(t) ? this.userNumeralSet = "arabic-indic" : /[\u06F0-\u06F9]/.test(t) ? this.userNumeralSet = "persian" : this.userNumeralSet = "ascii";
2546
+ }
2547
+ _mapAsciiToUserNumerals(t) {
2548
+ if (this.userNumeralSet || this._updateNumeralSet(this.ui.telInput.value), this.userNumeralSet === "ascii")
2549
+ return t;
2550
+ const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776;
2551
+ return t.replace(/[0-9]/g, (i) => String.fromCharCode(e + Number(i)));
2552
+ }
2553
+ // Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
2554
+ _normaliseNumerals(t) {
2555
+ if (!t)
2556
+ return "";
2557
+ if (this._updateNumeralSet(t), this.userNumeralSet === "ascii")
2558
+ return t;
2559
+ const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776, i = this.userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
2560
+ return t.replace(i, (s) => String.fromCharCode(48 + (s.charCodeAt(0) - e)));
2561
+ }
2562
+ _getTelInputValue() {
2563
+ const t = this.ui.telInput.value.trim();
2564
+ return this._normaliseNumerals(t);
2565
+ }
2566
+ _setTelInputValue(t) {
2567
+ this.ui.telInput.value = this._mapAsciiToUserNumerals(t);
2568
+ }
2553
2569
  _createInitPromises() {
2554
2570
  const t = new Promise((i, s) => {
2555
2571
  this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
@@ -2567,20 +2583,20 @@ class U {
2567
2583
  //********************
2568
2584
  //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
2569
2585
  _processCountryData() {
2570
- ft(this.countries, this.options), gt(this.countries, this.options), bt(this.countries);
2586
+ _t(this.countries, this.options), It(this.countries, this.options), Nt(this.countries);
2571
2587
  }
2572
2588
  //* Set the initial state of the input value and the selected country by:
2573
2589
  //* 1. Extracting a dial code from the given number
2574
2590
  //* 2. Using explicit initialCountry
2575
2591
  _setInitialState(t = !1) {
2576
- const e = this.ui.telInput.getAttribute("value"), i = this.ui.telInput.value, o = e && e.startsWith("+") && (!i || !i.startsWith("+")) ? e : i, n = this._getDialCode(o), r = V(o), { initialCountry: a, geoIpLookup: d } = this.options, c = a === O.AUTO && d;
2577
- if (n && !r)
2578
- this._updateCountryFromNumber(o);
2579
- else if (!c || t) {
2580
- const f = a ? a.toLowerCase() : "";
2581
- M(f) ? this._setCountry(f) : n && r ? this._setCountry(rt.ISO2) : this._setCountry("");
2592
+ const e = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(e), s = this._getTelInputValue(), n = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s, r = this._getDialCode(n), a = z(n), { initialCountry: d, geoIpLookup: c } = this.options, f = d === M.AUTO && c;
2593
+ if (r && !a)
2594
+ this._updateCountryFromNumber(n);
2595
+ else if (!f || t) {
2596
+ const b = d ? d.toLowerCase() : "";
2597
+ B(b) ? this._setCountry(b) : r && a ? this._setCountry(dt.ISO2) : this._setCountry("");
2582
2598
  }
2583
- o && this._updateValFromNumber(o);
2599
+ n && this._updateValFromNumber(n);
2584
2600
  }
2585
2601
  //* Initialise the main event listeners: input keyup, and click selected country.
2586
2602
  _initListeners() {
@@ -2617,7 +2633,7 @@ class U {
2617
2633
  const o = (n) => {
2618
2634
  this.ui.dropdownContent.classList.contains(
2619
2635
  h.HIDE
2620
- ) && [g.ARROW_UP, g.ARROW_DOWN, g.SPACE, g.ENTER].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === g.TAB && this._closeDropdown();
2636
+ ) && [_.ARROW_UP, _.ARROW_DOWN, _.SPACE, _.ENTER].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === _.TAB && this._closeDropdown();
2621
2637
  };
2622
2638
  this.ui.countryContainer.addEventListener(
2623
2639
  "keydown",
@@ -2646,17 +2662,17 @@ class U {
2646
2662
  }
2647
2663
  } else
2648
2664
  this.resolveUtilsScriptPromise();
2649
- e === O.AUTO && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2665
+ e === M.AUTO && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2650
2666
  }
2651
2667
  //* Perform the geo ip lookup.
2652
2668
  _loadAutoCountry() {
2653
2669
  u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
2654
2670
  (t = "") => {
2655
2671
  const e = t.toLowerCase();
2656
- M(e) ? (u.autoCountry = e, setTimeout(() => L("handleAutoCountry"))) : (this._setInitialState(!0), L("rejectAutoCountryPromise"));
2672
+ B(e) ? (u.autoCountry = e, setTimeout(() => T("handleAutoCountry"))) : (this._setInitialState(!0), T("rejectAutoCountryPromise"));
2657
2673
  },
2658
2674
  () => {
2659
- this._setInitialState(!0), L("rejectAutoCountryPromise");
2675
+ this._setInitialState(!0), T("rejectAutoCountryPromise");
2660
2676
  }
2661
2677
  ));
2662
2678
  }
@@ -2676,40 +2692,38 @@ class U {
2676
2692
  countrySearch: o
2677
2693
  } = this.options;
2678
2694
  let n = !1;
2679
- N.ALPHA_UNICODE.test(this.ui.telInput.value) && (n = !0);
2695
+ L.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
2680
2696
  const r = (a) => {
2697
+ const d = this._getTelInputValue();
2681
2698
  if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && i && s && o) {
2682
- const b = this.ui.telInput.selectionStart || 0, p = this.ui.telInput.value.substring(
2683
- 0,
2684
- b - 1
2685
- ), y = this.ui.telInput.value.substring(b);
2686
- this.ui.telInput.value = p + y, this._openDropdownWithPlus();
2699
+ const y = this.ui.telInput.selectionStart || 0, I = d.substring(0, y - 1), N = d.substring(y);
2700
+ this._setTelInputValue(I + N), this._openDropdownWithPlus();
2687
2701
  return;
2688
2702
  }
2689
- this._updateCountryFromNumber(this.ui.telInput.value) && this._triggerCountryChange();
2690
- const d = (a == null ? void 0 : a.data) && N.NON_PLUS_NUMERIC.test(a.data), c = (a == null ? void 0 : a.inputType) === H.PASTE && this.ui.telInput.value;
2691
- d || c && !t ? n = !0 : N.NON_PLUS_NUMERIC.test(this.ui.telInput.value) || (n = !1);
2692
- const f = (a == null ? void 0 : a.detail) && a.detail.isSetNumber;
2693
- if (e && !n && !f) {
2694
- const b = this.ui.telInput.selectionStart || 0, y = this.ui.telInput.value.substring(
2703
+ this._updateCountryFromNumber(d) && this._triggerCountryChange();
2704
+ const c = (a == null ? void 0 : a.data) && L.NON_PLUS_NUMERIC.test(a.data), f = (a == null ? void 0 : a.inputType) === F.PASTE && d;
2705
+ c || f && !t ? n = !0 : L.NON_PLUS_NUMERIC.test(d) || (n = !1);
2706
+ const b = (a == null ? void 0 : a.detail) && a.detail.isSetNumber, C = this.userNumeralSet === "ascii";
2707
+ if (e && !n && !b && C) {
2708
+ const y = this.ui.telInput.selectionStart || 0, N = d.substring(
2695
2709
  0,
2696
- b
2710
+ y
2697
2711
  ).replace(
2698
- N.NON_PLUS_NUMERIC_GLOBAL,
2712
+ L.NON_PLUS_NUMERIC_GLOBAL,
2699
2713
  ""
2700
- ).length, w = (a == null ? void 0 : a.inputType) === H.DELETE_FWD, I = this._getFullNumber(), _ = _t(
2701
- I,
2702
- this.ui.telInput.value,
2714
+ ).length, D = (a == null ? void 0 : a.inputType) === F.DELETE_FWD, g = this._getFullNumber(), E = Dt(
2715
+ g,
2716
+ d,
2703
2717
  u.utils,
2704
2718
  this.selectedCountryData,
2705
2719
  this.options.separateDialCode
2706
- ), D = wt(
2720
+ ), w = Et(
2721
+ N,
2722
+ E,
2707
2723
  y,
2708
- _,
2709
- b,
2710
- w
2724
+ D
2711
2725
  );
2712
- this.ui.telInput.value = _, this.ui.telInput.setSelectionRange(D, D);
2726
+ this._setTelInputValue(E), this.ui.telInput.setSelectionRange(w, w);
2713
2727
  }
2714
2728
  };
2715
2729
  this.ui.telInput.addEventListener(
@@ -2730,11 +2744,11 @@ class U {
2730
2744
  return;
2731
2745
  }
2732
2746
  if (t) {
2733
- const r = this.ui.telInput.value, d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = /^[0-9]$/.test(n.key), f = e ? c : d || c, b = r.slice(0, this.ui.telInput.selectionStart) + n.key + r.slice(this.ui.telInput.selectionEnd), p = this._getFullNumber(b), y = u.utils.getCoreNumber(
2734
- p,
2747
+ const r = this._getTelInputValue(), d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = this._normaliseNumerals(n.key), f = /^[0-9]$/.test(c), b = e ? f : d || f, C = this.ui.telInput, y = C.selectionStart, I = C.selectionEnd, N = r.slice(0, y), D = r.slice(I), g = N + n.key + D, E = this._getFullNumber(g), w = u.utils.getCoreNumber(
2748
+ E,
2735
2749
  this.selectedCountryData.iso2
2736
- ), w = this.maxCoreNumberLength && y.length > this.maxCoreNumberLength, _ = this._getNewCountryFromNumber(p) !== null;
2737
- (!f || w && !_ && !d) && n.preventDefault();
2750
+ ), v = this.maxCoreNumberLength && w.length > this.maxCoreNumberLength, X = this._getNewCountryFromNumber(E) !== null;
2751
+ (!b || v && !X && !d) && n.preventDefault();
2738
2752
  }
2739
2753
  }
2740
2754
  };
@@ -2747,21 +2761,24 @@ class U {
2747
2761
  if (this.options.strictMode) {
2748
2762
  const t = (e) => {
2749
2763
  e.preventDefault();
2750
- const i = this.ui.telInput, s = i.selectionStart, o = i.selectionEnd, n = i.value.slice(0, s), r = i.value.slice(o), a = this.selectedCountryData.iso2, d = e.clipboardData.getData("text"), c = s === 0 && o > 0, f = !i.value.startsWith("+") || c, b = d.replace(N.NON_PLUS_NUMERIC_GLOBAL, ""), p = b.startsWith("+"), y = b.replace(/\+/g, ""), w = p && f ? `+${y}` : y;
2751
- let I = n + w + r, _ = u.utils.getCoreNumber(I, a);
2752
- for (; _.length === 0 && I.length > 0; )
2753
- I = I.slice(0, -1), _ = u.utils.getCoreNumber(I, a);
2754
- if (!_)
2755
- return;
2756
- if (this.maxCoreNumberLength && _.length > this.maxCoreNumberLength)
2757
- if (i.selectionEnd === i.value.length) {
2758
- const K = _.length - this.maxCoreNumberLength;
2759
- I = I.slice(0, I.length - K);
2760
- } else
2764
+ const i = this.ui.telInput, s = i.selectionStart, o = i.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, s), a = n.slice(o), d = this.selectedCountryData.iso2, c = e.clipboardData.getData("text"), f = this._normaliseNumerals(c), b = s === 0 && o > 0, C = !n.startsWith("+") || b, y = f.replace(L.NON_PLUS_NUMERIC_GLOBAL, ""), I = y.startsWith("+"), N = y.replace(/\+/g, ""), D = I && C ? `+${N}` : N;
2765
+ let g = r + D + a;
2766
+ if (g.length > 5) {
2767
+ let w = u.utils.getCoreNumber(g, d);
2768
+ for (; w.length === 0 && g.length > 0; )
2769
+ g = g.slice(0, -1), w = u.utils.getCoreNumber(g, d);
2770
+ if (!w)
2761
2771
  return;
2762
- i.value = I;
2763
- const D = s + w.length;
2764
- i.setSelectionRange(D, D), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2772
+ if (this.maxCoreNumberLength && w.length > this.maxCoreNumberLength)
2773
+ if (i.selectionEnd === n.length) {
2774
+ const v = w.length - this.maxCoreNumberLength;
2775
+ g = g.slice(0, g.length - v);
2776
+ } else
2777
+ return;
2778
+ }
2779
+ this._setTelInputValue(g);
2780
+ const E = s + D.length;
2781
+ i.setSelectionRange(E, E), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2765
2782
  };
2766
2783
  this.ui.telInput.addEventListener("paste", t, {
2767
2784
  signal: this.abortController.signal
@@ -2785,11 +2802,11 @@ class U {
2785
2802
  //* Open the dropdown.
2786
2803
  _openDropdown() {
2787
2804
  const { fixDropdownWidth: t, countrySearch: e } = this.options;
2788
- if (this.dropdownAbortController = new AbortController(), t && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(h.HIDE), this.ui.selectedCountry.setAttribute(C.EXPANDED, "true"), this._setDropdownPosition(), e) {
2805
+ if (this.dropdownAbortController = new AbortController(), t && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(h.HIDE), this.ui.selectedCountry.setAttribute(p.EXPANDED, "true"), this._setDropdownPosition(), e) {
2789
2806
  const i = this.ui.countryList.firstElementChild;
2790
2807
  i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
2791
2808
  }
2792
- this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(h.ARROW_UP), this._trigger(A.OPEN_COUNTRY_DROPDOWN);
2809
+ this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(h.ARROW_UP), this._trigger(S.OPEN_COUNTRY_DROPDOWN);
2793
2810
  }
2794
2811
  //* Set the dropdown position
2795
2812
  _setDropdownPosition() {
@@ -2864,13 +2881,13 @@ class U {
2864
2881
  let e = "", i = null;
2865
2882
  const s = (o) => {
2866
2883
  [
2867
- g.ARROW_UP,
2868
- g.ARROW_DOWN,
2869
- g.ENTER,
2870
- g.ESC
2871
- ].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === g.ARROW_UP || o.key === g.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === g.ENTER ? this._handleEnterKey() : o.key === g.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && N.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), i && clearTimeout(i), e += o.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
2884
+ _.ARROW_UP,
2885
+ _.ARROW_DOWN,
2886
+ _.ENTER,
2887
+ _.ESC
2888
+ ].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === _.ARROW_UP || o.key === _.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === _.ENTER ? this._handleEnterKey() : o.key === _.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && L.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), i && clearTimeout(i), e += o.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
2872
2889
  e = "";
2873
- }, lt.HIDDEN_SEARCH_RESET_MS));
2890
+ }, ut.HIDDEN_SEARCH_RESET_MS));
2874
2891
  };
2875
2892
  document.addEventListener("keydown", s, { signal: t });
2876
2893
  }
@@ -2898,7 +2915,7 @@ class U {
2898
2915
  }
2899
2916
  //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
2900
2917
  _searchForCountry(t) {
2901
- const e = ct(this.countries, t);
2918
+ const e = Ct(this.countries, t);
2902
2919
  if (e) {
2903
2920
  const i = e.nodeById[this.id];
2904
2921
  this.ui.highlightListItem(i, !1), this.ui.scrollTo(i);
@@ -2907,13 +2924,13 @@ class U {
2907
2924
  //* Country search: Filter the countries according to the search query.
2908
2925
  _filterCountriesByQuery(t) {
2909
2926
  let e;
2910
- t === "" ? e = this.countries : e = dt(this.countries, t), this.ui.filterCountries(e);
2927
+ t === "" ? e = this.countries : e = pt(this.countries, t), this.ui.filterCountries(e);
2911
2928
  }
2912
2929
  //* Highlight the next/prev item in the list (and ensure it is visible).
2913
2930
  _handleUpDownKey(t) {
2914
2931
  var i, s;
2915
- let e = t === g.ARROW_UP ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
2916
- !e && this.ui.countryList.childElementCount > 1 && (e = t === g.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), e && (this.ui.scrollTo(e), this.ui.highlightListItem(e, !1));
2932
+ let e = t === _.ARROW_UP ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
2933
+ !e && this.ui.countryList.childElementCount > 1 && (e = t === _.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), e && (this.ui.scrollTo(e), this.ui.highlightListItem(e, !1));
2917
2934
  }
2918
2935
  //* Select the currently highlighted item.
2919
2936
  _handleEnterKey() {
@@ -2931,7 +2948,7 @@ class U {
2931
2948
  n
2932
2949
  );
2933
2950
  }
2934
- e = this._beforeSetNumber(e), this.ui.telInput.value = e;
2951
+ e = this._beforeSetNumber(e), this._setTelInputValue(e);
2935
2952
  }
2936
2953
  //* Check if need to select a new country based on the given number
2937
2954
  //* Note: called from _setInitialState, keyup handler, setNumber.
@@ -2955,26 +2972,26 @@ class U {
2955
2972
  let i = e ? t.substring(e) : t;
2956
2973
  const s = this.selectedCountryData.iso2, o = this.selectedCountryData.dialCode;
2957
2974
  i = this._ensureHasDialCode(i);
2958
- const n = this._getDialCode(i, !0), r = v(i);
2975
+ const n = this._getDialCode(i, !0), r = P(i);
2959
2976
  if (n) {
2960
- const a = v(n), d = this.dialCodeToIso2Map[a];
2977
+ const a = P(n), d = this.dialCodeToIso2Map[a];
2961
2978
  if (d.length === 1)
2962
2979
  return d[0] === s ? null : d[0];
2963
2980
  if (!s && this.defaultCountry && d.includes(this.defaultCountry))
2964
2981
  return this.defaultCountry;
2965
- if (o === G.NANP && V(r))
2982
+ if (o === K.NANP && z(r))
2966
2983
  return null;
2967
2984
  const { areaCodes: f, priority: b } = this.selectedCountryData;
2968
2985
  if (f) {
2969
- const _ = f.map(
2970
- (D) => `${o}${D}`
2986
+ const D = f.map(
2987
+ (g) => `${o}${g}`
2971
2988
  );
2972
- for (const D of _)
2973
- if (r.startsWith(D))
2989
+ for (const g of D)
2990
+ if (r.startsWith(g))
2974
2991
  return null;
2975
2992
  }
2976
- const y = f && !(b === 0) && r.length > a.length, w = s && d.includes(s) && !y, I = s === d[0];
2977
- if (!w && !I)
2993
+ const y = f && !(b === 0) && r.length > a.length, I = s && d.includes(s) && !y, N = s === d[0];
2994
+ if (!I && !N)
2978
2995
  return d[0];
2979
2996
  } else if (i.startsWith("+") && r.length) {
2980
2997
  const a = this.selectedCountryData.dialCode || "";
@@ -2995,7 +3012,7 @@ class U {
2995
3012
  a = d, r = s.selectedCountryAriaLabel.replace("${countryName}", d).replace("${dialCode}", `+${c}`);
2996
3013
  } else
2997
3014
  a = s.noCountrySelected, r = s.noCountrySelected;
2998
- this.ui.selectedCountryInner.className = n, this.ui.selectedCountry.setAttribute("title", a), this.ui.selectedCountry.setAttribute(C.LABEL, r);
3015
+ this.ui.selectedCountryInner.className = n, this.ui.selectedCountry.setAttribute("title", a), this.ui.selectedCountry.setAttribute(p.LABEL, r);
2999
3016
  }
3000
3017
  if (e) {
3001
3018
  const n = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
@@ -3033,7 +3050,7 @@ class U {
3033
3050
  placeholderNumberType: e,
3034
3051
  nationalMode: i,
3035
3052
  customPlaceholder: s
3036
- } = this.options, o = t === x.AGGRESSIVE || !this.ui.hadInitialPlaceholder && t === x.POLITE;
3053
+ } = this.options, o = t === H.AGGRESSIVE || !this.ui.hadInitialPlaceholder && t === H.POLITE;
3037
3054
  if (u.utils && o) {
3038
3055
  const n = u.utils.numberType[e];
3039
3056
  let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
@@ -3046,23 +3063,27 @@ class U {
3046
3063
  }
3047
3064
  //* Called when the user selects a list item from the dropdown.
3048
3065
  _selectListItem(t) {
3049
- const e = t.dataset[F.COUNTRY_CODE], i = this._setCountry(e);
3066
+ const e = t.dataset[G.COUNTRY_CODE], i = this._setCountry(e);
3050
3067
  this._closeDropdown();
3051
- const s = t.dataset[F.DIAL_CODE];
3052
- this._updateDialCode(s), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this.ui.telInput.focus(), i && this._triggerCountryChange();
3068
+ const s = t.dataset[G.DIAL_CODE];
3069
+ if (this._updateDialCode(s), this.options.formatOnDisplay) {
3070
+ const o = this._getTelInputValue();
3071
+ this._updateValFromNumber(o);
3072
+ }
3073
+ this.ui.telInput.focus(), i && this._triggerCountryChange();
3053
3074
  }
3054
3075
  //* Close the dropdown and unbind any listeners.
3055
3076
  _closeDropdown() {
3056
- this.ui.dropdownContent.classList.contains(h.HIDE) || (this.ui.dropdownContent.classList.add(h.HIDE), this.ui.selectedCountry.setAttribute(C.EXPANDED, "false"), this.ui.highlightedItem && this.ui.highlightedItem.setAttribute(C.SELECTED, "false"), this.options.countrySearch && this.ui.searchInput.removeAttribute(C.ACTIVE_DESCENDANT), this.ui.dropdownArrow.classList.remove(h.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(A.CLOSE_COUNTRY_DROPDOWN));
3077
+ this.ui.dropdownContent.classList.contains(h.HIDE) || (this.ui.dropdownContent.classList.add(h.HIDE), this.ui.selectedCountry.setAttribute(p.EXPANDED, "false"), this.ui.highlightedItem && this.ui.highlightedItem.setAttribute(p.SELECTED, "false"), this.options.countrySearch && this.ui.searchInput.removeAttribute(p.ACTIVE_DESCENDANT), this.ui.dropdownArrow.classList.remove(h.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(S.CLOSE_COUNTRY_DROPDOWN));
3057
3078
  }
3058
3079
  //* Replace any existing dial code with the new one
3059
3080
  //* Note: called from _selectListItem and setCountry
3060
3081
  _updateDialCode(t) {
3061
- const e = this.ui.telInput.value, i = `+${t}`;
3082
+ const e = this._getTelInputValue(), i = `+${t}`;
3062
3083
  let s;
3063
3084
  if (e.startsWith("+")) {
3064
3085
  const o = this._getDialCode(e);
3065
- o ? s = e.replace(o, i) : s = i, this.ui.telInput.value = s;
3086
+ o ? s = e.replace(o, i) : s = i, this._setTelInputValue(s);
3066
3087
  }
3067
3088
  }
3068
3089
  //* Try and extract a valid international dial code from a full telephone number.
@@ -3089,14 +3110,14 @@ class U {
3089
3110
  }
3090
3111
  //* Get the input val, adding the dial code if separateDialCode is enabled.
3091
3112
  _getFullNumber(t) {
3092
- const e = t || this.ui.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
3113
+ const e = t ? this._normaliseNumerals(t) : this._getTelInputValue(), { dialCode: i } = this.selectedCountryData;
3093
3114
  let s;
3094
- const o = v(e);
3115
+ const o = P(e);
3095
3116
  return this.options.separateDialCode && !e.startsWith("+") && i && o ? s = `+${i}` : s = "", s + e;
3096
3117
  }
3097
3118
  //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
3098
3119
  _beforeSetNumber(t) {
3099
- const e = this._getDialCode(t), i = It(
3120
+ const e = this._getDialCode(t), i = wt(
3100
3121
  t,
3101
3122
  e,
3102
3123
  this.options.separateDialCode,
@@ -3106,18 +3127,22 @@ class U {
3106
3127
  }
3107
3128
  //* Trigger the 'countrychange' event.
3108
3129
  _triggerCountryChange() {
3109
- this._trigger(A.COUNTRY_CHANGE);
3130
+ this._trigger(S.COUNTRY_CHANGE);
3110
3131
  }
3111
3132
  //**************************
3112
3133
  //* SECRET PUBLIC METHODS
3113
3134
  //**************************
3114
3135
  //* This is called when the geoip call returns.
3115
3136
  handleAutoCountry() {
3116
- this.options.initialCountry === O.AUTO && u.autoCountry && (this.defaultCountry = u.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(h.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
3137
+ this.options.initialCountry === M.AUTO && u.autoCountry && (this.defaultCountry = u.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(h.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
3117
3138
  }
3118
3139
  //* This is called when the utils request completes.
3119
3140
  handleUtils() {
3120
- u.utils && (this.ui.telInput.value && this._updateValFromNumber(this.ui.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
3141
+ if (u.utils) {
3142
+ const t = this._getTelInputValue();
3143
+ t && this._updateValFromNumber(t), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength());
3144
+ }
3145
+ this.resolveUtilsScriptPromise();
3121
3146
  }
3122
3147
  //********************
3123
3148
  //* PUBLIC METHODS
@@ -3136,12 +3161,12 @@ class U {
3136
3161
  //* Format the number to the given format.
3137
3162
  getNumber(t) {
3138
3163
  if (u.utils) {
3139
- const { iso2: e } = this.selectedCountryData;
3140
- return u.utils.formatNumber(
3141
- this._getFullNumber(),
3164
+ const { iso2: e } = this.selectedCountryData, i = this._getFullNumber(), s = u.utils.formatNumber(
3165
+ i,
3142
3166
  e,
3143
3167
  t
3144
3168
  );
3169
+ return this._mapAsciiToUserNumerals(s);
3145
3170
  }
3146
3171
  return "";
3147
3172
  }
@@ -3150,7 +3175,7 @@ class U {
3150
3175
  return u.utils ? u.utils.getNumberType(
3151
3176
  this._getFullNumber(),
3152
3177
  this.selectedCountryData.iso2
3153
- ) : W.UNKNOWN_NUMBER_TYPE;
3178
+ ) : $.UNKNOWN_NUMBER_TYPE;
3154
3179
  }
3155
3180
  //* Get the country data for the currently selected country.
3156
3181
  getSelectedCountryData() {
@@ -3162,14 +3187,14 @@ class U {
3162
3187
  const { iso2: t } = this.selectedCountryData;
3163
3188
  return u.utils.getValidationError(this._getFullNumber(), t);
3164
3189
  }
3165
- return W.UNKNOWN_VALIDATION_ERROR;
3190
+ return $.UNKNOWN_VALIDATION_ERROR;
3166
3191
  }
3167
3192
  //* Validate the input val using number length only
3168
3193
  isValidNumber() {
3169
3194
  const { dialCode: t, iso2: e } = this.selectedCountryData;
3170
- if (t === P.DIAL_CODE && u.utils) {
3195
+ if (t === k.DIAL_CODE && u.utils) {
3171
3196
  const i = this._getFullNumber(), s = u.utils.getCoreNumber(i, e);
3172
- if (s[0] === P.MOBILE_PREFIX && s.length !== P.MOBILE_CORE_LENGTH)
3197
+ if (s[0] === k.MOBILE_PREFIX && s.length !== k.MOBILE_CORE_LENGTH)
3173
3198
  return !1;
3174
3199
  }
3175
3200
  return this._validateNumber(!1);
@@ -3191,7 +3216,7 @@ class U {
3191
3216
  return null;
3192
3217
  if (!this.selectedCountryData.iso2)
3193
3218
  return !1;
3194
- const e = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n), i = this._getFullNumber(), s = i.search(N.ALPHA_UNICODE);
3219
+ const e = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n), i = this._getFullNumber(), s = i.search(L.ALPHA_UNICODE);
3195
3220
  if (s > -1 && !this.options.allowPhonewords) {
3196
3221
  const n = i.substring(0, s), r = e(n), a = e(i);
3197
3222
  return r && a;
@@ -3208,15 +3233,21 @@ class U {
3208
3233
  //* Update the selected country, and update the input val accordingly.
3209
3234
  setCountry(t) {
3210
3235
  const e = t == null ? void 0 : t.toLowerCase();
3211
- if (!M(e))
3236
+ if (!B(e))
3212
3237
  throw new Error(`Invalid country code: '${e}'`);
3213
3238
  const i = this.selectedCountryData.iso2;
3214
- (t && e !== i || !t && i) && (this._setCountry(e), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this._triggerCountryChange());
3239
+ if (t && e !== i || !t && i) {
3240
+ if (this._setCountry(e), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay) {
3241
+ const o = this._getTelInputValue();
3242
+ this._updateValFromNumber(o);
3243
+ }
3244
+ this._triggerCountryChange();
3245
+ }
3215
3246
  }
3216
3247
  //* Set the input value and update the country.
3217
3248
  setNumber(t) {
3218
- const e = this._updateCountryFromNumber(t);
3219
- this._updateValFromNumber(t), e && this._triggerCountryChange(), this._trigger(A.INPUT, { isSetNumber: !0 });
3249
+ const e = this._normaliseNumerals(t), i = this._updateCountryFromNumber(e);
3250
+ this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger(S.INPUT, { isSetNumber: !0 });
3220
3251
  }
3221
3252
  //* Set the placeholder number typ
3222
3253
  setPlaceholderNumberType(t) {
@@ -3226,7 +3257,7 @@ class U {
3226
3257
  this.ui.telInput.disabled = t, t ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
3227
3258
  }
3228
3259
  }
3229
- const Lt = (l) => {
3260
+ const St = (l) => {
3230
3261
  if (!u.utils && !u.startedLoadingUtilsScript) {
3231
3262
  let t;
3232
3263
  if (typeof l == "function")
@@ -3247,28 +3278,28 @@ const Lt = (l) => {
3247
3278
  throw new TypeError(
3248
3279
  "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
3249
3280
  );
3250
- return u.utils = i, L("handleUtils"), !0;
3281
+ return u.utils = i, T("handleUtils"), !0;
3251
3282
  }).catch((e) => {
3252
- throw L("rejectUtilsScriptPromise", e), e;
3283
+ throw T("rejectUtilsScriptPromise", e), e;
3253
3284
  });
3254
3285
  }
3255
3286
  return null;
3256
- }, L = (l, ...t) => {
3287
+ }, T = (l, ...t) => {
3257
3288
  Object.values(u.instances).forEach((e) => {
3258
3289
  const i = e[l];
3259
3290
  typeof i == "function" && i.apply(e, t);
3260
3291
  });
3261
3292
  }, u = Object.assign(
3262
3293
  (l, t) => {
3263
- const e = new U(l, t);
3294
+ const e = new V(l, t);
3264
3295
  return u.instances[e.id] = e, l.iti = e, e;
3265
3296
  },
3266
3297
  {
3267
- defaults: z,
3298
+ defaults: Y,
3268
3299
  //* Using a static var like this allows us to mock it in the tests.
3269
3300
  documentReady: () => document.readyState === "complete",
3270
3301
  //* Get the country data object.
3271
- getCountryData: () => E,
3302
+ getCountryData: () => A,
3272
3303
  //* A getter for the plugin instance.
3273
3304
  getInstance: (l) => {
3274
3305
  const t = l.dataset.intlTelInputId;
@@ -3276,14 +3307,14 @@ const Lt = (l) => {
3276
3307
  },
3277
3308
  //* A map from instance ID to instance object.
3278
3309
  instances: {},
3279
- attachUtils: Lt,
3310
+ attachUtils: St,
3280
3311
  startedLoadingUtilsScript: !1,
3281
3312
  startedLoadingAutoCountry: !1,
3282
- version: "25.12.6"
3313
+ version: "25.13.1"
3283
3314
  }
3284
- ), vt = {
3315
+ ), Ot = {
3285
3316
  __name: "IntlTelInput",
3286
- props: /* @__PURE__ */ B({
3317
+ props: /* @__PURE__ */ W({
3287
3318
  disabled: {
3288
3319
  type: Boolean,
3289
3320
  default: !1
@@ -3307,47 +3338,47 @@ const Lt = (l) => {
3307
3338
  },
3308
3339
  modelModifiers: {}
3309
3340
  }),
3310
- emits: /* @__PURE__ */ B([
3341
+ emits: /* @__PURE__ */ W([
3311
3342
  "changeNumber",
3312
3343
  "changeCountry",
3313
3344
  "changeValidity",
3314
3345
  "changeErrorCode"
3315
3346
  ], ["update:modelValue"]),
3316
3347
  setup(l, { expose: t, emit: e }) {
3317
- const i = Y(l, "modelValue"), s = l, o = e, n = S(), r = S(), a = S(!1), d = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, c = () => {
3318
- let p = d();
3319
- a.value !== p && (a.value = p, o("changeValidity", !!p), o(
3348
+ const i = Q(l, "modelValue"), s = l, o = e, n = O(), r = O(), a = O(!1), d = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, c = () => {
3349
+ let C = d();
3350
+ a.value !== C && (a.value = C, o("changeValidity", !!C), o(
3320
3351
  "changeErrorCode",
3321
- p ? null : r.value.getValidationError()
3352
+ C ? null : r.value.getValidationError()
3322
3353
  ));
3323
3354
  }, f = () => {
3324
- var p;
3325
- o("changeNumber", ((p = r.value) == null ? void 0 : p.getNumber()) ?? ""), c();
3355
+ var C;
3356
+ o("changeNumber", ((C = r.value) == null ? void 0 : C.getNumber()) ?? ""), c();
3326
3357
  }, b = () => {
3327
- var p;
3328
- o("changeCountry", ((p = r.value) == null ? void 0 : p.getSelectedCountryData().iso2) ?? ""), f(), c();
3358
+ var C;
3359
+ o("changeCountry", ((C = r.value) == null ? void 0 : C.getSelectedCountryData().iso2) ?? ""), f(), c();
3329
3360
  };
3330
- return q(() => {
3361
+ return J(() => {
3331
3362
  n.value && (r.value = u(n.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), a.value = d());
3332
- }), X(
3363
+ }), Z(
3333
3364
  () => s.disabled,
3334
- (p) => {
3365
+ (C) => {
3335
3366
  var y;
3336
- return (y = r.value) == null ? void 0 : y.setDisabled(p);
3367
+ return (y = r.value) == null ? void 0 : y.setDisabled(C);
3337
3368
  }
3338
- ), Q(() => {
3339
- var p;
3340
- return (p = r.value) == null ? void 0 : p.destroy();
3341
- }), t({ instance: r, input: n }), (p, y) => J((tt(), Z("input", et({
3369
+ ), tt(() => {
3370
+ var C;
3371
+ return (C = r.value) == null ? void 0 : C.destroy();
3372
+ }), t({ instance: r, input: n }), (C, y) => et((st(), it("input", nt({
3342
3373
  ref_key: "input",
3343
3374
  ref: n,
3344
- "onUpdate:modelValue": y[0] || (y[0] = (w) => i.value = w),
3375
+ "onUpdate:modelValue": y[0] || (y[0] = (I) => i.value = I),
3345
3376
  type: "tel",
3346
3377
  onCountrychange: b,
3347
3378
  onInput: f
3348
3379
  }, l.inputProps), null, 16)), [
3349
3380
  [
3350
- it,
3381
+ ot,
3351
3382
  i.value,
3352
3383
  void 0,
3353
3384
  { lazy: !0 }
@@ -3356,5 +3387,5 @@ const Lt = (l) => {
3356
3387
  }
3357
3388
  };
3358
3389
  export {
3359
- vt as default
3390
+ Ot as default
3360
3391
  };