intl-tel-input 28.0.1 → 28.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -56
- package/dist/js/data.js +2 -2
- package/dist/js/data.min.js +1 -1
- package/dist/js/data.mjs +1 -1
- package/dist/js/intlTelInput.js +7 -7
- package/dist/js/intlTelInput.min.js +2 -2
- package/dist/js/intlTelInput.mjs +6 -6
- package/dist/js/intlTelInputWithUtils.js +7 -7
- package/dist/js/intlTelInputWithUtils.min.js +2 -2
- package/dist/js/intlTelInputWithUtils.mjs +6 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,62 +1,11 @@
|
|
|
1
|
-
#
|
|
2
|
-
[](https://github.com/jackocnr/intl-tel-input/actions/workflows/ci.yml) <img src="https://img.shields.io/github/package-json/v/jackocnr/intl-tel-input.svg" alt="version"/> <img src="https://img.shields.io/npm/dm/intl-tel-input.svg" alt="downloads"/> [](https://badges.nerdydata.com/719de9d2-d0e7-4988-b02f-9f9d52687076/report)
|
|
1
|
+
# intlTelInput - Vanilla JavaScript library
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
The vanilla JavaScript library for [intl-tel-input](https://github.com/jackocnr/intl-tel-input). View the [source code](https://github.com/jackocnr/intl-tel-input/blob/master/packages/core/src/js/intlTelInput.ts).
|
|
5
4
|
|
|
6
|
-
[Explore docs »](https://intl-tel-input.com/docs/
|
|
5
|
+
[Explore docs »](https://intl-tel-input.com/docs/vanilla-javascript)
|
|
7
6
|
|
|
8
7
|
<picture>
|
|
9
8
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/iti-github-dark.png">
|
|
10
9
|
<source media="(prefers-color-scheme: light)" srcset="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/iti-github-light.png">
|
|
11
|
-
<img width="271" height="279" alt="
|
|
12
|
-
</picture>
|
|
13
|
-
|
|
14
|
-
## Sponsored by
|
|
15
|
-
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/twilio.webp" height="100" alt="Twilio"/>
|
|
16
|
-
|
|
17
|
-
Use [Twilio's API to build phone verification, SMS 2FA, appointment reminders, marketing notifications and so much more](https://www.twilio.com/blog/international-telephone-input-twilio?utm_source=github&utm_medium=referral&utm_campaign=intl_tel_input). We can't wait to see what you build.
|
|
18
|
-
|
|
19
|
-
## React, Vue, Angular and Svelte Components
|
|
20
|
-
We provide React, Vue, Angular and Svelte (beta) components alongside the regular JavaScript plugin. This readme is for the JavaScript plugin. View the [React Component](https://intl-tel-input.com/docs/react-component), the [Vue Component](https://intl-tel-input.com/docs/vue-component) the [Angular Component](https://intl-tel-input.com/docs/angular-component), or the [Svelte component](https://intl-tel-input.com/docs/svelte-component).
|
|
21
|
-
|
|
22
|
-
## Docs and Examples
|
|
23
|
-
We have a newly updated website, where you can find [a full set of docs](https://intl-tel-input.com/docs/integrations), a [live playground](https://intl-tel-input.com/playground/) where you can try out all of the options, as well as plenty of [examples](https://intl-tel-input.com/examples/validation-practical.html) of different setups.
|
|
24
|
-
|
|
25
|
-
## Features
|
|
26
|
-
|
|
27
|
-
🔍 **Fast country picking**
|
|
28
|
-
* Search by country name or dial code
|
|
29
|
-
* Full keyboard navigation
|
|
30
|
-
|
|
31
|
-
✨ **Smart defaults**
|
|
32
|
-
* Optionally auto-detect the user's country via IP lookup
|
|
33
|
-
* Example placeholders per country
|
|
34
|
-
|
|
35
|
-
📞 **Formatting & output**
|
|
36
|
-
* Formats the number as the user types
|
|
37
|
-
* Extract standard E.164 numbers to store
|
|
38
|
-
|
|
39
|
-
🛡️ **Validation**
|
|
40
|
-
* Validate numbers with specific error types
|
|
41
|
-
* Strict mode: only allow valid digits and enforce max length
|
|
42
|
-
|
|
43
|
-
🌍 **International & accessible**
|
|
44
|
-
* Translated into 40+ languages, with support for RTL and alternative numerals
|
|
45
|
-
* Screen reader-friendly ARIA markup
|
|
46
|
-
|
|
47
|
-
🎛️ **Customisable**
|
|
48
|
-
* Override CSS variables (e.g. dark mode)
|
|
49
|
-
* Optionally display the dial code next to the number
|
|
50
|
-
* Extensive initialisation options, methods, and events
|
|
51
|
-
|
|
52
|
-
## Contributing
|
|
53
|
-
See the [contributing guide](https://github.com/jackocnr/intl-tel-input/blob/master/.github/CONTRIBUTING.md) for instructions on setting up the project and making changes, and also on how to update the flag images, or how to add a new translation.
|
|
54
|
-
|
|
55
|
-
## Attributions
|
|
56
|
-
* Flag images from [flag-icons](https://github.com/lipis/flag-icons)
|
|
57
|
-
* Original country data from mledoze's [World countries in JSON, CSV and XML](https://github.com/mledoze/countries)
|
|
58
|
-
* Formatting/validation/example number code from [libphonenumber](https://github.com/googlei18n/libphonenumber)
|
|
59
|
-
|
|
60
|
-
User testing powered by [BrowserStack Open-Source Program](https://www.browserstack.com/open-source)
|
|
61
|
-
|
|
62
|
-
Browser testing via <a href="https://www.lambdatest.com/" target="_blank"><img src="https://raw.githubusercontent.com/jackocnr/intl-tel-input/refs/heads/master/screenshots/lambda_test.svg" style="vertical-align:middle;margin-left:5px" width="147" height="26" /></a>
|
|
10
|
+
<img width="271" height="279" alt="intl-tel-input screenshot showing country dropdown open" src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/iti-github-light.png">
|
|
11
|
+
</picture>
|
package/dist/js/data.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v28.0.
|
|
2
|
+
* International Telephone Input v28.0.2
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1770,7 +1770,7 @@ var _factory = (() => {
|
|
|
1770
1770
|
for (const c of rawCountryData) {
|
|
1771
1771
|
allCountries.push({
|
|
1772
1772
|
name: "",
|
|
1773
|
-
// populated in the
|
|
1773
|
+
// populated in the core library
|
|
1774
1774
|
iso2: c[0],
|
|
1775
1775
|
dialCode: c[1],
|
|
1776
1776
|
priority: c[2] || 0,
|
package/dist/js/data.min.js
CHANGED
package/dist/js/data.mjs
CHANGED
package/dist/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v28.0.
|
|
2
|
+
* International Telephone Input v28.0.2
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1773,7 +1773,7 @@ var _factory = (() => {
|
|
|
1773
1773
|
for (const c of rawCountryData) {
|
|
1774
1774
|
allCountries.push({
|
|
1775
1775
|
name: "",
|
|
1776
|
-
// populated in the
|
|
1776
|
+
// populated in the core library
|
|
1777
1777
|
iso2: c[0],
|
|
1778
1778
|
dialCode: c[1],
|
|
1779
1779
|
priority: c[2] || 0,
|
|
@@ -1993,7 +1993,7 @@ var _factory = (() => {
|
|
|
1993
1993
|
geoIpLookup: null,
|
|
1994
1994
|
//* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
|
|
1995
1995
|
hiddenInput: null,
|
|
1996
|
-
//* Internationalise the
|
|
1996
|
+
//* Internationalise the core library text e.g. search input placeholder, country names.
|
|
1997
1997
|
i18n: {},
|
|
1998
1998
|
//* Initial country.
|
|
1999
1999
|
initialCountry: "",
|
|
@@ -2482,7 +2482,7 @@ var _factory = (() => {
|
|
|
2482
2482
|
);
|
|
2483
2483
|
}
|
|
2484
2484
|
}
|
|
2485
|
-
//* Generate all of the markup for the
|
|
2485
|
+
//* Generate all of the markup for the core library: the selected country overlay, and the dropdown.
|
|
2486
2486
|
buildMarkup(countries, searchTokens) {
|
|
2487
2487
|
this.#countries = countries;
|
|
2488
2488
|
this.#searchTokens = searchTokens;
|
|
@@ -4409,7 +4409,7 @@ var _factory = (() => {
|
|
|
4409
4409
|
//********************
|
|
4410
4410
|
//* PUBLIC METHODS
|
|
4411
4411
|
//********************
|
|
4412
|
-
//* Remove
|
|
4412
|
+
//* Remove core library.
|
|
4413
4413
|
destroy() {
|
|
4414
4414
|
if (!this.#isActive) {
|
|
4415
4415
|
return;
|
|
@@ -4658,7 +4658,7 @@ var _factory = (() => {
|
|
|
4658
4658
|
documentReady: () => document.readyState === "complete",
|
|
4659
4659
|
//* Get the country data object.
|
|
4660
4660
|
getCountryData: () => data_default,
|
|
4661
|
-
//* A getter for the
|
|
4661
|
+
//* A getter for the core library instance.
|
|
4662
4662
|
getInstance: (input) => {
|
|
4663
4663
|
const id = input.dataset[DATA_KEYS.INSTANCE_ID];
|
|
4664
4664
|
return id ? intlTelInput.instances.get(id) ?? null : null;
|
|
@@ -4668,7 +4668,7 @@ var _factory = (() => {
|
|
|
4668
4668
|
attachUtils,
|
|
4669
4669
|
startedLoadingUtils: false,
|
|
4670
4670
|
startedLoadingAutoCountry: false,
|
|
4671
|
-
version: "28.0.
|
|
4671
|
+
version: "28.0.2",
|
|
4672
4672
|
NUMBER_FORMAT,
|
|
4673
4673
|
NUMBER_TYPE,
|
|
4674
4674
|
VALIDATION_ERROR
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v28.0.
|
|
2
|
+
* International Telephone Input v28.0.2
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
22
22
|
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
23
23
|
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
|
|
24
|
-
</svg>`;var It=n=>{let t=new Map;for(let e of n){let i=z(e.name),s=i.split(/[^a-z]/).map(o=>o[0]).join("");t.set(e.iso2,{normalisedName:i,initials:s,dialCodePlus:`+${e.dialCode}`})}return t},bt=(n,t,e)=>{let i=z(e),s=[],o=[],r=[],l=[],a=[],f=[];for(let d of n){let m=t.get(d.iso2);d.iso2===i?s.push(d):m.normalisedName.startsWith(i)?o.push(d):m.normalisedName.includes(i)?r.push(d):i===d.dialCode||i===m.dialCodePlus?l.push(d):m.dialCodePlus.includes(i)?a.push(d):m.initials.includes(i)&&f.push(d)}let E=(d,m)=>d.priority-m.priority;return[...s,...o,...r,...l.sort(E),...a.sort(E),...f]},Lt=(n,t,e)=>{let i=z(e);for(let s of n){let{normalisedName:o}=t.get(s.iso2);if(o.startsWith(i))return s}return null};var H=class n{#t;static toAscii(t){return t?t.replace(/[٠-٩]/g,e=>String.fromCharCode(48+(e.charCodeAt(0)-1632))).replace(/[۰-۹]/g,e=>String.fromCharCode(48+(e.charCodeAt(0)-1776))):""}constructor(t){t&&this.#i(t)}#i(t){/[٠-٩]/.test(t)?this.#t="arabic-indic":/[۰-۹]/.test(t)?this.#t="persian":this.#t="ascii"}denormalise(t){if(!this.#t||this.#t==="ascii")return t;let e=this.#t==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,i=>String.fromCharCode(e+Number(i)))}normalise(t){return t?(this.#i(t),this.#t==="ascii"?t:n.toAscii(t)):""}isAscii(){return!this.#t||this.#t==="ascii"}};var k=class n{#t;#i;#A;#C="";#b;#w;#D=null;#_;#E;#e;#c;#g;#o;#s;#m;#l;#u;#n;#a;#h;#T;#k;#r;#y=null;#p=null;#S=new Map;#O=null;telInputEl;hadInitialPlaceholder;constructor(t,e,i){t.dataset[T.INSTANCE_ID]=i.toString(),this.telInputEl=t,this.#t=e,this.#i=i,this.hadInitialPlaceholder=!!t.getAttribute("placeholder"),this.#A=!!this.telInputEl.closest("[dir=rtl]"),this.#C=this.telInputEl.style.paddingLeft}static validateInput(t){let e=t?.tagName;if(!(!!t&&typeof t=="object"&&e==="INPUT"&&typeof t.setAttribute=="function")){let s=Object.prototype.toString.call(t);throw new TypeError(`The first argument must be an HTMLInputElement, not ${s}`)}}buildMarkup(t,e){this.#b=t,this.#w=e,this.telInputEl.classList.add("iti__tel-input"),this.telInputEl.hasAttribute("type")||this.telInputEl.setAttribute("type","tel"),this.telInputEl.hasAttribute("autocomplete")||this.telInputEl.setAttribute("autocomplete","tel"),this.telInputEl.hasAttribute("inputmode")||this.telInputEl.setAttribute("inputmode","tel");let i=this.#U();this.#W(i),i.appendChild(this.telInputEl),this.#J(),this.#Q(i),this.ensureDropdownWidthSet()}#U(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:s}=this.#t,o=X({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!s,[i]:!!i}),r=p("div",{class:o});return this.#A&&r.setAttribute("dir","ltr"),this.telInputEl.before(r),r}#W(t){let{allowDropdown:e,separateDialCode:i,showFlags:s}=this.#t;if(!e&&!s&&!i)return;this.#E=p("div",{class:`iti__country-container ${c.V_HIDE}`},t),e?(this.#e=p("button",{type:"button",class:"iti__selected-country",[h.EXPANDED]:"false",[h.LABEL]:this.#t.i18n.noCountrySelected,[h.HASPOPUP]:"dialog",[h.CONTROLS]:`iti-${this.#i}__dropdown-content`},this.#E),this.telInputEl.disabled&&this.#e.setAttribute("disabled","true")):this.#e=p("div",{class:"iti__selected-country"},this.#E);let o=p("div",{class:"iti__selected-country-primary"},this.#e);this.#c=p("div",{class:c.FLAG},o),e&&(this.#o=p("div",{class:"iti__arrow",[h.HIDDEN]:"true"},o)),i&&(this.#g=p("div",{class:"iti__selected-dial-code"},this.#e)),e&&this.#X()}ensureDropdownWidthSet(){let{fixDropdownWidth:t,allowDropdown:e}=this.#t;if(!e||!t||this.#s.style.width)return;let i=this.telInputEl.offsetWidth;i>0&&(this.#s.style.width=`${i}px`)}#X(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:s,dropdownContainer:o,containerClass:r}=this.#t,l=t?"":"iti--flexible-dropdown-width";if(this.#s=p("div",{id:`iti-${this.#i}__dropdown-content`,class:`iti__dropdown-content ${c.HIDE} ${l}`,role:"dialog",[h.MODAL]:"true"}),this.#A&&this.#s.setAttribute("dir","rtl"),i&&this.#q(),this.#n=p("ul",{class:"iti__country-list",id:`iti-${this.#i}__country-listbox`,role:"listbox",[h.LABEL]:s.countryListAriaLabel},this.#s),this.#Z(),i&&this.#$(),e||(this.#_=this.#et(),i&&(this.#s.style.height=`${this.#_}px`)),o){let a=X({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[r]:!!r});this.#r=p("div",{class:a}),this.#r.appendChild(this.#s)}else this.#E.appendChild(this.#s)}#q(){let{i18n:t,searchInputClass:e}=this.#t,i=p("div",{class:"iti__search-input-wrapper"},this.#s);this.#m=p("span",{class:"iti__search-icon",[h.HIDDEN]:"true"},i),this.#m.innerHTML=yt(),this.#l=p("input",{id:`iti-${this.#i}__search-input`,type:"search",class:`iti__search-input ${e}`,placeholder:t.searchPlaceholder,role:"combobox",[h.EXPANDED]:"true",[h.LABEL]:t.searchPlaceholder,[h.CONTROLS]:`iti-${this.#i}__country-listbox`,[h.AUTOCOMPLETE]:"list",autocomplete:"off"},i),this.#u=p("button",{type:"button",class:`iti__search-clear ${c.HIDE}`,[h.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},i),this.#u.innerHTML=Ct(this.#i),this.#k=p("span",{class:"iti__a11y-text"},this.#s),this.#T=p("div",{class:`iti__no-results ${c.HIDE}`,[h.HIDDEN]:"true"},this.#s),this.#T.textContent=t.searchEmptyState??null}#J(){this.#E&&(this.#B(),this.#E.classList.remove(c.V_HIDE))}#Q(t){let{hiddenInput:e}=this.#t;if(!e)return;let i=this.telInputEl.getAttribute("name")||"",s=e(i);if(s.phone){let o=this.telInputEl.form?.querySelector(`input[name="${s.phone}"]`);o?this.#a=o:(this.#a=p("input",{type:"hidden",name:s.phone}),t.appendChild(this.#a))}if(s.country){let o=this.telInputEl.form?.querySelector(`input[name="${s.country}"]`);o?this.#h=o:(this.#h=p("input",{type:"hidden",name:s.country}),t.appendChild(this.#h))}}#Z(){let t=document.createDocumentFragment();for(let e=0;e<this.#b.length;e++){let i=this.#b[e],s=X({[c.COUNTRY_ITEM]:!0}),o=p("li",{id:`iti-${this.#i}__item-${i.iso2}`,class:s,tabindex:"-1",role:"option",[h.SELECTED]:"false"});o.dataset[T.DIAL_CODE]=i.dialCode,o.dataset[T.ISO2]=i.iso2,this.#S.set(i.iso2,o),this.#t.showFlags&&p("div",{class:`${c.FLAG} iti__${i.iso2}`},o);let r=p("span",{class:"iti__country-name"},o);r.textContent=`${i.name} `;let l=p("span",{class:"iti__dial-code"},r);this.#A&&l.setAttribute("dir","ltr"),l.textContent=`(+${i.dialCode})`,t.appendChild(o)}this.#n.appendChild(t)}#B(){if(this.#e){let t=this.#t.separateDialCode?L.FALLBACK_SELECTED_WITH_DIAL_WIDTH:L.FALLBACK_SELECTED_NO_DIAL_WIDTH,i=(this.#e.offsetWidth||this.#tt()||t)+L.INPUT_PADDING_EXTRA_LEFT;this.telInputEl.style.paddingLeft=`${i}px`}}static#F(){let t;try{t=window.top.document.body}catch{t=document.body}return t}#tt(){if(!this.telInputEl.parentNode)return 0;let t=n.#F(),e=this.telInputEl.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let i=this.#E.cloneNode();e.appendChild(i);let s=this.#e.cloneNode(!0);i.appendChild(s);let o=s.offsetWidth;return t.removeChild(e),o}#et(){let t=n.#F();this.#s.classList.remove(c.HIDE);let e=p("div",{class:"iti iti--inline-dropdown"});e.appendChild(this.#s),e.style.visibility="hidden",t.appendChild(e);let i=this.#s.offsetHeight;return t.removeChild(e),e.style.visibility="",this.#s.classList.add(c.HIDE),i>0?i:L.FALLBACK_DROPDOWN_HEIGHT}#$(){let{i18n:t}=this.#t,e=this.#n.childElementCount;this.#k.textContent=t.searchSummaryAria(e)}#j(t){let e;if(t==="")e=this.#b;else{let i=H.toAscii(t);e=bt(this.#b,this.#w,i)}this.#Y(e)}prefillSearchWithPlus(){this.#l.value="+",this.#l.focus(),this.#j("")}#P(){let t=this.#l.value.trim();this.#j(t),this.#l.value?this.#u.classList.remove(c.HIDE):this.#u.classList.add(c.HIDE)}#v(){this.#D&&clearTimeout(this.#D),this.#D=setTimeout(()=>{this.#P(),this.#D=null},tt.SEARCH_DEBOUNCE_MS)}#d(){this.#l.value="",this.#l.focus(),this.#P()}#R(t){let e=this.#n,i=e.getBoundingClientRect(),s=t.getBoundingClientRect(),o=s.top-i.top+e.scrollTop;s.top<i.top?e.scrollTop=o:s.bottom>i.bottom&&(e.scrollTop=o-i.height+s.height)}#f(t,e=!0){if(this.#p?.classList.remove(c.HIGHLIGHT),t){if(t.classList.add(c.HIGHLIGHT),this.#t.countrySearch){let i=t.getAttribute("id")||"";this.#l.setAttribute(h.ACTIVE_DESCENDANT,i)}e&&this.#R(t),this.#p=t}else this.#p=null}bindHiddenInputSubmitListener(t,e,i){let s=this.telInputEl.form;!s||!this.#a&&!this.#h||s.addEventListener("submit",()=>{this.#a&&(this.#a.value=e()),this.#h&&(this.#h.value=i())},{signal:t})}bindAllInitialDropdownListeners(t,e,i){let s=this.telInputEl.closest("label");s&&s.addEventListener("click",o=>{this.isDropdownOpen()?o.preventDefault():this.telInputEl.focus()},{signal:t}),this.#e.addEventListener("click",()=>{!this.isDropdownOpen()&&!this.telInputEl.disabled&&!this.telInputEl.readOnly&&e()},{signal:t}),this.#E.addEventListener("keydown",o=>{let r=[y.ARROW_UP,y.ARROW_DOWN,y.SPACE,y.ENTER];!this.isDropdownOpen()&&r.includes(o.key)&&(o.preventDefault(),o.stopPropagation(),e()),o.key===y.TAB&&i()},{signal:t})}openDropdown(t,e){let{countrySearch:i,dropdownAlwaysOpen:s,dropdownContainer:o}=this.#t;if(this.#O=new AbortController,this.ensureDropdownWidthSet(),o)this.#K();else{let l=this.#N(),a=this.telInputEl.offsetHeight+L.DROPDOWN_MARGIN;l?this.#s.style.top=`${a}px`:this.#s.style.bottom=`${a}px`}this.#s.classList.remove(c.HIDE),this.#e.setAttribute(h.EXPANDED,"true");let r=this.#y??this.#n.firstElementChild;r&&this.#f(r),i&&!s&&this.#l.focus(),this.#t.useFullscreenPopup&&this.#r&&window.visualViewport&&window.visualViewport.addEventListener("resize",()=>{this.#L(),this.#p&&this.#R(this.#p)},{signal:this.#O.signal}),this.#o.classList.add(c.ARROW_UP),this.#x(t,e)}#x(t,e){let i=this.#O.signal;this.#it(i),this.#V(i,t),this.#t.dropdownAlwaysOpen||this.#st(i,e),this.#I(i,t,e),this.#t.countrySearch&&this.#G(i),!this.#t.useFullscreenPopup&&this.#t.dropdownContainer&&window.addEventListener("scroll",e,{signal:i})}#it(t){this.#n.addEventListener("mouseover",e=>{let i=e.target?.closest(`.${c.COUNTRY_ITEM}`);i&&this.#f(i,!1)},{signal:t})}#V(t,e){this.#n.addEventListener("click",i=>{let s=i.target?.closest(`.${c.COUNTRY_ITEM}`);s&&e(s)},{signal:t})}#st(t,e){setTimeout(()=>{document.documentElement.addEventListener("click",i=>{this.#s.contains(i.target)||e()},{signal:t})},0)}#I(t,e,i){let s="",o=null,r=l=>{[y.ARROW_UP,y.ARROW_DOWN,y.ENTER,y.ESC].includes(l.key)&&(l.preventDefault(),l.stopPropagation(),l.key===y.ARROW_UP||l.key===y.ARROW_DOWN?this.#nt(l.key):l.key===y.ENTER&&!l.isComposing?e(this.#p):l.key===y.ESC&&(i(),this.#e.focus())),!this.#t.countrySearch&&l.target!==this.telInputEl&&A.HIDDEN_SEARCH_CHAR.test(l.key)&&(l.stopPropagation(),o&&clearTimeout(o),s+=l.key.toLowerCase(),this.#H(s),o=setTimeout(()=>{s=""},tt.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",r,{signal:t})}#G(t){this.#l.addEventListener("input",()=>this.#v(),{signal:t}),this.#u.addEventListener("click",()=>this.#d(),{signal:t})}#H(t){let e=Lt(this.#b,this.#w,t);if(e){let i=this.#S.get(e.iso2);this.#f(i)}}#nt(t){let e=t===y.ARROW_UP?this.#p?.previousElementSibling:this.#p?.nextElementSibling;!e&&this.#n.childElementCount>1&&(e=t===y.ARROW_UP?this.#n.lastElementChild:this.#n.firstElementChild),e&&this.#f(e)}#M(t){if(this.#y&&this.#y.dataset[T.ISO2]!==t&&(this.#y.setAttribute(h.SELECTED,"false"),this.#y.querySelector(".iti__country-check")?.remove(),this.#y=null),t&&!this.#y){let e=this.#n.querySelector(`[data-iso2="${t}"]`);if(e){e.setAttribute(h.SELECTED,"true");let i=p("span",{class:"iti__country-check",[h.HIDDEN]:"true"},e);i.innerHTML=gt(),this.#y=e,this.#t.dropdownAlwaysOpen&&this.#f(e)}}}#Y(t){this.#n.replaceChildren();let e=!0;for(let i of t){let s=this.#S.get(i.iso2);s&&(this.#n.appendChild(s),e&&(this.#f(s,!1),e=!1))}e?(this.#f(null),this.#T&&this.#T.classList.remove(c.HIDE)):this.#T&&this.#T.classList.add(c.HIDE),this.#n.scrollTop=0,this.#$()}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.#t;this.#O.abort(),this.#O=null,this.#s.classList.add(c.HIDE),this.#e.setAttribute(h.EXPANDED,"false"),t&&(this.#l.removeAttribute(h.ACTIVE_DESCENDANT),this.#l.value="",this.#P(),this.#p&&(this.#p.classList.remove(c.HIGHLIGHT),this.#p=null)),this.#o.classList.remove(c.ARROW_UP),e?(this.#r.remove(),this.#r.style.top="",this.#r.style.bottom="",this.#r.style.paddingLeft="",this.#r.style.paddingRight=""):(this.#s.style.top="",this.#s.style.bottom="")}#N(){if(this.#t.dropdownAlwaysOpen)return!0;let t=this.telInputEl.getBoundingClientRect(),e=t.top,i=window.innerHeight-t.bottom;return i>=this.#_||i>=e}#K(){let{dropdownContainer:t,useFullscreenPopup:e}=this.#t;if(e){if(window.innerWidth>=L.NARROW_VIEWPORT_WIDTH){let i=this.telInputEl.getBoundingClientRect();this.#r.style.paddingLeft=`${i.left}px`,this.#r.style.paddingRight=`${window.innerWidth-i.right}px`}}else{let i=this.telInputEl.getBoundingClientRect();this.#r.style.left=`${i.left}px`,this.#N()?this.#r.style.top=`${i.bottom+L.DROPDOWN_MARGIN}px`:(this.#r.style.top="unset",this.#r.style.bottom=`${window.innerHeight-i.top+L.DROPDOWN_MARGIN}px`)}t.appendChild(this.#r)}#L(){let t=window.visualViewport;if(!t||!this.#r)return;let e=window.innerHeight-t.height;this.#r.style.bottom=`${e}px`}isDropdownOpen(){return!this.#s.classList.contains(c.HIDE)}setLoading(t){this.#c.classList.toggle(c.LOADING,t)}isLoading(){return this.#c.classList.contains(c.LOADING)}setDisabled(t){this.telInputEl.disabled=t,this.#e&&(t?this.#e.setAttribute("disabled","true"):this.#e.removeAttribute("disabled"))}setReadonly(t){this.telInputEl.readOnly=t,this.#e&&(t?this.#e.setAttribute("disabled","true"):this.#e.removeAttribute("disabled"))}setCountry(t){let{allowDropdown:e,showFlags:i,separateDialCode:s,i18n:o}=this.#t,r=t?.name,l=t?.dialCode,a=t?.iso2??"";if(e&&this.#M(a),this.#e){let f=a&&i?`${c.FLAG} iti__${a}`:`${c.FLAG} ${c.GLOBE}`,E,d,m;a?(d=r,E=o.selectedCountryAriaLabel.replace("${countryName}",r).replace("${dialCode}",`+${l}`),m=i?"":nt()):(d=o.noCountrySelected,E=o.noCountrySelected,m=nt()),this.#c.className=f,this.#e.setAttribute("title",d),this.#e.setAttribute(h.LABEL,E),this.#c.innerHTML=m}if(s){let f=l?`+${l}`:"";this.#g.textContent=f,this.#B()}}destroy(){this.telInputEl.iti=void 0,delete this.telInputEl.dataset[T.INSTANCE_ID],this.telInputEl.style.paddingLeft=this.#C;let t=this.telInputEl.parentNode;t&&(t.before(this.telInputEl),t.remove()),this.#S.clear()}};var At=n=>{let{onlyCountries:t,excludeCountries:e}=n;return t?.length?R.filter(i=>t.includes(i.iso2)):e?.length?R.filter(i=>!e.includes(i.iso2)):[...R]},Tt=(n,t)=>{let{countryNameLocale:e,countryNameOverrides:i}=t,s;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?s=new Intl.DisplayNames(e,{type:"region"}):s=null}catch(o){console.error(o),s=null}for(let o of n)o.name=i[o.iso2]||s?.of(o.iso2.toUpperCase())||""},vt=n=>{let t=new Set,e=0,i={},s=(r,l)=>{if(!r||!l)return;l.length>e&&(e=l.length),Object.hasOwn(i,l)||(i[l]=[]);let a=i[l];a.includes(r)||a.push(r)},o=[...n].sort((r,l)=>r.priority-l.priority);for(let r of o){t.has(r.dialCode)||t.add(r.dialCode);for(let l=1;l<r.dialCode.length;l++){let a=r.dialCode.substring(0,l);s(r.iso2,a)}if(s(r.iso2,r.dialCode),r.areaCodes){let l=i[r.dialCode][0];for(let a of r.areaCodes){for(let f=1;f<a.length;f++){let E=a.substring(0,f),d=r.dialCode+E;s(l,d),s(r.iso2,d)}s(r.iso2,r.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLength:e,dialCodeToIso2Map:i}},Nt=(n,t)=>{let{countryOrder:e}=t;n.sort((i,s)=>{if(e){let o=e.indexOf(i.iso2),r=e.indexOf(s.iso2),l=o>-1,a=r>-1;if(l||a)return l&&a?o-r:l?-1:1}return i.name.localeCompare(s.name)})};var Vt=new Set(["800","808","870","881","882","883","888","979"]),ot=n=>{let t=N(n).slice(0,3);return n.startsWith("+")&&Vt.has(t)};var rt=(n,t,e,i)=>{if(!e||!t)return n;let s=`+${i.dialCode}`,o=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;return n.substring(o)},wt=(n,t,e,i,s)=>{let o=e?e.formatNumberAsYouType(n,i?.iso2):n,r=i?.dialCode;return s&&t.charAt(0)!=="+"&&o.includes(`+${r}`)?(o.split(`+${r}`)[1]||"").trim():o};var Dt=(n,t,e,i)=>{if(e===0&&!i)return 0;let s=0;for(let o=0;o<t.length;o++){if(/[+0-9]/.test(t[o])&&s++,s===n&&!i)return o+1;if(i&&s===n+1)return o}return t.length};var Gt=new Set(["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"]),lt=n=>{let t=N(n);if(t.startsWith(j.NANP)&&t.length>=4){let e=t.substring(1,4);return Gt.has(e)}return!1};var Yt=0,U=n=>{if(!u.utils)throw new Error(`intlTelInput.utils is required for ${n}(). See: https://intl-tel-input.com/docs/utils`)},Ot=()=>{let n,t;return{promise:new Promise((i,s)=>{n=i,t=s}),resolve:n,reject:t}},W=class n{id;promise;#t;#i;#A;#C;#b;#w;#D;#_;#E;#e=null;#c=null;#g;#o=!0;#s;#m;#l=!1;#u;#n;constructor(t,e={}){this.id=Yt++,k.validateInput(t);let i=ft(e);this.#i={...K,...i},mt(this.#i),Et(this.#i),this.#t=new k(t,this.#i,this.id),this.#A=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),this.#m=new H(t.value),this.promise=this.#T(this.#i),this.#C=At(this.#i);let{dialCodes:s,dialCodeMaxLength:o,dialCodeToIso2Map:r}=vt(this.#C);this.#D=s,this.#b=o,this.#w=r,this.#_=new Map(this.#C.map(l=>[l.iso2,l])),this.#k()}#a(){let t=this.#t.telInputEl.value.trim();return this.#m.normalise(t)}#h(t){this.#t.telInputEl.value=this.#m.denormalise(t)}#T(t){let{initialCountry:e,geoIpLookup:i,loadUtils:s}=t,o=e===F.AUTO&&!!i,r=!!s&&!u.utils;return o&&(this.#u=Ot()),r&&(this.#n=Ot()),Promise.all([this.#u?.promise,this.#n?.promise]).then(()=>{})}#k(){this.#s=new AbortController,this.#r(),this.#t.buildMarkup(this.#C,this.#E),this.#y(),this.#p(),this.#S(),this.#i.dropdownAlwaysOpen&&this.#R()}#r(){Tt(this.#C,this.#i),Nt(this.#C,this.#i),this.#E=It(this.#C)}#y(t=!1){let e=this.#t.telInputEl.getAttribute("value"),i=this.#m.normalise(e??""),s=this.#a(),r=i&&i.startsWith("+")&&(!s||!s.startsWith("+"))?i:s,l=this.#N(r),a=lt(r),{initialCountry:f,geoIpLookup:E}=this.#i,d=f===F.AUTO&&E,m=d&&u.autoCountry?u.autoCountry:f,v=d&&!t&&!u.autoCountry,b=D(m);l?a?b?this.#I(m):v||this.#I(at.ISO2):(b&&this.#I(m),this.#x(r)):b?this.#I(m):v||this.#I(""),r&&this.#f(r)}#p(){this.#X(),this.#i.allowDropdown&&this.#t.bindAllInitialDropdownListeners(this.#s.signal,()=>this.#R(),()=>this.#M()),this.#t.bindHiddenInputSubmitListener(this.#s.signal,()=>this.getNumber(),()=>this.#e?.iso2||"")}#S(){if(this.#n){let{loadUtils:t}=this.#i,e=()=>{u.attachUtils(t).catch(()=>{})};u.documentReady()?e():window.addEventListener("load",e,{signal:this.#s.signal})}this.#u&&(this.#e?this.#u.resolve():this.#O())}async#O(){if(u.autoCountry){this.#rt();return}if(this.#t.setLoading(!0),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.#i.geoIpLookup=="function"))try{let t=await this.#i.geoIpLookup(),e=typeof t=="string"?t.toLowerCase():"";if(!D(e)){n.forEachInstance("handleAutoCountryFailure");return}u.autoCountry=e,setTimeout(()=>n.forEachInstance("handleAutoCountryLoaded"))}catch{n.forEachInstance("handleAutoCountryFailure")}}#U(){this.#R(),this.#t.prefillSearchWithPlus()}#W(t){let e=this.#t.telInputEl.selectionStart||0,i=t.substring(0,e-1),s=t.substring(e);return this.#h(i+s),e-1}#X(){this.#B(),this.#tt(),this.#$()}#q(t){this.#W(t),this.#U()}#J(t,e){let i=this.#W(t);this.#t.telInputEl.setSelectionRange(i,i),this.#v(),this.#d(I.STRICT_REJECT,{source:"key",rejectedInput:e,reason:"invalid"})}#Q(t,e){let i=this.#t.telInputEl.selectionStart||0,o=t.substring(0,i).replace(A.NON_PLUS_NUMERIC_GLOBAL,"").length,r=this.#L(),l=wt(r,t,u.utils,this.#e,this.#i.separateDialCode),a=Dt(o,l,i,e);this.#h(l),this.#t.telInputEl.setSelectionRange(a,a)}#Z(t){if(t.startsWith("+")&&this.#e&&this.#N(t)){let e=rt(t,!0,!0,this.#e);this.#h(e)}}#B(){this.#l=A.ALPHA_UNICODE.test(this.#a()),this.#t.telInputEl.addEventListener("input",this.#F,{signal:this.#s.signal})}#F=t=>{let{strictMode:e,formatAsYouType:i,separateDialCode:s,allowDropdown:o,countrySearch:r}=this.#i,l=t?.detail;if(l?.isCountryChange)return;let a=this.#a();if(this.#A&&t?.data==="+"&&s&&o&&r){this.#q(a);return}if(this.#A&&e&&(t?.data===" "||t?.data==="-"||t?.data===".")){this.#J(a,t.data);return}this.#x(a)&&this.#z();let f=t?.data&&A.NON_PLUS_NUMERIC.test(t.data),E=t?.inputType===Z.PASTE&&a;f||E&&!e?this.#l=!0:A.NON_PLUS_NUMERIC.test(a)||(this.#l=!1),i&&!this.#l&&!l?.isSetNumber&&this.#m.isAscii()&&this.#Q(a,t?.inputType===Z.DELETE_FORWARD),s&&this.#Z(a)};#tt(){let{strictMode:t,separateDialCode:e}=this.#i;!t&&!e||this.#t.telInputEl.addEventListener("keydown",this.#et,{signal:this.#s.signal})}#et=t=>{let{strictMode:e,separateDialCode:i,allowDropdown:s,countrySearch:o}=this.#i;if(!t.key||t.key.length!==1||t.altKey||t.ctrlKey||t.metaKey)return;if(i&&s&&o&&t.key==="+"){t.preventDefault(),this.#U();return}if(!e)return;let r=this.#a(),a=!r.startsWith("+")&&this.#t.telInputEl.selectionStart===0&&t.key==="+",f=this.#m.normalise(t.key),E=/^[0-9]$/.test(f),d=i?E:a||E,m=this.#t.telInputEl,v=m.selectionStart,b=m.selectionEnd,$=r.slice(0,v??void 0),O=r.slice(b??void 0),g=$+f+O,_=this.#K(g),B=!1;u.utils&&this.#c&&(B=u.utils.getCoreNumber(_,this.#e?.iso2).length>this.#c);let q=this.#V(_)!==null;(!d||B&&!q&&!a)&&(this.#v(),this.#d(I.STRICT_REJECT,{source:"key",rejectedInput:t.key,reason:d?"max-length":"invalid"}),t.preventDefault())};#$(){this.#i.strictMode&&this.#t.telInputEl.addEventListener("paste",this.#j,{signal:this.#s.signal})}#j=t=>{t.preventDefault();let e=this.#t.telInputEl,i=e.selectionStart,s=e.selectionEnd,o=this.#a(),r=o.slice(0,i??void 0),l=o.slice(s??void 0),a=this.#e?.iso2,f=t.clipboardData.getData("text"),E=this.#m.normalise(f),d=i===0&&s>0,m=!o.startsWith("+")||d,v=E.replace(A.NON_PLUS_NUMERIC_GLOBAL,""),b=v.startsWith("+"),$=v.replace(/\+/g,""),O=b&&m?`+${$}`:$,g=r+O+l,_=O!==E?"invalid":null;if(g.length>30){this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:"max-length"});return}if(g.length>5&&u.utils){let S=u.utils.getCoreNumber(g,a);for(;S.length===0&&g.length>0;)g=g.slice(0,-1),S=u.utils.getCoreNumber(g,a);if(!S){this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:"max-length"});return}if(this.#c&&S.length>this.#c)if(e.selectionEnd===o.length){let q=S.length-this.#c;g=g.slice(0,g.length-q),_="max-length"}else{this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:"max-length"});return}}this.#h(g);let B=i+O.length;e.setSelectionRange(B,B),e.dispatchEvent(new InputEvent("input",{bubbles:!0})),_&&(E.length>0&&O.length===0&&this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:_}))};#P(t){let e=Number(this.#t.telInputEl.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}#v(){if(!this.#i.strictRejectAnimation)return;let t=this.#t.telInputEl.parentElement;t&&(t.classList.remove("iti__strict-reject-animation"),t.offsetWidth,t.classList.add("iti__strict-reject-animation"))}#d(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.#t.telInputEl.dispatchEvent(i)}#R(){this.#t.openDropdown(t=>this.#nt(t),()=>this.#M()),this.#d(I.OPEN_COUNTRY_DROPDOWN)}#f(t){let{formatOnDisplay:e,nationalMode:i,separateDialCode:s}=this.#i,o=t;if(e&&u.utils&&this.#e){let r=ot(t),a=i&&!r||!o.startsWith("+")&&!s?x.NATIONAL:x.INTERNATIONAL;o=u.utils.formatNumber(o,this.#e?.iso2,a)}o=this.#ot(o),this.#h(o)}#x(t){let e=this.#V(t);return e!==null?this.#I(e):!1}#it(t){let e=this.#e?.dialCode,i=this.#e?.nationalPrefix;if(t.startsWith("+")||!e)return t;let r=i&&t.startsWith(i)&&!this.#i.separateDialCode?t.substring(1):t;return`+${e}${r}`}#V(t){let e=t.indexOf("+"),i=e>0?t.substring(e):t,s=this.#e?.iso2;i=this.#it(i);let o=this.#N(i,!0),r=N(i);if(o){let l=N(o),a=this.#w[l];return a.length===1?a[0]===s?null:a[0]:this.#st(a,l,r)}else if(i.startsWith("+")&&r.length){let l=this.#e?.dialCode||"";return l&&l.startsWith(r)?null:""}else if((!i||i==="+")&&!s&&this.#g)return this.#g;return null}#st(t,e,i){let s=this.#e?.iso2,o=this.#e?.dialCode;if(!s&&this.#g&&t.includes(this.#g))return this.#g;if(o===j.NANP&<(i))return null;let l=this.#e?.areaCodes,a=this.#e?.priority;if(l){let v=l.map(b=>`${o}${b}`);for(let b of v)if(i.startsWith(b))return null}let E=l&&!(a===0)&&i.length>e.length,d=s&&t.includes(s)&&!E,m=s===t[0];return!d&&!m?t[0]:null}#I(t){let e=this.#e?.iso2||"";return this.#e=t?this.#_.get(t):null,this.#e&&(this.#g=this.#e.iso2),this.#t.setCountry(this.#e),this.#H(),this.#G(),e!==t}#G(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.#i;if(!t||!u.utils)return;let s=this.#e?.iso2;if(!s){this.#c=null;return}let o=u.utils.getExampleNumber(s,!1,e,!0),r=o;for(;u.utils.isPossibleNumber(o,s,i);)r=o,o+="0";let l=u.utils.getCoreNumber(r,s);this.#c=l.length,s==="by"&&(this.#c=l.length+1)}#H(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:s}=this.#i,o=t===M.AGGRESSIVE||!this.#t.hadInitialPlaceholder&&t===M.POLITE;if(!u.utils||!o)return;let r=this.#e?u.utils.getExampleNumber(this.#e.iso2,i,e):"";r=this.#ot(r),typeof s=="function"&&(r=s(r,this.#e)),this.#t.telInputEl.setAttribute("placeholder",r)}#nt(t){if(!t)return;let e=t.dataset[T.ISO2],i=this.#I(e);this.#M();let s=t.dataset[T.DIAL_CODE];if(this.#Y(s),this.#i.formatOnDisplay){let o=this.#a();this.#f(o)}this.#t.telInputEl.focus(),i&&(this.#z(),this.#d(I.INPUT,{isCountryChange:!0}))}#M(t){!this.#t.isDropdownOpen()||this.#i.dropdownAlwaysOpen&&!t||(this.#t.closeDropdown(),this.#d(I.CLOSE_COUNTRY_DROPDOWN))}#Y(t){let e=this.#a();if(!e.startsWith("+"))return;let i=`+${t}`,s=this.#N(e),o;s?o=e.replace(s,i):o=i,this.#h(o)}#N(t,e){if(!t.startsWith("+"))return"";let i="",s="",o=!1;for(let r=0;r<t.length;r++){let l=t.charAt(r);if(!/[0-9]/.test(l))continue;if(s+=l,!!!this.#w[s])break;if(this.#D.has(s)){if(i=t.substring(0,r+1),o=!0,!e)break}else e&&o&&(i=t.substring(0,r+1));if(s.length===this.#b)break}return i}#K(t){let e=this.#e?.dialCode,i=N(t);return(this.#i.separateDialCode&&!t.startsWith("+")&&e&&i?`+${e}`:"")+t}#L(){let t=this.#a();return this.#K(t)}#ot(t){let e=!!this.#N(t),i=rt(t,e,this.#i.separateDialCode,this.#e);return this.#P(i)}#z(){this.#d(I.COUNTRY_CHANGE,this.#e??null)}#rt(){if(!(!this.#u||!u.autoCountry)){if(!this.#o){this.#u.resolve();return}this.#t.isLoading()?this.setCountry(u.autoCountry):this.#g=u.autoCountry,this.#t.setLoading(!1),this.#u.resolve()}}#at(){if(!this.#o){this.#u?.reject();return}this.#y(!0),this.#t.setLoading(!1),this.#u?.reject()}#ut(){if(!this.#o){this.#n?.resolve();return}if(!u.utils){this.#n?.resolve();return}let t=this.#a();t&&this.#f(t),this.#e&&(this.#H(),this.#G()),this.#n?.resolve()}#ct(t){if(!this.#o){this.#n?.reject(t);return}this.#n?.reject(t)}destroy(){this.#o&&(this.#o=!1,this.#i.allowDropdown&&this.#M(!0),this.#s.abort(),this.#t.destroy(),u.instances.delete(String(this.id)))}isActive(){return this.#o}getExtension(){return this.#o?(U("getExtension"),u.utils.getExtension(this.#L(),this.#e?.iso2)):""}getNumber(t){if(!this.#o)return"";U("getNumber");let e=this.#e?.iso2,i=this.#L(),s=u.utils.formatNumber(i,e,t);return this.#m.denormalise(s)}getNumberType(){return this.#o?(U("getNumberType"),u.utils.getNumberType(this.#L(),this.#e?.iso2)):null}getSelectedCountryData(){return this.#e??null}getValidationError(){if(!this.#o)return null;U("getValidationError");let t=this.#e?.iso2;return u.utils.getValidationError(this.#L(),t)}isValidNumber(){if(!this.#o)return null;U("isValidNumber");let t=this.#e?.dialCode,e=this.#e?.iso2,i=this.#L(),s=u.utils.getCoreNumber(i,e);if(s){if(t===V.DIAL_CODE&&s[0]===V.MOBILE_PREFIX&&s.length!==V.MOBILE_CORE_LENGTH)return!1;if(!A.ALPHA_UNICODE.test(i)&&t){let r=i.startsWith("+")?i.slice(1+t.length):i,l=N(r).length;if(s.length>l)return!1}}return this.#lt("possible")}isValidNumberPrecise(){return this.#o?(U("isValidNumberPrecise"),this.#lt("precise")):null}#lt(t){let{allowNumberExtensions:e,allowPhonewords:i,allowedNumberTypes:s}=this.#i,o=this.#e?.iso2,r=this.#L();return!this.#e&&!ot(r)||!(t==="precise"?u.utils.isValidNumber:u.utils.isPossibleNumber)(r,o,s)?!1:A.ALPHA_UNICODE.test(r)?!!u.utils.getExtension(r,o)?e:i:!0}setCountry(t){if(!this.#o)return;let e=t?.toLowerCase();if(!D(e))throw new Error(`Invalid iso2 code: '${e}'`);let i=this.#e?.iso2;if(t&&e!==i||!t&&i){if(this.#I(e),this.#Y(this.#e?.dialCode||""),this.#i.formatOnDisplay){let o=this.#a();this.#f(o)}this.#z(),this.#d(I.INPUT,{isCountryChange:!0})}}setNumber(t){if(!this.#o)return;let e=this.#m.normalise(t),i=this.#x(e);this.#f(e),i&&this.#z(),this.#d(I.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.#o&&(this.#i.placeholderNumberType=t,this.#H())}setDisabled(t){this.#o&&this.#t.setDisabled(t)}setReadonly(t){this.#o&&this.#t.setReadonly(t)}static forEachInstance(t,...e){let i=[...u.instances.values()],s=e[0];i.forEach(o=>{if(o instanceof n)switch(t){case"handleUtilsLoaded":o.#ut();break;case"handleUtilsFailure":o.#ct(s);break;case"handleAutoCountryLoaded":o.#rt();break;case"handleAutoCountryFailure":o.#at();break}})}},Kt=async n=>{if(u.utils||u.startedLoadingUtils)return null;if(typeof n!="function")throw new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utils module, not ${typeof n}`);u.startedLoadingUtils=!0;try{let e=(await n())?.default;if(!e||typeof e!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return u.utils=e,W.forEachInstance("handleUtilsLoaded"),!0}catch(t){throw W.forEachInstance("handleUtilsFailure",t),t}},u=Object.assign((n,t)=>{let e=new W(n,t);return u.instances.set(String(e.id),e),n.iti=e,e},{defaults:K,documentReady:()=>document.readyState==="complete",getCountryData:()=>R,getInstance:n=>{let t=n.dataset[T.INSTANCE_ID];return t?u.instances.get(t)??null:null},instances:new Map,attachUtils:Kt,startedLoadingUtils:!1,startedLoadingAutoCountry:!1,version:"28.0.1",NUMBER_FORMAT:x,NUMBER_TYPE:w,VALIDATION_ERROR:G}),zt=u;return xt(Xt);})();
|
|
24
|
+
</svg>`;var It=n=>{let t=new Map;for(let e of n){let i=z(e.name),s=i.split(/[^a-z]/).map(o=>o[0]).join("");t.set(e.iso2,{normalisedName:i,initials:s,dialCodePlus:`+${e.dialCode}`})}return t},bt=(n,t,e)=>{let i=z(e),s=[],o=[],r=[],l=[],a=[],f=[];for(let d of n){let m=t.get(d.iso2);d.iso2===i?s.push(d):m.normalisedName.startsWith(i)?o.push(d):m.normalisedName.includes(i)?r.push(d):i===d.dialCode||i===m.dialCodePlus?l.push(d):m.dialCodePlus.includes(i)?a.push(d):m.initials.includes(i)&&f.push(d)}let E=(d,m)=>d.priority-m.priority;return[...s,...o,...r,...l.sort(E),...a.sort(E),...f]},Lt=(n,t,e)=>{let i=z(e);for(let s of n){let{normalisedName:o}=t.get(s.iso2);if(o.startsWith(i))return s}return null};var H=class n{#t;static toAscii(t){return t?t.replace(/[٠-٩]/g,e=>String.fromCharCode(48+(e.charCodeAt(0)-1632))).replace(/[۰-۹]/g,e=>String.fromCharCode(48+(e.charCodeAt(0)-1776))):""}constructor(t){t&&this.#i(t)}#i(t){/[٠-٩]/.test(t)?this.#t="arabic-indic":/[۰-۹]/.test(t)?this.#t="persian":this.#t="ascii"}denormalise(t){if(!this.#t||this.#t==="ascii")return t;let e=this.#t==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,i=>String.fromCharCode(e+Number(i)))}normalise(t){return t?(this.#i(t),this.#t==="ascii"?t:n.toAscii(t)):""}isAscii(){return!this.#t||this.#t==="ascii"}};var k=class n{#t;#i;#A;#C="";#b;#w;#D=null;#_;#E;#e;#c;#g;#o;#s;#m;#l;#u;#n;#a;#h;#T;#k;#r;#y=null;#p=null;#S=new Map;#O=null;telInputEl;hadInitialPlaceholder;constructor(t,e,i){t.dataset[T.INSTANCE_ID]=i.toString(),this.telInputEl=t,this.#t=e,this.#i=i,this.hadInitialPlaceholder=!!t.getAttribute("placeholder"),this.#A=!!this.telInputEl.closest("[dir=rtl]"),this.#C=this.telInputEl.style.paddingLeft}static validateInput(t){let e=t?.tagName;if(!(!!t&&typeof t=="object"&&e==="INPUT"&&typeof t.setAttribute=="function")){let s=Object.prototype.toString.call(t);throw new TypeError(`The first argument must be an HTMLInputElement, not ${s}`)}}buildMarkup(t,e){this.#b=t,this.#w=e,this.telInputEl.classList.add("iti__tel-input"),this.telInputEl.hasAttribute("type")||this.telInputEl.setAttribute("type","tel"),this.telInputEl.hasAttribute("autocomplete")||this.telInputEl.setAttribute("autocomplete","tel"),this.telInputEl.hasAttribute("inputmode")||this.telInputEl.setAttribute("inputmode","tel");let i=this.#U();this.#W(i),i.appendChild(this.telInputEl),this.#J(),this.#Q(i),this.ensureDropdownWidthSet()}#U(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:s}=this.#t,o=X({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!s,[i]:!!i}),r=p("div",{class:o});return this.#A&&r.setAttribute("dir","ltr"),this.telInputEl.before(r),r}#W(t){let{allowDropdown:e,separateDialCode:i,showFlags:s}=this.#t;if(!e&&!s&&!i)return;this.#E=p("div",{class:`iti__country-container ${c.V_HIDE}`},t),e?(this.#e=p("button",{type:"button",class:"iti__selected-country",[h.EXPANDED]:"false",[h.LABEL]:this.#t.i18n.noCountrySelected,[h.HASPOPUP]:"dialog",[h.CONTROLS]:`iti-${this.#i}__dropdown-content`},this.#E),this.telInputEl.disabled&&this.#e.setAttribute("disabled","true")):this.#e=p("div",{class:"iti__selected-country"},this.#E);let o=p("div",{class:"iti__selected-country-primary"},this.#e);this.#c=p("div",{class:c.FLAG},o),e&&(this.#o=p("div",{class:"iti__arrow",[h.HIDDEN]:"true"},o)),i&&(this.#g=p("div",{class:"iti__selected-dial-code"},this.#e)),e&&this.#X()}ensureDropdownWidthSet(){let{fixDropdownWidth:t,allowDropdown:e}=this.#t;if(!e||!t||this.#s.style.width)return;let i=this.telInputEl.offsetWidth;i>0&&(this.#s.style.width=`${i}px`)}#X(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:s,dropdownContainer:o,containerClass:r}=this.#t,l=t?"":"iti--flexible-dropdown-width";if(this.#s=p("div",{id:`iti-${this.#i}__dropdown-content`,class:`iti__dropdown-content ${c.HIDE} ${l}`,role:"dialog",[h.MODAL]:"true"}),this.#A&&this.#s.setAttribute("dir","rtl"),i&&this.#q(),this.#n=p("ul",{class:"iti__country-list",id:`iti-${this.#i}__country-listbox`,role:"listbox",[h.LABEL]:s.countryListAriaLabel},this.#s),this.#Z(),i&&this.#$(),e||(this.#_=this.#et(),i&&(this.#s.style.height=`${this.#_}px`)),o){let a=X({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[r]:!!r});this.#r=p("div",{class:a}),this.#r.appendChild(this.#s)}else this.#E.appendChild(this.#s)}#q(){let{i18n:t,searchInputClass:e}=this.#t,i=p("div",{class:"iti__search-input-wrapper"},this.#s);this.#m=p("span",{class:"iti__search-icon",[h.HIDDEN]:"true"},i),this.#m.innerHTML=yt(),this.#l=p("input",{id:`iti-${this.#i}__search-input`,type:"search",class:`iti__search-input ${e}`,placeholder:t.searchPlaceholder,role:"combobox",[h.EXPANDED]:"true",[h.LABEL]:t.searchPlaceholder,[h.CONTROLS]:`iti-${this.#i}__country-listbox`,[h.AUTOCOMPLETE]:"list",autocomplete:"off"},i),this.#u=p("button",{type:"button",class:`iti__search-clear ${c.HIDE}`,[h.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},i),this.#u.innerHTML=Ct(this.#i),this.#k=p("span",{class:"iti__a11y-text"},this.#s),this.#T=p("div",{class:`iti__no-results ${c.HIDE}`,[h.HIDDEN]:"true"},this.#s),this.#T.textContent=t.searchEmptyState??null}#J(){this.#E&&(this.#B(),this.#E.classList.remove(c.V_HIDE))}#Q(t){let{hiddenInput:e}=this.#t;if(!e)return;let i=this.telInputEl.getAttribute("name")||"",s=e(i);if(s.phone){let o=this.telInputEl.form?.querySelector(`input[name="${s.phone}"]`);o?this.#a=o:(this.#a=p("input",{type:"hidden",name:s.phone}),t.appendChild(this.#a))}if(s.country){let o=this.telInputEl.form?.querySelector(`input[name="${s.country}"]`);o?this.#h=o:(this.#h=p("input",{type:"hidden",name:s.country}),t.appendChild(this.#h))}}#Z(){let t=document.createDocumentFragment();for(let e=0;e<this.#b.length;e++){let i=this.#b[e],s=X({[c.COUNTRY_ITEM]:!0}),o=p("li",{id:`iti-${this.#i}__item-${i.iso2}`,class:s,tabindex:"-1",role:"option",[h.SELECTED]:"false"});o.dataset[T.DIAL_CODE]=i.dialCode,o.dataset[T.ISO2]=i.iso2,this.#S.set(i.iso2,o),this.#t.showFlags&&p("div",{class:`${c.FLAG} iti__${i.iso2}`},o);let r=p("span",{class:"iti__country-name"},o);r.textContent=`${i.name} `;let l=p("span",{class:"iti__dial-code"},r);this.#A&&l.setAttribute("dir","ltr"),l.textContent=`(+${i.dialCode})`,t.appendChild(o)}this.#n.appendChild(t)}#B(){if(this.#e){let t=this.#t.separateDialCode?L.FALLBACK_SELECTED_WITH_DIAL_WIDTH:L.FALLBACK_SELECTED_NO_DIAL_WIDTH,i=(this.#e.offsetWidth||this.#tt()||t)+L.INPUT_PADDING_EXTRA_LEFT;this.telInputEl.style.paddingLeft=`${i}px`}}static#F(){let t;try{t=window.top.document.body}catch{t=document.body}return t}#tt(){if(!this.telInputEl.parentNode)return 0;let t=n.#F(),e=this.telInputEl.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let i=this.#E.cloneNode();e.appendChild(i);let s=this.#e.cloneNode(!0);i.appendChild(s);let o=s.offsetWidth;return t.removeChild(e),o}#et(){let t=n.#F();this.#s.classList.remove(c.HIDE);let e=p("div",{class:"iti iti--inline-dropdown"});e.appendChild(this.#s),e.style.visibility="hidden",t.appendChild(e);let i=this.#s.offsetHeight;return t.removeChild(e),e.style.visibility="",this.#s.classList.add(c.HIDE),i>0?i:L.FALLBACK_DROPDOWN_HEIGHT}#$(){let{i18n:t}=this.#t,e=this.#n.childElementCount;this.#k.textContent=t.searchSummaryAria(e)}#j(t){let e;if(t==="")e=this.#b;else{let i=H.toAscii(t);e=bt(this.#b,this.#w,i)}this.#Y(e)}prefillSearchWithPlus(){this.#l.value="+",this.#l.focus(),this.#j("")}#P(){let t=this.#l.value.trim();this.#j(t),this.#l.value?this.#u.classList.remove(c.HIDE):this.#u.classList.add(c.HIDE)}#v(){this.#D&&clearTimeout(this.#D),this.#D=setTimeout(()=>{this.#P(),this.#D=null},tt.SEARCH_DEBOUNCE_MS)}#d(){this.#l.value="",this.#l.focus(),this.#P()}#R(t){let e=this.#n,i=e.getBoundingClientRect(),s=t.getBoundingClientRect(),o=s.top-i.top+e.scrollTop;s.top<i.top?e.scrollTop=o:s.bottom>i.bottom&&(e.scrollTop=o-i.height+s.height)}#f(t,e=!0){if(this.#p?.classList.remove(c.HIGHLIGHT),t){if(t.classList.add(c.HIGHLIGHT),this.#t.countrySearch){let i=t.getAttribute("id")||"";this.#l.setAttribute(h.ACTIVE_DESCENDANT,i)}e&&this.#R(t),this.#p=t}else this.#p=null}bindHiddenInputSubmitListener(t,e,i){let s=this.telInputEl.form;!s||!this.#a&&!this.#h||s.addEventListener("submit",()=>{this.#a&&(this.#a.value=e()),this.#h&&(this.#h.value=i())},{signal:t})}bindAllInitialDropdownListeners(t,e,i){let s=this.telInputEl.closest("label");s&&s.addEventListener("click",o=>{this.isDropdownOpen()?o.preventDefault():this.telInputEl.focus()},{signal:t}),this.#e.addEventListener("click",()=>{!this.isDropdownOpen()&&!this.telInputEl.disabled&&!this.telInputEl.readOnly&&e()},{signal:t}),this.#E.addEventListener("keydown",o=>{let r=[y.ARROW_UP,y.ARROW_DOWN,y.SPACE,y.ENTER];!this.isDropdownOpen()&&r.includes(o.key)&&(o.preventDefault(),o.stopPropagation(),e()),o.key===y.TAB&&i()},{signal:t})}openDropdown(t,e){let{countrySearch:i,dropdownAlwaysOpen:s,dropdownContainer:o}=this.#t;if(this.#O=new AbortController,this.ensureDropdownWidthSet(),o)this.#K();else{let l=this.#N(),a=this.telInputEl.offsetHeight+L.DROPDOWN_MARGIN;l?this.#s.style.top=`${a}px`:this.#s.style.bottom=`${a}px`}this.#s.classList.remove(c.HIDE),this.#e.setAttribute(h.EXPANDED,"true");let r=this.#y??this.#n.firstElementChild;r&&this.#f(r),i&&!s&&this.#l.focus(),this.#t.useFullscreenPopup&&this.#r&&window.visualViewport&&window.visualViewport.addEventListener("resize",()=>{this.#L(),this.#p&&this.#R(this.#p)},{signal:this.#O.signal}),this.#o.classList.add(c.ARROW_UP),this.#x(t,e)}#x(t,e){let i=this.#O.signal;this.#it(i),this.#V(i,t),this.#t.dropdownAlwaysOpen||this.#st(i,e),this.#I(i,t,e),this.#t.countrySearch&&this.#G(i),!this.#t.useFullscreenPopup&&this.#t.dropdownContainer&&window.addEventListener("scroll",e,{signal:i})}#it(t){this.#n.addEventListener("mouseover",e=>{let i=e.target?.closest(`.${c.COUNTRY_ITEM}`);i&&this.#f(i,!1)},{signal:t})}#V(t,e){this.#n.addEventListener("click",i=>{let s=i.target?.closest(`.${c.COUNTRY_ITEM}`);s&&e(s)},{signal:t})}#st(t,e){setTimeout(()=>{document.documentElement.addEventListener("click",i=>{this.#s.contains(i.target)||e()},{signal:t})},0)}#I(t,e,i){let s="",o=null,r=l=>{[y.ARROW_UP,y.ARROW_DOWN,y.ENTER,y.ESC].includes(l.key)&&(l.preventDefault(),l.stopPropagation(),l.key===y.ARROW_UP||l.key===y.ARROW_DOWN?this.#nt(l.key):l.key===y.ENTER&&!l.isComposing?e(this.#p):l.key===y.ESC&&(i(),this.#e.focus())),!this.#t.countrySearch&&l.target!==this.telInputEl&&A.HIDDEN_SEARCH_CHAR.test(l.key)&&(l.stopPropagation(),o&&clearTimeout(o),s+=l.key.toLowerCase(),this.#H(s),o=setTimeout(()=>{s=""},tt.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",r,{signal:t})}#G(t){this.#l.addEventListener("input",()=>this.#v(),{signal:t}),this.#u.addEventListener("click",()=>this.#d(),{signal:t})}#H(t){let e=Lt(this.#b,this.#w,t);if(e){let i=this.#S.get(e.iso2);this.#f(i)}}#nt(t){let e=t===y.ARROW_UP?this.#p?.previousElementSibling:this.#p?.nextElementSibling;!e&&this.#n.childElementCount>1&&(e=t===y.ARROW_UP?this.#n.lastElementChild:this.#n.firstElementChild),e&&this.#f(e)}#M(t){if(this.#y&&this.#y.dataset[T.ISO2]!==t&&(this.#y.setAttribute(h.SELECTED,"false"),this.#y.querySelector(".iti__country-check")?.remove(),this.#y=null),t&&!this.#y){let e=this.#n.querySelector(`[data-iso2="${t}"]`);if(e){e.setAttribute(h.SELECTED,"true");let i=p("span",{class:"iti__country-check",[h.HIDDEN]:"true"},e);i.innerHTML=gt(),this.#y=e,this.#t.dropdownAlwaysOpen&&this.#f(e)}}}#Y(t){this.#n.replaceChildren();let e=!0;for(let i of t){let s=this.#S.get(i.iso2);s&&(this.#n.appendChild(s),e&&(this.#f(s,!1),e=!1))}e?(this.#f(null),this.#T&&this.#T.classList.remove(c.HIDE)):this.#T&&this.#T.classList.add(c.HIDE),this.#n.scrollTop=0,this.#$()}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.#t;this.#O.abort(),this.#O=null,this.#s.classList.add(c.HIDE),this.#e.setAttribute(h.EXPANDED,"false"),t&&(this.#l.removeAttribute(h.ACTIVE_DESCENDANT),this.#l.value="",this.#P(),this.#p&&(this.#p.classList.remove(c.HIGHLIGHT),this.#p=null)),this.#o.classList.remove(c.ARROW_UP),e?(this.#r.remove(),this.#r.style.top="",this.#r.style.bottom="",this.#r.style.paddingLeft="",this.#r.style.paddingRight=""):(this.#s.style.top="",this.#s.style.bottom="")}#N(){if(this.#t.dropdownAlwaysOpen)return!0;let t=this.telInputEl.getBoundingClientRect(),e=t.top,i=window.innerHeight-t.bottom;return i>=this.#_||i>=e}#K(){let{dropdownContainer:t,useFullscreenPopup:e}=this.#t;if(e){if(window.innerWidth>=L.NARROW_VIEWPORT_WIDTH){let i=this.telInputEl.getBoundingClientRect();this.#r.style.paddingLeft=`${i.left}px`,this.#r.style.paddingRight=`${window.innerWidth-i.right}px`}}else{let i=this.telInputEl.getBoundingClientRect();this.#r.style.left=`${i.left}px`,this.#N()?this.#r.style.top=`${i.bottom+L.DROPDOWN_MARGIN}px`:(this.#r.style.top="unset",this.#r.style.bottom=`${window.innerHeight-i.top+L.DROPDOWN_MARGIN}px`)}t.appendChild(this.#r)}#L(){let t=window.visualViewport;if(!t||!this.#r)return;let e=window.innerHeight-t.height;this.#r.style.bottom=`${e}px`}isDropdownOpen(){return!this.#s.classList.contains(c.HIDE)}setLoading(t){this.#c.classList.toggle(c.LOADING,t)}isLoading(){return this.#c.classList.contains(c.LOADING)}setDisabled(t){this.telInputEl.disabled=t,this.#e&&(t?this.#e.setAttribute("disabled","true"):this.#e.removeAttribute("disabled"))}setReadonly(t){this.telInputEl.readOnly=t,this.#e&&(t?this.#e.setAttribute("disabled","true"):this.#e.removeAttribute("disabled"))}setCountry(t){let{allowDropdown:e,showFlags:i,separateDialCode:s,i18n:o}=this.#t,r=t?.name,l=t?.dialCode,a=t?.iso2??"";if(e&&this.#M(a),this.#e){let f=a&&i?`${c.FLAG} iti__${a}`:`${c.FLAG} ${c.GLOBE}`,E,d,m;a?(d=r,E=o.selectedCountryAriaLabel.replace("${countryName}",r).replace("${dialCode}",`+${l}`),m=i?"":nt()):(d=o.noCountrySelected,E=o.noCountrySelected,m=nt()),this.#c.className=f,this.#e.setAttribute("title",d),this.#e.setAttribute(h.LABEL,E),this.#c.innerHTML=m}if(s){let f=l?`+${l}`:"";this.#g.textContent=f,this.#B()}}destroy(){this.telInputEl.iti=void 0,delete this.telInputEl.dataset[T.INSTANCE_ID],this.telInputEl.style.paddingLeft=this.#C;let t=this.telInputEl.parentNode;t&&(t.before(this.telInputEl),t.remove()),this.#S.clear()}};var At=n=>{let{onlyCountries:t,excludeCountries:e}=n;return t?.length?R.filter(i=>t.includes(i.iso2)):e?.length?R.filter(i=>!e.includes(i.iso2)):[...R]},Tt=(n,t)=>{let{countryNameLocale:e,countryNameOverrides:i}=t,s;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?s=new Intl.DisplayNames(e,{type:"region"}):s=null}catch(o){console.error(o),s=null}for(let o of n)o.name=i[o.iso2]||s?.of(o.iso2.toUpperCase())||""},vt=n=>{let t=new Set,e=0,i={},s=(r,l)=>{if(!r||!l)return;l.length>e&&(e=l.length),Object.hasOwn(i,l)||(i[l]=[]);let a=i[l];a.includes(r)||a.push(r)},o=[...n].sort((r,l)=>r.priority-l.priority);for(let r of o){t.has(r.dialCode)||t.add(r.dialCode);for(let l=1;l<r.dialCode.length;l++){let a=r.dialCode.substring(0,l);s(r.iso2,a)}if(s(r.iso2,r.dialCode),r.areaCodes){let l=i[r.dialCode][0];for(let a of r.areaCodes){for(let f=1;f<a.length;f++){let E=a.substring(0,f),d=r.dialCode+E;s(l,d),s(r.iso2,d)}s(r.iso2,r.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLength:e,dialCodeToIso2Map:i}},Nt=(n,t)=>{let{countryOrder:e}=t;n.sort((i,s)=>{if(e){let o=e.indexOf(i.iso2),r=e.indexOf(s.iso2),l=o>-1,a=r>-1;if(l||a)return l&&a?o-r:l?-1:1}return i.name.localeCompare(s.name)})};var Vt=new Set(["800","808","870","881","882","883","888","979"]),ot=n=>{let t=N(n).slice(0,3);return n.startsWith("+")&&Vt.has(t)};var rt=(n,t,e,i)=>{if(!e||!t)return n;let s=`+${i.dialCode}`,o=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;return n.substring(o)},wt=(n,t,e,i,s)=>{let o=e?e.formatNumberAsYouType(n,i?.iso2):n,r=i?.dialCode;return s&&t.charAt(0)!=="+"&&o.includes(`+${r}`)?(o.split(`+${r}`)[1]||"").trim():o};var Dt=(n,t,e,i)=>{if(e===0&&!i)return 0;let s=0;for(let o=0;o<t.length;o++){if(/[+0-9]/.test(t[o])&&s++,s===n&&!i)return o+1;if(i&&s===n+1)return o}return t.length};var Gt=new Set(["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"]),lt=n=>{let t=N(n);if(t.startsWith(j.NANP)&&t.length>=4){let e=t.substring(1,4);return Gt.has(e)}return!1};var Yt=0,U=n=>{if(!u.utils)throw new Error(`intlTelInput.utils is required for ${n}(). See: https://intl-tel-input.com/docs/utils`)},Ot=()=>{let n,t;return{promise:new Promise((i,s)=>{n=i,t=s}),resolve:n,reject:t}},W=class n{id;promise;#t;#i;#A;#C;#b;#w;#D;#_;#E;#e=null;#c=null;#g;#o=!0;#s;#m;#l=!1;#u;#n;constructor(t,e={}){this.id=Yt++,k.validateInput(t);let i=ft(e);this.#i={...K,...i},mt(this.#i),Et(this.#i),this.#t=new k(t,this.#i,this.id),this.#A=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),this.#m=new H(t.value),this.promise=this.#T(this.#i),this.#C=At(this.#i);let{dialCodes:s,dialCodeMaxLength:o,dialCodeToIso2Map:r}=vt(this.#C);this.#D=s,this.#b=o,this.#w=r,this.#_=new Map(this.#C.map(l=>[l.iso2,l])),this.#k()}#a(){let t=this.#t.telInputEl.value.trim();return this.#m.normalise(t)}#h(t){this.#t.telInputEl.value=this.#m.denormalise(t)}#T(t){let{initialCountry:e,geoIpLookup:i,loadUtils:s}=t,o=e===F.AUTO&&!!i,r=!!s&&!u.utils;return o&&(this.#u=Ot()),r&&(this.#n=Ot()),Promise.all([this.#u?.promise,this.#n?.promise]).then(()=>{})}#k(){this.#s=new AbortController,this.#r(),this.#t.buildMarkup(this.#C,this.#E),this.#y(),this.#p(),this.#S(),this.#i.dropdownAlwaysOpen&&this.#R()}#r(){Tt(this.#C,this.#i),Nt(this.#C,this.#i),this.#E=It(this.#C)}#y(t=!1){let e=this.#t.telInputEl.getAttribute("value"),i=this.#m.normalise(e??""),s=this.#a(),r=i&&i.startsWith("+")&&(!s||!s.startsWith("+"))?i:s,l=this.#N(r),a=lt(r),{initialCountry:f,geoIpLookup:E}=this.#i,d=f===F.AUTO&&E,m=d&&u.autoCountry?u.autoCountry:f,v=d&&!t&&!u.autoCountry,b=D(m);l?a?b?this.#I(m):v||this.#I(at.ISO2):(b&&this.#I(m),this.#x(r)):b?this.#I(m):v||this.#I(""),r&&this.#f(r)}#p(){this.#X(),this.#i.allowDropdown&&this.#t.bindAllInitialDropdownListeners(this.#s.signal,()=>this.#R(),()=>this.#M()),this.#t.bindHiddenInputSubmitListener(this.#s.signal,()=>this.getNumber(),()=>this.#e?.iso2||"")}#S(){if(this.#n){let{loadUtils:t}=this.#i,e=()=>{u.attachUtils(t).catch(()=>{})};u.documentReady()?e():window.addEventListener("load",e,{signal:this.#s.signal})}this.#u&&(this.#e?this.#u.resolve():this.#O())}async#O(){if(u.autoCountry){this.#rt();return}if(this.#t.setLoading(!0),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.#i.geoIpLookup=="function"))try{let t=await this.#i.geoIpLookup(),e=typeof t=="string"?t.toLowerCase():"";if(!D(e)){n.forEachInstance("handleAutoCountryFailure");return}u.autoCountry=e,setTimeout(()=>n.forEachInstance("handleAutoCountryLoaded"))}catch{n.forEachInstance("handleAutoCountryFailure")}}#U(){this.#R(),this.#t.prefillSearchWithPlus()}#W(t){let e=this.#t.telInputEl.selectionStart||0,i=t.substring(0,e-1),s=t.substring(e);return this.#h(i+s),e-1}#X(){this.#B(),this.#tt(),this.#$()}#q(t){this.#W(t),this.#U()}#J(t,e){let i=this.#W(t);this.#t.telInputEl.setSelectionRange(i,i),this.#v(),this.#d(I.STRICT_REJECT,{source:"key",rejectedInput:e,reason:"invalid"})}#Q(t,e){let i=this.#t.telInputEl.selectionStart||0,o=t.substring(0,i).replace(A.NON_PLUS_NUMERIC_GLOBAL,"").length,r=this.#L(),l=wt(r,t,u.utils,this.#e,this.#i.separateDialCode),a=Dt(o,l,i,e);this.#h(l),this.#t.telInputEl.setSelectionRange(a,a)}#Z(t){if(t.startsWith("+")&&this.#e&&this.#N(t)){let e=rt(t,!0,!0,this.#e);this.#h(e)}}#B(){this.#l=A.ALPHA_UNICODE.test(this.#a()),this.#t.telInputEl.addEventListener("input",this.#F,{signal:this.#s.signal})}#F=t=>{let{strictMode:e,formatAsYouType:i,separateDialCode:s,allowDropdown:o,countrySearch:r}=this.#i,l=t?.detail;if(l?.isCountryChange)return;let a=this.#a();if(this.#A&&t?.data==="+"&&s&&o&&r){this.#q(a);return}if(this.#A&&e&&(t?.data===" "||t?.data==="-"||t?.data===".")){this.#J(a,t.data);return}this.#x(a)&&this.#z();let f=t?.data&&A.NON_PLUS_NUMERIC.test(t.data),E=t?.inputType===Z.PASTE&&a;f||E&&!e?this.#l=!0:A.NON_PLUS_NUMERIC.test(a)||(this.#l=!1),i&&!this.#l&&!l?.isSetNumber&&this.#m.isAscii()&&this.#Q(a,t?.inputType===Z.DELETE_FORWARD),s&&this.#Z(a)};#tt(){let{strictMode:t,separateDialCode:e}=this.#i;!t&&!e||this.#t.telInputEl.addEventListener("keydown",this.#et,{signal:this.#s.signal})}#et=t=>{let{strictMode:e,separateDialCode:i,allowDropdown:s,countrySearch:o}=this.#i;if(!t.key||t.key.length!==1||t.altKey||t.ctrlKey||t.metaKey)return;if(i&&s&&o&&t.key==="+"){t.preventDefault(),this.#U();return}if(!e)return;let r=this.#a(),a=!r.startsWith("+")&&this.#t.telInputEl.selectionStart===0&&t.key==="+",f=this.#m.normalise(t.key),E=/^[0-9]$/.test(f),d=i?E:a||E,m=this.#t.telInputEl,v=m.selectionStart,b=m.selectionEnd,$=r.slice(0,v??void 0),O=r.slice(b??void 0),g=$+f+O,_=this.#K(g),B=!1;u.utils&&this.#c&&(B=u.utils.getCoreNumber(_,this.#e?.iso2).length>this.#c);let q=this.#V(_)!==null;(!d||B&&!q&&!a)&&(this.#v(),this.#d(I.STRICT_REJECT,{source:"key",rejectedInput:t.key,reason:d?"max-length":"invalid"}),t.preventDefault())};#$(){this.#i.strictMode&&this.#t.telInputEl.addEventListener("paste",this.#j,{signal:this.#s.signal})}#j=t=>{t.preventDefault();let e=this.#t.telInputEl,i=e.selectionStart,s=e.selectionEnd,o=this.#a(),r=o.slice(0,i??void 0),l=o.slice(s??void 0),a=this.#e?.iso2,f=t.clipboardData.getData("text"),E=this.#m.normalise(f),d=i===0&&s>0,m=!o.startsWith("+")||d,v=E.replace(A.NON_PLUS_NUMERIC_GLOBAL,""),b=v.startsWith("+"),$=v.replace(/\+/g,""),O=b&&m?`+${$}`:$,g=r+O+l,_=O!==E?"invalid":null;if(g.length>30){this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:"max-length"});return}if(g.length>5&&u.utils){let S=u.utils.getCoreNumber(g,a);for(;S.length===0&&g.length>0;)g=g.slice(0,-1),S=u.utils.getCoreNumber(g,a);if(!S){this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:"max-length"});return}if(this.#c&&S.length>this.#c)if(e.selectionEnd===o.length){let q=S.length-this.#c;g=g.slice(0,g.length-q),_="max-length"}else{this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:"max-length"});return}}this.#h(g);let B=i+O.length;e.setSelectionRange(B,B),e.dispatchEvent(new InputEvent("input",{bubbles:!0})),_&&(E.length>0&&O.length===0&&this.#v(),this.#d(I.STRICT_REJECT,{source:"paste",rejectedInput:f,reason:_}))};#P(t){let e=Number(this.#t.telInputEl.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}#v(){if(!this.#i.strictRejectAnimation)return;let t=this.#t.telInputEl.parentElement;t&&(t.classList.remove("iti__strict-reject-animation"),t.offsetWidth,t.classList.add("iti__strict-reject-animation"))}#d(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.#t.telInputEl.dispatchEvent(i)}#R(){this.#t.openDropdown(t=>this.#nt(t),()=>this.#M()),this.#d(I.OPEN_COUNTRY_DROPDOWN)}#f(t){let{formatOnDisplay:e,nationalMode:i,separateDialCode:s}=this.#i,o=t;if(e&&u.utils&&this.#e){let r=ot(t),a=i&&!r||!o.startsWith("+")&&!s?x.NATIONAL:x.INTERNATIONAL;o=u.utils.formatNumber(o,this.#e?.iso2,a)}o=this.#ot(o),this.#h(o)}#x(t){let e=this.#V(t);return e!==null?this.#I(e):!1}#it(t){let e=this.#e?.dialCode,i=this.#e?.nationalPrefix;if(t.startsWith("+")||!e)return t;let r=i&&t.startsWith(i)&&!this.#i.separateDialCode?t.substring(1):t;return`+${e}${r}`}#V(t){let e=t.indexOf("+"),i=e>0?t.substring(e):t,s=this.#e?.iso2;i=this.#it(i);let o=this.#N(i,!0),r=N(i);if(o){let l=N(o),a=this.#w[l];return a.length===1?a[0]===s?null:a[0]:this.#st(a,l,r)}else if(i.startsWith("+")&&r.length){let l=this.#e?.dialCode||"";return l&&l.startsWith(r)?null:""}else if((!i||i==="+")&&!s&&this.#g)return this.#g;return null}#st(t,e,i){let s=this.#e?.iso2,o=this.#e?.dialCode;if(!s&&this.#g&&t.includes(this.#g))return this.#g;if(o===j.NANP&<(i))return null;let l=this.#e?.areaCodes,a=this.#e?.priority;if(l){let v=l.map(b=>`${o}${b}`);for(let b of v)if(i.startsWith(b))return null}let E=l&&!(a===0)&&i.length>e.length,d=s&&t.includes(s)&&!E,m=s===t[0];return!d&&!m?t[0]:null}#I(t){let e=this.#e?.iso2||"";return this.#e=t?this.#_.get(t):null,this.#e&&(this.#g=this.#e.iso2),this.#t.setCountry(this.#e),this.#H(),this.#G(),e!==t}#G(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.#i;if(!t||!u.utils)return;let s=this.#e?.iso2;if(!s){this.#c=null;return}let o=u.utils.getExampleNumber(s,!1,e,!0),r=o;for(;u.utils.isPossibleNumber(o,s,i);)r=o,o+="0";let l=u.utils.getCoreNumber(r,s);this.#c=l.length,s==="by"&&(this.#c=l.length+1)}#H(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:s}=this.#i,o=t===M.AGGRESSIVE||!this.#t.hadInitialPlaceholder&&t===M.POLITE;if(!u.utils||!o)return;let r=this.#e?u.utils.getExampleNumber(this.#e.iso2,i,e):"";r=this.#ot(r),typeof s=="function"&&(r=s(r,this.#e)),this.#t.telInputEl.setAttribute("placeholder",r)}#nt(t){if(!t)return;let e=t.dataset[T.ISO2],i=this.#I(e);this.#M();let s=t.dataset[T.DIAL_CODE];if(this.#Y(s),this.#i.formatOnDisplay){let o=this.#a();this.#f(o)}this.#t.telInputEl.focus(),i&&(this.#z(),this.#d(I.INPUT,{isCountryChange:!0}))}#M(t){!this.#t.isDropdownOpen()||this.#i.dropdownAlwaysOpen&&!t||(this.#t.closeDropdown(),this.#d(I.CLOSE_COUNTRY_DROPDOWN))}#Y(t){let e=this.#a();if(!e.startsWith("+"))return;let i=`+${t}`,s=this.#N(e),o;s?o=e.replace(s,i):o=i,this.#h(o)}#N(t,e){if(!t.startsWith("+"))return"";let i="",s="",o=!1;for(let r=0;r<t.length;r++){let l=t.charAt(r);if(!/[0-9]/.test(l))continue;if(s+=l,!!!this.#w[s])break;if(this.#D.has(s)){if(i=t.substring(0,r+1),o=!0,!e)break}else e&&o&&(i=t.substring(0,r+1));if(s.length===this.#b)break}return i}#K(t){let e=this.#e?.dialCode,i=N(t);return(this.#i.separateDialCode&&!t.startsWith("+")&&e&&i?`+${e}`:"")+t}#L(){let t=this.#a();return this.#K(t)}#ot(t){let e=!!this.#N(t),i=rt(t,e,this.#i.separateDialCode,this.#e);return this.#P(i)}#z(){this.#d(I.COUNTRY_CHANGE,this.#e??null)}#rt(){if(!(!this.#u||!u.autoCountry)){if(!this.#o){this.#u.resolve();return}this.#t.isLoading()?this.setCountry(u.autoCountry):this.#g=u.autoCountry,this.#t.setLoading(!1),this.#u.resolve()}}#at(){if(!this.#o){this.#u?.reject();return}this.#y(!0),this.#t.setLoading(!1),this.#u?.reject()}#ut(){if(!this.#o){this.#n?.resolve();return}if(!u.utils){this.#n?.resolve();return}let t=this.#a();t&&this.#f(t),this.#e&&(this.#H(),this.#G()),this.#n?.resolve()}#ct(t){if(!this.#o){this.#n?.reject(t);return}this.#n?.reject(t)}destroy(){this.#o&&(this.#o=!1,this.#i.allowDropdown&&this.#M(!0),this.#s.abort(),this.#t.destroy(),u.instances.delete(String(this.id)))}isActive(){return this.#o}getExtension(){return this.#o?(U("getExtension"),u.utils.getExtension(this.#L(),this.#e?.iso2)):""}getNumber(t){if(!this.#o)return"";U("getNumber");let e=this.#e?.iso2,i=this.#L(),s=u.utils.formatNumber(i,e,t);return this.#m.denormalise(s)}getNumberType(){return this.#o?(U("getNumberType"),u.utils.getNumberType(this.#L(),this.#e?.iso2)):null}getSelectedCountryData(){return this.#e??null}getValidationError(){if(!this.#o)return null;U("getValidationError");let t=this.#e?.iso2;return u.utils.getValidationError(this.#L(),t)}isValidNumber(){if(!this.#o)return null;U("isValidNumber");let t=this.#e?.dialCode,e=this.#e?.iso2,i=this.#L(),s=u.utils.getCoreNumber(i,e);if(s){if(t===V.DIAL_CODE&&s[0]===V.MOBILE_PREFIX&&s.length!==V.MOBILE_CORE_LENGTH)return!1;if(!A.ALPHA_UNICODE.test(i)&&t){let r=i.startsWith("+")?i.slice(1+t.length):i,l=N(r).length;if(s.length>l)return!1}}return this.#lt("possible")}isValidNumberPrecise(){return this.#o?(U("isValidNumberPrecise"),this.#lt("precise")):null}#lt(t){let{allowNumberExtensions:e,allowPhonewords:i,allowedNumberTypes:s}=this.#i,o=this.#e?.iso2,r=this.#L();return!this.#e&&!ot(r)||!(t==="precise"?u.utils.isValidNumber:u.utils.isPossibleNumber)(r,o,s)?!1:A.ALPHA_UNICODE.test(r)?!!u.utils.getExtension(r,o)?e:i:!0}setCountry(t){if(!this.#o)return;let e=t?.toLowerCase();if(!D(e))throw new Error(`Invalid iso2 code: '${e}'`);let i=this.#e?.iso2;if(t&&e!==i||!t&&i){if(this.#I(e),this.#Y(this.#e?.dialCode||""),this.#i.formatOnDisplay){let o=this.#a();this.#f(o)}this.#z(),this.#d(I.INPUT,{isCountryChange:!0})}}setNumber(t){if(!this.#o)return;let e=this.#m.normalise(t),i=this.#x(e);this.#f(e),i&&this.#z(),this.#d(I.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.#o&&(this.#i.placeholderNumberType=t,this.#H())}setDisabled(t){this.#o&&this.#t.setDisabled(t)}setReadonly(t){this.#o&&this.#t.setReadonly(t)}static forEachInstance(t,...e){let i=[...u.instances.values()],s=e[0];i.forEach(o=>{if(o instanceof n)switch(t){case"handleUtilsLoaded":o.#ut();break;case"handleUtilsFailure":o.#ct(s);break;case"handleAutoCountryLoaded":o.#rt();break;case"handleAutoCountryFailure":o.#at();break}})}},Kt=async n=>{if(u.utils||u.startedLoadingUtils)return null;if(typeof n!="function")throw new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utils module, not ${typeof n}`);u.startedLoadingUtils=!0;try{let e=(await n())?.default;if(!e||typeof e!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return u.utils=e,W.forEachInstance("handleUtilsLoaded"),!0}catch(t){throw W.forEachInstance("handleUtilsFailure",t),t}},u=Object.assign((n,t)=>{let e=new W(n,t);return u.instances.set(String(e.id),e),n.iti=e,e},{defaults:K,documentReady:()=>document.readyState==="complete",getCountryData:()=>R,getInstance:n=>{let t=n.dataset[T.INSTANCE_ID];return t?u.instances.get(t)??null:null},instances:new Map,attachUtils:Kt,startedLoadingUtils:!1,startedLoadingAutoCountry:!1,version:"28.0.2",NUMBER_FORMAT:x,NUMBER_TYPE:w,VALIDATION_ERROR:G}),zt=u;return xt(Xt);})();
|
|
25
25
|
var intlTelInput = _factory.default;
|
package/dist/js/intlTelInput.mjs
CHANGED
|
@@ -1738,7 +1738,7 @@ var allCountries = [];
|
|
|
1738
1738
|
for (const c of rawCountryData) {
|
|
1739
1739
|
allCountries.push({
|
|
1740
1740
|
name: "",
|
|
1741
|
-
// populated in the
|
|
1741
|
+
// populated in the core library
|
|
1742
1742
|
iso2: c[0],
|
|
1743
1743
|
dialCode: c[1],
|
|
1744
1744
|
priority: c[2] || 0,
|
|
@@ -1958,7 +1958,7 @@ var defaults = {
|
|
|
1958
1958
|
geoIpLookup: null,
|
|
1959
1959
|
//* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
|
|
1960
1960
|
hiddenInput: null,
|
|
1961
|
-
//* Internationalise the
|
|
1961
|
+
//* Internationalise the core library text e.g. search input placeholder, country names.
|
|
1962
1962
|
i18n: {},
|
|
1963
1963
|
//* Initial country.
|
|
1964
1964
|
initialCountry: "",
|
|
@@ -2447,7 +2447,7 @@ var UI = class _UI {
|
|
|
2447
2447
|
);
|
|
2448
2448
|
}
|
|
2449
2449
|
}
|
|
2450
|
-
//* Generate all of the markup for the
|
|
2450
|
+
//* Generate all of the markup for the core library: the selected country overlay, and the dropdown.
|
|
2451
2451
|
buildMarkup(countries, searchTokens) {
|
|
2452
2452
|
this.#countries = countries;
|
|
2453
2453
|
this.#searchTokens = searchTokens;
|
|
@@ -4374,7 +4374,7 @@ var Iti = class _Iti {
|
|
|
4374
4374
|
//********************
|
|
4375
4375
|
//* PUBLIC METHODS
|
|
4376
4376
|
//********************
|
|
4377
|
-
//* Remove
|
|
4377
|
+
//* Remove core library.
|
|
4378
4378
|
destroy() {
|
|
4379
4379
|
if (!this.#isActive) {
|
|
4380
4380
|
return;
|
|
@@ -4623,7 +4623,7 @@ var intlTelInput = Object.assign(
|
|
|
4623
4623
|
documentReady: () => document.readyState === "complete",
|
|
4624
4624
|
//* Get the country data object.
|
|
4625
4625
|
getCountryData: () => data_default,
|
|
4626
|
-
//* A getter for the
|
|
4626
|
+
//* A getter for the core library instance.
|
|
4627
4627
|
getInstance: (input) => {
|
|
4628
4628
|
const id = input.dataset[DATA_KEYS.INSTANCE_ID];
|
|
4629
4629
|
return id ? intlTelInput.instances.get(id) ?? null : null;
|
|
@@ -4633,7 +4633,7 @@ var intlTelInput = Object.assign(
|
|
|
4633
4633
|
attachUtils,
|
|
4634
4634
|
startedLoadingUtils: false,
|
|
4635
4635
|
startedLoadingAutoCountry: false,
|
|
4636
|
-
version: "28.0.
|
|
4636
|
+
version: "28.0.2",
|
|
4637
4637
|
NUMBER_FORMAT,
|
|
4638
4638
|
NUMBER_TYPE,
|
|
4639
4639
|
VALIDATION_ERROR
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v28.0.
|
|
2
|
+
* International Telephone Input v28.0.2
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1769,7 +1769,7 @@ var _factory = (() => {
|
|
|
1769
1769
|
for (const c of rawCountryData) {
|
|
1770
1770
|
allCountries.push({
|
|
1771
1771
|
name: "",
|
|
1772
|
-
// populated in the
|
|
1772
|
+
// populated in the core library
|
|
1773
1773
|
iso2: c[0],
|
|
1774
1774
|
dialCode: c[1],
|
|
1775
1775
|
priority: c[2] || 0,
|
|
@@ -1989,7 +1989,7 @@ var _factory = (() => {
|
|
|
1989
1989
|
geoIpLookup: null,
|
|
1990
1990
|
//* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
|
|
1991
1991
|
hiddenInput: null,
|
|
1992
|
-
//* Internationalise the
|
|
1992
|
+
//* Internationalise the core library text e.g. search input placeholder, country names.
|
|
1993
1993
|
i18n: {},
|
|
1994
1994
|
//* Initial country.
|
|
1995
1995
|
initialCountry: "",
|
|
@@ -2478,7 +2478,7 @@ var _factory = (() => {
|
|
|
2478
2478
|
);
|
|
2479
2479
|
}
|
|
2480
2480
|
}
|
|
2481
|
-
//* Generate all of the markup for the
|
|
2481
|
+
//* Generate all of the markup for the core library: the selected country overlay, and the dropdown.
|
|
2482
2482
|
buildMarkup(countries, searchTokens) {
|
|
2483
2483
|
this.#countries = countries;
|
|
2484
2484
|
this.#searchTokens = searchTokens;
|
|
@@ -4405,7 +4405,7 @@ var _factory = (() => {
|
|
|
4405
4405
|
//********************
|
|
4406
4406
|
//* PUBLIC METHODS
|
|
4407
4407
|
//********************
|
|
4408
|
-
//* Remove
|
|
4408
|
+
//* Remove core library.
|
|
4409
4409
|
destroy() {
|
|
4410
4410
|
if (!this.#isActive) {
|
|
4411
4411
|
return;
|
|
@@ -4654,7 +4654,7 @@ var _factory = (() => {
|
|
|
4654
4654
|
documentReady: () => document.readyState === "complete",
|
|
4655
4655
|
//* Get the country data object.
|
|
4656
4656
|
getCountryData: () => data_default,
|
|
4657
|
-
//* A getter for the
|
|
4657
|
+
//* A getter for the core library instance.
|
|
4658
4658
|
getInstance: (input) => {
|
|
4659
4659
|
const id = input.dataset[DATA_KEYS.INSTANCE_ID];
|
|
4660
4660
|
return id ? intlTelInput.instances.get(id) ?? null : null;
|
|
@@ -4664,7 +4664,7 @@ var _factory = (() => {
|
|
|
4664
4664
|
attachUtils,
|
|
4665
4665
|
startedLoadingUtils: false,
|
|
4666
4666
|
startedLoadingAutoCountry: false,
|
|
4667
|
-
version: "28.0.
|
|
4667
|
+
version: "28.0.2",
|
|
4668
4668
|
NUMBER_FORMAT,
|
|
4669
4669
|
NUMBER_TYPE,
|
|
4670
4670
|
VALIDATION_ERROR
|