intl-tel-input
Version:
A JavaScript library for entering, formatting, and validating international telephone numbers
6 lines • 312 kB
JavaScript
/*
* International Telephone Input v28.0.4
* git+https://github.com/jackocnr/intl-tel-input.git
* Licensed under the MIT license
*/
"use strict";var _factory=(()=>{var Z1=Object.defineProperty;var R2=Object.getOwnPropertyDescriptor;var x2=Object.getOwnPropertyNames;var P2=Object.prototype.hasOwnProperty;var H2=(r,t)=>{for(var n in t)Z1(r,n,{get:t[n],enumerable:!0})},U2=(r,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of x2(t))!P2.call(r,s)&&s!==n&&Z1(r,s,{get:()=>t[s],enumerable:!(i=R2(t,s))||i.enumerable});return r};var B2=r=>U2(Z1({},"__esModule",{value:!0}),r);var dd={};H2(dd,{default:()=>q2});var k2=[["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"]],X1=[];for(let r of k2)X1.push({name:"",iso2:r[0],dialCode:r[1],priority:r[2]||0,areaCodes:r[3]||null,nationalPrefix:r[4]||null});var G2=new Set(X1.map(r=>r.iso2)),s1=r=>G2.has(r),c1=X1;var k={OPEN_COUNTRY_DROPDOWN:"open:countrydropdown",CLOSE_COUNTRY_DROPDOWN:"close:countrydropdown",COUNTRY_CHANGE:"countrychange",INPUT:"input",STRICT_REJECT:"strict:reject"},I={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"},R={ARROW_UP:"ArrowUp",ARROW_DOWN:"ArrowDown",SPACE:" ",ENTER:"Enter",ESC:"Escape",TAB:"Tab"},J1={PASTE:"insertFromPaste",DELETE_FORWARD:"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À-ÿа-яА-Я ]$/},z1={SEARCH_DEBOUNCE_MS:100,HIDDEN_SEARCH_RESET_MS:1e3,NEXT_TICK:0},V={NARROW_VIEWPORT_WIDTH:500,FALLBACK_SELECTED_WITH_DIAL_WIDTH:78,FALLBACK_SELECTED_NO_DIAL_WIDTH:42,INPUT_PADDING_EXTRA_LEFT:6,DROPDOWN_MARGIN:3,FALLBACK_DROPDOWN_HEIGHT:200},H1={PLUS:"+",NANP:"1"},U1={ISO2:"gb",DIAL_CODE:"44",MOBILE_PREFIX:"7",MOBILE_CORE_LENGTH:10},Y0={ISO2:"us",DIAL_CODE:"1"},h1={AGGRESSIVE:"aggressive",POLITE:"polite",OFF:"off"},T1={AUTO:"auto"},F2=["E164","INTERNATIONAL","NATIONAL","RFC3966"],p1=["FIXED_LINE","MOBILE","FIXED_LINE_OR_MOBILE","TOLL_FREE","PREMIUM_RATE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL","UNKNOWN"],W2=["IS_POSSIBLE","INVALID_COUNTRY_CODE","TOO_SHORT","TOO_LONG","IS_POSSIBLE_LOCAL_ONLY","INVALID_LENGTH"],Q1=r=>Object.fromEntries(r.map(t=>[t,t])),L1=Q1(F2),r1=Q1(p1),q1=Q1(W2),K={ISO2:"iso2",DIAL_CODE:"dialCode",INSTANCE_ID:"intlTelInputId"},A={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 V2={selectedCountryAriaLabel:"Change country for phone number, currently selected ${countryName} (${dialCode})",noCountrySelected:"Select country for phone number",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`}},Z0=V2;var t0=r=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia(r).matches,z0=()=>t0(`(max-width: ${V.NARROW_VIEWPORT_WIDTH}px)`),j2=()=>{if(typeof navigator<"u"&&typeof window<"u"){let r=t0("(max-height: 600px)"),t=t0("(pointer: coarse)");return z0()||t&&r}return!1},k1={allowDropdown:!0,allowedNumberTypes:[r1.MOBILE,r1.FIXED_LINE],allowNumberExtensions:!1,allowPhonewords:!1,autoPlaceholder:h1.POLITE,containerClass:"",countryNameLocale:"en",countryNameOverrides:{},countryOrder:null,countrySearch:!0,customPlaceholder:null,dropdownAlwaysOpen:!1,dropdownContainer:null,excludeCountries:null,fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",loadUtils:null,nationalMode:!1,onlyCountries:null,placeholderNumberType:r1.MOBILE,searchInputClass:"",separateDialCode:!0,strictRejectAnimation:!0,showFlags:!0,strictMode:!0,useFullscreenPopup:j2()},Q0=r=>JSON.stringify(r),d0=r=>!!r&&typeof r=="object"&&!Array.isArray(r),K2=r=>typeof r=="function",Y2=r=>{if(!r||typeof r!="object")return!1;let t=r;return t.nodeType===1&&typeof t.tagName=="string"&&typeof t.appendChild=="function"},X0=new Set(Object.values(h1)),B1=r=>{console.warn(`[intl-tel-input] ${r}`)},U=(r,t,n)=>{B1(`Option '${r}' must be ${t}; got ${Q0(n)}. Ignoring.`)},J0=(r,t)=>{let n="an array of iso2 country code strings";if(!Array.isArray(t))return U(r,n,t),!1;let i=[];for(let s of t){if(typeof s!="string")return U(r,n,t),!1;let u=s.toLowerCase();s1(u)?i.push(s):B1(`Invalid iso2 code in '${r}': '${s}'. Skipping.`)}return i},q0=r=>{if(r===void 0)return{};if(!d0(r)){let n=`The second argument must be an options object; got ${Q0(r)}. Using defaults.`;return B1(n),{}}let t={};for(let[n,i]of Object.entries(r)){if(!Object.hasOwn(k1,n)){B1(`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"strictRejectAnimation":case"useFullscreenPopup":if(typeof i!="boolean"){U(n,"a boolean",i);break}t[n]=i;break;case"autoPlaceholder":if(typeof i!="string"||!X0.has(i)){let s=Array.from(X0).join(", ");U("autoPlaceholder",`one of ${s}`,i);break}t[n]=i;break;case"containerClass":case"searchInputClass":case"countryNameLocale":if(typeof i!="string"){U(n,"a string",i);break}t[n]=i;break;case"countryOrder":{if(i===null)t[n]=i;else{let s=J0(n,i);s!==!1&&(t[n]=s)}break}case"customPlaceholder":case"geoIpLookup":case"hiddenInput":case"loadUtils":if(i!==null&&!K2(i)){U(n,"a function or null",i);break}t[n]=i;break;case"dropdownContainer":if(i!==null&&!Y2(i)){U("dropdownContainer","an HTMLElement or null",i);break}t[n]=i;break;case"excludeCountries":case"onlyCountries":{if(i===null)t[n]=i;else{let s=J0(n,i);s!==!1&&(t[n]=s)}break}case"i18n":if(i&&!d0(i)){U("i18n","an object",i);break}t[n]=i;break;case"countryNameOverrides":if(i&&!d0(i)){U("countryNameOverrides","an object",i);break}t[n]=i;break;case"initialCountry":{if(typeof i!="string"){U("initialCountry","a string",i);break}let s=i.toLowerCase();if(s&&s!==T1.AUTO&&!s1(s)){U("initialCountry","a valid iso2 country code or 'auto'",i);break}t[n]=i;break}case"placeholderNumberType":if(typeof i!="string"||!p1.includes(i)){let s=p1.join(", ");U("placeholderNumberType",`one of ${s}`,i);break}t[n]=i;break;case"allowedNumberTypes":if(i!==null){if(!Array.isArray(i)){U("allowedNumberTypes","an array of number types or null",i);break}let s=!0;for(let u of i)if(typeof u!="string"||!p1.includes(u)){let h=p1.join(", ");U("allowedNumberTypes",`an array of valid number types (${h})`,u),s=!1;break}s&&(t[n]=i)}else t[n]=null;break}}return t},d2=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()))},t2=r=>{r.dropdownAlwaysOpen&&(r.useFullscreenPopup=!1,r.allowDropdown=!0),r.useFullscreenPopup?r.fixDropdownWidth=!1:z0()&&(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={...Z0,...r.i18n}};var Z=r=>r.replace(/\D/g,""),G1=(r="")=>r.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();var F1=r=>Object.keys(r).filter(t=>!!r[t]).join(" "),N=(r,t,n)=>{let i=document.createElement(r);return t&&Object.entries(t).forEach(([s,u])=>i.setAttribute(s,u)),n&&n.appendChild(i),i};var Z2="http://www.w3.org/2000/svg",N1=([r,t,n])=>{let i=document.createElementNS(Z2,r);if(t)for(let s in t)i.setAttribute(s,String(t[s]));if(n)for(let s of n)i.appendChild(N1(s));return i},e2=()=>N1(["svg",{class:"iti__search-icon-svg",width:14,height:14,viewBox:"0 0 24 24",focusable:"false",[A.HIDDEN]:"true"},[["circle",{cx:11,cy:11,r:7}],["line",{x1:21,y1:21,x2:16.65,y2:16.65}]]]),n2=r=>{let t=`iti-${r}-clear-mask`;return N1(["svg",{class:"iti__search-clear-svg",width:12,height:12,viewBox:"0 0 16 16",[A.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"}]]],["circle",{cx:8,cy:8,r:8,class:"iti__search-clear-bg",mask:`url(#${t})`}]]])},i2=()=>N1(["svg",{class:"iti__country-check-svg",width:14,height:14,viewBox:"0 0 16 16",fill:"currentColor",focusable:"false",[A.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"}]]]),e0=()=>N1(["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"}]]]);var $2=r=>{let t=new Map;for(let n of r){let i=G1(n.name),s=i.split(/[^a-z]/).map(u=>u[0]).join("");t.set(n.iso2,{normalisedName:i,initials:s,dialCodePlus:`+${n.dialCode}`})}return t},s2=(r,t,n)=>{let i=G1(n),s=[],u=[],h=[],p=[],g=[],S=[];for(let y of r){let T=t.get(y.iso2);y.iso2===i?s.push(y):T.normalisedName.startsWith(i)?u.push(y):T.normalisedName.includes(i)?h.push(y):i===y.dialCode||i===T.dialCodePlus?p.push(y):T.dialCodePlus.includes(i)?g.push(y):T.initials.includes(i)&&S.push(y)}let b=(y,T)=>y.priority-T.priority;return[...s,...u,...h,...p.sort(b),...g.sort(b),...S]},r2=(r,t,n)=>{let i=G1(n);for(let s of r){let{normalisedName:u}=t.get(s.iso2);if(u.startsWith(i))return s}return null};var f1=class r{#d;static toAscii(t){return t?t.replace(/[٠-٩]/g,n=>String.fromCharCode(48+(n.charCodeAt(0)-1632))).replace(/[۰-۹]/g,n=>String.fromCharCode(48+(n.charCodeAt(0)-1776))):""}constructor(t){t&&this.#e(t)}#e(t){/[٠-٩]/.test(t)?this.#d="arabic-indic":/[۰-۹]/.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,i=>String.fromCharCode(n+Number(i)))}normalise(t){return t?(this.#e(t),this.#d==="ascii"?t:r.toAscii(t)):""}isAscii(){return!this.#d||this.#d==="ascii"}};var g1=class r{#d;#e;#S;#C="";#I;#b;#v=null;#O;#g;#t;#l;#E;#$;#n;#f;#r;#u;#i;#o;#c;#T;#H;#s;#m=null;#h=null;#_=new Map;#w=null;telInputEl;hadInitialPlaceholder;constructor(t,n,i){t.dataset[K.INSTANCE_ID]=i.toString(),this.telInputEl=t,this.#d=n,this.#e=i,this.hadInitialPlaceholder=!!t.getAttribute("placeholder"),this.#S=!!this.telInputEl.closest("[dir=rtl]"),this.#C=this.telInputEl.style.paddingLeft}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}`)}}buildMarkup(t,n){this.#I=t,this.#b=n,this.telInputEl.classList.add("iti__tel-input"),this.telInputEl.hasAttribute("type")||this.telInputEl.setAttribute("type","tel"),this.telInputEl.hasAttribute("autocomplete")||this.telInputEl.setAttribute("autocomplete","tel"),this.telInputEl.hasAttribute("inputmode")||this.telInputEl.setAttribute("inputmode","tel");let i=this.#U();this.#B(i),i.appendChild(this.telInputEl),this.#z(),this.#Q(i),this.ensureDropdownWidthSet()}#U(){let{allowDropdown:t,showFlags:n,containerClass:i,useFullscreenPopup:s}=this.#d,u=F1({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":n,"iti--inline-dropdown":!s,[i]:!!i}),h=N("div",{class:u});return this.#S&&h.setAttribute("dir","ltr"),this.telInputEl.before(h),h}#B(t){let{allowDropdown:n,separateDialCode:i,showFlags:s}=this.#d;if(!n&&!s&&!i)return;this.#g=N("div",{class:`iti__country-container ${I.V_HIDE}`},t),n?(this.#t=N("button",{type:"button",class:"iti__selected-country",[A.EXPANDED]:"false",[A.LABEL]:this.#d.i18n.noCountrySelected,[A.HASPOPUP]:"dialog",[A.CONTROLS]:`iti-${this.#e}__dropdown-content`},this.#g),this.telInputEl.disabled&&this.#t.setAttribute("disabled","true")):this.#t=N("div",{class:"iti__selected-country"},this.#g);let u=N("div",{class:"iti__selected-country-primary"},this.#t);this.#l=N("div",{class:I.FLAG},u),n&&(this.#$=N("div",{class:"iti__arrow",[A.HIDDEN]:"true"},u)),i&&(this.#E=N("div",{class:"iti__selected-dial-code"},this.#t)),n&&this.#X()}ensureDropdownWidthSet(){let{fixDropdownWidth:t,allowDropdown:n}=this.#d;if(!n||!t||this.#n.style.width)return;let i=this.telInputEl.offsetWidth;i>0&&(this.#n.style.width=`${i}px`)}#X(){let{fixDropdownWidth:t,useFullscreenPopup:n,countrySearch:i,i18n:s,dropdownContainer:u,containerClass:h}=this.#d,p=t?"":"iti--flexible-dropdown-width";if(this.#n=N("div",{id:`iti-${this.#e}__dropdown-content`,class:`iti__dropdown-content ${I.HIDE} ${p}`,role:"dialog",[A.MODAL]:"true"}),this.#S&&this.#n.setAttribute("dir","rtl"),i&&this.#J(),this.#i=N("ul",{class:"iti__country-list",id:`iti-${this.#e}__country-listbox`,role:"listbox",[A.LABEL]:s.countryListAriaLabel},this.#n),this.#q(),i&&this.#F(),n||(this.#O=this.#t1(),i&&(this.#n.style.height=`${this.#O}px`)),u){let g=F1({iti:!0,"iti--container":!0,"iti--fullscreen-popup":n,"iti--inline-dropdown":!n,[h]:!!h});this.#s=N("div",{class:g}),this.#s.appendChild(this.#n)}else this.#g.appendChild(this.#n)}#J(){let{i18n:t,searchInputClass:n}=this.#d,i=N("div",{class:"iti__search-input-wrapper"},this.#n);this.#f=N("span",{class:"iti__search-icon",[A.HIDDEN]:"true"},i),this.#f.appendChild(e2()),this.#r=N("input",{id:`iti-${this.#e}__search-input`,type:"search",class:`iti__search-input ${n}`,placeholder:t.searchPlaceholder,role:"combobox",[A.EXPANDED]:"true",[A.LABEL]:t.searchPlaceholder,[A.CONTROLS]:`iti-${this.#e}__country-listbox`,[A.AUTOCOMPLETE]:"list",autocomplete:"off"},i),this.#u=N("button",{type:"button",class:`iti__search-clear ${I.HIDE}`,[A.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},i),this.#u.appendChild(n2(this.#e)),this.#H=N("span",{class:"iti__a11y-text"},this.#n),this.#T=N("div",{class:`iti__no-results ${I.HIDE}`,[A.HIDDEN]:"true"},this.#n),this.#T.textContent=t.searchEmptyState??null}#z(){this.#g&&(this.#k(),this.#g.classList.remove(I.V_HIDE))}#Q(t){let{hiddenInput:n}=this.#d;if(!n)return;let i=this.telInputEl.getAttribute("name")||"",s=n(i);if(s.phone){let u=this.telInputEl.form?.querySelector(`input[name="${s.phone}"]`);u?this.#o=u:(this.#o=N("input",{type:"hidden",name:s.phone}),t.appendChild(this.#o))}if(s.country){let u=this.telInputEl.form?.querySelector(`input[name="${s.country}"]`);u?this.#c=u:(this.#c=N("input",{type:"hidden",name:s.country}),t.appendChild(this.#c))}}#q(){let t=document.createDocumentFragment();for(let n=0;n<this.#I.length;n++){let i=this.#I[n],s=F1({[I.COUNTRY_ITEM]:!0}),u=N("li",{id:`iti-${this.#e}__item-${i.iso2}`,class:s,tabindex:"-1",role:"option",[A.SELECTED]:"false"});u.dataset[K.DIAL_CODE]=i.dialCode,u.dataset[K.ISO2]=i.iso2,this.#_.set(i.iso2,u),this.#d.showFlags&&N("div",{class:`${I.FLAG} iti__${i.iso2}`},u);let h=N("span",{class:"iti__country-name"},u);h.textContent=`${i.name} `;let p=N("span",{class:"iti__dial-code"},h);this.#S&&p.setAttribute("dir","ltr"),p.textContent=`(+${i.dialCode})`,t.appendChild(u)}this.#i.appendChild(t)}#k(){if(this.#t){let t=this.#d.separateDialCode?V.FALLBACK_SELECTED_WITH_DIAL_WIDTH:V.FALLBACK_SELECTED_NO_DIAL_WIDTH,i=(this.#t.offsetWidth||this.#d1()||t)+V.INPUT_PADDING_EXTRA_LEFT;this.telInputEl.style.paddingLeft=`${i}px`}}static#G(){let t;try{t=window.top.document.body}catch{t=document.body}return t}#d1(){if(!this.telInputEl.parentNode)return 0;let t=r.#G(),n=this.telInputEl.parentNode.cloneNode(!1);n.style.visibility="hidden",t.appendChild(n);let i=this.#g.cloneNode();n.appendChild(i);let s=this.#t.cloneNode(!0);i.appendChild(s);let u=s.offsetWidth;return t.removeChild(n),u}#t1(){let t=r.#G();this.#n.classList.remove(I.HIDE);let n=N("div",{class:"iti iti--inline-dropdown"});n.appendChild(this.#n),n.style.visibility="hidden",t.appendChild(n);let i=this.#n.offsetHeight;return t.removeChild(n),n.style.visibility="",this.#n.classList.add(I.HIDE),i>0?i:V.FALLBACK_DROPDOWN_HEIGHT}#F(){let{i18n:t}=this.#d,n=this.#i.childElementCount;this.#H.textContent=t.searchSummaryAria(n)}#W(t){let n;if(t==="")n=this.#I;else{let i=f1.toAscii(t);n=s2(this.#I,this.#b,i)}this.#K(n)}prefillSearchWithPlus(){this.#r.value="+",this.#r.focus(),this.#W("")}#R(){let t=this.#r.value.trim();this.#W(t),this.#r.value?this.#u.classList.remove(I.HIDE):this.#u.classList.add(I.HIDE)}#L(){this.#v&&clearTimeout(this.#v),this.#v=setTimeout(()=>{this.#R(),this.#v=null},z1.SEARCH_DEBOUNCE_MS)}#a(){this.#r.value="",this.#r.focus(),this.#R()}#D(t){let n=this.#i,i=n.getBoundingClientRect(),s=t.getBoundingClientRect(),u=s.top-i.top+n.scrollTop;s.top<i.top?n.scrollTop=u:s.bottom>i.bottom&&(n.scrollTop=u-i.height+s.height)}#p(t,n=!0){if(this.#h?.classList.remove(I.HIGHLIGHT),t){if(t.classList.add(I.HIGHLIGHT),this.#d.countrySearch){let i=t.getAttribute("id")||"";this.#r.setAttribute(A.ACTIVE_DESCENDANT,i)}n&&this.#D(t),this.#h=t}else this.#h=null}bindHiddenInputSubmitListener(t,n,i){let s=this.telInputEl.form;!s||!this.#o&&!this.#c||s.addEventListener("submit",()=>{this.#o&&(this.#o.value=n()),this.#c&&(this.#c.value=i())},{signal:t})}bindAllInitialDropdownListeners(t,n,i){let s=this.telInputEl.closest("label");s&&s.addEventListener("click",u=>{this.isDropdownOpen()?u.preventDefault():this.telInputEl.focus()},{signal:t}),this.#t.addEventListener("click",()=>{!this.isDropdownOpen()&&!this.telInputEl.disabled&&!this.telInputEl.readOnly&&n()},{signal:t}),this.#g.addEventListener("keydown",u=>{let h=[R.ARROW_UP,R.ARROW_DOWN,R.SPACE,R.ENTER];!this.isDropdownOpen()&&h.includes(u.key)&&(u.preventDefault(),u.stopPropagation(),n()),u.key===R.TAB&&i()},{signal:t})}openDropdown(t,n){let{countrySearch:i,dropdownAlwaysOpen:s,dropdownContainer:u}=this.#d;if(this.#w=new AbortController,this.ensureDropdownWidthSet(),u)this.#Y();else{let p=this.#N(),g=this.telInputEl.offsetHeight+V.DROPDOWN_MARGIN;p?this.#n.style.top=`${g}px`:this.#n.style.bottom=`${g}px`}this.#n.classList.remove(I.HIDE),this.#t.setAttribute(A.EXPANDED,"true");let h=this.#m??this.#i.firstElementChild;h&&this.#p(h),i&&!s&&this.#r.focus(),this.#d.useFullscreenPopup&&this.#s&&window.visualViewport&&window.visualViewport.addEventListener("resize",()=>{this.#A(),this.#h&&this.#D(this.#h)},{signal:this.#w.signal}),this.#$.classList.add(I.ARROW_UP),this.#x(t,n)}#x(t,n){let i=this.#w.signal;this.#e1(i),this.#V(i,t),this.#d.dropdownAlwaysOpen||this.#n1(i,n),this.#y(i,t,n),this.#d.countrySearch&&this.#j(i),!this.#d.useFullscreenPopup&&this.#d.dropdownContainer&&window.addEventListener("scroll",n,{signal:i})}#e1(t){this.#i.addEventListener("mouseover",n=>{let i=n.target?.closest(`.${I.COUNTRY_ITEM}`);i&&this.#p(i,!1)},{signal:t})}#V(t,n){this.#i.addEventListener("click",i=>{let s=i.target?.closest(`.${I.COUNTRY_ITEM}`);s&&n(s)},{signal:t})}#n1(t,n){setTimeout(()=>{document.documentElement.addEventListener("click",i=>{this.#n.contains(i.target)||n()},{signal:t})},0)}#y(t,n,i){let s="",u=null,h=p=>{[R.ARROW_UP,R.ARROW_DOWN,R.ENTER,R.ESC].includes(p.key)&&(p.preventDefault(),p.stopPropagation(),p.key===R.ARROW_UP||p.key===R.ARROW_DOWN?this.#i1(p.key):p.key===R.ENTER&&!p.isComposing?n(this.#h):p.key===R.ESC&&(i(),this.#t.focus())),!this.#d.countrySearch&&p.target!==this.telInputEl&&j.HIDDEN_SEARCH_CHAR.test(p.key)&&(p.stopPropagation(),u&&clearTimeout(u),s+=p.key.toLowerCase(),this.#P(s),u=setTimeout(()=>{s=""},z1.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",h,{signal:t})}#j(t){this.#r.addEventListener("input",()=>this.#L(),{signal:t}),this.#u.addEventListener("click",()=>this.#a(),{signal:t})}#P(t){let n=r2(this.#I,this.#b,t);if(n){let i=this.#_.get(n.iso2);this.#p(i)}}#i1(t){let n=t===R.ARROW_UP?this.#h?.previousElementSibling:this.#h?.nextElementSibling;!n&&this.#i.childElementCount>1&&(n=t===R.ARROW_UP?this.#i.lastElementChild:this.#i.firstElementChild),n&&this.#p(n)}#M(t){if(this.#m&&this.#m.dataset[K.ISO2]!==t&&(this.#m.setAttribute(A.SELECTED,"false"),this.#m.querySelector(".iti__country-check")?.remove(),this.#m=null),t&&!this.#m){let n=this.#i.querySelector(`[data-iso2="${t}"]`);n&&(n.setAttribute(A.SELECTED,"true"),N("span",{class:"iti__country-check",[A.HIDDEN]:"true"},n).appendChild(i2()),this.#m=n,this.#d.dropdownAlwaysOpen&&this.#p(n))}}#K(t){this.#i.replaceChildren();let n=!0;for(let i of t){let s=this.#_.get(i.iso2);s&&(this.#i.appendChild(s),n&&(this.#p(s,!1),n=!1))}n?(this.#p(null),this.#T&&this.#T.classList.remove(I.HIDE)):this.#T&&this.#T.classList.add(I.HIDE),this.#i.scrollTop=0,this.#F()}closeDropdown(){let{countrySearch:t,dropdownContainer:n}=this.#d;this.#w.abort(),this.#w=null,this.#n.classList.add(I.HIDE),this.#t.setAttribute(A.EXPANDED,"false"),t&&(this.#r.removeAttribute(A.ACTIVE_DESCENDANT),this.#r.value="",this.#R(),this.#h&&(this.#h.classList.remove(I.HIGHLIGHT),this.#h=null)),this.#$.classList.remove(I.ARROW_UP),n?(this.#s.remove(),this.#s.style.top="",this.#s.style.bottom="",this.#s.style.paddingLeft="",this.#s.style.paddingRight=""):(this.#n.style.top="",this.#n.style.bottom="")}#N(){if(this.#d.dropdownAlwaysOpen)return!0;let t=this.telInputEl.getBoundingClientRect(),n=t.top,i=window.innerHeight-t.bottom;return i>=this.#O||i>=n}#Y(){let{dropdownContainer:t,useFullscreenPopup:n}=this.#d;if(n){if(window.innerWidth>=V.NARROW_VIEWPORT_WIDTH){let i=this.telInputEl.getBoundingClientRect();this.#s.style.paddingLeft=`${i.left}px`,this.#s.style.paddingRight=`${window.innerWidth-i.right}px`}}else{let i=this.telInputEl.getBoundingClientRect();this.#s.style.left=`${i.left}px`,this.#N()?this.#s.style.top=`${i.bottom+V.DROPDOWN_MARGIN}px`:(this.#s.style.top="unset",this.#s.style.bottom=`${window.innerHeight-i.top+V.DROPDOWN_MARGIN}px`)}t.appendChild(this.#s)}#A(){let t=window.visualViewport;if(!t||!this.#s)return;let n=window.innerHeight-t.height;this.#s.style.bottom=`${n}px`}isDropdownOpen(){return!this.#n.classList.contains(I.HIDE)}setLoading(t){this.#l.classList.toggle(I.LOADING,t)}isLoading(){return this.#l.classList.contains(I.LOADING)}setDisabled(t){this.telInputEl.disabled=t,this.#t&&(t?this.#t.setAttribute("disabled","true"):this.#t.removeAttribute("disabled"))}setReadonly(t){this.telInputEl.readOnly=t,this.#t&&(t?this.#t.setAttribute("disabled","true"):this.#t.removeAttribute("disabled"))}setCountry(t){let{allowDropdown:n,showFlags:i,separateDialCode:s,i18n:u}=this.#d,h=t?.name,p=t?.dialCode,g=t?.iso2??"";if(n&&this.#M(g),this.#t){let S=g&&i?`${I.FLAG} iti__${g}`:`${I.FLAG} ${I.GLOBE}`,b,y,T=null;g?(y=h,b=u.selectedCountryAriaLabel.replace("${countryName}",h).replace("${dialCode}",`+${p}`),i||(T=e0())):(y=u.noCountrySelected,b=u.noCountrySelected,T=e0()),this.#l.className=S,this.#t.setAttribute("title",y),this.#t.setAttribute(A.LABEL,b),T?this.#l.replaceChildren(T):this.#l.replaceChildren()}if(s){let S=p?`+${p}`:"";this.#E.textContent=S,this.#k()}}destroy(){this.telInputEl.iti=void 0,delete this.telInputEl.dataset[K.INSTANCE_ID],this.telInputEl.style.paddingLeft=this.#C;let t=this.telInputEl.parentNode;t&&(t.before(this.telInputEl),t.remove()),this.#_.clear()}};var o2=r=>{let{onlyCountries:t,excludeCountries:n}=r;return t?.length?c1.filter(i=>t.includes(i.iso2)):n?.length?c1.filter(i=>!n.includes(i.iso2)):[...c1]},l2=(r,t)=>{let{countryNameLocale:n,countryNameOverrides:i}=t,s;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?s=new Intl.DisplayNames(n,{type:"region"}):s=null}catch(u){console.error(u),s=null}for(let u of r)u.name=i[u.iso2]||s?.of(u.iso2.toUpperCase())||""},u2=r=>{let t=new Set,n=0,i={},s=(h,p)=>{if(!h||!p)return;p.length>n&&(n=p.length),Object.hasOwn(i,p)||(i[p]=[]);let g=i[p];g.includes(h)||g.push(h)},u=[...r].sort((h,p)=>h.priority-p.priority);for(let h of u){t.has(h.dialCode)||t.add(h.dialCode);for(let p=1;p<h.dialCode.length;p++){let g=h.dialCode.substring(0,p);s(h.iso2,g)}if(s(h.iso2,h.dialCode),h.areaCodes){let p=i[h.dialCode][0];for(let g of h.areaCodes){for(let S=1;S<g.length;S++){let b=g.substring(0,S),y=h.dialCode+b;s(p,y),s(h.iso2,y)}s(h.iso2,h.dialCode+g)}}}return{dialCodes:t,dialCodeMaxLength:n,dialCodeToIso2Map:i}},a2=(r,t)=>{let{countryOrder:n}=t;r.sort((i,s)=>{if(n){let u=n.indexOf(i.iso2),h=n.indexOf(s.iso2),p=u>-1,g=h>-1;if(p||g)return p&&g?u-h:p?-1:1}return i.name.localeCompare(s.name)})};var X2=new Set(["800","808","870","881","882","883","888","979"]),n0=r=>{let t=Z(r).slice(0,3);return r.startsWith("+")&&X2.has(t)};var i0=(r,t,n,i)=>{if(!n||!t)return r;let s=`+${i.dialCode}`,u=r[s.length]===" "||r[s.length]==="-"?s.length+1:s.length;return r.substring(u)},c2=(r,t,n,i,s)=>{let u=n?n.formatNumberAsYouType(r,i?.iso2):r,h=i?.dialCode;return s&&t.charAt(0)!=="+"&&u.includes(`+${h}`)?(u.split(`+${h}`)[1]||"").trim():u};var h2=(r,t,n,i)=>{if(n===0&&!i)return 0;let s=0;for(let u=0;u<t.length;u++){if(/[+0-9]/.test(t[u])&&s++,s===r&&!i)return u+1;if(i&&s===r+1)return u}return t.length};var J2=new Set(["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"]),$0=r=>{let t=Z(r);if(t.startsWith(H1.NANP)&&t.length>=4){let n=t.substring(1,4);return J2.has(n)}return!1};var z2=0,m1=r=>{if(!C.utils)throw new Error(`intlTelInput.utils is required for ${r}(). See: https://intl-tel-input.com/docs/utils`)},p2=()=>{let r,t;return{promise:new Promise((i,s)=>{r=i,t=s}),resolve:r,reject:t}},b1=class r{id;promise;#d;#e;#S;#C;#I;#b;#v;#O;#g;#t=null;#l=null;#E;#$=!0;#n;#f;#r=!1;#u;#i;constructor(t,n={}){this.id=z2++,g1.validateInput(t);let i=q0(n);this.#e={...k1,...i},d2(this.#e),t2(this.#e),this.#d=new g1(t,this.#e,this.id),this.#S=typeof navigator<"u"&&/Android/i.test(navigator.userAgent),this.#f=new f1(t.value),this.promise=this.#T(this.#e),this.#C=o2(this.#e);let{dialCodes:s,dialCodeMaxLength:u,dialCodeToIso2Map:h}=u2(this.#C);this.#v=s,this.#I=u,this.#b=h,this.#O=new Map(this.#C.map(p=>[p.iso2,p])),this.#H()}#o(){let t=this.#d.telInputEl.value.trim();return this.#f.normalise(t)}#c(t){this.#d.telInputEl.value=this.#f.denormalise(t)}#T(t){let{initialCountry:n,geoIpLookup:i,loadUtils:s}=t,u=n===T1.AUTO&&!!i,h=!!s&&!C.utils;return u&&(this.#u=p2()),h&&(this.#i=p2()),Promise.all([this.#u?.promise,this.#i?.promise]).then(()=>{})}#H(){this.#n=new AbortController,this.#s(),this.#d.buildMarkup(this.#C,this.#g),this.#m(),this.#h(),this.#_(),this.#e.dropdownAlwaysOpen&&this.#D()}#s(){l2(this.#C,this.#e),a2(this.#C,this.#e),this.#g=$2(this.#C)}#m(t=!1){let n=this.#d.telInputEl.getAttribute("value"),i=this.#f.normalise(n??""),s=this.#o(),h=i&&i.startsWith("+")&&(!s||!s.startsWith("+"))?i:s,p=this.#N(h),g=$0(h),{initialCountry:S,geoIpLookup:b}=this.#e,y=S===T1.AUTO&&b,T=y&&C.autoCountry?C.autoCountry:S,F=y&&!t&&!C.autoCountry,B=s1(T);p?g?B?this.#y(T):F||this.#y(Y0.ISO2):(B&&this.#y(T),this.#x(h)):B?this.#y(T):F||this.#y(""),h&&this.#p(h)}#h(){this.#X(),this.#e.allowDropdown&&this.#d.bindAllInitialDropdownListeners(this.#n.signal,()=>this.#D(),()=>this.#M()),this.#d.bindHiddenInputSubmitListener(this.#n.signal,()=>this.getNumber(),()=>this.#t?.iso2||"")}#_(){if(this.#i){let{loadUtils:t}=this.#e,n=()=>{C.attachUtils(t).catch(()=>{})};C.documentReady()?n():window.addEventListener("load",n,{signal:this.#n.signal})}this.#u&&(this.#t?this.#u.resolve():this.#w())}async#w(){if(C.autoCountry){this.#s1();return}if(this.#d.setLoading(!0),!C.startedLoadingAutoCountry&&(C.startedLoadingAutoCountry=!0,typeof this.#e.geoIpLookup=="function"))try{let t=await this.#e.geoIpLookup(),n=typeof t=="string"?t.toLowerCase():"";if(!s1(n)){r.forEachInstance("handleAutoCountryFailure");return}C.autoCountry=n,setTimeout(()=>r.forEachInstance("handleAutoCountryLoaded"))}catch{r.forEachInstance("handleAutoCountryFailure")}}#U(){this.#D(),this.#d.prefillSearchWithPlus()}#B(t){let n=this.#d.telInputEl.selectionStart||0,i=t.substring(0,n-1),s=t.substring(n);return this.#c(i+s),n-1}#X(){this.#k(),this.#d1(),this.#F()}#J(t){this.#B(t),this.#U()}#z(t,n){let i=this.#B(t);this.#d.telInputEl.setSelectionRange(i,i),this.#L(),this.#a(k.STRICT_REJECT,{source:"key",rejectedInput:n,reason:"invalid"})}#Q(t,n){let i=this.#d.telInputEl.selectionStart||0,u=t.substring(0,i).replace(j.NON_PLUS_NUMERIC_GLOBAL,"").length,h=this.#A(),p=c2(h,t,C.utils,this.#t,this.#e.separateDialCode),g=h2(u,p,i,n);this.#c(p),this.#d.telInputEl.setSelectionRange(g,g)}#q(t){if(t.startsWith("+")&&this.#t&&this.#N(t)){let n=i0(t,!0,!0,this.#t);this.#c(n)}}#k(){this.#r=j.ALPHA_UNICODE.test(this.#o()),this.#d.telInputEl.addEventListener("input",this.#G,{signal:this.#n.signal})}#G=t=>{let{strictMode:n,formatAsYouType:i,separateDialCode:s,allowDropdown:u,countrySearch:h}=this.#e,p=t?.detail;if(p?.isCountryChange)return;let g=this.#o();if(this.#S&&t?.data==="+"&&s&&u&&h){this.#J(g);return}if(this.#S&&n&&(t?.data===" "||t?.data==="-"||t?.data===".")){this.#z(g,t.data);return}this.#x(g)&&this.#Z();let S=t?.data&&j.NON_PLUS_NUMERIC.test(t.data),b=t?.inputType===J1.PASTE&&g;S||b&&!n?this.#r=!0:j.NON_PLUS_NUMERIC.test(g)||(this.#r=!1),i&&!this.#r&&!p?.isSetNumber&&this.#f.isAscii()&&this.#Q(g,t?.inputType===J1.DELETE_FORWARD),s&&this.#q(g)};#d1(){let{strictMode:t,separateDialCode:n}=this.#e;!t&&!n||this.#d.telInputEl.addEventListener("keydown",this.#t1,{signal:this.#n.signal})}#t1=t=>{let{strictMode:n,separateDialCode:i,allowDropdown:s,countrySearch:u}=this.#e;if(!t.key||t.key.length!==1||t.altKey||t.ctrlKey||t.metaKey)return;if(i&&s&&u&&t.key==="+"){t.preventDefault(),this.#U();return}if(!n)return;let h=this.#o(),g=!h.startsWith("+")&&this.#d.telInputEl.selectionStart===0&&t.key==="+",S=this.#f.normalise(t.key),b=/^[0-9]$/.test(S),y=i?b:g||b,T=this.#d.telInputEl,F=T.selectionStart,B=T.selectionEnd,o1=h.slice(0,F??void 0),X=h.slice(B??void 0),x=o1+S+X,J=this.#Y(x),t1=!1;C.utils&&this.#l&&(t1=C.utils.getCoreNumber(J,this.#t?.iso2).length>this.#l);let l1=this.#V(J)!==null;(!y||t1&&!l1&&!g)&&(this.#L(),this.#a(k.STRICT_REJECT,{source:"key",rejectedInput:t.key,reason:y?"max-length":"invalid"}),t.preventDefault())};#F(){this.#e.strictMode&&this.#d.telInputEl.addEventListener("paste",this.#W,{signal:this.#n.signal})}#W=t=>{t.preventDefault();let n=this.#d.telInputEl,i=n.selectionStart,s=n.selectionEnd,u=this.#o(),h=u.slice(0,i??void 0),p=u.slice(s??void 0),g=this.#t?.iso2,S=t.clipboardData.getData("text"),b=this.#f.normalise(S),y=i===0&&s>0,T=!u.startsWith("+")||y,F=b.replace(j.NON_PLUS_NUMERIC_GLOBAL,""),B=F.startsWith("+"),o1=F.replace(/\+/g,""),X=B&&T?`+${o1}`:o1,x=h+X+p,J=X!==b?"invalid":null;if(x.length>30){this.#L(),this.#a(k.STRICT_REJECT,{source:"paste",rejectedInput:S,reason:"max-length"});return}if(x.length>5&&C.utils){let z=C.utils.getCoreNumber(x,g);for(;z.length===0&&x.length>0;)x=x.slice(0,-1),z=C.utils.getCoreNumber(x,g);if(!z){this.#L(),this.#a(k.STRICT_REJECT,{source:"paste",rejectedInput:S,reason:"max-length"});return}if(this.#l&&z.length>this.#l)if(n.selectionEnd===u.length){let l1=z.length-this.#l;x=x.slice(0,x.length-l1),J="max-length"}else{this.#L(),this.#a(k.STRICT_REJECT,{source:"paste",rejectedInput:S,reason:"max-length"});return}}this.#c(x);let t1=i+X.length;n.setSelectionRange(t1,t1),n.dispatchEvent(new InputEvent("input",{bubbles:!0})),J&&(b.length>0&&X.length===0&&this.#L(),this.#a(k.STRICT_REJECT,{source:"paste",rejectedInput:S,reason:J}))};#R(t){let n=Number(this.#d.telInputEl.getAttribute("maxlength"));return n&&t.length>n?t.substring(0,n):t}#L(){if(!this.#e.strictRejectAnimation)return;let t=this.#d.telInputEl.parentElement;t&&(t.classList.remove("iti__strict-reject-animation"),t.offsetWidth,t.classList.add("iti__strict-reject-animation"))}#a(t,n={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});this.#d.telInputEl.dispatchEvent(i)}#D(){this.#d.openDropdown(t=>this.#i1(t),()=>this.#M()),this.#a(k.OPEN_COUNTRY_DROPDOWN)}#p(t){let{formatOnDisplay:n,nationalMode:i,separateDialCode:s}=this.#e,u=t;if(n&&C.utils&&this.#t){let h=n0(t),g=i&&!h||!u.startsWith("+")&&!s?L1.NATIONAL:L1.INTERNATIONAL;u=C.utils.formatNumber(u,this.#t?.iso2,g)}u=this.#$1(u),this.#c(u)}#x(t){let n=this.#V(t);return n!==null?this.#y(n):!1}#e1(t){let n=this.#t?.dialCode,i=this.#t?.nationalPrefix;if(t.startsWith("+")||!n)return t;let h=i&&t.startsWith(i)&&!this.#e.separateDialCode?t.substring(1):t;return`+${n}${h}`}#V(t){let n=t.indexOf("+"),i=n>0?t.substring(n):t,s=this.#t?.iso2;i=this.#e1(i);let u=this.#N(i,!0),h=Z(i);if(u){let p=Z(u),g=this.#b[p];return g.length===1?g[0]===s?null:g[0]:this.#n1(g,p,h)}else if(i.startsWith("+")&&h.length){let p=this.#t?.dialCode||"";return p&&p.startsWith(h)?null:""}else if((!i||i==="+")&&!s&&this.#E)return this.#E;return null}#n1(t,n,i){let s=this.#t?.iso2,u=this.#t?.dialCode;if(!s&&this.#E&&t.includes(this.#E))return this.#E;if(u===H1.NANP&&$0(i))return null;let p=this.#t?.areaCodes,g=this.#t?.priority;if(p){let F=p.map(B=>`${u}${B}`);for(let B of F)if(i.startsWith(B))return null}let b=p&&!(g===0)&&i.length>n.length,y=s&&t.includes(s)&&!b,T=s===t[0];return!y&&!T?t[0]:null}#y(t){let n=this.#t?.iso2||"";return this.#t=t?this.#O.get(t):null,this.#t&&(this.#E=this.#t.iso2),this.#d.setCountry(this.#t),this.#P(),this.#j(),n!==t}#j(){let{strictMode:t,placeholderNumberType:n,allowedNumberTypes:i}=this.#e;if(!t||!C.utils)return;let s=this.#t?.iso2;if(!s){this.#l=null;return}let u=C.utils.getExampleNumber(s,!1,n,!0),h=u;for(;C.utils.isPossibleNumber(u,s,i);)h=u,u+="0";let p=C.utils.getCoreNumber(h,s);this.#l=p.length,s==="by"&&(this.#l=p.length+1)}#P(){let{autoPlaceholder:t,placeholderNumberType:n,nationalMode:i,customPlaceholder:s}=this.#e,u=t===h1.AGGRESSIVE||!this.#d.hadInitialPlaceholder&&t===h1.POLITE;if(!C.utils||!u)return;let h=this.#t?C.utils.getExampleNumber(this.#t.iso2,i,n):"";h=this.#$1(h),typeof s=="function"&&(h=s(h,this.#t)),this.#d.telInputEl.setAttribute("placeholder",h)}#i1(t){if(!t)return;let n=t.dataset[K.ISO2],i=this.#y(n);this.#M();let s=t.dataset[K.DIAL_CODE];if(this.#K(s),this.#e.formatOnDisplay){let u=this.#o();this.#p(u)}this.#d.telInputEl.focus(),i&&(this.#Z(),this.#a(k.INPUT,{isCountryChange:!0}))}#M(t){!this.#d.isDropdownOpen()||this.#e.dropdownAlwaysOpen&&!t||(this.#d.closeDropdown(),this.#a(k.CLOSE_COUNTRY_DROPDOWN))}#K(t){let n=this.#o();if(!n.startsWith("+"))return;let i=`+${t}`,s=this.#N(n),u;s?u=n.replace(s,i):u=i,this.#c(u)}#N(t,n){if(!t.startsWith("+"))return"";let i="",s="",u=!1;for(let h=0;h<t.length;h++){let p=t.charAt(h);if(!/[0-9]/.test(p))continue;if(s+=p,!!!this.#b[s])break;if(this.#v.has(s)){if(i=t.substring(0,h+1),u=!0,!n)break}else n&&u&&(i=t.substring(0,h+1));if(s.length===this.#I)break}return i}#Y(t){let n=this.#t?.dialCode,i=Z(t);return(this.#e.separateDialCode&&!t.startsWith("+")&&n&&i?`+${n}`:"")+t}#A(){let t=this.#o();return this.#Y(t)}#$1(t){let n=!!this.#N(t),i=i0(t,n,this.#e.separateDialCode,this.#t);return this.#R(i)}#Z(){this.#a(k.COUNTRY_CHANGE,this.#t??null)}#s1(){if(!(!this.#u||!C.autoCountry)){if(!this.#$){this.#u.resolve();return}this.#d.isLoading()?this.setCountry(C.autoCountry):this.#E=C.autoCountry,this.#d.setLoading(!1),this.#u.resolve()}}#o1(){if(!this.#$){this.#u?.reject();return}this.#m(!0),this.#d.setLoading(!1),this.#u?.reject()}#l1(){if(!this.#$){this.#i?.resolve();return}if(!C.utils){this.#i?.resolve();return}let t=this.#o();t&&this.#p(t),this.#t&&(this.#P(),this.#j()),this.#i?.resolve()}#u1(t){if(!this.#$){this.#i?.reject(t);return}this.#i?.reject(t)}destroy(){this.#$&&(this.#$=!1,this.#e.allowDropdown&&this.#M(!0),this.#n.abort(),this.#d.destroy(),C.instances.delete(String(this.id)))}isActive(){return this.#$}getExtension(){return this.#$?(m1("getExtension"),C.utils.getExtension(this.#A(),this.#t?.iso2)):""}getNumber(t){if(!this.#$)return"";m1("getNumber");let n=this.#t?.iso2,i=this.#A(),s=C.utils.formatNumber(i,n,t);return this.#f.denormalise(s)}getNumberType(){return this.#$?(m1("getNumberType"),C.utils.getNumberType(this.#A(),this.#t?.iso2)):null}getSelectedCountryData(){return this.#t??null}getValidationError(){if(!this.#$)return null;m1("getValidationError");let t=this.#t?.iso2;return C.utils.getValidationError(this.#A(),t)}isValidNumber(){if(!this.#$)return null;m1("isValidNumber");let t=this.#t?.dialCode,n=this.#t?.iso2,i=this.#A(),s=C.utils.getCoreNumber(i,n);if(s){if(t===U1.DIAL_CODE&&s[0]===U1.MOBILE_PREFIX&&s.length!==U1.MOBILE_CORE_LENGTH)return!1;if(!j.ALPHA_UNICODE.test(i)&&t){let h=i.startsWith("+")?i.slice(1+t.length):i,p=Z(h).length;if(s.length>p)return!1}}return this.#r1("possible")}isValidNumberPrecise(){return this.#$?(m1("isValidNumberPrecise"),this.#r1("precise")):null}#r1(t){let{allowNumberExtensions:n,allowPhonewords:i,allowedNumberTypes:s}=this.#e,u=this.#t?.iso2,h=this.#A();return!this.#t&&!n0(h)||!(t==="precise"?C.utils.isValidNumber:C.utils.isPossibleNumber)(h,u,s)?!1:j.ALPHA_UNICODE.test(h)?!!C.utils.getExtension(h,u)?n:i:!0}setCountry(t){if(!this.#$)return;let n=t?.toLowerCase();if(!s1(n))throw new Error(`Invalid iso2 code: '${n}'`);let i=this.#t?.iso2;if(t&&n!==i||!t&&i){if(this.#y(n),this.#K(this.#t?.dialCode||""),this.#e.formatOnDisplay){let u=this.#o();this.#p(u)}this.#Z(),this.#a(k.INPUT,{isCountryChange:!0})}}setNumber(t){if(!this.#$)return;let n=this.#f.normalise(t),i=this.#x(n);this.#p(n),i&&this.#Z(),this.#a(k.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.#$&&(this.#e.placeholderNumberType=t,this.#P())}setDisabled(t){this.#$&&this.#d.setDisabled(t)}setReadonly(t){this.#$&&this.#d.setReadonly(t)}static forEachInstance(t,...n){let i=[...C.instances.values()],s=n[0];i.forEach(u=>{if(u instanceof r)switch(t){case"handleUtilsLoaded":u.#l1();break;case"handleUtilsFailure":u.#u1(s);break;case"handleAutoCountryLoaded":u.#s1();break;case"handleAutoCountryFailure":u.#o1();break}})}},Q2=async r=>{if(C.utils||C.startedLoadingUtils)return null;if(typeof r!="function")throw new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utils module, not ${typeof r}`);C.startedLoadingUtils=!0;try{let n=(await r())?.default;if(!n||typeof n!="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=n,b1.forEachInstance("handleUtilsLoaded"),!0}catch(t){throw b1.forEachInstance("handleUtilsFailure",t),t}},C=Object.assign((r,t)=>{let n=new b1(r,t);return C.instances.set(String(n.id),n),r.iti=n,n},{defaults:k1,documentReady:()=>document.readyState==="complete",getCountryData:()=>c1,getInstance:r=>{let t=r.dataset[K.INSTANCE_ID];return t?C.instances.get(t)??null:null},instances:new Map,attachUtils:Q2,startedLoadingUtils:!1,startedLoadingAutoCountry:!1,version:"28.0.4",NUMBER_FORMAT:L1,NUMBER_TYPE:r1,VALIDATION_ERROR:q1}),s0=C;var f2={};(function(){var r=this||self;function t(d,e){d=d.split(".");var $=r;d[0]in $||typeof $.execScript>"u"||$.execScript("var "+d[0]);for(var o;d.length&&(o=d.shift());)d.length||e===void 0?$[o]&&$[o]!==Object.prototype[o]?$=$[o]:$=$[o]={}:$[o]=e}function n(d,e){function $(){}$.prototype=e.prototype,d.na=e.prototype,d.prototype=new $,d.prototype.constructor=d,d.ta=function(o,l,a){for(var c=Array(arguments.length-2),f=2;f<arguments.length;f++)c[f-2]=arguments[f];return e.prototype[l].apply(o,c)}}function i(d){let e=[],$=0;for(let o in d)e[$++]=d[o];return e}var s=class{constructor(d){if(u!==u)throw Error("SafeUrl is not meant to be built directly");this.g=d}toString(){return this.g.toString()}},u={};new s("about:invalid#zClosurez"),new s("about:blank");let h={};class p{constructor(){if(h!==h)throw Error("SafeStyle is not meant to be built directly")}toString(){return""}}new p;let g={};class S{constructor(){if(g!==g)throw Error("SafeStyleSheet is not meant to be built directly")}toString(){return""}}new S;let b={};class y{constructor(){var e=r.trustedTypes&&r.trustedTypes.emptyHTML||"";if(b!==b)throw Error("SafeHtml is not meant to be built directly");this.g=e}toString(){return this.g.toString()}}new y;function T(d,e){switch(this.g=d,this.l=!!e.ca,this.h=e.i,this.u=e.type,this.o=!1,this.h){case o1:case X:case x:case J:case t1:case B:case F:this.o=!0}this.j=e.defaultValue}var F=1,B=2,o1=3,X=4,x=6,J=16,t1=18;function z(d,e){for(this.h=d,this.g={},d=0;d<e.length;d++){var $=e[d];this.g[$.g]=$}}function l1(d){return d=i(d.g),d.sort(function(e,$){return e.g-$.g}),d}function _(){this.h={},this.j=this.m().g,this.g=this.l=null}_.prototype.has=function(d){return w(this,d.g)},_.prototype.get=function(d,e){return m(this,d.g,e)},_.prototype.set=function(d,e){D(this,d.g,e)},_.prototype.add=function(d,e){o0(this,d.g,e)},_.prototype.equals=function(d){if(!d||this.constructor!=d.constructor)return!1;for(var e=l1(this.m()),$=0;$<e.length;$++){var o=e[$],l=o.g;if(w(this,l)!=w(d,l))return!1;if(w(this,l)){var a=o.h==11||o.h==10,c=P(this,l);if(l=P(d,l),o.l){if(c.length!=l.length)return!1;for(o=0;o<c.length;o++){var f=c[o],E=l[o];if(a?!f.equals(E):f!=E)return!1}}else if(a?!c.equals(l):c!=l)return!1}}return!0};function r0(d,e){for(var $=l1(d.m()),o=0;o<$.length;o++){var l=$[o],a=l.g;if(w(e,a)){d.g&&delete d.g[l.g];var c=l.h==11||l.h==10;if(l.l){l=P(e,a)||[];for(var f=0;f<l.length;f++)o0(d,a,c?l[f].clone():l[f])}else l=P(e,a),c?(c=P(d,a))?r0(c,l):D(d,a,l.clone()):D(d,a,l)}}}_.prototype.clone=function(){var d=new this.constructor;return d!=this&&(d.h={},d.g&&(d.g={}),r0(d,this)),d};function w(d,e){return d.h[e]!=null}function P(d,e){var $=d.h[e];if($==null)return null;if(d.l){if(!(e in d.g)){var o=d.l,l=d.j[e];if($!=null)if(l.l){for(var a=[],c=0;c<$.length;c++)a[c]=o.h(l,$[c]);$=a}else $=o.h(l,$);return d.g[e]=$}return d.g[e]}return $}function m(d,e,$){var o=P(d,e);return d.j[e].l?o[$||0]:o}function L(d,e){if(w(d,e))d=m(d,e);else d:{if(d=d.j[e],d.j===void 0)if(e=d.u,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 Q(d,e){return d.j[e].l?w(d,e)?d.h[e].length:0:w(d,e)?1:0}function D(d,e,$){d.h[e]=$,d.g&&(d.g[e]=$)}function o0(d,e,$){d.h[e]||(d.h[e]=[]),d.h[e].push($),d.g&&delete d.g[e]}function v1(d,e){var $=[],o;for(o in e)o!=0&&$.push(new T(o,e[o]));return new z(d,$)}function w1(){}w1.prototype.g=function(d){throw new d.h,Error("Unimplemented")},w1.prototype.h=function(d,e){if(d.h==11||d.h==10)return e instanceof _?e:this.g(d.u.prototype.m(),e);if(d.h==14)return typeof e=="string"&&l0.test(e)&&(d=Number(e),d>0)?d:e;if(!d.o)return e;if(d=d.u,d===String){if(typeof e=="number")return String(e)}else if(d===Number&&typeof e=="string"&&(e==="Infinity"||e==="-Infinity"||e==="NaN"||l0.test(e)))return Number(e);return e};var l0=/^-?[0-9]+$/;function W1(){}n(W1,w1),W1.prototype.g=function(d,e){return d=new d.h,d.l=this,d.h=e,d.g={},d};function C1(){}n(C1,W1),C1.prototype.h=function(d,e){return d.h==8?!!e:w1.prototype.h.apply(this,arguments)},C1.prototype.g=function(d,e){return C1.na.g.call(this,d,e)};function O(d,e){d!=null&&this.g.apply(this,arguments)}O.prototype.h="",O.prototype.set=function(d){this.h=""+d},O.prototype.g=function(d,e,$){if(this.h+=String(d),e!=null)for(let o=1;o<arguments.length;o++)this.h+=arguments[o];return this};function H(d){d.h=""}O.prototype.toString=function(){return this.h};function e1(){_.call(this)}n(e1,_);var u0=null;function