intl-tel-input 25.10.12 → 25.11.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.
Files changed (35) hide show
  1. package/README.md +62 -59
  2. package/angular/README.md +1 -1
  3. package/angular/build/IntlTelInput.js +887 -688
  4. package/angular/build/IntlTelInputWithUtils.js +891 -692
  5. package/angular/build/types/intl-tel-input/data.d.ts +3 -3
  6. package/angular/build/types/intl-tel-input.d.ts +22 -70
  7. package/angular/build/types/modules/constants.d.ts +84 -0
  8. package/angular/build/types/modules/core/countrySearch.d.ts +17 -0
  9. package/angular/build/types/modules/core/icons.d.ts +7 -0
  10. package/angular/build/types/modules/core/options.d.ts +2 -1
  11. package/angular/build/types/modules/core/ui.d.ts +44 -0
  12. package/angular/build/types/modules/data/country-data.d.ts +5 -5
  13. package/angular/build/types/modules/format/caret.d.ts +1 -1
  14. package/angular/build/types/modules/format/formatting.d.ts +3 -3
  15. package/angular/build/types/modules/types/events.d.ts +9 -0
  16. package/angular/build/types/modules/types/public-api.d.ts +3 -0
  17. package/angular/build/types/modules/utils/dom.d.ts +5 -0
  18. package/build/js/data.js +8 -2
  19. package/build/js/data.min.js +2 -2
  20. package/build/js/intlTelInput.d.ts +214 -83
  21. package/build/js/intlTelInput.js +1034 -770
  22. package/build/js/intlTelInput.min.js +13 -13
  23. package/build/js/intlTelInputWithUtils.js +1038 -774
  24. package/build/js/intlTelInputWithUtils.min.js +13 -13
  25. package/build/js/utils.js +4 -4
  26. package/package.json +3 -1
  27. package/react/README.md +1 -1
  28. package/react/build/IntlTelInput.cjs +1033 -769
  29. package/react/build/IntlTelInput.d.ts +214 -83
  30. package/react/build/IntlTelInput.js +1033 -769
  31. package/react/build/IntlTelInputWithUtils.cjs +1037 -773
  32. package/react/build/IntlTelInputWithUtils.js +1037 -773
  33. package/vue/README.md +1 -1
  34. package/vue/build/IntlTelInput.mjs +967 -739
  35. package/vue/build/IntlTelInputWithUtils.mjs +1279 -1051
