intl-tel-input 27.0.16 → 27.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/angular/dist/IntlTelInput.js +1 -1
- package/angular/dist/IntlTelInputWithUtils.js +1 -1
- package/dist/js/data.js +1 -1
- package/dist/js/data.min.js +1 -1
- package/dist/js/intlTelInput.js +2 -2
- package/dist/js/intlTelInput.min.js +2 -2
- package/dist/js/intlTelInput.mjs +1 -1
- package/dist/js/intlTelInputWithUtils.js +2 -2
- package/dist/js/intlTelInputWithUtils.min.js +2 -2
- package/dist/js/intlTelInputWithUtils.mjs +1 -1
- package/package.json +1 -1
- package/react/dist/IntlTelInput.js +1 -1
- package/react/dist/IntlTelInputWithUtils.js +1 -1
- package/vue/dist/{IntlTelInput-DFggvy-Z.js → IntlTelInput-CcMc59OL.js} +1 -1
- package/vue/dist/IntlTelInput.js +1 -1
- package/vue/dist/IntlTelInputWithUtils.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
See the Github Releases page for changelog: https://github.com/jackocnr/intl-tel-input/releases
|
|
2
2
|
|
|
3
|
-
Or to view a specific version, e.g. v27.0.
|
|
3
|
+
Or to view a specific version, e.g. v27.0.17, update the URL accordingly, e.g. https://github.com/jackocnr/intl-tel-input/releases/tag/v27.0.17
|
|
4
4
|
|
|
5
5
|
## Breaking changes
|
|
6
6
|
|
package/dist/js/data.js
CHANGED
package/dist/js/data.min.js
CHANGED
package/dist/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v27.0.
|
|
2
|
+
* International Telephone Input v27.0.17
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -4532,7 +4532,7 @@ var _factory = (() => {
|
|
|
4532
4532
|
attachUtils,
|
|
4533
4533
|
startedLoadingUtils: false,
|
|
4534
4534
|
startedLoadingAutoCountry: false,
|
|
4535
|
-
version: "27.0.
|
|
4535
|
+
version: "27.0.17"
|
|
4536
4536
|
}
|
|
4537
4537
|
);
|
|
4538
4538
|
var intlTelInput_default = intlTelInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v27.0.
|
|
2
|
+
* International Telephone Input v27.0.17
|
|
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 Ct=(n,t)=>{let e=$(t),i=[],s=[],o=[],l=[],r=[],a=[];for(let d of n)d.iso2===e?i.push(d):d.normalisedName.startsWith(e)?s.push(d):d.normalisedName.includes(e)?o.push(d):e===d.dialCode||e===d.dialCodePlus?l.push(d):d.dialCodePlus.includes(e)?r.push(d):d.initials.includes(e)&&a.push(d);let c=(d,m)=>d.priority-m.priority;return[...i,...s,...o,...l.sort(c),...r.sort(c),...a]},Et=(n,t)=>{let e=$(t);for(let i of n)if(i.normalisedName.startsWith(e))return i;return null};var R=class n{#t;#i;#D;#m="";#E;#L=null;#T;#p;#e;#u;#f;#o;#s;#h;#l;#c;#n;#d;#A;#v;#U;#r;#y=null;#a=null;#O=new Map;#w=null;telInputEl;hadInitialPlaceholder;constructor(t,e,i){t.dataset[w.INSTANCE_ID]=i.toString(),this.telInputEl=t,this.#t=e,this.#i=i,this.hadInitialPlaceholder=!!t.getAttribute("placeholder"),this.#D=!!this.telInputEl.closest("[dir=rtl]"),this.#m=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){this.#E=t,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 e=this.#j();this.#K(e),e.appendChild(this.telInputEl),this.#X(),this.#_(e)}#j(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:s}=this.#t,o=j({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!s,[i]:!!i}),l=f("div",{class:o});return this.#D&&l.setAttribute("dir","ltr"),this.telInputEl.before(l),l}#K(t){let{allowDropdown:e,separateDialCode:i,showFlags:s}=this.#t;if(!e&&!s&&!i)return;this.#p=f("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.#e=f("button",{type:"button",class:"iti__selected-country",[p.EXPANDED]:"false",[p.LABEL]:this.#t.i18n.noCountrySelected,[p.HASPOPUP]:"dialog",[p.CONTROLS]:`iti-${this.#i}__dropdown-content`},this.#p),this.telInputEl.disabled&&this.#e.setAttribute("disabled","true")):this.#e=f("div",{class:"iti__selected-country"},this.#p);let o=f("div",{class:"iti__selected-country-primary"},this.#e);this.#u=f("div",{class:h.FLAG},o),e&&(this.#o=f("div",{class:"iti__arrow",[p.HIDDEN]:"true"},o)),i&&(this.#f=f("div",{class:"iti__selected-dial-code"},this.#e)),e&&this.#Y()}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`)}#Y(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:s,dropdownContainer:o,containerClass:l}=this.#t,r=t?"":"iti--flexible-dropdown-width";if(this.#s=f("div",{id:`iti-${this.#i}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${r}`,role:"dialog",[p.MODAL]:"true"}),this.#D&&this.#s.setAttribute("dir","rtl"),i&&this.#z(),this.#n=f("ul",{class:"iti__country-list",id:`iti-${this.#i}__country-listbox`,role:"listbox",[p.LABEL]:s.countryListAriaLabel},this.#s),this.#x(),i&&this.#$(),e||(this.#T=this.#W(),i&&(this.#s.style.height=`${this.#T}px`)),o){let a=j({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[l]:!!l});this.#r=f("div",{class:a}),this.#r.appendChild(this.#s)}else this.#p.appendChild(this.#s)}#z(){let{i18n:t,searchInputClass:e}=this.#t,i=f("div",{class:"iti__search-input-wrapper"},this.#s);this.#h=f("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},i),this.#h.innerHTML=ft(),this.#l=f("input",{id:`iti-${this.#i}__search-input`,type:"search",class:`iti__search-input ${e}`,placeholder:t.searchPlaceholder,role:"combobox",[p.EXPANDED]:"true",[p.LABEL]:t.searchPlaceholder,[p.CONTROLS]:`iti-${this.#i}__country-listbox`,[p.AUTOCOMPLETE]:"list",autocomplete:"off"},i),this.#c=f("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},i),this.#c.innerHTML=mt(this.#i),this.#U=f("span",{class:"iti__a11y-text"},this.#s),this.#v=f("div",{class:`iti__no-results ${h.HIDE}`,[p.HIDDEN]:"true"},this.#s),this.#v.textContent=t.searchEmptyState??null}#X(){this.#p&&(this.#N(),this.#p.classList.remove(h.V_HIDE))}#_(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.#d=o:(this.#d=f("input",{type:"hidden",name:s.phone}),t.appendChild(this.#d))}if(s.country){let o=this.telInputEl.form?.querySelector(`input[name="${s.country}"]`);o?this.#A=o:(this.#A=f("input",{type:"hidden",name:s.country}),t.appendChild(this.#A))}}#x(){let t=document.createDocumentFragment();for(let e=0;e<this.#E.length;e++){let i=this.#E[e],s=j({[h.COUNTRY_ITEM]:!0}),o=f("li",{id:`iti-${this.#i}__item-${i.iso2}`,class:s,tabindex:"-1",role:"option",[p.SELECTED]:"false"});o.dataset[w.DIAL_CODE]=i.dialCode,o.dataset[w.ISO2]=i.iso2,this.#O.set(i.iso2,o),this.#t.showFlags&&f("div",{class:`${h.FLAG} iti__${i.iso2}`},o);let l=f("span",{class:"iti__country-name"},o);l.textContent=`${i.name} `;let r=f("span",{class:"iti__dial-code"},l);this.#D&&r.setAttribute("dir","ltr"),r.textContent=`(+${i.dialCode})`,t.appendChild(o)}this.#n.appendChild(t)}#N(){if(this.#e){let t=this.#t.separateDialCode?A.FALLBACK_SELECTED_WITH_DIAL_WIDTH:A.FALLBACK_SELECTED_NO_DIAL_WIDTH,i=(this.#e.offsetWidth||this.#q()||t)+A.INPUT_PADDING_EXTRA_LEFT;this.telInputEl.style.paddingLeft=`${i}px`}}static#S(){let t;try{t=window.top.document.body}catch{t=document.body}return t}#q(){if(!this.telInputEl.parentNode)return 0;let t=n.#S(),e=this.telInputEl.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let i=this.#p.cloneNode();e.appendChild(i);let s=this.#e.cloneNode(!0);i.appendChild(s);let o=s.offsetWidth;return t.removeChild(e),o}#W(){let t=n.#S();this.#s.classList.remove(h.HIDE);let e=f("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(h.HIDE),i>0?i:A.FALLBACK_DROPDOWN_HEIGHT}#$(){let{i18n:t}=this.#t,e=this.#n.childElementCount;this.#U.textContent=t.searchSummaryAria(e)}#C(t){let e;t===""?e=this.#E:e=Ct(this.#E,t),this.#tt(e)}prefillSearchWithPlus(){this.#l.value="+",this.#C("")}#P(){let t=this.#l.value.trim();this.#C(t),this.#l.value?this.#c.classList.remove(h.HIDE):this.#c.classList.add(h.HIDE)}#H(){this.#L&&clearTimeout(this.#L),this.#L=setTimeout(()=>{this.#P(),this.#L=null},q.SEARCH_DEBOUNCE_MS)}#Q(){this.#l.value="",this.#l.focus(),this.#P()}#g(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)}#b(t,e){let i=this.#a;if(i&&i.classList.remove(h.HIGHLIGHT),this.#a=t,this.#a){if(this.#a.classList.add(h.HIGHLIGHT),this.#t.countrySearch){let s=this.#a.getAttribute("id")||"";this.#l.setAttribute(p.ACTIVE_DESCENDANT,s)}e&&this.#a.focus()}}bindHiddenInputSubmitListener(t,e,i){let s=this.telInputEl.form;!s||!this.#d&&!this.#A||s.addEventListener("submit",()=>{this.#d&&(this.#d.value=e()),this.#A&&(this.#A.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.#p.addEventListener("keydown",o=>{let l=[C.ARROW_UP,C.ARROW_DOWN,C.SPACE,C.ENTER];!this.isDropdownOpen()&&l.includes(o.key)&&(o.preventDefault(),o.stopPropagation(),e()),o.key===C.TAB&&i()},{signal:t})}openDropdown(t,e){let{countrySearch:i,dropdownAlwaysOpen:s,dropdownContainer:o}=this.#t;if(this.#w=new AbortController,this.ensureDropdownWidthSet(),o)this.#et();else{let r=this.#k(),a=this.telInputEl.offsetHeight+A.DROPDOWN_MARGIN;r?this.#s.style.top=`${a}px`:this.#s.style.bottom=`${a}px`}this.#s.classList.remove(h.HIDE),this.#e.setAttribute(p.EXPANDED,"true");let l=this.#y??this.#n.firstElementChild;l&&(this.#b(l,!1),this.#g(l)),i&&!s&&this.#l.focus(),this.#t.useFullscreenPopup&&this.#r&&window.visualViewport&&window.visualViewport.addEventListener("resize",()=>{this.#it(),this.#a&&this.#g(this.#a)},{signal:this.#w.signal}),this.#o.classList.add(h.ARROW_UP),this.#M(t,e)}#M(t,e){let i=this.#w.signal;this.#B(i),this.#I(i,t),this.#t.dropdownAlwaysOpen||this.#F(i,e),this.#V(i,t,e),this.#t.countrySearch&&this.#R(i),!this.#t.useFullscreenPopup&&this.#t.dropdownContainer&&window.addEventListener("scroll",e,{signal:i})}#B(t){this.#n.addEventListener("mouseover",e=>{let i=e.target?.closest(`.${h.COUNTRY_ITEM}`);i&&this.#b(i,!1)},{signal:t})}#I(t,e){this.#n.addEventListener("click",i=>{let s=i.target?.closest(`.${h.COUNTRY_ITEM}`);s&&e(s)},{signal:t})}#F(t,e){setTimeout(()=>{document.documentElement.addEventListener("click",i=>{this.#s.contains(i.target)||e()},{signal:t})},0)}#V(t,e,i){let s="",o=null,l=r=>{[C.ARROW_UP,C.ARROW_DOWN,C.ENTER,C.ESC].includes(r.key)&&(r.preventDefault(),r.stopPropagation(),r.key===C.ARROW_UP||r.key===C.ARROW_DOWN?this.#J(r.key):r.key===C.ENTER&&!r.isComposing?e(this.#a):r.key===C.ESC&&(i(),this.#e.focus())),!this.#t.countrySearch&&v.HIDDEN_SEARCH_CHAR.test(r.key)&&(r.stopPropagation(),o&&clearTimeout(o),s+=r.key.toLowerCase(),this.#G(s),o=setTimeout(()=>{s=""},q.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",l,{signal:t})}#R(t){this.#l.addEventListener("input",()=>this.#H(),{signal:t}),this.#c.addEventListener("click",()=>this.#Q(),{signal:t})}#G(t){let e=Et(this.#E,t);if(e){let i=this.#O.get(e.iso2);this.#b(i,!1),this.#g(i)}}#J(t){let e=t===C.ARROW_UP?this.#a?.previousElementSibling:this.#a?.nextElementSibling;!e&&this.#n.childElementCount>1&&(e=t===C.ARROW_UP?this.#n.lastElementChild:this.#n.firstElementChild),e&&(this.#g(e),this.#b(e,!1))}#Z(t){if(this.#y&&this.#y.dataset[w.ISO2]!==t&&(this.#y.setAttribute(p.SELECTED,"false"),this.#y.querySelector(".iti__country-check")?.remove(),this.#y=null),t&&!this.#y){let e=this.#n.querySelector(`[data-country-code="${t}"]`);if(e){e.setAttribute(p.SELECTED,"true");let i=f("span",{class:"iti__country-check",[p.HIDDEN]:"true"},e);i.innerHTML=yt(),this.#y=e}}}#tt(t){this.#n.replaceChildren();let e=!0;for(let i of t){let s=this.#O.get(i.iso2);s&&(this.#n.appendChild(s),e&&(this.#b(s,!1),e=!1))}e?(this.#b(null,!1),this.#v&&this.#v.classList.remove(h.HIDE)):this.#v&&this.#v.classList.add(h.HIDE),this.#n.scrollTop=0,this.#$()}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.#t;this.#w.abort(),this.#w=null,this.#s.classList.add(h.HIDE),this.#e.setAttribute(p.EXPANDED,"false"),t&&(this.#l.removeAttribute(p.ACTIVE_DESCENDANT),this.#l.value="",this.#P(),this.#a&&(this.#a.classList.remove(h.HIGHLIGHT),this.#a=null)),this.#o.classList.remove(h.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="")}#k(){if(this.#t.dropdownAlwaysOpen)return!0;let t=this.telInputEl.getBoundingClientRect(),e=t.top,i=window.innerHeight-t.bottom;return i>=this.#T||i>=e}#et(){let{dropdownContainer:t,useFullscreenPopup:e}=this.#t;if(e){if(window.innerWidth>=A.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.#k()?this.#r.style.top=`${i.bottom+A.DROPDOWN_MARGIN}px`:(this.#r.style.top="unset",this.#r.style.bottom=`${window.innerHeight-i.top+A.DROPDOWN_MARGIN}px`)}t.appendChild(this.#r)}#it(){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(h.HIDE)}setLoading(t){this.#u.classList.toggle(h.LOADING,t)}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"))}isShowingGlobe(){return this.#u.classList.contains(h.GLOBE)}setCountry(t){let{allowDropdown:e,showFlags:i,separateDialCode:s,i18n:o}=this.#t,l=t?.name,r=t?.dialCode,a=t?.iso2??"";if(e&&this.#Z(a),this.#e){let c=a&&i?`${h.FLAG} iti__${a}`:`${h.FLAG} ${h.GLOBE}`,d,m,E;a?(m=l,d=o.selectedCountryAriaLabel.replace("${countryName}",l).replace("${dialCode}",`+${r}`),E=i?"":Z()):(m=o.noCountrySelected,d=o.noCountrySelected,E=Z()),this.#u.className=c,this.#e.setAttribute("title",m),this.#e.setAttribute(p.LABEL,d),this.#u.innerHTML=E}if(s){let c=r?`+${r}`:"";this.#f.textContent=c,this.#N()}}destroy(){this.telInputEl.iti=void 0,delete this.telInputEl.dataset[w.INSTANCE_ID],this.telInputEl.style.paddingLeft=this.#m;let t=this.telInputEl.parentNode;t&&(t.before(this.telInputEl),t.remove()),this.#O.clear()}};var gt=n=>{let{onlyCountries:t,excludeCountries:e}=n;return t?.length?P.filter(i=>t.includes(i.iso2)):e?.length?P.filter(i=>!e.includes(i.iso2)):[...P]},bt=(n,t)=>{let{countryNameLocale:e,i18n: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())||""},It=n=>{let t=new Set,e=0,i={},s=(l,r)=>{if(!l||!r)return;r.length>e&&(e=r.length),Object.hasOwn(i,r)||(i[r]=[]);let a=i[r];a.includes(l)||a.push(l)},o=[...n].sort((l,r)=>l.priority-r.priority);for(let l of o){t.has(l.dialCode)||t.add(l.dialCode);for(let r=1;r<l.dialCode.length;r++){let a=l.dialCode.substring(0,r);s(l.iso2,a)}if(s(l.iso2,l.dialCode),l.areaCodes){let r=i[l.dialCode][0];for(let a of l.areaCodes){for(let c=1;c<a.length;c++){let d=a.substring(0,c),m=l.dialCode+d;s(r,m),s(l.iso2,m)}s(l.iso2,l.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLength:e,dialCodeToIso2Map:i}},Lt=(n,t)=>{let{countryOrder:e}=t;n.sort((i,s)=>{if(e){let o=e.indexOf(i.iso2),l=e.indexOf(s.iso2),r=o>-1,a=l>-1;if(r||a)return r&&a?o-l:r?-1:1}return i.name.localeCompare(s.name)})},At=n=>{for(let t of n)t.normalisedName=$(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var Bt=new Set(["800","808","870","881","882","883","888","979"]),tt=n=>{let t=N(n).slice(0,3);return n.startsWith("+")&&Bt.has(t)};var et=(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)},vt=(n,t,e,i,s)=>{let o=e?e.formatNumberAsYouType(n,i?.iso2):n,l=i?.dialCode;return s&&t.charAt(0)!=="+"&&o.includes(`+${l}`)?(o.split(`+${l}`)[1]||"").trim():o};var wt=(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 Ft=new Set(["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"]),it=n=>{let t=N(n);if(t.startsWith(B.NANP)&&t.length>=4){let e=t.substring(1,4);return Ft.has(e)}return!1};var K=class{#t;constructor(t){t&&this.#i(t)}#i(t){/[\u0660-\u0669]/.test(t)?this.#t="arabic-indic":/[\u06F0-\u06F9]/.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){if(!t)return"";if(this.#i(t),this.#t==="ascii")return t;let e=this.#t==="arabic-indic"?1632:1776,i=this.#t==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return t.replace(i,s=>String.fromCharCode(48+(s.charCodeAt(0)-e)))}isAscii(){return!this.#t||this.#t==="ascii"}};var Vt=0,x=n=>{if(!u.utils)throw new Error(`intlTelInput.utils is required for ${n}(). See: https://intl-tel-input.com/docs/utils`)},Nt=()=>{let n,t;return{promise:new Promise((i,s)=>{n=i,t=s}),resolve:n,reject:t}},H=class n{id;promise;#t;#i;#D;#m;#E;#L;#T;#p;#e=null;#u=null;#f;#o=!0;#s;#h;#l;#c;constructor(t,e={}){this.id=Vt++,R.validateInput(t);let i=dt(e);this.#i={...G,...i},ht(this.#i),pt(this.#i),this.#t=new R(t,this.#i,this.id),this.#D=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),this.#h=new K(t.value),this.promise=this.#A(this.#i),this.#m=gt(this.#i);let{dialCodes:s,dialCodeMaxLength:o,dialCodeToIso2Map:l}=It(this.#m);this.#T=s,this.#E=o,this.#L=l,this.#p=new Map(this.#m.map(r=>[r.iso2,r])),this.#v()}#n(){let t=this.#t.telInputEl.value.trim();return this.#h.normalise(t)}#d(t){this.#t.telInputEl.value=this.#h.denormalise(t)}#A(t){let{initialCountry:e,geoIpLookup:i,loadUtils:s}=t,o=e===U.AUTO&&!!i,l=!!s&&!u.utils;return o&&(this.#l=Nt()),l&&(this.#c=Nt()),Promise.all([this.#l?.promise,this.#c?.promise]).then(()=>{})}#v(){this.#s=new AbortController,this.#U(),this.#t.buildMarkup(this.#m),this.#r(),this.#t.ensureDropdownWidthSet(),this.#y(),this.#a(),this.#i.dropdownAlwaysOpen&&this.#x()}#U(){bt(this.#m,this.#i),Lt(this.#m,this.#i),At(this.#m)}#r(t=!1){let e=this.#t.telInputEl.getAttribute("value"),i=this.#h.normalise(e??""),s=this.#n(),l=i&&i.startsWith("+")&&(!s||!s.startsWith("+"))?i:s,r=this.#M(l),a=it(l),{initialCountry:c,geoIpLookup:d}=this.#i,E=c===U.AUTO&&d&&!t,I=O(c);r?a?I?this.#C(c):E||this.#C(nt.ISO2):this.#S(l):I?this.#C(c):E||this.#C(""),l&&this.#N(l)}#y(){this.#j(),this.#i.allowDropdown&&this.#t.bindAllInitialDropdownListeners(this.#s.signal,()=>this.#x(),()=>this.#g()),this.#t.bindHiddenInputSubmitListener(this.#s.signal,()=>this.getNumber(),()=>this.#e?.iso2||"")}#a(){if(this.#c){let{loadUtils:t}=this.#i,e=()=>{u.attachUtils(t)?.catch(()=>{})};u.documentReady()?e():window.addEventListener("load",e,{signal:this.#s.signal})}this.#l&&(this.#e?this.#l.resolve():this.#O())}#O(){if(u.autoCountry){this.#G();return}if(this.#t.setLoading(!0),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.#i.geoIpLookup=="function")){let t=(i="")=>{this.#t.setLoading(!1);let s=i.toLowerCase();O(s)?(u.autoCountry=s,setTimeout(()=>n.forEachInstance("handleAutoCountryLoaded"))):n.forEachInstance("handleAutoCountryFailure")},e=()=>{this.#t.setLoading(!1),n.forEachInstance("handleAutoCountryFailure")};this.#i.geoIpLookup(t,e)}}#w(){this.#x(),this.#t.prefillSearchWithPlus()}#j(){this.#K(),this.#Y(),this.#z()}#K(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,allowDropdown:s,countrySearch:o}=this.#i,l=!1;v.ALPHA_UNICODE.test(this.#n())&&(l=!0);let r=a=>{let c=this.#n();if(this.#D&&a?.data==="+"&&i&&s&&o){let y=this.#t.telInputEl.selectionStart||0,_=c.substring(0,y-1),D=c.substring(y);this.#d(_+D),this.#w();return}this.#S(c)&&this.#R();let d=a?.data&&v.NON_PLUS_NUMERIC.test(a.data),m=a?.inputType===X.PASTE&&c;d||m&&!t?l=!0:v.NON_PLUS_NUMERIC.test(c)||(l=!1);let E=a?.detail&&a.detail.isSetNumber,I=this.#h.isAscii();if(e&&!l&&!E&&I){let y=this.#t.telInputEl.selectionStart||0,D=c.substring(0,y).replace(v.NON_PLUS_NUMERIC_GLOBAL,"").length,S=a?.inputType===X.DELETE_FORWARD,g=this.#I(),T=vt(g,c,u.utils,this.#e,i),L=wt(D,T,y,S);this.#d(T),this.#t.telInputEl.setSelectionRange(L,L)}if(i&&c.startsWith("+")&&this.#e?.dialCode){let y=et(c,!0,i,this.#e);this.#d(y)}};this.#t.telInputEl.addEventListener("input",r,{signal:this.#s.signal})}#Y(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:s}=this.#i;if(!t&&!e)return;let o=l=>{if(!l.key||l.key.length!==1||l.altKey||l.ctrlKey||l.metaKey)return;if(e&&i&&s&&l.key==="+"){l.preventDefault(),this.#w();return}if(!t)return;let r=this.#n(),c=!r.startsWith("+")&&this.#t.telInputEl.selectionStart===0&&l.key==="+",d=this.#h.normalise(l.key),m=/^[0-9]$/.test(d),E=e?m:c||m,I=this.#t.telInputEl,y=I.selectionStart,_=I.selectionEnd,D=r.slice(0,y??void 0),S=r.slice(_??void 0),g=D+d+S,T=this.#B(g),L=!1;u.utils&&this.#u&&(L=u.utils.getCoreNumber(T,this.#e?.iso2).length>this.#u);let Dt=this.#W(T)!==null;(!E||L&&!Dt&&!c)&&l.preventDefault()};this.#t.telInputEl.addEventListener("keydown",o,{signal:this.#s.signal})}#z(){if(!this.#i.strictMode)return;let t=e=>{e.preventDefault();let i=this.#t.telInputEl,s=i.selectionStart,o=i.selectionEnd,l=this.#n(),r=l.slice(0,s??void 0),a=l.slice(o??void 0),c=this.#e?.iso2,d=e.clipboardData.getData("text"),m=this.#h.normalise(d),E=s===0&&o>0,I=!l.startsWith("+")||E,y=m.replace(v.NON_PLUS_NUMERIC_GLOBAL,""),_=y.startsWith("+"),D=y.replace(/\+/g,""),S=_&&I?`+${D}`:D,g=r+S+a;if(g.length>5&&u.utils){let L=u.utils.getCoreNumber(g,c);for(;L.length===0&&g.length>0;)g=g.slice(0,-1),L=u.utils.getCoreNumber(g,c);if(!L)return;if(this.#u&&L.length>this.#u)if(i.selectionEnd===l.length){let st=L.length-this.#u;g=g.slice(0,g.length-st)}else return}this.#d(g);let T=s+S.length;i.setSelectionRange(T,T),i.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.#t.telInputEl.addEventListener("paste",t,{signal:this.#s.signal})}#X(t){let e=Number(this.#t.telInputEl.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}#_(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.#t.telInputEl.dispatchEvent(i)}#x(){this.#t.openDropdown(t=>this.#Q(t),()=>this.#g()),this.#_(k.OPEN_COUNTRY_DROPDOWN)}#N(t){let{formatOnDisplay:e,nationalMode:i,separateDialCode:s}=this.#i,o=t;if(e&&u.utils&&this.#e){let l=tt(t),r=i&&!l||!o.startsWith("+")&&!s,{NATIONAL:a,INTERNATIONAL:c}=u.utils.numberFormat,d=r?a:c;o=u.utils.formatNumber(o,this.#e?.iso2,d)}o=this.#F(o),this.#d(o)}#S(t){let e=this.#W(t);return e!==null?this.#C(e):!1}#q(t){let e=this.#e?.dialCode,i=this.#e?.nationalPrefix;if(t.startsWith("+")||!e)return t;let l=i&&t.startsWith(i)&&!this.#i.separateDialCode?t.substring(1):t;return`+${e}${l}`}#W(t){let e=t.indexOf("+"),i=e>0?t.substring(e):t,s=this.#e?.iso2;i=this.#q(i);let o=this.#M(i,!0),l=N(i);if(o){let r=N(o),a=this.#L[r];return a.length===1?a[0]===s?null:a[0]:this.#$(a,r,l)}else if(i.startsWith("+")&&l.length){let r=this.#e?.dialCode||"";return r&&r.startsWith(l)?null:""}else if((!i||i==="+")&&!s&&this.#f)return this.#f;return null}#$(t,e,i){let s=this.#e?.iso2,o=this.#e?.dialCode;if(!s&&this.#f&&t.includes(this.#f))return this.#f;if(o===B.NANP&&it(i))return null;let r=this.#e?.areaCodes,a=this.#e?.priority;if(r){let I=r.map(y=>`${o}${y}`);for(let y of I)if(i.startsWith(y))return null}let d=r&&!(a===0)&&i.length>e.length,m=s&&t.includes(s)&&!d,E=s===t[0];return!m&&!E?t[0]:null}#C(t){let e=this.#e?.iso2||"";return this.#e=t?this.#p.get(t):null,this.#e&&(this.#f=this.#e.iso2),this.#t.setCountry(this.#e),this.#H(),this.#P(),e!==t}#P(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.#i;if(!t||!u.utils)return;let s=this.#e?.iso2;if(!s){this.#u=null;return}let o=u.utils.numberType[e],l=u.utils.getExampleNumber(s,!1,o,!0),r=l;for(;u.utils.isPossibleNumber(l,s,i);)r=l,l+="0";let a=u.utils.getCoreNumber(r,s);this.#u=a.length,s==="by"&&(this.#u=a.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 l=u.utils.numberType[e],r=this.#e?u.utils.getExampleNumber(this.#e.iso2,i,l):"";r=this.#F(r),typeof s=="function"&&(r=s(r,this.#e)),this.#t.telInputEl.setAttribute("placeholder",r)}#Q(t){if(!t)return;let e=t.dataset[w.ISO2],i=this.#C(e);this.#g();let s=t.dataset[w.DIAL_CODE];if(this.#b(s),this.#i.formatOnDisplay){let o=this.#n();this.#N(o)}this.#t.telInputEl.focus(),i&&this.#R()}#g(t){!this.#t.isDropdownOpen()||this.#i.dropdownAlwaysOpen&&!t||(this.#t.closeDropdown(),this.#_(k.CLOSE_COUNTRY_DROPDOWN))}#b(t){let e=this.#n();if(!e.startsWith("+"))return;let i=`+${t}`,s=this.#M(e),o;s?o=e.replace(s,i):o=i,this.#d(o)}#M(t,e){if(!t.startsWith("+"))return"";let i="",s="",o=!1;for(let l=0;l<t.length;l++){let r=t.charAt(l);if(!/[0-9]/.test(r))continue;if(s+=r,!!!this.#L[s])break;if(this.#T.has(s)){if(i=t.substring(0,l+1),o=!0,!e)break}else e&&o&&(i=t.substring(0,l+1));if(s.length===this.#E)break}return i}#B(t){let e=this.#e?.dialCode,i=N(t);return(this.#i.separateDialCode&&!t.startsWith("+")&&e&&i?`+${e}`:"")+t}#I(){let t=this.#n();return this.#B(t)}#F(t){let e=!!this.#M(t),i=et(t,e,this.#i.separateDialCode,this.#e);return this.#X(i)}#V(){let t=this.#e;if(!t)return null;let{iso2:e,dialCode:i,name:s}=t;return{iso2:e,dialCode:i,name:s}}#R(){let t=this.#V();this.#_(k.COUNTRY_CHANGE,t)}#G(){if(!this.#l||!u.autoCountry)return;if(!this.#o){this.#l.resolve();return}this.#f=u.autoCountry,this.#e||this.#t.isShowingGlobe()||this.setCountry(this.#f),this.#l.resolve()}#J(){if(!this.#o){this.#l?.reject();return}this.#r(!0),this.#l?.reject()}#Z(){if(!this.#o){this.#c?.resolve();return}if(!u.utils){this.#c?.resolve();return}let t=this.#n();t&&this.#N(t),this.#e&&(this.#H(),this.#P()),this.#c?.resolve()}#tt(t){if(!this.#o){this.#c?.reject(t);return}this.#c?.reject(t)}destroy(){this.#o&&(this.#o=!1,this.#i.allowDropdown&&this.#g(!0),this.#s.abort(),this.#t.destroy(),u.instances.delete(String(this.id)))}isActive(){return this.#o}getExtension(){return this.#o?(x("getExtension"),u.utils.getExtension(this.#I(),this.#e?.iso2)):""}getNumber(t){if(!this.#o)return"";x("getNumber");let e=this.#e?.iso2,i=this.#I(),s=u.utils.formatNumber(i,e,t);return this.#h.denormalise(s)}getNumberType(){return this.#o?(x("getNumberType"),u.utils.getNumberType(this.#I(),this.#e?.iso2)):Q.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.#V()}getValidationError(){if(!this.#o)return Q.UNKNOWN_VALIDATION_ERROR;x("getValidationError");let t=this.#e?.iso2;return u.utils.getValidationError(this.#I(),t)}isValidNumber(){if(!this.#o)return null;x("isValidNumber");let t=this.#e?.dialCode,e=this.#e?.iso2,i=this.#I(),s=u.utils.getCoreNumber(i,e);if(s){if(t===F.DIAL_CODE&&s[0]===F.MOBILE_PREFIX&&s.length!==F.MOBILE_CORE_LENGTH)return!1;if(!v.ALPHA_UNICODE.test(i)&&t){let l=i.startsWith("+")?i.slice(1+t.length):i,r=N(l).length;if(s.length>r)return!1}}return this.#k("possible")}isValidNumberPrecise(){return this.#o?(x("isValidNumberPrecise"),this.#k("precise")):null}#k(t){let{allowNumberExtensions:e,allowPhonewords:i,allowedNumberTypes:s}=this.#i,o=this.#e?.iso2,l=this.#I();return!this.#e&&!tt(l)||!(t==="precise"?u.utils.isValidNumber:u.utils.isPossibleNumber)(l,o,s)?!1:v.ALPHA_UNICODE.test(l)?!!u.utils.getExtension(l,o)?e:i:!0}setCountry(t){if(!this.#o)return;let e=t?.toLowerCase();if(!O(e))throw new Error(`Invalid iso2 code: '${e}'`);let i=this.#e?.iso2;if(t&&e!==i||!t&&i){if(this.#C(e),this.#b(this.#e?.dialCode||""),this.#i.formatOnDisplay){let o=this.#n();this.#N(o)}this.#R()}}setNumber(t){if(!this.#o)return;let e=this.#h.normalise(t),i=this.#S(e);this.#N(e),i&&this.#R(),this.#_(k.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.#Z();break;case"handleUtilsFailure":o.#tt(s);break;case"handleAutoCountryLoaded":o.#G();break;case"handleAutoCountryFailure":o.#J();break}})}},Gt=n=>{if(!u.utils&&!u.startedLoadingUtils){let t;if(typeof n=="function")try{t=Promise.resolve(n())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof n}`));return u.startedLoadingUtils=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="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=i,H.forEachInstance("handleUtilsLoaded"),!0}).catch(e=>{throw H.forEachInstance("handleUtilsFailure",e),e})}return null},u=Object.assign((n,t)=>{let e=new H(n,t);return u.instances.set(String(e.id),e),n.iti=e,e},{defaults:G,documentReady:()=>document.readyState==="complete",getCountryData:()=>P,getInstance:n=>{let t=n.dataset[w.INSTANCE_ID];return t?u.instances.get(t)??null:null},instances:new Map,attachUtils:Gt,startedLoadingUtils:!1,startedLoadingAutoCountry:!1,version:"27.0.16"}),jt=u;return Mt(Kt);})();
|
|
24
|
+
</svg>`;var Ct=(n,t)=>{let e=$(t),i=[],s=[],o=[],l=[],r=[],a=[];for(let d of n)d.iso2===e?i.push(d):d.normalisedName.startsWith(e)?s.push(d):d.normalisedName.includes(e)?o.push(d):e===d.dialCode||e===d.dialCodePlus?l.push(d):d.dialCodePlus.includes(e)?r.push(d):d.initials.includes(e)&&a.push(d);let c=(d,m)=>d.priority-m.priority;return[...i,...s,...o,...l.sort(c),...r.sort(c),...a]},Et=(n,t)=>{let e=$(t);for(let i of n)if(i.normalisedName.startsWith(e))return i;return null};var R=class n{#t;#i;#D;#m="";#E;#L=null;#T;#p;#e;#u;#f;#o;#s;#h;#l;#c;#n;#d;#A;#v;#U;#r;#y=null;#a=null;#O=new Map;#w=null;telInputEl;hadInitialPlaceholder;constructor(t,e,i){t.dataset[w.INSTANCE_ID]=i.toString(),this.telInputEl=t,this.#t=e,this.#i=i,this.hadInitialPlaceholder=!!t.getAttribute("placeholder"),this.#D=!!this.telInputEl.closest("[dir=rtl]"),this.#m=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){this.#E=t,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 e=this.#j();this.#K(e),e.appendChild(this.telInputEl),this.#X(),this.#_(e)}#j(){let{allowDropdown:t,showFlags:e,containerClass:i,useFullscreenPopup:s}=this.#t,o=j({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!s,[i]:!!i}),l=f("div",{class:o});return this.#D&&l.setAttribute("dir","ltr"),this.telInputEl.before(l),l}#K(t){let{allowDropdown:e,separateDialCode:i,showFlags:s}=this.#t;if(!e&&!s&&!i)return;this.#p=f("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.#e=f("button",{type:"button",class:"iti__selected-country",[p.EXPANDED]:"false",[p.LABEL]:this.#t.i18n.noCountrySelected,[p.HASPOPUP]:"dialog",[p.CONTROLS]:`iti-${this.#i}__dropdown-content`},this.#p),this.telInputEl.disabled&&this.#e.setAttribute("disabled","true")):this.#e=f("div",{class:"iti__selected-country"},this.#p);let o=f("div",{class:"iti__selected-country-primary"},this.#e);this.#u=f("div",{class:h.FLAG},o),e&&(this.#o=f("div",{class:"iti__arrow",[p.HIDDEN]:"true"},o)),i&&(this.#f=f("div",{class:"iti__selected-dial-code"},this.#e)),e&&this.#Y()}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`)}#Y(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:i,i18n:s,dropdownContainer:o,containerClass:l}=this.#t,r=t?"":"iti--flexible-dropdown-width";if(this.#s=f("div",{id:`iti-${this.#i}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${r}`,role:"dialog",[p.MODAL]:"true"}),this.#D&&this.#s.setAttribute("dir","rtl"),i&&this.#z(),this.#n=f("ul",{class:"iti__country-list",id:`iti-${this.#i}__country-listbox`,role:"listbox",[p.LABEL]:s.countryListAriaLabel},this.#s),this.#x(),i&&this.#$(),e||(this.#T=this.#W(),i&&(this.#s.style.height=`${this.#T}px`)),o){let a=j({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[l]:!!l});this.#r=f("div",{class:a}),this.#r.appendChild(this.#s)}else this.#p.appendChild(this.#s)}#z(){let{i18n:t,searchInputClass:e}=this.#t,i=f("div",{class:"iti__search-input-wrapper"},this.#s);this.#h=f("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},i),this.#h.innerHTML=ft(),this.#l=f("input",{id:`iti-${this.#i}__search-input`,type:"search",class:`iti__search-input ${e}`,placeholder:t.searchPlaceholder,role:"combobox",[p.EXPANDED]:"true",[p.LABEL]:t.searchPlaceholder,[p.CONTROLS]:`iti-${this.#i}__country-listbox`,[p.AUTOCOMPLETE]:"list",autocomplete:"off"},i),this.#c=f("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},i),this.#c.innerHTML=mt(this.#i),this.#U=f("span",{class:"iti__a11y-text"},this.#s),this.#v=f("div",{class:`iti__no-results ${h.HIDE}`,[p.HIDDEN]:"true"},this.#s),this.#v.textContent=t.searchEmptyState??null}#X(){this.#p&&(this.#N(),this.#p.classList.remove(h.V_HIDE))}#_(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.#d=o:(this.#d=f("input",{type:"hidden",name:s.phone}),t.appendChild(this.#d))}if(s.country){let o=this.telInputEl.form?.querySelector(`input[name="${s.country}"]`);o?this.#A=o:(this.#A=f("input",{type:"hidden",name:s.country}),t.appendChild(this.#A))}}#x(){let t=document.createDocumentFragment();for(let e=0;e<this.#E.length;e++){let i=this.#E[e],s=j({[h.COUNTRY_ITEM]:!0}),o=f("li",{id:`iti-${this.#i}__item-${i.iso2}`,class:s,tabindex:"-1",role:"option",[p.SELECTED]:"false"});o.dataset[w.DIAL_CODE]=i.dialCode,o.dataset[w.ISO2]=i.iso2,this.#O.set(i.iso2,o),this.#t.showFlags&&f("div",{class:`${h.FLAG} iti__${i.iso2}`},o);let l=f("span",{class:"iti__country-name"},o);l.textContent=`${i.name} `;let r=f("span",{class:"iti__dial-code"},l);this.#D&&r.setAttribute("dir","ltr"),r.textContent=`(+${i.dialCode})`,t.appendChild(o)}this.#n.appendChild(t)}#N(){if(this.#e){let t=this.#t.separateDialCode?A.FALLBACK_SELECTED_WITH_DIAL_WIDTH:A.FALLBACK_SELECTED_NO_DIAL_WIDTH,i=(this.#e.offsetWidth||this.#q()||t)+A.INPUT_PADDING_EXTRA_LEFT;this.telInputEl.style.paddingLeft=`${i}px`}}static#S(){let t;try{t=window.top.document.body}catch{t=document.body}return t}#q(){if(!this.telInputEl.parentNode)return 0;let t=n.#S(),e=this.telInputEl.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let i=this.#p.cloneNode();e.appendChild(i);let s=this.#e.cloneNode(!0);i.appendChild(s);let o=s.offsetWidth;return t.removeChild(e),o}#W(){let t=n.#S();this.#s.classList.remove(h.HIDE);let e=f("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(h.HIDE),i>0?i:A.FALLBACK_DROPDOWN_HEIGHT}#$(){let{i18n:t}=this.#t,e=this.#n.childElementCount;this.#U.textContent=t.searchSummaryAria(e)}#C(t){let e;t===""?e=this.#E:e=Ct(this.#E,t),this.#tt(e)}prefillSearchWithPlus(){this.#l.value="+",this.#C("")}#P(){let t=this.#l.value.trim();this.#C(t),this.#l.value?this.#c.classList.remove(h.HIDE):this.#c.classList.add(h.HIDE)}#H(){this.#L&&clearTimeout(this.#L),this.#L=setTimeout(()=>{this.#P(),this.#L=null},q.SEARCH_DEBOUNCE_MS)}#Q(){this.#l.value="",this.#l.focus(),this.#P()}#g(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)}#b(t,e){let i=this.#a;if(i&&i.classList.remove(h.HIGHLIGHT),this.#a=t,this.#a){if(this.#a.classList.add(h.HIGHLIGHT),this.#t.countrySearch){let s=this.#a.getAttribute("id")||"";this.#l.setAttribute(p.ACTIVE_DESCENDANT,s)}e&&this.#a.focus()}}bindHiddenInputSubmitListener(t,e,i){let s=this.telInputEl.form;!s||!this.#d&&!this.#A||s.addEventListener("submit",()=>{this.#d&&(this.#d.value=e()),this.#A&&(this.#A.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.#p.addEventListener("keydown",o=>{let l=[C.ARROW_UP,C.ARROW_DOWN,C.SPACE,C.ENTER];!this.isDropdownOpen()&&l.includes(o.key)&&(o.preventDefault(),o.stopPropagation(),e()),o.key===C.TAB&&i()},{signal:t})}openDropdown(t,e){let{countrySearch:i,dropdownAlwaysOpen:s,dropdownContainer:o}=this.#t;if(this.#w=new AbortController,this.ensureDropdownWidthSet(),o)this.#et();else{let r=this.#k(),a=this.telInputEl.offsetHeight+A.DROPDOWN_MARGIN;r?this.#s.style.top=`${a}px`:this.#s.style.bottom=`${a}px`}this.#s.classList.remove(h.HIDE),this.#e.setAttribute(p.EXPANDED,"true");let l=this.#y??this.#n.firstElementChild;l&&(this.#b(l,!1),this.#g(l)),i&&!s&&this.#l.focus(),this.#t.useFullscreenPopup&&this.#r&&window.visualViewport&&window.visualViewport.addEventListener("resize",()=>{this.#it(),this.#a&&this.#g(this.#a)},{signal:this.#w.signal}),this.#o.classList.add(h.ARROW_UP),this.#M(t,e)}#M(t,e){let i=this.#w.signal;this.#B(i),this.#I(i,t),this.#t.dropdownAlwaysOpen||this.#F(i,e),this.#V(i,t,e),this.#t.countrySearch&&this.#R(i),!this.#t.useFullscreenPopup&&this.#t.dropdownContainer&&window.addEventListener("scroll",e,{signal:i})}#B(t){this.#n.addEventListener("mouseover",e=>{let i=e.target?.closest(`.${h.COUNTRY_ITEM}`);i&&this.#b(i,!1)},{signal:t})}#I(t,e){this.#n.addEventListener("click",i=>{let s=i.target?.closest(`.${h.COUNTRY_ITEM}`);s&&e(s)},{signal:t})}#F(t,e){setTimeout(()=>{document.documentElement.addEventListener("click",i=>{this.#s.contains(i.target)||e()},{signal:t})},0)}#V(t,e,i){let s="",o=null,l=r=>{[C.ARROW_UP,C.ARROW_DOWN,C.ENTER,C.ESC].includes(r.key)&&(r.preventDefault(),r.stopPropagation(),r.key===C.ARROW_UP||r.key===C.ARROW_DOWN?this.#J(r.key):r.key===C.ENTER&&!r.isComposing?e(this.#a):r.key===C.ESC&&(i(),this.#e.focus())),!this.#t.countrySearch&&v.HIDDEN_SEARCH_CHAR.test(r.key)&&(r.stopPropagation(),o&&clearTimeout(o),s+=r.key.toLowerCase(),this.#G(s),o=setTimeout(()=>{s=""},q.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",l,{signal:t})}#R(t){this.#l.addEventListener("input",()=>this.#H(),{signal:t}),this.#c.addEventListener("click",()=>this.#Q(),{signal:t})}#G(t){let e=Et(this.#E,t);if(e){let i=this.#O.get(e.iso2);this.#b(i,!1),this.#g(i)}}#J(t){let e=t===C.ARROW_UP?this.#a?.previousElementSibling:this.#a?.nextElementSibling;!e&&this.#n.childElementCount>1&&(e=t===C.ARROW_UP?this.#n.lastElementChild:this.#n.firstElementChild),e&&(this.#g(e),this.#b(e,!1))}#Z(t){if(this.#y&&this.#y.dataset[w.ISO2]!==t&&(this.#y.setAttribute(p.SELECTED,"false"),this.#y.querySelector(".iti__country-check")?.remove(),this.#y=null),t&&!this.#y){let e=this.#n.querySelector(`[data-country-code="${t}"]`);if(e){e.setAttribute(p.SELECTED,"true");let i=f("span",{class:"iti__country-check",[p.HIDDEN]:"true"},e);i.innerHTML=yt(),this.#y=e}}}#tt(t){this.#n.replaceChildren();let e=!0;for(let i of t){let s=this.#O.get(i.iso2);s&&(this.#n.appendChild(s),e&&(this.#b(s,!1),e=!1))}e?(this.#b(null,!1),this.#v&&this.#v.classList.remove(h.HIDE)):this.#v&&this.#v.classList.add(h.HIDE),this.#n.scrollTop=0,this.#$()}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.#t;this.#w.abort(),this.#w=null,this.#s.classList.add(h.HIDE),this.#e.setAttribute(p.EXPANDED,"false"),t&&(this.#l.removeAttribute(p.ACTIVE_DESCENDANT),this.#l.value="",this.#P(),this.#a&&(this.#a.classList.remove(h.HIGHLIGHT),this.#a=null)),this.#o.classList.remove(h.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="")}#k(){if(this.#t.dropdownAlwaysOpen)return!0;let t=this.telInputEl.getBoundingClientRect(),e=t.top,i=window.innerHeight-t.bottom;return i>=this.#T||i>=e}#et(){let{dropdownContainer:t,useFullscreenPopup:e}=this.#t;if(e){if(window.innerWidth>=A.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.#k()?this.#r.style.top=`${i.bottom+A.DROPDOWN_MARGIN}px`:(this.#r.style.top="unset",this.#r.style.bottom=`${window.innerHeight-i.top+A.DROPDOWN_MARGIN}px`)}t.appendChild(this.#r)}#it(){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(h.HIDE)}setLoading(t){this.#u.classList.toggle(h.LOADING,t)}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"))}isShowingGlobe(){return this.#u.classList.contains(h.GLOBE)}setCountry(t){let{allowDropdown:e,showFlags:i,separateDialCode:s,i18n:o}=this.#t,l=t?.name,r=t?.dialCode,a=t?.iso2??"";if(e&&this.#Z(a),this.#e){let c=a&&i?`${h.FLAG} iti__${a}`:`${h.FLAG} ${h.GLOBE}`,d,m,E;a?(m=l,d=o.selectedCountryAriaLabel.replace("${countryName}",l).replace("${dialCode}",`+${r}`),E=i?"":Z()):(m=o.noCountrySelected,d=o.noCountrySelected,E=Z()),this.#u.className=c,this.#e.setAttribute("title",m),this.#e.setAttribute(p.LABEL,d),this.#u.innerHTML=E}if(s){let c=r?`+${r}`:"";this.#f.textContent=c,this.#N()}}destroy(){this.telInputEl.iti=void 0,delete this.telInputEl.dataset[w.INSTANCE_ID],this.telInputEl.style.paddingLeft=this.#m;let t=this.telInputEl.parentNode;t&&(t.before(this.telInputEl),t.remove()),this.#O.clear()}};var gt=n=>{let{onlyCountries:t,excludeCountries:e}=n;return t?.length?P.filter(i=>t.includes(i.iso2)):e?.length?P.filter(i=>!e.includes(i.iso2)):[...P]},bt=(n,t)=>{let{countryNameLocale:e,i18n: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())||""},It=n=>{let t=new Set,e=0,i={},s=(l,r)=>{if(!l||!r)return;r.length>e&&(e=r.length),Object.hasOwn(i,r)||(i[r]=[]);let a=i[r];a.includes(l)||a.push(l)},o=[...n].sort((l,r)=>l.priority-r.priority);for(let l of o){t.has(l.dialCode)||t.add(l.dialCode);for(let r=1;r<l.dialCode.length;r++){let a=l.dialCode.substring(0,r);s(l.iso2,a)}if(s(l.iso2,l.dialCode),l.areaCodes){let r=i[l.dialCode][0];for(let a of l.areaCodes){for(let c=1;c<a.length;c++){let d=a.substring(0,c),m=l.dialCode+d;s(r,m),s(l.iso2,m)}s(l.iso2,l.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLength:e,dialCodeToIso2Map:i}},Lt=(n,t)=>{let{countryOrder:e}=t;n.sort((i,s)=>{if(e){let o=e.indexOf(i.iso2),l=e.indexOf(s.iso2),r=o>-1,a=l>-1;if(r||a)return r&&a?o-l:r?-1:1}return i.name.localeCompare(s.name)})},At=n=>{for(let t of n)t.normalisedName=$(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var Bt=new Set(["800","808","870","881","882","883","888","979"]),tt=n=>{let t=N(n).slice(0,3);return n.startsWith("+")&&Bt.has(t)};var et=(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)},vt=(n,t,e,i,s)=>{let o=e?e.formatNumberAsYouType(n,i?.iso2):n,l=i?.dialCode;return s&&t.charAt(0)!=="+"&&o.includes(`+${l}`)?(o.split(`+${l}`)[1]||"").trim():o};var wt=(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 Ft=new Set(["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"]),it=n=>{let t=N(n);if(t.startsWith(B.NANP)&&t.length>=4){let e=t.substring(1,4);return Ft.has(e)}return!1};var K=class{#t;constructor(t){t&&this.#i(t)}#i(t){/[\u0660-\u0669]/.test(t)?this.#t="arabic-indic":/[\u06F0-\u06F9]/.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){if(!t)return"";if(this.#i(t),this.#t==="ascii")return t;let e=this.#t==="arabic-indic"?1632:1776,i=this.#t==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return t.replace(i,s=>String.fromCharCode(48+(s.charCodeAt(0)-e)))}isAscii(){return!this.#t||this.#t==="ascii"}};var Vt=0,x=n=>{if(!u.utils)throw new Error(`intlTelInput.utils is required for ${n}(). See: https://intl-tel-input.com/docs/utils`)},Nt=()=>{let n,t;return{promise:new Promise((i,s)=>{n=i,t=s}),resolve:n,reject:t}},H=class n{id;promise;#t;#i;#D;#m;#E;#L;#T;#p;#e=null;#u=null;#f;#o=!0;#s;#h;#l;#c;constructor(t,e={}){this.id=Vt++,R.validateInput(t);let i=dt(e);this.#i={...G,...i},ht(this.#i),pt(this.#i),this.#t=new R(t,this.#i,this.id),this.#D=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),this.#h=new K(t.value),this.promise=this.#A(this.#i),this.#m=gt(this.#i);let{dialCodes:s,dialCodeMaxLength:o,dialCodeToIso2Map:l}=It(this.#m);this.#T=s,this.#E=o,this.#L=l,this.#p=new Map(this.#m.map(r=>[r.iso2,r])),this.#v()}#n(){let t=this.#t.telInputEl.value.trim();return this.#h.normalise(t)}#d(t){this.#t.telInputEl.value=this.#h.denormalise(t)}#A(t){let{initialCountry:e,geoIpLookup:i,loadUtils:s}=t,o=e===U.AUTO&&!!i,l=!!s&&!u.utils;return o&&(this.#l=Nt()),l&&(this.#c=Nt()),Promise.all([this.#l?.promise,this.#c?.promise]).then(()=>{})}#v(){this.#s=new AbortController,this.#U(),this.#t.buildMarkup(this.#m),this.#r(),this.#t.ensureDropdownWidthSet(),this.#y(),this.#a(),this.#i.dropdownAlwaysOpen&&this.#x()}#U(){bt(this.#m,this.#i),Lt(this.#m,this.#i),At(this.#m)}#r(t=!1){let e=this.#t.telInputEl.getAttribute("value"),i=this.#h.normalise(e??""),s=this.#n(),l=i&&i.startsWith("+")&&(!s||!s.startsWith("+"))?i:s,r=this.#M(l),a=it(l),{initialCountry:c,geoIpLookup:d}=this.#i,E=c===U.AUTO&&d&&!t,I=O(c);r?a?I?this.#C(c):E||this.#C(nt.ISO2):this.#S(l):I?this.#C(c):E||this.#C(""),l&&this.#N(l)}#y(){this.#j(),this.#i.allowDropdown&&this.#t.bindAllInitialDropdownListeners(this.#s.signal,()=>this.#x(),()=>this.#g()),this.#t.bindHiddenInputSubmitListener(this.#s.signal,()=>this.getNumber(),()=>this.#e?.iso2||"")}#a(){if(this.#c){let{loadUtils:t}=this.#i,e=()=>{u.attachUtils(t)?.catch(()=>{})};u.documentReady()?e():window.addEventListener("load",e,{signal:this.#s.signal})}this.#l&&(this.#e?this.#l.resolve():this.#O())}#O(){if(u.autoCountry){this.#G();return}if(this.#t.setLoading(!0),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.#i.geoIpLookup=="function")){let t=(i="")=>{this.#t.setLoading(!1);let s=i.toLowerCase();O(s)?(u.autoCountry=s,setTimeout(()=>n.forEachInstance("handleAutoCountryLoaded"))):n.forEachInstance("handleAutoCountryFailure")},e=()=>{this.#t.setLoading(!1),n.forEachInstance("handleAutoCountryFailure")};this.#i.geoIpLookup(t,e)}}#w(){this.#x(),this.#t.prefillSearchWithPlus()}#j(){this.#K(),this.#Y(),this.#z()}#K(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,allowDropdown:s,countrySearch:o}=this.#i,l=!1;v.ALPHA_UNICODE.test(this.#n())&&(l=!0);let r=a=>{let c=this.#n();if(this.#D&&a?.data==="+"&&i&&s&&o){let y=this.#t.telInputEl.selectionStart||0,_=c.substring(0,y-1),D=c.substring(y);this.#d(_+D),this.#w();return}this.#S(c)&&this.#R();let d=a?.data&&v.NON_PLUS_NUMERIC.test(a.data),m=a?.inputType===X.PASTE&&c;d||m&&!t?l=!0:v.NON_PLUS_NUMERIC.test(c)||(l=!1);let E=a?.detail&&a.detail.isSetNumber,I=this.#h.isAscii();if(e&&!l&&!E&&I){let y=this.#t.telInputEl.selectionStart||0,D=c.substring(0,y).replace(v.NON_PLUS_NUMERIC_GLOBAL,"").length,S=a?.inputType===X.DELETE_FORWARD,g=this.#I(),T=vt(g,c,u.utils,this.#e,i),L=wt(D,T,y,S);this.#d(T),this.#t.telInputEl.setSelectionRange(L,L)}if(i&&c.startsWith("+")&&this.#e?.dialCode){let y=et(c,!0,i,this.#e);this.#d(y)}};this.#t.telInputEl.addEventListener("input",r,{signal:this.#s.signal})}#Y(){let{strictMode:t,separateDialCode:e,allowDropdown:i,countrySearch:s}=this.#i;if(!t&&!e)return;let o=l=>{if(!l.key||l.key.length!==1||l.altKey||l.ctrlKey||l.metaKey)return;if(e&&i&&s&&l.key==="+"){l.preventDefault(),this.#w();return}if(!t)return;let r=this.#n(),c=!r.startsWith("+")&&this.#t.telInputEl.selectionStart===0&&l.key==="+",d=this.#h.normalise(l.key),m=/^[0-9]$/.test(d),E=e?m:c||m,I=this.#t.telInputEl,y=I.selectionStart,_=I.selectionEnd,D=r.slice(0,y??void 0),S=r.slice(_??void 0),g=D+d+S,T=this.#B(g),L=!1;u.utils&&this.#u&&(L=u.utils.getCoreNumber(T,this.#e?.iso2).length>this.#u);let Dt=this.#W(T)!==null;(!E||L&&!Dt&&!c)&&l.preventDefault()};this.#t.telInputEl.addEventListener("keydown",o,{signal:this.#s.signal})}#z(){if(!this.#i.strictMode)return;let t=e=>{e.preventDefault();let i=this.#t.telInputEl,s=i.selectionStart,o=i.selectionEnd,l=this.#n(),r=l.slice(0,s??void 0),a=l.slice(o??void 0),c=this.#e?.iso2,d=e.clipboardData.getData("text"),m=this.#h.normalise(d),E=s===0&&o>0,I=!l.startsWith("+")||E,y=m.replace(v.NON_PLUS_NUMERIC_GLOBAL,""),_=y.startsWith("+"),D=y.replace(/\+/g,""),S=_&&I?`+${D}`:D,g=r+S+a;if(g.length>5&&u.utils){let L=u.utils.getCoreNumber(g,c);for(;L.length===0&&g.length>0;)g=g.slice(0,-1),L=u.utils.getCoreNumber(g,c);if(!L)return;if(this.#u&&L.length>this.#u)if(i.selectionEnd===l.length){let st=L.length-this.#u;g=g.slice(0,g.length-st)}else return}this.#d(g);let T=s+S.length;i.setSelectionRange(T,T),i.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.#t.telInputEl.addEventListener("paste",t,{signal:this.#s.signal})}#X(t){let e=Number(this.#t.telInputEl.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}#_(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.#t.telInputEl.dispatchEvent(i)}#x(){this.#t.openDropdown(t=>this.#Q(t),()=>this.#g()),this.#_(k.OPEN_COUNTRY_DROPDOWN)}#N(t){let{formatOnDisplay:e,nationalMode:i,separateDialCode:s}=this.#i,o=t;if(e&&u.utils&&this.#e){let l=tt(t),r=i&&!l||!o.startsWith("+")&&!s,{NATIONAL:a,INTERNATIONAL:c}=u.utils.numberFormat,d=r?a:c;o=u.utils.formatNumber(o,this.#e?.iso2,d)}o=this.#F(o),this.#d(o)}#S(t){let e=this.#W(t);return e!==null?this.#C(e):!1}#q(t){let e=this.#e?.dialCode,i=this.#e?.nationalPrefix;if(t.startsWith("+")||!e)return t;let l=i&&t.startsWith(i)&&!this.#i.separateDialCode?t.substring(1):t;return`+${e}${l}`}#W(t){let e=t.indexOf("+"),i=e>0?t.substring(e):t,s=this.#e?.iso2;i=this.#q(i);let o=this.#M(i,!0),l=N(i);if(o){let r=N(o),a=this.#L[r];return a.length===1?a[0]===s?null:a[0]:this.#$(a,r,l)}else if(i.startsWith("+")&&l.length){let r=this.#e?.dialCode||"";return r&&r.startsWith(l)?null:""}else if((!i||i==="+")&&!s&&this.#f)return this.#f;return null}#$(t,e,i){let s=this.#e?.iso2,o=this.#e?.dialCode;if(!s&&this.#f&&t.includes(this.#f))return this.#f;if(o===B.NANP&&it(i))return null;let r=this.#e?.areaCodes,a=this.#e?.priority;if(r){let I=r.map(y=>`${o}${y}`);for(let y of I)if(i.startsWith(y))return null}let d=r&&!(a===0)&&i.length>e.length,m=s&&t.includes(s)&&!d,E=s===t[0];return!m&&!E?t[0]:null}#C(t){let e=this.#e?.iso2||"";return this.#e=t?this.#p.get(t):null,this.#e&&(this.#f=this.#e.iso2),this.#t.setCountry(this.#e),this.#H(),this.#P(),e!==t}#P(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:i}=this.#i;if(!t||!u.utils)return;let s=this.#e?.iso2;if(!s){this.#u=null;return}let o=u.utils.numberType[e],l=u.utils.getExampleNumber(s,!1,o,!0),r=l;for(;u.utils.isPossibleNumber(l,s,i);)r=l,l+="0";let a=u.utils.getCoreNumber(r,s);this.#u=a.length,s==="by"&&(this.#u=a.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 l=u.utils.numberType[e],r=this.#e?u.utils.getExampleNumber(this.#e.iso2,i,l):"";r=this.#F(r),typeof s=="function"&&(r=s(r,this.#e)),this.#t.telInputEl.setAttribute("placeholder",r)}#Q(t){if(!t)return;let e=t.dataset[w.ISO2],i=this.#C(e);this.#g();let s=t.dataset[w.DIAL_CODE];if(this.#b(s),this.#i.formatOnDisplay){let o=this.#n();this.#N(o)}this.#t.telInputEl.focus(),i&&this.#R()}#g(t){!this.#t.isDropdownOpen()||this.#i.dropdownAlwaysOpen&&!t||(this.#t.closeDropdown(),this.#_(k.CLOSE_COUNTRY_DROPDOWN))}#b(t){let e=this.#n();if(!e.startsWith("+"))return;let i=`+${t}`,s=this.#M(e),o;s?o=e.replace(s,i):o=i,this.#d(o)}#M(t,e){if(!t.startsWith("+"))return"";let i="",s="",o=!1;for(let l=0;l<t.length;l++){let r=t.charAt(l);if(!/[0-9]/.test(r))continue;if(s+=r,!!!this.#L[s])break;if(this.#T.has(s)){if(i=t.substring(0,l+1),o=!0,!e)break}else e&&o&&(i=t.substring(0,l+1));if(s.length===this.#E)break}return i}#B(t){let e=this.#e?.dialCode,i=N(t);return(this.#i.separateDialCode&&!t.startsWith("+")&&e&&i?`+${e}`:"")+t}#I(){let t=this.#n();return this.#B(t)}#F(t){let e=!!this.#M(t),i=et(t,e,this.#i.separateDialCode,this.#e);return this.#X(i)}#V(){let t=this.#e;if(!t)return null;let{iso2:e,dialCode:i,name:s}=t;return{iso2:e,dialCode:i,name:s}}#R(){let t=this.#V();this.#_(k.COUNTRY_CHANGE,t)}#G(){if(!this.#l||!u.autoCountry)return;if(!this.#o){this.#l.resolve();return}this.#f=u.autoCountry,this.#e||this.#t.isShowingGlobe()||this.setCountry(this.#f),this.#l.resolve()}#J(){if(!this.#o){this.#l?.reject();return}this.#r(!0),this.#l?.reject()}#Z(){if(!this.#o){this.#c?.resolve();return}if(!u.utils){this.#c?.resolve();return}let t=this.#n();t&&this.#N(t),this.#e&&(this.#H(),this.#P()),this.#c?.resolve()}#tt(t){if(!this.#o){this.#c?.reject(t);return}this.#c?.reject(t)}destroy(){this.#o&&(this.#o=!1,this.#i.allowDropdown&&this.#g(!0),this.#s.abort(),this.#t.destroy(),u.instances.delete(String(this.id)))}isActive(){return this.#o}getExtension(){return this.#o?(x("getExtension"),u.utils.getExtension(this.#I(),this.#e?.iso2)):""}getNumber(t){if(!this.#o)return"";x("getNumber");let e=this.#e?.iso2,i=this.#I(),s=u.utils.formatNumber(i,e,t);return this.#h.denormalise(s)}getNumberType(){return this.#o?(x("getNumberType"),u.utils.getNumberType(this.#I(),this.#e?.iso2)):Q.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.#V()}getValidationError(){if(!this.#o)return Q.UNKNOWN_VALIDATION_ERROR;x("getValidationError");let t=this.#e?.iso2;return u.utils.getValidationError(this.#I(),t)}isValidNumber(){if(!this.#o)return null;x("isValidNumber");let t=this.#e?.dialCode,e=this.#e?.iso2,i=this.#I(),s=u.utils.getCoreNumber(i,e);if(s){if(t===F.DIAL_CODE&&s[0]===F.MOBILE_PREFIX&&s.length!==F.MOBILE_CORE_LENGTH)return!1;if(!v.ALPHA_UNICODE.test(i)&&t){let l=i.startsWith("+")?i.slice(1+t.length):i,r=N(l).length;if(s.length>r)return!1}}return this.#k("possible")}isValidNumberPrecise(){return this.#o?(x("isValidNumberPrecise"),this.#k("precise")):null}#k(t){let{allowNumberExtensions:e,allowPhonewords:i,allowedNumberTypes:s}=this.#i,o=this.#e?.iso2,l=this.#I();return!this.#e&&!tt(l)||!(t==="precise"?u.utils.isValidNumber:u.utils.isPossibleNumber)(l,o,s)?!1:v.ALPHA_UNICODE.test(l)?!!u.utils.getExtension(l,o)?e:i:!0}setCountry(t){if(!this.#o)return;let e=t?.toLowerCase();if(!O(e))throw new Error(`Invalid iso2 code: '${e}'`);let i=this.#e?.iso2;if(t&&e!==i||!t&&i){if(this.#C(e),this.#b(this.#e?.dialCode||""),this.#i.formatOnDisplay){let o=this.#n();this.#N(o)}this.#R()}}setNumber(t){if(!this.#o)return;let e=this.#h.normalise(t),i=this.#S(e);this.#N(e),i&&this.#R(),this.#_(k.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.#Z();break;case"handleUtilsFailure":o.#tt(s);break;case"handleAutoCountryLoaded":o.#G();break;case"handleAutoCountryFailure":o.#J();break}})}},Gt=n=>{if(!u.utils&&!u.startedLoadingUtils){let t;if(typeof n=="function")try{t=Promise.resolve(n())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof n}`));return u.startedLoadingUtils=!0,t.then(e=>{let i=e?.default;if(!i||typeof i!="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=i,H.forEachInstance("handleUtilsLoaded"),!0}).catch(e=>{throw H.forEachInstance("handleUtilsFailure",e),e})}return null},u=Object.assign((n,t)=>{let e=new H(n,t);return u.instances.set(String(e.id),e),n.iti=e,e},{defaults:G,documentReady:()=>document.readyState==="complete",getCountryData:()=>P,getInstance:n=>{let t=n.dataset[w.INSTANCE_ID];return t?u.instances.get(t)??null:null},instances:new Map,attachUtils:Gt,startedLoadingUtils:!1,startedLoadingAutoCountry:!1,version:"27.0.17"}),jt=u;return Mt(Kt);})();
|
|
25
25
|
var intlTelInput = _factory.default;
|
package/dist/js/intlTelInput.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v27.0.
|
|
2
|
+
* International Telephone Input v27.0.17
|
|
3
3
|
* git+https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -4531,7 +4531,7 @@ var _factory = (() => {
|
|
|
4531
4531
|
attachUtils,
|
|
4532
4532
|
startedLoadingUtils: false,
|
|
4533
4533
|
startedLoadingAutoCountry: false,
|
|
4534
|
-
version: "27.0.
|
|
4534
|
+
version: "27.0.17"
|
|
4535
4535
|
}
|
|
4536
4536
|
);
|
|
4537
4537
|
var intlTelInput_default = intlTelInput;
|