intl-tel-input
Version:
A JavaScript plugin for entering and validating international telephone numbers
34 lines (32 loc) • 310 kB
JavaScript
/*
* International Telephone Input v26.8.0
* https://github.com/jackocnr/intl-tel-input.git
* Licensed under the MIT license
*/
// UMD
(function(factory) {
if (typeof module === 'object' && module.exports) {
module.exports = factory();
} else {
window.intlTelInput = factory();
}
}(() => {
var factoryOutput=(()=>{var F1=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var T2=Object.getOwnPropertyNames;var A2=Object.prototype.hasOwnProperty;var v2=(u,e)=>{for(var n in e)F1(u,n,{get:e[n],enumerable:!0})},w2=(u,e,n,$)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of T2(e))!A2.call(u,s)&&s!==n&&F1(u,s,{get:()=>e[s],enumerable:!($=N2(e,s))||$.enumerable});return u};var D2=u=>w2(F1({},"__esModule",{value:!0}),u);var Y2={};v2(Y2,{default:()=>V2});var _2=[["af","93",0,null,"0"],["ax","358",1,["18","4"],"0"],["al","355",0,null,"0"],["dz","213",0,null,"0"],["as","1",5,["684"],"1"],["ad","376"],["ao","244"],["ai","1",6,["264"],"1"],["ag","1",7,["268"],"1"],["ar","54",0,null,"0"],["am","374",0,null,"0"],["aw","297"],["ac","247"],["au","61",0,["4"],"0"],["at","43",0,null,"0"],["az","994",0,null,"0"],["bs","1",8,["242"],"1"],["bh","973"],["bd","880",0,null,"0"],["bb","1",9,["246"],"1"],["by","375",0,null,"8"],["be","32",0,null,"0"],["bz","501"],["bj","229"],["bm","1",10,["441"],"1"],["bt","975"],["bo","591",0,null,"0"],["ba","387",0,null,"0"],["bw","267"],["br","55",0,null,"0"],["io","246"],["vg","1",11,["284"],"1"],["bn","673"],["bg","359",0,null,"0"],["bf","226"],["bi","257"],["kh","855",0,null,"0"],["cm","237"],["ca","1",1,["204","226","236","249","250","257","263","289","306","343","354","365","367","368","382","403","416","418","428","431","437","438","450","468","474","506","514","519","548","579","581","584","587","604","613","639","647","672","683","705","709","742","753","778","780","782","807","819","825","867","873","879","902","905","942"],"1"],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"],"1"],["cf","236"],["td","235"],["cl","56"],["cn","86",0,null,"0"],["cx","61",2,["4","89164"],"0"],["cc","61",1,["4","89162"],"0"],["co","57",0,null,"0"],["km","269"],["cg","242"],["cd","243",0,null,"0"],["ck","682"],["cr","506"],["ci","225"],["hr","385",0,null,"0"],["cu","53",0,null,"0"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"],"1"],["do","1",2,["809","829","849"],"1"],["ec","593",0,null,"0"],["eg","20",0,null,"0"],["sv","503"],["gq","240"],["er","291",0,null,"0"],["ee","372"],["sz","268"],["et","251",0,null,"0"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0,["4"],"0"],["fr","33",0,null,"0"],["gf","594",0,null,"0"],["pf","689"],["ga","241"],["gm","220"],["ge","995",0,null,"0"],["de","49",0,null,"0"],["gh","233",0,null,"0"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"],"1"],["gp","590",0,null,"0"],["gu","1",15,["671"],"1"],["gt","502"],["gg","44",1,["1481","7781","7839","7911"],"0"],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36",0,null,"06"],["is","354"],["in","91",0,null,"0"],["id","62",0,null,"0"],["ir","98",0,null,"0"],["iq","964",0,null,"0"],["ie","353",0,null,"0"],["im","44",2,["1624","74576","7524","7624","7924"],"0"],["il","972",0,null,"0"],["it","39",0,["3"]],["jm","1",4,["658","876"],"1"],["jp","81",0,null,"0"],["je","44",3,["1534","7509","7700","7797","7829","7937"],"0"],["jo","962",0,null,"0"],["kz","7",1,["33","7"],"8"],["ke","254",0,null,"0"],["ki","686",0,null,"0"],["xk","383",0,null,"0"],["kw","965"],["kg","996",0,null,"0"],["la","856",0,null,"0"],["lv","371"],["lb","961",0,null,"0"],["ls","266"],["lr","231",0,null,"0"],["ly","218",0,null,"0"],["li","423",0,null,"0"],["lt","370",0,null,"0"],["lu","352"],["mo","853"],["mg","261",0,null,"0"],["mw","265",0,null,"0"],["my","60",0,null,"0"],["mv","960"],["ml","223"],["mt","356"],["mh","692",0,null,"1"],["mq","596",0,null,"0"],["mr","222"],["mu","230"],["yt","262",1,["269","639"],"0"],["mx","52"],["fm","691"],["md","373",0,null,"0"],["mc","377",0,null,"0"],["mn","976",0,null,"0"],["me","382",0,null,"0"],["ms","1",16,["664"],"1"],["ma","212",0,["6","7"],"0"],["mz","258"],["mm","95",0,null,"0"],["na","264",0,null,"0"],["nr","674"],["np","977",0,null,"0"],["nl","31",0,null,"0"],["nc","687"],["nz","64",0,null,"0"],["ni","505"],["ne","227"],["ng","234",0,null,"0"],["nu","683"],["nf","672"],["kp","850",0,null,"0"],["mk","389",0,null,"0"],["mp","1",17,["670"],"1"],["no","47",0,["4","9"]],["om","968"],["pk","92",0,null,"0"],["pw","680"],["ps","970",0,null,"0"],["pa","507"],["pg","675"],["py","595",0,null,"0"],["pe","51",0,null,"0"],["ph","63",0,null,"0"],["pl","48"],["pt","351"],["pr","1",3,["787","939"],"1"],["qa","974"],["re","262",0,null,"0"],["ro","40",0,null,"0"],["ru","7",0,["33"],"8"],["rw","250",0,null,"0"],["ws","685"],["sm","378"],["st","239"],["sa","966",0,null,"0"],["sn","221"],["rs","381",0,null,"0"],["sc","248"],["sl","232",0,null,"0"],["sg","65"],["sx","1",21,["721"],"1"],["sk","421",0,null,"0"],["si","386",0,null,"0"],["sb","677"],["so","252",0,null,"0"],["za","27",0,null,"0"],["kr","82",0,null,"0"],["ss","211",0,null,"0"],["es","34"],["lk","94",0,null,"0"],["bl","590",1,null,"0"],["sh","290"],["kn","1",18,["869"],"1"],["lc","1",19,["758"],"1"],["mf","590",2,null,"0"],["pm","508",0,null,"0"],["vc","1",20,["784"],"1"],["sd","249",0,null,"0"],["sr","597"],["sj","47",1,["4","79","9"]],["se","46",0,null,"0"],["ch","41",0,null,"0"],["sy","963",0,null,"0"],["tw","886",0,null,"0"],["tj","992"],["tz","255",0,null,"0"],["th","66",0,null,"0"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"],"1"],["tn","216"],["tr","90",0,null,"0"],["tm","993",0,null,"8"],["tc","1",23,["649"],"1"],["tv","688"],["vi","1",24,["340"],"1"],["ug","256",0,null,"0"],["ua","380",0,null,"0"],["ae","971",0,null,"0"],["gb","44",0,null,"0"],["us","1",0,null,"1"],["uy","598",0,null,"0"],["uz","998"],["vu","678"],["va","39",1,["06698","3"]],["ve","58",0,null,"0"],["vn","84",0,null,"0"],["wf","681"],["eh","212",1,["5288","5289","6","7"],"0"],["ye","967",0,null,"0"],["zm","260",0,null,"0"],["zw","263",0,null,"0"]],x0=[];for(let u of _2)x0.push({name:"",iso2:u[0],dialCode:u[1],priority:u[2]||0,areaCodes:u[3]||null,nodeById:{},nationalPrefix:u[4]||null,normalisedName:"",initials:"",dialCodePlus:""});var z=x0;var g1={OPEN_COUNTRY_DROPDOWN:"open:countrydropdown",CLOSE_COUNTRY_DROPDOWN:"close:countrydropdown",COUNTRY_CHANGE:"countrychange",INPUT:"input"},b={HIDE:"iti__hide",V_HIDE:"iti__v-hide",ARROW_UP:"iti__arrow--up",GLOBE:"iti__globe",FLAG:"iti__flag",LOADING:"iti__loading",COUNTRY_ITEM:"iti__country",HIGHLIGHT:"iti__highlight"},_={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",SPACE:" ",ENTER:"Enter",ESC:"Escape",TAB:"Tab"},K1={PASTE:"insertFromPaste",DELETE_FWD:"deleteContentForward"},J={ALPHA_UNICODE:/\p{L}/u,NON_PLUS_NUMERIC:/[^+0-9]/,NON_PLUS_NUMERIC_GLOBAL:/[^+0-9]/g,HIDDEN_SEARCH_CHAR:/^[a-zA-ZÀ-ÿа-яА-Я ]$/},w1={SEARCH_DEBOUNCE_MS:100,HIDDEN_SEARCH_RESET_MS:1e3,NEXT_TICK:0},V1={UNKNOWN_NUMBER_TYPE:-99,UNKNOWN_VALIDATION_ERROR:-99},j={NARROW_VIEWPORT_WIDTH:500,SANE_SELECTED_WITH_DIAL_WIDTH:78,SANE_SELECTED_NO_DIAL_WIDTH:42,INPUT_PADDING_EXTRA_LEFT:6,DROPDOWN_MARGIN:3,SANE_DROPDOWN_HEIGHT:200},D1={PLUS:"+",NANP:"1"},_1={ISO2:"gb",DIAL_CODE:"44",MOBILE_PREFIX:"7",MOBILE_CORE_LENGTH:10},H0={ISO2:"us",DIAL_CODE:"1"},o1={AGGRESSIVE:"aggressive",POLITE:"polite",OFF:"off"},i1={AUTO:"auto"},O2=["FIXED_LINE","MOBILE","FIXED_LINE_OR_MOBILE","TOLL_FREE","PREMIUM_RATE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL","UNKNOWN"],m1=new Set(O2),Y1={COUNTRY_CODE:"countryCode",DIAL_CODE:"dialCode"},L={EXPANDED:"aria-expanded",LABEL:"aria-label",SELECTED:"aria-selected",ACTIVE_DESCENDANT:"aria-activedescendant",HASPOPUP:"aria-haspopup",CONTROLS:"aria-controls",HIDDEN:"aria-hidden",AUTOCOMPLETE:"aria-autocomplete",MODAL:"aria-modal"};var M2={selectedCountryAriaLabel:"Change country, selected ${countryName} (${dialCode})",noCountrySelected:"Select country",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",clearSearchAriaLabel:"Clear search",searchEmptyState:"No results found",searchSummaryAria(u){return u===0?"No results found":u===1?"1 result found":`${u} results found`}},U0=M2;var j1=u=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(u).matches,W0=()=>j1(`(max-width: ${j.NARROW_VIEWPORT_WIDTH}px)`),R2=()=>{if(typeof navigator<"u"&&typeof window<"u"){let u=j1("(max-height: 600px)"),e=j1("(pointer: coarse)");return W0()||e&&u}return!1},M1={allowDropdown:!0,allowedNumberTypes:["MOBILE","FIXED_LINE"],allowNumberExtensions:!1,allowPhonewords:!1,autoPlaceholder:o1.POLITE,containerClass:"",countryNameLocale:"en",countryOrder:null,countrySearch:!0,customPlaceholder:null,dropdownAlwaysOpen:!1,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",loadUtils:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",searchInputClass:"",separateDialCode:!1,showFlags:!0,strictMode:!1,useFullscreenPopup:R2()},F0=u=>JSON.stringify(u),B0=u=>!!u&&typeof u=="object"&&!Array.isArray(u),P2=u=>typeof u=="function",x2=u=>{if(!u||typeof u!="object")return!1;let e=u;return e.nodeType===1&&typeof e.tagName=="string"&&typeof e.appendChild=="function"},H2=new Set(z.map(u=>u.iso2)),K0=u=>H2.has(u),k0=new Set(Object.values(o1)),O1=u=>{console.warn(`[intl-tel-input] ${u}`)},k=(u,e,n)=>{O1(`Option '${u}' must be ${e}; got ${F0(n)}. Ignoring.`)},U2=(u,e)=>Object.prototype.hasOwnProperty.call(u,e),G0=(u,e)=>{let n="an array of ISO2 country code strings";if(!Array.isArray(e))return k(u,n,e),!1;for(let $ of e){if(typeof $!="string")return k(u,n,e),!1;let s=$.toLowerCase();if(!K0(s))return O1(`Invalid country code in '${u}': '${$}'. Ignoring.`),!1}return!0},V0=u=>{if(u===void 0)return{};if(!B0(u)){let n=`The second argument must be an options object; got ${F0(u)}. Using defaults.`;return O1(n),{}}let e={};for(let[n,$]of Object.entries(u)){if(!U2(M1,n)){O1(`Unknown option '${n}'. Ignoring.`);continue}switch(n){case"allowDropdown":case"allowNumberExtensions":case"allowPhonewords":case"countrySearch":case"dropdownAlwaysOpen":case"fixDropdownWidth":case"formatAsYouType":case"formatOnDisplay":case"nationalMode":case"showFlags":case"separateDialCode":case"strictMode":case"useFullscreenPopup":if(typeof $!="boolean"){k(n,"a boolean",$);break}e[n]=$;break;case"autoPlaceholder":if(typeof $!="string"||!k0.has($)){let s=Array.from(k0).join(", ");k("autoPlaceholder",`one of ${s}`,$);break}e[n]=$;break;case"containerClass":case"searchInputClass":case"countryNameLocale":if(typeof $!="string"){k(n,"a string",$);break}e[n]=$;break;case"countryOrder":($===null||G0(n,$))&&(e[n]=$);break;case"customPlaceholder":case"geoIpLookup":case"hiddenInput":case"loadUtils":if($!==null&&!P2($)){k(n,"a function or null",$);break}e[n]=$;break;case"dropdownContainer":if($!==null&&!x2($)){k("dropdownContainer","an HTMLElement or null",$);break}e[n]=$;break;case"excludeCountries":case"onlyCountries":G0(n,$)&&(e[n]=$);break;case"i18n":if($&&!B0($)){k("i18n","an object",$);break}e[n]=$;break;case"initialCountry":{if(typeof $!="string"){k("initialCountry","a string",$);break}let s=$.toLowerCase();if(s&&s!==i1.AUTO&&!K0(s)){k("initialCountry","a valid ISO2 country code or 'auto'",$);break}e[n]=$;break}case"placeholderNumberType":if(typeof $!="string"||!m1.has($)){let s=Array.from(m1).join(", ");k("placeholderNumberType",`one of ${s}`,$);break}e[n]=$;break;case"allowedNumberTypes":if($!==null){if(!Array.isArray($)){k("allowedNumberTypes","an array of number types or null",$);break}let s=!0;for(let r of $)if(typeof r!="string"||!m1.has(r)){let c=Array.from(m1).join(", ");k("allowedNumberTypes",`an array of valid number types (${c})`,r),s=!1;break}s&&(e[n]=$)}else e[n]=null;break}}return e},Y0=u=>{u.dropdownAlwaysOpen&&(u.useFullscreenPopup=!1,u.allowDropdown=!0),u.useFullscreenPopup?u.fixDropdownWidth=!1:W0()&&(u.fixDropdownWidth=!0),u.onlyCountries.length===1&&(u.initialCountry=u.onlyCountries[0]),u.separateDialCode&&(u.nationalMode=!1),u.allowDropdown&&!u.showFlags&&!u.separateDialCode&&(u.nationalMode=!1),u.useFullscreenPopup&&!u.dropdownContainer&&(u.dropdownContainer=document.body),u.i18n={...U0,...u.i18n}};var Q=u=>u.replace(/\D/g,""),R1=(u="")=>u.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();var j0=()=>typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1;var Z0=(u,e)=>{let n=R1(e),$=[],s=[],r=[],c=[],p=[],g=[];for(let I of u)I.iso2===n?$.push(I):I.normalisedName.startsWith(n)?s.push(I):I.normalisedName.includes(n)?r.push(I):n===I.dialCode||n===I.dialCodePlus?c.push(I):I.dialCodePlus.includes(n)?p.push(I):I.initials.includes(n)&&g.push(I);let y=(I,T)=>I.priority-T.priority;return[...$.sort(y),...s.sort(y),...r.sort(y),...c.sort(y),...p.sort(y),...g.sort(y)]},X0=(u,e)=>{let n=e.toLowerCase();for(let $ of u)if($.name.toLowerCase().startsWith(n))return $;return null};var P1=u=>Object.keys(u).filter(e=>!!u[e]).join(" "),N=(u,e,n)=>{let $=document.createElement(u);return e&&Object.entries(e).forEach(([s,r])=>$.setAttribute(s,r)),n&&n.appendChild($),$};var z0=()=>`
<svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${L.HIDDEN}="true">
<circle cx="11" cy="11" r="7" />
<line x1="21" y1="21" x2="16.65" y2="16.65" />
</svg>`,J0=u=>{let e=`iti-${u}-clear-mask`;return`
<svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${L.HIDDEN}="true" focusable="false">
<mask id="${e}" maskUnits="userSpaceOnUse">
<rect width="16" height="16" fill="white" />
<path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
</mask>
<circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${e})" />
</svg>`},Q0=()=>`
<svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${L.HIDDEN}="true">
<path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
</svg>`,Z1=()=>`
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
</svg>`;var r1=class u{constructor(e,n,$){this.#c=null;this.#y=null;this.#$=null;this.#s=null;this.highlightedItem=null;e.dataset.intlTelInputId=$.toString(),this.telInput=e,this.#d=n,this.#t=$,this.hadInitialPlaceholder=!!e.getAttribute("placeholder"),this.#f=!!this.telInput.closest("[dir=rtl]"),this.#d.separateDialCode&&(this.#l=this.telInput.style.paddingLeft)}#d;#t;#f;#l;#u;#c;#y;#I;#e;#n;#o;#i;#a;#$;#s;static validateInput(e){let n=e?.tagName;if(!(!!e&&typeof e=="object"&&n==="INPUT"&&typeof e.setAttribute=="function")){let s=Object.prototype.toString.call(e);throw new TypeError(`The first argument must be an HTMLInputElement, not ${s}`)}}generateMarkup(e){this.#u=e,this.telInput.classList.add("iti__tel-input"),this.telInput.hasAttribute("autocomplete")||this.telInput.setAttribute("autocomplete","tel"),this.telInput.hasAttribute("inputmode")||this.telInput.setAttribute("inputmode","tel");let n=this.#E();this.#g(n),n.appendChild(this.telInput),this.#R(),this.#P(n)}#E(){let{allowDropdown:e,showFlags:n,containerClass:$,useFullscreenPopup:s}=this.#d,r=P1({iti:!0,"iti--allow-dropdown":e,"iti--show-flags":n,"iti--inline-dropdown":!s,[$]:!!$}),c=N("div",{class:r});return this.#f&&c.setAttribute("dir","ltr"),this.telInput.before(c),c}#g(e){let{allowDropdown:n,separateDialCode:$,showFlags:s}=this.#d;if(n||s||$){this.countryContainer=N("div",{class:`iti__country-container ${b.V_HIDE}`},e),n?(this.selectedCountry=N("button",{type:"button",class:"iti__selected-country",[L.EXPANDED]:"false",[L.LABEL]:this.#d.i18n.noCountrySelected,[L.HASPOPUP]:"dialog",[L.CONTROLS]:`iti-${this.#t}__dropdown-content`},this.countryContainer),this.telInput.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=N("div",{class:"iti__selected-country"},this.countryContainer);let r=N("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=N("div",{class:b.FLAG},r),n&&(this.#e=N("div",{class:"iti__arrow",[L.HIDDEN]:"true"},r)),$&&(this.#I=N("div",{class:"iti__selected-dial-code"},this.selectedCountry)),n&&this.#r()}}#m(){let{fixDropdownWidth:e}=this.#d;if(e&&!this.#n.style.width){let n=this.telInput.offsetWidth;n>0&&(this.#n.style.width=`${n}px`)}}#r(){let{fixDropdownWidth:e,useFullscreenPopup:n,countrySearch:$,i18n:s,dropdownContainer:r,containerClass:c}=this.#d,p=e?"":"iti--flexible-dropdown-width";if(this.#n=N("div",{id:`iti-${this.#t}__dropdown-content`,class:`iti__dropdown-content ${b.HIDE} ${p}`,role:"dialog",[L.MODAL]:"true"}),this.#f&&this.#n.setAttribute("dir","rtl"),$&&this.#h(),this.countryList=N("ul",{class:"iti__country-list",id:`iti-${this.#t}__country-listbox`,role:"listbox",[L.LABEL]:s.countryListAriaLabel},this.#n),this.#x(),$&&this.#T(),n||(this.#m(),this.#y=this.#U(),$&&(this.#n.style.height=`${this.#y}px`)),r){let g=P1({iti:!0,"iti--container":!0,"iti--fullscreen-popup":n,"iti--inline-dropdown":!n,[c]:!!c});this.#$=N("div",{class:g}),this.#$.appendChild(this.#n)}else this.countryContainer.appendChild(this.#n)}#h(){let{i18n:e,searchInputClass:n}=this.#d,$=N("div",{class:"iti__search-input-wrapper"},this.#n);this.#o=N("span",{class:"iti__search-icon",[L.HIDDEN]:"true"},$),this.#o.innerHTML=z0(),this.searchInput=N("input",{id:`iti-${this.#t}__search-input`,type:"search",class:`iti__search-input ${n}`,placeholder:e.searchPlaceholder,role:"combobox",[L.EXPANDED]:"true",[L.LABEL]:e.searchPlaceholder,[L.CONTROLS]:`iti-${this.#t}__country-listbox`,[L.AUTOCOMPLETE]:"list",autocomplete:"off"},$),this.searchClearButton=N("button",{type:"button",class:`iti__search-clear ${b.HIDE}`,[L.LABEL]:e.clearSearchAriaLabel,tabindex:"-1"},$),this.searchClearButton.innerHTML=J0(this.#t),this.#a=N("span",{class:"iti__a11y-text"},this.#n),this.#i=N("div",{class:`iti__no-results ${b.HIDE}`,[L.HIDDEN]:"true"},this.#n),this.#i.textContent=e.searchEmptyState}#R(){this.countryContainer&&(this.#L(),this.countryContainer.classList.remove(b.V_HIDE))}#P(e){let{hiddenInput:n}=this.#d;if(n){let $=this.telInput.getAttribute("name")||"",s=n($);if(s.phone){let r=this.telInput.form?.querySelector(`input[name="${s.phone}"]`);r?this.hiddenInput=r:(this.hiddenInput=N("input",{type:"hidden",name:s.phone}),e.appendChild(this.hiddenInput))}if(s.country){let r=this.telInput.form?.querySelector(`input[name="${s.country}"]`);r?this.hiddenInputCountry=r:(this.hiddenInputCountry=N("input",{type:"hidden",name:s.country}),e.appendChild(this.hiddenInputCountry))}}}#x(){let e=document.createDocumentFragment();for(let n=0;n<this.#u.length;n++){let $=this.#u[n],s=P1({[b.COUNTRY_ITEM]:!0}),r=N("li",{id:`iti-${this.#t}__item-${$.iso2}`,class:s,tabindex:"-1",role:"option",[L.SELECTED]:"false"});r.dataset.dialCode=$.dialCode,r.dataset.countryCode=$.iso2,$.nodeById[this.#t]=r,this.#d.showFlags&&N("div",{class:`${b.FLAG} iti__${$.iso2}`},r);let c=N("span",{class:"iti__country-name"},r);c.textContent=`${$.name} `;let p=N("span",{class:"iti__dial-code"},c);this.#f&&p.setAttribute("dir","ltr"),p.textContent=`(+${$.dialCode})`,e.appendChild(r)}this.countryList.appendChild(e)}#L(){if(this.selectedCountry){let e=this.#d.separateDialCode?j.SANE_SELECTED_WITH_DIAL_WIDTH:j.SANE_SELECTED_NO_DIAL_WIDTH,$=(this.selectedCountry.offsetWidth||this.#H()||e)+j.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${$}px`}}static#N(){let e;try{e=window.top.document.body}catch{e=document.body}return e}#H(){if(this.telInput.parentNode){let e=u.#N(),n=this.telInput.parentNode.cloneNode(!1);n.style.visibility="hidden",e.appendChild(n);let $=this.countryContainer.cloneNode();n.appendChild($);let s=this.selectedCountry.cloneNode(!0);$.appendChild(s);let r=s.offsetWidth;return e.removeChild(n),r}return 0}#U(){let e=u.#N();this.#n.classList.remove(b.HIDE);let n=N("div",{class:"iti iti--inline-dropdown"});n.appendChild(this.#n),n.style.visibility="hidden",e.appendChild(n);let $=this.#n.offsetHeight;return e.removeChild(n),n.style.visibility="",this.#n.classList.add(b.HIDE),$>0?$:j.SANE_DROPDOWN_HEIGHT}#T(){let{i18n:e}=this.#d,n=this.countryList.childElementCount;this.#a.textContent=e.searchSummaryAria(n)}filterCountriesByQuery(e){let n;e===""?n=this.#u:n=Z0(this.#u,e),this.#B(n)}#A(){let e=this.searchInput.value.trim();this.filterCountriesByQuery(e),this.searchInput.value?this.searchClearButton.classList.remove(b.HIDE):this.searchClearButton.classList.add(b.HIDE)}handleSearchChange(){this.#c&&clearTimeout(this.#c),this.#c=setTimeout(()=>{this.#A(),this.#c=null},w1.SEARCH_DEBOUNCE_MS)}handleSearchClear(){this.searchInput.value="",this.searchInput.focus(),this.#A()}scrollTo(e){let n=this.countryList,$=document.documentElement.scrollTop,s=n.offsetHeight,r=n.getBoundingClientRect().top+$,c=r+s,p=e.offsetHeight,g=e.getBoundingClientRect().top+$,y=g+p,I=g-r+n.scrollTop;if(g<r)n.scrollTop=I;else if(y>c){let T=s-p;n.scrollTop=I-T}}highlightListItem(e,n){let $=this.highlightedItem;if($&&$.classList.remove(b.HIGHLIGHT),this.highlightedItem=e,this.highlightedItem&&(this.highlightedItem.classList.add(b.HIGHLIGHT),this.#d.countrySearch)){let s=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(L.ACTIVE_DESCENDANT,s)}n&&this.highlightedItem.focus()}handleUpDownKey(e){let n=e===_.ARROW_UP?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!n&&this.countryList.childElementCount>1&&(n=e===_.ARROW_UP?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this.scrollTo(n),this.highlightListItem(n,!1))}#v(e){if(this.#s&&this.#s.dataset.countryCode!==e&&(this.#s.setAttribute(L.SELECTED,"false"),this.#s.querySelector(".iti__country-check")?.remove(),this.#s=null),e&&!this.#s){let n=this.countryList.querySelector(`[data-country-code="${e}"]`);if(n){n.setAttribute(L.SELECTED,"true");let $=N("span",{class:"iti__country-check",[L.HIDDEN]:"true"},n);$.innerHTML=Q0(),this.#s=n}}}#B(e){this.countryList.innerHTML="";let n=!0;for(let $ of e){let s=$.nodeById[this.#t];s&&(this.countryList.appendChild(s),n&&(this.highlightListItem(s,!1),n=!1))}n?(this.highlightListItem(null,!1),this.#i&&this.#i.classList.remove(b.HIDE)):this.#i&&this.#i.classList.add(b.HIDE),this.countryList.scrollTop=0,this.#T()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.#d.separateDialCode&&(this.telInput.style.paddingLeft=this.#l);let e=this.telInput.parentNode;e.before(this.telInput),e.remove(),this.telInput=null,this.countryContainer=null,this.selectedCountry=null,this.selectedCountryInner=null,this.searchInput=null,this.searchClearButton=null,this.countryList=null,this.hiddenInput=null,this.hiddenInputCountry=null,this.highlightedItem=null,this.#I=null,this.#e=null,this.#n=null,this.#o=null,this.#i=null,this.#a=null,this.#$=null,this.#s=null;for(let n of this.#u)delete n.nodeById[this.#t];this.#u=null}openDropdown(){let{countrySearch:e,dropdownAlwaysOpen:n,dropdownContainer:$}=this.#d;if(this.#m(),$)this.#k();else{let s=this.#w(),r=this.telInput.offsetHeight+j.DROPDOWN_MARGIN;s?this.#n.style.top=`${r}px`:this.#n.style.bottom=`${r}px`}if(this.#n.classList.remove(b.HIDE),this.selectedCountry.setAttribute(L.EXPANDED,"true"),e){let s=this.countryList.firstElementChild;s&&(this.highlightListItem(s,!1),this.countryList.scrollTop=0),n||this.searchInput.focus()}this.#e.classList.add(b.ARROW_UP)}closeDropdown(){let{countrySearch:e,dropdownContainer:n}=this.#d;this.#n.classList.add(b.HIDE),this.selectedCountry.setAttribute(L.EXPANDED,"false"),e&&(this.searchInput.removeAttribute(L.ACTIVE_DESCENDANT),this.highlightedItem&&(this.highlightedItem.classList.remove(b.HIGHLIGHT),this.highlightedItem=null)),this.#e.classList.remove(b.ARROW_UP),n?(this.#$.remove(),this.#$.style.top="",this.#$.style.bottom=""):(this.#n.style.top="",this.#n.style.bottom="")}#w(){if(this.#d.dropdownAlwaysOpen)return!0;let e=this.telInput.getBoundingClientRect(),n=e.top,$=window.innerHeight-e.bottom;return $>=this.#y||$>=n}#k(){let{dropdownContainer:e,useFullscreenPopup:n}=this.#d;if(e){if(!n){let $=this.telInput.getBoundingClientRect();this.#$.style.left=`${$.left}px`,this.#w()?this.#$.style.top=`${$.bottom+j.DROPDOWN_MARGIN}px`:(this.#$.style.top="unset",this.#$.style.bottom=`${window.innerHeight-$.top+j.DROPDOWN_MARGIN}px`)}e.appendChild(this.#$)}}isDropdownClosed(){return this.#n.classList.contains(b.HIDE)}setCountry(e){let{allowDropdown:n,showFlags:$,separateDialCode:s,i18n:r}=this.#d,{name:c,dialCode:p,iso2:g=""}=e;if(n&&this.#v(g),this.selectedCountry){let y=g&&$?`${b.FLAG} iti__${g}`:`${b.FLAG} ${b.GLOBE}`,I,T,O;g?(T=c,I=r.selectedCountryAriaLabel.replace("${countryName}",c).replace("${dialCode}",`+${p}`),O=$?"":Z1()):(T=r.noCountrySelected,I=r.noCountrySelected,O=Z1()),this.selectedCountryInner.className=y,this.selectedCountry.setAttribute("title",T),this.selectedCountry.setAttribute(L.LABEL,I),this.selectedCountryInner.innerHTML=O}if(s){let y=p?`+${p}`:"";this.#I.textContent=y,this.#L()}}};var q0=u=>{let{onlyCountries:e,excludeCountries:n}=u;if(e?.length){let $=e.map(s=>s.toLowerCase());return z.filter(s=>$.includes(s.iso2))}else if(n?.length){let $=n.map(s=>s.toLowerCase());return z.filter(s=>!$.includes(s.iso2))}return z},d2=(u,e)=>{let{countryNameLocale:n,i18n:$}=e,s;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?s=new Intl.DisplayNames(n,{type:"region"}):s=null}catch(r){console.error(r),s=null}for(let r of u)r.name=$[r.iso2]||s?.of(r.iso2.toUpperCase())||""},t2=u=>{let e=new Set,n=0,$={},s=(c,p)=>{if(!c||!p)return;p.length>n&&(n=p.length),$.hasOwnProperty(p)||($[p]=[]);let g=$[p];g.includes(c)||g.push(c)},r=[...u].sort((c,p)=>c.priority-p.priority);for(let c of r){e.has(c.dialCode)||e.add(c.dialCode);for(let p=1;p<c.dialCode.length;p++){let g=c.dialCode.substring(0,p);s(c.iso2,g)}if(s(c.iso2,c.dialCode),c.areaCodes){let p=$[c.dialCode][0];for(let g of c.areaCodes){for(let y=1;y<g.length;y++){let I=g.substring(0,y),T=c.dialCode+I;s(p,T),s(c.iso2,T)}s(c.iso2,c.dialCode+g)}}}return{dialCodes:e,dialCodeMaxLen:n,dialCodeToIso2Map:$}},e2=(u,e)=>{e.countryOrder&&(e.countryOrder=e.countryOrder.map(n=>n.toLowerCase())),u.sort((n,$)=>{let{countryOrder:s}=e;if(s){let r=s.indexOf(n.iso2),c=s.indexOf($.iso2),p=r>-1,g=c>-1;if(p||g)return p&&g?r-c:p?-1:1}return n.name.localeCompare($.name)})},n2=u=>{for(let e of u)e.normalisedName=R1(e.name),e.initials=e.normalisedName.split(/[^a-z]/).map(n=>n[0]).join(""),e.dialCodePlus=`+${e.dialCode}`};var B2=new Set(["800","808","870","881","882","883","888","979"]),X1=u=>{let e=Q(u).slice(0,3);return u.startsWith("+")&&B2.has(e)};var z1=(u,e,n,$)=>{let s=u;if(n&&e){let r=`+${$.dialCode}`,c=s[r.length]===" "||s[r.length]==="-"?r.length+1:r.length;s=s.substring(c)}return s},$2=(u,e,n,$,s)=>{let r=n?n.formatNumberAsYouType(u,$.iso2):u,{dialCode:c}=$;return s&&e.charAt(0)!=="+"&&r.includes(`+${c}`)?(r.split(`+${c}`)[1]||"").trim():r};var i2=(u,e,n,$)=>{if(n===0&&!$)return 0;let s=0;for(let r=0;r<e.length;r++){if(/[+0-9]/.test(e[r])&&s++,s===u&&!$)return r+1;if($&&s===u+1)return r}return e.length};var k2=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],J1=u=>{let e=Q(u);if(e.startsWith(D1.NANP)&&e.length>=4){let n=e.substring(1,4);return k2.includes(n)}return!1};var x1=class{#d;constructor(){}#t(e){/[\u0660-\u0669]/.test(e)?this.#d="arabic-indic":/[\u06F0-\u06F9]/.test(e)?this.#d="persian":this.#d="ascii"}denormalise(e,n){if(this.#d||this.#t(n),this.#d==="ascii")return e;let $=this.#d==="arabic-indic"?1632:1776;return e.replace(/[0-9]/g,s=>String.fromCharCode($+Number(s)))}normalise(e){if(!e)return"";if(this.#t(e),this.#d==="ascii")return e;let n=this.#d==="arabic-indic"?1632:1776,$=this.#d==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return e.replace($,s=>String.fromCharCode(48+(s.charCodeAt(0)-n)))}isAscii(){return this.#d==="ascii"}};var G2=0,W2=new Set(z.map(u=>u.iso2)),Q1=u=>W2.has(u),C1=class u{#d;#t;#f;#l;#u;#c;#y;#I;#e;#n;#o;#i;#a;#$;#s;#E;#g;#m;constructor(e,n={}){this.id=G2++,r1.validateInput(e);let $=V0(n);this.#t={...M1,...$},Y0(this.#t),this.#d=new r1(e,this.#t,this.id),this.#f=j0(),this.#$=new x1,this.promise=this.#R(this.#t),this.#l=q0(this.#t);let{dialCodes:s,dialCodeMaxLen:r,dialCodeToIso2Map:c}=t2(this.#l);this.#y=s,this.#u=r,this.#c=c,this.#I=new Map(this.#l.map(p=>[p.iso2,p])),this.#P()}#r(){let e=this.#d.telInput.value.trim();return this.#$.normalise(e)}#h(e){let n=this.#d.telInput.value;this.#d.telInput.value=this.#$.denormalise(e,n)}#R(e){let{initialCountry:n,geoIpLookup:$,loadUtils:s}=e,r=n===i1.AUTO&&!!$,c=!!s&&!C.utils,p;r?p=new Promise((y,I)=>{this.#s=y,this.#E=I}):(p=Promise.resolve(void 0),this.#s=()=>{},this.#E=()=>{});let g;return c?g=new Promise((y,I)=>{this.#g=y,this.#m=I}):(g=Promise.resolve(void 0),this.#g=()=>{},this.#m=()=>{}),Promise.all([p,g])}#P(){this.#e={},this.#i=new AbortController,this.#x(),this.#d.generateMarkup(this.#l),this.#L(),this.#N(),this.#T(),this.#t.dropdownAlwaysOpen&&this.#_()}#x(){d2(this.#l,this.#t),e2(this.#l,this.#t),n2(this.#l)}#L(e=!1){let n=this.#d.telInput.getAttribute("value"),$=this.#$.normalise(n),s=this.#r(),c=$&&$.startsWith("+")&&(!s||!s.startsWith("+"))?$:s,p=this.#O(c),g=J1(c),{initialCountry:y,geoIpLookup:I}=this.#t,O=y===i1.AUTO&&I&&!e,B=y.toLowerCase(),w=Q1(B);p?g?w?this.#C(B):O||this.#C(H0.ISO2):this.#G(c):w?this.#C(B):O||this.#C(""),c&&this.#S(c)}#N(){this.#B(),this.#t.allowDropdown&&this.#U(),(this.#d.hiddenInput||this.#d.hiddenInputCountry)&&this.#d.telInput.form&&this.#H()}#H(){let e=()=>{this.#d.hiddenInput&&(this.#d.hiddenInput.value=this.getNumber()),this.#d.hiddenInputCountry&&(this.#d.hiddenInputCountry.value=this.#e.iso2||"")};this.#d.telInput.form?.addEventListener("submit",e,{signal:this.#i.signal})}#U(){let e=this.#i.signal,n=c=>{this.#d.isDropdownClosed()?this.#d.telInput.focus():c.preventDefault()},$=this.#d.telInput.closest("label");$&&$.addEventListener("click",n,{signal:e});let s=()=>{this.#d.isDropdownClosed()&&!this.#d.telInput.disabled&&!this.#d.telInput.readOnly&&this.#_()};this.#d.selectedCountry.addEventListener("click",s,{signal:e});let r=c=>{let p=[_.ARROW_UP,_.ARROW_DOWN,_.SPACE,_.ENTER];this.#d.isDropdownClosed()&&p.includes(c.key)&&(c.preventDefault(),c.stopPropagation(),this.#_()),c.key===_.TAB&&this.#b()};this.#d.countryContainer.addEventListener("keydown",r,{signal:e})}#T(){let{loadUtils:e,initialCountry:n,geoIpLookup:$}=this.#t;if(e&&!C.utils){let r=()=>{C.attachUtils(e)?.catch(()=>{})};if(C.documentReady())r();else{let c=()=>{r()};window.addEventListener("load",c,{signal:this.#i.signal})}}else this.#g();n===i1.AUTO&&$&&(this.#e.iso2?this.#s():this.#A())}#A(){if(C.autoCountry)this.#Z();else if(this.#d.selectedCountryInner.classList.add(b.LOADING),!C.startedLoadingAutoCountry&&(C.startedLoadingAutoCountry=!0,typeof this.#t.geoIpLookup=="function")){let e=($="")=>{this.#d.selectedCountryInner.classList.remove(b.LOADING);let s=$.toLowerCase();Q1(s)?(C.autoCountry=s,setTimeout(()=>u.forEachInstance("handleAutoCountry"))):u.forEachInstance("handleAutoCountryFailure")},n=()=>{this.#d.selectedCountryInner.classList.remove(b.LOADING),u.forEachInstance("handleAutoCountryFailure")};this.#t.geoIpLookup(e,n)}}#v(){this.#_(),this.#d.searchInput.value="+",this.#d.filterCountriesByQuery("")}#B(){this.#w(),this.#k(),this.#z()}#w(){let{strictMode:e,formatAsYouType:n,separateDialCode:$,allowDropdown:s,countrySearch:r}=this.#t,c=!1;J.ALPHA_UNICODE.test(this.#r())&&(c=!0);let p=g=>{let y=this.#r();if(this.#f&&g?.data==="+"&&$&&s&&r){let w=this.#d.telInput.selectionStart||0,K=y.substring(0,w-1),G=y.substring(w);this.#h(K+G),this.#v();return}this.#G(y)&&this.#M();let I=g?.data&&J.NON_PLUS_NUMERIC.test(g.data),T=g?.inputType===K1.PASTE&&y;I||T&&!e?c=!0:J.NON_PLUS_NUMERIC.test(y)||(c=!1);let O=g?.detail&&g.detail.isSetNumber,B=this.#$.isAscii();if(n&&!c&&!O&&B){let w=this.#d.telInput.selectionStart||0,G=y.substring(0,w).replace(J.NON_PLUS_NUMERIC_GLOBAL,"").length,V=g?.inputType===K1.DELETE_FWD,v=this.#p(),Y=$2(v,y,C.utils,this.#e,$),W=i2(G,Y,w,V);this.#h(Y),this.#d.telInput.setSelectionRange(W,W)}if($&&y.startsWith("+")&&this.#e.dialCode){let w=z1(y,!0,$,this.#e);this.#h(w)}};this.#d.telInput.addEventListener("input",p,{signal:this.#i.signal})}#k(){let{strictMode:e,separateDialCode:n,allowDropdown:$,countrySearch:s}=this.#t;if(e||n){let r=c=>{if(c.key&&c.key.length===1&&!c.altKey&&!c.ctrlKey&&!c.metaKey){if(n&&$&&s&&c.key==="+"){c.preventDefault(),this.#v();return}if(e){let p=this.#r(),y=!p.startsWith("+")&&this.#d.telInput.selectionStart===0&&c.key==="+",I=this.#$.normalise(c.key),T=/^[0-9]$/.test(I),O=n?T:y||T,B=this.#d.telInput,w=B.selectionStart,K=B.selectionEnd,G=p.slice(0,w),V=p.slice(K),v=G+c.key+V,Y=this.#p(v),W=C.utils.getCoreNumber(Y,this.#e.iso2),l1=this.#n&&W.length>this.#n,y1=this.#F(Y)!==null;(!O||l1&&!y1&&!y)&&c.preventDefault()}}};this.#d.telInput.addEventListener("keydown",r,{signal:this.#i.signal})}}#z(){if(this.#t.strictMode){let e=n=>{n.preventDefault();let $=this.#d.telInput,s=$.selectionStart,r=$.selectionEnd,c=this.#r(),p=c.slice(0,s),g=c.slice(r),y=this.#e.iso2,I=n.clipboardData.getData("text"),T=this.#$.normalise(I),O=s===0&&r>0,B=!c.startsWith("+")||O,w=T.replace(J.NON_PLUS_NUMERIC_GLOBAL,""),K=w.startsWith("+"),G=w.replace(/\+/g,""),V=K&&B?`+${G}`:G,v=p+V+g;if(v.length>5){let W=C.utils.getCoreNumber(v,y);for(;W.length===0&&v.length>0;)v=v.slice(0,-1),W=C.utils.getCoreNumber(v,y);if(!W)return;if(this.#n&&W.length>this.#n)if($.selectionEnd===c.length){let l1=W.length-this.#n;v=v.slice(0,v.length-l1)}else return}this.#h(v);let Y=s+V.length;$.setSelectionRange(Y,Y),$.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.#d.telInput.addEventListener("paste",e,{signal:this.#i.signal})}}#J(e){let n=Number(this.#d.telInput.getAttribute("maxlength"));return n&&e.length>n?e.substring(0,n):e}#D(e,n={}){let $=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});this.#d.telInput.dispatchEvent($)}#_(){let{dropdownContainer:e,useFullscreenPopup:n}=this.#t;if(this.#a=new AbortController,this.#d.openDropdown(),!n&&e){let $=()=>this.#b();window.addEventListener("scroll",$,{signal:this.#a.signal})}this.#Q(),this.#D(g1.OPEN_COUNTRY_DROPDOWN)}#Q(){let e=this.#a.signal;this.#q(e),this.#d1(e),this.#t.dropdownAlwaysOpen||this.#t1(e),this.#e1(e),this.#t.countrySearch&&this.#n1(e)}#q(e){let n=$=>{let s=$.target?.closest(`.${b.COUNTRY_ITEM}`);s&&this.#d.highlightListItem(s,!1)};this.#d.countryList.addEventListener("mouseover",n,{signal:e})}#d1(e){let n=$=>{let s=$.target?.closest(`.${b.COUNTRY_ITEM}`);s&&this.#V(s)};this.#d.countryList.addEventListener("click",n,{signal:e})}#t1(e){let n=$=>{!!$.target.closest(`#iti-${this.id}__dropdown-content`)||this.#b()};setTimeout(()=>{document.documentElement.addEventListener("click",n,{signal:e})},0)}#e1(e){let n="",$=null,s=r=>{[_.ARROW_UP,_.ARROW_DOWN,_.ENTER,_.ESC].includes(r.key)&&(r.preventDefault(),r.stopPropagation(),r.key===_.ARROW_UP||r.key===_.ARROW_DOWN?this.#d.handleUpDownKey(r.key):r.key===_.ENTER?this.#i1():r.key===_.ESC&&(this.#b(),this.#d.selectedCountry.focus())),!this.#t.countrySearch&&J.HIDDEN_SEARCH_CHAR.test(r.key)&&(r.stopPropagation(),$&&clearTimeout($),n+=r.key.toLowerCase(),this.#$1(n),$=setTimeout(()=>{n=""},w1.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",s,{signal:e})}#n1(e){this.#d.searchInput.addEventListener("input",()=>this.#d.handleSearchChange(),{signal:e}),this.#d.searchClearButton.addEventListener("click",()=>this.#d.handleSearchClear(),{signal:e})}#$1(e){let n=X0(this.#l,e);if(n){let $=n.nodeById[this.id];this.#d.highlightListItem($,!1),this.#d.scrollTo($)}}#i1(){this.#d.highlightedItem&&this.#V(this.#d.highlightedItem)}#S(e){let{formatOnDisplay:n,nationalMode:$,separateDialCode:s}=this.#t,r=e;if(n&&C.utils&&this.#e){let c=X1(e),p=$&&!c||!r.startsWith("+")&&!s,{NATIONAL:g,INTERNATIONAL:y}=C.utils.numberFormat,I=p?g:y;r=C.utils.formatNumber(r,this.#e.iso2,I)}r=this.#j(r),this.#h(r)}#G(e){let n=this.#F(e);return n!==null?this.#C(n):!1}#s1(e){let{dialCode:n,nationalPrefix:$}=this.#e;if(e.startsWith("+")||!n)return e;let c=$&&e.startsWith($)&&!this.#t.separateDialCode?e.substring(1):e;return`+${n}${c}`}#F(e){let n=e.indexOf("+"),$=n?e.substring(n):e,s=this.#e.iso2,r=this.#e.dialCode;$=this.#s1($);let c=this.#O($,!0),p=Q($);if(c){let g=Q(c),y=this.#c[g];if(y.length===1)return y[0]===s?null:y[0];if(!s&&this.#o&&y.includes(this.#o))return this.#o;if(r===D1.NANP&&J1(p))return null;let{areaCodes:T,priority:O}=this.#e;if(T){let V=T.map(v=>`${r}${v}`);for(let v of V)if(p.startsWith(v))return null}let w=T&&!(O===0)&&p.length>g.length,K=s&&y.includes(s)&&!w,G=s===y[0];if(!K&&!G)return y[0]}else if($.startsWith("+")&&p.length){let g=this.#e.dialCode||"";return g&&g.startsWith(p)?null:""}else if((!$||$==="+")&&!s&&this.#o)return this.#o;return null}#C(e){let n=this.#e.iso2||"";return this.#e=e?this.#I.get(e):{},this.#e.iso2&&(this.#o=this.#e.iso2),this.#d.setCountry(this.#e),this.#W(),this.#K(),n!==e}#K(){let{strictMode:e,placeholderNumberType:n,allowedNumberTypes:$}=this.#t,{iso2:s}=this.#e;if(e&&C.utils)if(s){let r=C.utils.numberType[n],c=C.utils.getExampleNumber(s,!1,r,!0),p=c;for(;C.utils.isPossibleNumber(c,s,$);)p=c,c+="0";let g=C.utils.getCoreNumber(p,s);this.#n=g.length,s==="by"&&(this.#n=g.length+1)}else this.#n=null}#W(){let{autoPlaceholder:e,placeholderNumberType:n,nationalMode:$,customPlaceholder:s}=this.#t,r=e===o1.AGGRESSIVE||!this.#d.hadInitialPlaceholder&&e===o1.POLITE;if(C.utils&&r){let c=C.utils.numberType[n],p=this.#e.iso2?C.utils.getExampleNumber(this.#e.iso2,$,c):"";p=this.#j(p),typeof s=="function"&&(p=s(p,this.#e)),this.#d.telInput.setAttribute("placeholder",p)}}#V(e){let n=e.dataset[Y1.COUNTRY_CODE],$=this.#C(n);this.#b();let s=e.dataset[Y1.DIAL_CODE];if(this.#Y(s),this.#t.formatOnDisplay){let r=this.#r();this.#S(r)}this.#d.telInput.focus(),$&&this.#M()}#b(e){this.#d.isDropdownClosed()||this.#t.dropdownAlwaysOpen&&!e||(this.#d.closeDropdown(),this.#a.abort(),this.#a=null,this.#D(g1.CLOSE_COUNTRY_DROPDOWN))}#Y(e){let n=this.#r(),$=`+${e}`,s;if(n.startsWith("+")){let r=this.#O(n);r?s=n.replace(r,$):s=$,this.#h(s)}}#O(e,n){let $="";if(e.startsWith("+")){let s="",r=!1;for(let c=0;c<e.length;c++){let p=e.charAt(c);if(/[0-9]/.test(p)){if(s+=p,!!!this.#c[s])break;if(this.#y.has(s)){if($=e.substring(0,c+1),r=!0,!n)break}else n&&r&&($=e.substring(0,c+1));if(s.length===this.#u)break}}}return $}#p(e){let n=e?this.#$.normalise(e):this.#r(),{dialCode:$}=this.#e,s,r=Q(n);return this.#t.separateDialCode&&!n.startsWith("+")&&$&&r?s=`+${$}`:s="",s+n}#j(e){let n=!!this.#O(e),$=z1(e,n,this.#t.separateDialCode,this.#e);return this.#J($)}#M(){this.#D(g1.COUNTRY_CHANGE)}#Z(){if(!this.#d.telInput){this.#s?.();return}this.#t.initialCountry===i1.AUTO&&C.autoCountry&&(this.#o=C.autoCountry,this.#e.iso2||this.#d.selectedCountryInner.classList.contains(b.GLOBE)||this.setCountry(this.#o),this.#s())}#o1(){if(!this.#d.telInput){this.#E?.();return}this.#L(!0),this.#E()}#r1(){if(!this.#d.telInput){this.#g?.();return}if(C.utils){let e=this.#r();e&&this.#S(e),this.#e.iso2&&(this.#W(),this.#K())}this.#g()}#l1(e){if(!this.#d.telInput){this.#m?.(e);return}this.#m(e)}destroy(){this.#d.telInput&&(this.#t.allowDropdown&&this.#b(!0),this.#i.abort(),this.#i=null,this.#d.destroy(),C.instances instanceof Map?C.instances.delete(this.id):delete C.instances[this.id])}isActive(){return!!this.#d?.telInput}getExtension(){return C.utils&&this.#d.telInput?C.utils.getExtension(this.#p(),this.#e.iso2):""}getNumber(e){if(C.utils&&this.#d.telInput){let{iso2:n}=this.#e,$=this.#p(),s=C.utils.formatNumber($,n,e),r=this.#d.telInput.value;return this.#$.denormalise(s,r)}return""}getNumberType(){return C.utils&&this.#d.telInput?C.utils.getNumberType(this.#p(),this.#e.iso2):V1.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.#e}getValidationError(){if(C.utils&&this.#d.telInput){let{iso2:e}=this.#e;return C.utils.getValidationError(this.#p(),e)}return V1.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:e,iso2:n}=this.#e;if(C.utils&&this.#d.telInput){let $=this.#p(),s=C.utils.getCoreNumber($,n);if(s){if(e===_1.DIAL_CODE&&s[0]===_1.MOBILE_PREFIX&&s.length!==_1.MOBILE_CORE_LENGTH)return!1;if(!J.ALPHA_UNICODE.test($)&&e){let c=$.startsWith("+")?$.slice(1+e.length):$,p=Q(c).length;if(s.length>p)return!1}}}return this.#X(!1)}isValidNumberPrecise(){return this.#X(!0)}#u1(e){return C.utils?C.utils.isPossibleNumber(e,this.#e.iso2,this.#t.allowedNumberTypes):null}#X(e){if(!C.utils||!this.#d.telInput)return null;let{allowNumberExtensions:n,allowPhonewords:$}=this.#t,s=g=>e?this.#a1(g):this.#u1(g),r=this.#p();if(!this.#e.iso2&&!X1(r)||!s(r))return!1;if(r.search(J.ALPHA_UNICODE)>-1){let g=this.#e.iso2;return C.utils.getExtension(r,g)?n:$}return!0}#a1(e){return C.utils?C.utils.isValidNumber(e,this.#e.iso2,this.#t.allowedNumberTypes):null}setCountry(e){if(!this.#d.telInput)return;let n=e?.toLowerCase();if(!Q1(n))throw new Error(`Invalid country code: '${n}'`);let $=this.#e.iso2;if(e&&n!==$||!e&&$){if(this.#C(n),this.#Y(this.#e.dialCode),this.#t.formatOnDisplay){let r=this.#r();this.#S(r)}this.#M()}}setNumber(e){if(!this.#d.telInput)return;let n=this.#$.normalise(e),$=this.#G(n);this.#S(n),$&&this.#M(),this.#D(g1.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(e){this.#d.telInput&&(this.#t.placeholderNumberType=e,this.#W())}setDisabled(e){this.#d.telInput&&(this.#d.telInput.disabled=e,e?this.#d.selectedCountry.setAttribute("disabled","true"):this.#d.selectedCountry.removeAttribute("disabled"))}static forEachInstance(e,...n){let $=C.instances,s=$ instanceof Map?Array.from($.values()):Object.values($),r=n[0];s.forEach(c=>{if(c instanceof u)switch(e){case"handleUtils":c.#r1();break;case"handleUtilsFailure":c.#l1(r);break;case"handleAutoCountry":c.#Z();break;case"handleAutoCountryFailure":c.#o1();break}})}},F2=u=>{if(!C.utils&&!C.startedLoadingUtilsScript){let e;if(typeof u=="function")try{e=Promise.resolve(u())}catch(n){return Promise.reject(n)}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 u}`));return C.startedLoadingUtilsScript=!0,e.then(n=>{let $=n?.default;if(!$||typeof $!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return C.utils=$,C1.forEachInstance("handleUtils"),!0}).catch(n=>{throw C1.forEachInstance("handleUtilsFailure",n),n})}return null},C=Object.assign((u,e)=>{let n=new C1(u,e);return C.instances[n.id]=n,u.iti=n,n},{defaults:M1,documentReady:()=>document.readyState==="complete",getCountryData:()=>z,getInstance:u=>{let e=u.dataset.intlTelInputId;return e?C.instances[e]:null},instances:{},attachUtils:F2,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.8.0"}),q1=C;(function(){var u=this||self;function e(d,t){d=d.split(".");var i=u;d[0]in i||typeof i.execScript>"u"||i.execScript("var "+d[0]);for(var o;d.length&&(o=d.shift());)d.length||t===void 0?i[o]&&i[o]!==Object.prototype[o]?i=i[o]:i=i[o]={}:i[o]=t}function n(d,t){function i(){}i.prototype=t.prototype,d.ma=t.prototype,d.prototype=new i,d.prototype.constructor=d,d.sa=function(o,l,a){for(var h=Array(arguments.length-2),f=2;f<arguments.length;f++)h[f-2]=arguments[f];return t.prototype[l].apply(o,h)}}function $(d){let t=[],i=0;for(let o in d)t[i++]=d[o];return t}var s=class{constructor(d){if(r!==r)throw Error("SafeUrl is not meant to be built directly");this.g=d}toString(){return this.g.toString()}},r={};new s("about:invalid#zClosurez"),new s("about:blank");let c={};class p{constructor(){if(c!==c)throw Error("SafeStyle is not meant to be built directly")}toString(){return""}}new p;let g={};class y{constructor(){if(g!==g)throw Error("SafeStyleSheet is not meant to be built directly")}toString(){return""}}new y;let I={};class T{constructor(){var t=u.trustedTypes&&u.trustedTypes.emptyHTML||"";if(I!==I)throw Error("SafeHtml is not meant to be built directly");this.g=t}toString(){return this.g.toString()}}new T;function O(d,t){switch(this.g=d,this.l=!!t.aa,this.h=t.i,this.s=t.type,this.o=!1,this.h){case K:case G:case V:case v:case Y:case w:case B:this.o=!0}this.j=t.defaultValue}var B=1,w=2,K=3,G=4,V=6,v=16,Y=18;function W(d,t){for(this.h=d,this.g={},d=0;d<t.length;d++){var i=t[d];this.g[i.g]=i}}function l1(d){return d=$(d.g),d.sort(function(t,i){return t.g-i.g}),d}function P(){this.h={},this.j=this.m().g,this.g=this.l=null}P.prototype.has=function(d){return H(this,d.g)},P.prototype.get=function(d,t){return m(this,d.g,t)},P.prototype.set=function(d,t){M(this,d.g,t)},P.prototype.add=function(d,t){d0(this,d.g,t)};function y1(d,t){for(var i=l1(d.m()),o=0;o<i.length;o++){var l=i[o],a=l.g;if(H(t,a)){d.g&&delete d.g[l.g];var h=l.h==11||l.h==10;if(l.l){l=x(t,a);for(var f=0;f<l.length;f++)d0(d,a,h?l[f].clone():l[f])}else l=I1(t,a),h?(h=I1(d,a))?y1(h,l):M(d,a,l.clone()):M(d,a,l)}}}P.prototype.clone=function(){var d=new this.constructor;return d!=this&&(d.h={},d.g&&(d.g={}),y1(d,this)),d};function H(d,t){return d.h[t]!=null}function I1(d,t){var i=d.h[t];if(i==null)return null;if(d.l){if(!(t in d.g)){var o=d.l,l=d.j[t];if(i!=null)if(l.l){for(var a=[],h=0;h<i.length;h++)a[h]=o.h(l,i[h]);i=a}else i=o.h(l,i);return d.g[t]=i}return d.g[t]}return i}function m(d,t,i){var o=I1(d,t);return d.j[t].l?o[i||0]:o}function S(d,t){if(H(d,t))d=m(d,t);else d:{if(d=d.j[t],d.j===void 0)if(t=d.s,t===Boolean)d.j=!1;else if(t===Number)d.j=0;else if(t===String)d.j=d.o?"0":"";else{d=new t;break d}d=d.j}return d}function x(d,t){return I1(d,t)||[]}function q(d,t){return d.j[t].l?H(d,t)?d.h[t].length:0:H(d,t)?1:0}function M(d,t,i){d.h[t]=i,d.g&&(d.g[t]=i)}function d0(d,t,i){d.h[t]||(d.h[t]=[]),d.h[t].push(i),d.g&&delete d.g[t]}function E1(d,t){var i=[],o;for(o in t)o!=0&&i.push(new O(o,t[o]));return new W(d,i)}function b1(){}b1.prototype.g=function(d){throw new d.h,Error("Unimplemented")},b1.prototype.h=function(d,t){if(d.h==11||d.h==10)return t instanceof P?t:this.g(d.s.prototype.m(),t);if(d.h==14)return typeof t=="string"&&t0.test(t)&&(d=Number(t),0<d)?d:t;if(!d.o)return t;if(d=d.s,d===String){if(typeof t=="number")return String(t)}else if(d===Number&&typeof t=="string"&&(t==="Infinity"||t==="-Infinity"||t==="NaN"||t0.test(t)))return Number(t);return t};var t0=/^-?[0-9]+$/;function H1(){}n(H1,b1),H1.prototype.g=function(d,t){return d=new d.h,d.l=this,d.h=t,d.g={},d};function u1(){}n(u1,H1),u1.prototype.h=function(d,t){return d.h==8?!!t:b1.prototype.h.apply(this,arguments)},u1.prototype.g=function(d,t){return u1.ma.g.call(this,d,t)};function D(d,t){d!=null&&this.g.apply(this,arguments)}D.prototype.h="",D.prototype.set=function(d){this.h=""+d},D.prototype.g=function(d,t,i){if(this.h+=String(d),t!=null)for(let o=1;o<arguments.length;o++)this.h+=arguments[o];return this};function U(d){d.h=""}D.prototype.toString=function(){return this.h};function e1(){P.call(this)}n(e1,P);var e0=null;function A(){P.call(this)}n(A,P);var n0=null;function n1(){P.call(this)}n(n1,P);var $0=null;e1.prototype.m=function(){var d=e0;return d||(e0=d=E1(e1,{0:{name:"NumberFormat",ia:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,i:9,type:String},2:{name:"format",required:!0,i:9,type:String},3:{name:"leading_digits_pattern",aa:!0,i:9,type:String},4:{name:"national_prefix_formatting_rule",i:9,type:String},6:{name:"national_prefix_optional_when_formatting",i:8,defaultValue:!1,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",i:9,type:String}})),d},e1.m=e1.prototype.m,A.prototype.m=function(){var d=n0;return d||(n0=d=E1(A,{0:{name:"PhoneNumberDesc",ia:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",i:9,type:String},9:{name:"possible_length",aa:!0,i:5,type:Number},10:{name:"possible_length_local_only",aa:!0,i:5,type:Number},6:{name:"example_number",i:9,type:String}})),d},A.m=A.prototype.m,n1.prototype.m=function(){var d=$0;return d||($0=d=E1(n1,{0:{name:"PhoneMetadata",ia:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",i:11,type:A},2:{name:"fixed_line",i:11,type:A},3:{name:"mobile",i:11,type:A},4:{name:"toll_free",i:11,type:A},5:{name:"premium_rate",i:11,type:A},6:{name:"shared_cost",i:11,type:A},7:{name:"personal_number",i:11,type:A},8:{name:"voip",i:11,type:A},21:{name:"pager",i:11