@@ -1,5 +1,5 @@
1
- import { mergeModels as s0, useModel as P0, ref as I1, onMounted as x0, watch as B0, onUnmounted as R0, withDirectives as k0, createElementBlock as O0, openBlock as G0, mergeProps as U0, vModelText as F0 } from "vue";
2
- const K0 = [
1
+ import { mergeModels as g0, useModel as j0, ref as A1, onMounted as Y0, watch as z0, onUnmounted as Z0, withDirectives as J0, createElementBlock as X0, openBlock as q0, mergeProps as Q0, vModelText as d2 } from "vue";
2
+ const t2 = [
3
3
  [
4
4
  "af",
5
5
  // Afghanistan
@@ -1676,20 +1676,26 @@ const K0 = [
1676
1676
  null,
1677
1677
  "0"
1678
1678
  ]
1679
- ], Y = [];
1680
- for (const f of K0)
1681
- Y.push({
1679
+ ], Q = [];
1680
+ for (const h of t2)
1681
+ Q.push({
1682
1682
  name: "",
1683
1683
  // populated in the plugin
1684
- iso2: f[0],
1685
- dialCode: f[1],
1686
- priority: f[2] || 0,
1687
- areaCodes: f[3] || null,
1684
+ iso2: h[0],
1685
+ dialCode: h[1],
1686
+ priority: h[2] || 0,
1687
+ areaCodes: h[3] || null,
1688
1688
  nodeById: {},
1689
1689
  // populated by the plugin
1690
- nationalPrefix: f[4] || null
1690
+ nationalPrefix: h[4] || null,
1691
+ normalisedName: "",
1692
+ // populated in the plugin
1693
+ initials: "",
1694
+ // populated in the plugin
1695
+ dialCodePlus: ""
1696
+ // populated in the plugin
1691
1697
  });
1692
- const V0 = {
1698
+ const e2 = {
1693
1699
  ad: "Andorra",
1694
1700
  ae: "United Arab Emirates",
1695
1701
  af: "Afghanistan",
@@ -1932,7 +1938,7 @@ const V0 = {
1932
1938
  za: "South Africa",
1933
1939
  zm: "Zambia",
1934
1940
  zw: "Zimbabwe"
1935
- }, H0 = {
1941
+ }, $2 = {
1936
1942
  selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1937
1943
  noCountrySelected: "Select country",
1938
1944
  countryListAriaLabel: "List of countries",
@@ -1944,19 +1950,95 @@ const V0 = {
1944
1950
  // additional countries (not supported by country-list library)
1945
1951
  ac: "Ascension Island",
1946
1952
  xk: "Kosovo"
1947
- }, l0 = { ...V0, ...H0 }, v1 = (f) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(f).matches, j0 = () => {
1953
+ }, E0 = { ...e2, ...$2 }, g1 = {
1954
+ OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1955
+ CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1956
+ COUNTRY_CHANGE: "countrychange",
1957
+ INPUT: "input"
1958
+ // used for synthetic input trigger
1959
+ }, E = {
1960
+ HIDE: "iti__hide",
1961
+ V_HIDE: "iti__v-hide",
1962
+ ARROW_UP: "iti__arrow--up",
1963
+ GLOBE: "iti__globe",
1964
+ FLAG: "iti__flag",
1965
+ COUNTRY_ITEM: "iti__country",
1966
+ HIGHLIGHT: "iti__highlight"
1967
+ }, x = {
1968
+ ARROW_UP: "ArrowUp",
1969
+ ARROW_DOWN: "ArrowDown",
1970
+ SPACE: " ",
1971
+ ENTER: "Enter",
1972
+ ESC: "Escape",
1973
+ TAB: "Tab"
1974
+ }, m0 = {
1975
+ PASTE: "insertFromPaste",
1976
+ DELETE_FWD: "deleteContentForward"
1977
+ }, q = {
1978
+ ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
1979
+ // any kind of letter from any language
1980
+ NON_PLUS_NUMERIC: /[^+0-9]/,
1981
+ // chars that are NOT + or digit
1982
+ NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
1983
+ // chars that are NOT + or digit (global)
1984
+ HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
1985
+ // single acceptable hidden-search char
1986
+ }, n2 = {
1987
+ HIDDEN_SEARCH_RESET_MS: 1e3
1988
+ }, y0 = {
1989
+ UNKNOWN_NUMBER_TYPE: -99,
1990
+ UNKNOWN_VALIDATION_ERROR: -99
1991
+ }, w1 = {
1992
+ SANE_SELECTED_WITH_DIAL_WIDTH: 78,
1993
+ // px width fallback when separateDialCode enabled
1994
+ SANE_SELECTED_NO_DIAL_WIDTH: 42,
1995
+ // px width fallback when no separate dial code
1996
+ INPUT_PADDING_EXTRA_LEFT: 6
1997
+ // px gap between selected country container and input text
1998
+ }, N0 = {
1999
+ NANP: "1"
2000
+ // North American Numbering Plan
2001
+ }, b1 = {
2002
+ DIAL_CODE: "44",
2003
+ // +44 United Kingdom
2004
+ MOBILE_PREFIX: "7",
2005
+ // UK mobile numbers start with 7 after national trunk (0) or core section
2006
+ MOBILE_CORE_LENGTH: 10
2007
+ // core number length (excluding dial code / national prefix) for mobiles
2008
+ }, i2 = {
2009
+ ISO2: "us"
2010
+ }, s2 = {
2011
+ POLITE: "polite"
2012
+ }, T1 = {
2013
+ AUTO: "auto"
2014
+ }, I0 = {
2015
+ COUNTRY_CODE: "countryCode",
2016
+ DIAL_CODE: "dialCode"
2017
+ }, L = {
2018
+ EXPANDED: "aria-expanded",
2019
+ LABEL: "aria-label",
2020
+ SELECTED: "aria-selected",
2021
+ ACTIVE_DESCENDANT: "aria-activedescendant",
2022
+ HASPOPUP: "aria-haspopup",
2023
+ CONTROLS: "aria-controls",
2024
+ HIDDEN: "aria-hidden",
2025
+ AUTOCOMPLETE: "aria-autocomplete",
2026
+ MODAL: "aria-modal"
2027
+ }, D1 = (h) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(h).matches, r2 = () => {
1948
2028
  if (typeof navigator < "u" && typeof window < "u") {
1949
- const f = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), e = v1("(max-width: 500px)"), $ = v1("(max-height: 600px)"), i = v1("(pointer: coarse)");
1950
- return f || e || i && $;
2029
+ const h = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
2030
+ navigator.userAgent
2031
+ ), e = D1("(max-width: 500px)"), $ = D1("(max-height: 600px)"), i = D1("(pointer: coarse)");
2032
+ return h || e || i && $;
1951
2033
  }
1952
2034
  return !1;
1953
- }, u0 = {
2035
+ }, S0 = {
1954
2036
  // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1955
2037
  allowPhonewords: !1,
1956
2038
  //* Whether or not to allow the dropdown.
1957
2039
  allowDropdown: !0,
1958
2040
  //* Add a placeholder in the input with an example number for the selected country.
1959
- autoPlaceholder: "polite",
2041
+ autoPlaceholder: s2.POLITE,
1960
2042
  //* Modify the parentClass.
1961
2043
  containerClass: "",
1962
2044
  //* The order of the countries in the dropdown. Defaults to alphabetical.
@@ -1998,246 +2080,112 @@ const V0 = {
1998
2080
  //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
1999
2081
  strictMode: !1,
2000
2082
  //* Use full screen popup instead of dropdown for country list.
2001
- useFullscreenPopup: j0(),
2083
+ useFullscreenPopup: r2(),
2002
2084
  //* The number type to enforce during validation.
2003
2085
  validationNumberTypes: ["MOBILE"]
2086
+ }, o2 = (h, e) => {
2087
+ h.useFullscreenPopup && (h.fixDropdownWidth = !1), h.onlyCountries.length === 1 && (h.initialCountry = h.onlyCountries[0]), h.separateDialCode && (h.nationalMode = !1), h.allowDropdown && !h.showFlags && !h.separateDialCode && (h.nationalMode = !1), h.useFullscreenPopup && !h.dropdownContainer && (h.dropdownContainer = document.body), h.i18n = { ...e, ...h.i18n };
2088
+ }, m1 = (h) => h.replace(/\D/g, ""), L0 = (h = "") => h.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), u2 = (h, e) => {
2089
+ const $ = L0(e), i = [], s = [], a = [], u = [], f = [], C = [];
2090
+ for (const _ of h)
2091
+ _.iso2 === $ ? i.push(_) : _.normalisedName.startsWith($) ? s.push(_) : _.normalisedName.includes($) ? a.push(_) : $ === _.dialCode || $ === _.dialCodePlus ? u.push(_) : _.dialCodePlus.includes($) ? f.push(_) : _.initials.includes($) && C.push(_);
2092
+ const I = (_, A) => _.priority - A.priority;
2093
+ return [
2094
+ ...i.sort(I),
2095
+ ...s.sort(I),
2096
+ ...a.sort(I),
2097
+ ...u.sort(I),
2098
+ ...f.sort(I),
2099
+ ...C.sort(I)
2100
+ ];
2101
+ }, l2 = (h, e) => {
2102
+ const $ = e.toLowerCase();
2103
+ for (const i of h)
2104
+ if (i.name.toLowerCase().startsWith($))
2105
+ return i;
2106
+ return null;
2107
+ }, v1 = (h) => Object.keys(h).filter((e) => !!h[e]).join(" "), w = (h, e, $) => {
2108
+ const i = document.createElement(h);
2109
+ return e && Object.entries(e).forEach(
2110
+ ([s, a]) => i.setAttribute(s, a)
2111
+ ), $ && $.appendChild(i), i;
2112
+ }, a2 = () => `
2113
+ <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${L.HIDDEN}="true">
2114
+ <circle cx="11" cy="11" r="7" />
2115
+ <line x1="21" y1="21" x2="16.65" y2="16.65" />
2116
+ </svg>`, c2 = (h) => {
2117
+ const e = `iti-${h}-clear-mask`;
2118
+ return `
2119
+ <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${L.HIDDEN}="true" focusable="false">
2120
+ <mask id="${e}" maskUnits="userSpaceOnUse">
2121
+ <rect width="16" height="16" fill="white" />
2122
+ <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" />
2123
+ </mask>
2124
+ <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${e})" />
2125
+ </svg>`;
2004
2126
  };
2005
- function W0(f) {
2006
- f.useFullscreenPopup && (f.fixDropdownWidth = !1), f.onlyCountries.length === 1 && (f.initialCountry = f.onlyCountries[0]), f.separateDialCode && (f.nationalMode = !1), f.allowDropdown && !f.showFlags && !f.separateDialCode && (f.nationalMode = !1), f.useFullscreenPopup && !f.dropdownContainer && (f.dropdownContainer = document.body), f.i18n = { ...l0, ...f.i18n };
2007
- }
2008
- const c1 = (f) => f.replace(/\D/g, ""), a0 = (f = "") => f.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), L = (f, e, $) => {
2009
- const i = document.createElement(f);
2010
- return e && Object.entries(e).forEach(([r, u]) => i.setAttribute(r, u)), $ && $.appendChild(i), i;
2011
- };
2012
- function z0(f) {
2013
- const { onlyCountries: e, excludeCountries: $ } = f;
2014
- if (e.length) {
2015
- const i = e.map((r) => r.toLowerCase());
2016
- return Y.filter((r) => i.includes(r.iso2));
2017
- } else if ($.length) {
2018
- const i = $.map((r) => r.toLowerCase());
2019
- return Y.filter((r) => !i.includes(r.iso2));
2020
- }
2021
- return Y;
2022
- }
2023
- function Z0(f, e) {
2024
- for (const $ of f) {
2025
- const i = $.iso2.toLowerCase();
2026
- e.i18n[i] && ($.name = e.i18n[i]);
2027
- }
2028
- }
2029
- function Y0(f, e) {
2030
- const $ = /* @__PURE__ */ new Set();
2031
- let i = 0;
2032
- const r = {}, u = (h, c, C) => {
2033
- if (!h || !c)
2034
- return;
2035
- c.length > i && (i = c.length), r.hasOwnProperty(c) || (r[c] = []);
2036
- const g = r[c];
2037
- if (g.includes(h))
2038
- return;
2039
- const I = C !== void 0 ? C : g.length;
2040
- g[I] = h;
2041
- };
2042
- for (const h of f) {
2043
- $.has(h.dialCode) || $.add(h.dialCode);
2044
- for (let c = 1; c < h.dialCode.length; c++) {
2045
- const C = h.dialCode.substring(0, c);
2046
- u(h.iso2, C);
2047
- }
2048
- u(h.iso2, h.dialCode, h.priority);
2049
- }
2050
- (e.onlyCountries.length || e.excludeCountries.length) && $.forEach((h) => {
2051
- r[h] = r[h].filter(Boolean);
2052
- });
2053
- for (const h of f)
2054
- if (h.areaCodes) {
2055
- const c = r[h.dialCode][0];
2056
- for (const C of h.areaCodes) {
2057
- for (let g = 1; g < C.length; g++) {
2058
- const I = C.substring(0, g), w = h.dialCode + I;
2059
- u(c, w), u(h.iso2, w);
2060
- }
2061
- u(h.iso2, h.dialCode + C);
2062
- }
2063
- }
2064
- return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: r };
2065
- }
2066
- function J0(f, e) {
2067
- e.countryOrder && (e.countryOrder = e.countryOrder.map(($) => $.toLowerCase())), f.sort(($, i) => {
2068
- const { countryOrder: r } = e;
2069
- if (r) {
2070
- const u = r.indexOf($.iso2), h = r.indexOf(i.iso2), c = u > -1, C = h > -1;
2071
- if (c || C)
2072
- return c && C ? u - h : c ? -1 : 1;
2073
- }
2074
- return $.name.localeCompare(i.name);
2075
- });
2076
- }
2077
- function q0(f) {
2078
- for (const e of f)
2079
- e.normalisedName = a0(e.name), e.initials = e.name.split(/[^a-zA-ZÀ-ÿа-яА-Я]/).map(($) => $[0]).join("").toLowerCase(), e.dialCodePlus = `+${e.dialCode}`;
2080
- }
2081
- function X0(f, e, $, i) {
2082
- let r = f;
2083
- if ($ && e) {
2084
- e = `+${i.dialCode}`;
2085
- const u = r[e.length] === " " || r[e.length] === "-" ? e.length + 1 : e.length;
2086
- r = r.substring(u);
2087
- }
2088
- return r;
2089
- }
2090
- function Q0(f, e, $, i, r) {
2091
- const u = $ ? $.formatNumberAsYouType(f, i.iso2) : f, { dialCode: h } = i;
2092
- return r && e.charAt(0) !== "+" && u.includes(`+${h}`) ? (u.split(`+${h}`)[1] || "").trim() : u;
2093
- }
2094
- function d2(f, e, $, i) {
2095
- if ($ === 0 && !i)
2096
- return 0;
2097
- let r = 0;
2098
- for (let u = 0; u < e.length; u++) {
2099
- if (/[+0-9]/.test(e[u]) && r++, r === f && !i)
2100
- return u + 1;
2101
- if (i && r === f + 1)
2102
- return u;
2103
- }
2104
- return e.length;
2105
- }
2106
- const t2 = [
2107
- "800",
2108
- "822",
2109
- "833",
2110
- "844",
2111
- "855",
2112
- "866",
2113
- "877",
2114
- "880",
2115
- "881",
2116
- "882",
2117
- "883",
2118
- "884",
2119
- "885",
2120
- "886",
2121
- "887",
2122
- "888",
2123
- "889"
2124
- ], o0 = (f) => {
2125
- const e = c1(f);
2126
- if (e.charAt(0) === "1") {
2127
- const $ = e.substring(1, 4);
2128
- return t2.includes($);
2129
- }
2130
- return !1;
2131
- };
2132
- for (const f of Y)
2133
- f.name = l0[f.iso2];
2134
- let e2 = 0;
2135
- const $2 = new Set(Y.map((f) => f.iso2)), w1 = (f) => $2.has(f), $1 = (f, ...e) => {
2136
- const { instances: $ } = y;
2137
- Object.values($).forEach((i) => i[f](...e));
2138
- };
2139
- class f1 {
2140
- /**
2141
- * Build a space-delimited class string from an object map of className -> truthy/falsey.
2142
- * Only keys with truthy values are included.
2143
- */
2144
- static _buildClassNames(e) {
2145
- return Object.keys(e).filter(($) => !!e[$]).join(" ");
2146
- }
2147
- constructor(e, $ = {}) {
2148
- this.id = e2++, this.telInput = e, this.highlightedItem = null, this.options = Object.assign({}, u0, $), this.hadInitialPlaceholder = !!e.getAttribute("placeholder");
2149
- }
2150
- _detectEnvironmentAndLayout() {
2151
- this.isAndroid = typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1, this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2152
- }
2153
- _createInitPromises() {
2154
- const e = new Promise((i, r) => {
2155
- this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = r;
2156
- }), $ = new Promise((i, r) => {
2157
- this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = r;
2158
- });
2159
- this.promise = Promise.all([e, $]);
2160
- }
2161
- //* Can't be private as it's called from intlTelInput convenience wrapper.
2162
- _init() {
2163
- W0(this.options), this._detectEnvironmentAndLayout(), this._createInitPromises(), this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
2164
- }
2165
- //********************
2166
- //* PRIVATE METHODS
2167
- //********************
2168
- //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
2169
- _processCountryData() {
2170
- this.countries = z0(this.options);
2171
- const e = Y0(this.countries, this.options);
2172
- this.dialCodes = e.dialCodes, this.dialCodeMaxLen = e.dialCodeMaxLen, this.dialCodeToIso2Map = e.dialCodeToIso2Map, Z0(this.countries, this.options), J0(this.countries, this.options), this.countryByIso2 = new Map(this.countries.map(($) => [$.iso2, $])), q0(this.countries);
2127
+ class h2 {
2128
+ constructor(e, $, i) {
2129
+ this.highlightedItem = null, e.dataset.intlTelInputId = i.toString(), this.telInput = e, this.options = $, this.id = i, this.hadInitialPlaceholder = !!e.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2173
2130
  }
2174
2131
  //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
2175
- _generateMarkup() {
2176
- this._prepareTelInput();
2177
- const e = this._createWrapperAndInsert();
2178
- this._maybeBuildCountryContainer(e), e.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs(e);
2132
+ generateMarkup(e) {
2133
+ this.countries = e, this._prepareTelInput();
2134
+ const $ = this._createWrapperAndInsert();
2135
+ this._maybeBuildCountryContainer($), $.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs($);
2179
2136
  }
2180
2137
  _prepareTelInput() {
2181
- this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
2138
+ var e;
2139
+ this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((e = this.telInput.form) != null && e.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
2182
2140
  }
2183
2141
  _createWrapperAndInsert() {
2184
- var c;
2185
- const {
2186
- allowDropdown: e,
2187
- showFlags: $,
2188
- containerClass: i,
2189
- useFullscreenPopup: r
2190
- } = this.options, u = f1._buildClassNames({
2142
+ const { allowDropdown: e, showFlags: $, containerClass: i, useFullscreenPopup: s } = this.options, a = v1({
2191
2143
  iti: !0,
2192
2144
  "iti--allow-dropdown": e,
2193
2145
  "iti--show-flags": $,
2194
- "iti--inline-dropdown": !r,
2146
+ "iti--inline-dropdown": !s,
2195
2147
  [i]: !!i
2196
- }), h = L("div", { class: u });
2197
- return this.isRTL && h.setAttribute("dir", "ltr"), (c = this.telInput.parentNode) == null || c.insertBefore(h, this.telInput), h;
2148
+ }), u = w("div", { class: a });
2149
+ return this.isRTL && u.setAttribute("dir", "ltr"), this.telInput.before(u), u;
2198
2150
  }
2199
2151
  _maybeBuildCountryContainer(e) {
2200
- const {
2201
- allowDropdown: $,
2202
- separateDialCode: i,
2203
- showFlags: r
2204
- } = this.options;
2205
- if ($ || r || i) {
2206
- this.countryContainer = L(
2152
+ const { allowDropdown: $, separateDialCode: i, showFlags: s } = this.options;
2153
+ if ($ || s || i) {
2154
+ this.countryContainer = w(
2207
2155
  "div",
2208
2156
  // visibly hidden until we measure it's width to set the input padding correctly
2209
- { class: "iti__country-container iti__v-hide" },
2157
+ { class: `iti__country-container ${E.V_HIDE}` },
2210
2158
  e
2211
- ), $ ? (this.selectedCountry = L(
2159
+ ), $ ? (this.selectedCountry = w(
2212
2160
  "button",
2213
2161
  {
2214
2162
  type: "button",
2215
2163
  class: "iti__selected-country",
2216
- "aria-expanded": "false",
2217
- "aria-label": this.options.i18n.noCountrySelected,
2218
- "aria-haspopup": "dialog",
2219
- "aria-controls": `iti-${this.id}__dropdown-content`
2164
+ [L.EXPANDED]: "false",
2165
+ [L.LABEL]: this.options.i18n.noCountrySelected,
2166
+ [L.HASPOPUP]: "dialog",
2167
+ [L.CONTROLS]: `iti-${this.id}__dropdown-content`
2220
2168
  },
2221
2169
  this.countryContainer
2222
- ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = L(
2170
+ ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = w(
2223
2171
  "div",
2224
2172
  { class: "iti__selected-country" },
2225
2173
  this.countryContainer
2226
2174
  );
2227
- const u = L(
2175
+ const a = w(
2228
2176
  "div",
2229
2177
  { class: "iti__selected-country-primary" },
2230
2178
  this.selectedCountry
2231
2179
  );
2232
- this.selectedCountryInner = L(
2180
+ this.selectedCountryInner = w(
2233
2181
  "div",
2234
- { class: "iti__flag" },
2235
- u
2236
- ), $ && (this.dropdownArrow = L(
2182
+ { class: E.FLAG },
2183
+ a
2184
+ ), $ && (this.dropdownArrow = w(
2237
2185
  "div",
2238
- { class: "iti__arrow", "aria-hidden": "true" },
2239
- u
2240
- )), i && (this.selectedDialCode = L(
2186
+ { class: "iti__arrow", [L.HIDDEN]: "true" },
2187
+ a
2188
+ )), i && (this.selectedDialCode = w(
2241
2189
  "div",
2242
2190
  { class: "iti__selected-dial-code" },
2243
2191
  this.selectedCountry
@@ -2249,54 +2197,50 @@ class f1 {
2249
2197
  fixDropdownWidth: e,
2250
2198
  useFullscreenPopup: $,
2251
2199
  countrySearch: i,
2252
- i18n: r,
2253
- dropdownContainer: u,
2254
- containerClass: h
2255
- } = this.options, c = e ? "" : "iti--flexible-dropdown-width";
2256
- if (this.dropdownContent = L("div", {
2200
+ i18n: s,
2201
+ dropdownContainer: a,
2202
+ containerClass: u
2203
+ } = this.options, f = e ? "" : "iti--flexible-dropdown-width";
2204
+ if (this.dropdownContent = w("div", {
2257
2205
  id: `iti-${this.id}__dropdown-content`,
2258
- class: `iti__dropdown-content iti__hide ${c}`,
2206
+ class: `iti__dropdown-content ${E.HIDE} ${f}`,
2259
2207
  role: "dialog",
2260
- "aria-modal": "true"
2261
- }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = L(
2208
+ [L.MODAL]: "true"
2209
+ }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = w(
2262
2210
  "ul",
2263
2211
  {
2264
2212
  class: "iti__country-list",
2265
2213
  id: `iti-${this.id}__country-listbox`,
2266
2214
  role: "listbox",
2267
- "aria-label": r.countryListAriaLabel
2215
+ [L.LABEL]: s.countryListAriaLabel
2268
2216
  },
2269
2217
  this.dropdownContent
2270
- ), this._appendListItems(), i && this._updateSearchResultsA11yText(), u) {
2271
- const C = f1._buildClassNames({
2218
+ ), this._appendListItems(), i && this.updateSearchResultsA11yText(), a) {
2219
+ const C = v1({
2272
2220
  iti: !0,
2273
2221
  "iti--container": !0,
2274
2222
  "iti--fullscreen-popup": $,
2275
2223
  "iti--inline-dropdown": !$,
2276
- [h]: !!h
2224
+ [u]: !!u
2277
2225
  });
2278
- this.dropdown = L("div", { class: C }), this.dropdown.appendChild(this.dropdownContent);
2226
+ this.dropdown = w("div", { class: C }), this.dropdown.appendChild(this.dropdownContent);
2279
2227
  } else
2280
2228
  this.countryContainer.appendChild(this.dropdownContent);
2281
2229
  }
2282
2230
  _buildSearchUI() {
2283
- const { i18n: e } = this.options, $ = L(
2231
+ const { i18n: e } = this.options, $ = w(
2284
2232
  "div",
2285
2233
  { class: "iti__search-input-wrapper" },
2286
2234
  this.dropdownContent
2287
2235
  );
2288
- this.searchIcon = L(
2236
+ this.searchIcon = w(
2289
2237
  "span",
2290
2238
  {
2291
2239
  class: "iti__search-icon",
2292
- "aria-hidden": "true"
2240
+ [L.HIDDEN]: "true"
2293
2241
  },
2294
2242
  $
2295
- ), this.searchIcon.innerHTML = `
2296
- <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" aria-hidden="true">
2297
- <circle cx="11" cy="11" r="7" />
2298
- <line x1="21" y1="21" x2="16.65" y2="16.65" />
2299
- </svg>`, this.searchInput = L(
2243
+ ), this.searchIcon.innerHTML = a2(), this.searchInput = w(
2300
2244
  "input",
2301
2245
  {
2302
2246
  id: `iti-${this.id}__search-input`,
@@ -2306,356 +2250,687 @@ class f1 {
2306
2250
  placeholder: e.searchPlaceholder,
2307
2251
  // 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
2308
2252
  role: "combobox",
2309
- "aria-expanded": "true",
2310
- "aria-label": e.searchPlaceholder,
2311
- "aria-controls": `iti-${this.id}__country-listbox`,
2312
- "aria-autocomplete": "list",
2253
+ [L.EXPANDED]: "true",
2254
+ [L.LABEL]: e.searchPlaceholder,
2255
+ [L.CONTROLS]: `iti-${this.id}__country-listbox`,
2256
+ [L.AUTOCOMPLETE]: "list",
2313
2257
  autocomplete: "off"
2314
2258
  },
2315
2259
  $
2316
- ), this.searchClearButton = L(
2260
+ ), this.searchClearButton = w(
2317
2261
  "button",
2318
2262
  {
2319
2263
  type: "button",
2320
- class: "iti__search-clear iti__hide",
2321
- "aria-label": e.clearSearchAriaLabel,
2264
+ class: `iti__search-clear ${E.HIDE}`,
2265
+ [L.LABEL]: e.clearSearchAriaLabel,
2322
2266
  tabindex: "-1"
2323
2267
  },
2324
2268
  $
2325
- );
2326
- const i = `iti-${this.id}-clear-mask`;
2327
- this.searchClearButton.innerHTML = `
2328
- <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
2329
- <mask id="${i}" maskUnits="userSpaceOnUse">
2330
- <rect width="16" height="16" fill="white" />
2331
- <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" />
2332
- </mask>
2333
- <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${i})" />
2334
- </svg>`, this.searchResultsA11yText = L(
2269
+ ), this.searchClearButton.innerHTML = c2(this.id), this.searchResultsA11yText = w(
2335
2270
  "span",
2336
2271
  { class: "iti__a11y-text" },
2337
2272
  this.dropdownContent
2338
- ), this.searchNoResults = L(
2273
+ ), this.searchNoResults = w(
2339
2274
  "div",
2340
2275
  {
2341
- class: "iti__no-results iti__hide",
2342
- "aria-hidden": "true"
2276
+ class: `iti__no-results ${E.HIDE}`,
2277
+ [L.HIDDEN]: "true"
2343
2278
  // all a11y messaging happens in this.searchResultsA11yText
2344
2279
  },
2345
2280
  this.dropdownContent
2346
2281
  ), this.searchNoResults.textContent = e.zeroSearchResults;
2347
2282
  }
2348
2283
  _maybeUpdateInputPaddingAndReveal() {
2349
- this.countryContainer && (this._updateInputPadding(), this.countryContainer.classList.remove("iti__v-hide"));
2284
+ this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove(E.V_HIDE));
2350
2285
  }
2351
2286
  _maybeBuildHiddenInputs(e) {
2352
- var i, r;
2287
+ var i, s;
2353
2288
  const { hiddenInput: $ } = this.options;
2354
2289
  if ($) {
2355
- const u = this.telInput.getAttribute("name") || "", h = $(u);
2356
- if (h.phone) {
2357
- const c = (i = this.telInput.form) == null ? void 0 : i.querySelector(`input[name="${h.phone}"]`);
2358
- c ? this.hiddenInput = c : (this.hiddenInput = L("input", {
2290
+ const a = this.telInput.getAttribute("name") || "", u = $(a);
2291
+ if (u.phone) {
2292
+ const f = (i = this.telInput.form) == null ? void 0 : i.querySelector(
2293
+ `input[name="${u.phone}"]`
2294
+ );
2295
+ f ? this.hiddenInput = f : (this.hiddenInput = w("input", {
2359
2296
  type: "hidden",
2360
- name: h.phone
2297
+ name: u.phone
2361
2298
  }), e.appendChild(this.hiddenInput));
2362
2299
  }
2363
- if (h.country) {
2364
- const c = (r = this.telInput.form) == null ? void 0 : r.querySelector(`input[name="${h.country}"]`);
2365
- c ? this.hiddenInputCountry = c : (this.hiddenInputCountry = L("input", {
2300
+ if (u.country) {
2301
+ const f = (s = this.telInput.form) == null ? void 0 : s.querySelector(
2302
+ `input[name="${u.country}"]`
2303
+ );
2304
+ f ? this.hiddenInputCountry = f : (this.hiddenInputCountry = w("input", {
2366
2305
  type: "hidden",
2367
- name: h.country
2306
+ name: u.country
2368
2307
  }), e.appendChild(this.hiddenInputCountry));
2369
2308
  }
2370
2309
  }
2371
2310
  }
2372
2311
  //* For each country: add a country list item <li> to the countryList <ul> container.
2373
2312
  _appendListItems() {
2374
- for (let e = 0; e < this.countries.length; e++) {
2375
- const $ = this.countries[e], i = e === 0 ? "iti__highlight" : "", r = L(
2376
- "li",
2377
- {
2378
- id: `iti-${this.id}__item-${$.iso2}`,
2379
- class: `iti__country ${i}`,
2380
- tabindex: "-1",
2381
- role: "option",
2382
- "data-dial-code": $.dialCode,
2383
- "data-country-code": $.iso2,
2384
- "aria-selected": "false"
2385
- },
2386
- this.countryList
2313
+ const e = document.createDocumentFragment();
2314
+ for (let $ = 0; $ < this.countries.length; $++) {
2315
+ const i = this.countries[$], s = v1({
2316
+ [E.COUNTRY_ITEM]: !0,
2317
+ [E.HIGHLIGHT]: $ === 0
2318
+ }), a = w("li", {
2319
+ id: `iti-${this.id}__item-${i.iso2}`,
2320
+ class: s,
2321
+ tabindex: "-1",
2322
+ role: "option",
2323
+ [L.SELECTED]: "false"
2324
+ });
2325
+ a.dataset.dialCode = i.dialCode, a.dataset.countryCode = i.iso2, i.nodeById[this.id] = a, this.options.showFlags && w("div", { class: `${E.FLAG} iti__${i.iso2}` }, a);
2326
+ const u = w("span", { class: "iti__country-name" }, a);
2327
+ u.textContent = i.name;
2328
+ const f = w("span", { class: "iti__dial-code" }, a);
2329
+ this.isRTL && f.setAttribute("dir", "ltr"), f.textContent = `+${i.dialCode}`, e.appendChild(a);
2330
+ }
2331
+ this.countryList.appendChild(e);
2332
+ }
2333
+ //* Update the input padding to make space for the selected country/dial code.
2334
+ updateInputPadding() {
2335
+ if (this.selectedCountry) {
2336
+ const e = this.options.separateDialCode ? w1.SANE_SELECTED_WITH_DIAL_WIDTH : w1.SANE_SELECTED_NO_DIAL_WIDTH, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + w1.INPUT_PADDING_EXTRA_LEFT;
2337
+ this.telInput.style.paddingLeft = `${i}px`;
2338
+ }
2339
+ }
2340
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2341
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2342
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2343
+ //* and then to inject a deep clone of the selectedCountry element.
2344
+ _getHiddenSelectedCountryWidth() {
2345
+ if (this.telInput.parentNode) {
2346
+ let e;
2347
+ try {
2348
+ e = window.top.document.body;
2349
+ } catch {
2350
+ e = document.body;
2351
+ }
2352
+ const $ = this.telInput.parentNode.cloneNode(
2353
+ !1
2354
+ );
2355
+ $.style.visibility = "hidden", e.appendChild($);
2356
+ const i = this.countryContainer.cloneNode();
2357
+ $.appendChild(i);
2358
+ const s = this.selectedCountry.cloneNode(
2359
+ !0
2387
2360
  );
2388
- $.nodeById[this.id] = r;
2389
- let u = "";
2390
- this.options.showFlags && (u += `<div class='iti__flag iti__${$.iso2}'></div>`), u += `<span class='iti__country-name'>${$.name}</span>`, u += `<span class='iti__dial-code' dir='ltr'>+${$.dialCode}</span>`, r.insertAdjacentHTML("beforeend", u);
2361
+ i.appendChild(s);
2362
+ const a = s.offsetWidth;
2363
+ return e.removeChild($), a;
2364
+ }
2365
+ return 0;
2366
+ }
2367
+ //* Update search results text (for a11y).
2368
+ updateSearchResultsA11yText() {
2369
+ const { i18n: e } = this.options, $ = this.countryList.childElementCount;
2370
+ let i;
2371
+ $ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace(
2372
+ "${count}",
2373
+ $.toString()
2374
+ ), this.searchResultsA11yText.textContent = i;
2375
+ }
2376
+ //* Check if an element is visible within it's container, else scroll until it is.
2377
+ scrollTo(e) {
2378
+ const $ = this.countryList, i = document.documentElement.scrollTop, s = $.offsetHeight, a = $.getBoundingClientRect().top + i, u = a + s, f = e.offsetHeight, C = e.getBoundingClientRect().top + i, I = C + f, _ = C - a + $.scrollTop;
2379
+ if (C < a)
2380
+ $.scrollTop = _;
2381
+ else if (I > u) {
2382
+ const A = s - f;
2383
+ $.scrollTop = _ - A;
2391
2384
  }
2392
2385
  }
2386
+ //* Remove highlighting from other list items and highlight the given item.
2387
+ highlightListItem(e, $) {
2388
+ const i = this.highlightedItem;
2389
+ if (i && (i.classList.remove(E.HIGHLIGHT), i.setAttribute(L.SELECTED, "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add(E.HIGHLIGHT), this.highlightedItem.setAttribute(L.SELECTED, "true"), this.options.countrySearch)) {
2390
+ const s = this.highlightedItem.getAttribute("id") || "";
2391
+ this.searchInput.setAttribute(L.ACTIVE_DESCENDANT, s);
2392
+ }
2393
+ $ && this.highlightedItem.focus();
2394
+ }
2395
+ //* Country search: Filter the country list to the given array of countries.
2396
+ filterCountries(e) {
2397
+ this.countryList.innerHTML = "";
2398
+ let $ = !0;
2399
+ for (const i of e) {
2400
+ const s = i.nodeById[this.id];
2401
+ s && (this.countryList.appendChild(s), $ && (this.highlightListItem(s, !1), $ = !1));
2402
+ }
2403
+ $ ? (this.highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove(E.HIDE)) : this.searchNoResults && this.searchNoResults.classList.add(E.HIDE), this.countryList.scrollTop = 0, this.updateSearchResultsA11yText();
2404
+ }
2405
+ destroy() {
2406
+ this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
2407
+ const e = this.telInput.parentNode;
2408
+ e.before(this.telInput), e.remove(), this.telInput = null, this.countryContainer = null, this.selectedCountry = null, this.selectedCountryInner = null, this.selectedDialCode = null, this.dropdownArrow = null, this.dropdownContent = null, this.searchInput = null, this.searchIcon = null, this.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null;
2409
+ for (const $ of this.countries)
2410
+ delete $.nodeById[this.id];
2411
+ this.countries = null;
2412
+ }
2413
+ }
2414
+ const f2 = (h) => {
2415
+ const { onlyCountries: e, excludeCountries: $ } = h;
2416
+ if (e.length) {
2417
+ const i = e.map(
2418
+ (s) => s.toLowerCase()
2419
+ );
2420
+ return Q.filter(
2421
+ (s) => i.includes(s.iso2)
2422
+ );
2423
+ } else if ($.length) {
2424
+ const i = $.map(
2425
+ (s) => s.toLowerCase()
2426
+ );
2427
+ return Q.filter(
2428
+ (s) => !i.includes(s.iso2)
2429
+ );
2430
+ }
2431
+ return Q;
2432
+ }, p2 = (h, e) => {
2433
+ for (const $ of h) {
2434
+ const i = $.iso2.toLowerCase();
2435
+ e.i18n[i] && ($.name = e.i18n[i]);
2436
+ }
2437
+ }, C2 = (h, e) => {
2438
+ const $ = /* @__PURE__ */ new Set();
2439
+ let i = 0;
2440
+ const s = {}, a = (u, f, C) => {
2441
+ if (!u || !f)
2442
+ return;
2443
+ f.length > i && (i = f.length), s.hasOwnProperty(f) || (s[f] = []);
2444
+ const I = s[f];
2445
+ if (I.includes(u))
2446
+ return;
2447
+ const _ = C !== void 0 ? C : I.length;
2448
+ I[_] = u;
2449
+ };
2450
+ for (const u of h) {
2451
+ $.has(u.dialCode) || $.add(u.dialCode);
2452
+ for (let f = 1; f < u.dialCode.length; f++) {
2453
+ const C = u.dialCode.substring(0, f);
2454
+ a(u.iso2, C);
2455
+ }
2456
+ a(u.iso2, u.dialCode, u.priority);
2457
+ }
2458
+ (e.onlyCountries.length || e.excludeCountries.length) && $.forEach((u) => {
2459
+ s[u] = s[u].filter(Boolean);
2460
+ });
2461
+ for (const u of h)
2462
+ if (u.areaCodes) {
2463
+ const f = s[u.dialCode][0];
2464
+ for (const C of u.areaCodes) {
2465
+ for (let I = 1; I < C.length; I++) {
2466
+ const _ = C.substring(0, I), A = u.dialCode + _;
2467
+ a(f, A), a(u.iso2, A);
2468
+ }
2469
+ a(u.iso2, u.dialCode + C);
2470
+ }
2471
+ }
2472
+ return { dialCodes: $, dialCodeMaxLen: i, dialCodeToIso2Map: s };
2473
+ }, g2 = (h, e) => {
2474
+ e.countryOrder && (e.countryOrder = e.countryOrder.map(
2475
+ ($) => $.toLowerCase()
2476
+ )), h.sort(($, i) => {
2477
+ const { countryOrder: s } = e;
2478
+ if (s) {
2479
+ const a = s.indexOf($.iso2), u = s.indexOf(i.iso2), f = a > -1, C = u > -1;
2480
+ if (f || C)
2481
+ return f && C ? a - u : f ? -1 : 1;
2482
+ }
2483
+ return $.name.localeCompare(i.name);
2484
+ });
2485
+ }, m2 = (h) => {
2486
+ for (const e of h)
2487
+ e.normalisedName = L0(e.name), e.initials = e.normalisedName.split(/[^a-z]/).map(($) => $[0]).join(""), e.dialCodePlus = `+${e.dialCode}`;
2488
+ }, y2 = (h, e, $, i) => {
2489
+ let s = h;
2490
+ if ($ && e) {
2491
+ e = `+${i.dialCode}`;
2492
+ const a = s[e.length] === " " || s[e.length] === "-" ? e.length + 1 : e.length;
2493
+ s = s.substring(a);
2494
+ }
2495
+ return s;
2496
+ }, I2 = (h, e, $, i, s) => {
2497
+ const a = $ ? $.formatNumberAsYouType(h, i.iso2) : h, { dialCode: u } = i;
2498
+ return s && e.charAt(0) !== "+" && a.includes(`+${u}`) ? (a.split(`+${u}`)[1] || "").trim() : a;
2499
+ }, _2 = (h, e, $, i) => {
2500
+ if ($ === 0 && !i)
2501
+ return 0;
2502
+ let s = 0;
2503
+ for (let a = 0; a < e.length; a++) {
2504
+ if (/[+0-9]/.test(e[a]) && s++, s === h && !i)
2505
+ return a + 1;
2506
+ if (i && s === h + 1)
2507
+ return a;
2508
+ }
2509
+ return e.length;
2510
+ }, E2 = [
2511
+ "800",
2512
+ "822",
2513
+ "833",
2514
+ "844",
2515
+ "855",
2516
+ "866",
2517
+ "877",
2518
+ "880",
2519
+ "881",
2520
+ "882",
2521
+ "883",
2522
+ "884",
2523
+ "885",
2524
+ "886",
2525
+ "887",
2526
+ "888",
2527
+ "889"
2528
+ ], _0 = (h) => {
2529
+ const e = m1(h);
2530
+ if (e.startsWith(N0.NANP) && e.length >= 4) {
2531
+ const $ = e.substring(1, 4);
2532
+ return E2.includes($);
2533
+ }
2534
+ return !1;
2535
+ };
2536
+ for (const h of Q)
2537
+ h.name = E0[h.iso2];
2538
+ let N2 = 0;
2539
+ const S2 = new Set(Q.map((h) => h.iso2)), P1 = (h) => S2.has(h);
2540
+ class M1 {
2541
+ constructor(e, $ = {}) {
2542
+ this.id = N2++, this.options = { ...S0, ...$ }, o2(this.options, E0), this.ui = new h2(e, this.options, this.id), this.isAndroid = M1._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = f2(this.options);
2543
+ const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: a } = C2(
2544
+ this.countries,
2545
+ this.options
2546
+ );
2547
+ this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = a, this.countryByIso2 = new Map(this.countries.map((u) => [u.iso2, u])), this._init();
2548
+ }
2549
+ static _getIsAndroid() {
2550
+ return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
2551
+ }
2552
+ _createInitPromises() {
2553
+ const e = new Promise((i, s) => {
2554
+ this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
2555
+ }), $ = new Promise((i, s) => {
2556
+ this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = s;
2557
+ });
2558
+ return Promise.all([e, $]);
2559
+ }
2560
+ //* Can't be private as it's called from intlTelInput convenience wrapper.
2561
+ _init() {
2562
+ this.selectedCountryData = {}, this.abortController = new AbortController(), this._processCountryData(), this.ui.generateMarkup(this.countries), this._setInitialState(), this._initListeners(), this._initRequests();
2563
+ }
2564
+ //********************
2565
+ //* PRIVATE METHODS
2566
+ //********************
2567
+ //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
2568
+ _processCountryData() {
2569
+ p2(this.countries, this.options), g2(this.countries, this.options), m2(this.countries);
2570
+ }
2393
2571
  //* Set the initial state of the input value and the selected country by:
2394
2572
  //* 1. Extracting a dial code from the given number
2395
2573
  //* 2. Using explicit initialCountry
2396
2574
  _setInitialState(e = !1) {
2397
- const $ = this.telInput.getAttribute("value"), i = this.telInput.value, u = $ && $.charAt(0) === "+" && (!i || i.charAt(0) !== "+") ? $ : i, h = this._getDialCode(u), c = o0(u), { initialCountry: C, geoIpLookup: g } = this.options, I = C === "auto" && g;
2398
- if (h && !c)
2399
- this._updateCountryFromNumber(u);
2400
- else if (!I || e) {
2401
- const w = C ? C.toLowerCase() : "";
2402
- w1(w) ? this._setCountry(w) : h && c ? this._setCountry("us") : this._setCountry("");
2575
+ const $ = this.ui.telInput.getAttribute("value"), i = this.ui.telInput.value, a = $ && $.startsWith("+") && (!i || !i.startsWith("+")) ? $ : i, u = this._getDialCode(a), f = _0(a), { initialCountry: C, geoIpLookup: I } = this.options, _ = C === T1.AUTO && I;
2576
+ if (u && !f)
2577
+ this._updateCountryFromNumber(a);
2578
+ else if (!_ || e) {
2579
+ const A = C ? C.toLowerCase() : "";
2580
+ P1(A) ? this._setCountry(A) : u && f ? this._setCountry(i2.ISO2) : this._setCountry("");
2403
2581
  }
2404
- u && this._updateValFromNumber(u);
2582
+ a && this._updateValFromNumber(a);
2405
2583
  }
2406
2584
  //* Initialise the main event listeners: input keyup, and click selected country.
2407
2585
  _initListeners() {
2408
- this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.hiddenInput || this.hiddenInputCountry) && this.telInput.form && this._initHiddenInputListener();
2586
+ this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.ui.hiddenInput || this.ui.hiddenInputCountry) && this.ui.telInput.form && this._initHiddenInputListener();
2409
2587
  }
2410
2588
  //* Update hidden input on form submit.
2411
2589
  _initHiddenInputListener() {
2412
- var e;
2413
- this._handleHiddenInputSubmit = () => {
2414
- this.hiddenInput && (this.hiddenInput.value = this.getNumber()), this.hiddenInputCountry && (this.hiddenInputCountry.value = this.getSelectedCountryData().iso2 || "");
2415
- }, (e = this.telInput.form) == null || e.addEventListener(
2416
- "submit",
2417
- this._handleHiddenInputSubmit
2418
- );
2590
+ var $;
2591
+ const e = () => {
2592
+ this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
2593
+ };
2594
+ ($ = this.ui.telInput.form) == null || $.addEventListener("submit", e, {
2595
+ signal: this.abortController.signal
2596
+ });
2419
2597
  }
2420
2598
  //* initialise the dropdown listeners.
2421
2599
  _initDropdownListeners() {
2422
- this._handleLabelClick = ($) => {
2423
- this.dropdownContent.classList.contains("iti__hide") ? this.telInput.focus() : $.preventDefault();
2600
+ const e = this.abortController.signal, $ = (u) => {
2601
+ this.ui.dropdownContent.classList.contains(E.HIDE) ? this.ui.telInput.focus() : u.preventDefault();
2602
+ }, i = this.ui.telInput.closest("label");
2603
+ i && i.addEventListener("click", $, { signal: e });
2604
+ const s = () => {
2605
+ this.ui.dropdownContent.classList.contains(
2606
+ E.HIDE
2607
+ ) && !this.ui.telInput.disabled && !this.ui.telInput.readOnly && this._openDropdown();
2608
+ };
2609
+ this.ui.selectedCountry.addEventListener(
2610
+ "click",
2611
+ s,
2612
+ {
2613
+ signal: e
2614
+ }
2615
+ );
2616
+ const a = (u) => {
2617
+ this.ui.dropdownContent.classList.contains(
2618
+ E.HIDE
2619
+ ) && [x.ARROW_UP, x.ARROW_DOWN, x.SPACE, x.ENTER].includes(u.key) && (u.preventDefault(), u.stopPropagation(), this._openDropdown()), u.key === x.TAB && this._closeDropdown();
2424
2620
  };
2425
- const e = this.telInput.closest("label");
2426
- e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedCountry = () => {
2427
- this.dropdownContent.classList.contains("iti__hide") && !this.telInput.disabled && !this.telInput.readOnly && this._openDropdown();
2428
- }, this.selectedCountry.addEventListener("click", this._handleClickSelectedCountry), this._handleCountryContainerKeydown = ($) => {
2429
- this.dropdownContent.classList.contains("iti__hide") && ["ArrowUp", "ArrowDown", " ", "Enter"].includes($.key) && ($.preventDefault(), $.stopPropagation(), this._openDropdown()), $.key === "Tab" && this._closeDropdown();
2430
- }, this.countryContainer.addEventListener(
2621
+ this.ui.countryContainer.addEventListener(
2431
2622
  "keydown",
2432
- this._handleCountryContainerKeydown
2623
+ a,
2624
+ { signal: e }
2433
2625
  );
2434
2626
  }
2435
2627
  //* Init many requests: utils script / geo ip lookup.
2436
2628
  _initRequests() {
2437
- let { loadUtils: e, initialCountry: $, geoIpLookup: i } = this.options;
2438
- e && !y.utils ? (this._doAttachUtils = () => {
2439
- var u;
2440
- (u = y.attachUtils(e)) == null || u.catch(() => {
2441
- });
2442
- }, y.documentReady() ? this._doAttachUtils() : (this._handlePageLoad = () => {
2443
- this._doAttachUtils();
2444
- }, window.addEventListener("load", this._handlePageLoad))) : this.resolveUtilsScriptPromise(), $ === "auto" && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2629
+ const { loadUtils: e, initialCountry: $, geoIpLookup: i } = this.options;
2630
+ if (e && !m.utils) {
2631
+ const a = () => {
2632
+ var u;
2633
+ (u = m.attachUtils(e)) == null || u.catch(() => {
2634
+ });
2635
+ };
2636
+ if (m.documentReady())
2637
+ a();
2638
+ else {
2639
+ const u = () => {
2640
+ a();
2641
+ };
2642
+ window.addEventListener("load", u, {
2643
+ signal: this.abortController.signal
2644
+ });
2645
+ }
2646
+ } else
2647
+ this.resolveUtilsScriptPromise();
2648
+ $ === T1.AUTO && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2445
2649
  }
2446
2650
  //* Perform the geo ip lookup.
2447
2651
  _loadAutoCountry() {
2448
- y.autoCountry ? this.handleAutoCountry() : y.startedLoadingAutoCountry || (y.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
2652
+ m.autoCountry ? this.handleAutoCountry() : m.startedLoadingAutoCountry || (m.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
2449
2653
  (e = "") => {
2450
2654
  const $ = e.toLowerCase();
2451
- w1($) ? (y.autoCountry = $, setTimeout(() => $1("handleAutoCountry"))) : (this._setInitialState(!0), $1("rejectAutoCountryPromise"));
2655
+ P1($) ? (m.autoCountry = $, setTimeout(() => r1("handleAutoCountry"))) : (this._setInitialState(!0), r1("rejectAutoCountryPromise"));
2452
2656
  },
2453
2657
  () => {
2454
- this._setInitialState(!0), $1("rejectAutoCountryPromise");
2658
+ this._setInitialState(!0), r1("rejectAutoCountryPromise");
2455
2659
  }
2456
2660
  ));
2457
2661
  }
2458
2662
  _openDropdownWithPlus() {
2459
- this._openDropdown(), this.searchInput.value = "+", this._filterCountries("");
2663
+ this._openDropdown(), this.ui.searchInput.value = "+", this._filterCountriesByQuery("");
2460
2664
  }
2461
2665
  //* Initialize the tel input listeners.
2462
2666
  _initTelInputListeners() {
2463
2667
  this._bindInputListener(), this._maybeBindKeydownListener(), this._maybeBindPasteListener();
2464
2668
  }
2465
2669
  _bindInputListener() {
2466
- const { strictMode: e, formatAsYouType: $, separateDialCode: i, allowDropdown: r, countrySearch: u } = this.options;
2467
- let h = !1;
2468
- new RegExp("\\p{L}", "u").test(this.telInput.value) && (h = !0), this._handleInputEvent = (c) => {
2469
- if (this.isAndroid && (c == null ? void 0 : c.data) === "+" && i && r && u) {
2470
- const w = this.telInput.selectionStart || 0, k = this.telInput.value.substring(0, w - 1), v = this.telInput.value.substring(w);
2471
- this.telInput.value = k + v, this._openDropdownWithPlus();
2670
+ const {
2671
+ strictMode: e,
2672
+ formatAsYouType: $,
2673
+ separateDialCode: i,
2674
+ allowDropdown: s,
2675
+ countrySearch: a
2676
+ } = this.options;
2677
+ let u = !1;
2678
+ q.ALPHA_UNICODE.test(this.ui.telInput.value) && (u = !0);
2679
+ const f = (C) => {
2680
+ if (this.isAndroid && (C == null ? void 0 : C.data) === "+" && i && s && a) {
2681
+ const v = this.ui.telInput.selectionStart || 0, N = this.ui.telInput.value.substring(
2682
+ 0,
2683
+ v - 1
2684
+ ), T = this.ui.telInput.value.substring(v);
2685
+ this.ui.telInput.value = N + T, this._openDropdownWithPlus();
2472
2686
  return;
2473
2687
  }
2474
- this._updateCountryFromNumber(this.telInput.value) && this._triggerCountryChange();
2475
- const C = (c == null ? void 0 : c.data) && /[^+0-9]/.test(c.data), g = (c == null ? void 0 : c.inputType) === "insertFromPaste" && this.telInput.value;
2476
- C || g && !e ? h = !0 : /[^+0-9]/.test(this.telInput.value) || (h = !1);
2477
- const I = (c == null ? void 0 : c.detail) && c.detail.isSetNumber;
2478
- if ($ && !h && !I) {
2479
- const w = this.telInput.selectionStart || 0, v = this.telInput.value.substring(0, w).replace(/[^+0-9]/g, "").length, E = (c == null ? void 0 : c.inputType) === "deleteContentForward", N = this._getFullNumber(), P = Q0(
2480
- N,
2481
- this.telInput.value,
2482
- y.utils,
2688
+ this._updateCountryFromNumber(this.ui.telInput.value) && this._triggerCountryChange();
2689
+ const I = (C == null ? void 0 : C.data) && q.NON_PLUS_NUMERIC.test(C.data), _ = (C == null ? void 0 : C.inputType) === m0.PASTE && this.ui.telInput.value;
2690
+ I || _ && !e ? u = !0 : q.NON_PLUS_NUMERIC.test(this.ui.telInput.value) || (u = !1);
2691
+ const A = (C == null ? void 0 : C.detail) && C.detail.isSetNumber;
2692
+ if ($ && !u && !A) {
2693
+ const v = this.ui.telInput.selectionStart || 0, T = this.ui.telInput.value.substring(
2694
+ 0,
2695
+ v
2696
+ ).replace(
2697
+ q.NON_PLUS_NUMERIC_GLOBAL,
2698
+ ""
2699
+ ).length, k = (C == null ? void 0 : C.inputType) === m0.DELETE_FWD, P = this._getFullNumber(), B = I2(
2700
+ P,
2701
+ this.ui.telInput.value,
2702
+ m.utils,
2483
2703
  this.selectedCountryData,
2484
2704
  this.options.separateDialCode
2485
- ), G = d2(v, P, w, E);
2486
- this.telInput.value = P, this.telInput.setSelectionRange(G, G);
2705
+ ), W = _2(
2706
+ T,
2707
+ B,
2708
+ v,
2709
+ k
2710
+ );
2711
+ this.ui.telInput.value = B, this.ui.telInput.setSelectionRange(W, W);
2712
+ }
2713
+ };
2714
+ this.ui.telInput.addEventListener(
2715
+ "input",
2716
+ f,
2717
+ {
2718
+ signal: this.abortController.signal
2487
2719
  }
2488
- }, this.telInput.addEventListener("input", this._handleInputEvent);
2720
+ );
2489
2721
  }
2490
2722
  _maybeBindKeydownListener() {
2491
- const { strictMode: e, separateDialCode: $, allowDropdown: i, countrySearch: r } = this.options;
2492
- (e || $) && (this._handleKeydownEvent = (u) => {
2493
- if (u.key && u.key.length === 1 && !u.altKey && !u.ctrlKey && !u.metaKey) {
2494
- if ($ && i && r && u.key === "+") {
2495
- u.preventDefault(), this._openDropdownWithPlus();
2496
- return;
2497
- }
2498
- if (e) {
2499
- const h = this.telInput.value, C = !(h.charAt(0) === "+") && this.telInput.selectionStart === 0 && u.key === "+", g = /^[0-9]$/.test(u.key), I = $ ? g : C || g, w = h.slice(0, this.telInput.selectionStart) + u.key + h.slice(this.telInput.selectionEnd), k = this._getFullNumber(w), v = y.utils.getCoreNumber(k, this.selectedCountryData.iso2), E = this.maxCoreNumberLength && v.length > this.maxCoreNumberLength, P = this._getNewCountryFromNumber(k) !== null;
2500
- (!I || E && !P && !C) && u.preventDefault();
2723
+ const { strictMode: e, separateDialCode: $, allowDropdown: i, countrySearch: s } = this.options;
2724
+ if (e || $) {
2725
+ const a = (u) => {
2726
+ if (u.key && u.key.length === 1 && !u.altKey && !u.ctrlKey && !u.metaKey) {
2727
+ if ($ && i && s && u.key === "+") {
2728
+ u.preventDefault(), this._openDropdownWithPlus();
2729
+ return;
2730
+ }
2731
+ if (e) {
2732
+ const f = this.ui.telInput.value, I = !f.startsWith("+") && this.ui.telInput.selectionStart === 0 && u.key === "+", _ = /^[0-9]$/.test(u.key), A = $ ? _ : I || _, v = f.slice(0, this.ui.telInput.selectionStart) + u.key + f.slice(this.ui.telInput.selectionEnd), N = this._getFullNumber(v), T = m.utils.getCoreNumber(
2733
+ N,
2734
+ this.selectedCountryData.iso2
2735
+ ), k = this.maxCoreNumberLength && T.length > this.maxCoreNumberLength, B = this._getNewCountryFromNumber(N) !== null;
2736
+ (!A || k && !B && !I) && u.preventDefault();
2737
+ }
2501
2738
  }
2502
- }
2503
- }, this.telInput.addEventListener("keydown", this._handleKeydownEvent));
2739
+ };
2740
+ this.ui.telInput.addEventListener("keydown", a, {
2741
+ signal: this.abortController.signal
2742
+ });
2743
+ }
2504
2744
  }
2505
2745
  _maybeBindPasteListener() {
2506
- this.options.strictMode && (this._handlePasteEvent = (e) => {
2507
- e.preventDefault();
2508
- const $ = this.telInput, i = $.selectionStart, r = $.selectionEnd, u = $.value.slice(0, i), h = $.value.slice(r), c = this.selectedCountryData.iso2, C = e.clipboardData.getData("text"), g = i === 0 && r > 0, I = !$.value.startsWith("+") || g, w = C.replace(/[^0-9+]/g, ""), k = w.startsWith("+"), v = w.replace(/\+/g, ""), E = k && I ? `+${v}` : v;
2509
- let N = u + E + h, P = y.utils.getCoreNumber(N, c);
2510
- for (; P.length === 0 && N.length > 0; )
2511
- N = N.slice(0, -1), P = y.utils.getCoreNumber(N, c);
2512
- if (!P)
2513
- return;
2514
- if (this.maxCoreNumberLength && P.length > this.maxCoreNumberLength)
2515
- if ($.selectionEnd === $.value.length) {
2516
- const j = P.length - this.maxCoreNumberLength;
2517
- N = N.slice(0, N.length - j);
2518
- } else
2746
+ if (this.options.strictMode) {
2747
+ const e = ($) => {
2748
+ $.preventDefault();
2749
+ const i = this.ui.telInput, s = i.selectionStart, a = i.selectionEnd, u = i.value.slice(0, s), f = i.value.slice(a), C = this.selectedCountryData.iso2, I = $.clipboardData.getData("text"), _ = s === 0 && a > 0, A = !i.value.startsWith("+") || _, v = I.replace(q.NON_PLUS_NUMERIC_GLOBAL, ""), N = v.startsWith("+"), T = v.replace(/\+/g, ""), k = N && A ? `+${T}` : T;
2750
+ let P = u + k + f, B = m.utils.getCoreNumber(P, C);
2751
+ for (; B.length === 0 && P.length > 0; )
2752
+ P = P.slice(0, -1), B = m.utils.getCoreNumber(P, C);
2753
+ if (!B)
2519
2754
  return;
2520
- $.value = N;
2521
- const G = i + E.length;
2522
- $.setSelectionRange(G, G), $.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2523
- }, this.telInput.addEventListener("paste", this._handlePasteEvent));
2755
+ if (this.maxCoreNumberLength && B.length > this.maxCoreNumberLength)
2756
+ if (i.selectionEnd === i.value.length) {
2757
+ const y1 = B.length - this.maxCoreNumberLength;
2758
+ P = P.slice(0, P.length - y1);
2759
+ } else
2760
+ return;
2761
+ i.value = P;
2762
+ const W = s + k.length;
2763
+ i.setSelectionRange(W, W), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2764
+ };
2765
+ this.ui.telInput.addEventListener("paste", e, {
2766
+ signal: this.abortController.signal
2767
+ });
2768
+ }
2524
2769
  }
2525
2770
  //* Adhere to the input's maxlength attr.
2526
2771
  _cap(e) {
2527
- const $ = parseInt(this.telInput.getAttribute("maxlength") || "", 10);
2772
+ const $ = Number(this.ui.telInput.getAttribute("maxlength"));
2528
2773
  return $ && e.length > $ ? e.substring(0, $) : e;
2529
2774
  }
2530
- //* Trigger a custom event on the input.
2775
+ //* Trigger a custom event on the input (typed via ItiEventMap).
2531
2776
  _trigger(e, $ = {}) {
2532
2777
  const i = new CustomEvent(e, {
2533
2778
  bubbles: !0,
2534
2779
  cancelable: !0,
2535
2780
  detail: $
2536
2781
  });
2537
- this.telInput.dispatchEvent(i);
2782
+ this.ui.telInput.dispatchEvent(i);
2538
2783
  }
2539
2784
  //* Open the dropdown.
2540
2785
  _openDropdown() {
2541
2786
  const { fixDropdownWidth: e, countrySearch: $ } = this.options;
2542
- if (e && (this.dropdownContent.style.width = `${this.telInput.offsetWidth}px`), this.dropdownContent.classList.remove("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), $) {
2543
- const i = this.countryList.firstElementChild;
2544
- i && (this._highlightListItem(i, !1), this.countryList.scrollTop = 0), this.searchInput.focus();
2787
+ if (this.dropdownAbortController = new AbortController(), e && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(E.HIDE), this.ui.selectedCountry.setAttribute(L.EXPANDED, "true"), this._setDropdownPosition(), $) {
2788
+ const i = this.ui.countryList.firstElementChild;
2789
+ i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
2545
2790
  }
2546
- this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
2791
+ this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(E.ARROW_UP), this._trigger(g1.OPEN_COUNTRY_DROPDOWN);
2547
2792
  }
2548
2793
  //* Set the dropdown position
2549
2794
  _setDropdownPosition() {
2550
- if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
2551
- const e = this.telInput.getBoundingClientRect(), $ = this.telInput.offsetHeight;
2552
- this.options.dropdownContainer && (this.dropdown.style.top = `${e.top + $}px`, this.dropdown.style.left = `${e.left}px`, this._handleWindowScroll = () => this._closeDropdown(), window.addEventListener("scroll", this._handleWindowScroll));
2795
+ if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
2796
+ const e = this.ui.telInput.getBoundingClientRect(), $ = this.ui.telInput.offsetHeight;
2797
+ if (this.options.dropdownContainer) {
2798
+ this.ui.dropdown.style.top = `${e.top + $}px`, this.ui.dropdown.style.left = `${e.left}px`;
2799
+ const i = () => this._closeDropdown();
2800
+ window.addEventListener("scroll", i, {
2801
+ signal: this.dropdownAbortController.signal
2802
+ });
2803
+ }
2553
2804
  }
2554
2805
  }
2555
2806
  //* We only bind dropdown listeners when the dropdown is open.
2556
2807
  _bindDropdownListeners() {
2557
- this._handleMouseoverCountryList = (i) => {
2558
- var u;
2559
- const r = (u = i.target) == null ? void 0 : u.closest(".iti__country");
2560
- r && this._highlightListItem(r, !1);
2561
- }, this.countryList.addEventListener(
2808
+ const e = this.dropdownAbortController.signal;
2809
+ this._bindDropdownMouseoverListener(e), this._bindDropdownCountryClickListener(e), this._bindDropdownClickOffListener(e), this._bindDropdownKeydownListener(e), this.options.countrySearch && this._bindDropdownSearchListeners(e);
2810
+ }
2811
+ //* When mouse over a list item, just highlight that one
2812
+ //* we add the class "highlight", so if they hit "enter" we know which one to select.
2813
+ _bindDropdownMouseoverListener(e) {
2814
+ const $ = (i) => {
2815
+ var a;
2816
+ const s = (a = i.target) == null ? void 0 : a.closest(
2817
+ `.${E.COUNTRY_ITEM}`
2818
+ );
2819
+ s && this.ui.highlightListItem(s, !1);
2820
+ };
2821
+ this.ui.countryList.addEventListener(
2562
2822
  "mouseover",
2563
- this._handleMouseoverCountryList
2564
- ), this._handleClickCountryList = (i) => {
2565
- var u;
2566
- const r = (u = i.target) == null ? void 0 : u.closest(".iti__country");
2567
- r && this._selectListItem(r);
2568
- }, this.countryList.addEventListener("click", this._handleClickCountryList), this._handleClickOffToClose = (i) => {
2569
- !!i.target.closest(`#iti-${this.id}__dropdown-content`) || this._closeDropdown();
2570
- }, setTimeout(() => {
2823
+ $,
2824
+ {
2825
+ signal: e
2826
+ }
2827
+ );
2828
+ }
2829
+ //* Listen for country selection.
2830
+ _bindDropdownCountryClickListener(e) {
2831
+ const $ = (i) => {
2832
+ var a;
2833
+ const s = (a = i.target) == null ? void 0 : a.closest(
2834
+ `.${E.COUNTRY_ITEM}`
2835
+ );
2836
+ s && this._selectListItem(s);
2837
+ };
2838
+ this.ui.countryList.addEventListener("click", $, {
2839
+ signal: e
2840
+ });
2841
+ }
2842
+ //* Click off to close (except when this initial opening click is bubbling up).
2843
+ //* We cannot just stopPropagation as it may be needed to close another instance.
2844
+ _bindDropdownClickOffListener(e) {
2845
+ const $ = (i) => {
2846
+ !!i.target.closest(
2847
+ `#iti-${this.id}__dropdown-content`
2848
+ ) || this._closeDropdown();
2849
+ };
2850
+ setTimeout(() => {
2571
2851
  document.documentElement.addEventListener(
2572
2852
  "click",
2573
- this._handleClickOffToClose
2853
+ $,
2854
+ { signal: e }
2574
2855
  );
2575
2856
  }, 0);
2576
- let e = "", $ = null;
2577
- if (this._handleKeydownOnDropdown = (i) => {
2578
- ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), i.key === "ArrowUp" || i.key === "ArrowDown" ? this._handleUpDownKey(i.key) : i.key === "Enter" ? this._handleEnterKey() : i.key === "Escape" && this._closeDropdown()), !this.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(i.key) && (i.stopPropagation(), $ && clearTimeout($), e += i.key.toLowerCase(), this._searchForCountry(e), $ = setTimeout(() => {
2579
- e = "";
2580
- }, 1e3));
2581
- }, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
2582
- const i = () => {
2583
- const u = this.searchInput.value.trim();
2584
- this._filterCountries(u), this.searchInput.value ? this.searchClearButton.classList.remove("iti__hide") : this.searchClearButton.classList.add("iti__hide");
2585
- };
2586
- let r = null;
2587
- this._handleSearchChange = () => {
2588
- r && clearTimeout(r), r = setTimeout(() => {
2589
- i(), r = null;
2590
- }, 100);
2591
- }, this.searchInput.addEventListener("input", this._handleSearchChange), this._handleSearchClear = () => {
2592
- this.searchInput.value = "", this.searchInput.focus(), i();
2593
- }, this.searchClearButton.addEventListener("click", this._handleSearchClear);
2594
- }
2857
+ }
2858
+ //* Listen for up/down scrolling, enter to select, or escape to close.
2859
+ //* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
2860
+ //* just hit down and hold it to scroll down (no keyup event).
2861
+ //* Listen on the document because that's where key events are triggered if no input has focus.
2862
+ _bindDropdownKeydownListener(e) {
2863
+ let $ = "", i = null;
2864
+ const s = (a) => {
2865
+ [
2866
+ x.ARROW_UP,
2867
+ x.ARROW_DOWN,
2868
+ x.ENTER,
2869
+ x.ESC
2870
+ ].includes(a.key) && (a.preventDefault(), a.stopPropagation(), a.key === x.ARROW_UP || a.key === x.ARROW_DOWN ? this._handleUpDownKey(a.key) : a.key === x.ENTER ? this._handleEnterKey() : a.key === x.ESC && this._closeDropdown()), !this.options.countrySearch && q.HIDDEN_SEARCH_CHAR.test(a.key) && (a.stopPropagation(), i && clearTimeout(i), $ += a.key.toLowerCase(), this._searchForCountry($), i = setTimeout(() => {
2871
+ $ = "";
2872
+ }, n2.HIDDEN_SEARCH_RESET_MS));
2873
+ };
2874
+ document.addEventListener("keydown", s, { signal: e });
2875
+ }
2876
+ //* Search input listeners when countrySearch enabled.
2877
+ _bindDropdownSearchListeners(e) {
2878
+ const $ = () => {
2879
+ const u = this.ui.searchInput.value.trim();
2880
+ this._filterCountriesByQuery(u), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove(E.HIDE) : this.ui.searchClearButton.classList.add(E.HIDE);
2881
+ };
2882
+ let i = null;
2883
+ const s = () => {
2884
+ i && clearTimeout(i), i = setTimeout(() => {
2885
+ $(), i = null;
2886
+ }, 100);
2887
+ };
2888
+ this.ui.searchInput.addEventListener("input", s, {
2889
+ signal: e
2890
+ });
2891
+ const a = () => {
2892
+ this.ui.searchInput.value = "", this.ui.searchInput.focus(), $();
2893
+ };
2894
+ this.ui.searchClearButton.addEventListener("click", a, {
2895
+ signal: e
2896
+ });
2595
2897
  }
2596
2898
  //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
2597
2899
  _searchForCountry(e) {
2598
- for (const $ of this.countries)
2599
- if ($.name.substring(0, e.length).toLowerCase() === e) {
2600
- const r = $.nodeById[this.id];
2601
- this._highlightListItem(r, !1), this._scrollTo(r);
2602
- break;
2603
- }
2604
- }
2605
- //* Country search enabled: Filter the countries according to the search query.
2606
- _filterCountries(e) {
2607
- this.countryList.innerHTML = "";
2608
- let $;
2609
- e === "" ? $ = this.countries : $ = this._getMatchedCountries(e);
2610
- let i = !0;
2611
- for (const r of $) {
2612
- const u = r.nodeById[this.id];
2613
- u && (this.countryList.appendChild(u), i && (this._highlightListItem(u, !1), i = !1));
2900
+ const $ = l2(this.countries, e);
2901
+ if ($) {
2902
+ const i = $.nodeById[this.id];
2903
+ this.ui.highlightListItem(i, !1), this.ui.scrollTo(i);
2614
2904
  }
2615
- i ? (this._highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove("iti__hide")) : this.searchNoResults && this.searchNoResults.classList.add("iti__hide"), this.countryList.scrollTop = 0, this._updateSearchResultsA11yText();
2616
- }
2617
- _getMatchedCountries(e) {
2618
- const $ = a0(e), i = [], r = [], u = [], h = [], c = [], C = [];
2619
- for (const g of this.countries)
2620
- g.iso2 === $ ? i.push(g) : g.normalisedName.startsWith($) ? r.push(g) : g.normalisedName.includes($) ? u.push(g) : $ === g.dialCode || $ === g.dialCodePlus ? h.push(g) : g.dialCodePlus.includes($) ? c.push(g) : g.initials.includes($) && C.push(g);
2621
- return [
2622
- ...i.sort((g, I) => g.priority - I.priority),
2623
- ...r.sort((g, I) => g.priority - I.priority),
2624
- ...u.sort((g, I) => g.priority - I.priority),
2625
- ...h.sort((g, I) => g.priority - I.priority),
2626
- ...c.sort((g, I) => g.priority - I.priority),
2627
- ...C.sort((g, I) => g.priority - I.priority)
2628
- ];
2629
2905
  }
2630
- //* Update search results text (for a11y).
2631
- _updateSearchResultsA11yText() {
2632
- const { i18n: e } = this.options, $ = this.countryList.childElementCount;
2633
- let i;
2634
- $ === 0 ? i = e.zeroSearchResults : e.searchResultsText ? i = e.searchResultsText($) : $ === 1 ? i = e.oneSearchResult : i = e.multipleSearchResults.replace("${count}", $.toString()), this.searchResultsA11yText.textContent = i;
2906
+ //* Country search: Filter the countries according to the search query.
2907
+ _filterCountriesByQuery(e) {
2908
+ let $;
2909
+ e === "" ? $ = this.countries : $ = u2(this.countries, e), this.ui.filterCountries($);
2635
2910
  }
2636
2911
  //* Highlight the next/prev item in the list (and ensure it is visible).
2637
2912
  _handleUpDownKey(e) {
2638
- var i, r;
2639
- let $ = e === "ArrowUp" ? (i = this.highlightedItem) == null ? void 0 : i.previousElementSibling : (r = this.highlightedItem) == null ? void 0 : r.nextElementSibling;
2640
- !$ && this.countryList.childElementCount > 1 && ($ = e === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), $ && (this._scrollTo($), this._highlightListItem($, !1));
2913
+ var i, s;
2914
+ let $ = e === x.ARROW_UP ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
2915
+ !$ && this.ui.countryList.childElementCount > 1 && ($ = e === x.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), $ && (this.ui.scrollTo($), this.ui.highlightListItem($, !1));
2641
2916
  }
2642
2917
  //* Select the currently highlighted item.
2643
2918
  _handleEnterKey() {
2644
- this.highlightedItem && this._selectListItem(this.highlightedItem);
2919
+ this.ui.highlightedItem && this._selectListItem(this.ui.highlightedItem);
2645
2920
  }
2646
2921
  //* Update the input's value to the given val (format first if possible)
2647
2922
  //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
2648
2923
  _updateValFromNumber(e) {
2649
2924
  let $ = e;
2650
- if (this.options.formatOnDisplay && y.utils && this.selectedCountryData) {
2651
- const i = this.options.nationalMode || $.charAt(0) !== "+" && !this.options.separateDialCode, { NATIONAL: r, INTERNATIONAL: u } = y.utils.numberFormat, h = i ? r : u;
2652
- $ = y.utils.formatNumber(
2925
+ if (this.options.formatOnDisplay && m.utils && this.selectedCountryData) {
2926
+ const i = this.options.nationalMode || !$.startsWith("+") && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: a } = m.utils.numberFormat, u = i ? s : a;
2927
+ $ = m.utils.formatNumber(
2653
2928
  $,
2654
2929
  this.selectedCountryData.iso2,
2655
- h
2930
+ u
2656
2931
  );
2657
2932
  }
2658
- $ = this._beforeSetNumber($), this.telInput.value = $;
2933
+ $ = this._beforeSetNumber($), this.ui.telInput.value = $;
2659
2934
  }
2660
2935
  //* Check if need to select a new country based on the given number
2661
2936
  //* Note: called from _setInitialState, keyup handler, setNumber.
@@ -2666,10 +2941,10 @@ class f1 {
2666
2941
  // if there is a selected country, and the number doesn't start with a dial code, then add it
2667
2942
  _ensureHasDialCode(e) {
2668
2943
  const { dialCode: $, nationalPrefix: i } = this.selectedCountryData;
2669
- if (e.charAt(0) === "+" || !$)
2944
+ if (e.startsWith("+") || !$)
2670
2945
  return e;
2671
- const h = i && e.charAt(0) === i && !this.options.separateDialCode ? e.substring(1) : e;
2672
- return `+${$}${h}`;
2946
+ const u = i && e.startsWith(i) && !this.options.separateDialCode ? e.substring(1) : e;
2947
+ return `+${$}${u}`;
2673
2948
  }
2674
2949
  // Get the country ISO2 code from the given number
2675
2950
  // BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
@@ -2677,186 +2952,137 @@ class f1 {
2677
2952
  _getNewCountryFromNumber(e) {
2678
2953
  const $ = e.indexOf("+");
2679
2954
  let i = $ ? e.substring($) : e;
2680
- const r = this.selectedCountryData.iso2, u = this.selectedCountryData.dialCode;
2955
+ const s = this.selectedCountryData.iso2, a = this.selectedCountryData.dialCode;
2681
2956
  i = this._ensureHasDialCode(i);
2682
- const h = this._getDialCode(i, !0), c = c1(i);
2683
- if (h) {
2684
- const C = c1(h), g = this.dialCodeToIso2Map[C];
2685
- if (g.length === 1)
2686
- return g[0] === r ? null : g[0];
2687
- if (!r && this.defaultCountry && g.includes(this.defaultCountry))
2957
+ const u = this._getDialCode(i, !0), f = m1(i);
2958
+ if (u) {
2959
+ const C = m1(u), I = this.dialCodeToIso2Map[C];
2960
+ if (I.length === 1)
2961
+ return I[0] === s ? null : I[0];
2962
+ if (!s && this.defaultCountry && I.includes(this.defaultCountry))
2688
2963
  return this.defaultCountry;
2689
- if (u === "1" && o0(c))
2964
+ if (a === N0.NANP && _0(f))
2690
2965
  return null;
2691
- const { areaCodes: w, priority: k } = this.selectedCountryData;
2692
- if (w) {
2693
- const G = w.map((j) => `${u}${j}`);
2694
- for (const j of G)
2695
- if (c.startsWith(j))
2966
+ const { areaCodes: A, priority: v } = this.selectedCountryData;
2967
+ if (A) {
2968
+ const B = A.map(
2969
+ (W) => `${a}${W}`
2970
+ );
2971
+ for (const W of B)
2972
+ if (f.startsWith(W))
2696
2973
  return null;
2697
2974
  }
2698
- const E = w && !(k === 0) && c.length > C.length, N = r && g.includes(r) && !E, P = r === g[0];
2699
- if (!N && !P)
2700
- return g[0];
2975
+ const T = A && !(v === 0) && f.length > C.length, k = s && I.includes(s) && !T, P = s === I[0];
2976
+ if (!k && !P)
2977
+ return I[0];
2701
2978
  } else {
2702
- if (i.charAt(0) === "+" && c.length)
2979
+ if (i.startsWith("+") && f.length)
2703
2980
  return "";
2704
- if ((!i || i === "+") && !r)
2981
+ if ((!i || i === "+") && !s)
2705
2982
  return this.defaultCountry;
2706
2983
  }
2707
2984
  return null;
2708
2985
  }
2709
- //* Remove highlighting from other list items and highlight the given item.
2710
- _highlightListItem(e, $) {
2711
- const i = this.highlightedItem;
2712
- if (i && (i.classList.remove("iti__highlight"), i.setAttribute("aria-selected", "false")), this.highlightedItem = e, this.highlightedItem && (this.highlightedItem.classList.add("iti__highlight"), this.highlightedItem.setAttribute("aria-selected", "true"), this.options.countrySearch)) {
2713
- const r = this.highlightedItem.getAttribute("id") || "";
2714
- this.searchInput.setAttribute("aria-activedescendant", r);
2715
- }
2716
- $ && this.highlightedItem.focus();
2717
- }
2718
2986
  //* Update the selected country, dial code (if separateDialCode), placeholder, title, and active list item.
2719
2987
  //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
2720
2988
  _setCountry(e) {
2721
- const { separateDialCode: $, showFlags: i, i18n: r } = this.options, u = this.selectedCountryData.iso2 || "";
2722
- if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.selectedCountry) {
2723
- const h = e && i ? `iti__flag iti__${e}` : "iti__flag iti__globe";
2724
- let c, C;
2989
+ const { separateDialCode: $, showFlags: i, i18n: s } = this.options, a = this.selectedCountryData.iso2 || "";
2990
+ if (this.selectedCountryData = e ? this.countryByIso2.get(e) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
2991
+ const u = e && i ? `${E.FLAG} iti__${e}` : `${E.FLAG} ${E.GLOBE}`;
2992
+ let f, C;
2725
2993
  if (e) {
2726
- const { name: g, dialCode: I } = this.selectedCountryData;
2727
- C = g, c = r.selectedCountryAriaLabel.replace("${countryName}", g).replace("${dialCode}", `+${I}`);
2994
+ const { name: I, dialCode: _ } = this.selectedCountryData;
2995
+ C = I, f = s.selectedCountryAriaLabel.replace("${countryName}", I).replace("${dialCode}", `+${_}`);
2728
2996
  } else
2729
- C = r.noCountrySelected, c = r.noCountrySelected;
2730
- this.selectedCountryInner.className = h, this.selectedCountry.setAttribute("title", C), this.selectedCountry.setAttribute("aria-label", c);
2997
+ C = s.noCountrySelected, f = s.noCountrySelected;
2998
+ this.ui.selectedCountryInner.className = u, this.ui.selectedCountry.setAttribute("title", C), this.ui.selectedCountry.setAttribute(L.LABEL, f);
2731
2999
  }
2732
3000
  if ($) {
2733
- const h = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
2734
- this.selectedDialCode.innerHTML = h, this._updateInputPadding();
2735
- }
2736
- return this._updatePlaceholder(), this._updateMaxLength(), u !== e;
2737
- }
2738
- //* Update the input padding to make space for the selected country/dial code.
2739
- _updateInputPadding() {
2740
- if (this.selectedCountry) {
2741
- const e = this.options.separateDialCode ? 78 : 42, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || e) + 6;
2742
- this.telInput.style.paddingLeft = `${i}px`;
3001
+ const u = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
3002
+ this.ui.selectedDialCode.textContent = u, this.ui.updateInputPadding();
2743
3003
  }
3004
+ return this._updatePlaceholder(), this._updateMaxLength(), a !== e;
2744
3005
  }
2745
3006
  //* Update the maximum valid number length for the currently selected country.
2746
3007
  _updateMaxLength() {
2747
- const { strictMode: e, placeholderNumberType: $, validationNumberTypes: i } = this.options, { iso2: r } = this.selectedCountryData;
2748
- if (e && y.utils)
2749
- if (r) {
2750
- const u = y.utils.numberType[$];
2751
- let h = y.utils.getExampleNumber(
2752
- r,
3008
+ const { strictMode: e, placeholderNumberType: $, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
3009
+ if (e && m.utils)
3010
+ if (s) {
3011
+ const a = m.utils.numberType[$];
3012
+ let u = m.utils.getExampleNumber(
3013
+ s,
2753
3014
  !1,
2754
- u,
3015
+ a,
2755
3016
  !0
2756
- ), c = h;
2757
- for (; y.utils.isPossibleNumber(h, r, i); )
2758
- c = h, h += "0";
2759
- const C = y.utils.getCoreNumber(c, r);
2760
- this.maxCoreNumberLength = C.length, r === "by" && (this.maxCoreNumberLength = C.length + 1);
3017
+ ), f = u;
3018
+ for (; m.utils.isPossibleNumber(
3019
+ u,
3020
+ s,
3021
+ i
3022
+ ); )
3023
+ f = u, u += "0";
3024
+ const C = m.utils.getCoreNumber(f, s);
3025
+ this.maxCoreNumberLength = C.length, s === "by" && (this.maxCoreNumberLength = C.length + 1);
2761
3026
  } else
2762
3027
  this.maxCoreNumberLength = null;
2763
3028
  }
2764
- //* When input is in a hidden container during init, we cannot calculate the selected country width.
2765
- //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2766
- //* To get the right styling to apply, all we need is a shallow clone of the container,
2767
- //* and then to inject a deep clone of the selectedCountry element.
2768
- _getHiddenSelectedCountryWidth() {
2769
- if (this.telInput.parentNode) {
2770
- let e;
2771
- try {
2772
- e = window.top.document.body;
2773
- } catch {
2774
- e = document.body;
2775
- }
2776
- const $ = this.telInput.parentNode.cloneNode(!1);
2777
- $.style.visibility = "hidden", e.appendChild($);
2778
- const i = this.countryContainer.cloneNode();
2779
- $.appendChild(i);
2780
- const r = this.selectedCountry.cloneNode(!0);
2781
- i.appendChild(r);
2782
- const u = r.offsetWidth;
2783
- return e.removeChild($), u;
2784
- }
2785
- return 0;
2786
- }
2787
3029
  //* Update the input placeholder to an example number from the currently selected country.
2788
3030
  _updatePlaceholder() {
2789
3031
  const {
2790
3032
  autoPlaceholder: e,
2791
3033
  placeholderNumberType: $,
2792
3034
  nationalMode: i,
2793
- customPlaceholder: r
2794
- } = this.options, u = e === "aggressive" || !this.hadInitialPlaceholder && e === "polite";
2795
- if (y.utils && u) {
2796
- const h = y.utils.numberType[$];
2797
- let c = this.selectedCountryData.iso2 ? y.utils.getExampleNumber(
3035
+ customPlaceholder: s
3036
+ } = this.options, a = e === "aggressive" || !this.ui.hadInitialPlaceholder && e === "polite";
3037
+ if (m.utils && a) {
3038
+ const u = m.utils.numberType[$];
3039
+ let f = this.selectedCountryData.iso2 ? m.utils.getExampleNumber(
2798
3040
  this.selectedCountryData.iso2,
2799
3041
  i,
2800
- h
3042
+ u
2801
3043
  ) : "";
2802
- c = this._beforeSetNumber(c), typeof r == "function" && (c = r(c, this.selectedCountryData)), this.telInput.setAttribute("placeholder", c);
3044
+ f = this._beforeSetNumber(f), typeof s == "function" && (f = s(f, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", f);
2803
3045
  }
2804
3046
  }
2805
3047
  //* Called when the user selects a list item from the dropdown.
2806
3048
  _selectListItem(e) {
2807
- const $ = e.getAttribute("data-country-code"), i = this._setCountry($);
3049
+ const $ = e.dataset[I0.COUNTRY_CODE], i = this._setCountry($);
2808
3050
  this._closeDropdown();
2809
- const r = e.getAttribute("data-dial-code");
2810
- this._updateDialCode(r), this.options.formatOnDisplay && this._updateValFromNumber(this.telInput.value), this.telInput.focus(), i && this._triggerCountryChange();
3051
+ const s = e.dataset[I0.DIAL_CODE];
3052
+ this._updateDialCode(s), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this.ui.telInput.focus(), i && this._triggerCountryChange();
2811
3053
  }
2812
3054
  //* Close the dropdown and unbind any listeners.
2813
3055
  _closeDropdown() {
2814
- this.dropdownContent.classList.add("iti__hide"), this.selectedCountry.setAttribute("aria-expanded", "false"), this.highlightedItem && this.highlightedItem.setAttribute("aria-selected", "false"), this.options.countrySearch && this.searchInput.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), this.options.countrySearch && (this.searchInput.removeEventListener("input", this._handleSearchChange), this.searchClearButton.removeEventListener("click", this._handleSearchClear)), document.removeEventListener("keydown", this._handleKeydownOnDropdown), document.documentElement.removeEventListener(
2815
- "click",
2816
- this._handleClickOffToClose
2817
- ), this.countryList.removeEventListener(
2818
- "mouseover",
2819
- this._handleMouseoverCountryList
2820
- ), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
2821
- }
2822
- //* Check if an element is visible within it's container, else scroll until it is.
2823
- _scrollTo(e) {
2824
- const $ = this.countryList, i = document.documentElement.scrollTop, r = $.offsetHeight, u = $.getBoundingClientRect().top + i, h = u + r, c = e.offsetHeight, C = e.getBoundingClientRect().top + i, g = C + c, I = C - u + $.scrollTop;
2825
- if (C < u)
2826
- $.scrollTop = I;
2827
- else if (g > h) {
2828
- const w = r - c;
2829
- $.scrollTop = I - w;
2830
- }
3056
+ this.ui.dropdownContent.classList.contains(E.HIDE) || (this.ui.dropdownContent.classList.add(E.HIDE), this.ui.selectedCountry.setAttribute(L.EXPANDED, "false"), this.ui.highlightedItem && this.ui.highlightedItem.setAttribute(L.SELECTED, "false"), this.options.countrySearch && this.ui.searchInput.removeAttribute(L.ACTIVE_DESCENDANT), this.ui.dropdownArrow.classList.remove(E.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(g1.CLOSE_COUNTRY_DROPDOWN));
2831
3057
  }
2832
3058
  //* Replace any existing dial code with the new one
2833
3059
  //* Note: called from _selectListItem and setCountry
2834
3060
  _updateDialCode(e) {
2835
- const $ = this.telInput.value, i = `+${e}`;
2836
- let r;
2837
- if ($.charAt(0) === "+") {
2838
- const u = this._getDialCode($);
2839
- u ? r = $.replace(u, i) : r = i, this.telInput.value = r;
3061
+ const $ = this.ui.telInput.value, i = `+${e}`;
3062
+ let s;
3063
+ if ($.startsWith("+")) {
3064
+ const a = this._getDialCode($);
3065
+ a ? s = $.replace(a, i) : s = i, this.ui.telInput.value = s;
2840
3066
  }
2841
3067
  }
2842
3068
  //* Try and extract a valid international dial code from a full telephone number.
2843
3069
  //* Note: returns the raw string inc plus character and any whitespace/dots etc.
2844
3070
  _getDialCode(e, $) {
2845
3071
  let i = "";
2846
- if (e.charAt(0) === "+") {
2847
- let r = "";
2848
- for (let u = 0; u < e.length; u++) {
2849
- const h = e.charAt(u);
2850
- if (/[0-9]/.test(h)) {
2851
- if (r += h, !!!this.dialCodeToIso2Map[r])
3072
+ if (e.startsWith("+")) {
3073
+ let s = "";
3074
+ for (let a = 0; a < e.length; a++) {
3075
+ const u = e.charAt(a);
3076
+ if (/[0-9]/.test(u)) {
3077
+ if (s += u, !!!this.dialCodeToIso2Map[s])
2852
3078
  break;
2853
3079
  if ($)
2854
- i = e.substring(0, u + 1);
2855
- else if (this.dialCodes.has(r)) {
2856
- i = e.substring(0, u + 1);
3080
+ i = e.substring(0, a + 1);
3081
+ else if (this.dialCodes.has(s)) {
3082
+ i = e.substring(0, a + 1);
2857
3083
  break;
2858
3084
  }
2859
- if (r.length === this.dialCodeMaxLen)
3085
+ if (s.length === this.dialCodeMaxLen)
2860
3086
  break;
2861
3087
  }
2862
3088
  }
@@ -2865,14 +3091,14 @@ class f1 {
2865
3091
  }
2866
3092
  //* Get the input val, adding the dial code if separateDialCode is enabled.
2867
3093
  _getFullNumber(e) {
2868
- const $ = e || this.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
2869
- let r;
2870
- const u = c1($);
2871
- return this.options.separateDialCode && $.charAt(0) !== "+" && i && u ? r = `+${i}` : r = "", r + $;
3094
+ const $ = e || this.ui.telInput.value.trim(), { dialCode: i } = this.selectedCountryData;
3095
+ let s;
3096
+ const a = m1($);
3097
+ return this.options.separateDialCode && !$.startsWith("+") && i && a ? s = `+${i}` : s = "", s + $;
2872
3098
  }
2873
3099
  //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
2874
3100
  _beforeSetNumber(e) {
2875
- const $ = this._getDialCode(e), i = X0(
3101
+ const $ = this._getDialCode(e), i = y2(
2876
3102
  e,
2877
3103
  $,
2878
3104
  this.options.separateDialCode,
@@ -2882,55 +3108,38 @@ class f1 {
2882
3108
  }
2883
3109
  //* Trigger the 'countrychange' event.
2884
3110
  _triggerCountryChange() {
2885
- this._trigger("countrychange");
3111
+ this._trigger(g1.COUNTRY_CHANGE);
2886
3112
  }
2887
3113
  //**************************
2888
3114
  //* SECRET PUBLIC METHODS
2889
3115
  //**************************
2890
3116
  //* This is called when the geoip call returns.
2891
3117
  handleAutoCountry() {
2892
- this.options.initialCountry === "auto" && y.autoCountry && (this.defaultCountry = y.autoCountry, this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe") || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
3118
+ this.options.initialCountry === T1.AUTO && m.autoCountry && (this.defaultCountry = m.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(E.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
2893
3119
  }
2894
3120
  //* This is called when the utils request completes.
2895
3121
  handleUtils() {
2896
- y.utils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
3122
+ m.utils && (this.ui.telInput.value && this._updateValFromNumber(this.ui.telInput.value), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength())), this.resolveUtilsScriptPromise();
2897
3123
  }
2898
3124
  //********************
2899
3125
  //* PUBLIC METHODS
2900
3126
  //********************
2901
3127
  //* Remove plugin.
2902
3128
  destroy() {
2903
- var u, h;
2904
- this.telInput.iti = void 0;
2905
- const { allowDropdown: e, separateDialCode: $ } = this.options;
2906
- if (e) {
2907
- this._closeDropdown(), this.selectedCountry.removeEventListener(
2908
- "click",
2909
- this._handleClickSelectedCountry
2910
- ), this.countryContainer.removeEventListener(
2911
- "keydown",
2912
- this._handleCountryContainerKeydown
2913
- );
2914
- const c = this.telInput.closest("label");
2915
- c && c.removeEventListener("click", this._handleLabelClick);
2916
- }
2917
- const { form: i } = this.telInput;
2918
- this._handleHiddenInputSubmit && i && i.removeEventListener("submit", this._handleHiddenInputSubmit), this.telInput.removeEventListener("input", this._handleInputEvent), this._handleKeydownEvent && this.telInput.removeEventListener("keydown", this._handleKeydownEvent), this._handlePasteEvent && this.telInput.removeEventListener("paste", this._handlePasteEvent), this._handlePageLoad && window.removeEventListener("load", this._handlePageLoad), this.telInput.removeAttribute("data-intl-tel-input-id"), $ && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
2919
- const r = this.telInput.parentNode;
2920
- (u = r == null ? void 0 : r.parentNode) == null || u.insertBefore(this.telInput, r), (h = r == null ? void 0 : r.parentNode) == null || h.removeChild(r), delete y.instances[this.id];
3129
+ this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), m.instances instanceof Map ? m.instances.delete(this.id) : delete m.instances[this.id]);
2921
3130
  }
2922
3131
  //* Get the extension from the current number.
2923
3132
  getExtension() {
2924
- return y.utils ? y.utils.getExtension(
3133
+ return m.utils ? m.utils.getExtension(
2925
3134
  this._getFullNumber(),
2926
3135
  this.selectedCountryData.iso2
2927
3136
  ) : "";
2928
3137
  }
2929
3138
  //* Format the number to the given format.
2930
3139
  getNumber(e) {
2931
- if (y.utils) {
3140
+ if (m.utils) {
2932
3141
  const { iso2: $ } = this.selectedCountryData;
2933
- return y.utils.formatNumber(
3142
+ return m.utils.formatNumber(
2934
3143
  this._getFullNumber(),
2935
3144
  $,
2936
3145
  e
@@ -2940,10 +3149,10 @@ class f1 {
2940
3149
  }
2941
3150
  //* Get the type of the entered number e.g. landline/mobile.
2942
3151
  getNumberType() {
2943
- return y.utils ? y.utils.getNumberType(
3152
+ return m.utils ? m.utils.getNumberType(
2944
3153
  this._getFullNumber(),
2945
3154
  this.selectedCountryData.iso2
2946
- ) : -99;
3155
+ ) : y0.UNKNOWN_NUMBER_TYPE;
2947
3156
  }
2948
3157
  //* Get the country data for the currently selected country.
2949
3158
  getSelectedCountryData() {
@@ -2951,18 +3160,18 @@ class f1 {
2951
3160
  }
2952
3161
  //* Get the validation error.
2953
3162
  getValidationError() {
2954
- if (y.utils) {
3163
+ if (m.utils) {
2955
3164
  const { iso2: e } = this.selectedCountryData;
2956
- return y.utils.getValidationError(this._getFullNumber(), e);
3165
+ return m.utils.getValidationError(this._getFullNumber(), e);
2957
3166
  }
2958
- return -99;
3167
+ return y0.UNKNOWN_VALIDATION_ERROR;
2959
3168
  }
2960
3169
  //* Validate the input val using number length only
2961
3170
  isValidNumber() {
2962
3171
  const { dialCode: e, iso2: $ } = this.selectedCountryData;
2963
- if (e === "44" && y.utils) {
2964
- const i = this._getFullNumber(), r = y.utils.getCoreNumber(i, $);
2965
- if (r[0] === "7" && r.length !== 10)
3172
+ if (e === b1.DIAL_CODE && m.utils) {
3173
+ const i = this._getFullNumber(), s = m.utils.getCoreNumber(i, $);
3174
+ if (s[0] === b1.MOBILE_PREFIX && s.length !== b1.MOBILE_CORE_LENGTH)
2966
3175
  return !1;
2967
3176
  }
2968
3177
  return this._validateNumber(!1);
@@ -2972,134 +3181,153 @@ class f1 {
2972
3181
  return this._validateNumber(!0);
2973
3182
  }
2974
3183
  _utilsIsPossibleNumber(e) {
2975
- return y.utils ? y.utils.isPossibleNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
3184
+ return m.utils ? m.utils.isPossibleNumber(
3185
+ e,
3186
+ this.selectedCountryData.iso2,
3187
+ this.options.validationNumberTypes
3188
+ ) : null;
2976
3189
  }
2977
3190
  //* Shared internal validation logic to handle alpha character extension rules.
2978
3191
  _validateNumber(e) {
2979
- if (!y.utils)
3192
+ if (!m.utils)
2980
3193
  return null;
2981
3194
  if (!this.selectedCountryData.iso2)
2982
3195
  return !1;
2983
- const $ = (h) => e ? this._utilsIsValidNumber(h) : this._utilsIsPossibleNumber(h), i = this._getFullNumber(), r = i.search(new RegExp("\\p{L}", "u"));
2984
- if (r > -1 && !this.options.allowPhonewords) {
2985
- const h = i.substring(0, r), c = $(h), C = $(i);
2986
- return c && C;
3196
+ const $ = (u) => e ? this._utilsIsValidNumber(u) : this._utilsIsPossibleNumber(u), i = this._getFullNumber(), s = i.search(q.ALPHA_UNICODE);
3197
+ if (s > -1 && !this.options.allowPhonewords) {
3198
+ const u = i.substring(0, s), f = $(u), C = $(i);
3199
+ return f && C;
2987
3200
  }
2988
3201
  return $(i);
2989
3202
  }
2990
3203
  _utilsIsValidNumber(e) {
2991
- return y.utils ? y.utils.isValidNumber(e, this.selectedCountryData.iso2, this.options.validationNumberTypes) : null;
3204
+ return m.utils ? m.utils.isValidNumber(
3205
+ e,
3206
+ this.selectedCountryData.iso2,
3207
+ this.options.validationNumberTypes
3208
+ ) : null;
2992
3209
  }
2993
3210
  //* Update the selected country, and update the input val accordingly.
2994
3211
  setCountry(e) {
2995
3212
  const $ = e == null ? void 0 : e.toLowerCase();
2996
- if (!w1($))
3213
+ if (!P1($))
2997
3214
  throw new Error(`Invalid country code: '${$}'`);
2998
3215
  const i = this.selectedCountryData.iso2;
2999
- (e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.telInput.value), this._triggerCountryChange());
3216
+ (e && $ !== i || !e && i) && (this._setCountry($), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay && this._updateValFromNumber(this.ui.telInput.value), this._triggerCountryChange());
3000
3217
  }
3001
3218
  //* Set the input value and update the country.
3002
3219
  setNumber(e) {
3003
3220
  const $ = this._updateCountryFromNumber(e);
3004
- this._updateValFromNumber(e), $ && this._triggerCountryChange(), this._trigger("input", { isSetNumber: !0 });
3221
+ this._updateValFromNumber(e), $ && this._triggerCountryChange(), this._trigger(g1.INPUT, { isSetNumber: !0 });
3005
3222
  }
3006
3223
  //* Set the placeholder number typ
3007
3224
  setPlaceholderNumberType(e) {
3008
3225
  this.options.placeholderNumberType = e, this._updatePlaceholder();
3009
3226
  }
3010
3227
  setDisabled(e) {
3011
- this.telInput.disabled = e, e ? this.selectedCountry.setAttribute("disabled", "true") : this.selectedCountry.removeAttribute("disabled");
3228
+ this.ui.telInput.disabled = e, e ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
3012
3229
  }
3013
3230
  }
3014
- const n2 = (f) => {
3015
- if (!y.utils && !y.startedLoadingUtilsScript) {
3231
+ const L2 = (h) => {
3232
+ if (!m.utils && !m.startedLoadingUtilsScript) {
3016
3233
  let e;
3017
- if (typeof f == "function")
3234
+ if (typeof h == "function")
3018
3235
  try {
3019
- e = Promise.resolve(f());
3236
+ e = Promise.resolve(h());
3020
3237
  } catch ($) {
3021
3238
  return Promise.reject($);
3022
3239
  }
3023
3240
  else
3024
- return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof f}`));
3025
- return y.startedLoadingUtilsScript = !0, e.then(($) => {
3241
+ return Promise.reject(
3242
+ new TypeError(
3243
+ `The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof h}`
3244
+ )
3245
+ );
3246
+ return m.startedLoadingUtilsScript = !0, e.then(($) => {
3026
3247
  const i = $ == null ? void 0 : $.default;
3027
3248
  if (!i || typeof i != "object")
3028
- throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");
3029
- return y.utils = i, $1("handleUtils"), !0;
3249
+ throw new TypeError(
3250
+ "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
3251
+ );
3252
+ return m.utils = i, r1("handleUtils"), !0;
3030
3253
  }).catch(($) => {
3031
- throw $1("rejectUtilsScriptPromise", $), $;
3254
+ throw r1("rejectUtilsScriptPromise", $), $;
3032
3255
  });
3033
3256
  }
3034
3257
  return null;
3035
- }, y = Object.assign(
3036
- (f, e) => {
3037
- const $ = new f1(f, e);
3038
- return $._init(), f.setAttribute("data-intl-tel-input-id", $.id.toString()), y.instances[$.id] = $, f.iti = $, $;
3258
+ }, r1 = (h, ...e) => {
3259
+ Object.values(m.instances).forEach(($) => {
3260
+ const i = $[h];
3261
+ typeof i == "function" && i.apply($, e);
3262
+ });
3263
+ }, m = Object.assign(
3264
+ (h, e) => {
3265
+ const $ = new M1(h, e);
3266
+ return m.instances[$.id] = $, h.iti = $, $;
3039
3267
  },
3040
3268
  {
3041
- defaults: u0,
3269
+ defaults: S0,
3042
3270
  //* Using a static var like this allows us to mock it in the tests.
3043
3271
  documentReady: () => document.readyState === "complete",
3044
3272
  //* Get the country data object.
3045
- getCountryData: () => Y,
3273
+ getCountryData: () => Q,
3046
3274
  //* A getter for the plugin instance.
3047
- getInstance: (f) => {
3048
- const e = f.getAttribute("data-intl-tel-input-id");
3049
- return e ? y.instances[e] : null;
3275
+ getInstance: (h) => {
3276
+ const e = h.dataset.intlTelInputId;
3277
+ return e ? m.instances[e] : null;
3050
3278
  },
3051
3279
  //* A map from instance ID to instance object.
3052
3280
  instances: {},
3053
- attachUtils: n2,
3281
+ attachUtils: L2,
3054
3282
  startedLoadingUtilsScript: !1,
3055
3283
  startedLoadingAutoCountry: !1,
3056
- version: "25.10.12"
3284
+ version: "25.11.1"
3057
3285
  }
3058
3286
  );
3059
3287
  (function() {
3060
- var f = this || self;
3288
+ var h = this || self;
3061
3289
  function e(d, t) {
3062
3290
  d = d.split(".");
3063
- var n = f;
3291
+ var n = h;
3064
3292
  d[0] in n || typeof n.execScript > "u" || n.execScript("var " + d[0]);
3065
- for (var s; d.length && (s = d.shift()); ) d.length || t === void 0 ? n[s] && n[s] !== Object.prototype[s] ? n = n[s] : n = n[s] = {} : n[s] = t;
3293
+ for (var r; d.length && (r = d.shift()); ) d.length || t === void 0 ? n[r] && n[r] !== Object.prototype[r] ? n = n[r] : n = n[r] = {} : n[r] = t;
3066
3294
  }
3067
3295
  function $(d, t) {
3068
3296
  function n() {
3069
3297
  }
3070
- n.prototype = t.prototype, d.ma = t.prototype, d.prototype = new n(), d.prototype.constructor = d, d.sa = function(s, o, l) {
3071
- for (var a = Array(arguments.length - 2), p = 2; p < arguments.length; p++) a[p - 2] = arguments[p];
3072
- return t.prototype[o].apply(s, a);
3298
+ n.prototype = t.prototype, d.ma = t.prototype, d.prototype = new n(), d.prototype.constructor = d, d.sa = function(r, o, l) {
3299
+ for (var c = Array(arguments.length - 2), p = 2; p < arguments.length; p++) c[p - 2] = arguments[p];
3300
+ return t.prototype[o].apply(r, c);
3073
3301
  };
3074
3302
  }
3075
3303
  function i(d) {
3076
3304
  const t = [];
3077
3305
  let n = 0;
3078
- for (const s in d) t[n++] = d[s];
3306
+ for (const r in d) t[n++] = d[r];
3079
3307
  return t;
3080
3308
  }
3081
- var r = class {
3309
+ var s = class {
3082
3310
  constructor(d) {
3083
- if (u !== u) throw Error("SafeUrl is not meant to be built directly");
3311
+ if (a !== a) throw Error("SafeUrl is not meant to be built directly");
3084
3312
  this.g = d;
3085
3313
  }
3086
3314
  toString() {
3087
3315
  return this.g.toString();
3088
3316
  }
3089
- }, u = {};
3090
- new r("about:invalid#zClosurez"), new r("about:blank");
3091
- const h = {};
3092
- class c {
3317
+ }, a = {};
3318
+ new s("about:invalid#zClosurez"), new s("about:blank");
3319
+ const u = {};
3320
+ class f {
3093
3321
  constructor() {
3094
- if (h !== h) throw Error("SafeStyle is not meant to be built directly");
3322
+ if (u !== u) throw Error("SafeStyle is not meant to be built directly");
3095
3323
  }
3096
3324
  toString() {
3097
3325
  return "";
3098
3326
  }
3099
3327
  }
3100
- new c();
3328
+ new f();
3101
3329
  const C = {};
3102
- class g {
3330
+ class I {
3103
3331
  constructor() {
3104
3332
  if (C !== C) throw Error("SafeStyleSheet is not meant to be built directly");
3105
3333
  }
@@ -3107,98 +3335,98 @@ const n2 = (f) => {
3107
3335
  return "";
3108
3336
  }
3109
3337
  }
3110
- new g();
3111
- const I = {};
3112
- class w {
3338
+ new I();
3339
+ const _ = {};
3340
+ class A {
3113
3341
  constructor() {
3114
- var t = f.trustedTypes && f.trustedTypes.emptyHTML || "";
3115
- if (I !== I) throw Error("SafeHtml is not meant to be built directly");
3342
+ var t = h.trustedTypes && h.trustedTypes.emptyHTML || "";
3343
+ if (_ !== _) throw Error("SafeHtml is not meant to be built directly");
3116
3344
  this.g = t;
3117
3345
  }
3118
3346
  toString() {
3119
3347
  return this.g.toString();
3120
3348
  }
3121
3349
  }
3122
- new w();
3123
- function k(d, t) {
3350
+ new A();
3351
+ function v(d, t) {
3124
3352
  switch (this.g = d, this.l = !!t.aa, this.h = t.i, this.s = t.type, this.o = !1, this.h) {
3125
- case N:
3353
+ case k:
3126
3354
  case P:
3127
- case G:
3128
- case j:
3129
- case c0:
3130
- case E:
3131
- case v:
3355
+ case B:
3356
+ case W:
3357
+ case y1:
3358
+ case T:
3359
+ case N:
3132
3360
  this.o = !0;
3133
3361
  }
3134
3362
  this.j = t.defaultValue;
3135
3363
  }
3136
- var v = 1, E = 2, N = 3, P = 4, G = 6, j = 16, c0 = 18;
3137
- function f0(d, t) {
3364
+ var N = 1, T = 2, k = 3, P = 4, B = 6, W = 16, y1 = 18;
3365
+ function w0(d, t) {
3138
3366
  for (this.h = d, this.g = {}, d = 0; d < t.length; d++) {
3139
3367
  var n = t[d];
3140
3368
  this.g[n.g] = n;
3141
3369
  }
3142
3370
  }
3143
- function p0(d) {
3371
+ function b0(d) {
3144
3372
  return d = i(d.g), d.sort(function(t, n) {
3145
3373
  return t.g - n.g;
3146
3374
  }), d;
3147
3375
  }
3148
- function x() {
3376
+ function U() {
3149
3377
  this.h = {}, this.j = this.m().g, this.g = this.l = null;
3150
3378
  }
3151
- x.prototype.has = function(d) {
3152
- return B(this, d.g);
3153
- }, x.prototype.get = function(d, t) {
3154
- return m(this, d.g, t);
3155
- }, x.prototype.set = function(d, t) {
3156
- T(this, d.g, t);
3157
- }, x.prototype.add = function(d, t) {
3158
- b1(this, d.g, t);
3379
+ U.prototype.has = function(d) {
3380
+ return G(this, d.g);
3381
+ }, U.prototype.get = function(d, t) {
3382
+ return g(this, d.g, t);
3383
+ }, U.prototype.set = function(d, t) {
3384
+ M(this, d.g, t);
3385
+ }, U.prototype.add = function(d, t) {
3386
+ O1(this, d.g, t);
3159
3387
  };
3160
- function S1(d, t) {
3161
- for (var n = p0(d.m()), s = 0; s < n.length; s++) {
3162
- var o = n[s], l = o.g;
3163
- if (B(t, l)) {
3388
+ function R1(d, t) {
3389
+ for (var n = b0(d.m()), r = 0; r < n.length; r++) {
3390
+ var o = n[r], l = o.g;
3391
+ if (G(t, l)) {
3164
3392
  d.g && delete d.g[o.g];
3165
- var a = o.h == 11 || o.h == 10;
3393
+ var c = o.h == 11 || o.h == 10;
3166
3394
  if (o.l) {
3167
- o = D(t, l);
3168
- for (var p = 0; p < o.length; p++) b1(d, l, a ? o[p].clone() : o[p]);
3169
- } else o = n1(t, l), a ? (a = n1(d, l)) ? S1(a, o) : T(d, l, o.clone()) : T(d, l, o);
3395
+ o = O(t, l);
3396
+ for (var p = 0; p < o.length; p++) O1(d, l, c ? o[p].clone() : o[p]);
3397
+ } else o = o1(t, l), c ? (c = o1(d, l)) ? R1(c, o) : M(d, l, o.clone()) : M(d, l, o);
3170
3398
  }
3171
3399
  }
3172
3400
  }
3173
- x.prototype.clone = function() {
3401
+ U.prototype.clone = function() {
3174
3402
  var d = new this.constructor();
3175
- return d != this && (d.h = {}, d.g && (d.g = {}), S1(d, this)), d;
3403
+ return d != this && (d.h = {}, d.g && (d.g = {}), R1(d, this)), d;
3176
3404
  };
3177
- function B(d, t) {
3405
+ function G(d, t) {
3178
3406
  return d.h[t] != null;
3179
3407
  }
3180
- function n1(d, t) {
3408
+ function o1(d, t) {
3181
3409
  var n = d.h[t];
3182
3410
  if (n == null) return null;
3183
3411
  if (d.l) {
3184
3412
  if (!(t in d.g)) {
3185
- var s = d.l, o = d.j[t];
3413
+ var r = d.l, o = d.j[t];
3186
3414
  if (n != null) if (o.l) {
3187
- for (var l = [], a = 0; a < n.length; a++) l[a] = s.h(o, n[a]);
3415
+ for (var l = [], c = 0; c < n.length; c++) l[c] = r.h(o, n[c]);
3188
3416
  n = l;
3189
- } else n = s.h(o, n);
3417
+ } else n = r.h(o, n);
3190
3418
  return d.g[t] = n;
3191
3419
  }
3192
3420
  return d.g[t];
3193
3421
  }
3194
3422
  return n;
3195
3423
  }
3196
- function m(d, t, n) {
3197
- var s = n1(d, t);
3198
- return d.j[t].l ? s[n || 0] : s;
3424
+ function g(d, t, n) {
3425
+ var r = o1(d, t);
3426
+ return d.j[t].l ? r[n || 0] : r;
3199
3427
  }
3200
3428
  function S(d, t) {
3201
- if (B(d, t)) d = m(d, t);
3429
+ if (G(d, t)) d = g(d, t);
3202
3430
  else d: {
3203
3431
  if (d = d.j[t], d.j === void 0) if (t = d.s, t === Boolean) d.j = !1;
3204
3432
  else if (t === Number) d.j = 0;
@@ -3211,88 +3439,88 @@ const n2 = (f) => {
3211
3439
  }
3212
3440
  return d;
3213
3441
  }
3214
- function D(d, t) {
3215
- return n1(d, t) || [];
3442
+ function O(d, t) {
3443
+ return o1(d, t) || [];
3216
3444
  }
3217
- function K(d, t) {
3218
- return d.j[t].l ? B(d, t) ? d.h[t].length : 0 : B(d, t) ? 1 : 0;
3445
+ function j(d, t) {
3446
+ return d.j[t].l ? G(d, t) ? d.h[t].length : 0 : G(d, t) ? 1 : 0;
3219
3447
  }
3220
- function T(d, t, n) {
3448
+ function M(d, t, n) {
3221
3449
  d.h[t] = n, d.g && (d.g[t] = n);
3222
3450
  }
3223
- function b1(d, t, n) {
3451
+ function O1(d, t, n) {
3224
3452
  d.h[t] || (d.h[t] = []), d.h[t].push(n), d.g && delete d.g[t];
3225
3453
  }
3226
- function i1(d, t) {
3227
- var n = [], s;
3228
- for (s in t) s != 0 && n.push(new k(s, t[s]));
3229
- return new f0(d, n);
3454
+ function u1(d, t) {
3455
+ var n = [], r;
3456
+ for (r in t) r != 0 && n.push(new v(r, t[r]));
3457
+ return new w0(d, n);
3230
3458
  }
3231
- function r1() {
3459
+ function l1() {
3232
3460
  }
3233
- r1.prototype.g = function(d) {
3461
+ l1.prototype.g = function(d) {
3234
3462
  throw new d.h(), Error("Unimplemented");
3235
- }, r1.prototype.h = function(d, t) {
3236
- if (d.h == 11 || d.h == 10) return t instanceof x ? t : this.g(d.s.prototype.m(), t);
3237
- if (d.h == 14) return typeof t == "string" && L1.test(t) && (d = Number(t), 0 < d) ? d : t;
3463
+ }, l1.prototype.h = function(d, t) {
3464
+ if (d.h == 11 || d.h == 10) return t instanceof U ? t : this.g(d.s.prototype.m(), t);
3465
+ if (d.h == 14) return typeof t == "string" && x1.test(t) && (d = Number(t), 0 < d) ? d : t;
3238
3466
  if (!d.o) return t;
3239
3467
  if (d = d.s, d === String) {
3240
3468
  if (typeof t == "number") return String(t);
3241
- } else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || L1.test(t))) return Number(t);
3469
+ } else if (d === Number && typeof t == "string" && (t === "Infinity" || t === "-Infinity" || t === "NaN" || x1.test(t))) return Number(t);
3242
3470
  return t;
3243
3471
  };
3244
- var L1 = /^-?[0-9]+$/;
3245
- function p1() {
3472
+ var x1 = /^-?[0-9]+$/;
3473
+ function I1() {
3246
3474
  }
3247
- $(p1, r1), p1.prototype.g = function(d, t) {
3475
+ $(I1, l1), I1.prototype.g = function(d, t) {
3248
3476
  return d = new d.h(), d.l = this, d.h = t, d.g = {}, d;
3249
3477
  };
3250
- function q() {
3478
+ function t1() {
3251
3479
  }
3252
- $(q, p1), q.prototype.h = function(d, t) {
3253
- return d.h == 8 ? !!t : r1.prototype.h.apply(this, arguments);
3254
- }, q.prototype.g = function(d, t) {
3255
- return q.ma.g.call(this, d, t);
3480
+ $(t1, I1), t1.prototype.h = function(d, t) {
3481
+ return d.h == 8 ? !!t : l1.prototype.h.apply(this, arguments);
3482
+ }, t1.prototype.g = function(d, t) {
3483
+ return t1.ma.g.call(this, d, t);
3256
3484
  };
3257
- function A(d, t) {
3485
+ function D(d, t) {
3258
3486
  d != null && this.g.apply(this, arguments);
3259
3487
  }
3260
- A.prototype.h = "", A.prototype.set = function(d) {
3488
+ D.prototype.h = "", D.prototype.set = function(d) {
3261
3489
  this.h = "" + d;
3262
- }, A.prototype.g = function(d, t, n) {
3263
- if (this.h += String(d), t != null) for (let s = 1; s < arguments.length; s++) this.h += arguments[s];
3490
+ }, D.prototype.g = function(d, t, n) {
3491
+ if (this.h += String(d), t != null) for (let r = 1; r < arguments.length; r++) this.h += arguments[r];
3264
3492
  return this;
3265
3493
  };
3266
- function R(d) {
3494
+ function H(d) {
3267
3495
  d.h = "";
3268
3496
  }
3269
- A.prototype.toString = function() {
3497
+ D.prototype.toString = function() {
3270
3498
  return this.h;
3271
3499
  };
3272
- function W() {
3273
- x.call(this);
3500
+ function Z() {
3501
+ U.call(this);
3274
3502
  }
3275
- $(W, x);
3276
- var N1 = null;
3503
+ $(Z, U);
3504
+ var B1 = null;
3277
3505
  function b() {
3278
- x.call(this);
3279
- }
3280
- $(b, x);
3281
- var A1 = null;
3282
- function z() {
3283
- x.call(this);
3284
- }
3285
- $(z, x);
3286
- var E1 = null;
3287
- W.prototype.m = function() {
3288
- var d = N1;
3289
- return d || (N1 = d = i1(W, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
3290
- }, W.m = W.prototype.m, b.prototype.m = function() {
3291
- var d = A1;
3292
- return d || (A1 = d = i1(b, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
3293
- }, b.m = b.prototype.m, z.prototype.m = function() {
3294
- var d = E1;
3295
- return d || (E1 = d = i1(z, {
3506
+ U.call(this);
3507
+ }
3508
+ $(b, U);
3509
+ var U1 = null;
3510
+ function J() {
3511
+ U.call(this);
3512
+ }
3513
+ $(J, U);
3514
+ var G1 = null;
3515
+ Z.prototype.m = function() {
3516
+ var d = B1;
3517
+ return d || (B1 = d = u1(Z, { 0: { name: "NumberFormat", ia: "i18n.phonenumbers.NumberFormat" }, 1: { name: "pattern", required: !0, i: 9, type: String }, 2: { name: "format", required: !0, i: 9, type: String }, 3: { name: "leading_digits_pattern", aa: !0, i: 9, type: String }, 4: { name: "national_prefix_formatting_rule", i: 9, type: String }, 6: { name: "national_prefix_optional_when_formatting", i: 8, defaultValue: !1, type: Boolean }, 5: { name: "domestic_carrier_code_formatting_rule", i: 9, type: String } })), d;
3518
+ }, Z.m = Z.prototype.m, b.prototype.m = function() {
3519
+ var d = U1;
3520
+ return d || (U1 = d = u1(b, { 0: { name: "PhoneNumberDesc", ia: "i18n.phonenumbers.PhoneNumberDesc" }, 2: { name: "national_number_pattern", i: 9, type: String }, 9: { name: "possible_length", aa: !0, i: 5, type: Number }, 10: { name: "possible_length_local_only", aa: !0, i: 5, type: Number }, 6: { name: "example_number", i: 9, type: String } })), d;
3521
+ }, b.m = b.prototype.m, J.prototype.m = function() {
3522
+ var d = G1;
3523
+ return d || (G1 = d = u1(J, {
3296
3524
  0: { name: "PhoneMetadata", ia: "i18n.phonenumbers.PhoneMetadata" },
3297
3525
  1: { name: "general_desc", i: 11, type: b },
3298
3526
  2: { name: "fixed_line", i: 11, type: b },
@@ -3324,26 +3552,26 @@ const n2 = (f) => {
3324
3552
  },
3325
3553
  16: { name: "national_prefix_transform_rule", i: 9, type: String },
3326
3554
  18: { name: "same_mobile_and_fixed_line_pattern", i: 8, defaultValue: !1, type: Boolean },
3327
- 19: { name: "number_format", aa: !0, i: 11, type: W },
3328
- 20: { name: "intl_number_format", aa: !0, i: 11, type: W },
3555
+ 19: { name: "number_format", aa: !0, i: 11, type: Z },
3556
+ 20: { name: "intl_number_format", aa: !0, i: 11, type: Z },
3329
3557
  22: { name: "main_country_for_code", i: 8, defaultValue: !1, type: Boolean },
3330
3558
  23: { name: "leading_digits", i: 9, type: String }
3331
3559
  })), d;
3332
- }, z.m = z.prototype.m;
3333
- function V() {
3334
- x.call(this);
3335
- }
3336
- $(V, x);
3337
- var T1 = null, g0 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
3338
- V.prototype.m = function() {
3339
- var d = T1;
3340
- return d || (T1 = d = i1(V, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: g0 }, 7: {
3560
+ }, J.m = J.prototype.m;
3561
+ function Y() {
3562
+ U.call(this);
3563
+ }
3564
+ $(Y, U);
3565
+ var H1 = null, T0 = { ra: 0, qa: 1, pa: 5, oa: 10, na: 20 };
3566
+ Y.prototype.m = function() {
3567
+ var d = H1;
3568
+ return d || (H1 = d = u1(Y, { 0: { name: "PhoneNumber", ia: "i18n.phonenumbers.PhoneNumber" }, 1: { name: "country_code", required: !0, i: 5, type: Number }, 2: { name: "national_number", required: !0, i: 4, type: Number }, 3: { name: "extension", i: 9, type: String }, 4: { name: "italian_leading_zero", i: 8, type: Boolean }, 8: { name: "number_of_leading_zeros", i: 5, defaultValue: 1, type: Number }, 5: { name: "raw_input", i: 9, type: String }, 6: { name: "country_code_source", i: 14, defaultValue: 0, type: T0 }, 7: {
3341
3569
  name: "preferred_domestic_carrier_code",
3342
3570
  i: 9,
3343
3571
  type: String
3344
3572
  } })), d;
3345
- }, V.ctor = V, V.ctor.m = V.prototype.m;
3346
- var X = {
3573
+ }, Y.ctor = Y, Y.ctor.m = Y.prototype.m;
3574
+ var e1 = {
3347
3575
  1: "US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),
3348
3576
  7: ["RU", "KZ"],
3349
3577
  20: ["EG"],
@@ -3559,7 +3787,7 @@ const n2 = (f) => {
3559
3787
  995: ["GE"],
3560
3788
  996: ["KG"],
3561
3789
  998: ["UZ"]
3562
- }, M1 = {
3790
+ }, k1 = {
3563
3791
  AC: [, [
3564
3792
  ,
3565
3793
  ,
@@ -6108,7 +6336,7 @@ const n2 = (f) => {
6108
6336
  ,
6109
6337
  ,
6110
6338
  [7, 8, 9]
6111
- ], [, , "(?:1(?:0[0-8]|1[0-7]|2[014]|30)|7\\d\\d)\\d{6}", , , , "712123456", , , [9]], [, , "800[02-8]\\d{5,6}", , , , "800223456", , , [9, 10]], [, , "900[02-9]\\d{5}", , , , "900223456", , , [9]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "KE", 254, "000", "0", , , "0", , , , [[, "(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], [, "(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6339
+ ], [, , "(?:1(?:0[0-8]|1\\d|2[014]|[34]0)|7\\d\\d)\\d{6}", , , , "712123456", , , [9]], [, , "800[02-8]\\d{5,6}", , , , "800223456", , , [9, 10]], [, , "900[02-9]\\d{5}", , , , "900223456", , , [9]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "KE", 254, "000", "0", , , "0", , , , [[, "(\\d{2})(\\d{5,7})", "$1 $2", ["[24-6]"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[17]"], "0$1"], [, "(\\d{3})(\\d{3})(\\d{3,4})", "$1 $2 $3", ["[89]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
6112
6340
  KG: [, [
6113
6341
  ,
6114
6342
  ,
@@ -8164,7 +8392,7 @@ const n2 = (f) => {
8164
8392
  ,
8165
8393
  ,
8166
8394
  [5, 6, 7]
8167
- ], [, , "72[48]0\\d{5}|7(?:[014-8]\\d|2[067]|36|9[0189])\\d{6}", , , , "712345678"], [, , "800[1-3]\\d{5}", , , , "800123456"], [, , "90[1-3]\\d{6}", , , , "901123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "UG", 256, "00[057]", "0", , , "0", , , , [[, "(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], [, "(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
8395
+ ], [, , "72[48]0\\d{5}|7(?:[014-8]\\d|2[067]|36|9[0-289])\\d{6}", , , , "712345678"], [, , "800[1-3]\\d{5}", , , , "800123456"], [, , "90[1-3]\\d{6}", , , , "901123456"], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "UG", 256, "00[057]", "0", , , "0", , , , [[, "(\\d{4})(\\d{5})", "$1 $2", ["202", "2024"], "0$1"], [, "(\\d{3})(\\d{6})", "$1 $2", ["[27-9]|4(?:6[45]|[7-9])"], "0$1"], [, "(\\d{2})(\\d{7})", "$1 $2", ["[34]"], "0$1"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]],
8168
8396
  US: [, [
8169
8397
  ,
8170
8398
  ,
@@ -8180,7 +8408,7 @@ const n2 = (f) => {
8180
8408
  ], [
8181
8409
  ,
8182
8410
  ,
8183
- "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8411
+ "3052(?:0[0-8]|[1-9]\\d)\\d{4}|(?:2742|305[3-9])\\d{6}|(?:472|983)[2-47-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8184
8412
  ,
8185
8413
  ,
8186
8414
  ,
@@ -8192,7 +8420,7 @@ const n2 = (f) => {
8192
8420
  ], [
8193
8421
  ,
8194
8422
  ,
8195
- "(?:3052(?:0[0-8]|[1-9]\\d)|5056(?:[0-35-9]\\d|4[0-68]))\\d{4}|(?:2742|305[3-9]|(?:472|983)[2-47-9]|505[2-57-9])\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-47-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8423
+ "3052(?:0[0-8]|[1-9]\\d)\\d{4}|(?:2742|305[3-9])\\d{6}|(?:472|983)[2-47-9]\\d{6}|(?:2(?:0[1-35-9]|1[02-9]|2[03-57-9]|3[1459]|4[08]|5[1-46]|6[0279]|7[0269]|8[13])|3(?:0[1-47-9]|1[02-9]|2[0135-79]|3[0-24679]|4[167]|5[0-2]|6[01349]|8[056])|4(?:0[124-9]|1[02-579]|2[3-5]|3[0245]|4[023578]|58|6[349]|7[0589]|8[04])|5(?:0[1-57-9]|1[0235-8]|20|3[0149]|4[01]|5[179]|6[1-47]|7[0-5]|8[0256])|6(?:0[1-35-9]|1[024-9]|2[03689]|3[016]|4[0156]|5[01679]|6[0-279]|78|8[0-269])|7(?:0[1-46-8]|1[2-9]|2[04-8]|3[0-247]|4[0378]|5[47]|6[02359]|7[0-59]|8[156])|8(?:0[1-68]|1[02-8]|2[0168]|3[0-2589]|4[03578]|5[046-9]|6[02-5]|7[028])|9(?:0[1346-9]|1[02-9]|2[0589]|3[0146-8]|4[01357-9]|5[12469]|7[0-3589]|8[04-69]))[2-9]\\d{6}",
8196
8424
  ,
8197
8425
  ,
8198
8426
  ,
@@ -8693,13 +8921,13 @@ const n2 = (f) => {
8693
8921
  ], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 888, , , , , , , , 1, [[, "(\\d{3})(\\d{3})(\\d{5})", "$1 $2 $3"]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , "\\d{11}", , , , "12345678901"], , , [, , , , , , , , , [-1]]],
8694
8922
  979: [, [, , "[1359]\\d{8}", , , , , , , [9], [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , "[1359]\\d{8}", , , , "123456789", , , , [8]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], "001", 979, , , , , , , , 1, [[, "(\\d)(\\d{4})(\\d{4})", "$1 $2 $3", ["[1359]"]]], , [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]], [, , , , , , , , , [-1]], , , [, , , , , , , , , [-1]]]
8695
8923
  };
8696
- function M() {
8924
+ function R() {
8697
8925
  this.g = {};
8698
8926
  }
8699
- M.h = void 0, M.g = function() {
8700
- return M.h ? M.h : M.h = new M();
8927
+ R.h = void 0, R.g = function() {
8928
+ return R.h ? R.h : R.h = new R();
8701
8929
  };
8702
- var g1 = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "0": "0", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8", "9": "9", "٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9", "۰": "0", "۱": "1", "۲": "2", "۳": "3", "۴": "4", "۵": "5", "۶": "6", "۷": "7", "۸": "8", "۹": "9" }, m0 = {
8930
+ var _1 = { 0: "0", 1: "1", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", "0": "0", "1": "1", "2": "2", "3": "3", "4": "4", "5": "5", "6": "6", "7": "7", "8": "8", "9": "9", "٠": "0", "١": "1", "٢": "2", "٣": "3", "٤": "4", "٥": "5", "٦": "6", "٧": "7", "٨": "8", "٩": "9", "۰": "0", "۱": "1", "۲": "2", "۳": "3", "۴": "4", "۵": "5", "۶": "6", "۷": "7", "۸": "8", "۹": "9" }, D0 = {
8703
8931
  0: "0",
8704
8932
  1: "1",
8705
8933
  2: "2",
@@ -8713,7 +8941,7 @@ const n2 = (f) => {
8713
8941
  "+": "+",
8714
8942
  "*": "*",
8715
8943
  "#": "#"
8716
- }, C0 = {
8944
+ }, v0 = {
8717
8945
  0: "0",
8718
8946
  1: "1",
8719
8947
  2: "2",
@@ -8780,154 +9008,154 @@ const n2 = (f) => {
8780
9008
  X: "9",
8781
9009
  Y: "9",
8782
9010
  Z: "9"
8783
- }, y0 = RegExp("[++]+"), Q = RegExp("^[++]+"), D1 = RegExp("([0-90-9٠-٩۰-۹])"), _0 = RegExp("[++0-90-9٠-٩۰-۹]"), I0 = /[\\\/] *x/, v0 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), w0 = /(?:.*?[A-Za-z]){3}.*/, S0 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), b0 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
8784
- function J(d) {
9011
+ }, P0 = RegExp("[++]+"), $1 = RegExp("^[++]+"), F1 = RegExp("([0-90-9٠-٩۰-۹])"), M0 = RegExp("[++0-90-9٠-٩۰-۹]"), R0 = /[\\\/] *x/, O0 = RegExp("[^0-90-9٠-٩۰-۹A-Za-z#]+$"), x0 = /(?:.*?[A-Za-z]){3}.*/, B0 = RegExp("^\\+([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*[0-90-9٠-٩۰-۹]([0-90-9٠-٩۰-۹]|[\\-\\.\\(\\)]?)*$"), U0 = RegExp("^([A-Za-z0-90-9٠-٩۰-۹]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-90-9٠-٩۰-۹])*\\.?$");
9012
+ function d1(d) {
8785
9013
  return "([0-90-9٠-٩۰-۹]{1," + d + "})";
8786
9014
  }
8787
- function P1() {
8788
- return ";ext=" + J("20") + "|[  \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[  \\t,-]*" + (J("20") + "#?|[  \\t,]*(?:[xx##~~]|int|int)[:\\..]?[  \\t,-]*") + (J("9") + "#?|[- ]+") + (J("6") + "#|[  \\t]*(?:,{2}|;)[:\\..]?[  \\t,-]*") + (J("15") + "#?|[  \\t]*(?:,)+[:\\..]?[  \\t,-]*") + (J("9") + "#?");
9015
+ function W1() {
9016
+ return ";ext=" + d1("20") + "|[  \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|anexo)[:\\..]?[  \\t,-]*" + (d1("20") + "#?|[  \\t,]*(?:[xx##~~]|int|int)[:\\..]?[  \\t,-]*") + (d1("9") + "#?|[- ]+") + (d1("6") + "#|[  \\t]*(?:,{2}|;)[:\\..]?[  \\t,-]*") + (d1("15") + "#?|[  \\t]*(?:,)+[:\\..]?[  \\t,-]*") + (d1("9") + "#?");
8789
9017
  }
8790
- var x1 = new RegExp("(?:" + P1() + ")$", "i"), L0 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + P1() + ")?$", "i"), N0 = /(\$\d)/, A0 = /^\(?\$1\)?$/;
8791
- function B1(d) {
8792
- return 2 > d.length ? !1 : U(L0, d);
9018
+ var V1 = new RegExp("(?:" + W1() + ")$", "i"), G0 = new RegExp("^[0-90-9٠-٩۰-۹]{2}$|^[++]*(?:[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*]*[0-90-9٠-٩۰-۹]){3,}[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~*A-Za-z0-90-9٠-٩۰-۹]*(?:" + W1() + ")?$", "i"), H0 = /(\$\d)/, k0 = /^\(?\$1\)?$/;
9019
+ function K1(d) {
9020
+ return 2 > d.length ? !1 : V(G0, d);
8793
9021
  }
8794
- function R1(d) {
8795
- return U(w0, d) ? s1(d, C0) : s1(d, g1);
9022
+ function j1(d) {
9023
+ return V(x0, d) ? a1(d, v0) : a1(d, _1);
8796
9024
  }
8797
- function k1(d) {
8798
- var t = R1(d.toString());
8799
- R(d), d.g(t);
9025
+ function Y1(d) {
9026
+ var t = j1(d.toString());
9027
+ H(d), d.g(t);
8800
9028
  }
8801
- function O1(d) {
8802
- return d != null && (K(d, 9) != 1 || D(d, 9)[0] != -1);
9029
+ function z1(d) {
9030
+ return d != null && (j(d, 9) != 1 || O(d, 9)[0] != -1);
8803
9031
  }
8804
- function s1(d, t) {
8805
- for (var n = new A(), s, o = d.length, l = 0; l < o; ++l) s = d.charAt(l), s = t[s.toUpperCase()], s != null && n.g(s);
9032
+ function a1(d, t) {
9033
+ for (var n = new D(), r, o = d.length, l = 0; l < o; ++l) r = d.charAt(l), r = t[r.toUpperCase()], r != null && n.g(r);
8806
9034
  return n.toString();
8807
9035
  }
8808
- function G1(d) {
8809
- return d.length == 0 || A0.test(d);
9036
+ function Z1(d) {
9037
+ return d.length == 0 || k0.test(d);
8810
9038
  }
8811
- function o1(d) {
8812
- return d != null && isNaN(d) && d.toUpperCase() in M1;
9039
+ function c1(d) {
9040
+ return d != null && isNaN(d) && d.toUpperCase() in k1;
8813
9041
  }
8814
- M.prototype.format = function(d, t) {
8815
- if (m(d, 2) == 0 && B(d, 5)) {
9042
+ R.prototype.format = function(d, t) {
9043
+ if (g(d, 2) == 0 && G(d, 5)) {
8816
9044
  var n = S(d, 5);
8817
9045
  if (0 < n.length) return n;
8818
9046
  }
8819
9047
  n = S(d, 1);
8820
- var s = t1(d);
8821
- if (t == 0) return U1(n, 0, s, "");
8822
- if (!(n in X)) return s;
8823
- var o = d1(this, n, e1(n));
8824
- d = B(d, 3) && m(d, 3).length != 0 ? t == 3 ? ";ext=" + m(d, 3) : B(o, 13) ? m(o, 13) + S(d, 3) : " ext. " + S(d, 3) : "";
9048
+ var r = i1(d);
9049
+ if (t == 0) return J1(n, 0, r, "");
9050
+ if (!(n in e1)) return r;
9051
+ var o = n1(this, n, s1(n));
9052
+ d = G(d, 3) && g(d, 3).length != 0 ? t == 3 ? ";ext=" + g(d, 3) : G(o, 13) ? g(o, 13) + S(d, 3) : " ext. " + S(d, 3) : "";
8825
9053
  d: {
8826
- o = D(o, 20).length == 0 || t == 2 ? D(o, 19) : D(o, 20);
8827
- for (var l, a = o.length, p = 0; p < a; ++p) {
9054
+ o = O(o, 20).length == 0 || t == 2 ? O(o, 19) : O(o, 20);
9055
+ for (var l, c = o.length, p = 0; p < c; ++p) {
8828
9056
  l = o[p];
8829
- var _ = K(l, 3);
8830
- if ((_ == 0 || s.search(m(l, 3, _ - 1)) == 0) && (_ = new RegExp(m(l, 1)), U(_, s))) {
9057
+ var y = j(l, 3);
9058
+ if ((y == 0 || r.search(g(l, 3, y - 1)) == 0) && (y = new RegExp(g(l, 1)), V(y, r))) {
8831
9059
  o = l;
8832
9060
  break d;
8833
9061
  }
8834
9062
  }
8835
9063
  o = null;
8836
9064
  }
8837
- return o != null && (a = o, o = S(a, 2), l = new RegExp(m(a, 1)), S(
8838
- a,
9065
+ return o != null && (c = o, o = S(c, 2), l = new RegExp(g(c, 1)), S(
9066
+ c,
8839
9067
  5
8840
- ), a = S(a, 4), s = t == 2 && a != null && 0 < a.length ? s.replace(l, o.replace(N0, a)) : s.replace(l, o), t == 3 && (s = s.replace(RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+"), ""), s = s.replace(RegExp("[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), U1(n, t, s, d);
9068
+ ), c = S(c, 4), r = t == 2 && c != null && 0 < c.length ? r.replace(l, o.replace(H0, c)) : r.replace(l, o), t == 3 && (r = r.replace(RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+"), ""), r = r.replace(RegExp("[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]+", "g"), "-"))), J1(n, t, r, d);
8841
9069
  };
8842
- function d1(d, t, n) {
8843
- return n == "001" ? H(d, "" + t) : H(d, n);
9070
+ function n1(d, t, n) {
9071
+ return n == "001" ? z(d, "" + t) : z(d, n);
8844
9072
  }
8845
- function t1(d) {
8846
- if (!B(d, 2)) return "";
8847
- var t = "" + m(d, 2);
8848
- return B(d, 4) && m(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
9073
+ function i1(d) {
9074
+ if (!G(d, 2)) return "";
9075
+ var t = "" + g(d, 2);
9076
+ return G(d, 4) && g(d, 4) && 0 < S(d, 8) ? Array(S(d, 8) + 1).join("0") + t : t;
8849
9077
  }
8850
- function U1(d, t, n, s) {
9078
+ function J1(d, t, n, r) {
8851
9079
  switch (t) {
8852
9080
  case 0:
8853
- return "+" + d + n + s;
9081
+ return "+" + d + n + r;
8854
9082
  case 1:
8855
- return "+" + d + " " + n + s;
9083
+ return "+" + d + " " + n + r;
8856
9084
  case 3:
8857
- return "tel:+" + d + "-" + n + s;
9085
+ return "tel:+" + d + "-" + n + r;
8858
9086
  default:
8859
- return n + s;
9087
+ return n + r;
8860
9088
  }
8861
9089
  }
8862
- function l1(d, t) {
9090
+ function h1(d, t) {
8863
9091
  switch (t) {
8864
9092
  case 4:
8865
- return m(d, 5);
9093
+ return g(d, 5);
8866
9094
  case 3:
8867
- return m(d, 4);
9095
+ return g(d, 4);
8868
9096
  case 1:
8869
- return m(d, 3);
9097
+ return g(d, 3);
8870
9098
  case 0:
8871
9099
  case 2:
8872
- return m(d, 2);
9100
+ return g(d, 2);
8873
9101
  case 5:
8874
- return m(d, 6);
9102
+ return g(d, 6);
8875
9103
  case 6:
8876
- return m(d, 8);
9104
+ return g(d, 8);
8877
9105
  case 7:
8878
- return m(d, 7);
9106
+ return g(d, 7);
8879
9107
  case 8:
8880
- return m(d, 21);
9108
+ return g(d, 21);
8881
9109
  case 9:
8882
- return m(d, 25);
9110
+ return g(d, 25);
8883
9111
  case 10:
8884
- return m(d, 28);
9112
+ return g(d, 28);
8885
9113
  default:
8886
- return m(d, 1);
9114
+ return g(d, 1);
8887
9115
  }
8888
9116
  }
8889
- function F1(d, t) {
8890
- var n = K1(d, t);
8891
- return d = d1(d, S(t, 1), n), d == null ? -1 : (t = t1(t), m1(t, d));
9117
+ function X1(d, t) {
9118
+ var n = q1(d, t);
9119
+ return d = n1(d, S(t, 1), n), d == null ? -1 : (t = i1(t), E1(t, d));
8892
9120
  }
8893
- function m1(d, t) {
8894
- return O(d, m(t, 1)) ? O(d, m(t, 5)) ? 4 : O(d, m(t, 4)) ? 3 : O(d, m(t, 6)) ? 5 : O(d, m(t, 8)) ? 6 : O(d, m(t, 7)) ? 7 : O(d, m(t, 21)) ? 8 : O(d, m(t, 25)) ? 9 : O(d, m(t, 28)) ? 10 : O(d, m(t, 2)) ? m(t, 18) || O(d, m(t, 3)) ? 2 : 0 : !m(t, 18) && O(d, m(t, 3)) ? 1 : -1 : -1;
9121
+ function E1(d, t) {
9122
+ return F(d, g(t, 1)) ? F(d, g(t, 5)) ? 4 : F(d, g(t, 4)) ? 3 : F(d, g(t, 6)) ? 5 : F(d, g(t, 8)) ? 6 : F(d, g(t, 7)) ? 7 : F(d, g(t, 21)) ? 8 : F(d, g(t, 25)) ? 9 : F(d, g(t, 28)) ? 10 : F(d, g(t, 2)) ? g(t, 18) || F(d, g(t, 3)) ? 2 : 0 : !g(t, 18) && F(d, g(t, 3)) ? 1 : -1 : -1;
8895
9123
  }
8896
- function H(d, t) {
9124
+ function z(d, t) {
8897
9125
  if (t == null) return null;
8898
9126
  t = t.toUpperCase();
8899
9127
  var n = d.g[t];
8900
9128
  if (n == null) {
8901
- if (n = M1[t], n == null) return null;
8902
- n = new q().g(z.m(), n), d.g[t] = n;
9129
+ if (n = k1[t], n == null) return null;
9130
+ n = new t1().g(J.m(), n), d.g[t] = n;
8903
9131
  }
8904
9132
  return n;
8905
9133
  }
8906
- function O(d, t) {
9134
+ function F(d, t) {
8907
9135
  var n = d.length;
8908
- return 0 < K(t, 9) && D(t, 9).indexOf(n) == -1 ? !1 : U(S(t, 2), d);
9136
+ return 0 < j(t, 9) && O(t, 9).indexOf(n) == -1 ? !1 : V(S(t, 2), d);
8909
9137
  }
8910
- function E0(d, t) {
8911
- var n = K1(d, t), s = S(t, 1), o = d1(d, s, n);
8912
- return o == null || n != "001" && s != V1(d, n) ? o = !1 : (d = t1(t), o = m1(d, o) != -1), o;
9138
+ function F0(d, t) {
9139
+ var n = q1(d, t), r = S(t, 1), o = n1(d, r, n);
9140
+ return o == null || n != "001" && r != Q1(d, n) ? o = !1 : (d = i1(t), o = E1(d, o) != -1), o;
8913
9141
  }
8914
- function K1(d, t) {
9142
+ function q1(d, t) {
8915
9143
  if (t == null) return null;
8916
9144
  var n = S(t, 1);
8917
- if (n = X[n], n == null) d = null;
9145
+ if (n = e1[n], n == null) d = null;
8918
9146
  else if (n.length == 1) d = n[0];
8919
9147
  else d: {
8920
- t = t1(t);
8921
- for (var s, o = n.length, l = 0; l < o; l++) {
8922
- s = n[l];
8923
- var a = H(d, s);
8924
- if (B(a, 23)) {
8925
- if (t.search(m(a, 23)) == 0) {
8926
- d = s;
9148
+ t = i1(t);
9149
+ for (var r, o = n.length, l = 0; l < o; l++) {
9150
+ r = n[l];
9151
+ var c = z(d, r);
9152
+ if (G(c, 23)) {
9153
+ if (t.search(g(c, 23)) == 0) {
9154
+ d = r;
8927
9155
  break d;
8928
9156
  }
8929
- } else if (m1(t, a) != -1) {
8930
- d = s;
9157
+ } else if (E1(t, c) != -1) {
9158
+ d = r;
8931
9159
  break d;
8932
9160
  }
8933
9161
  }
@@ -8935,151 +9163,151 @@ const n2 = (f) => {
8935
9163
  }
8936
9164
  return d;
8937
9165
  }
8938
- function e1(d) {
8939
- return d = X[d], d == null ? "ZZ" : d[0];
9166
+ function s1(d) {
9167
+ return d = e1[d], d == null ? "ZZ" : d[0];
8940
9168
  }
8941
- function V1(d, t) {
8942
- if (d = H(d, t), d == null) throw Error("Invalid region code: " + t);
9169
+ function Q1(d, t) {
9170
+ if (d = z(d, t), d == null) throw Error("Invalid region code: " + t);
8943
9171
  return S(d, 10);
8944
9172
  }
8945
- function u1(d, t, n, s) {
8946
- var o = l1(n, s), l = K(o, 9) == 0 ? D(m(n, 1), 9) : D(o, 9);
8947
- if (o = D(o, 10), s == 2) if (O1(l1(n, 0))) d = l1(n, 1), O1(d) && (l = l.concat(K(d, 9) == 0 ? D(m(n, 1), 9) : D(d, 9)), l.sort(), o.length == 0 ? o = D(d, 10) : (o = o.concat(D(d, 10)), o.sort()));
8948
- else return u1(d, t, n, 1);
9173
+ function f1(d, t, n, r) {
9174
+ var o = h1(n, r), l = j(o, 9) == 0 ? O(g(n, 1), 9) : O(o, 9);
9175
+ if (o = O(o, 10), r == 2) if (z1(h1(n, 0))) d = h1(n, 1), z1(d) && (l = l.concat(j(d, 9) == 0 ? O(g(n, 1), 9) : O(d, 9)), l.sort(), o.length == 0 ? o = O(d, 10) : (o = o.concat(O(d, 10)), o.sort()));
9176
+ else return f1(d, t, n, 1);
8949
9177
  return l[0] == -1 ? 5 : (t = t.length, -1 < o.indexOf(t) ? 4 : (n = l[0], n == t ? 0 : n > t ? 2 : l[l.length - 1] < t ? 3 : -1 < l.indexOf(t, 1) ? 0 : 5));
8950
9178
  }
8951
- function a1(d, t, n) {
8952
- var s = t1(t);
8953
- return t = S(t, 1), t in X ? (t = d1(d, t, e1(t)), u1(d, s, t, n)) : 1;
9179
+ function p1(d, t, n) {
9180
+ var r = i1(t);
9181
+ return t = S(t, 1), t in e1 ? (t = n1(d, t, s1(t)), f1(d, r, t, n)) : 1;
8954
9182
  }
8955
- function H1(d, t) {
9183
+ function d0(d, t) {
8956
9184
  if (d = d.toString(), d.length == 0 || d.charAt(0) == "0") return 0;
8957
- for (var n, s = d.length, o = 1; 3 >= o && o <= s; ++o) if (n = parseInt(d.substring(0, o), 10), n in X) return t.g(d.substring(o)), n;
9185
+ for (var n, r = d.length, o = 1; 3 >= o && o <= r; ++o) if (n = parseInt(d.substring(0, o), 10), n in e1) return t.g(d.substring(o)), n;
8958
9186
  return 0;
8959
9187
  }
8960
- function j1(d, t, n, s, o, l) {
9188
+ function t0(d, t, n, r, o, l) {
8961
9189
  if (t.length == 0) return 0;
8962
- t = new A(t);
8963
- var a;
8964
- n != null && (a = m(n, 11)), a == null && (a = "NonMatch");
9190
+ t = new D(t);
9191
+ var c;
9192
+ n != null && (c = g(n, 11)), c == null && (c = "NonMatch");
8965
9193
  var p = t.toString();
8966
- if (p.length == 0) a = 20;
8967
- else if (Q.test(p)) p = p.replace(Q, ""), R(t), t.g(R1(p)), a = 1;
9194
+ if (p.length == 0) c = 20;
9195
+ else if ($1.test(p)) p = p.replace($1, ""), H(t), t.g(j1(p)), c = 1;
8968
9196
  else {
8969
- if (p = new RegExp(a), k1(t), a = t.toString(), a.search(p) == 0) {
8970
- p = a.match(p)[0].length;
8971
- var _ = a.substring(p).match(D1);
8972
- _ && _[1] != null && 0 < _[1].length && s1(_[1], g1) == "0" ? a = !1 : (R(t), t.g(a.substring(p)), a = !0);
8973
- } else a = !1;
8974
- a = a ? 5 : 20;
9197
+ if (p = new RegExp(c), Y1(t), c = t.toString(), c.search(p) == 0) {
9198
+ p = c.match(p)[0].length;
9199
+ var y = c.substring(p).match(F1);
9200
+ y && y[1] != null && 0 < y[1].length && a1(y[1], _1) == "0" ? c = !1 : (H(t), t.g(c.substring(p)), c = !0);
9201
+ } else c = !1;
9202
+ c = c ? 5 : 20;
8975
9203
  }
8976
- if (o && T(l, 6, a), a != 20) {
9204
+ if (o && M(l, 6, c), c != 20) {
8977
9205
  if (2 >= t.h.length) throw Error("Phone number too short after IDD");
8978
- if (d = H1(t, s), d != 0) return T(l, 1, d), d;
9206
+ if (d = d0(t, r), d != 0) return M(l, 1, d), d;
8979
9207
  throw Error("Invalid country calling code");
8980
9208
  }
8981
- return n != null && (a = S(n, 10), p = "" + a, _ = t.toString(), _.lastIndexOf(p, 0) == 0 && (p = new A(_.substring(p.length)), _ = m(n, 1), _ = new RegExp(S(_, 2)), W1(p, n, null), p = p.toString(), !U(_, t.toString()) && U(_, p) || u1(d, t.toString(), n, -1) == 3)) ? (s.g(p), o && T(l, 6, 10), T(l, 1, a), a) : (T(l, 1, 0), 0);
9209
+ return n != null && (c = S(n, 10), p = "" + c, y = t.toString(), y.lastIndexOf(p, 0) == 0 && (p = new D(y.substring(p.length)), y = g(n, 1), y = new RegExp(S(y, 2)), e0(p, n, null), p = p.toString(), !V(y, t.toString()) && V(y, p) || f1(d, t.toString(), n, -1) == 3)) ? (r.g(p), o && M(l, 6, 10), M(l, 1, c), c) : (M(l, 1, 0), 0);
8982
9210
  }
8983
- function W1(d, t, n) {
8984
- var s = d.toString(), o = s.length, l = m(t, 15);
9211
+ function e0(d, t, n) {
9212
+ var r = d.toString(), o = r.length, l = g(t, 15);
8985
9213
  if (o != 0 && l != null && l.length != 0) {
8986
- var a = new RegExp("^(?:" + l + ")");
8987
- if (o = a.exec(s)) {
8988
- l = new RegExp(S(m(t, 1), 2));
8989
- var p = U(l, s), _ = o.length - 1;
8990
- t = m(t, 16), t == null || t.length == 0 || o[_] == null || o[_].length == 0 ? (!p || U(l, s.substring(o[0].length))) && (n != null && 0 < _ && o[_] != null && n.g(o[1]), d.set(s.substring(o[0].length))) : (s = s.replace(a, t), (!p || U(l, s)) && (n != null && 0 < _ && n.g(o[1]), d.set(s)));
9214
+ var c = new RegExp("^(?:" + l + ")");
9215
+ if (o = c.exec(r)) {
9216
+ l = new RegExp(S(g(t, 1), 2));
9217
+ var p = V(l, r), y = o.length - 1;
9218
+ t = g(t, 16), t == null || t.length == 0 || o[y] == null || o[y].length == 0 ? (!p || V(l, r.substring(o[0].length))) && (n != null && 0 < y && o[y] != null && n.g(o[1]), d.set(r.substring(o[0].length))) : (r = r.replace(c, t), (!p || V(l, r)) && (n != null && 0 < y && n.g(o[1]), d.set(r)));
8991
9219
  }
8992
9220
  }
8993
9221
  }
8994
- function Z(d, t, n) {
8995
- if (!o1(n) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
8996
- return z1(d, t, n, !0);
9222
+ function X(d, t, n) {
9223
+ if (!c1(n) && 0 < t.length && t.charAt(0) != "+") throw Error("Invalid country calling code");
9224
+ return $0(d, t, n, !0);
8997
9225
  }
8998
- function z1(d, t, n, s) {
9226
+ function $0(d, t, n, r) {
8999
9227
  if (t == null) throw Error("The string supplied did not seem to be a phone number");
9000
9228
  if (250 < t.length) throw Error("The string supplied is too long to be a phone number");
9001
- var o = new A(), l = t.indexOf(";phone-context=");
9229
+ var o = new D(), l = t.indexOf(";phone-context=");
9002
9230
  if (l === -1) l = null;
9003
9231
  else if (l += 15, l >= t.length) l = "";
9004
9232
  else {
9005
- var a = t.indexOf(";", l);
9006
- l = a !== -1 ? t.substring(l, a) : t.substring(l);
9233
+ var c = t.indexOf(";", l);
9234
+ l = c !== -1 ? t.substring(l, c) : t.substring(l);
9007
9235
  }
9008
9236
  var p = l;
9009
- if (p == null ? a = !0 : p.length === 0 ? a = !1 : (a = S0.exec(p), p = b0.exec(p), a = a !== null || p !== null), !a || (l != null ? (l.charAt(0) === "+" && o.g(l), l = t.indexOf("tel:"), o.g(t.substring(0 <= l ? l + 4 : 0, t.indexOf(";phone-context=")))) : (l = o.g, a = t ?? "", p = a.search(_0), 0 <= p ? (a = a.substring(p), a = a.replace(v0, ""), p = a.search(I0), 0 <= p && (a = a.substring(0, p))) : a = "", l.call(o, a)), l = o.toString(), a = l.indexOf(";isub="), 0 < a && (R(o), o.g(l.substring(0, a))), !B1(o.toString()))) throw Error("The string supplied did not seem to be a phone number");
9010
- if (l = o.toString(), !(o1(n) || l != null && 0 < l.length && Q.test(l))) throw Error("Invalid country calling code");
9011
- l = new V(), s && T(l, 5, t);
9237
+ if (p == null ? c = !0 : p.length === 0 ? c = !1 : (c = B0.exec(p), p = U0.exec(p), c = c !== null || p !== null), !c || (l != null ? (l.charAt(0) === "+" && o.g(l), l = t.indexOf("tel:"), o.g(t.substring(0 <= l ? l + 4 : 0, t.indexOf(";phone-context=")))) : (l = o.g, c = t ?? "", p = c.search(M0), 0 <= p ? (c = c.substring(p), c = c.replace(O0, ""), p = c.search(R0), 0 <= p && (c = c.substring(0, p))) : c = "", l.call(o, c)), l = o.toString(), c = l.indexOf(";isub="), 0 < c && (H(o), o.g(l.substring(0, c))), !K1(o.toString()))) throw Error("The string supplied did not seem to be a phone number");
9238
+ if (l = o.toString(), !(c1(n) || l != null && 0 < l.length && $1.test(l))) throw Error("Invalid country calling code");
9239
+ l = new Y(), r && M(l, 5, t);
9012
9240
  d: {
9013
- if (t = o.toString(), a = t.search(x1), 0 <= a && B1(t.substring(0, a))) {
9014
- p = t.match(x1);
9015
- for (var _ = p.length, F = 1; F < _; ++F) if (p[F] != null && 0 < p[F].length) {
9016
- R(o), o.g(t.substring(0, a)), t = p[F];
9241
+ if (t = o.toString(), c = t.search(V1), 0 <= c && K1(t.substring(0, c))) {
9242
+ p = t.match(V1);
9243
+ for (var y = p.length, K = 1; K < y; ++K) if (p[K] != null && 0 < p[K].length) {
9244
+ H(o), o.g(t.substring(0, c)), t = p[K];
9017
9245
  break d;
9018
9246
  }
9019
9247
  }
9020
9248
  t = "";
9021
9249
  }
9022
- 0 < t.length && T(l, 3, t), a = H(d, n), t = new A(), p = 0, _ = o.toString();
9250
+ 0 < t.length && M(l, 3, t), c = z(d, n), t = new D(), p = 0, y = o.toString();
9023
9251
  try {
9024
- p = j1(d, _, a, t, s, l);
9025
- } catch (_1) {
9026
- if (_1.message == "Invalid country calling code" && Q.test(_)) {
9027
- if (_ = _.replace(Q, ""), p = j1(d, _, a, t, s, l), p == 0) throw _1;
9028
- } else throw _1;
9252
+ p = t0(d, y, c, t, r, l);
9253
+ } catch (L1) {
9254
+ if (L1.message == "Invalid country calling code" && $1.test(y)) {
9255
+ if (y = y.replace($1, ""), p = t0(d, y, c, t, r, l), p == 0) throw L1;
9256
+ } else throw L1;
9029
9257
  }
9030
- if (p != 0 ? (o = e1(p), o != n && (a = d1(d, p, o))) : (k1(o), t.g(o.toString()), n != null ? (p = S(a, 10), T(
9258
+ if (p != 0 ? (o = s1(p), o != n && (c = n1(d, p, o))) : (Y1(o), t.g(o.toString()), n != null ? (p = S(c, 10), M(
9031
9259
  l,
9032
9260
  1,
9033
9261
  p
9034
- )) : s && (delete l.h[6], l.g && delete l.g[6])), 2 > t.h.length || (a != null && (n = new A(), o = new A(t.toString()), W1(o, a, n), d = u1(d, o.toString(), a, -1), d != 2 && d != 4 && d != 5 && (t = o, s && 0 < n.toString().length && T(l, 7, n.toString()))), s = t.toString(), d = s.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
9262
+ )) : r && (delete l.h[6], l.g && delete l.g[6])), 2 > t.h.length || (c != null && (n = new D(), o = new D(t.toString()), e0(o, c, n), d = f1(d, o.toString(), c, -1), d != 2 && d != 4 && d != 5 && (t = o, r && 0 < n.toString().length && M(l, 7, n.toString()))), r = t.toString(), d = r.length, 2 > d)) throw Error("The string supplied is too short to be a phone number");
9035
9263
  if (17 < d) throw Error("The string supplied is too long to be a phone number");
9036
- if (1 < s.length && s.charAt(0) == "0") {
9037
- for (T(l, 4, !0), d = 1; d < s.length - 1 && s.charAt(d) == "0"; ) d++;
9038
- d != 1 && T(l, 8, d);
9264
+ if (1 < r.length && r.charAt(0) == "0") {
9265
+ for (M(l, 4, !0), d = 1; d < r.length - 1 && r.charAt(d) == "0"; ) d++;
9266
+ d != 1 && M(l, 8, d);
9039
9267
  }
9040
- return T(l, 2, parseInt(s, 10)), l;
9268
+ return M(l, 2, parseInt(r, 10)), l;
9041
9269
  }
9042
- function U(d, t) {
9270
+ function V(d, t) {
9043
9271
  return !!((d = t.match(new RegExp("^(?:" + (typeof d == "string" ? d : d.source) + ")$", "i"))) && d[0].length == t.length);
9044
9272
  }
9045
- function T0(d) {
9046
- this.fa = RegExp(" "), this.ja = "", this.v = new A(), this.da = "", this.s = new A(), this.ba = new A(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = M.g(), this.$ = 0, this.h = new A(), this.ha = !1, this.o = "", this.g = new A(), this.j = [], this.ka = d, this.l = J1(this, this.ka);
9273
+ function W0(d) {
9274
+ this.fa = RegExp(" "), this.ja = "", this.v = new D(), this.da = "", this.s = new D(), this.ba = new D(), this.u = !0, this.ea = this.ca = this.la = !1, this.ga = R.g(), this.$ = 0, this.h = new D(), this.ha = !1, this.o = "", this.g = new D(), this.j = [], this.ka = d, this.l = s0(this, this.ka);
9047
9275
  }
9048
- var Z1 = new z();
9049
- T(Z1, 11, "NA");
9050
- var M0 = RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)*$"), Y1 = /[- ]/;
9051
- function J1(d, t) {
9276
+ var n0 = new J();
9277
+ M(n0, 11, "NA");
9278
+ var V0 = RegExp("^[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*\\$1[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*(\\$\\d[-x‐-―−ー--/  ­​⁠ ()()[].\\[\\]/~⁓∼~]*)*$"), i0 = /[- ]/;
9279
+ function s0(d, t) {
9052
9280
  var n = d.ga;
9053
- return t = o1(t) ? V1(n, t) : 0, d = H(d.ga, e1(t)), d ?? Z1;
9281
+ return t = c1(t) ? Q1(n, t) : 0, d = z(d.ga, s1(t)), d ?? n0;
9054
9282
  }
9055
- function q1(d) {
9283
+ function r0(d) {
9056
9284
  for (var t = d.j.length, n = 0; n < t; ++n) {
9057
- var s = d.j[n], o = S(s, 1);
9285
+ var r = d.j[n], o = S(r, 1);
9058
9286
  if (d.da == o) return !1;
9059
- var l = d, a = s, p = S(a, 1);
9060
- R(l.v);
9061
- var _ = l;
9062
- a = S(a, 2);
9063
- var F = "999999999999999".match(p)[0];
9064
- if (F.length < _.g.h.length ? _ = "" : (_ = F.replace(new RegExp(p, "g"), a), _ = _.replace(RegExp("9", "g"), " ")), 0 < _.length ? (l.v.g(_), l = !0) : l = !1, l) return d.da = o, d.ha = Y1.test(m(s, 4)), d.$ = 0, !0;
9287
+ var l = d, c = r, p = S(c, 1);
9288
+ H(l.v);
9289
+ var y = l;
9290
+ c = S(c, 2);
9291
+ var K = "999999999999999".match(p)[0];
9292
+ if (K.length < y.g.h.length ? y = "" : (y = K.replace(new RegExp(p, "g"), c), y = y.replace(RegExp("9", "g"), " ")), 0 < y.length ? (l.v.g(y), l = !0) : l = !1, l) return d.da = o, d.ha = i0.test(g(r, 4)), d.$ = 0, !0;
9065
9293
  }
9066
9294
  return d.u = !1;
9067
9295
  }
9068
- function X1(d, t) {
9069
- for (var n = [], s = t.length - 3, o = d.j.length, l = 0; l < o; ++l) {
9070
- var a = d.j[l];
9071
- K(a, 3) == 0 ? n.push(d.j[l]) : (a = m(a, 3, Math.min(s, K(a, 3) - 1)), t.search(a) == 0 && n.push(d.j[l]));
9296
+ function o0(d, t) {
9297
+ for (var n = [], r = t.length - 3, o = d.j.length, l = 0; l < o; ++l) {
9298
+ var c = d.j[l];
9299
+ j(c, 3) == 0 ? n.push(d.j[l]) : (c = g(c, 3, Math.min(r, j(c, 3) - 1)), t.search(c) == 0 && n.push(d.j[l]));
9072
9300
  }
9073
9301
  d.j = n;
9074
9302
  }
9075
- function D0(d, t) {
9303
+ function K0(d, t) {
9076
9304
  d.s.g(t);
9077
9305
  var n = t;
9078
- if (D1.test(n) || d.s.h.length == 1 && y0.test(n) ? (t == "+" ? (n = t, d.ba.g(t)) : (n = g1[t], d.ba.g(n), d.g.g(n)), t = n) : (d.u = !1, d.la = !0), !d.u) {
9306
+ if (F1.test(n) || d.s.h.length == 1 && P0.test(n) ? (t == "+" ? (n = t, d.ba.g(t)) : (n = _1[t], d.ba.g(n), d.g.g(n)), t = n) : (d.u = !1, d.la = !0), !d.u) {
9079
9307
  if (!d.la) {
9080
- if ($0(d)) {
9081
- if (n0(d)) return Q1(d);
9082
- } else if (0 < d.o.length && (t = d.g.toString(), R(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), n = t.lastIndexOf(d.o), R(d.h), d.h.g(t.substring(0, n))), d.o != e0(d)) return d.h.g(" "), Q1(d);
9308
+ if (h0(d)) {
9309
+ if (f0(d)) return u0(d);
9310
+ } else if (0 < d.o.length && (t = d.g.toString(), H(d.g), d.g.g(d.o), d.g.g(t), t = d.h.toString(), n = t.lastIndexOf(d.o), H(d.h), d.h.g(t.substring(0, n))), d.o != c0(d)) return d.h.g(" "), u0(d);
9083
9311
  }
9084
9312
  return d.s.toString();
9085
9313
  }
@@ -9089,99 +9317,99 @@ const n2 = (f) => {
9089
9317
  case 2:
9090
9318
  return d.s.toString();
9091
9319
  case 3:
9092
- if ($0(d)) d.ea = !0;
9093
- else return d.o = e0(d), C1(d);
9320
+ if (h0(d)) d.ea = !0;
9321
+ else return d.o = c0(d), N1(d);
9094
9322
  default:
9095
- return d.ea ? (n0(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = i0(d, t), n = d0(d), 0 < n.length ? n : (X1(d, d.g.toString()), q1(d) ? t0(d) : d.u ? h1(d, t) : d.s.toString())) : C1(d);
9323
+ return d.ea ? (f0(d) && (d.ea = !1), d.h.toString() + d.g.toString()) : 0 < d.j.length ? (t = p0(d, t), n = l0(d), 0 < n.length ? n : (o0(d, d.g.toString()), r0(d) ? a0(d) : d.u ? C1(d, t) : d.s.toString())) : N1(d);
9096
9324
  }
9097
9325
  }
9098
- function Q1(d) {
9099
- return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, R(d.v), d.da = "", C1(d);
9326
+ function u0(d) {
9327
+ return d.u = !0, d.ea = !1, d.j = [], d.$ = 0, H(d.v), d.da = "", N1(d);
9100
9328
  }
9101
- function d0(d) {
9102
- for (var t = d.g.toString(), n = d.j.length, s = 0; s < n; ++s) {
9103
- var o = d.j[s], l = S(o, 1);
9104
- if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha = Y1.test(m(o, 4)), o = t.replace(new RegExp(l, "g"), m(o, 2)), o = h1(d, o), s1(o, m0) == d.ba)) return o;
9329
+ function l0(d) {
9330
+ for (var t = d.g.toString(), n = d.j.length, r = 0; r < n; ++r) {
9331
+ var o = d.j[r], l = S(o, 1);
9332
+ if (new RegExp("^(?:" + l + ")$").test(t) && (d.ha = i0.test(g(o, 4)), o = t.replace(new RegExp(l, "g"), g(o, 2)), o = C1(d, o), a1(o, D0) == d.ba)) return o;
9105
9333
  }
9106
9334
  return "";
9107
9335
  }
9108
- function h1(d, t) {
9336
+ function C1(d, t) {
9109
9337
  var n = d.h.h.length;
9110
9338
  return d.ha && 0 < n && d.h.toString().charAt(n - 1) != " " ? d.h + " " + t : d.h + t;
9111
9339
  }
9112
- function C1(d) {
9340
+ function N1(d) {
9113
9341
  var t = d.g.toString();
9114
9342
  if (3 <= t.length) {
9115
- for (var n = d.ca && d.o.length == 0 && 0 < K(d.l, 20) ? D(d.l, 20) : D(d.l, 19), s = n.length, o = 0; o < s; ++o) {
9343
+ for (var n = d.ca && d.o.length == 0 && 0 < j(d.l, 20) ? O(d.l, 20) : O(d.l, 19), r = n.length, o = 0; o < r; ++o) {
9116
9344
  var l = n[o];
9117
- 0 < d.o.length && G1(S(l, 4)) && !m(l, 6) && !B(l, 5) || (d.o.length != 0 || d.ca || G1(S(l, 4)) || m(l, 6)) && M0.test(S(l, 2)) && d.j.push(l);
9345
+ 0 < d.o.length && Z1(S(l, 4)) && !g(l, 6) && !G(l, 5) || (d.o.length != 0 || d.ca || Z1(S(l, 4)) || g(l, 6)) && V0.test(S(l, 2)) && d.j.push(l);
9118
9346
  }
9119
- return X1(d, t), t = d0(d), 0 < t.length ? t : q1(d) ? t0(d) : d.s.toString();
9347
+ return o0(d, t), t = l0(d), 0 < t.length ? t : r0(d) ? a0(d) : d.s.toString();
9120
9348
  }
9121
- return h1(d, t);
9349
+ return C1(d, t);
9122
9350
  }
9123
- function t0(d) {
9351
+ function a0(d) {
9124
9352
  var t = d.g.toString(), n = t.length;
9125
9353
  if (0 < n) {
9126
- for (var s = "", o = 0; o < n; o++) s = i0(d, t.charAt(o));
9127
- return d.u ? h1(d, s) : d.s.toString();
9354
+ for (var r = "", o = 0; o < n; o++) r = p0(d, t.charAt(o));
9355
+ return d.u ? C1(d, r) : d.s.toString();
9128
9356
  }
9129
9357
  return d.h.toString();
9130
9358
  }
9131
- function e0(d) {
9359
+ function c0(d) {
9132
9360
  var t = d.g.toString(), n = 0;
9133
- if (m(d.l, 10) != 1) var s = !1;
9134
- else s = d.g.toString(), s = s.charAt(0) == "1" && s.charAt(1) != "0" && s.charAt(1) != "1";
9135
- return s ? (n = 1, d.h.g("1").g(" "), d.ca = !0) : B(d.l, 15) && (s = new RegExp("^(?:" + m(d.l, 15) + ")"), s = t.match(s), s != null && s[0] != null && 0 < s[0].length && (d.ca = !0, n = s[0].length, d.h.g(t.substring(0, n)))), R(d.g), d.g.g(t.substring(n)), t.substring(0, n);
9361
+ if (g(d.l, 10) != 1) var r = !1;
9362
+ else r = d.g.toString(), r = r.charAt(0) == "1" && r.charAt(1) != "0" && r.charAt(1) != "1";
9363
+ return r ? (n = 1, d.h.g("1").g(" "), d.ca = !0) : G(d.l, 15) && (r = new RegExp("^(?:" + g(d.l, 15) + ")"), r = t.match(r), r != null && r[0] != null && 0 < r[0].length && (d.ca = !0, n = r[0].length, d.h.g(t.substring(0, n)))), H(d.g), d.g.g(t.substring(n)), t.substring(0, n);
9136
9364
  }
9137
- function $0(d) {
9138
- var t = d.ba.toString(), n = new RegExp("^(?:\\+|" + m(d.l, 11) + ")");
9139
- return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length, R(d.g), d.g.g(t.substring(n)), R(d.h), d.h.g(t.substring(0, n)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
9365
+ function h0(d) {
9366
+ var t = d.ba.toString(), n = new RegExp("^(?:\\+|" + g(d.l, 11) + ")");
9367
+ return n = t.match(n), n != null && n[0] != null && 0 < n[0].length ? (d.ca = !0, n = n[0].length, H(d.g), d.g.g(t.substring(n)), H(d.h), d.h.g(t.substring(0, n)), t.charAt(0) != "+" && d.h.g(" "), !0) : !1;
9140
9368
  }
9141
- function n0(d) {
9369
+ function f0(d) {
9142
9370
  if (d.g.h.length == 0) return !1;
9143
- var t = new A(), n = H1(d.g, t);
9144
- return n == 0 ? !1 : (R(d.g), d.g.g(t.toString()), t = e1(n), t == "001" ? d.l = H(d.ga, "" + n) : t != d.ka && (d.l = J1(d, t)), d.h.g("" + n).g(" "), d.o = "", !0);
9371
+ var t = new D(), n = d0(d.g, t);
9372
+ return n == 0 ? !1 : (H(d.g), d.g.g(t.toString()), t = s1(n), t == "001" ? d.l = z(d.ga, "" + n) : t != d.ka && (d.l = s0(d, t)), d.h.g("" + n).g(" "), d.o = "", !0);
9145
9373
  }
9146
- function i0(d, t) {
9374
+ function p0(d, t) {
9147
9375
  var n = d.v.toString();
9148
9376
  if (0 <= n.substring(d.$).search(d.fa)) {
9149
- var s = n.search(d.fa);
9150
- return t = n.replace(d.fa, t), R(d.v), d.v.g(t), d.$ = s, t.substring(0, d.$ + 1);
9377
+ var r = n.search(d.fa);
9378
+ return t = n.replace(d.fa, t), H(d.v), d.v.g(t), d.$ = r, t.substring(0, d.$ + 1);
9151
9379
  }
9152
9380
  return d.j.length == 1 && (d.u = !1), d.da = "", d.s.toString();
9153
9381
  }
9154
- const r0 = (d) => {
9382
+ const C0 = (d) => {
9155
9383
  const t = [];
9156
9384
  return d.includes("FIXED_LINE_OR_MOBILE") ? (d.includes("MOBILE") || t.push("MOBILE"), d.includes("FIXED_LINE") || t.push("FIXED_LINE")) : (d.includes("MOBILE") || d.includes("FIXED_LINE")) && t.push("FIXED_LINE_OR_MOBILE"), d.concat(t);
9157
- }, y1 = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
9385
+ }, S1 = { FIXED_LINE: 0, MOBILE: 1, FIXED_LINE_OR_MOBILE: 2, TOLL_FREE: 3, PREMIUM_RATE: 4, SHARED_COST: 5, VOIP: 6, PERSONAL_NUMBER: 7, PAGER: 8, UAN: 9, VOICEMAIL: 10, UNKNOWN: -1 };
9158
9386
  e("intlTelInputUtilsTemp", {}), e("intlTelInputUtilsTemp.formatNumberAsYouType", (d, t) => {
9159
9387
  try {
9160
- const n = d.replace(/[^+0-9]/g, ""), s = new T0(t);
9388
+ const n = d.replace(/[^+0-9]/g, ""), r = new W0(t);
9161
9389
  t = "";
9162
- for (let o = 0; o < n.length; o++) s.ja = D0(s, n.charAt(o)), t = s.ja;
9390
+ for (let o = 0; o < n.length; o++) r.ja = K0(r, n.charAt(o)), t = r.ja;
9163
9391
  return t;
9164
9392
  } catch {
9165
9393
  return d;
9166
9394
  }
9167
9395
  }), e("intlTelInputUtilsTemp.formatNumber", (d, t, n) => {
9168
9396
  try {
9169
- const o = M.g(), l = Z(o, d, t);
9170
- var s = a1(o, l, -1);
9171
- return s == 0 || s == 4 ? o.format(l, typeof n > "u" ? 0 : n) : d;
9397
+ const o = R.g(), l = X(o, d, t);
9398
+ var r = p1(o, l, -1);
9399
+ return r == 0 || r == 4 ? o.format(l, typeof n > "u" ? 0 : n) : d;
9172
9400
  } catch {
9173
9401
  return d;
9174
9402
  }
9175
- }), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, n, s) => {
9403
+ }), e("intlTelInputUtilsTemp.getExampleNumber", (d, t, n, r) => {
9176
9404
  try {
9177
- const _ = M.g();
9405
+ const y = R.g();
9178
9406
  d: {
9179
- var o = _;
9180
- if (o1(d)) {
9181
- var l = l1(H(o, d), n);
9407
+ var o = y;
9408
+ if (c1(d)) {
9409
+ var l = h1(z(o, d), n);
9182
9410
  try {
9183
- if (B(l, 6)) {
9184
- var a = m(l, 6), p = z1(o, a, d, !1);
9411
+ if (G(l, 6)) {
9412
+ var c = g(l, 6), p = $0(o, c, d, !1);
9185
9413
  break d;
9186
9414
  }
9187
9415
  } catch {
@@ -9189,37 +9417,37 @@ const n2 = (f) => {
9189
9417
  }
9190
9418
  p = null;
9191
9419
  }
9192
- return _.format(p, s ? 0 : t ? 2 : 1);
9420
+ return y.format(p, r ? 0 : t ? 2 : 1);
9193
9421
  } catch {
9194
9422
  return "";
9195
9423
  }
9196
9424
  }), e("intlTelInputUtilsTemp.getExtension", (d, t) => {
9197
9425
  try {
9198
- return m(Z(M.g(), d, t), 3);
9426
+ return g(X(R.g(), d, t), 3);
9199
9427
  } catch {
9200
9428
  return "";
9201
9429
  }
9202
9430
  }), e("intlTelInputUtilsTemp.getNumberType", (d, t) => {
9203
9431
  try {
9204
- const n = M.g(), s = Z(n, d, t);
9205
- return F1(n, s);
9432
+ const n = R.g(), r = X(n, d, t);
9433
+ return X1(n, r);
9206
9434
  } catch {
9207
9435
  return -99;
9208
9436
  }
9209
9437
  }), e("intlTelInputUtilsTemp.getValidationError", (d, t) => {
9210
9438
  if (!t) return 1;
9211
9439
  try {
9212
- const n = M.g(), s = Z(n, d, t);
9213
- return a1(n, s, -1);
9440
+ const n = R.g(), r = X(n, d, t);
9441
+ return p1(n, r, -1);
9214
9442
  } catch (n) {
9215
9443
  return n.message === "Invalid country calling code" ? 1 : 3 >= d.length || n.message === "Phone number too short after IDD" || n.message === "The string supplied is too short to be a phone number" ? 2 : n.message === "The string supplied is too long to be a phone number" ? 3 : -99;
9216
9444
  }
9217
9445
  }), e("intlTelInputUtilsTemp.isValidNumber", (d, t, n) => {
9218
9446
  try {
9219
- const s = M.g(), o = Z(s, d, t), l = E0(s, o);
9447
+ const r = R.g(), o = X(r, d, t), l = F0(r, o);
9220
9448
  if (n) {
9221
- const a = r0(n).map((p) => y1[p]);
9222
- return l && a.includes(F1(s, o));
9449
+ const c = C0(n).map((p) => S1[p]);
9450
+ return l && c.includes(X1(r, o));
9223
9451
  }
9224
9452
  return l;
9225
9453
  } catch {
@@ -9227,30 +9455,30 @@ const n2 = (f) => {
9227
9455
  }
9228
9456
  }), e("intlTelInputUtilsTemp.isPossibleNumber", (d, t, n) => {
9229
9457
  try {
9230
- const s = M.g(), o = Z(s, d, t);
9458
+ const r = R.g(), o = X(r, d, t);
9231
9459
  if (n) {
9232
- const l = r0(n);
9233
- for (let a of l) if (a1(s, o, y1[a]) === 0) return !0;
9460
+ const l = C0(n);
9461
+ for (let c of l) if (p1(r, o, S1[c]) === 0) return !0;
9234
9462
  return !1;
9235
9463
  }
9236
- return a1(s, o, -1) === 0;
9464
+ return p1(r, o, -1) === 0;
9237
9465
  } catch {
9238
9466
  return !1;
9239
9467
  }
9240
9468
  }), e("intlTelInputUtilsTemp.getCoreNumber", (d, t) => {
9241
9469
  try {
9242
- return m(Z(M.g(), d, t), 2).toString();
9470
+ return g(X(R.g(), d, t), 2).toString();
9243
9471
  } catch {
9244
9472
  return "";
9245
9473
  }
9246
- }), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", y1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
9474
+ }), e("intlTelInputUtilsTemp.numberFormat", { E164: 0, INTERNATIONAL: 1, NATIONAL: 2, RFC3966: 3 }), e("intlTelInputUtilsTemp.numberType", S1), e("intlTelInputUtilsTemp.validationError", { IS_POSSIBLE: 0, INVALID_COUNTRY_CODE: 1, TOO_SHORT: 2, TOO_LONG: 3, IS_POSSIBLE_LOCAL_ONLY: 4, INVALID_LENGTH: 5 });
9247
9475
  })();
9248
- const h0 = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : void 0, i2 = h0.intlTelInputUtilsTemp;
9249
- delete h0.intlTelInputUtilsTemp;
9250
- y.utils = i2;
9251
- const s2 = {
9476
+ const A0 = typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : void 0, A2 = A0.intlTelInputUtilsTemp;
9477
+ delete A0.intlTelInputUtilsTemp;
9478
+ m.utils = A2;
9479
+ const b2 = {
9252
9480
  __name: "IntlTelInputWithUtils",
9253
- props: /* @__PURE__ */ s0({
9481
+ props: /* @__PURE__ */ g0({
9254
9482
  disabled: {
9255
9483
  type: Boolean,
9256
9484
  default: !1
@@ -9274,47 +9502,47 @@ const s2 = {
9274
9502
  },
9275
9503
  modelModifiers: {}
9276
9504
  }),
9277
- emits: /* @__PURE__ */ s0([
9505
+ emits: /* @__PURE__ */ g0([
9278
9506
  "changeNumber",
9279
9507
  "changeCountry",
9280
9508
  "changeValidity",
9281
9509
  "changeErrorCode"
9282
9510
  ], ["update:modelValue"]),
9283
- setup(f, { expose: e, emit: $ }) {
9284
- const i = P0(f, "modelValue"), r = f, u = $, h = I1(), c = I1(), C = I1(!1), g = () => c.value ? r.options.strictMode ? c.value.isValidNumberPrecise() : c.value.isValidNumber() : null, I = () => {
9285
- let v = g();
9286
- C.value !== v && (C.value = v, u("changeValidity", !!v), u(
9511
+ setup(h, { expose: e, emit: $ }) {
9512
+ const i = j0(h, "modelValue"), s = h, a = $, u = A1(), f = A1(), C = A1(!1), I = () => f.value ? s.options.strictMode ? f.value.isValidNumberPrecise() : f.value.isValidNumber() : null, _ = () => {
9513
+ let N = I();
9514
+ C.value !== N && (C.value = N, a("changeValidity", !!N), a(
9287
9515
  "changeErrorCode",
9288
- v ? null : c.value.getValidationError()
9516
+ N ? null : f.value.getValidationError()
9289
9517
  ));
9290
- }, w = () => {
9291
- var v;
9292
- u("changeNumber", ((v = c.value) == null ? void 0 : v.getNumber()) ?? ""), I();
9293
- }, k = () => {
9294
- var v;
9295
- u("changeCountry", ((v = c.value) == null ? void 0 : v.getSelectedCountryData().iso2) ?? ""), w(), I();
9518
+ }, A = () => {
9519
+ var N;
9520
+ a("changeNumber", ((N = f.value) == null ? void 0 : N.getNumber()) ?? ""), _();
9521
+ }, v = () => {
9522
+ var N;
9523
+ a("changeCountry", ((N = f.value) == null ? void 0 : N.getSelectedCountryData().iso2) ?? ""), A(), _();
9296
9524
  };
9297
- return x0(() => {
9298
- h.value && (c.value = y(h.value, r.options), r.value && c.value.setNumber(r.value), r.disabled && c.value.setDisabled(r.disabled), C.value = g());
9299
- }), B0(
9300
- () => r.disabled,
9301
- (v) => {
9302
- var E;
9303
- return (E = c.value) == null ? void 0 : E.setDisabled(v);
9525
+ return Y0(() => {
9526
+ u.value && (f.value = m(u.value, s.options), s.value && f.value.setNumber(s.value), s.disabled && f.value.setDisabled(s.disabled), C.value = I());
9527
+ }), z0(
9528
+ () => s.disabled,
9529
+ (N) => {
9530
+ var T;
9531
+ return (T = f.value) == null ? void 0 : T.setDisabled(N);
9304
9532
  }
9305
- ), R0(() => {
9306
- var v;
9307
- return (v = c.value) == null ? void 0 : v.destroy();
9308
- }), e({ instance: c, input: h }), (v, E) => k0((G0(), O0("input", U0({
9533
+ ), Z0(() => {
9534
+ var N;
9535
+ return (N = f.value) == null ? void 0 : N.destroy();
9536
+ }), e({ instance: f, input: u }), (N, T) => J0((q0(), X0("input", Q0({
9309
9537
  ref_key: "input",
9310
- ref: h,
9311
- "onUpdate:modelValue": E[0] || (E[0] = (N) => i.value = N),
9538
+ ref: u,
9539
+ "onUpdate:modelValue": T[0] || (T[0] = (k) => i.value = k),
9312
9540
  type: "tel",
9313
- onCountrychange: k,
9314
- onInput: w
9315
- }, f.inputProps), null, 16)), [
9541
+ onCountrychange: v,
9542
+ onInput: A
9543
+ }, h.inputProps), null, 16)), [
9316
9544
  [
9317
- F0,
9545
+ d2,
9318
9546
  i.value,
9319
9547
  void 0,
9320
9548
  { lazy: !0 }
@@ -9323,5 +9551,5 @@ const s2 = {
9323
9551
  }
9324
9552
  };
9325
9553
  export {
9326
- s2 as default
9554
+ b2 as default
9327
9555
  };