UNPKG

intl-tel-input

Version:

A JavaScript plugin for entering and validating international telephone numbers

34 lines (32 loc) 311 kB
/* * International Telephone Input v26.9.1 * 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 K1=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var A2=Object.getOwnPropertyNames;var T2=Object.prototype.hasOwnProperty;var v2=(r,t)=>{for(var n in t)K1(r,n,{get:t[n],enumerable:!0})},w2=(r,t,n,$)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of A2(t))!T2.call(r,s)&&s!==n&&K1(r,s,{get:()=>t[s],enumerable:!($=N2(t,s))||$.enumerable});return r};var D2=r=>w2(K1({},"__esModule",{value:!0}),r);var V2={};v2(V2,{default:()=>K2});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"]],V1=[];for(let r of _2)V1.push({name:"",iso2:r[0],dialCode:r[1],priority:r[2]||0,areaCodes:r[3]||null,nodeById:{},nationalPrefix:r[4]||null,normalisedName:"",initials:"",dialCodePlus:""});var O2=new Set(V1.map(r=>r.iso2)),$1=r=>O2.has(r),o1=V1;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"},D={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",SPACE:" ",ENTER:"Enter",ESC:"Escape",TAB:"Tab"},Y1={PASTE:"insertFromPaste",DELETE_FWD:"deleteContentForward"},z={ALPHA_UNICODE:/\p{L}/u,NON_PLUS_NUMERIC:/[^+0-9]/,NON_PLUS_NUMERIC_GLOBAL:/[^+0-9]/g,HIDDEN_SEARCH_CHAR:/^[a-zA-ZÀ-ÿа-яА-Я ]$/},D1={SEARCH_DEBOUNCE_MS:100,HIDDEN_SEARCH_RESET_MS:1e3,NEXT_TICK:0},j1={UNKNOWN_NUMBER_TYPE:-99,UNKNOWN_VALIDATION_ERROR:-99},K={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},_1={PLUS:"+",NANP:"1"},O1={ISO2:"gb",DIAL_CODE:"44",MOBILE_PREFIX:"7",MOBILE_CORE_LENGTH:10},H0={ISO2:"us",DIAL_CODE:"1"},r1={AGGRESSIVE:"aggressive",POLITE:"polite",OFF:"off"},i1={AUTO:"auto"},M2=["FIXED_LINE","MOBILE","FIXED_LINE_OR_MOBILE","TOLL_FREE","PREMIUM_RATE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL","UNKNOWN"],m1=new Set(M2),Z1={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 R2={selectedCountryAriaLabel:"Change country, selected ${countryName} (${dialCode})",noCountrySelected:"Select country",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",clearSearchAriaLabel:"Clear search",searchEmptyState:"No results found",searchSummaryAria(r){return r===0?"No results found":r===1?"1 result found":`${r} results found`}},U0=R2;var X1=r=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(r).matches,W0=()=>X1(`(max-width: ${K.NARROW_VIEWPORT_WIDTH}px)`),P2=()=>{if(typeof navigator<"u"&&typeof window<"u"){let r=X1("(max-height: 600px)"),t=X1("(pointer: coarse)");return W0()||t&&r}return!1},R1={allowDropdown:!0,allowedNumberTypes:["MOBILE","FIXED_LINE"],allowNumberExtensions:!1,allowPhonewords:!1,autoPlaceholder:r1.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:P2()},F0=r=>JSON.stringify(r),B0=r=>!!r&&typeof r=="object"&&!Array.isArray(r),x2=r=>typeof r=="function",H2=r=>{if(!r||typeof r!="object")return!1;let t=r;return t.nodeType===1&&typeof t.tagName=="string"&&typeof t.appendChild=="function"},k0=new Set(Object.values(r1)),M1=r=>{console.warn(`[intl-tel-input] ${r}`)},k=(r,t,n)=>{M1(`Option '${r}' must be ${t}; got ${F0(n)}. Ignoring.`)},U2=(r,t)=>Object.prototype.hasOwnProperty.call(r,t),G0=(r,t)=>{let n="an array of ISO2 country code strings";if(!Array.isArray(t))return k(r,n,t),!1;let $=[];for(let s of t){if(typeof s!="string")return k(r,n,t),!1;let l=s.toLowerCase();$1(l)?$.push(s):M1(`Invalid country code in '${r}': '${s}'. Skipping.`)}return $},K0=r=>{if(r===void 0)return{};if(!B0(r)){let n=`The second argument must be an options object; got ${F0(r)}. Using defaults.`;return M1(n),{}}let t={};for(let[n,$]of Object.entries(r)){if(!U2(R1,n)){M1(`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}t[n]=$;break;case"autoPlaceholder":if(typeof $!="string"||!k0.has($)){let s=Array.from(k0).join(", ");k("autoPlaceholder",`one of ${s}`,$);break}t[n]=$;break;case"containerClass":case"searchInputClass":case"countryNameLocale":if(typeof $!="string"){k(n,"a string",$);break}t[n]=$;break;case"countryOrder":{if($===null)t[n]=$;else{let s=G0(n,$);s!==!1&&(t[n]=s)}break}case"customPlaceholder":case"geoIpLookup":case"hiddenInput":case"loadUtils":if($!==null&&!x2($)){k(n,"a function or null",$);break}t[n]=$;break;case"dropdownContainer":if($!==null&&!H2($)){k("dropdownContainer","an HTMLElement or null",$);break}t[n]=$;break;case"excludeCountries":case"onlyCountries":{let s=G0(n,$);s!==!1&&(t[n]=s);break}case"i18n":if($&&!B0($)){k("i18n","an object",$);break}t[n]=$;break;case"initialCountry":{if(typeof $!="string"){k("initialCountry","a string",$);break}let s=$.toLowerCase();if(s&&s!==i1.AUTO&&!$1(s)){k("initialCountry","a valid ISO2 country code or 'auto'",$);break}t[n]=$;break}case"placeholderNumberType":if(typeof $!="string"||!m1.has($)){let s=Array.from(m1).join(", ");k("placeholderNumberType",`one of ${s}`,$);break}t[n]=$;break;case"allowedNumberTypes":if($!==null){if(!Array.isArray($)){k("allowedNumberTypes","an array of number types or null",$);break}let s=!0;for(let l of $)if(typeof l!="string"||!m1.has(l)){let c=Array.from(m1).join(", ");k("allowedNumberTypes",`an array of valid number types (${c})`,l),s=!1;break}s&&(t[n]=$)}else t[n]=null;break}}return t},V0=r=>{r.initialCountry&&(r.initialCountry=r.initialCountry.toLowerCase()),r.onlyCountries?.length&&(r.onlyCountries=r.onlyCountries.map(t=>t.toLowerCase())),r.excludeCountries?.length&&(r.excludeCountries=r.excludeCountries.map(t=>t.toLowerCase())),r.countryOrder&&(r.countryOrder=r.countryOrder.map(t=>t.toLowerCase()))},Y0=r=>{r.dropdownAlwaysOpen&&(r.useFullscreenPopup=!1,r.allowDropdown=!0),r.useFullscreenPopup?r.fixDropdownWidth=!1:W0()&&(r.fixDropdownWidth=!0),r.onlyCountries.length===1&&(r.initialCountry=r.onlyCountries[0]),r.separateDialCode&&(r.nationalMode=!1),r.allowDropdown&&!r.showFlags&&!r.separateDialCode&&(r.nationalMode=!1),r.useFullscreenPopup&&!r.dropdownContainer&&(r.dropdownContainer=document.body),r.i18n={...U0,...r.i18n}};var J=r=>r.replace(/\D/g,""),C1=(r="")=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();var j0=()=>typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1;var Z0=(r,t)=>{let n=C1(t),$=[],s=[],l=[],c=[],p=[],g=[];for(let E of r)E.iso2===n?$.push(E):E.normalisedName.startsWith(n)?s.push(E):E.normalisedName.includes(n)?l.push(E):n===E.dialCode||n===E.dialCodePlus?c.push(E):E.dialCodePlus.includes(n)?p.push(E):E.initials.includes(n)&&g.push(E);let y=(E,A)=>E.priority-A.priority;return[...$,...s,...l,...c.sort(y),...p.sort(y),...g]},X0=(r,t)=>{let n=C1(t);for(let $ of r)if($.normalisedName.startsWith(n))return $;return null};var P1=r=>Object.keys(r).filter(t=>!!r[t]).join(" "),N=(r,t,n)=>{let $=document.createElement(r);return t&&Object.entries(t).forEach(([s,l])=>$.setAttribute(s,l)),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=r=>{let t=`iti-${r}-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="${t}" 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(#${t})" /> </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 l1=class r{constructor(t,n,$){this.#c=null;this.#y=null;this.#$=null;this.#s=null;this.highlightedItem=null;t.dataset.intlTelInputId=$.toString(),this.telInput=t,this.#d=n,this.#t=$,this.hadInitialPlaceholder=!!t.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(t){let n=t?.tagName;if(!(!!t&&typeof t=="object"&&n==="INPUT"&&typeof t.setAttribute=="function")){let s=Object.prototype.toString.call(t);throw new TypeError(`The first argument must be an HTMLInputElement, not ${s}`)}}generateMarkup(t){this.#u=t,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:t,showFlags:n,containerClass:$,useFullscreenPopup:s}=this.#d,l=P1({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":n,"iti--inline-dropdown":!s,[$]:!!$}),c=N("div",{class:l});return this.#f&&c.setAttribute("dir","ltr"),this.telInput.before(c),c}#g(t){let{allowDropdown:n,separateDialCode:$,showFlags:s}=this.#d;if(n||s||$){this.countryContainer=N("div",{class:`iti__country-container ${b.V_HIDE}`},t),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 l=N("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=N("div",{class:b.FLAG},l),n&&(this.#e=N("div",{class:"iti__arrow",[L.HIDDEN]:"true"},l)),$&&(this.#I=N("div",{class:"iti__selected-dial-code"},this.selectedCountry)),n&&this.#r()}}#m(){let{fixDropdownWidth:t}=this.#d;if(t&&!this.#n.style.width){let n=this.telInput.offsetWidth;n>0&&(this.#n.style.width=`${n}px`)}}#r(){let{fixDropdownWidth:t,useFullscreenPopup:n,countrySearch:$,i18n:s,dropdownContainer:l,containerClass:c}=this.#d,p=t?"":"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.#A(),n||(this.#m(),this.#y=this.#U(),$&&(this.#n.style.height=`${this.#y}px`)),l){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:t,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:t.searchPlaceholder,role:"combobox",[L.EXPANDED]:"true",[L.LABEL]:t.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]:t.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=t.searchEmptyState}#R(){this.countryContainer&&(this.#L(),this.countryContainer.classList.remove(b.V_HIDE))}#P(t){let{hiddenInput:n}=this.#d;if(n){let $=this.telInput.getAttribute("name")||"",s=n($);if(s.phone){let l=this.telInput.form?.querySelector(`input[name="${s.phone}"]`);l?this.hiddenInput=l:(this.hiddenInput=N("input",{type:"hidden",name:s.phone}),t.appendChild(this.hiddenInput))}if(s.country){let l=this.telInput.form?.querySelector(`input[name="${s.country}"]`);l?this.hiddenInputCountry=l:(this.hiddenInputCountry=N("input",{type:"hidden",name:s.country}),t.appendChild(this.hiddenInputCountry))}}}#x(){let t=document.createDocumentFragment();for(let n=0;n<this.#u.length;n++){let $=this.#u[n],s=P1({[b.COUNTRY_ITEM]:!0}),l=N("li",{id:`iti-${this.#t}__item-${$.iso2}`,class:s,tabindex:"-1",role:"option",[L.SELECTED]:"false"});l.dataset.dialCode=$.dialCode,l.dataset.countryCode=$.iso2,$.nodeById[this.#t]=l,this.#d.showFlags&&N("div",{class:`${b.FLAG} iti__${$.iso2}`},l);let c=N("span",{class:"iti__country-name"},l);c.textContent=`${$.name} `;let p=N("span",{class:"iti__dial-code"},c);this.#f&&p.setAttribute("dir","ltr"),p.textContent=`(+${$.dialCode})`,t.appendChild(l)}this.countryList.appendChild(t)}#L(){if(this.selectedCountry){let t=this.#d.separateDialCode?K.SANE_SELECTED_WITH_DIAL_WIDTH:K.SANE_SELECTED_NO_DIAL_WIDTH,$=(this.selectedCountry.offsetWidth||this.#H()||t)+K.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${$}px`}}static#N(){let t;try{t=window.top.document.body}catch{t=document.body}return t}#H(){if(this.telInput.parentNode){let t=r.#N(),n=this.telInput.parentNode.cloneNode(!1);n.style.visibility="hidden",t.appendChild(n);let $=this.countryContainer.cloneNode();n.appendChild($);let s=this.selectedCountry.cloneNode(!0);$.appendChild(s);let l=s.offsetWidth;return t.removeChild(n),l}return 0}#U(){let t=r.#N();this.#n.classList.remove(b.HIDE);let n=N("div",{class:"iti iti--inline-dropdown"});n.appendChild(this.#n),n.style.visibility="hidden",t.appendChild(n);let $=this.#n.offsetHeight;return t.removeChild(n),n.style.visibility="",this.#n.classList.add(b.HIDE),$>0?$:K.SANE_DROPDOWN_HEIGHT}#A(){let{i18n:t}=this.#d,n=this.countryList.childElementCount;this.#a.textContent=t.searchSummaryAria(n)}filterCountriesByQuery(t){let n;t===""?n=this.#u:n=Z0(this.#u,t),this.#B(n)}#T(){let t=this.searchInput.value.trim();this.filterCountriesByQuery(t),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.#T(),this.#c=null},D1.SEARCH_DEBOUNCE_MS)}handleSearchClear(){this.searchInput.value="",this.searchInput.focus(),this.#T()}scrollCountryListToItem(t){let n=this.countryList,$=n.getBoundingClientRect(),s=t.getBoundingClientRect(),l=s.top-$.top+n.scrollTop;s.top<$.top?n.scrollTop=l:s.bottom>$.bottom&&(n.scrollTop=l-$.height+s.height)}highlightListItem(t,n){let $=this.highlightedItem;if($&&$.classList.remove(b.HIGHLIGHT),this.highlightedItem=t,this.highlightedItem){if(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(t){let n=t===D.ARROW_UP?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!n&&this.countryList.childElementCount>1&&(n=t===D.ARROW_UP?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this.scrollCountryListToItem(n),this.highlightListItem(n,!1))}#v(t){if(this.#s&&this.#s.dataset.countryCode!==t&&(this.#s.setAttribute(L.SELECTED,"false"),this.#s.querySelector(".iti__country-check")?.remove(),this.#s=null),t&&!this.#s){let n=this.countryList.querySelector(`[data-country-code="${t}"]`);if(n){n.setAttribute(L.SELECTED,"true");let $=N("span",{class:"iti__country-check",[L.HIDDEN]:"true"},n);$.innerHTML=Q0(),this.#s=n}}}#B(t){this.countryList.replaceChildren();let n=!0;for(let $ of t){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.#A()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.#d.separateDialCode&&(this.telInput.style.paddingLeft=this.#l);let t=this.telInput.parentNode;t.before(this.telInput),t.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:t,dropdownAlwaysOpen:n,dropdownContainer:$}=this.#d;if(this.#m(),$)this.#k();else{let s=this.#w(),l=this.telInput.offsetHeight+K.DROPDOWN_MARGIN;s?this.#n.style.top=`${l}px`:this.#n.style.bottom=`${l}px`}if(this.#n.classList.remove(b.HIDE),this.selectedCountry.setAttribute(L.EXPANDED,"true"),t){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:t,dropdownContainer:n}=this.#d;this.#n.classList.add(b.HIDE),this.selectedCountry.setAttribute(L.EXPANDED,"false"),t&&(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.#$.style.paddingLeft="",this.#$.style.paddingRight=""):(this.#n.style.top="",this.#n.style.bottom="")}#w(){if(this.#d.dropdownAlwaysOpen)return!0;let t=this.telInput.getBoundingClientRect(),n=t.top,$=window.innerHeight-t.bottom;return $>=this.#y||$>=n}#k(){let{dropdownContainer:t,useFullscreenPopup:n}=this.#d;if(n){if(window.innerWidth>=K.NARROW_VIEWPORT_WIDTH){let $=this.telInput.getBoundingClientRect();this.#$.style.paddingLeft=`${$.left}px`,this.#$.style.paddingRight=`${window.innerWidth-$.right}px`}}else{let $=this.telInput.getBoundingClientRect();this.#$.style.left=`${$.left}px`,this.#w()?this.#$.style.top=`${$.bottom+K.DROPDOWN_MARGIN}px`:(this.#$.style.top="unset",this.#$.style.bottom=`${window.innerHeight-$.top+K.DROPDOWN_MARGIN}px`)}t.appendChild(this.#$)}isDropdownClosed(){return this.#n.classList.contains(b.HIDE)}setCountry(t){let{allowDropdown:n,showFlags:$,separateDialCode:s,i18n:l}=this.#d,{name:c,dialCode:p,iso2:g=""}=t;if(n&&this.#v(g),this.selectedCountry){let y=g&&$?`${b.FLAG} iti__${g}`:`${b.FLAG} ${b.GLOBE}`,E,A,_;g?(A=c,E=l.selectedCountryAriaLabel.replace("${countryName}",c).replace("${dialCode}",`+${p}`),_=$?"":z1()):(A=l.noCountrySelected,E=l.noCountrySelected,_=z1()),this.selectedCountryInner.className=y,this.selectedCountry.setAttribute("title",A),this.selectedCountry.setAttribute(L.LABEL,E),this.selectedCountryInner.innerHTML=_}if(s){let y=p?`+${p}`:"";this.#I.textContent=y,this.#L()}}};var q0=r=>{let{onlyCountries:t,excludeCountries:n}=r;return t?.length?o1.filter($=>t.includes($.iso2)):n?.length?o1.filter($=>!n.includes($.iso2)):o1},d2=(r,t)=>{let{countryNameLocale:n,i18n:$}=t,s;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?s=new Intl.DisplayNames(n,{type:"region"}):s=null}catch(l){console.error(l),s=null}for(let l of r)l.name=$[l.iso2]||s?.of(l.iso2.toUpperCase())||""},t2=r=>{let t=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)},l=[...r].sort((c,p)=>c.priority-p.priority);for(let c of l){t.has(c.dialCode)||t.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 E=g.substring(0,y),A=c.dialCode+E;s(p,A),s(c.iso2,A)}s(c.iso2,c.dialCode+g)}}}return{dialCodes:t,dialCodeMaxLen:n,dialCodeToIso2Map:$}},e2=(r,t)=>{let{countryOrder:n}=t;r.sort(($,s)=>{if(n){let l=n.indexOf($.iso2),c=n.indexOf(s.iso2),p=l>-1,g=c>-1;if(p||g)return p&&g?l-c:p?-1:1}return $.name.localeCompare(s.name)})},n2=r=>{for(let t of r)t.normalisedName=C1(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(n=>n[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var B2=new Set(["800","808","870","881","882","883","888","979"]),J1=r=>{let t=J(r).slice(0,3);return r.startsWith("+")&&B2.has(t)};var Q1=(r,t,n,$)=>{let s=r;if(n&&t){let l=`+${$.dialCode}`,c=s[l.length]===" "||s[l.length]==="-"?l.length+1:l.length;s=s.substring(c)}return s},$2=(r,t,n,$,s)=>{let l=n?n.formatNumberAsYouType(r,$.iso2):r,{dialCode:c}=$;return s&&t.charAt(0)!=="+"&&l.includes(`+${c}`)?(l.split(`+${c}`)[1]||"").trim():l};var i2=(r,t,n,$)=>{if(n===0&&!$)return 0;let s=0;for(let l=0;l<t.length;l++){if(/[+0-9]/.test(t[l])&&s++,s===r&&!$)return l+1;if($&&s===r+1)return l}return t.length};var k2=new Set(["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"]),q1=r=>{let t=J(r);if(t.startsWith(_1.NANP)&&t.length>=4){let n=t.substring(1,4);return k2.has(n)}return!1};var x1=class{#d;constructor(t){t&&this.#t(t)}#t(t){/[\u0660-\u0669]/.test(t)?this.#d="arabic-indic":/[\u06F0-\u06F9]/.test(t)?this.#d="persian":this.#d="ascii"}denormalise(t){if(!this.#d||this.#d==="ascii")return t;let n=this.#d==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,$=>String.fromCharCode(n+Number($)))}normalise(t){if(!t)return"";if(this.#t(t),this.#d==="ascii")return t;let n=this.#d==="arabic-indic"?1632:1776,$=this.#d==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return t.replace($,s=>String.fromCharCode(48+(s.charCodeAt(0)-n)))}isAscii(){return!this.#d||this.#d==="ascii"}};var G2=0,y1=class r{#d;#t;#f;#l;#u;#c;#y;#I;#e;#n;#o;#i;#a;#$;#s;#E;#g;#m;constructor(t,n={}){this.id=G2++,l1.validateInput(t);let $=K0(n);this.#t={...R1,...$},V0(this.#t),Y0(this.#t),this.#d=new l1(t,this.#t,this.id),this.#f=j0(),this.#$=new x1(t.value),this.promise=this.#R(this.#t),this.#l=q0(this.#t);let{dialCodes:s,dialCodeMaxLen:l,dialCodeToIso2Map:c}=t2(this.#l);this.#y=s,this.#u=l,this.#c=c,this.#I=new Map(this.#l.map(p=>[p.iso2,p])),this.#P()}#r(){let t=this.#d.telInput.value.trim();return this.#$.normalise(t)}#h(t){this.#d.telInput.value=this.#$.denormalise(t)}#R(t){let{initialCountry:n,geoIpLookup:$,loadUtils:s}=t,l=n===i1.AUTO&&!!$,c=!!s&&!C.utils,p;l?p=new Promise((y,E)=>{this.#s=y,this.#E=E}):(p=Promise.resolve(void 0),this.#s=()=>{},this.#E=()=>{});let g;return c?g=new Promise((y,E)=>{this.#g=y,this.#m=E}):(g=Promise.resolve(void 0),this.#g=()=>{},this.#m=()=>{}),Promise.all([p,g]).then(()=>{})}#P(){this.#e=null,this.#i=new AbortController,this.#x(),this.#d.generateMarkup(this.#l),this.#L(),this.#N(),this.#A(),this.#t.dropdownAlwaysOpen&&this.#_()}#x(){d2(this.#l,this.#t),e2(this.#l,this.#t),n2(this.#l)}#L(t=!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=q1(c),{initialCountry:y,geoIpLookup:E}=this.#t,_=y===i1.AUTO&&E&&!t,G=$1(y);p?g?G?this.#C(y):_||this.#C(H0.ISO2):this.#G(c):G?this.#C(y):_||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 t=()=>{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",t,{signal:this.#i.signal})}#U(){let t=this.#i.signal,n=c=>{this.#d.isDropdownClosed()?this.#d.telInput.focus():c.preventDefault()},$=this.#d.telInput.closest("label");$&&$.addEventListener("click",n,{signal:t});let s=()=>{this.#d.isDropdownClosed()&&!this.#d.telInput.disabled&&!this.#d.telInput.readOnly&&this.#_()};this.#d.selectedCountry.addEventListener("click",s,{signal:t});let l=c=>{let p=[D.ARROW_UP,D.ARROW_DOWN,D.SPACE,D.ENTER];this.#d.isDropdownClosed()&&p.includes(c.key)&&(c.preventDefault(),c.stopPropagation(),this.#_()),c.key===D.TAB&&this.#b()};this.#d.countryContainer.addEventListener("keydown",l,{signal:t})}#A(){let{loadUtils:t,initialCountry:n,geoIpLookup:$}=this.#t;if(t&&!C.utils){let l=()=>{C.attachUtils(t)?.catch(()=>{})};C.documentReady()?l():window.addEventListener("load",l,{signal:this.#i.signal})}else this.#g();n===i1.AUTO&&$&&(this.#e?.iso2?this.#s():this.#T())}#T(){if(C.autoCountry)this.#X();else if(this.#d.selectedCountryInner.classList.add(b.LOADING),!C.startedLoadingAutoCountry&&(C.startedLoadingAutoCountry=!0,typeof this.#t.geoIpLookup=="function")){let t=($="")=>{this.#d.selectedCountryInner.classList.remove(b.LOADING);let s=$.toLowerCase();$1(s)?(C.autoCountry=s,setTimeout(()=>r.forEachInstance("handleAutoCountry"))):r.forEachInstance("handleAutoCountryFailure")},n=()=>{this.#d.selectedCountryInner.classList.remove(b.LOADING),r.forEachInstance("handleAutoCountryFailure")};this.#t.geoIpLookup(t,n)}}#v(){this.#_(),this.#d.searchInput.value="+",this.#d.filterCountriesByQuery("")}#B(){this.#w(),this.#k(),this.#J()}#w(){let{strictMode:t,formatAsYouType:n,separateDialCode:$,allowDropdown:s,countrySearch:l}=this.#t,c=!1;z.ALPHA_UNICODE.test(this.#r())&&(c=!0);let p=g=>{let y=this.#r();if(this.#f&&g?.data==="+"&&$&&s&&l){let O=this.#d.telInput.selectionStart||0,V=y.substring(0,O-1),W=y.substring(O);this.#h(V+W),this.#v();return}this.#G(y)&&this.#M();let E=g?.data&&z.NON_PLUS_NUMERIC.test(g.data),A=g?.inputType===Y1.PASTE&&y;E||A&&!t?c=!0:z.NON_PLUS_NUMERIC.test(y)||(c=!1);let _=g?.detail&&g.detail.isSetNumber,G=this.#$.isAscii();if(n&&!c&&!_&&G){let O=this.#d.telInput.selectionStart||0,W=y.substring(0,O).replace(z.NON_PLUS_NUMERIC_GLOBAL,"").length,Y=g?.inputType===Y1.DELETE_FWD,v=this.#p(),j=$2(v,y,C.utils,this.#e??{},$),B=i2(W,j,O,Y);this.#h(j),this.#d.telInput.setSelectionRange(B,B)}if($&&y.startsWith("+")&&this.#e?.dialCode){let O=Q1(y,!0,$,this.#e??{});this.#h(O)}};this.#d.telInput.addEventListener("input",p,{signal:this.#i.signal})}#k(){let{strictMode:t,separateDialCode:n,allowDropdown:$,countrySearch:s}=this.#t;if(t||n){let l=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(t){let p=this.#r(),y=!p.startsWith("+")&&this.#d.telInput.selectionStart===0&&c.key==="+",E=this.#$.normalise(c.key),A=/^[0-9]$/.test(E),_=n?A:y||A,G=this.#d.telInput,O=G.selectionStart,V=G.selectionEnd,W=p.slice(0,O),Y=p.slice(V),v=W+c.key+Y,j=this.#p(v),B=!1;C.utils&&this.#n&&(B=C.utils.getCoreNumber(j,this.#e?.iso2).length>this.#n);let M=this.#F(j)!==null;(!_||B&&!M&&!y)&&c.preventDefault()}}};this.#d.telInput.addEventListener("keydown",l,{signal:this.#i.signal})}}#J(){if(this.#t.strictMode){let t=n=>{n.preventDefault();let $=this.#d.telInput,s=$.selectionStart,l=$.selectionEnd,c=this.#r(),p=c.slice(0,s),g=c.slice(l),y=this.#e?.iso2,E=n.clipboardData.getData("text"),A=this.#$.normalise(E),_=s===0&&l>0,G=!c.startsWith("+")||_,O=A.replace(z.NON_PLUS_NUMERIC_GLOBAL,""),V=O.startsWith("+"),W=O.replace(/\+/g,""),Y=V&&G?`+${W}`:W,v=p+Y+g;if(v.length>5){let B=C.utils.getCoreNumber(v,y);for(;B.length===0&&v.length>0;)v=v.slice(0,-1),B=C.utils.getCoreNumber(v,y);if(!B)return;if(this.#n&&B.length>this.#n)if($.selectionEnd===c.length){let I1=B.length-this.#n;v=v.slice(0,v.length-I1)}else return}this.#h(v);let j=s+Y.length;$.setSelectionRange(j,j),$.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.#d.telInput.addEventListener("paste",t,{signal:this.#i.signal})}}#Q(t){let n=Number(this.#d.telInput.getAttribute("maxlength"));return n&&t.length>n?t.substring(0,n):t}#D(t,n={}){let $=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});this.#d.telInput.dispatchEvent($)}#_(){let{dropdownContainer:t,useFullscreenPopup:n}=this.#t;if(this.#a=new AbortController,this.#d.openDropdown(),!n&&t){let $=()=>this.#b();window.addEventListener("scroll",$,{signal:this.#a.signal})}this.#q(),this.#D(g1.OPEN_COUNTRY_DROPDOWN)}#q(){let t=this.#a.signal;this.#d1(t),this.#t1(t),this.#t.dropdownAlwaysOpen||this.#e1(t),this.#n1(t),this.#t.countrySearch&&this.#$1(t)}#d1(t){let n=$=>{let s=$.target?.closest(`.${b.COUNTRY_ITEM}`);s&&this.#d.highlightListItem(s,!1)};this.#d.countryList.addEventListener("mouseover",n,{signal:t})}#t1(t){let n=$=>{let s=$.target?.closest(`.${b.COUNTRY_ITEM}`);s&&this.#V(s)};this.#d.countryList.addEventListener("click",n,{signal:t})}#e1(t){let n=$=>{!!$.target.closest(`#iti-${this.id}__dropdown-content`)||this.#b()};setTimeout(()=>{document.documentElement.addEventListener("click",n,{signal:t})},0)}#n1(t){let n="",$=null,s=l=>{[D.ARROW_UP,D.ARROW_DOWN,D.ENTER,D.ESC].includes(l.key)&&(l.preventDefault(),l.stopPropagation(),l.key===D.ARROW_UP||l.key===D.ARROW_DOWN?this.#d.handleUpDownKey(l.key):l.key===D.ENTER&&!l.isComposing?this.#s1():l.key===D.ESC&&(this.#b(),this.#d.selectedCountry.focus())),!this.#t.countrySearch&&z.HIDDEN_SEARCH_CHAR.test(l.key)&&(l.stopPropagation(),$&&clearTimeout($),n+=l.key.toLowerCase(),this.#i1(n),$=setTimeout(()=>{n=""},D1.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",s,{signal:t})}#$1(t){this.#d.searchInput.addEventListener("input",()=>this.#d.handleSearchChange(),{signal:t}),this.#d.searchClearButton.addEventListener("click",()=>this.#d.handleSearchClear(),{signal:t})}#i1(t){let n=X0(this.#l,t);if(n){let $=n.nodeById[this.id];this.#d.highlightListItem($,!1),this.#d.scrollCountryListToItem($)}}#s1(){this.#d.highlightedItem&&this.#V(this.#d.highlightedItem)}#S(t){let{formatOnDisplay:n,nationalMode:$,separateDialCode:s}=this.#t,l=t;if(n&&C.utils&&this.#e){let c=J1(t),p=$&&!c||!l.startsWith("+")&&!s,{NATIONAL:g,INTERNATIONAL:y}=C.utils.numberFormat,E=p?g:y;l=C.utils.formatNumber(l,this.#e?.iso2,E)}l=this.#j(l),this.#h(l)}#G(t){let n=this.#F(t);return n!==null?this.#C(n):!1}#o1(t){let n=this.#e?.dialCode,$=this.#e?.nationalPrefix;if(t.startsWith("+")||!n)return t;let c=$&&t.startsWith($)&&!this.#t.separateDialCode?t.substring(1):t;return`+${n}${c}`}#F(t){let n=t.indexOf("+"),$=n?t.substring(n):t,s=this.#e?.iso2,l=this.#e?.dialCode;$=this.#o1($);let c=this.#O($,!0),p=J($);if(c){let g=J(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(l===_1.NANP&&q1(p))return null;let A=this.#e?.areaCodes,_=this.#e?.priority;if(A){let Y=A.map(v=>`${l}${v}`);for(let v of Y)if(p.startsWith(v))return null}let O=A&&!(_===0)&&p.length>g.length,V=s&&y.includes(s)&&!O,W=s===y[0];if(!V&&!W)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(t){let n=this.#e?.iso2||"";return this.#e=t?this.#I.get(t):null,this.#e?.iso2&&(this.#o=this.#e.iso2),this.#d.setCountry(this.#e??{}),this.#W(),this.#K(),n!==t}#K(){let{strictMode:t,placeholderNumberType:n,allowedNumberTypes:$}=this.#t,s=this.#e?.iso2;if(t&&C.utils)if(s){let l=C.utils.numberType[n],c=C.utils.getExampleNumber(s,!1,l,!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:t,placeholderNumberType:n,nationalMode:$,customPlaceholder:s}=this.#t,l=t===r1.AGGRESSIVE||!this.#d.hadInitialPlaceholder&&t===r1.POLITE;if(C.utils&&l){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(t){let n=t.dataset[Z1.COUNTRY_CODE],$=this.#C(n);this.#b();let s=t.dataset[Z1.DIAL_CODE];if(this.#Y(s),this.#t.formatOnDisplay){let l=this.#r();this.#S(l)}this.#d.telInput.focus(),$&&this.#M()}#b(t){this.#d.isDropdownClosed()||this.#t.dropdownAlwaysOpen&&!t||(this.#d.closeDropdown(),this.#a.abort(),this.#a=null,this.#D(g1.CLOSE_COUNTRY_DROPDOWN))}#Y(t){let n=this.#r(),$=`+${t}`,s;if(n.startsWith("+")){let l=this.#O(n);l?s=n.replace(l,$):s=$,this.#h(s)}}#O(t,n){let $="";if(t.startsWith("+")){let s="",l=!1;for(let c=0;c<t.length;c++){let p=t.charAt(c);if(/[0-9]/.test(p)){if(s+=p,!!!this.#c[s])break;if(this.#y.has(s)){if($=t.substring(0,c+1),l=!0,!n)break}else n&&l&&($=t.substring(0,c+1));if(s.length===this.#u)break}}}return $}#p(t){let n=t?this.#$.normalise(t):this.#r(),$=this.#e?.dialCode,s,l=J(n);return this.#t.separateDialCode&&!n.startsWith("+")&&$&&l?s=`+${$}`:s="",s+n}#j(t){let n=!!this.#O(t),$=Q1(t,n,this.#t.separateDialCode,this.#e??{});return this.#Q($)}#Z(){let t=this.#e;if(!t)return{};let{iso2:n,dialCode:$,name:s}=t;return{iso2:n,dialCode:$,name:s}}#M(){let t=this.#Z();this.#D(g1.COUNTRY_CHANGE,t)}#X(){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())}#r1(){if(!this.#d.telInput){this.#E?.();return}this.#L(!0),this.#E()}#l1(){if(!this.#d.telInput){this.#g?.();return}if(C.utils){let t=this.#r();t&&this.#S(t),this.#e?.iso2&&(this.#W(),this.#K())}this.#g()}#u1(t){if(!this.#d.telInput){this.#m?.(t);return}this.#m(t)}destroy(){this.#d.telInput&&(this.#t.allowDropdown&&this.#b(!0),this.#i.abort(),this.#i=null,this.#d.destroy(),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(t){if(C.utils&&this.#d.telInput){let n=this.#e?.iso2,$=this.#p(),s=C.utils.formatNumber($,n,t);return this.#$.denormalise(s)}return""}getNumberType(){return C.utils&&this.#d.telInput?C.utils.getNumberType(this.#p(),this.#e?.iso2):j1.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.#Z()}getValidationError(){if(C.utils&&this.#d.telInput){let t=this.#e?.iso2;return C.utils.getValidationError(this.#p(),t)}return j1.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let t=this.#e?.dialCode,n=this.#e?.iso2;if(C.utils&&this.#d.telInput){let $=this.#p(),s=C.utils.getCoreNumber($,n);if(s){if(t===O1.DIAL_CODE&&s[0]===O1.MOBILE_PREFIX&&s.length!==O1.MOBILE_CORE_LENGTH)return!1;if(!z.ALPHA_UNICODE.test($)&&t){let c=$.startsWith("+")?$.slice(1+t.length):$,p=J(c).length;if(s.length>p)return!1}}}return this.#z(!1)}isValidNumberPrecise(){return this.#z(!0)}#a1(t){return C.utils?C.utils.isPossibleNumber(t,this.#e?.iso2,this.#t.allowedNumberTypes):null}#z(t){if(!C.utils||!this.#d.telInput)return null;let{allowNumberExtensions:n,allowPhonewords:$}=this.#t,s=g=>t?this.#c1(g):this.#a1(g),l=this.#p();if(!this.#e?.iso2&&!J1(l)||!s(l))return!1;if(l.search(z.ALPHA_UNICODE)>-1){let g=this.#e?.iso2;return C.utils.getExtension(l,g)?n:$}return!0}#c1(t){return C.utils?C.utils.isValidNumber(t,this.#e?.iso2,this.#t.allowedNumberTypes):null}setCountry(t){if(!this.#d.telInput)return;let n=t?.toLowerCase();if(!$1(n))throw new Error(`Invalid country code: '${n}'`);let $=this.#e?.iso2;if(t&&n!==$||!t&&$){if(this.#C(n),this.#Y(this.#e?.dialCode||""),this.#t.formatOnDisplay){let l=this.#r();this.#S(l)}this.#M()}}setNumber(t){if(!this.#d.telInput)return;let n=this.#$.normalise(t),$=this.#G(n);this.#S(n),$&&this.#M(),this.#D(g1.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.#d.telInput&&(this.#t.placeholderNumberType=t,this.#W())}setDisabled(t){this.#d.telInput&&(this.#d.telInput.disabled=t,this.#d.selectedCountry&&(t?this.#d.selectedCountry.setAttribute("disabled","true"):this.#d.selectedCountry.removeAttribute("disabled")))}static forEachInstance(t,...n){let $=Object.values(C.instances),s=n[0];$.forEach(l=>{if(l instanceof r)switch(t){case"handleUtils":l.#l1();break;case"handleUtilsFailure":l.#u1(s);break;case"handleAutoCountry":l.#X();break;case"handleAutoCountryFailure":l.#r1();break}})}},W2=r=>{if(!C.utils&&!C.startedLoadingUtilsScript){let t;if(typeof r=="function")try{t=Promise.resolve(r())}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 r}`));return C.startedLoadingUtilsScript=!0,t.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=$,y1.forEachInstance("handleUtils"),!0}).catch(n=>{throw y1.forEachInstance("handleUtilsFailure",n),n})}return null},C=Object.assign((r,t)=>{let n=new y1(r,t);return C.instances[n.id]=n,r.iti=n,n},{defaults:R1,documentReady:()=>document.readyState==="complete",getCountryData:()=>o1,getInstance:r=>{let t=r.dataset.intlTelInputId;return t?C.instances[t]:null},instances:{},attachUtils:W2,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.9.1"}),d0=C;(function(){var r=this||self;function t(d,e){d=d.split(".");var i=r;d[0]in i||typeof i.execScript>"u"||i.execScript("var "+d[0]);for(var o;d.length&&(o=d.shift());)d.length||e===void 0?i[o]&&i[o]!==Object.prototype[o]?i=i[o]:i=i[o]={}:i[o]=e}function n(d,e){function i(){}i.prototype=e.prototype,d.ma=e.prototype,d.prototype=new i,d.prototype.constructor=d,d.sa=function(o,u,a){for(var h=Array(arguments.length-2),f=2;f<arguments.length;f++)h[f-2]=arguments[f];return e.prototype[u].apply(o,h)}}function $(d){let e=[],i=0;for(let o in d)e[i++]=d[o];return e}var s=class{constructor(d){if(l!==l)throw Error("SafeUrl is not meant to be built directly");this.g=d}toString(){return this.g.toString()}},l={};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 E={};class A{constructor(){var e=r.trustedTypes&&r.trustedTypes.emptyHTML||"";if(E!==E)throw Error("SafeHtml is not meant to be built directly");this.g=e}toString(){return this.g.toString()}}new A;function _(d,e){switch(this.g=d,this.l=!!e.aa,this.h=e.i,this.s=e.type,this.o=!1,this.h){case V:case W:case Y:case v:case j:case O:case G:this.o=!0}this.j=e.defaultValue}var G=1,O=2,V=3,W=4,Y=6,v=16,j=18;function B(d,e){for(this.h=d,this.g={},d=0;d<e.length;d++){var i=e[d];this.g[i.g]=i}}function I1(d){return d=$(d.g),d.sort(function(e,i){return e.g-i.g}),d}function M(){this.h={},this.j=this.m().g,this.g=this.l=null}M.prototype.has=function(d){return H(this,d.g)},M.prototype.get=function(d,e){return m(this,d.g,e)},M.prototype.set=function(d,e){R(this,d.g,e)},M.prototype.add=function(d,e){t0(this,d.g,e)};function H1(d,e){for(var i=I1(d.m()),o=0;o<i.length;o++){var u=i[o],a=u.g;if(H(e,a)){d.g&&delete d.g[u.g];var h=u.h==11||u.h==10;if(u.l){u=x(e,a);for(var f=0;f<u.length;f++)t0(d,a,h?u[f].clone():u[f])}else u=E1(e,a),h?(h=E1(d,a))?H1(h,u):R(d,a,u.clone()):R(d,a,u)}}}M.prototype.clone=function(){var d=new this.constructor;return d!=this&&(d.h={},d.g&&(d.g={}),H1(d,this)),d};function H(d,e){return d.h[e]!=null}function E1(d,e){var i=d.h[e];if(i==null)return null;if(d.l){if(!(e in d.g)){var o=d.l,u=d.j[e];if(i!=null)if(u.l){for(var a=[],h=0;h<i.length;h++)a[h]=o.h(u,i[h]);i=a}else i=o.h(u,i);return d.g[e]=i}return d.g[e]}return i}function m(d,e,i){var o=E1(d,e);return d.j[e].l?o[i||0]:o}function S(d,e){if(H(d,e))d=m(d,e);else d:{if(d=d.j[e],d.j===void 0)if(e=d.s,e===Boolean)d.j=!1;else if(e===Number)d.j=0;else if(e===String)d.j=d.o?"0":"";else{d=new e;break d}d=d.j}return d}function x(d,e){return E1(d,e)||[]}function Q(d,e){return d.j[e].l?H(d,e)?d.h[e].length:0:H(d,e)?1:0}function R(d,e,i){d.h[e]=i,d.g&&(d.g[e]=i)}function t0(d,e,i){d.h[e]||(d.h[e]=[]),d.h[e].push(i),d.g&&delete d.g[e]}function b1(d,e){var i=[],o;for(o in e)o!=0&&i.push(new _(o,e[o]));return new B(d,i)}function L1(){}L1.prototype.g=function(d){throw new d.h,Error("Unimplemented")},L1.prototype.h=function(d,e){if(d.h==11||d.h==10)return e instanceof M?e:this.g(d.s.prototype.m(),e);if(d.h==14)return typeof e=="string"&&e0.test(e)&&(d=Number(e),0<d)?d:e;if(!d.o)return e;if(d=d.s,d===String){if(typeof e=="number")return String(e)}else if(d===Number&&typeof e=="string"&&(e==="Infinity"||e==="-Infinity"||e==="NaN"||e0.test(e)))return Number(e);return e};var e0=/^-?[0-9]+$/;function U1(){}n(U1,L1),U1.prototype.g=function(d,e){return d=new d.h,d.l=this,d.h=e,d.g={},d};function u1(){}n(u1,U1),u1.prototype.h=function(d,e){return d.h==8?!!e:L1.prototype.h.apply(this,arguments)},u1.prototype.g=function(d,e){return u1.ma.g.call(this,d,e)};function w(d,e){d!=null&&this.g.apply(this,arguments)}w.prototype.h="",w.prototype.set=function(d){this.h=""+d},w.prototype.g=function(d,e,i){if(this.h+=String(d),e!=null)for(let o=1;o<arguments.length;o++)this.h+=arguments[o];return this};function U(d){d.h=""}w.prototype.toString=function(){return this.h};function t1(){M.call(this)}n(t1,M);var n0=null;function T(){M.call(this)}n(T,M);var $0=null;function e1(){M.call(this)}n(e1,M);var i0=null;t1.prototype.m=function(){var d=n0;return d||(n0=d=b1(t1,{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},t1.m=t1.prototype.m,T.prototype.m=function(){var d=$0;return d||($0=d=b1(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: