UNPKG

intl-tel-input

Version:

A JavaScript plugin for entering and validating international telephone numbers

27 lines (25 loc) 309 kB
/* * International Telephone Input v25.12.4 * 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 R1=Object.defineProperty;var h2=Object.getOwnPropertyDescriptor;var p2=Object.getOwnPropertyNames;var f2=Object.prototype.hasOwnProperty;var C2=(h,e)=>{for(var n in e)R1(h,n,{get:e[n],enumerable:!0})},m2=(h,e,n,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of p2(e))!f2.call(h,r)&&r!==n&&R1(h,r,{get:()=>e[r],enumerable:!(i=h2(e,r))||i.enumerable});return h};var g2=h=>m2(R1({},"__esModule",{value:!0}),h);var w2={};C2(w2,{default:()=>A2});var y2=[["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"]],b0=[];for(let h of y2)b0.push({name:"",iso2:h[0],dialCode:h[1],priority:h[2]||0,areaCodes:h[3]||null,nodeById:{},nationalPrefix:h[4]||null,normalisedName:"",initials:"",dialCodePlus:""});var Z=b0;var I2={ad:"Andorra",ae:"United Arab Emirates",af:"Afghanistan",ag:"Antigua & Barbuda",ai:"Anguilla",al:"Albania",am:"Armenia",ao:"Angola",ar:"Argentina",as:"American Samoa",at:"Austria",au:"Australia",aw:"Aruba",ax:"\xC5land Islands",az:"Azerbaijan",ba:"Bosnia & Herzegovina",bb:"Barbados",bd:"Bangladesh",be:"Belgium",bf:"Burkina Faso",bg:"Bulgaria",bh:"Bahrain",bi:"Burundi",bj:"Benin",bl:"St. Barth\xE9lemy",bm:"Bermuda",bn:"Brunei",bo:"Bolivia",bq:"Caribbean Netherlands",br:"Brazil",bs:"Bahamas",bt:"Bhutan",bw:"Botswana",by:"Belarus",bz:"Belize",ca:"Canada",cc:"Cocos (Keeling) Islands",cd:"Congo - Kinshasa",cf:"Central African Republic",cg:"Congo - Brazzaville",ch:"Switzerland",ci:"C\xF4te d\u2019Ivoire",ck:"Cook Islands",cl:"Chile",cm:"Cameroon",cn:"China",co:"Colombia",cr:"Costa Rica",cu:"Cuba",cv:"Cape Verde",cw:"Cura\xE7ao",cx:"Christmas Island",cy:"Cyprus",cz:"Czechia",de:"Germany",dj:"Djibouti",dk:"Denmark",dm:"Dominica",do:"Dominican Republic",dz:"Algeria",ec:"Ecuador",ee:"Estonia",eg:"Egypt",eh:"Western Sahara",er:"Eritrea",es:"Spain",et:"Ethiopia",fi:"Finland",fj:"Fiji",fk:"Falkland Islands",fm:"Micronesia",fo:"Faroe Islands",fr:"France",ga:"Gabon",gb:"United Kingdom",gd:"Grenada",ge:"Georgia",gf:"French Guiana",gg:"Guernsey",gh:"Ghana",gi:"Gibraltar",gl:"Greenland",gm:"Gambia",gn:"Guinea",gp:"Guadeloupe",gq:"Equatorial Guinea",gr:"Greece",gt:"Guatemala",gu:"Guam",gw:"Guinea-Bissau",gy:"Guyana",hk:"Hong Kong SAR China",hn:"Honduras",hr:"Croatia",ht:"Haiti",hu:"Hungary",id:"Indonesia",ie:"Ireland",il:"Israel",im:"Isle of Man",in:"India",io:"British Indian Ocean Territory",iq:"Iraq",ir:"Iran",is:"Iceland",it:"Italy",je:"Jersey",jm:"Jamaica",jo:"Jordan",jp:"Japan",ke:"Kenya",kg:"Kyrgyzstan",kh:"Cambodia",ki:"Kiribati",km:"Comoros",kn:"St. Kitts & Nevis",kp:"North Korea",kr:"South Korea",kw:"Kuwait",ky:"Cayman Islands",kz:"Kazakhstan",la:"Laos",lb:"Lebanon",lc:"St. Lucia",li:"Liechtenstein",lk:"Sri Lanka",lr:"Liberia",ls:"Lesotho",lt:"Lithuania",lu:"Luxembourg",lv:"Latvia",ly:"Libya",ma:"Morocco",mc:"Monaco",md:"Moldova",me:"Montenegro",mf:"St. Martin",mg:"Madagascar",mh:"Marshall Islands",mk:"North Macedonia",ml:"Mali",mm:"Myanmar (Burma)",mn:"Mongolia",mo:"Macao SAR China",mp:"Northern Mariana Islands",mq:"Martinique",mr:"Mauritania",ms:"Montserrat",mt:"Malta",mu:"Mauritius",mv:"Maldives",mw:"Malawi",mx:"Mexico",my:"Malaysia",mz:"Mozambique",na:"Namibia",nc:"New Caledonia",ne:"Niger",nf:"Norfolk Island",ng:"Nigeria",ni:"Nicaragua",nl:"Netherlands",no:"Norway",np:"Nepal",nr:"Nauru",nu:"Niue",nz:"New Zealand",om:"Oman",pa:"Panama",pe:"Peru",pf:"French Polynesia",pg:"Papua New Guinea",ph:"Philippines",pk:"Pakistan",pl:"Poland",pm:"St. Pierre & Miquelon",pr:"Puerto Rico",ps:"Palestinian Territories",pt:"Portugal",pw:"Palau",py:"Paraguay",qa:"Qatar",re:"R\xE9union",ro:"Romania",rs:"Serbia",ru:"Russia",rw:"Rwanda",sa:"Saudi Arabia",sb:"Solomon Islands",sc:"Seychelles",sd:"Sudan",se:"Sweden",sg:"Singapore",sh:"St. Helena",si:"Slovenia",sj:"Svalbard & Jan Mayen",sk:"Slovakia",sl:"Sierra Leone",sm:"San Marino",sn:"Senegal",so:"Somalia",sr:"Suriname",ss:"South Sudan",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sv:"El Salvador",sx:"Sint Maarten",sy:"Syria",sz:"Eswatini",tc:"Turks & Caicos Islands",td:"Chad",tg:"Togo",th:"Thailand",tj:"Tajikistan",tk:"Tokelau",tl:"Timor-Leste",tm:"Turkmenistan",tn:"Tunisia",to:"Tonga",tr:"Turkey",tt:"Trinidad & Tobago",tv:"Tuvalu",tw:"Taiwan",tz:"Tanzania",ua:"Ukraine",ug:"Uganda",us:"United States",uy:"Uruguay",uz:"Uzbekistan",va:"Vatican City",vc:"St. Vincent & Grenadines",ve:"Venezuela",vg:"British Virgin Islands",vi:"U.S. Virgin Islands",vn:"Vietnam",vu:"Vanuatu",wf:"Wallis & Futuna",ws:"Samoa",ye:"Yemen",yt:"Mayotte",za:"South Africa",zm:"Zambia",zw:"Zimbabwe"},A0=I2;var E2={selectedCountryAriaLabel:"Change country, selected ${countryName} (${dialCode})",noCountrySelected:"Select country",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",clearSearchAriaLabel:"Clear search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"},w0=E2;var v2={...A0,...w0},O1=v2;var s1={OPEN_COUNTRY_DROPDOWN:"open:countrydropdown",CLOSE_COUNTRY_DROPDOWN:"close:countrydropdown",COUNTRY_CHANGE:"countrychange",INPUT:"input"},v={HIDE:"iti__hide",V_HIDE:"iti__v-hide",ARROW_UP:"iti__arrow--up",GLOBE:"iti__globe",FLAG:"iti__flag",COUNTRY_ITEM:"iti__country",HIGHLIGHT:"iti__highlight"},M={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",SPACE:" ",ENTER:"Enter",ESC:"Escape",TAB:"Tab"},x1={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À-ÿа-яА-Я ]$/},D0={SEARCH_DEBOUNCE_MS:100,HIDDEN_SEARCH_RESET_MS:1e3,NEXT_TICK:0},H1={UNKNOWN_NUMBER_TYPE:-99,UNKNOWN_VALIDATION_ERROR:-99},E1={SANE_SELECTED_WITH_DIAL_WIDTH:78,SANE_SELECTED_NO_DIAL_WIDTH:42,INPUT_PADDING_EXTRA_LEFT:6},v1={PLUS:"+",NANP:"1"},_1={ISO2:"gb",DIAL_CODE:"44",MOBILE_PREFIX:"7",MOBILE_CORE_LENGTH:10},M0={ISO2:"us",DIAL_CODE:"1"},l1={AGGRESSIVE:"aggressive",POLITE:"polite",OFF:"off"},S1={AUTO:"auto"},B1={COUNTRY_CODE:"countryCode",DIAL_CODE:"dialCode"},_={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 U1=h=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(h).matches,_2=()=>{if(typeof navigator<"u"&&typeof window<"u"){let h=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),e=U1("(max-width: 500px)"),n=U1("(max-height: 600px)"),i=U1("(pointer: coarse)");return h||e||i&&n}return!1},G1={allowPhonewords:!1,allowDropdown:!0,autoPlaceholder:l1.POLITE,containerClass:"",countryOrder:null,countrySearch:!0,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",loadUtils:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:_2(),validationNumberTypes:["MOBILE"]},P0=(h,e)=>{h.useFullscreenPopup&&(h.fixDropdownWidth=!1),h.onlyCountries.length===1&&(h.initialCountry=h.onlyCountries[0]),h.separateDialCode&&(h.nationalMode=!1),h.allowDropdown&&!h.showFlags&&!h.separateDialCode&&(h.nationalMode=!1),h.useFullscreenPopup&&!h.dropdownContainer&&(h.dropdownContainer=document.body),h.i18n={...e,...h.i18n}};var t1=h=>h.replace(/\D/g,""),L1=(h="")=>h.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();var R0=(h,e)=>{let n=L1(e),i=[],r=[],a=[],u=[],f=[],m=[];for(let E of h)E.iso2===n?i.push(E):E.normalisedName.startsWith(n)?r.push(E):E.normalisedName.includes(n)?a.push(E):n===E.dialCode||n===E.dialCodePlus?u.push(E):E.dialCodePlus.includes(n)?f.push(E):E.initials.includes(n)&&m.push(E);let I=(E,N)=>E.priority-N.priority;return[...i.sort(I),...r.sort(I),...a.sort(I),...u.sort(I),...f.sort(I),...m.sort(I)]},O0=(h,e)=>{let n=e.toLowerCase();for(let i of h)if(i.name.toLowerCase().startsWith(n))return i;return null};var T1=h=>Object.keys(h).filter(e=>!!h[e]).join(" "),L=(h,e,n)=>{let i=document.createElement(h);return e&&Object.entries(e).forEach(([r,a])=>i.setAttribute(r,a)),n&&n.appendChild(i),i};var x0=()=>` <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${_.HIDDEN}="true"> <circle cx="11" cy="11" r="7" /> <line x1="21" y1="21" x2="16.65" y2="16.65" /> </svg>`,H0=h=>{let e=`iti-${h}-clear-mask`;return` <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${_.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>`};var u1=class{constructor(e,n,i){this.highlightedItem=null;e.dataset.intlTelInputId=i.toString(),this.telInput=e,this.options=n,this.id=i,this.hadInitialPlaceholder=!!e.getAttribute("placeholder"),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.originalPaddingLeft=this.telInput.style.paddingLeft)}generateMarkup(e){this.countries=e,this._prepareTelInput();let n=this._createWrapperAndInsert();this._maybeBuildCountryContainer(n),n.appendChild(this.telInput),this._maybeUpdateInputPaddingAndReveal(),this._maybeBuildHiddenInputs(n)}_prepareTelInput(){this.telInput.classList.add("iti__tel-input"),!this.telInput.hasAttribute("autocomplete")&&!this.telInput.form?.hasAttribute("autocomplete")&&this.telInput.setAttribute("autocomplete","off")}_createWrapperAndInsert(){let{allowDropdown:e,showFlags:n,containerClass:i,useFullscreenPopup:r}=this.options,a=T1({iti:!0,"iti--allow-dropdown":e,"iti--show-flags":n,"iti--inline-dropdown":!r,[i]:!!i}),u=L("div",{class:a});return this.isRTL&&u.setAttribute("dir","ltr"),this.telInput.before(u),u}_maybeBuildCountryContainer(e){let{allowDropdown:n,separateDialCode:i,showFlags:r}=this.options;if(n||r||i){this.countryContainer=L("div",{class:`iti__country-container ${v.V_HIDE}`},e),n?(this.selectedCountry=L("button",{type:"button",class:"iti__selected-country",[_.EXPANDED]:"false",[_.LABEL]:this.options.i18n.noCountrySelected,[_.HASPOPUP]:"dialog",[_.CONTROLS]:`iti-${this.id}__dropdown-content`},this.countryContainer),this.telInput.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=L("div",{class:"iti__selected-country"},this.countryContainer);let a=L("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=L("div",{class:v.FLAG},a),n&&(this.dropdownArrow=L("div",{class:"iti__arrow",[_.HIDDEN]:"true"},a)),i&&(this.selectedDialCode=L("div",{class:"iti__selected-dial-code"},this.selectedCountry)),n&&this._buildDropdownContent()}}_buildDropdownContent(){let{fixDropdownWidth:e,useFullscreenPopup:n,countrySearch:i,i18n:r,dropdownContainer:a,containerClass:u}=this.options,f=e?"":"iti--flexible-dropdown-width";if(this.dropdownContent=L("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${v.HIDE} ${f}`,role:"dialog",[_.MODAL]:"true"}),this.isRTL&&this.dropdownContent.setAttribute("dir","rtl"),i&&this._buildSearchUI(),this.countryList=L("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[_.LABEL]:r.countryListAriaLabel},this.dropdownContent),this._appendListItems(),i&&this.updateSearchResultsA11yText(),a){let m=T1({iti:!0,"iti--container":!0,"iti--fullscreen-popup":n,"iti--inline-dropdown":!n,[u]:!!u});this.dropdown=L("div",{class:m}),this.dropdown.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_buildSearchUI(){let{i18n:e}=this.options,n=L("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=L("span",{class:"iti__search-icon",[_.HIDDEN]:"true"},n),this.searchIcon.innerHTML=x0(),this.searchInput=L("input",{id:`iti-${this.id}__search-input`,type:"search",class:"iti__search-input",placeholder:e.searchPlaceholder,role:"combobox",[_.EXPANDED]:"true",[_.LABEL]:e.searchPlaceholder,[_.CONTROLS]:`iti-${this.id}__country-listbox`,[_.AUTOCOMPLETE]:"list",autocomplete:"off"},n),this.searchClearButton=L("button",{type:"button",class:`iti__search-clear ${v.HIDE}`,[_.LABEL]:e.clearSearchAriaLabel,tabindex:"-1"},n),this.searchClearButton.innerHTML=H0(this.id),this.searchResultsA11yText=L("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=L("div",{class:`iti__no-results ${v.HIDE}`,[_.HIDDEN]:"true"},this.dropdownContent),this.searchNoResults.textContent=e.zeroSearchResults}_maybeUpdateInputPaddingAndReveal(){this.countryContainer&&(this.updateInputPadding(),this.countryContainer.classList.remove(v.V_HIDE))}_maybeBuildHiddenInputs(e){let{hiddenInput:n}=this.options;if(n){let i=this.telInput.getAttribute("name")||"",r=n(i);if(r.phone){let a=this.telInput.form?.querySelector(`input[name="${r.phone}"]`);a?this.hiddenInput=a:(this.hiddenInput=L("input",{type:"hidden",name:r.phone}),e.appendChild(this.hiddenInput))}if(r.country){let a=this.telInput.form?.querySelector(`input[name="${r.country}"]`);a?this.hiddenInputCountry=a:(this.hiddenInputCountry=L("input",{type:"hidden",name:r.country}),e.appendChild(this.hiddenInputCountry))}}}_appendListItems(){let e=document.createDocumentFragment();for(let n=0;n<this.countries.length;n++){let i=this.countries[n],r=T1({[v.COUNTRY_ITEM]:!0,[v.HIGHLIGHT]:n===0}),a=L("li",{id:`iti-${this.id}__item-${i.iso2}`,class:r,tabindex:"-1",role:"option",[_.SELECTED]:"false"});a.dataset.dialCode=i.dialCode,a.dataset.countryCode=i.iso2,i.nodeById[this.id]=a,this.options.showFlags&&L("div",{class:`${v.FLAG} iti__${i.iso2}`},a);let u=L("span",{class:"iti__country-name"},a);u.textContent=i.name;let f=L("span",{class:"iti__dial-code"},a);this.isRTL&&f.setAttribute("dir","ltr"),f.textContent=`+${i.dialCode}`,e.appendChild(a)}this.countryList.appendChild(e)}updateInputPadding(){if(this.selectedCountry){let e=this.options.separateDialCode?E1.SANE_SELECTED_WITH_DIAL_WIDTH:E1.SANE_SELECTED_NO_DIAL_WIDTH,i=(this.selectedCountry.offsetWidth||this._getHiddenSelectedCountryWidth()||e)+E1.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${i}px`}}_getHiddenSelectedCountryWidth(){if(this.telInput.parentNode){let e;try{e=window.top.document.body}catch{e=document.body}let n=this.telInput.parentNode.cloneNode(!1);n.style.visibility="hidden",e.appendChild(n);let i=this.countryContainer.cloneNode();n.appendChild(i);let r=this.selectedCountry.cloneNode(!0);i.appendChild(r);let a=r.offsetWidth;return e.removeChild(n),a}return 0}updateSearchResultsA11yText(){let{i18n:e}=this.options,n=this.countryList.childElementCount,i;n===0?i=e.zeroSearchResults:e.searchResultsText?i=e.searchResultsText(n):n===1?i=e.oneSearchResult:i=e.multipleSearchResults.replace("${count}",n.toString()),this.searchResultsA11yText.textContent=i}scrollTo(e){let n=this.countryList,i=document.documentElement.scrollTop,r=n.offsetHeight,a=n.getBoundingClientRect().top+i,u=a+r,f=e.offsetHeight,m=e.getBoundingClientRect().top+i,I=m+f,E=m-a+n.scrollTop;if(m<a)n.scrollTop=E;else if(I>u){let N=r-f;n.scrollTop=E-N}}highlightListItem(e,n){let i=this.highlightedItem;if(i&&(i.classList.remove(v.HIGHLIGHT),i.setAttribute(_.SELECTED,"false")),this.highlightedItem=e,this.highlightedItem&&(this.highlightedItem.classList.add(v.HIGHLIGHT),this.highlightedItem.setAttribute(_.SELECTED,"true"),this.options.countrySearch)){let r=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(_.ACTIVE_DESCENDANT,r)}n&&this.highlightedItem.focus()}filterCountries(e){this.countryList.innerHTML="";let n=!0;for(let i of e){let r=i.nodeById[this.id];r&&(this.countryList.appendChild(r),n&&(this.highlightListItem(r,!1),n=!1))}n?(this.highlightListItem(null,!1),this.searchNoResults&&this.searchNoResults.classList.remove(v.HIDE)):this.searchNoResults&&this.searchNoResults.classList.add(v.HIDE),this.countryList.scrollTop=0,this.updateSearchResultsA11yText()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.options.separateDialCode&&(this.telInput.style.paddingLeft=this.originalPaddingLeft);let e=this.telInput.parentNode;e.before(this.telInput),e.remove(),this.telInput=null,this.countryContainer=null,this.selectedCountry=null,this.selectedCountryInner=null,this.selectedDialCode=null,this.dropdownArrow=null,this.dropdownContent=null,this.searchInput=null,this.searchIcon=null,this.searchClearButton=null,this.searchNoResults=null,this.searchResultsA11yText=null,this.countryList=null,this.dropdown=null,this.hiddenInput=null,this.hiddenInputCountry=null,this.highlightedItem=null;for(let n of this.countries)delete n.nodeById[this.id];this.countries=null}};var B0=h=>{let{onlyCountries:e,excludeCountries:n}=h;if(e.length){let i=e.map(r=>r.toLowerCase());return Z.filter(r=>i.includes(r.iso2))}else if(n.length){let i=n.map(r=>r.toLowerCase());return Z.filter(r=>!i.includes(r.iso2))}return Z},U0=(h,e)=>{for(let n of h){let i=n.iso2.toLowerCase();e.i18n[i]&&(n.name=e.i18n[i])}},G0=(h,e)=>{let n=new Set,i=0,r={},a=(u,f,m)=>{if(!u||!f)return;f.length>i&&(i=f.length),r.hasOwnProperty(f)||(r[f]=[]);let I=r[f];if(I.includes(u))return;let E=m!==void 0?m:I.length;I[E]=u};for(let u of h){n.has(u.dialCode)||n.add(u.dialCode);for(let f=1;f<u.dialCode.length;f++){let m=u.dialCode.substring(0,f);a(u.iso2,m)}a(u.iso2,u.dialCode,u.priority)}(e.onlyCountries.length||e.excludeCountries.length)&&n.forEach(u=>{r[u]=r[u].filter(Boolean)});for(let u of h)if(u.areaCodes){let f=r[u.dialCode][0];for(let m of u.areaCodes){for(let I=1;I<m.length;I++){let E=m.substring(0,I),N=u.dialCode+E;a(f,N),a(u.iso2,N)}a(u.iso2,u.dialCode+m)}}return{dialCodes:n,dialCodeMaxLen:i,dialCodeToIso2Map:r}},k0=(h,e)=>{e.countryOrder&&(e.countryOrder=e.countryOrder.map(n=>n.toLowerCase())),h.sort((n,i)=>{let{countryOrder:r}=e;if(r){let a=r.indexOf(n.iso2),u=r.indexOf(i.iso2),f=a>-1,m=u>-1;if(f||m)return f&&m?a-u:f?-1:1}return n.name.localeCompare(i.name)})},F0=h=>{for(let e of h)e.normalisedName=L1(e.name),e.initials=e.normalisedName.split(/[^a-z]/).map(n=>n[0]).join(""),e.dialCodePlus=`+${e.dialCode}`};var K0=(h,e,n,i)=>{let r=h;if(n&&e){e=`+${i.dialCode}`;let a=r[e.length]===" "||r[e.length]==="-"?e.length+1:e.length;r=r.substring(a)}return r},W0=(h,e,n,i,r)=>{let a=n?n.formatNumberAsYouType(h,i.iso2):h,{dialCode:u}=i;return r&&e.charAt(0)!=="+"&&a.includes(`+${u}`)?(a.split(`+${u}`)[1]||"").trim():a};var V0=(h,e,n,i)=>{if(n===0&&!i)return 0;let r=0;for(let a=0;a<e.length;a++){if(/[+0-9]/.test(e[a])&&r++,r===h&&!i)return a+1;if(i&&r===h+1)return a}return e.length};var S2=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],k1=h=>{let e=t1(h);if(e.startsWith(v1.NANP)&&e.length>=4){let n=e.substring(1,4);return S2.includes(n)}return!1};for(let h of Z)h.name=O1[h.iso2];var L2=0,T2=new Set(Z.map(h=>h.iso2)),F1=h=>T2.has(h),K1=class h{constructor(e,n={}){this.id=L2++,this.options={...G1,...n},P0(this.options,O1),this.ui=new u1(e,this.options,this.id),this.isAndroid=h._getIsAndroid(),this.promise=this._createInitPromises(),this.countries=B0(this.options);let{dialCodes:i,dialCodeMaxLen:r,dialCodeToIso2Map:a}=G0(this.countries,this.options);this.dialCodes=i,this.dialCodeMaxLen=r,this.dialCodeToIso2Map=a,this.countryByIso2=new Map(this.countries.map(u=>[u.iso2,u])),this._init()}static _getIsAndroid(){return typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1}_createInitPromises(){let e=new Promise((i,r)=>{this.resolveAutoCountryPromise=i,this.rejectAutoCountryPromise=r}),n=new Promise((i,r)=>{this.resolveUtilsScriptPromise=i,this.rejectUtilsScriptPromise=r});return Promise.all([e,n])}_init(){this.selectedCountryData={},this.abortController=new AbortController,this._processCountryData(),this.ui.generateMarkup(this.countries),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){U0(this.countries,this.options),k0(this.countries,this.options),F0(this.countries)}_setInitialState(e=!1){let n=this.ui.telInput.getAttribute("value"),i=this.ui.telInput.value,a=n&&n.startsWith("+")&&(!i||!i.startsWith("+"))?n:i,u=this._getDialCode(a),f=k1(a),{initialCountry:m,geoIpLookup:I}=this.options,E=m===S1.AUTO&&I;if(u&&!f)this._updateCountryFromNumber(a);else if(!E||e){let N=m?m.toLowerCase():"";F1(N)?this._setCountry(N):u&&f?this._setCountry(M0.ISO2):this._setCountry("")}a&&this._updateValFromNumber(a)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.ui.hiddenInput||this.ui.hiddenInputCountry)&&this.ui.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){let e=()=>{this.ui.hiddenInput&&(this.ui.hiddenInput.value=this.getNumber()),this.ui.hiddenInputCountry&&(this.ui.hiddenInputCountry.value=this.selectedCountryData.iso2||"")};this.ui.telInput.form?.addEventListener("submit",e,{signal:this.abortController.signal})}_initDropdownListeners(){let e=this.abortController.signal,n=u=>{this.ui.dropdownContent.classList.contains(v.HIDE)?this.ui.telInput.focus():u.preventDefault()},i=this.ui.telInput.closest("label");i&&i.addEventListener("click",n,{signal:e});let r=()=>{this.ui.dropdownContent.classList.contains(v.HIDE)&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._openDropdown()};this.ui.selectedCountry.addEventListener("click",r,{signal:e});let a=u=>{this.ui.dropdownContent.classList.contains(v.HIDE)&&[M.ARROW_UP,M.ARROW_DOWN,M.SPACE,M.ENTER].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),this._openDropdown()),u.key===M.TAB&&this._closeDropdown()};this.ui.countryContainer.addEventListener("keydown",a,{signal:e})}_initRequests(){let{loadUtils:e,initialCountry:n,geoIpLookup:i}=this.options;if(e&&!g.utils){let a=()=>{g.attachUtils(e)?.catch(()=>{})};if(g.documentReady())a();else{let u=()=>{a()};window.addEventListener("load",u,{signal:this.abortController.signal})}}else this.resolveUtilsScriptPromise();n===S1.AUTO&&i&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){g.autoCountry?this.handleAutoCountry():g.startedLoadingAutoCountry||(g.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((e="")=>{let n=e.toLowerCase();F1(n)?(g.autoCountry=n,setTimeout(()=>a1("handleAutoCountry"))):(this._setInitialState(!0),a1("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),a1("rejectAutoCountryPromise")}))}_openDropdownWithPlus(){this._openDropdown(),this.ui.searchInput.value="+",this._filterCountriesByQuery("")}_initTelInputListeners(){this._bindInputListener(),this._maybeBindKeydownListener(),this._maybeBindPasteListener()}_bindInputListener(){let{strictMode:e,formatAsYouType:n,separateDialCode:i,allowDropdown:r,countrySearch:a}=this.options,u=!1;J.ALPHA_UNICODE.test(this.ui.telInput.value)&&(u=!0);let f=m=>{if(this.isAndroid&&m?.data==="+"&&i&&r&&a){let R=this.ui.telInput.selectionStart||0,F=this.ui.telInput.value.substring(0,R-1),U=this.ui.telInput.value.substring(R);this.ui.telInput.value=F+U,this._openDropdownWithPlus();return}this._updateCountryFromNumber(this.ui.telInput.value)&&this._triggerCountryChange();let I=m?.data&&J.NON_PLUS_NUMERIC.test(m.data),E=m?.inputType===x1.PASTE&&this.ui.telInput.value;I||E&&!e?u=!0:J.NON_PLUS_NUMERIC.test(this.ui.telInput.value)||(u=!1);let N=m?.detail&&m.detail.isSetNumber;if(n&&!u&&!N){let R=this.ui.telInput.selectionStart||0,U=this.ui.telInput.value.substring(0,R).replace(J.NON_PLUS_NUMERIC_GLOBAL,"").length,K=m?.inputType===x1.DELETE_FWD,A=this._getFullNumber(),O=W0(A,this.ui.telInput.value,g.utils,this.selectedCountryData,this.options.separateDialCode),k=V0(U,O,R,K);this.ui.telInput.value=O,this.ui.telInput.setSelectionRange(k,k)}};this.ui.telInput.addEventListener("input",f,{signal:this.abortController.signal})}_maybeBindKeydownListener(){let{strictMode:e,separateDialCode:n,allowDropdown:i,countrySearch:r}=this.options;if(e||n){let a=u=>{if(u.key&&u.key.length===1&&!u.altKey&&!u.ctrlKey&&!u.metaKey){if(n&&i&&r&&u.key==="+"){u.preventDefault(),this._openDropdownWithPlus();return}if(e){let f=this.ui.telInput.value,I=!f.startsWith("+")&&this.ui.telInput.selectionStart===0&&u.key==="+",E=/^[0-9]$/.test(u.key),N=n?E:I||E,R=f.slice(0,this.ui.telInput.selectionStart)+u.key+f.slice(this.ui.telInput.selectionEnd),F=this._getFullNumber(R),U=g.utils.getCoreNumber(F,this.selectedCountryData.iso2),K=this.maxCoreNumberLength&&U.length>this.maxCoreNumberLength,O=this._getNewCountryFromNumber(F)!==null;(!N||K&&!O&&!I)&&u.preventDefault()}}};this.ui.telInput.addEventListener("keydown",a,{signal:this.abortController.signal})}}_maybeBindPasteListener(){if(this.options.strictMode){let e=n=>{n.preventDefault();let i=this.ui.telInput,r=i.selectionStart,a=i.selectionEnd,u=i.value.slice(0,r),f=i.value.slice(a),m=this.selectedCountryData.iso2,I=n.clipboardData.getData("text"),E=r===0&&a>0,N=!i.value.startsWith("+")||E,R=I.replace(J.NON_PLUS_NUMERIC_GLOBAL,""),F=R.startsWith("+"),U=R.replace(/\+/g,""),K=F&&N?`+${U}`:U,A=u+K+f,O=g.utils.getCoreNumber(A,m);for(;O.length===0&&A.length>0;)A=A.slice(0,-1),O=g.utils.getCoreNumber(A,m);if(!O)return;if(this.maxCoreNumberLength&&O.length>this.maxCoreNumberLength)if(i.selectionEnd===i.value.length){let N1=O.length-this.maxCoreNumberLength;A=A.slice(0,A.length-N1)}else return;i.value=A;let k=r+K.length;i.setSelectionRange(k,k),i.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.ui.telInput.addEventListener("paste",e,{signal:this.abortController.signal})}}_cap(e){let n=Number(this.ui.telInput.getAttribute("maxlength"));return n&&e.length>n?e.substring(0,n):e}_trigger(e,n={}){let i=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});this.ui.telInput.dispatchEvent(i)}_openDropdown(){let{fixDropdownWidth:e,countrySearch:n}=this.options;if(this.dropdownAbortController=new AbortController,e&&(this.ui.dropdownContent.style.width=`${this.ui.telInput.offsetWidth}px`),this.ui.dropdownContent.classList.remove(v.HIDE),this.ui.selectedCountry.setAttribute(_.EXPANDED,"true"),this._setDropdownPosition(),n){let i=this.ui.countryList.firstElementChild;i&&(this.ui.highlightListItem(i,!1),this.ui.countryList.scrollTop=0),this.ui.searchInput.focus()}this._bindDropdownListeners(),this.ui.dropdownArrow.classList.add(v.ARROW_UP),this._trigger(s1.OPEN_COUNTRY_DROPDOWN)}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.ui.dropdown),!this.options.useFullscreenPopup){let e=this.ui.telInput.getBoundingClientRect(),n=this.ui.telInput.offsetHeight;if(this.options.dropdownContainer){this.ui.dropdown.style.top=`${e.top+n}px`,this.ui.dropdown.style.left=`${e.left}px`;let i=()=>this._closeDropdown();window.addEventListener("scroll",i,{signal:this.dropdownAbortController.signal})}}}_bindDropdownListeners(){let e=this.dropdownAbortController.signal;this._bindDropdownMouseoverListener(e),this._bindDropdownCountryClickListener(e),this._bindDropdownClickOffListener(e),this._bindDropdownKeydownListener(e),this.options.countrySearch&&this._bindDropdownSearchListeners(e)}_bindDropdownMouseoverListener(e){let n=i=>{let r=i.target?.closest(`.${v.COUNTRY_ITEM}`);r&&this.ui.highlightListItem(r,!1)};this.ui.countryList.addEventListener("mouseover",n,{signal:e})}_bindDropdownCountryClickListener(e){let n=i=>{let r=i.target?.closest(`.${v.COUNTRY_ITEM}`);r&&this._selectListItem(r)};this.ui.countryList.addEventListener("click",n,{signal:e})}_bindDropdownClickOffListener(e){let n=i=>{!!i.target.closest(`#iti-${this.id}__dropdown-content`)||this._closeDropdown()};setTimeout(()=>{document.documentElement.addEventListener("click",n,{signal:e})},0)}_bindDropdownKeydownListener(e){let n="",i=null,r=a=>{[M.ARROW_UP,M.ARROW_DOWN,M.ENTER,M.ESC].includes(a.key)&&(a.preventDefault(),a.stopPropagation(),a.key===M.ARROW_UP||a.key===M.ARROW_DOWN?this._handleUpDownKey(a.key):a.key===M.ENTER?this._handleEnterKey():a.key===M.ESC&&this._closeDropdown()),!this.options.countrySearch&&J.HIDDEN_SEARCH_CHAR.test(a.key)&&(a.stopPropagation(),i&&clearTimeout(i),n+=a.key.toLowerCase(),this._searchForCountry(n),i=setTimeout(()=>{n=""},D0.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",r,{signal:e})}_bindDropdownSearchListeners(e){let n=()=>{let u=this.ui.searchInput.value.trim();this._filterCountriesByQuery(u),this.ui.searchInput.value?this.ui.searchClearButton.classList.remove(v.HIDE):this.ui.searchClearButton.classList.add(v.HIDE)},i=null,r=()=>{i&&clearTimeout(i),i=setTimeout(()=>{n(),i=null},100)};this.ui.searchInput.addEventListener("input",r,{signal:e});let a=()=>{this.ui.searchInput.value="",this.ui.searchInput.focus(),n()};this.ui.searchClearButton.addEventListener("click",a,{signal:e})}_searchForCountry(e){let n=O0(this.countries,e);if(n){let i=n.nodeById[this.id];this.ui.highlightListItem(i,!1),this.ui.scrollTo(i)}}_filterCountriesByQuery(e){let n;e===""?n=this.countries:n=R0(this.countries,e),this.ui.filterCountries(n)}_handleUpDownKey(e){let n=e===M.ARROW_UP?this.ui.highlightedItem?.previousElementSibling:this.ui.highlightedItem?.nextElementSibling;!n&&this.ui.countryList.childElementCount>1&&(n=e===M.ARROW_UP?this.ui.countryList.lastElementChild:this.ui.countryList.firstElementChild),n&&(this.ui.scrollTo(n),this.ui.highlightListItem(n,!1))}_handleEnterKey(){this.ui.highlightedItem&&this._selectListItem(this.ui.highlightedItem)}_updateValFromNumber(e){let n=e;if(this.options.formatOnDisplay&&g.utils&&this.selectedCountryData){let i=this.options.nationalMode||!n.startsWith("+")&&!this.options.separateDialCode,{NATIONAL:r,INTERNATIONAL:a}=g.utils.numberFormat,u=i?r:a;n=g.utils.formatNumber(n,this.selectedCountryData.iso2,u)}n=this._beforeSetNumber(n),this.ui.telInput.value=n}_updateCountryFromNumber(e){let n=this._getNewCountryFromNumber(e);return n!==null?this._setCountry(n):!1}_ensureHasDialCode(e){let{dialCode:n,nationalPrefix:i}=this.selectedCountryData;if(e.startsWith("+")||!n)return e;let u=i&&e.startsWith(i)&&!this.options.separateDialCode?e.substring(1):e;return`+${n}${u}`}_getNewCountryFromNumber(e){let n=e.indexOf("+"),i=n?e.substring(n):e,r=this.selectedCountryData.iso2,a=this.selectedCountryData.dialCode;i=this._ensureHasDialCode(i);let u=this._getDialCode(i,!0),f=t1(i);if(u){let m=t1(u),I=this.dialCodeToIso2Map[m];if(I.length===1)return I[0]===r?null:I[0];if(!r&&this.defaultCountry&&I.includes(this.defaultCountry))return this.defaultCountry;if(a===v1.NANP&&k1(f))return null;let{areaCodes:N,priority:R}=this.selectedCountryData;if(N){let O=N.map(k=>`${a}${k}`);for(let k of O)if(f.startsWith(k))return null}let U=N&&!(R===0)&&f.length>m.length,K=r&&I.includes(r)&&!U,A=r===I[0];if(!K&&!A)return I[0]}else if(i.startsWith("+")&&f.length){let m=this.selectedCountryData.dialCode||"";return m&&m.startsWith(f)?null:""}else if((!i||i==="+")&&!r)return this.defaultCountry;return null}_setCountry(e){let{separateDialCode:n,showFlags:i,i18n:r}=this.options,a=this.selectedCountryData.iso2||"";if(this.selectedCountryData=e?this.countryByIso2.get(e):{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.ui.selectedCountry){let u=e&&i?`${v.FLAG} iti__${e}`:`${v.FLAG} ${v.GLOBE}`,f,m;if(e){let{name:I,dialCode:E}=this.selectedCountryData;m=I,f=r.selectedCountryAriaLabel.replace("${countryName}",I).replace("${dialCode}",`+${E}`)}else m=r.noCountrySelected,f=r.noCountrySelected;this.ui.selectedCountryInner.className=u,this.ui.selectedCountry.setAttribute("title",m),this.ui.selectedCountry.setAttribute(_.LABEL,f)}if(n){let u=this.selectedCountryData.dialCode?`+${this.selectedCountryData.dialCode}`:"";this.ui.selectedDialCode.textContent=u,this.ui.updateInputPadding()}return this._updatePlaceholder(),this._updateMaxLength(),a!==e}_updateMaxLength(){let{strictMode:e,placeholderNumberType:n,validationNumberTypes:i}=this.options,{iso2:r}=this.selectedCountryData;if(e&&g.utils)if(r){let a=g.utils.numberType[n],u=g.utils.getExampleNumber(r,!1,a,!0),f=u;for(;g.utils.isPossibleNumber(u,r,i);)f=u,u+="0";let m=g.utils.getCoreNumber(f,r);this.maxCoreNumberLength=m.length,r==="by"&&(this.maxCoreNumberLength=m.length+1)}else this.maxCoreNumberLength=null}_updatePlaceholder(){let{autoPlaceholder:e,placeholderNumberType:n,nationalMode:i,customPlaceholder:r}=this.options,a=e===l1.AGGRESSIVE||!this.ui.hadInitialPlaceholder&&e===l1.POLITE;if(g.utils&&a){let u=g.utils.numberType[n],f=this.selectedCountryData.iso2?g.utils.getExampleNumber(this.selectedCountryData.iso2,i,u):"";f=this._beforeSetNumber(f),typeof r=="function"&&(f=r(f,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",f)}}_selectListItem(e){let n=e.dataset[B1.COUNTRY_CODE],i=this._setCountry(n);this._closeDropdown();let r=e.dataset[B1.DIAL_CODE];this._updateDialCode(r),this.options.formatOnDisplay&&this._updateValFromNumber(this.ui.telInput.value),this.ui.telInput.focus(),i&&this._triggerCountryChange()}_closeDropdown(){this.ui.dropdownContent.classList.contains(v.HIDE)||(this.ui.dropdownContent.classList.add(v.HIDE),this.ui.selectedCountry.setAttribute(_.EXPANDED,"false"),this.ui.highlightedItem&&this.ui.highlightedItem.setAttribute(_.SELECTED,"false"),this.options.countrySearch&&this.ui.searchInput.removeAttribute(_.ACTIVE_DESCENDANT),this.ui.dropdownArrow.classList.remove(v.ARROW_UP),this.dropdownAbortController.abort(),this.dropdownAbortController=null,this.options.dropdownContainer&&this.ui.dropdown.remove(),this._trigger(s1.CLOSE_COUNTRY_DROPDOWN))}_updateDialCode(e){let n=this.ui.telInput.value,i=`+${e}`,r;if(n.startsWith("+")){let a=this._getDialCode(n);a?r=n.replace(a,i):r=i,this.ui.telInput.value=r}}_getDialCode(e,n){let i="";if(e.startsWith("+")){let r="",a=!1;for(let u=0;u<e.length;u++){let f=e.charAt(u);if(/[0-9]/.test(f)){if(r+=f,!!!this.dialCodeToIso2Map[r])break;if(this.dialCodes.has(r)){if(i=e.substring(0,u+1),a=!0,!n)break}else n&&a&&(i=e.substring(0,u+1));if(r.length===this.dialCodeMaxLen)break}}}return i}_getFullNumber(e){let n=e||this.ui.telInput.value.trim(),{dialCode:i}=this.selectedCountryData,r,a=t1(n);return this.options.separateDialCode&&!n.startsWith("+")&&i&&a?r=`+${i}`:r="",r+n}_beforeSetNumber(e){let n=this._getDialCode(e),i=K0(e,n,this.options.separateDialCode,this.selectedCountryData);return this._cap(i)}_triggerCountryChange(){this._trigger(s1.COUNTRY_CHANGE)}handleAutoCountry(){this.options.initialCountry===S1.AUTO&&g.autoCountry&&(this.defaultCountry=g.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(v.GLOBE)||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){g.utils&&(this.ui.telInput.value&&this._updateValFromNumber(this.ui.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){this.ui.telInput&&(this.options.allowDropdown&&this._closeDropdown(),this.abortController.abort(),this.abortController=null,this.ui.destroy(),g.instances instanceof Map?g.instances.delete(this.id):delete g.instances[this.id])}getExtension(){return g.utils?g.utils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber(e){if(g.utils){let{iso2:n}=this.selectedCountryData;return g.utils.formatNumber(this._getFullNumber(),n,e)}return""}getNumberType(){return g.utils?g.utils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):H1.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(g.utils){let{iso2:e}=this.selectedCountryData;return g.utils.getValidationError(this._getFullNumber(),e)}return H1.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:e,iso2:n}=this.selectedCountryData;if(e===_1.DIAL_CODE&&g.utils){let i=this._getFullNumber(),r=g.utils.getCoreNumber(i,n);if(r[0]===_1.MOBILE_PREFIX&&r.length!==_1.MOBILE_CORE_LENGTH)return!1}return this._validateNumber(!1)}isValidNumberPrecise(){return this._validateNumber(!0)}_utilsIsPossibleNumber(e){return g.utils?g.utils.isPossibleNumber(e,this.selectedCountryData.iso2,this.options.validationNumberTypes):null}_validateNumber(e){if(!g.utils)return null;if(!this.selectedCountryData.iso2)return!1;let n=u=>e?this._utilsIsValidNumber(u):this._utilsIsPossibleNumber(u),i=this._getFullNumber(),r=i.search(J.ALPHA_UNICODE);if(r>-1&&!this.options.allowPhonewords){let u=i.substring(0,r),f=n(u),m=n(i);return f&&m}return n(i)}_utilsIsValidNumber(e){return g.utils?g.utils.isValidNumber(e,this.selectedCountryData.iso2,this.options.validationNumberTypes):null}setCountry(e){let n=e?.toLowerCase();if(!F1(n))throw new Error(`Invalid country code: '${n}'`);let i=this.selectedCountryData.iso2;(e&&n!==i||!e&&i)&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this.options.formatOnDisplay&&this._updateValFromNumber(this.ui.telInput.value),this._triggerCountryChange())}setNumber(e){let n=this._updateCountryFromNumber(e);this._updateValFromNumber(e),n&&this._triggerCountryChange(),this._trigger(s1.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(e){this.options.placeholderNumberType=e,this._updatePlaceholder()}setDisabled(e){this.ui.telInput.disabled=e,e?this.ui.selectedCountry.setAttribute("disabled","true"):this.ui.selectedCountry.removeAttribute("disabled")}},N2=h=>{if(!g.utils&&!g.startedLoadingUtilsScript){let e;if(typeof h=="function")try{e=Promise.resolve(h())}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 h}`));return g.startedLoadingUtilsScript=!0,e.then(n=>{let i=n?.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 g.utils=i,a1("handleUtils"),!0}).catch(n=>{throw a1("rejectUtilsScriptPromise",n),n})}return null},a1=(h,...e)=>{Object.values(g.instances).forEach(n=>{let i=n[h];typeof i=="function"&&i.apply(n,e)})},g=Object.assign((h,e)=>{let n=new K1(h,e);return g.instances[n.id]=n,h.iti=n,n},{defaults:G1,documentReady:()=>document.readyState==="complete",getCountryData:()=>Z,getInstance:h=>{let e=h.dataset.intlTelInputId;return e?g.instances[e]:null},instances:{},attachUtils:N2,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"25.12.4"}),W1=g;(function(){var h=this||self;function e(d,t){d=d.split(".");var $=h;d[0]in $||typeof $.execScript>"u"||$.execScript("var "+d[0]);for(var o;d.length&&(o=d.shift());)d.length||t===void 0?$[o]&&$[o]!==Object.prototype[o]?$=$[o]:$=$[o]={}:$[o]=t}function n(d,t){function $(){}$.prototype=t.prototype,d.ma=t.prototype,d.prototype=new $,d.prototype.constructor=d,d.sa=function(o,s,l){for(var c=Array(arguments.length-2),p=2;p<arguments.length;p++)c[p-2]=arguments[p];return t.prototype[s].apply(o,c)}}function i(d){let t=[],$=0;for(let o in d)t[$++]=d[o];return t}var r=class{constructor(d){if(a!==a)throw Error("SafeUrl is not meant to be built directly");this.g=d}toString(){return this.g.toString()}},a={};new r("about:invalid#zClosurez"),new r("about:blank");let u={};class f{constructor(){if(u!==u)throw Error("SafeStyle is not meant to be built directly")}toString(){return""}}new f;let m={};class I{constructor(){if(m!==m)throw Error("SafeStyleSheet is not meant to be built directly")}toString(){return""}}new I;let E={};class N{constructor(){var t=h.trustedTypes&&h.trustedTypes.emptyHTML||"";if(E!==E)throw Error("SafeHtml is not meant to be built directly");this.g=t}toString(){return this.g.toString()}}new N;function R(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 A:case O:case k:case N1:case U:case F:this.o=!0}this.j=t.defaultValue}var F=1,U=2,K=3,A=4,O=6,k=16,N1=18;function z0(d,t){for(this.h=d,this.g={},d=0;d<t.length;d++){var $=t[d];this.g[$.g]=$}}function Z0(d){return d=i(d.g),d.sort(function(t,$){return t.g-$.g}),d}function x(){this.h={},this.j=this.m().g,this.g=this.l=null}x.prototype.has=function(d){return H(this,d.g)},x.prototype.get=function(d,t){return C(this,d.g,t)},x.prototype.set=function(d,t){w(this,d.g,t)},x.prototype.add=function(d,t){j1(this,d.g,t)};function V1(d,t){for(var $=Z0(d.m()),o=0;o<$.length;o++){var s=$[o],l=s.g;if(H(t,l)){d.g&&delete d.g[s.g];var c=s.h==11||s.h==10;if(s.l){s=P(t,l);for(var p=0;p<s.length;p++)j1(d,l,c?s[p].clone():s[p])}else s=c1(t,l),c?(c=c1(d,l))?V1(c,s):w(d,l,s.clone()):w(d,l,s)}}}x.prototype.clone=function(){var d=new this.constructor;return d!=this&&(d.h={},d.g&&(d.g={}),V1(d,this)),d};function H(d,t){return d.h[t]!=null}function c1(d,t){var $=d.h[t];if($==null)return null;if(d.l){if(!(t in d.g)){var o=d.l,s=d.j[t];if($!=null)if(s.l){for(var l=[],c=0;c<$.length;c++)l[c]=o.h(s,$[c]);$=l}else $=o.h(s,$);return d.g[t]=$}return d.g[t]}return $}function C(d,t,$){var o=c1(d,t);return d.j[t].l?o[$||0]:o}function S(d,t){if(H(d,t))d=C(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 P(d,t){return c1(d,t)||[]}function j(d,t){return d.j[t].l?H(d,t)?d.h[t].length:0:H(d,t)?1:0}function w(d,t,$){d.h[t]=$,d.g&&(d.g[t]=$)}function j1(d,t,$){d.h[t]||(d.h[t]=[]),d.h[t].push($),d.g&&delete d.g[t]}function h1(d,t){var $=[],o;for(o in t)o!=0&&$.push(new R(o,t[o]));return new z0(d,$)}function p1(){}p1.prototype.g=function(d){throw new d.h,Error("Unimplemented")},p1.prototype.h=function(d,t){if(d.h==11||d.h==10)return t instanceof x?t:this.g(d.s.prototype.m(),t);if(d.h==14)return typeof t=="string"&&Y1.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"||Y1.test(t)))return Number(t);return t};var Y1=/^-?[0-9]+$/;function b1(){}n(b1,p1),b1.prototype.g=function(d,t){return d=new d.h,d.l=this,d.h=t,d.g={},d};function e1(){}n(e1,b1),e1.prototype.h=function(d,t){return d.h==8?!!t:p1.prototype.h.apply(this,arguments)},e1.prototype.g=function(d,t){return e1.ma.g.call(this,d,t)};function b(d,t){d!=null&&this.g.apply(this,arguments)}b.prototype.h="",b.prototype.set=function(d){this.h=""+d},b.prototype.g=function(d,t,$){if(this.h+=String(d),t!=null)for(let o=1;o<arguments.length;o++)this.h+=arguments[o];return this};function B(d){d.h=""}b.prototype.toString=function(){return this.h};function X(){x.call(this)}n(X,x);var z1=null;function T(){x.call(this)}n(T,x);var Z1=null;function q(){x.call(this)}n(q,x);var J1=null;X.prototype.m=function(){var d=z1;return d||(z1=d=h1(X,{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},X.m=X.prototype.m,T.prototype.m=function(){var d=Z1;return d||(Z1=d=h1(T,{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},T.m=T.prototype.m,q.prototype.m=function(){var d=J1;return d||(J1=d=h1(q,{0:{name:"PhoneMetadata",ia:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",i:11,type:T},2:{name:"fixed_line",i:11,type:T},3:{name:"mobile",i:11,type:T},4:{name:"toll_free",i:11,type:T},5:{name:"premium_rate",i:11,type:T},6:{name:"shared_cost",i:11,type:T},7:{name:"personal_number",i:11,type:T},8:{name:"voip",i:11,type:T},21:{name:"pager",i:11,type:T},25:{name:"uan",i:11,type:T},27:{name:"emergency",i:11,type:T},28:{name:"voicemail",i:11,type:T},29:{name:"short_code",i:11,type:T},30:{name:"standard_rate",i:11,type:T},31:{name:"carrier_specific",i:11,type:T},33:{name:"sms_services",i:11,type:T},24:{name:"no_international_dialling",i:11,type:T},9:{name:"id",required:!0,i:9,type:String},10:{name:"country_code",i:5,type:Number},11:{name:"internatio