diff --git a/README.md b/README.md index 794832fa5..8d8b9e63a 100644 --- a/README.md +++ b/README.md @@ -67,16 +67,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because ## Getting Started (Using a CDN) 1. Add the CSS ```html - + ``` 2. Add the plugin script and initialise it on your input element ```html - + ``` diff --git a/build/js/data.js b/build/js/data.js index e1808fc1f..4c7cc42fd 100644 --- a/build/js/data.js +++ b/build/js/data.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v22.0.2 + * International Telephone Input v23.0.0 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ diff --git a/build/js/data.min.js b/build/js/data.min.js index 70cd5e14e..75b80cfcb 100644 --- a/build/js/data.min.js +++ b/build/js/data.min.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v22.0.2 + * International Telephone Input v23.0.0 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ diff --git a/build/js/intlTelInput.js b/build/js/intlTelInput.js index ef9476159..4699b2f74 100644 --- a/build/js/intlTelInput.js +++ b/build/js/intlTelInput.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v22.0.2 + * International Telephone Input v23.0.0 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ @@ -2771,7 +2771,7 @@ var factoryOutput = (() => { //* A map from instance ID to instance object. instances: {}, loadUtils, - version: "22.0.2" + version: "23.0.0" } ); var intl_tel_input_default = intlTelInput; diff --git a/build/js/intlTelInput.min.js b/build/js/intlTelInput.min.js index 35e1a9fe7..8aaed5f23 100644 --- a/build/js/intlTelInput.min.js +++ b/build/js/intlTelInput.min.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v22.0.2 + * International Telephone Input v23.0.0 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ @@ -13,7 +13,7 @@ } }(() => { -var factoryOutput=(()=>{var _=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var x=(l,t)=>{for(var e in t)_(l,e,{get:t[e],enumerable:!0})},P=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of S(t))!M.call(l,n)&&n!==e&&_(l,n,{get:()=>t[n],enumerable:!(i=N(t,n))||i.enumerable});return l};var H=l=>P(_({},"__esModule",{value:!0}),l);var B={};x(B,{Iti:()=>b,default:()=>F});var I=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],w=[];for(let l=0;ll.replace(/\D/g,""),D=(l="")=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),k=l=>{let t=f(l);if(t.charAt(0)==="1"){let e=t.substr(1,3);return R.indexOf(e)!==-1}return!1},z=(l,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(l);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},y=l=>{let{instances:t}=r;Object.values(t).forEach(e=>e[l]())},b=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_a14;_a9;_a10;_a11;_a12;_handleKeydownEvent;_a4;_a0;_a1;_a2;_a3;_a7;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(t,e={}){this.id=O++,this.a=t,this.c=null,this.d=Object.assign({},A,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.separateDialCode&&(this.d.allowDropdown=!0,this.d.nationalMode=!1),!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.i18n={...E,...this.d.i18n};let t=new Promise((i,n)=>{this.h=i,this.i=n}),e=new Promise((i,n)=>{this.i0=i,this.i1=n});this.promise=Promise.all([t,e]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this._sortCountries()}_sortCountries(){this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),o=n>-1,a=s>-1;if(o||a)return o&&a?n-s:o?-1:1}return t.namee.name?1:0})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;sn.toLowerCase());this.p=C.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=C.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=C}_d0(){for(let t=0;t
`),o+=`${n.name}`,o+=`+${n.dialCode}`,s.insertAdjacentHTML("beforeend",o)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,o=this._5(s),a=k(s),{initialCountry:u}=this.d;if(o&&!a)this._v(s);else if(u!=="auto"||t){let d=u?u.toLowerCase():"";d&&this._y(d,!0)?this._z(d):o&&a?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){this.d.utilsScript&&!r.utils?r.documentReady()?r.loadUtils(this.d.utilsScript):window.addEventListener("load",()=>{r.loadUtils(this.d.utilsScript)}):this.i0(),this.d.initialCountry==="auto"&&!this.s.iso2?this._i4():this.h()}_i4(){r.autoCountry?this.handleAutoCountry():r.startedLoadingAutoCountry||(r.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(r.autoCountry=e,setTimeout(()=>y("handleAutoCountry"))):(this._h(!0),y("rejectAutoCountryPromise"))},()=>{this._h(!0),y("rejectAutoCountryPromise")}))}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i}=this.d,n=!1;this._a12=s=>{this._v(this.a.value)&&this._8();let o=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.a.value;if(o||a&&!t?n=!0:/[^+0-9]/.test(this.a.value)||(n=!1),e&&!n){let u=this.a.selectionStart||0,c=this.a.value.substring(0,u).replace(/[^+0-9]/g,"").length,p=s&&s.inputType==="deleteContentForward",g=this._9(),m=z(c,g,u,p);this.a.value=g,this.a.setSelectionRange(m,m)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(i&&s.key==="+"){s.preventDefault(),this._n(),this.searchInput.value="+",this._p3("",!0);return}if(t){let o=this.a.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=o||a,d=this._6(),c=r.utils.getCoreNumber(d,this.s.iso2),p=this.maxCoreNumberLength&&c.length>=this.maxCoreNumberLength;(!u||p)&&s.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t){let e=new Event(t,{bubbles:!0,cancelable:!0});this.a.dispatchEvent(e)}_n(){let{fixDropdownWidth:t}=this.d;t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o();let e=this.countryList.firstElementChild;e&&(this._x(e,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2),this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2())},document.addEventListener("keydown",this._a3);let e=()=>{let n=this.searchInput.value.trim();n?this._p3(n):this._p3("",!0)},i=null;this._a7=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_p3(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=D(t);for(let s=0;s1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&r.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=r.utils.numberFormat,o=i?n:s;e=r.utils.formatNumber(e,this.s.iso2,o)}e=this._7(e),this.a.value=e}_v(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let o=this._5(i,!0),a=f(i),u=null;if(o){let d=this.q[f(o)],c=d.indexOf(this.s.iso2)!==-1&&a.length<=o.length-1;if(!(n==="1"&&k(a))&&!c){for(let g=0;go){let p=n-a;e.scrollTop=c-p}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s!r.utils&&!r.startedLoadingUtilsScript?(r.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(l).then(({default:i})=>{r.utils=i,y("handleUtils"),t(!0)}).catch(()=>{y("rejectUtilsScriptPromise"),e()})})):null,r=Object.assign((l,t)=>{let e=new b(l,t);return e._init(),l.setAttribute("data-intl-tel-input-id",e.id.toString()),r.instances[e.id]=e,e},{defaults:A,documentReady:()=>document.readyState==="complete",getCountryData:()=>C,getInstance:l=>{let t=l.getAttribute("data-intl-tel-input-id");return t?r.instances[t]:null},instances:{},loadUtils:j,version:"22.0.2"}),F=r;return H(B);})(); +var factoryOutput=(()=>{var _=Object.defineProperty;var N=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var x=(l,t)=>{for(var e in t)_(l,e,{get:t[e],enumerable:!0})},P=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of S(t))!M.call(l,n)&&n!==e&&_(l,n,{get:()=>t[n],enumerable:!(i=N(t,n))||i.enumerable});return l};var H=l=>P(_({},"__esModule",{value:!0}),l);var B={};x(B,{Iti:()=>b,default:()=>F});var I=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],w=[];for(let l=0;ll.replace(/\D/g,""),D=(l="")=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),k=l=>{let t=f(l);if(t.charAt(0)==="1"){let e=t.substr(1,3);return R.indexOf(e)!==-1}return!1},z=(l,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(l);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},y=l=>{let{instances:t}=r;Object.values(t).forEach(e=>e[l]())},b=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_a14;_a9;_a10;_a11;_a12;_handleKeydownEvent;_a4;_a0;_a1;_a2;_a3;_a7;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(t,e={}){this.id=O++,this.a=t,this.c=null,this.d=Object.assign({},A,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.separateDialCode&&(this.d.allowDropdown=!0,this.d.nationalMode=!1),!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.i18n={...E,...this.d.i18n};let t=new Promise((i,n)=>{this.h=i,this.i=n}),e=new Promise((i,n)=>{this.i0=i,this.i1=n});this.promise=Promise.all([t,e]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this._sortCountries()}_sortCountries(){this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),o=n>-1,a=s>-1;if(o||a)return o&&a?n-s:o?-1:1}return t.namee.name?1:0})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;sn.toLowerCase());this.p=C.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=C.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=C}_d0(){for(let t=0;t
`),o+=`${n.name}`,o+=`+${n.dialCode}`,s.insertAdjacentHTML("beforeend",o)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,o=this._5(s),a=k(s),{initialCountry:u}=this.d;if(o&&!a)this._v(s);else if(u!=="auto"||t){let d=u?u.toLowerCase():"";d&&this._y(d,!0)?this._z(d):o&&a?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){this.d.utilsScript&&!r.utils?r.documentReady()?r.loadUtils(this.d.utilsScript):window.addEventListener("load",()=>{r.loadUtils(this.d.utilsScript)}):this.i0(),this.d.initialCountry==="auto"&&!this.s.iso2?this._i4():this.h()}_i4(){r.autoCountry?this.handleAutoCountry():r.startedLoadingAutoCountry||(r.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(r.autoCountry=e,setTimeout(()=>y("handleAutoCountry"))):(this._h(!0),y("rejectAutoCountryPromise"))},()=>{this._h(!0),y("rejectAutoCountryPromise")}))}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i}=this.d,n=!1;this._a12=s=>{this._v(this.a.value)&&this._8();let o=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.a.value;if(o||a&&!t?n=!0:/[^+0-9]/.test(this.a.value)||(n=!1),e&&!n){let u=this.a.selectionStart||0,c=this.a.value.substring(0,u).replace(/[^+0-9]/g,"").length,p=s&&s.inputType==="deleteContentForward",g=this._9(),m=z(c,g,u,p);this.a.value=g,this.a.setSelectionRange(m,m)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(i&&s.key==="+"){s.preventDefault(),this._n(),this.searchInput.value="+",this._p3("",!0);return}if(t){let o=this.a.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=o||a,d=this._6(),c=r.utils.getCoreNumber(d,this.s.iso2),p=this.maxCoreNumberLength&&c.length>=this.maxCoreNumberLength;(!u||p)&&s.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t){let e=new Event(t,{bubbles:!0,cancelable:!0});this.a.dispatchEvent(e)}_n(){let{fixDropdownWidth:t}=this.d;t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o();let e=this.countryList.firstElementChild;e&&(this._x(e,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2),this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2())},document.addEventListener("keydown",this._a3);let e=()=>{let n=this.searchInput.value.trim();n?this._p3(n):this._p3("",!0)},i=null;this._a7=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_p3(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=D(t);for(let s=0;s1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&r.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=r.utils.numberFormat,o=i?n:s;e=r.utils.formatNumber(e,this.s.iso2,o)}e=this._7(e),this.a.value=e}_v(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let o=this._5(i,!0),a=f(i),u=null;if(o){let d=this.q[f(o)],c=d.indexOf(this.s.iso2)!==-1&&a.length<=o.length-1;if(!(n==="1"&&k(a))&&!c){for(let g=0;go){let p=n-a;e.scrollTop=c-p}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s!r.utils&&!r.startedLoadingUtilsScript?(r.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(l).then(({default:i})=>{r.utils=i,y("handleUtils"),t(!0)}).catch(()=>{y("rejectUtilsScriptPromise"),e()})})):null,r=Object.assign((l,t)=>{let e=new b(l,t);return e._init(),l.setAttribute("data-intl-tel-input-id",e.id.toString()),r.instances[e.id]=e,e},{defaults:A,documentReady:()=>document.readyState==="complete",getCountryData:()=>C,getInstance:l=>{let t=l.getAttribute("data-intl-tel-input-id");return t?r.instances[t]:null},instances:{},loadUtils:j,version:"23.0.0"}),F=r;return H(B);})(); // UMD return factoryOutput.default; diff --git a/build/js/intlTelInputWithUtils.js b/build/js/intlTelInputWithUtils.js index ad0f3284f..6864d9bc5 100644 --- a/build/js/intlTelInputWithUtils.js +++ b/build/js/intlTelInputWithUtils.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v22.0.2 + * International Telephone Input v23.0.0 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ @@ -2770,7 +2770,7 @@ var factoryOutput = (() => { //* A map from instance ID to instance object. instances: {}, loadUtils, - version: "22.0.2" + version: "23.0.0" } ); var intl_tel_input_default = intlTelInput; diff --git a/build/js/intlTelInputWithUtils.min.js b/build/js/intlTelInputWithUtils.min.js index 05dcfeda3..dba55f559 100644 --- a/build/js/intlTelInputWithUtils.min.js +++ b/build/js/intlTelInputWithUtils.min.js @@ -1,5 +1,5 @@ /* - * International Telephone Input v22.0.2 + * International Telephone Input v23.0.0 * https://github.com/jackocnr/intl-tel-input.git * Licensed under the MIT license */ @@ -13,7 +13,7 @@ } }(() => { -var factoryOutput=(()=>{var g1=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var D2=Object.getOwnPropertyNames;var x2=Object.prototype.hasOwnProperty;var P2=(m,$)=>{for(var n in $)g1(m,n,{get:$[n],enumerable:!0})},R2=(m,$,n,s)=>{if($&&typeof $=="object"||typeof $=="function")for(let u of D2($))!x2.call(m,u)&&u!==n&&g1(m,u,{get:()=>$[u],enumerable:!(s=N2($,u))||s.enumerable});return m};var k2=m=>R2(g1({},"__esModule",{value:!0}),m);var F2={};P2(F2,{default:()=>K2});var Q1=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],d2=[];for(let m=0;mm.replace(/\D/g,""),n2=(m="")=>m.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),i2=m=>{let $=u1(m);if($.charAt(0)==="1"){let n=$.substr(1,3);return B2.indexOf(n)!==-1}return!1},G2=(m,$,n,s)=>{if(n===0&&!s)return 0;let u=0;for(let l=0;l<$.length;l++){if(/[+0-9]/.test($[l])&&u++,u===m&&!s)return l+1;if(s&&u===m+1)return l}return $.length},E=(m,$,n)=>{let s=document.createElement(m);return $&&Object.entries($).forEach(([u,l])=>s.setAttribute(u,l)),n&&n.appendChild(s),s},Q=m=>{let{instances:$}=f;Object.values($).forEach(n=>n[m]())},f1=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor($,n={}){this.id=O2++,this.telInput=$,this.highlightedItem=null,this.options=Object.assign({},r2,n),this.hadInitialPlaceholder=!!$.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...$2,...this.options.i18n};let $=new Promise((s,u)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=u}),n=new Promise((s,u)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=u});this.promise=Promise.all([$,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map($=>$.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort(($,n)=>{let{countryOrder:s}=this.options;if(s){let u=s.indexOf($.iso2),l=s.indexOf(n.iso2),p=u>-1,C=l>-1;if(p||C)return p&&C?u-l:p?-1:1}return $.namen.name?1:0})}_addToDialCodeMap($,n,s){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let l=0;lu.toLowerCase());this.countries=X.filter(u=>s.indexOf(u.iso2)>-1)}else if(n.length){let s=n.map(u=>u.toLowerCase());this.countries=X.filter(u=>s.indexOf(u.iso2)===-1)}else this.countries=X}_translateCountryNames(){for(let $=0;$
`),p+=`${u.name}`,p+=`+${u.dialCode}`,l.insertAdjacentHTML("beforeend",p)}}_setInitialState($=!1){let n=this.telInput.getAttribute("value"),s=this.telInput.value,l=n&&n.charAt(0)==="+"&&(!s||s.charAt(0)!=="+")?n:s,p=this._getDialCode(l),C=i2(l),{initialCountry:y}=this.options;if(p&&!C)this._updateCountryFromNumber(l);else if(y!=="auto"||$){let I=y?y.toLowerCase():"";I&&this._getCountryData(I,!0)?this._setCountry(I):p&&C?this._setCountry("us"):this._setCountry()}l&&this._updateValFromNumber(l)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let $=this.telInput.closest("label");$&&$.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!f.utils?f.documentReady()?f.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{f.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){f.autoCountry?this.handleAutoCountry():f.startedLoadingAutoCountry||(f.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup(($="")=>{let n=$.toLowerCase();n&&this._getCountryData(n,!0)?(f.autoCountry=n,setTimeout(()=>Q("handleAutoCountry"))):(this._setInitialState(!0),Q("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),Q("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:$,formatAsYouType:n,separateDialCode:s}=this.options,u=!1;this._handleInputEvent=l=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let p=l&&l.data&&/[^+0-9]/.test(l.data),C=l&&l.inputType==="insertFromPaste"&&this.telInput.value;if(p||C&&!$?u=!0:/[^+0-9]/.test(this.telInput.value)||(u=!1),n&&!u){let y=this.telInput.selectionStart||0,b=this.telInput.value.substring(0,y).replace(/[^+0-9]/g,"").length,A=l&&l.inputType==="deleteContentForward",M=this._formatNumberAsYouType(),R=G2(b,M,y,A);this.telInput.value=M,this.telInput.setSelectionRange(R,R)}},this.telInput.addEventListener("input",this._handleInputEvent),($||s)&&(this._handleKeydownEvent=l=>{if(l.key&&l.key.length===1&&!l.altKey&&!l.ctrlKey&&!l.metaKey){if(s&&l.key==="+"){l.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if($){let p=this.telInput.selectionStart===0&&l.key==="+",C=/^[0-9]$/.test(l.key),y=p||C,I=this._getFullNumber(),b=f.utils.getCoreNumber(I,this.selectedCountryData.iso2),A=this.maxCoreNumberLength&&b.length>=this.maxCoreNumberLength;(!y||A)&&l.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap($){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&$.length>n?$.substr(0,n):$}_trigger($){let n=new Event($,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(n)}_openDropdown(){let{fixDropdownWidth:$}=this.options;$&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let $=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${$.top+n}px`,this.dropdown.style.left=`${$.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._highlightListItem(l,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._selectListItem(l)},this.countryList.addEventListener("click",this._handleClickCountryList);let $=!0;this._handleClickOffToClose=()=>{$||this._closeDropdown(),$=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=u=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),u.key==="ArrowUp"||u.key==="ArrowDown"?this._handleUpDownKey(u.key):u.key==="Enter"?this._handleEnterKey():u.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let n=()=>{let u=this.searchInput.value.trim();u?this._filterCountries(u):this._filterCountries("",!0)},s=null;this._handleSearchChange=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",u=>u.stopPropagation())}_filterCountries($,n=!1){let s=!0;this.countryList.innerHTML="";let u=n2($);for(let l=0;l1&&(n=$==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber($){let n=$;if(this.options.formatOnDisplay&&f.utils&&this.selectedCountryData){let s=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:u,INTERNATIONAL:l}=f.utils.numberFormat,p=s?u:l;n=f.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber($){let n=$.indexOf("+"),s=n?$.substring(n):$,u=this.selectedCountryData.dialCode;s&&u==="1"&&s.charAt(0)!=="+"&&(s.charAt(0)!=="1"&&(s=`1${s}`),s=`+${s}`),this.options.separateDialCode&&u&&s.charAt(0)!=="+"&&(s=`+${u}${s}`);let p=this._getDialCode(s,!0),C=u1(s),y=null;if(p){let I=this.dialCodeToIso2Map[u1(p)],b=I.indexOf(this.selectedCountryData.iso2)!==-1&&C.length<=p.length-1;if(!(u==="1"&&i2(C))&&!b){for(let M=0;Mp){let A=u-C;n.scrollTop=b-A}}_updateDialCode($){let n=this.telInput.value,s=`+${$}`,u;if(n.charAt(0)==="+"){let l=this._getDialCode(n);l?u=n.replace(l,s):u=s,this.telInput.value=u}}_getDialCode($,n){let s="";if($.charAt(0)==="+"){let u="";for(let l=0;l<$.length;l++){let p=$.charAt(l);if(!isNaN(parseInt(p,10))){if(u+=p,n)this.dialCodeToIso2Map[u]&&(s=$.substr(0,l+1));else if(this.dialCodes[u]){s=$.substr(0,l+1);break}if(u.length===this.dialCodeMaxLen)break}}}return s}_getFullNumber(){let $=this.telInput.value.trim(),{dialCode:n}=this.selectedCountryData,s,u=u1($);return this.options.separateDialCode&&$.charAt(0)!=="+"&&n&&u?s=`+${n}`:s="",s+$}_beforeSetNumber($){let n=$;if(this.options.separateDialCode){let s=this._getDialCode(n);if(s){s=`+${this.selectedCountryData.dialCode}`;let u=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substr(u)}}return this._cap(n)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let $=this._getFullNumber(),n=f.utils?f.utils.formatNumberAsYouType($,this.selectedCountryData.iso2):$,{dialCode:s}=this.selectedCountryData;return this.options.separateDialCode&&this.telInput.value.charAt(0)!=="+"&&n.includes(`+${s}`)?(n.split(`+${s}`)[1]||"").trim():n}handleAutoCountry(){this.options.initialCountry==="auto"&&f.autoCountry&&(this.defaultCountry=f.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){f.utils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let s=this.telInput.closest("label");s&&s.removeEventListener("click",this._handleLabelClick)}let{form:$}=this.telInput;this._handleHiddenInputSubmit&&$&&$.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let n=this.telInput.parentNode;n?.parentNode?.insertBefore(this.telInput,n),n?.parentNode?.removeChild(n),delete f.instances[this.id]}getExtension(){return f.utils?f.utils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber($){if(f.utils){let{iso2:n}=this.selectedCountryData;return f.utils.formatNumber(this._getFullNumber(),n,$)}return""}getNumberType(){return f.utils?f.utils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(f.utils){let{iso2:$}=this.selectedCountryData;return f.utils.getValidationError(this._getFullNumber(),$)}return-99}isValidNumber($=!0){let n=this._getFullNumber();return/\p{L}/u.test(n)?!1:f.utils?f.utils.isPossibleNumber(n,this.selectedCountryData.iso2,$):null}isValidNumberPrecise(){let $=this._getFullNumber();return/\p{L}/u.test($)?!1:f.utils?f.utils.isValidNumber($,this.selectedCountryData.iso2):null}setCountry($){let n=$.toLowerCase();this.selectedCountryData.iso2!==n&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber($){let n=this._updateCountryFromNumber($);this._updateValFromNumber($),n&&this._triggerCountryChange()}setPlaceholderNumberType($){this.options.placeholderNumberType=$,this._updatePlaceholder()}},H2=m=>!f.utils&&!f.startedLoadingUtilsScript?(f.startedLoadingUtilsScript=!0,new Promise(($,n)=>{import(m).then(({default:s})=>{f.utils=s,Q("handleUtils"),$(!0)}).catch(()=>{Q("rejectUtilsScriptPromise"),n()})})):null,f=Object.assign((m,$)=>{let n=new f1(m,$);return n._init(),m.setAttribute("data-intl-tel-input-id",n.id.toString()),f.instances[n.id]=n,n},{defaults:r2,documentReady:()=>document.readyState==="complete",getCountryData:()=>X,getInstance:m=>{let $=m.getAttribute("data-intl-tel-input-id");return $?f.instances[$]:null},instances:{},loadUtils:H2,version:"22.0.2"}),m1=f;(function(){var m=this||self;function $(d,t){d=d.split(".");var e=m;d[0]in e||typeof e.execScript>"u"||e.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?e[i]&&e[i]!==Object.prototype[i]?e=e[i]:e=e[i]={}:e[i]=t}function n(d,t){function e(){}e.prototype=t.prototype,d.ma=t.prototype,d.prototype=new e,d.prototype.constructor=d,d.sa=function(i,r,o){for(var a=Array(arguments.length-2),h=2;hd.length?!1:k(w2,d)}function M1(d){return k(_2,d)?$1(d,m2):$1(d,l1)}function N1(d){var t=M1(d.toString());x(d),d.g(t)}function D1(d){return d!=null&&(B(d,9)!=1||L(d,9)[0]!=-1)}function $1(d,t){for(var e=new S,i,r=d.length,o=0;ot?2:o[o.length-1]=r&&r<=i;++r)if(e=parseInt(d.substring(0,r),10),e in W)return t.g(d.substring(r)),e;return 0}function B1(d,t,e,i,r,o){if(t.length==0)return 0;t=new S(t);var a;e!=null&&(a=c(e,11)),a==null&&(a="NonMatch");var h=t.toString();if(h.length==0)a=20;else if(Z.test(h))h=h.replace(Z,""),x(t),t.g(M1(h)),a=1;else{if(h=new RegExp(a),N1(t),a=t.toString(),a.search(h)==0){h=a.match(h)[0].length;var g=a.substring(h).match(T1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=O1(t,i),d!=0)return w(o,1,d),d;throw Error("Invalid country calling code")}return e!=null&&(a=v(e,10),h=""+a,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new S(g.substring(h.length)),g=c(e,1),g=new RegExp(v(g,2)),G1(h,e,null),h=h.toString(),!k(g,t.toString())&&k(g,h)||r1(d,t.toString(),e,-1)==3))?(i.g(h),r&&w(o,6,10),w(o,1,a),a):(w(o,1,0),0)}function G1(d,t,e){var i=d.toString(),r=i.length,o=c(t,15);if(r!=0&&o!=null&&o.length!=0){var a=new RegExp("^(?:"+o+")");if(r=a.exec(i)){o=new RegExp(v(c(t,1),2));var h=k(o,i),g=r.length-1;t=c(t,16),t==null||t.length==0||r[g]==null||r[g].length==0?(!h||k(o,i.substring(r[0].length)))&&(e!=null&&0=t.length)o="";else{var a=t.indexOf(";",o);o=a!==-1?t.substring(o,a):t.substring(o)}var h=o;if(h==null?a=!0:h.length===0?a=!1:(a=b2.exec(h),h=S2.exec(h),a=a!==null||h!==null),!a||(o!=null?(o.charAt(0)==="+"&&r.g(o),o=t.indexOf("tel:"),r.g(t.substring(0<=o?o+4:0,t.indexOf(";phone-context=")))):(o=r.g,a=t??"",h=a.search(y2),0<=h?(a=a.substring(h),a=a.replace(I2,""),h=a.search(v2),0<=h&&(a=a.substring(0,h))):a="",o.call(r,a)),o=r.toString(),a=o.indexOf(";isub="),0t.h.length||(a!=null&&(e=new S,r=new S(t.toString()),G1(r,a,e),d=r1(d,r.toString(),a,-1),d!=2&&d!=4&&d!=5&&(t=r,i&&0d))throw Error("The string supplied is too short to be a phone number");if(17{try{let e=d.replace(/[^+0-9]/g,""),i=new L2(t);t="";for(let r=0;r{try{let r=T.g(),o=F(r,d,t);var i=s1(r,o,-1);return i==0||i==4?r.format(o,typeof e>"u"?0:e):d}catch{return d}}),$("intlTelInputUtilsTemp.getExampleNumber",(d,t,e,i)=>{try{let g=T.g();d:{var r=g;if(n1(d)){var o=i1(H(r,d),e);try{if(D(o,6)){var a=c(o,6),h=H1(r,a,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),$("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(F(T.g(),d,t),3)}catch{return""}}),$("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let a=T.g(),h=F(a,d,t);var e=R1(a,h),i=Y(a,v(h,1),e);if(i==null)var r=-1;else{var o=J(h);r=h1(o,i)}return r}catch{return-99}}),$("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let e=T.g(),i=F(e,d,t);return s1(e,i,-1)}catch(e){return e.message==="Invalid country calling code"?1:3>=d.length||e.message==="Phone number too short after IDD"||e.message==="The string supplied is too short to be a phone number"?2:e.message==="The string supplied is too long to be a phone number"?3:-99}}),$("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=T.g();var e=F(g,d,t),i=R1(g,e);d=g;var r=v(e,1),o=Y(d,r,i);if(o==null||i!="001"&&r!=k1(d,i))var a=!1;else{var h=J(e);a=h1(h,o)!=-1}return a}catch{return!1}}),$("intlTelInputUtilsTemp.isPossibleNumber",(d,t,e)=>{try{let i=T.g(),r=F(i,d,t);return e?s1(i,r,1)===0:s1(i,r,-1)===0}catch{return!1}}),$("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(F(T.g(),d,t),2).toString()}catch{return""}}),$("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),$("intlTelInputUtilsTemp.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1}),$("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var U2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var s2=U2;m1.utils=s2;var K2=m1;return k2(F2);})(); +var factoryOutput=(()=>{var g1=Object.defineProperty;var N2=Object.getOwnPropertyDescriptor;var D2=Object.getOwnPropertyNames;var x2=Object.prototype.hasOwnProperty;var P2=(m,$)=>{for(var n in $)g1(m,n,{get:$[n],enumerable:!0})},R2=(m,$,n,s)=>{if($&&typeof $=="object"||typeof $=="function")for(let u of D2($))!x2.call(m,u)&&u!==n&&g1(m,u,{get:()=>$[u],enumerable:!(s=N2($,u))||s.enumerable});return m};var k2=m=>R2(g1({},"__esModule",{value:!0}),m);var F2={};P2(F2,{default:()=>K2});var Q1=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],d2=[];for(let m=0;mm.replace(/\D/g,""),n2=(m="")=>m.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),i2=m=>{let $=u1(m);if($.charAt(0)==="1"){let n=$.substr(1,3);return B2.indexOf(n)!==-1}return!1},G2=(m,$,n,s)=>{if(n===0&&!s)return 0;let u=0;for(let l=0;l<$.length;l++){if(/[+0-9]/.test($[l])&&u++,u===m&&!s)return l+1;if(s&&u===m+1)return l}return $.length},E=(m,$,n)=>{let s=document.createElement(m);return $&&Object.entries($).forEach(([u,l])=>s.setAttribute(u,l)),n&&n.appendChild(s),s},Q=m=>{let{instances:$}=f;Object.values($).forEach(n=>n[m]())},f1=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor($,n={}){this.id=O2++,this.telInput=$,this.highlightedItem=null,this.options=Object.assign({},r2,n),this.hadInitialPlaceholder=!!$.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...$2,...this.options.i18n};let $=new Promise((s,u)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=u}),n=new Promise((s,u)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=u});this.promise=Promise.all([$,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map($=>$.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort(($,n)=>{let{countryOrder:s}=this.options;if(s){let u=s.indexOf($.iso2),l=s.indexOf(n.iso2),p=u>-1,C=l>-1;if(p||C)return p&&C?u-l:p?-1:1}return $.namen.name?1:0})}_addToDialCodeMap($,n,s){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let l=0;lu.toLowerCase());this.countries=X.filter(u=>s.indexOf(u.iso2)>-1)}else if(n.length){let s=n.map(u=>u.toLowerCase());this.countries=X.filter(u=>s.indexOf(u.iso2)===-1)}else this.countries=X}_translateCountryNames(){for(let $=0;$
`),p+=`${u.name}`,p+=`+${u.dialCode}`,l.insertAdjacentHTML("beforeend",p)}}_setInitialState($=!1){let n=this.telInput.getAttribute("value"),s=this.telInput.value,l=n&&n.charAt(0)==="+"&&(!s||s.charAt(0)!=="+")?n:s,p=this._getDialCode(l),C=i2(l),{initialCountry:y}=this.options;if(p&&!C)this._updateCountryFromNumber(l);else if(y!=="auto"||$){let I=y?y.toLowerCase():"";I&&this._getCountryData(I,!0)?this._setCountry(I):p&&C?this._setCountry("us"):this._setCountry()}l&&this._updateValFromNumber(l)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let $=this.telInput.closest("label");$&&$.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!f.utils?f.documentReady()?f.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{f.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){f.autoCountry?this.handleAutoCountry():f.startedLoadingAutoCountry||(f.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup(($="")=>{let n=$.toLowerCase();n&&this._getCountryData(n,!0)?(f.autoCountry=n,setTimeout(()=>Q("handleAutoCountry"))):(this._setInitialState(!0),Q("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),Q("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:$,formatAsYouType:n,separateDialCode:s}=this.options,u=!1;this._handleInputEvent=l=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let p=l&&l.data&&/[^+0-9]/.test(l.data),C=l&&l.inputType==="insertFromPaste"&&this.telInput.value;if(p||C&&!$?u=!0:/[^+0-9]/.test(this.telInput.value)||(u=!1),n&&!u){let y=this.telInput.selectionStart||0,b=this.telInput.value.substring(0,y).replace(/[^+0-9]/g,"").length,A=l&&l.inputType==="deleteContentForward",M=this._formatNumberAsYouType(),R=G2(b,M,y,A);this.telInput.value=M,this.telInput.setSelectionRange(R,R)}},this.telInput.addEventListener("input",this._handleInputEvent),($||s)&&(this._handleKeydownEvent=l=>{if(l.key&&l.key.length===1&&!l.altKey&&!l.ctrlKey&&!l.metaKey){if(s&&l.key==="+"){l.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if($){let p=this.telInput.selectionStart===0&&l.key==="+",C=/^[0-9]$/.test(l.key),y=p||C,I=this._getFullNumber(),b=f.utils.getCoreNumber(I,this.selectedCountryData.iso2),A=this.maxCoreNumberLength&&b.length>=this.maxCoreNumberLength;(!y||A)&&l.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap($){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&$.length>n?$.substr(0,n):$}_trigger($){let n=new Event($,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(n)}_openDropdown(){let{fixDropdownWidth:$}=this.options;$&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let $=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${$.top+n}px`,this.dropdown.style.left=`${$.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._highlightListItem(l,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=u=>{let l=u.target?.closest(".iti__country");l&&this._selectListItem(l)},this.countryList.addEventListener("click",this._handleClickCountryList);let $=!0;this._handleClickOffToClose=()=>{$||this._closeDropdown(),$=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=u=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),u.key==="ArrowUp"||u.key==="ArrowDown"?this._handleUpDownKey(u.key):u.key==="Enter"?this._handleEnterKey():u.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let n=()=>{let u=this.searchInput.value.trim();u?this._filterCountries(u):this._filterCountries("",!0)},s=null;this._handleSearchChange=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",u=>u.stopPropagation())}_filterCountries($,n=!1){let s=!0;this.countryList.innerHTML="";let u=n2($);for(let l=0;l1&&(n=$==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber($){let n=$;if(this.options.formatOnDisplay&&f.utils&&this.selectedCountryData){let s=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:u,INTERNATIONAL:l}=f.utils.numberFormat,p=s?u:l;n=f.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber($){let n=$.indexOf("+"),s=n?$.substring(n):$,u=this.selectedCountryData.dialCode;s&&u==="1"&&s.charAt(0)!=="+"&&(s.charAt(0)!=="1"&&(s=`1${s}`),s=`+${s}`),this.options.separateDialCode&&u&&s.charAt(0)!=="+"&&(s=`+${u}${s}`);let p=this._getDialCode(s,!0),C=u1(s),y=null;if(p){let I=this.dialCodeToIso2Map[u1(p)],b=I.indexOf(this.selectedCountryData.iso2)!==-1&&C.length<=p.length-1;if(!(u==="1"&&i2(C))&&!b){for(let M=0;Mp){let A=u-C;n.scrollTop=b-A}}_updateDialCode($){let n=this.telInput.value,s=`+${$}`,u;if(n.charAt(0)==="+"){let l=this._getDialCode(n);l?u=n.replace(l,s):u=s,this.telInput.value=u}}_getDialCode($,n){let s="";if($.charAt(0)==="+"){let u="";for(let l=0;l<$.length;l++){let p=$.charAt(l);if(!isNaN(parseInt(p,10))){if(u+=p,n)this.dialCodeToIso2Map[u]&&(s=$.substr(0,l+1));else if(this.dialCodes[u]){s=$.substr(0,l+1);break}if(u.length===this.dialCodeMaxLen)break}}}return s}_getFullNumber(){let $=this.telInput.value.trim(),{dialCode:n}=this.selectedCountryData,s,u=u1($);return this.options.separateDialCode&&$.charAt(0)!=="+"&&n&&u?s=`+${n}`:s="",s+$}_beforeSetNumber($){let n=$;if(this.options.separateDialCode){let s=this._getDialCode(n);if(s){s=`+${this.selectedCountryData.dialCode}`;let u=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substr(u)}}return this._cap(n)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let $=this._getFullNumber(),n=f.utils?f.utils.formatNumberAsYouType($,this.selectedCountryData.iso2):$,{dialCode:s}=this.selectedCountryData;return this.options.separateDialCode&&this.telInput.value.charAt(0)!=="+"&&n.includes(`+${s}`)?(n.split(`+${s}`)[1]||"").trim():n}handleAutoCountry(){this.options.initialCountry==="auto"&&f.autoCountry&&(this.defaultCountry=f.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){f.utils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let s=this.telInput.closest("label");s&&s.removeEventListener("click",this._handleLabelClick)}let{form:$}=this.telInput;this._handleHiddenInputSubmit&&$&&$.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let n=this.telInput.parentNode;n?.parentNode?.insertBefore(this.telInput,n),n?.parentNode?.removeChild(n),delete f.instances[this.id]}getExtension(){return f.utils?f.utils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber($){if(f.utils){let{iso2:n}=this.selectedCountryData;return f.utils.formatNumber(this._getFullNumber(),n,$)}return""}getNumberType(){return f.utils?f.utils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(f.utils){let{iso2:$}=this.selectedCountryData;return f.utils.getValidationError(this._getFullNumber(),$)}return-99}isValidNumber($=!0){let n=this._getFullNumber();return/\p{L}/u.test(n)?!1:f.utils?f.utils.isPossibleNumber(n,this.selectedCountryData.iso2,$):null}isValidNumberPrecise(){let $=this._getFullNumber();return/\p{L}/u.test($)?!1:f.utils?f.utils.isValidNumber($,this.selectedCountryData.iso2):null}setCountry($){let n=$.toLowerCase();this.selectedCountryData.iso2!==n&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber($){let n=this._updateCountryFromNumber($);this._updateValFromNumber($),n&&this._triggerCountryChange()}setPlaceholderNumberType($){this.options.placeholderNumberType=$,this._updatePlaceholder()}},H2=m=>!f.utils&&!f.startedLoadingUtilsScript?(f.startedLoadingUtilsScript=!0,new Promise(($,n)=>{import(m).then(({default:s})=>{f.utils=s,Q("handleUtils"),$(!0)}).catch(()=>{Q("rejectUtilsScriptPromise"),n()})})):null,f=Object.assign((m,$)=>{let n=new f1(m,$);return n._init(),m.setAttribute("data-intl-tel-input-id",n.id.toString()),f.instances[n.id]=n,n},{defaults:r2,documentReady:()=>document.readyState==="complete",getCountryData:()=>X,getInstance:m=>{let $=m.getAttribute("data-intl-tel-input-id");return $?f.instances[$]:null},instances:{},loadUtils:H2,version:"23.0.0"}),m1=f;(function(){var m=this||self;function $(d,t){d=d.split(".");var e=m;d[0]in e||typeof e.execScript>"u"||e.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?e[i]&&e[i]!==Object.prototype[i]?e=e[i]:e=e[i]={}:e[i]=t}function n(d,t){function e(){}e.prototype=t.prototype,d.ma=t.prototype,d.prototype=new e,d.prototype.constructor=d,d.sa=function(i,r,o){for(var a=Array(arguments.length-2),h=2;hd.length?!1:k(w2,d)}function M1(d){return k(_2,d)?$1(d,m2):$1(d,l1)}function N1(d){var t=M1(d.toString());x(d),d.g(t)}function D1(d){return d!=null&&(B(d,9)!=1||L(d,9)[0]!=-1)}function $1(d,t){for(var e=new S,i,r=d.length,o=0;ot?2:o[o.length-1]=r&&r<=i;++r)if(e=parseInt(d.substring(0,r),10),e in W)return t.g(d.substring(r)),e;return 0}function B1(d,t,e,i,r,o){if(t.length==0)return 0;t=new S(t);var a;e!=null&&(a=c(e,11)),a==null&&(a="NonMatch");var h=t.toString();if(h.length==0)a=20;else if(Z.test(h))h=h.replace(Z,""),x(t),t.g(M1(h)),a=1;else{if(h=new RegExp(a),N1(t),a=t.toString(),a.search(h)==0){h=a.match(h)[0].length;var g=a.substring(h).match(T1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=O1(t,i),d!=0)return w(o,1,d),d;throw Error("Invalid country calling code")}return e!=null&&(a=v(e,10),h=""+a,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new S(g.substring(h.length)),g=c(e,1),g=new RegExp(v(g,2)),G1(h,e,null),h=h.toString(),!k(g,t.toString())&&k(g,h)||r1(d,t.toString(),e,-1)==3))?(i.g(h),r&&w(o,6,10),w(o,1,a),a):(w(o,1,0),0)}function G1(d,t,e){var i=d.toString(),r=i.length,o=c(t,15);if(r!=0&&o!=null&&o.length!=0){var a=new RegExp("^(?:"+o+")");if(r=a.exec(i)){o=new RegExp(v(c(t,1),2));var h=k(o,i),g=r.length-1;t=c(t,16),t==null||t.length==0||r[g]==null||r[g].length==0?(!h||k(o,i.substring(r[0].length)))&&(e!=null&&0=t.length)o="";else{var a=t.indexOf(";",o);o=a!==-1?t.substring(o,a):t.substring(o)}var h=o;if(h==null?a=!0:h.length===0?a=!1:(a=b2.exec(h),h=S2.exec(h),a=a!==null||h!==null),!a||(o!=null?(o.charAt(0)==="+"&&r.g(o),o=t.indexOf("tel:"),r.g(t.substring(0<=o?o+4:0,t.indexOf(";phone-context=")))):(o=r.g,a=t??"",h=a.search(y2),0<=h?(a=a.substring(h),a=a.replace(I2,""),h=a.search(v2),0<=h&&(a=a.substring(0,h))):a="",o.call(r,a)),o=r.toString(),a=o.indexOf(";isub="),0t.h.length||(a!=null&&(e=new S,r=new S(t.toString()),G1(r,a,e),d=r1(d,r.toString(),a,-1),d!=2&&d!=4&&d!=5&&(t=r,i&&0d))throw Error("The string supplied is too short to be a phone number");if(17{try{let e=d.replace(/[^+0-9]/g,""),i=new L2(t);t="";for(let r=0;r{try{let r=T.g(),o=F(r,d,t);var i=s1(r,o,-1);return i==0||i==4?r.format(o,typeof e>"u"?0:e):d}catch{return d}}),$("intlTelInputUtilsTemp.getExampleNumber",(d,t,e,i)=>{try{let g=T.g();d:{var r=g;if(n1(d)){var o=i1(H(r,d),e);try{if(D(o,6)){var a=c(o,6),h=H1(r,a,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),$("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(F(T.g(),d,t),3)}catch{return""}}),$("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let a=T.g(),h=F(a,d,t);var e=R1(a,h),i=Y(a,v(h,1),e);if(i==null)var r=-1;else{var o=J(h);r=h1(o,i)}return r}catch{return-99}}),$("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let e=T.g(),i=F(e,d,t);return s1(e,i,-1)}catch(e){return e.message==="Invalid country calling code"?1:3>=d.length||e.message==="Phone number too short after IDD"||e.message==="The string supplied is too short to be a phone number"?2:e.message==="The string supplied is too long to be a phone number"?3:-99}}),$("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=T.g();var e=F(g,d,t),i=R1(g,e);d=g;var r=v(e,1),o=Y(d,r,i);if(o==null||i!="001"&&r!=k1(d,i))var a=!1;else{var h=J(e);a=h1(h,o)!=-1}return a}catch{return!1}}),$("intlTelInputUtilsTemp.isPossibleNumber",(d,t,e)=>{try{let i=T.g(),r=F(i,d,t);return e?s1(i,r,1)===0:s1(i,r,-1)===0}catch{return!1}}),$("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(F(T.g(),d,t),2).toString()}catch{return""}}),$("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),$("intlTelInputUtilsTemp.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1}),$("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var U2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var s2=U2;m1.utils=s2;var K2=m1;return k2(F2);})(); // UMD return factoryOutput.default; diff --git a/composer.json b/composer.json index 2ba587dd4..fa0adbd6d 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "jackocnr/intl-tel-input", - "version": "22.0.2", + "version": "23.0.0", "description": "A JavaScript plugin for entering and validating international telephone numbers", "keywords": [ "international", diff --git a/package-lock.json b/package-lock.json index 3f57e861b..ee7017bc3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "intl-tel-input", - "version": "22.0.2", + "version": "23.0.0", "lockfileVersion": 2, "requires": true, "packages": { diff --git a/package.json b/package.json index a624aff0a..377ffab25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "intl-tel-input", - "version": "22.0.2", + "version": "23.0.0", "description": "A JavaScript plugin for entering and validating international telephone numbers", "keywords": [ "international", diff --git a/react/build/IntlTelInput.cjs b/react/build/IntlTelInput.cjs index 4d84f77af..479bb1ff4 100644 --- a/react/build/IntlTelInput.cjs +++ b/react/build/IntlTelInput.cjs @@ -1 +1 @@ -var x=Object.create;var v=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var z=(a,t)=>{for(var e in t)v(a,e,{get:t[e],enumerable:!0})},w=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of H(t))!R.call(a,n)&&n!==e&&v(a,n,{get:()=>t[n],enumerable:!(i=P(t,n))||i.enumerable});return a};var j=(a,t,e)=>(e=a!=null?x(O(a)):{},w(t||!a||!a.__esModule?v(e,"default",{value:a,enumerable:!0}):e,a)),F=a=>w(v({},"__esModule",{value:!0}),a);var G={};z(G,{default:()=>q});module.exports=F(G);var L=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],E=[];for(let a=0;aa.replace(/\D/g,""),N=(a="")=>a.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),A=a=>{let t=_(a);if(t.charAt(0)==="1"){let e=t.substr(1,3);return K.indexOf(e)!==-1}return!1},U=(a,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(a);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=a=>{let{instances:t}=o;Object.values(t).forEach(e=>e[a]())},I=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(t,e={}){this.id=B++,this.telInput=t,this.highlightedItem=null,this.options=Object.assign({},S,e),this.hadInitialPlaceholder=!!t.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...k,...this.options.i18n};let t=new Promise((i,n)=>{this.resolveAutoCountryPromise=i,this.rejectAutoCountryPromise=n}),e=new Promise((i,n)=>{this.resolveUtilsScriptPromise=i,this.rejectUtilsScriptPromise=n});this.promise=Promise.all([t,e]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(t=>t.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort((t,e)=>{let{countryOrder:i}=this.options;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),r=n>-1,l=s>-1;if(r||l)return r&&l?n-s:r?-1:1}return t.namee.name?1:0})}_addToDialCodeMap(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.dialCodeToIso2Map.hasOwnProperty(e)||(this.dialCodeToIso2Map[e]=[]);for(let s=0;sn.toLowerCase());this.countries=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.countries=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.countries=f}_translateCountryNames(){for(let t=0;t
`),r+=`${n.name}`,r+=`+${n.dialCode}`,s.insertAdjacentHTML("beforeend",r)}}_setInitialState(t=!1){let e=this.telInput.getAttribute("value"),i=this.telInput.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,r=this._getDialCode(s),l=A(s),{initialCountry:d}=this.options;if(r&&!l)this._updateCountryFromNumber(s);else if(d!=="auto"||t){let u=d?d.toLowerCase():"";u&&this._getCountryData(u,!0)?this._setCountry(u):r&&l?this._setCountry("us"):this._setCountry()}s&&this._updateValFromNumber(s)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=e=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():e.preventDefault()};let t=this.telInput.closest("label");t&&t.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._openDropdown()),e.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!o.utils?o.documentReady()?o.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{o.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){o.autoCountry?this.handleAutoCountry():o.startedLoadingAutoCountry||(o.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._getCountryData(e,!0)?(o.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._setInitialState(!0),b("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),b("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:t,formatAsYouType:e,separateDialCode:i}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let r=s&&s.data&&/[^+0-9]/.test(s.data),l=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(r||l&&!t?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),e&&!n){let d=this.telInput.selectionStart||0,h=this.telInput.value.substring(0,d).replace(/[^+0-9]/g,"").length,c=s&&s.inputType==="deleteContentForward",g=this._formatNumberAsYouType(),m=U(h,g,d,c);this.telInput.value=g,this.telInput.setSelectionRange(m,m)}},this.telInput.addEventListener("input",this._handleInputEvent),(t||i)&&(this._handleKeydownEvent=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(i&&s.key==="+"){s.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if(t){let r=this.telInput.selectionStart===0&&s.key==="+",l=/^[0-9]$/.test(s.key),d=r||l,u=this._getFullNumber(),h=o.utils.getCoreNumber(u,this.selectedCountryData.iso2),c=this.maxCoreNumberLength&&h.length>=this.maxCoreNumberLength;(!d||c)&&s.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(t){let e=parseInt(this.telInput.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t){let e=new Event(t,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(e)}_openDropdown(){let{fixDropdownWidth:t}=this.options;t&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let e=this.countryList.firstElementChild;e&&(this._highlightListItem(e,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let t=this.telInput.getBoundingClientRect(),e=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._highlightListItem(s,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._selectListItem(s)},this.countryList.addEventListener("click",this._handleClickCountryList);let t=!0;this._handleClickOffToClose=()=>{t||this._closeDropdown(),t=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._handleUpDownKey(n.key):n.key==="Enter"?this._handleEnterKey():n.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let e=()=>{let n=this.searchInput.value.trim();n?this._filterCountries(n):this._filterCountries("",!0)},i=null;this._handleSearchChange=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_filterCountries(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=N(t);for(let s=0;s1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._scrollTo(e),this._highlightListItem(e,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(t){let e=t;if(this.options.formatOnDisplay&&o.utils&&this.selectedCountryData){let i=this.options.nationalMode||e.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=o.utils.numberFormat,r=i?n:s;e=o.utils.formatNumber(e,this.selectedCountryData.iso2,r)}e=this._beforeSetNumber(e),this.telInput.value=e}_updateCountryFromNumber(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.selectedCountryData.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.options.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let r=this._getDialCode(i,!0),l=_(i),d=null;if(r){let u=this.dialCodeToIso2Map[_(r)],h=u.indexOf(this.selectedCountryData.iso2)!==-1&&l.length<=r.length-1;if(!(n==="1"&&A(l))&&!h){for(let g=0;gr){let c=n-l;e.scrollTop=h-c}}_updateDialCode(t){let e=this.telInput.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._getDialCode(e);s?n=e.replace(s,i):n=i,this.telInput.value=n}}_getDialCode(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s!o.utils&&!o.startedLoadingUtilsScript?(o.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(a).then(({default:i})=>{o.utils=i,b("handleUtils"),t(!0)}).catch(()=>{b("rejectUtilsScriptPromise"),e()})})):null,o=Object.assign((a,t)=>{let e=new I(a,t);return e._init(),a.setAttribute("data-intl-tel-input-id",e.id.toString()),o.instances[e.id]=e,e},{defaults:S,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:a=>{let t=a.getAttribute("data-intl-tel-input-id");return t?o.instances[t]:null},instances:{},loadUtils:V,version:"22.0.2"}),M=o;var C=j(require("react")),$=({initialValue:a="",onChangeNumber:t=()=>{},onChangeCountry:e=()=>{},onChangeValidity:i=()=>{},onChangeErrorCode:n=()=>{},usePreciseValidation:s=!1,initOptions:r={},inputProps:l={}})=>{let d=(0,C.useRef)(null),u=(0,C.useRef)(null),h=()=>{let c=u.current?.getNumber()||"",g=u.current?.getSelectedCountryData().iso2||"";if(t(c),e(g),u.current)if(s?u.current.isValidNumberPrecise():u.current.isValidNumber())i(!0),n(null);else{let y=u.current.getValidationError();i(!1),n(y)}};return(0,C.useEffect)(()=>{let c=d.current;return c&&(u.current=M(c,r),c.addEventListener("countrychange",h),u.current.promise.then(h)),()=>{c&&c.removeEventListener("countrychange",h),u.current?.destroy()}},[]),C.default.createElement("input",{type:"tel",ref:d,onInput:h,defaultValue:a,...l})},q=$; +var x=Object.create;var v=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var O=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var z=(a,t)=>{for(var e in t)v(a,e,{get:t[e],enumerable:!0})},w=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of H(t))!R.call(a,n)&&n!==e&&v(a,n,{get:()=>t[n],enumerable:!(i=P(t,n))||i.enumerable});return a};var j=(a,t,e)=>(e=a!=null?x(O(a)):{},w(t||!a||!a.__esModule?v(e,"default",{value:a,enumerable:!0}):e,a)),F=a=>w(v({},"__esModule",{value:!0}),a);var G={};z(G,{default:()=>q});module.exports=F(G);var L=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],E=[];for(let a=0;aa.replace(/\D/g,""),N=(a="")=>a.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),A=a=>{let t=_(a);if(t.charAt(0)==="1"){let e=t.substr(1,3);return K.indexOf(e)!==-1}return!1},U=(a,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(a);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},b=a=>{let{instances:t}=o;Object.values(t).forEach(e=>e[a]())},I=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(t,e={}){this.id=B++,this.telInput=t,this.highlightedItem=null,this.options=Object.assign({},S,e),this.hadInitialPlaceholder=!!t.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...k,...this.options.i18n};let t=new Promise((i,n)=>{this.resolveAutoCountryPromise=i,this.rejectAutoCountryPromise=n}),e=new Promise((i,n)=>{this.resolveUtilsScriptPromise=i,this.rejectUtilsScriptPromise=n});this.promise=Promise.all([t,e]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(t=>t.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort((t,e)=>{let{countryOrder:i}=this.options;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),r=n>-1,l=s>-1;if(r||l)return r&&l?n-s:r?-1:1}return t.namee.name?1:0})}_addToDialCodeMap(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.dialCodeToIso2Map.hasOwnProperty(e)||(this.dialCodeToIso2Map[e]=[]);for(let s=0;sn.toLowerCase());this.countries=f.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.countries=f.filter(n=>i.indexOf(n.iso2)===-1)}else this.countries=f}_translateCountryNames(){for(let t=0;t
`),r+=`${n.name}`,r+=`+${n.dialCode}`,s.insertAdjacentHTML("beforeend",r)}}_setInitialState(t=!1){let e=this.telInput.getAttribute("value"),i=this.telInput.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,r=this._getDialCode(s),l=A(s),{initialCountry:d}=this.options;if(r&&!l)this._updateCountryFromNumber(s);else if(d!=="auto"||t){let u=d?d.toLowerCase():"";u&&this._getCountryData(u,!0)?this._setCountry(u):r&&l?this._setCountry("us"):this._setCountry()}s&&this._updateValFromNumber(s)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=e=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():e.preventDefault()};let t=this.telInput.closest("label");t&&t.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._openDropdown()),e.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!o.utils?o.documentReady()?o.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{o.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){o.autoCountry?this.handleAutoCountry():o.startedLoadingAutoCountry||(o.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._getCountryData(e,!0)?(o.autoCountry=e,setTimeout(()=>b("handleAutoCountry"))):(this._setInitialState(!0),b("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),b("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:t,formatAsYouType:e,separateDialCode:i}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let r=s&&s.data&&/[^+0-9]/.test(s.data),l=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(r||l&&!t?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),e&&!n){let d=this.telInput.selectionStart||0,h=this.telInput.value.substring(0,d).replace(/[^+0-9]/g,"").length,c=s&&s.inputType==="deleteContentForward",g=this._formatNumberAsYouType(),m=U(h,g,d,c);this.telInput.value=g,this.telInput.setSelectionRange(m,m)}},this.telInput.addEventListener("input",this._handleInputEvent),(t||i)&&(this._handleKeydownEvent=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(i&&s.key==="+"){s.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if(t){let r=this.telInput.selectionStart===0&&s.key==="+",l=/^[0-9]$/.test(s.key),d=r||l,u=this._getFullNumber(),h=o.utils.getCoreNumber(u,this.selectedCountryData.iso2),c=this.maxCoreNumberLength&&h.length>=this.maxCoreNumberLength;(!d||c)&&s.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(t){let e=parseInt(this.telInput.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t){let e=new Event(t,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(e)}_openDropdown(){let{fixDropdownWidth:t}=this.options;t&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let e=this.countryList.firstElementChild;e&&(this._highlightListItem(e,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let t=this.telInput.getBoundingClientRect(),e=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._highlightListItem(s,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._selectListItem(s)},this.countryList.addEventListener("click",this._handleClickCountryList);let t=!0;this._handleClickOffToClose=()=>{t||this._closeDropdown(),t=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._handleUpDownKey(n.key):n.key==="Enter"?this._handleEnterKey():n.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let e=()=>{let n=this.searchInput.value.trim();n?this._filterCountries(n):this._filterCountries("",!0)},i=null;this._handleSearchChange=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_filterCountries(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=N(t);for(let s=0;s1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._scrollTo(e),this._highlightListItem(e,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(t){let e=t;if(this.options.formatOnDisplay&&o.utils&&this.selectedCountryData){let i=this.options.nationalMode||e.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=o.utils.numberFormat,r=i?n:s;e=o.utils.formatNumber(e,this.selectedCountryData.iso2,r)}e=this._beforeSetNumber(e),this.telInput.value=e}_updateCountryFromNumber(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.selectedCountryData.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.options.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let r=this._getDialCode(i,!0),l=_(i),d=null;if(r){let u=this.dialCodeToIso2Map[_(r)],h=u.indexOf(this.selectedCountryData.iso2)!==-1&&l.length<=r.length-1;if(!(n==="1"&&A(l))&&!h){for(let g=0;gr){let c=n-l;e.scrollTop=h-c}}_updateDialCode(t){let e=this.telInput.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._getDialCode(e);s?n=e.replace(s,i):n=i,this.telInput.value=n}}_getDialCode(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s!o.utils&&!o.startedLoadingUtilsScript?(o.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(a).then(({default:i})=>{o.utils=i,b("handleUtils"),t(!0)}).catch(()=>{b("rejectUtilsScriptPromise"),e()})})):null,o=Object.assign((a,t)=>{let e=new I(a,t);return e._init(),a.setAttribute("data-intl-tel-input-id",e.id.toString()),o.instances[e.id]=e,e},{defaults:S,documentReady:()=>document.readyState==="complete",getCountryData:()=>f,getInstance:a=>{let t=a.getAttribute("data-intl-tel-input-id");return t?o.instances[t]:null},instances:{},loadUtils:V,version:"23.0.0"}),M=o;var C=j(require("react")),$=({initialValue:a="",onChangeNumber:t=()=>{},onChangeCountry:e=()=>{},onChangeValidity:i=()=>{},onChangeErrorCode:n=()=>{},usePreciseValidation:s=!1,initOptions:r={},inputProps:l={}})=>{let d=(0,C.useRef)(null),u=(0,C.useRef)(null),h=()=>{let c=u.current?.getNumber()||"",g=u.current?.getSelectedCountryData().iso2||"";if(t(c),e(g),u.current)if(s?u.current.isValidNumberPrecise():u.current.isValidNumber())i(!0),n(null);else{let y=u.current.getValidationError();i(!1),n(y)}};return(0,C.useEffect)(()=>{let c=d.current;return c&&(u.current=M(c,r),c.addEventListener("countrychange",h),u.current.promise.then(h)),()=>{c&&c.removeEventListener("countrychange",h),u.current?.destroy()}},[]),C.default.createElement("input",{type:"tel",ref:d,onInput:h,defaultValue:a,...l})},q=$; diff --git a/react/build/IntlTelInput.js b/react/build/IntlTelInput.js index fdb374b1a..8cecda6f1 100644 --- a/react/build/IntlTelInput.js +++ b/react/build/IntlTelInput.js @@ -1 +1 @@ -var _=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],I=[];for(let d=0;d<_.length;d++){let e=_[d];I[d]={name:"",iso2:e[0],dialCode:e[1],priority:e[2]||0,areaCodes:e[3]||null,nodeById:{}}}var y=I;var w={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var L={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"};var E={...w,...L};var S=0,k={allowDropdown:!0,autoPlaceholder:"polite",containerClass:"",countryOrder:null,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},M=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],b=d=>d.replace(/\D/g,""),T=(d="")=>d.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),D=d=>{let e=b(d);if(e.charAt(0)==="1"){let t=e.substr(1,3);return M.indexOf(t)!==-1}return!1},x=(d,e,t,i)=>{if(t===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(d);return e&&Object.entries(e).forEach(([n,s])=>i.setAttribute(n,s)),t&&t.appendChild(i),i},f=d=>{let{instances:e}=o;Object.values(e).forEach(t=>t[d]())},v=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(e,t={}){this.id=S++,this.telInput=e,this.highlightedItem=null,this.options=Object.assign({},k,t),this.hadInitialPlaceholder=!!e.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...E,...this.options.i18n};let e=new Promise((i,n)=>{this.resolveAutoCountryPromise=i,this.rejectAutoCountryPromise=n}),t=new Promise((i,n)=>{this.resolveUtilsScriptPromise=i,this.rejectUtilsScriptPromise=n});this.promise=Promise.all([e,t]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(e=>e.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort((e,t)=>{let{countryOrder:i}=this.options;if(i){let n=i.indexOf(e.iso2),s=i.indexOf(t.iso2),r=n>-1,a=s>-1;if(r||a)return r&&a?n-s:r?-1:1}return e.namet.name?1:0})}_addToDialCodeMap(e,t,i){t.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=t.length),this.dialCodeToIso2Map.hasOwnProperty(t)||(this.dialCodeToIso2Map[t]=[]);for(let s=0;sn.toLowerCase());this.countries=y.filter(n=>i.indexOf(n.iso2)>-1)}else if(t.length){let i=t.map(n=>n.toLowerCase());this.countries=y.filter(n=>i.indexOf(n.iso2)===-1)}else this.countries=y}_translateCountryNames(){for(let e=0;e
`),r+=`${n.name}`,r+=`+${n.dialCode}`,s.insertAdjacentHTML("beforeend",r)}}_setInitialState(e=!1){let t=this.telInput.getAttribute("value"),i=this.telInput.value,s=t&&t.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?t:i,r=this._getDialCode(s),a=D(s),{initialCountry:u}=this.options;if(r&&!a)this._updateCountryFromNumber(s);else if(u!=="auto"||e){let l=u?u.toLowerCase():"";l&&this._getCountryData(l,!0)?this._setCountry(l):r&&a?this._setCountry("us"):this._setCountry()}s&&this._updateValFromNumber(s)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=t=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():t.preventDefault()};let e=this.telInput.closest("label");e&&e.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=t=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this._openDropdown()),t.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!o.utils?o.documentReady()?o.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{o.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){o.autoCountry?this.handleAutoCountry():o.startedLoadingAutoCountry||(o.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((e="")=>{let t=e.toLowerCase();t&&this._getCountryData(t,!0)?(o.autoCountry=t,setTimeout(()=>f("handleAutoCountry"))):(this._setInitialState(!0),f("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),f("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:e,formatAsYouType:t,separateDialCode:i}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let r=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(r||a&&!e?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),t&&!n){let u=this.telInput.selectionStart||0,h=this.telInput.value.substring(0,u).replace(/[^+0-9]/g,"").length,c=s&&s.inputType==="deleteContentForward",g=this._formatNumberAsYouType(),m=x(h,g,u,c);this.telInput.value=g,this.telInput.setSelectionRange(m,m)}},this.telInput.addEventListener("input",this._handleInputEvent),(e||i)&&(this._handleKeydownEvent=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(i&&s.key==="+"){s.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if(e){let r=this.telInput.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=r||a,l=this._getFullNumber(),h=o.utils.getCoreNumber(l,this.selectedCountryData.iso2),c=this.maxCoreNumberLength&&h.length>=this.maxCoreNumberLength;(!u||c)&&s.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(e){let t=parseInt(this.telInput.getAttribute("maxlength")||"",10);return t&&e.length>t?e.substr(0,t):e}_trigger(e){let t=new Event(e,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(t)}_openDropdown(){let{fixDropdownWidth:e}=this.options;e&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let t=this.countryList.firstElementChild;t&&(this._highlightListItem(t,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let e=this.telInput.getBoundingClientRect(),t=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${e.top+t}px`,this.dropdown.style.left=`${e.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._highlightListItem(s,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._selectListItem(s)},this.countryList.addEventListener("click",this._handleClickCountryList);let e=!0;this._handleClickOffToClose=()=>{e||this._closeDropdown(),e=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._handleUpDownKey(n.key):n.key==="Enter"?this._handleEnterKey():n.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let t=()=>{let n=this.searchInput.value.trim();n?this._filterCountries(n):this._filterCountries("",!0)},i=null;this._handleSearchChange=()=>{i&&clearTimeout(i),i=setTimeout(()=>{t(),i=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_filterCountries(e,t=!1){let i=!0;this.countryList.innerHTML="";let n=T(e);for(let s=0;s1&&(t=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),t&&(this._scrollTo(t),this._highlightListItem(t,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(e){let t=e;if(this.options.formatOnDisplay&&o.utils&&this.selectedCountryData){let i=this.options.nationalMode||t.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=o.utils.numberFormat,r=i?n:s;t=o.utils.formatNumber(t,this.selectedCountryData.iso2,r)}t=this._beforeSetNumber(t),this.telInput.value=t}_updateCountryFromNumber(e){let t=e.indexOf("+"),i=t?e.substring(t):e,n=this.selectedCountryData.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.options.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let r=this._getDialCode(i,!0),a=b(i),u=null;if(r){let l=this.dialCodeToIso2Map[b(r)],h=l.indexOf(this.selectedCountryData.iso2)!==-1&&a.length<=r.length-1;if(!(n==="1"&&D(a))&&!h){for(let g=0;gr){let c=n-a;t.scrollTop=h-c}}_updateDialCode(e){let t=this.telInput.value,i=`+${e}`,n;if(t.charAt(0)==="+"){let s=this._getDialCode(t);s?n=t.replace(s,i):n=i,this.telInput.value=n}}_getDialCode(e,t){let i="";if(e.charAt(0)==="+"){let n="";for(let s=0;s!o.utils&&!o.startedLoadingUtilsScript?(o.startedLoadingUtilsScript=!0,new Promise((e,t)=>{import(d).then(({default:i})=>{o.utils=i,f("handleUtils"),e(!0)}).catch(()=>{f("rejectUtilsScriptPromise"),t()})})):null,o=Object.assign((d,e)=>{let t=new v(d,e);return t._init(),d.setAttribute("data-intl-tel-input-id",t.id.toString()),o.instances[t.id]=t,t},{defaults:k,documentReady:()=>document.readyState==="complete",getCountryData:()=>y,getInstance:d=>{let e=d.getAttribute("data-intl-tel-input-id");return e?o.instances[e]:null},instances:{},loadUtils:P,version:"22.0.2"}),N=o;import H,{useRef as A,useEffect as O}from"react";var R=({initialValue:d="",onChangeNumber:e=()=>{},onChangeCountry:t=()=>{},onChangeValidity:i=()=>{},onChangeErrorCode:n=()=>{},usePreciseValidation:s=!1,initOptions:r={},inputProps:a={}})=>{let u=A(null),l=A(null),h=()=>{let c=l.current?.getNumber()||"",g=l.current?.getSelectedCountryData().iso2||"";if(e(c),t(g),l.current)if(s?l.current.isValidNumberPrecise():l.current.isValidNumber())i(!0),n(null);else{let C=l.current.getValidationError();i(!1),n(C)}};return O(()=>{let c=u.current;return c&&(l.current=N(c,r),c.addEventListener("countrychange",h),l.current.promise.then(h)),()=>{c&&c.removeEventListener("countrychange",h),l.current?.destroy()}},[]),H.createElement("input",{type:"tel",ref:u,onInput:h,defaultValue:d,...a})},J=R;export{J as default}; +var _=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],I=[];for(let d=0;d<_.length;d++){let e=_[d];I[d]={name:"",iso2:e[0],dialCode:e[1],priority:e[2]||0,areaCodes:e[3]||null,nodeById:{}}}var y=I;var w={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var L={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"};var E={...w,...L};var S=0,k={allowDropdown:!0,autoPlaceholder:"polite",containerClass:"",countryOrder:null,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:""},M=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],b=d=>d.replace(/\D/g,""),T=(d="")=>d.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),D=d=>{let e=b(d);if(e.charAt(0)==="1"){let t=e.substr(1,3);return M.indexOf(t)!==-1}return!1},x=(d,e,t,i)=>{if(t===0&&!i)return 0;let n=0;for(let s=0;s{let i=document.createElement(d);return e&&Object.entries(e).forEach(([n,s])=>i.setAttribute(n,s)),t&&t.appendChild(i),i},f=d=>{let{instances:e}=o;Object.values(e).forEach(t=>t[d]())},v=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(e,t={}){this.id=S++,this.telInput=e,this.highlightedItem=null,this.options=Object.assign({},k,t),this.hadInitialPlaceholder=!!e.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...E,...this.options.i18n};let e=new Promise((i,n)=>{this.resolveAutoCountryPromise=i,this.rejectAutoCountryPromise=n}),t=new Promise((i,n)=>{this.resolveUtilsScriptPromise=i,this.rejectUtilsScriptPromise=n});this.promise=Promise.all([e,t]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map(e=>e.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort((e,t)=>{let{countryOrder:i}=this.options;if(i){let n=i.indexOf(e.iso2),s=i.indexOf(t.iso2),r=n>-1,a=s>-1;if(r||a)return r&&a?n-s:r?-1:1}return e.namet.name?1:0})}_addToDialCodeMap(e,t,i){t.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=t.length),this.dialCodeToIso2Map.hasOwnProperty(t)||(this.dialCodeToIso2Map[t]=[]);for(let s=0;sn.toLowerCase());this.countries=y.filter(n=>i.indexOf(n.iso2)>-1)}else if(t.length){let i=t.map(n=>n.toLowerCase());this.countries=y.filter(n=>i.indexOf(n.iso2)===-1)}else this.countries=y}_translateCountryNames(){for(let e=0;e
`),r+=`${n.name}`,r+=`+${n.dialCode}`,s.insertAdjacentHTML("beforeend",r)}}_setInitialState(e=!1){let t=this.telInput.getAttribute("value"),i=this.telInput.value,s=t&&t.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?t:i,r=this._getDialCode(s),a=D(s),{initialCountry:u}=this.options;if(r&&!a)this._updateCountryFromNumber(s);else if(u!=="auto"||e){let l=u?u.toLowerCase():"";l&&this._getCountryData(l,!0)?this._setCountry(l):r&&a?this._setCountry("us"):this._setCountry()}s&&this._updateValFromNumber(s)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=t=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():t.preventDefault()};let e=this.telInput.closest("label");e&&e.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=t=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(t.key)&&(t.preventDefault(),t.stopPropagation(),this._openDropdown()),t.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!o.utils?o.documentReady()?o.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{o.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){o.autoCountry?this.handleAutoCountry():o.startedLoadingAutoCountry||(o.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup((e="")=>{let t=e.toLowerCase();t&&this._getCountryData(t,!0)?(o.autoCountry=t,setTimeout(()=>f("handleAutoCountry"))):(this._setInitialState(!0),f("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),f("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:e,formatAsYouType:t,separateDialCode:i}=this.options,n=!1;this._handleInputEvent=s=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let r=s&&s.data&&/[^+0-9]/.test(s.data),a=s&&s.inputType==="insertFromPaste"&&this.telInput.value;if(r||a&&!e?n=!0:/[^+0-9]/.test(this.telInput.value)||(n=!1),t&&!n){let u=this.telInput.selectionStart||0,h=this.telInput.value.substring(0,u).replace(/[^+0-9]/g,"").length,c=s&&s.inputType==="deleteContentForward",g=this._formatNumberAsYouType(),m=x(h,g,u,c);this.telInput.value=g,this.telInput.setSelectionRange(m,m)}},this.telInput.addEventListener("input",this._handleInputEvent),(e||i)&&(this._handleKeydownEvent=s=>{if(s.key&&s.key.length===1&&!s.altKey&&!s.ctrlKey&&!s.metaKey){if(i&&s.key==="+"){s.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if(e){let r=this.telInput.selectionStart===0&&s.key==="+",a=/^[0-9]$/.test(s.key),u=r||a,l=this._getFullNumber(),h=o.utils.getCoreNumber(l,this.selectedCountryData.iso2),c=this.maxCoreNumberLength&&h.length>=this.maxCoreNumberLength;(!u||c)&&s.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap(e){let t=parseInt(this.telInput.getAttribute("maxlength")||"",10);return t&&e.length>t?e.substr(0,t):e}_trigger(e){let t=new Event(e,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(t)}_openDropdown(){let{fixDropdownWidth:e}=this.options;e&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let t=this.countryList.firstElementChild;t&&(this._highlightListItem(t,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let e=this.telInput.getBoundingClientRect(),t=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${e.top+t}px`,this.dropdown.style.left=`${e.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._highlightListItem(s,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=n=>{let s=n.target?.closest(".iti__country");s&&this._selectListItem(s)},this.countryList.addEventListener("click",this._handleClickCountryList);let e=!0;this._handleClickOffToClose=()=>{e||this._closeDropdown(),e=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._handleUpDownKey(n.key):n.key==="Enter"?this._handleEnterKey():n.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let t=()=>{let n=this.searchInput.value.trim();n?this._filterCountries(n):this._filterCountries("",!0)},i=null;this._handleSearchChange=()=>{i&&clearTimeout(i),i=setTimeout(()=>{t(),i=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_filterCountries(e,t=!1){let i=!0;this.countryList.innerHTML="";let n=T(e);for(let s=0;s1&&(t=e==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),t&&(this._scrollTo(t),this._highlightListItem(t,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber(e){let t=e;if(this.options.formatOnDisplay&&o.utils&&this.selectedCountryData){let i=this.options.nationalMode||t.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=o.utils.numberFormat,r=i?n:s;t=o.utils.formatNumber(t,this.selectedCountryData.iso2,r)}t=this._beforeSetNumber(t),this.telInput.value=t}_updateCountryFromNumber(e){let t=e.indexOf("+"),i=t?e.substring(t):e,n=this.selectedCountryData.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.options.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let r=this._getDialCode(i,!0),a=b(i),u=null;if(r){let l=this.dialCodeToIso2Map[b(r)],h=l.indexOf(this.selectedCountryData.iso2)!==-1&&a.length<=r.length-1;if(!(n==="1"&&D(a))&&!h){for(let g=0;gr){let c=n-a;t.scrollTop=h-c}}_updateDialCode(e){let t=this.telInput.value,i=`+${e}`,n;if(t.charAt(0)==="+"){let s=this._getDialCode(t);s?n=t.replace(s,i):n=i,this.telInput.value=n}}_getDialCode(e,t){let i="";if(e.charAt(0)==="+"){let n="";for(let s=0;s!o.utils&&!o.startedLoadingUtilsScript?(o.startedLoadingUtilsScript=!0,new Promise((e,t)=>{import(d).then(({default:i})=>{o.utils=i,f("handleUtils"),e(!0)}).catch(()=>{f("rejectUtilsScriptPromise"),t()})})):null,o=Object.assign((d,e)=>{let t=new v(d,e);return t._init(),d.setAttribute("data-intl-tel-input-id",t.id.toString()),o.instances[t.id]=t,t},{defaults:k,documentReady:()=>document.readyState==="complete",getCountryData:()=>y,getInstance:d=>{let e=d.getAttribute("data-intl-tel-input-id");return e?o.instances[e]:null},instances:{},loadUtils:P,version:"23.0.0"}),N=o;import H,{useRef as A,useEffect as O}from"react";var R=({initialValue:d="",onChangeNumber:e=()=>{},onChangeCountry:t=()=>{},onChangeValidity:i=()=>{},onChangeErrorCode:n=()=>{},usePreciseValidation:s=!1,initOptions:r={},inputProps:a={}})=>{let u=A(null),l=A(null),h=()=>{let c=l.current?.getNumber()||"",g=l.current?.getSelectedCountryData().iso2||"";if(e(c),t(g),l.current)if(s?l.current.isValidNumberPrecise():l.current.isValidNumber())i(!0),n(null);else{let C=l.current.getValidationError();i(!1),n(C)}};return O(()=>{let c=u.current;return c&&(l.current=N(c,r),c.addEventListener("countrychange",h),l.current.promise.then(h)),()=>{c&&c.removeEventListener("countrychange",h),l.current?.destroy()}},[]),H.createElement("input",{type:"tel",ref:u,onInput:h,defaultValue:d,...a})},J=R;export{J as default}; diff --git a/react/build/IntlTelInputWithUtils.cjs b/react/build/IntlTelInputWithUtils.cjs index 32d09342c..b69a52042 100644 --- a/react/build/IntlTelInputWithUtils.cjs +++ b/react/build/IntlTelInputWithUtils.cjs @@ -1 +1 @@ -var P2=Object.create;var l1=Object.defineProperty;var R2=Object.getOwnPropertyDescriptor;var k2=Object.getOwnPropertyNames;var O2=Object.getPrototypeOf,B2=Object.prototype.hasOwnProperty;var G2=(f,$)=>{for(var n in $)l1(f,n,{get:$[n],enumerable:!0})},d2=(f,$,n,s)=>{if($&&typeof $=="object"||typeof $=="function")for(let u of k2($))!B2.call(f,u)&&u!==n&&l1(f,u,{get:()=>$[u],enumerable:!(s=R2($,u))||s.enumerable});return f};var H2=(f,$,n)=>(n=f!=null?P2(O2(f)):{},d2($||!f||!f.__esModule?l1(n,"default",{value:f,enumerable:!0}):n,f)),U2=f=>d2(l1({},"__esModule",{value:!0}),f);var Y2={};G2(Y2,{default:()=>Z2});module.exports=U2(Y2);var t2=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],e2=[];for(let f=0;ff.replace(/\D/g,""),r2=(f="")=>f.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),s2=f=>{let $=a1(f);if($.charAt(0)==="1"){let n=$.substr(1,3);return F2.indexOf(n)!==-1}return!1},V2=(f,$,n,s)=>{if(n===0&&!s)return 0;let u=0;for(let a=0;a<$.length;a++){if(/[+0-9]/.test($[a])&&u++,u===f&&!s)return a+1;if(s&&u===f+1)return a}return $.length},A=(f,$,n)=>{let s=document.createElement(f);return $&&Object.entries($).forEach(([u,a])=>s.setAttribute(u,a)),n&&n.appendChild(s),s},d1=f=>{let{instances:$}=m;Object.values($).forEach(n=>n[f]())},m1=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor($,n={}){this.id=K2++,this.telInput=$,this.highlightedItem=null,this.options=Object.assign({},o2,n),this.hadInitialPlaceholder=!!$.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...i2,...this.options.i18n};let $=new Promise((s,u)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=u}),n=new Promise((s,u)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=u});this.promise=Promise.all([$,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map($=>$.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort(($,n)=>{let{countryOrder:s}=this.options;if(s){let u=s.indexOf($.iso2),a=s.indexOf(n.iso2),p=u>-1,C=a>-1;if(p||C)return p&&C?u-a:p?-1:1}return $.namen.name?1:0})}_addToDialCodeMap($,n,s){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let a=0;au.toLowerCase());this.countries=Q.filter(u=>s.indexOf(u.iso2)>-1)}else if(n.length){let s=n.map(u=>u.toLowerCase());this.countries=Q.filter(u=>s.indexOf(u.iso2)===-1)}else this.countries=Q}_translateCountryNames(){for(let $=0;$
`),p+=`${u.name}`,p+=`+${u.dialCode}`,a.insertAdjacentHTML("beforeend",p)}}_setInitialState($=!1){let n=this.telInput.getAttribute("value"),s=this.telInput.value,a=n&&n.charAt(0)==="+"&&(!s||s.charAt(0)!=="+")?n:s,p=this._getDialCode(a),C=s2(a),{initialCountry:v}=this.options;if(p&&!C)this._updateCountryFromNumber(a);else if(v!=="auto"||$){let y=v?v.toLowerCase():"";y&&this._getCountryData(y,!0)?this._setCountry(y):p&&C?this._setCountry("us"):this._setCountry()}a&&this._updateValFromNumber(a)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let $=this.telInput.closest("label");$&&$.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!m.utils?m.documentReady()?m.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{m.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){m.autoCountry?this.handleAutoCountry():m.startedLoadingAutoCountry||(m.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup(($="")=>{let n=$.toLowerCase();n&&this._getCountryData(n,!0)?(m.autoCountry=n,setTimeout(()=>d1("handleAutoCountry"))):(this._setInitialState(!0),d1("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),d1("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:$,formatAsYouType:n,separateDialCode:s}=this.options,u=!1;this._handleInputEvent=a=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let p=a&&a.data&&/[^+0-9]/.test(a.data),C=a&&a.inputType==="insertFromPaste"&&this.telInput.value;if(p||C&&!$?u=!0:/[^+0-9]/.test(this.telInput.value)||(u=!1),n&&!u){let v=this.telInput.selectionStart||0,b=this.telInput.value.substring(0,v).replace(/[^+0-9]/g,"").length,_=a&&a.inputType==="deleteContentForward",T=this._formatNumberAsYouType(),P=V2(b,T,v,_);this.telInput.value=T,this.telInput.setSelectionRange(P,P)}},this.telInput.addEventListener("input",this._handleInputEvent),($||s)&&(this._handleKeydownEvent=a=>{if(a.key&&a.key.length===1&&!a.altKey&&!a.ctrlKey&&!a.metaKey){if(s&&a.key==="+"){a.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if($){let p=this.telInput.selectionStart===0&&a.key==="+",C=/^[0-9]$/.test(a.key),v=p||C,y=this._getFullNumber(),b=m.utils.getCoreNumber(y,this.selectedCountryData.iso2),_=this.maxCoreNumberLength&&b.length>=this.maxCoreNumberLength;(!v||_)&&a.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap($){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&$.length>n?$.substr(0,n):$}_trigger($){let n=new Event($,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(n)}_openDropdown(){let{fixDropdownWidth:$}=this.options;$&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let $=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${$.top+n}px`,this.dropdown.style.left=`${$.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=u=>{let a=u.target?.closest(".iti__country");a&&this._highlightListItem(a,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=u=>{let a=u.target?.closest(".iti__country");a&&this._selectListItem(a)},this.countryList.addEventListener("click",this._handleClickCountryList);let $=!0;this._handleClickOffToClose=()=>{$||this._closeDropdown(),$=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=u=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),u.key==="ArrowUp"||u.key==="ArrowDown"?this._handleUpDownKey(u.key):u.key==="Enter"?this._handleEnterKey():u.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let n=()=>{let u=this.searchInput.value.trim();u?this._filterCountries(u):this._filterCountries("",!0)},s=null;this._handleSearchChange=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",u=>u.stopPropagation())}_filterCountries($,n=!1){let s=!0;this.countryList.innerHTML="";let u=r2($);for(let a=0;a1&&(n=$==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber($){let n=$;if(this.options.formatOnDisplay&&m.utils&&this.selectedCountryData){let s=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:u,INTERNATIONAL:a}=m.utils.numberFormat,p=s?u:a;n=m.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber($){let n=$.indexOf("+"),s=n?$.substring(n):$,u=this.selectedCountryData.dialCode;s&&u==="1"&&s.charAt(0)!=="+"&&(s.charAt(0)!=="1"&&(s=`1${s}`),s=`+${s}`),this.options.separateDialCode&&u&&s.charAt(0)!=="+"&&(s=`+${u}${s}`);let p=this._getDialCode(s,!0),C=a1(s),v=null;if(p){let y=this.dialCodeToIso2Map[a1(p)],b=y.indexOf(this.selectedCountryData.iso2)!==-1&&C.length<=p.length-1;if(!(u==="1"&&s2(C))&&!b){for(let T=0;Tp){let _=u-C;n.scrollTop=b-_}}_updateDialCode($){let n=this.telInput.value,s=`+${$}`,u;if(n.charAt(0)==="+"){let a=this._getDialCode(n);a?u=n.replace(a,s):u=s,this.telInput.value=u}}_getDialCode($,n){let s="";if($.charAt(0)==="+"){let u="";for(let a=0;a<$.length;a++){let p=$.charAt(a);if(!isNaN(parseInt(p,10))){if(u+=p,n)this.dialCodeToIso2Map[u]&&(s=$.substr(0,a+1));else if(this.dialCodes[u]){s=$.substr(0,a+1);break}if(u.length===this.dialCodeMaxLen)break}}}return s}_getFullNumber(){let $=this.telInput.value.trim(),{dialCode:n}=this.selectedCountryData,s,u=a1($);return this.options.separateDialCode&&$.charAt(0)!=="+"&&n&&u?s=`+${n}`:s="",s+$}_beforeSetNumber($){let n=$;if(this.options.separateDialCode){let s=this._getDialCode(n);if(s){s=`+${this.selectedCountryData.dialCode}`;let u=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substr(u)}}return this._cap(n)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let $=this._getFullNumber(),n=m.utils?m.utils.formatNumberAsYouType($,this.selectedCountryData.iso2):$,{dialCode:s}=this.selectedCountryData;return this.options.separateDialCode&&this.telInput.value.charAt(0)!=="+"&&n.includes(`+${s}`)?(n.split(`+${s}`)[1]||"").trim():n}handleAutoCountry(){this.options.initialCountry==="auto"&&m.autoCountry&&(this.defaultCountry=m.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){m.utils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let s=this.telInput.closest("label");s&&s.removeEventListener("click",this._handleLabelClick)}let{form:$}=this.telInput;this._handleHiddenInputSubmit&&$&&$.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let n=this.telInput.parentNode;n?.parentNode?.insertBefore(this.telInput,n),n?.parentNode?.removeChild(n),delete m.instances[this.id]}getExtension(){return m.utils?m.utils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber($){if(m.utils){let{iso2:n}=this.selectedCountryData;return m.utils.formatNumber(this._getFullNumber(),n,$)}return""}getNumberType(){return m.utils?m.utils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(m.utils){let{iso2:$}=this.selectedCountryData;return m.utils.getValidationError(this._getFullNumber(),$)}return-99}isValidNumber($=!0){let n=this._getFullNumber();return/\p{L}/u.test(n)?!1:m.utils?m.utils.isPossibleNumber(n,this.selectedCountryData.iso2,$):null}isValidNumberPrecise(){let $=this._getFullNumber();return/\p{L}/u.test($)?!1:m.utils?m.utils.isValidNumber($,this.selectedCountryData.iso2):null}setCountry($){let n=$.toLowerCase();this.selectedCountryData.iso2!==n&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber($){let n=this._updateCountryFromNumber($);this._updateValFromNumber($),n&&this._triggerCountryChange()}setPlaceholderNumberType($){this.options.placeholderNumberType=$,this._updatePlaceholder()}},j2=f=>!m.utils&&!m.startedLoadingUtilsScript?(m.startedLoadingUtilsScript=!0,new Promise(($,n)=>{import(f).then(({default:s})=>{m.utils=s,d1("handleUtils"),$(!0)}).catch(()=>{d1("rejectUtilsScriptPromise"),n()})})):null,m=Object.assign((f,$)=>{let n=new m1(f,$);return n._init(),f.setAttribute("data-intl-tel-input-id",n.id.toString()),m.instances[n.id]=n,n},{defaults:o2,documentReady:()=>document.readyState==="complete",getCountryData:()=>Q,getInstance:f=>{let $=f.getAttribute("data-intl-tel-input-id");return $?m.instances[$]:null},instances:{},loadUtils:j2,version:"22.0.2"}),C1=m;(function(){var f=this||self;function $(d,t){d=d.split(".");var e=f;d[0]in e||typeof e.execScript>"u"||e.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?e[i]&&e[i]!==Object.prototype[i]?e=e[i]:e=e[i]={}:e[i]=t}function n(d,t){function e(){}e.prototype=t.prototype,d.ma=t.prototype,d.prototype=new e,d.prototype.constructor=d,d.sa=function(i,r,o){for(var l=Array(arguments.length-2),h=2;hd.length?!1:k(L2,d)}function M1(d){return k(w2,d)?n1(d,v2):n1(d,c1)}function D1(d){var t=M1(d.toString());x(d),d.g(t)}function x1(d){return d!=null&&(B(d,9)!=1||N(d,9)[0]!=-1)}function n1(d,t){for(var e=new w,i,r=d.length,o=0;ot?2:o[o.length-1]=r&&r<=i;++r)if(e=parseInt(d.substring(0,r),10),e in Z)return t.g(d.substring(r)),e;return 0}function G1(d,t,e,i,r,o){if(t.length==0)return 0;t=new w(t);var l;e!=null&&(l=c(e,11)),l==null&&(l="NonMatch");var h=t.toString();if(h.length==0)l=20;else if(Y.test(h))h=h.replace(Y,""),x(t),t.g(M1(h)),l=1;else{if(h=new RegExp(l),D1(t),l=t.toString(),l.search(h)==0){h=l.match(h)[0].length;var g=l.substring(h).match(E1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=B1(t,i),d!=0)return E(o,1,d),d;throw Error("Invalid country calling code")}return e!=null&&(l=I(e,10),h=""+l,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new w(g.substring(h.length)),g=c(e,1),g=new RegExp(I(g,2)),H1(h,e,null),h=h.toString(),!k(g,t.toString())&&k(g,h)||s1(d,t.toString(),e,-1)==3))?(i.g(h),r&&E(o,6,10),E(o,1,l),l):(E(o,1,0),0)}function H1(d,t,e){var i=d.toString(),r=i.length,o=c(t,15);if(r!=0&&o!=null&&o.length!=0){var l=new RegExp("^(?:"+o+")");if(r=l.exec(i)){o=new RegExp(I(c(t,1),2));var h=k(o,i),g=r.length-1;t=c(t,16),t==null||t.length==0||r[g]==null||r[g].length==0?(!h||k(o,i.substring(r[0].length)))&&(e!=null&&0=t.length)o="";else{var l=t.indexOf(";",o);o=l!==-1?t.substring(o,l):t.substring(o)}var h=o;if(h==null?l=!0:h.length===0?l=!1:(l=T2.exec(h),h=E2.exec(h),l=l!==null||h!==null),!l||(o!=null?(o.charAt(0)==="+"&&r.g(o),o=t.indexOf("tel:"),r.g(t.substring(0<=o?o+4:0,t.indexOf(";phone-context=")))):(o=r.g,l=t??"",h=l.search(b2),0<=h?(l=l.substring(h),l=l.replace(S2,""),h=l.search(_2),0<=h&&(l=l.substring(0,h))):l="",o.call(r,l)),o=r.toString(),l=o.indexOf(";isub="),0t.h.length||(l!=null&&(e=new w,r=new w(t.toString()),H1(r,l,e),d=s1(d,r.toString(),l,-1),d!=2&&d!=4&&d!=5&&(t=r,i&&0d))throw Error("The string supplied is too short to be a phone number");if(17{try{let e=d.replace(/[^+0-9]/g,""),i=new M2(t);t="";for(let r=0;r{try{let r=L.g(),o=V(r,d,t);var i=o1(r,o,-1);return i==0||i==4?r.format(o,typeof e>"u"?0:e):d}catch{return d}}),$("intlTelInputUtilsTemp.getExampleNumber",(d,t,e,i)=>{try{let g=L.g();d:{var r=g;if(i1(d)){var o=r1(H(r,d),e);try{if(D(o,6)){var l=c(o,6),h=U1(r,l,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),$("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(V(L.g(),d,t),3)}catch{return""}}),$("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let l=L.g(),h=V(l,d,t);var e=k1(l,h),i=J(l,I(h,1),e);if(i==null)var r=-1;else{var o=q(h);r=p1(o,i)}return r}catch{return-99}}),$("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let e=L.g(),i=V(e,d,t);return o1(e,i,-1)}catch(e){return e.message==="Invalid country calling code"?1:3>=d.length||e.message==="Phone number too short after IDD"||e.message==="The string supplied is too short to be a phone number"?2:e.message==="The string supplied is too long to be a phone number"?3:-99}}),$("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=L.g();var e=V(g,d,t),i=k1(g,e);d=g;var r=I(e,1),o=J(d,r,i);if(o==null||i!="001"&&r!=O1(d,i))var l=!1;else{var h=q(e);l=p1(h,o)!=-1}return l}catch{return!1}}),$("intlTelInputUtilsTemp.isPossibleNumber",(d,t,e)=>{try{let i=L.g(),r=V(i,d,t);return e?o1(i,r,1)===0:o1(i,r,-1)===0}catch{return!1}}),$("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(V(L.g(),d,t),2).toString()}catch{return""}}),$("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),$("intlTelInputUtilsTemp.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1}),$("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var z2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var u2=z2;C1.utils=u2;var l2=C1;var j=H2(require("react")),W2=({initialValue:f="",onChangeNumber:$=()=>{},onChangeCountry:n=()=>{},onChangeValidity:s=()=>{},onChangeErrorCode:u=()=>{},usePreciseValidation:a=!1,initOptions:p={},inputProps:C={}})=>{let v=(0,j.useRef)(null),y=(0,j.useRef)(null),b=()=>{let _=y.current?.getNumber()||"",T=y.current?.getSelectedCountryData().iso2||"";if($(_),n(T),y.current)if(a?y.current.isValidNumberPrecise():y.current.isValidNumber())s(!0),u(null);else{let U=y.current.getValidationError();s(!1),u(U)}};return(0,j.useEffect)(()=>{let _=v.current;return _&&(y.current=l2(_,p),_.addEventListener("countrychange",b),y.current.promise.then(b)),()=>{_&&_.removeEventListener("countrychange",b),y.current?.destroy()}},[]),j.default.createElement("input",{type:"tel",ref:v,onInput:b,defaultValue:f,...C})},Z2=W2; +var P2=Object.create;var l1=Object.defineProperty;var R2=Object.getOwnPropertyDescriptor;var k2=Object.getOwnPropertyNames;var O2=Object.getPrototypeOf,B2=Object.prototype.hasOwnProperty;var G2=(f,$)=>{for(var n in $)l1(f,n,{get:$[n],enumerable:!0})},d2=(f,$,n,s)=>{if($&&typeof $=="object"||typeof $=="function")for(let u of k2($))!B2.call(f,u)&&u!==n&&l1(f,u,{get:()=>$[u],enumerable:!(s=R2($,u))||s.enumerable});return f};var H2=(f,$,n)=>(n=f!=null?P2(O2(f)):{},d2($||!f||!f.__esModule?l1(n,"default",{value:f,enumerable:!0}):n,f)),U2=f=>d2(l1({},"__esModule",{value:!0}),f);var Y2={};G2(Y2,{default:()=>Z2});module.exports=U2(Y2);var t2=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],e2=[];for(let f=0;ff.replace(/\D/g,""),r2=(f="")=>f.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),s2=f=>{let $=a1(f);if($.charAt(0)==="1"){let n=$.substr(1,3);return F2.indexOf(n)!==-1}return!1},V2=(f,$,n,s)=>{if(n===0&&!s)return 0;let u=0;for(let a=0;a<$.length;a++){if(/[+0-9]/.test($[a])&&u++,u===f&&!s)return a+1;if(s&&u===f+1)return a}return $.length},A=(f,$,n)=>{let s=document.createElement(f);return $&&Object.entries($).forEach(([u,a])=>s.setAttribute(u,a)),n&&n.appendChild(s),s},d1=f=>{let{instances:$}=m;Object.values($).forEach(n=>n[f]())},m1=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor($,n={}){this.id=K2++,this.telInput=$,this.highlightedItem=null,this.options=Object.assign({},o2,n),this.hadInitialPlaceholder=!!$.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...i2,...this.options.i18n};let $=new Promise((s,u)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=u}),n=new Promise((s,u)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=u});this.promise=Promise.all([$,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map($=>$.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort(($,n)=>{let{countryOrder:s}=this.options;if(s){let u=s.indexOf($.iso2),a=s.indexOf(n.iso2),p=u>-1,C=a>-1;if(p||C)return p&&C?u-a:p?-1:1}return $.namen.name?1:0})}_addToDialCodeMap($,n,s){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let a=0;au.toLowerCase());this.countries=Q.filter(u=>s.indexOf(u.iso2)>-1)}else if(n.length){let s=n.map(u=>u.toLowerCase());this.countries=Q.filter(u=>s.indexOf(u.iso2)===-1)}else this.countries=Q}_translateCountryNames(){for(let $=0;$
`),p+=`${u.name}`,p+=`+${u.dialCode}`,a.insertAdjacentHTML("beforeend",p)}}_setInitialState($=!1){let n=this.telInput.getAttribute("value"),s=this.telInput.value,a=n&&n.charAt(0)==="+"&&(!s||s.charAt(0)!=="+")?n:s,p=this._getDialCode(a),C=s2(a),{initialCountry:v}=this.options;if(p&&!C)this._updateCountryFromNumber(a);else if(v!=="auto"||$){let y=v?v.toLowerCase():"";y&&this._getCountryData(y,!0)?this._setCountry(y):p&&C?this._setCountry("us"):this._setCountry()}a&&this._updateValFromNumber(a)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let $=this.telInput.closest("label");$&&$.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!m.utils?m.documentReady()?m.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{m.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){m.autoCountry?this.handleAutoCountry():m.startedLoadingAutoCountry||(m.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup(($="")=>{let n=$.toLowerCase();n&&this._getCountryData(n,!0)?(m.autoCountry=n,setTimeout(()=>d1("handleAutoCountry"))):(this._setInitialState(!0),d1("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),d1("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:$,formatAsYouType:n,separateDialCode:s}=this.options,u=!1;this._handleInputEvent=a=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let p=a&&a.data&&/[^+0-9]/.test(a.data),C=a&&a.inputType==="insertFromPaste"&&this.telInput.value;if(p||C&&!$?u=!0:/[^+0-9]/.test(this.telInput.value)||(u=!1),n&&!u){let v=this.telInput.selectionStart||0,b=this.telInput.value.substring(0,v).replace(/[^+0-9]/g,"").length,_=a&&a.inputType==="deleteContentForward",T=this._formatNumberAsYouType(),P=V2(b,T,v,_);this.telInput.value=T,this.telInput.setSelectionRange(P,P)}},this.telInput.addEventListener("input",this._handleInputEvent),($||s)&&(this._handleKeydownEvent=a=>{if(a.key&&a.key.length===1&&!a.altKey&&!a.ctrlKey&&!a.metaKey){if(s&&a.key==="+"){a.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if($){let p=this.telInput.selectionStart===0&&a.key==="+",C=/^[0-9]$/.test(a.key),v=p||C,y=this._getFullNumber(),b=m.utils.getCoreNumber(y,this.selectedCountryData.iso2),_=this.maxCoreNumberLength&&b.length>=this.maxCoreNumberLength;(!v||_)&&a.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap($){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&$.length>n?$.substr(0,n):$}_trigger($){let n=new Event($,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(n)}_openDropdown(){let{fixDropdownWidth:$}=this.options;$&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let $=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${$.top+n}px`,this.dropdown.style.left=`${$.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=u=>{let a=u.target?.closest(".iti__country");a&&this._highlightListItem(a,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=u=>{let a=u.target?.closest(".iti__country");a&&this._selectListItem(a)},this.countryList.addEventListener("click",this._handleClickCountryList);let $=!0;this._handleClickOffToClose=()=>{$||this._closeDropdown(),$=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=u=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(u.key)&&(u.preventDefault(),u.stopPropagation(),u.key==="ArrowUp"||u.key==="ArrowDown"?this._handleUpDownKey(u.key):u.key==="Enter"?this._handleEnterKey():u.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let n=()=>{let u=this.searchInput.value.trim();u?this._filterCountries(u):this._filterCountries("",!0)},s=null;this._handleSearchChange=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",u=>u.stopPropagation())}_filterCountries($,n=!1){let s=!0;this.countryList.innerHTML="";let u=r2($);for(let a=0;a1&&(n=$==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber($){let n=$;if(this.options.formatOnDisplay&&m.utils&&this.selectedCountryData){let s=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:u,INTERNATIONAL:a}=m.utils.numberFormat,p=s?u:a;n=m.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber($){let n=$.indexOf("+"),s=n?$.substring(n):$,u=this.selectedCountryData.dialCode;s&&u==="1"&&s.charAt(0)!=="+"&&(s.charAt(0)!=="1"&&(s=`1${s}`),s=`+${s}`),this.options.separateDialCode&&u&&s.charAt(0)!=="+"&&(s=`+${u}${s}`);let p=this._getDialCode(s,!0),C=a1(s),v=null;if(p){let y=this.dialCodeToIso2Map[a1(p)],b=y.indexOf(this.selectedCountryData.iso2)!==-1&&C.length<=p.length-1;if(!(u==="1"&&s2(C))&&!b){for(let T=0;Tp){let _=u-C;n.scrollTop=b-_}}_updateDialCode($){let n=this.telInput.value,s=`+${$}`,u;if(n.charAt(0)==="+"){let a=this._getDialCode(n);a?u=n.replace(a,s):u=s,this.telInput.value=u}}_getDialCode($,n){let s="";if($.charAt(0)==="+"){let u="";for(let a=0;a<$.length;a++){let p=$.charAt(a);if(!isNaN(parseInt(p,10))){if(u+=p,n)this.dialCodeToIso2Map[u]&&(s=$.substr(0,a+1));else if(this.dialCodes[u]){s=$.substr(0,a+1);break}if(u.length===this.dialCodeMaxLen)break}}}return s}_getFullNumber(){let $=this.telInput.value.trim(),{dialCode:n}=this.selectedCountryData,s,u=a1($);return this.options.separateDialCode&&$.charAt(0)!=="+"&&n&&u?s=`+${n}`:s="",s+$}_beforeSetNumber($){let n=$;if(this.options.separateDialCode){let s=this._getDialCode(n);if(s){s=`+${this.selectedCountryData.dialCode}`;let u=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substr(u)}}return this._cap(n)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let $=this._getFullNumber(),n=m.utils?m.utils.formatNumberAsYouType($,this.selectedCountryData.iso2):$,{dialCode:s}=this.selectedCountryData;return this.options.separateDialCode&&this.telInput.value.charAt(0)!=="+"&&n.includes(`+${s}`)?(n.split(`+${s}`)[1]||"").trim():n}handleAutoCountry(){this.options.initialCountry==="auto"&&m.autoCountry&&(this.defaultCountry=m.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){m.utils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let s=this.telInput.closest("label");s&&s.removeEventListener("click",this._handleLabelClick)}let{form:$}=this.telInput;this._handleHiddenInputSubmit&&$&&$.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let n=this.telInput.parentNode;n?.parentNode?.insertBefore(this.telInput,n),n?.parentNode?.removeChild(n),delete m.instances[this.id]}getExtension(){return m.utils?m.utils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber($){if(m.utils){let{iso2:n}=this.selectedCountryData;return m.utils.formatNumber(this._getFullNumber(),n,$)}return""}getNumberType(){return m.utils?m.utils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(m.utils){let{iso2:$}=this.selectedCountryData;return m.utils.getValidationError(this._getFullNumber(),$)}return-99}isValidNumber($=!0){let n=this._getFullNumber();return/\p{L}/u.test(n)?!1:m.utils?m.utils.isPossibleNumber(n,this.selectedCountryData.iso2,$):null}isValidNumberPrecise(){let $=this._getFullNumber();return/\p{L}/u.test($)?!1:m.utils?m.utils.isValidNumber($,this.selectedCountryData.iso2):null}setCountry($){let n=$.toLowerCase();this.selectedCountryData.iso2!==n&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber($){let n=this._updateCountryFromNumber($);this._updateValFromNumber($),n&&this._triggerCountryChange()}setPlaceholderNumberType($){this.options.placeholderNumberType=$,this._updatePlaceholder()}},j2=f=>!m.utils&&!m.startedLoadingUtilsScript?(m.startedLoadingUtilsScript=!0,new Promise(($,n)=>{import(f).then(({default:s})=>{m.utils=s,d1("handleUtils"),$(!0)}).catch(()=>{d1("rejectUtilsScriptPromise"),n()})})):null,m=Object.assign((f,$)=>{let n=new m1(f,$);return n._init(),f.setAttribute("data-intl-tel-input-id",n.id.toString()),m.instances[n.id]=n,n},{defaults:o2,documentReady:()=>document.readyState==="complete",getCountryData:()=>Q,getInstance:f=>{let $=f.getAttribute("data-intl-tel-input-id");return $?m.instances[$]:null},instances:{},loadUtils:j2,version:"23.0.0"}),C1=m;(function(){var f=this||self;function $(d,t){d=d.split(".");var e=f;d[0]in e||typeof e.execScript>"u"||e.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?e[i]&&e[i]!==Object.prototype[i]?e=e[i]:e=e[i]={}:e[i]=t}function n(d,t){function e(){}e.prototype=t.prototype,d.ma=t.prototype,d.prototype=new e,d.prototype.constructor=d,d.sa=function(i,r,o){for(var l=Array(arguments.length-2),h=2;hd.length?!1:k(L2,d)}function M1(d){return k(w2,d)?n1(d,v2):n1(d,c1)}function D1(d){var t=M1(d.toString());x(d),d.g(t)}function x1(d){return d!=null&&(B(d,9)!=1||N(d,9)[0]!=-1)}function n1(d,t){for(var e=new w,i,r=d.length,o=0;ot?2:o[o.length-1]=r&&r<=i;++r)if(e=parseInt(d.substring(0,r),10),e in Z)return t.g(d.substring(r)),e;return 0}function G1(d,t,e,i,r,o){if(t.length==0)return 0;t=new w(t);var l;e!=null&&(l=c(e,11)),l==null&&(l="NonMatch");var h=t.toString();if(h.length==0)l=20;else if(Y.test(h))h=h.replace(Y,""),x(t),t.g(M1(h)),l=1;else{if(h=new RegExp(l),D1(t),l=t.toString(),l.search(h)==0){h=l.match(h)[0].length;var g=l.substring(h).match(E1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=B1(t,i),d!=0)return E(o,1,d),d;throw Error("Invalid country calling code")}return e!=null&&(l=I(e,10),h=""+l,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new w(g.substring(h.length)),g=c(e,1),g=new RegExp(I(g,2)),H1(h,e,null),h=h.toString(),!k(g,t.toString())&&k(g,h)||s1(d,t.toString(),e,-1)==3))?(i.g(h),r&&E(o,6,10),E(o,1,l),l):(E(o,1,0),0)}function H1(d,t,e){var i=d.toString(),r=i.length,o=c(t,15);if(r!=0&&o!=null&&o.length!=0){var l=new RegExp("^(?:"+o+")");if(r=l.exec(i)){o=new RegExp(I(c(t,1),2));var h=k(o,i),g=r.length-1;t=c(t,16),t==null||t.length==0||r[g]==null||r[g].length==0?(!h||k(o,i.substring(r[0].length)))&&(e!=null&&0=t.length)o="";else{var l=t.indexOf(";",o);o=l!==-1?t.substring(o,l):t.substring(o)}var h=o;if(h==null?l=!0:h.length===0?l=!1:(l=T2.exec(h),h=E2.exec(h),l=l!==null||h!==null),!l||(o!=null?(o.charAt(0)==="+"&&r.g(o),o=t.indexOf("tel:"),r.g(t.substring(0<=o?o+4:0,t.indexOf(";phone-context=")))):(o=r.g,l=t??"",h=l.search(b2),0<=h?(l=l.substring(h),l=l.replace(S2,""),h=l.search(_2),0<=h&&(l=l.substring(0,h))):l="",o.call(r,l)),o=r.toString(),l=o.indexOf(";isub="),0t.h.length||(l!=null&&(e=new w,r=new w(t.toString()),H1(r,l,e),d=s1(d,r.toString(),l,-1),d!=2&&d!=4&&d!=5&&(t=r,i&&0d))throw Error("The string supplied is too short to be a phone number");if(17{try{let e=d.replace(/[^+0-9]/g,""),i=new M2(t);t="";for(let r=0;r{try{let r=L.g(),o=V(r,d,t);var i=o1(r,o,-1);return i==0||i==4?r.format(o,typeof e>"u"?0:e):d}catch{return d}}),$("intlTelInputUtilsTemp.getExampleNumber",(d,t,e,i)=>{try{let g=L.g();d:{var r=g;if(i1(d)){var o=r1(H(r,d),e);try{if(D(o,6)){var l=c(o,6),h=U1(r,l,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),$("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(V(L.g(),d,t),3)}catch{return""}}),$("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let l=L.g(),h=V(l,d,t);var e=k1(l,h),i=J(l,I(h,1),e);if(i==null)var r=-1;else{var o=q(h);r=p1(o,i)}return r}catch{return-99}}),$("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let e=L.g(),i=V(e,d,t);return o1(e,i,-1)}catch(e){return e.message==="Invalid country calling code"?1:3>=d.length||e.message==="Phone number too short after IDD"||e.message==="The string supplied is too short to be a phone number"?2:e.message==="The string supplied is too long to be a phone number"?3:-99}}),$("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=L.g();var e=V(g,d,t),i=k1(g,e);d=g;var r=I(e,1),o=J(d,r,i);if(o==null||i!="001"&&r!=O1(d,i))var l=!1;else{var h=q(e);l=p1(h,o)!=-1}return l}catch{return!1}}),$("intlTelInputUtilsTemp.isPossibleNumber",(d,t,e)=>{try{let i=L.g(),r=V(i,d,t);return e?o1(i,r,1)===0:o1(i,r,-1)===0}catch{return!1}}),$("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(V(L.g(),d,t),2).toString()}catch{return""}}),$("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),$("intlTelInputUtilsTemp.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1}),$("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var z2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var u2=z2;C1.utils=u2;var l2=C1;var j=H2(require("react")),W2=({initialValue:f="",onChangeNumber:$=()=>{},onChangeCountry:n=()=>{},onChangeValidity:s=()=>{},onChangeErrorCode:u=()=>{},usePreciseValidation:a=!1,initOptions:p={},inputProps:C={}})=>{let v=(0,j.useRef)(null),y=(0,j.useRef)(null),b=()=>{let _=y.current?.getNumber()||"",T=y.current?.getSelectedCountryData().iso2||"";if($(_),n(T),y.current)if(a?y.current.isValidNumberPrecise():y.current.isValidNumber())s(!0),u(null);else{let U=y.current.getValidationError();s(!1),u(U)}};return(0,j.useEffect)(()=>{let _=v.current;return _&&(y.current=l2(_,p),_.addEventListener("countrychange",b),y.current.promise.then(b)),()=>{_&&_.removeEventListener("countrychange",b),y.current?.destroy()}},[]),j.default.createElement("input",{type:"tel",ref:v,onInput:b,defaultValue:f,...C})},Z2=W2; diff --git a/react/build/IntlTelInputWithUtils.js b/react/build/IntlTelInputWithUtils.js index f1a039df2..8482509b2 100644 --- a/react/build/IntlTelInputWithUtils.js +++ b/react/build/IntlTelInputWithUtils.js @@ -1 +1 @@ -var X1=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],Q1=[];for(let v=0;vv.replace(/\D/g,""),$2=(v="")=>v.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),n2=v=>{let $=u1(v);if($.charAt(0)==="1"){let n=$.substr(1,3);return x2.indexOf(n)!==-1}return!1},P2=(v,$,n,s)=>{if(n===0&&!s)return 0;let l=0;for(let a=0;a<$.length;a++){if(/[+0-9]/.test($[a])&&l++,l===v&&!s)return a+1;if(s&&l===v+1)return a}return $.length},A=(v,$,n)=>{let s=document.createElement(v);return $&&Object.entries($).forEach(([l,a])=>s.setAttribute(l,a)),n&&n.appendChild(s),s},Q=v=>{let{instances:$}=f;Object.values($).forEach(n=>n[v]())},g1=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor($,n={}){this.id=D2++,this.telInput=$,this.highlightedItem=null,this.options=Object.assign({},i2,n),this.hadInitialPlaceholder=!!$.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...e2,...this.options.i18n};let $=new Promise((s,l)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=l}),n=new Promise((s,l)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=l});this.promise=Promise.all([$,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map($=>$.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort(($,n)=>{let{countryOrder:s}=this.options;if(s){let l=s.indexOf($.iso2),a=s.indexOf(n.iso2),p=l>-1,m=a>-1;if(p||m)return p&&m?l-a:p?-1:1}return $.namen.name?1:0})}_addToDialCodeMap($,n,s){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let a=0;al.toLowerCase());this.countries=X.filter(l=>s.indexOf(l.iso2)>-1)}else if(n.length){let s=n.map(l=>l.toLowerCase());this.countries=X.filter(l=>s.indexOf(l.iso2)===-1)}else this.countries=X}_translateCountryNames(){for(let $=0;$
`),p+=`${l.name}`,p+=`+${l.dialCode}`,a.insertAdjacentHTML("beforeend",p)}}_setInitialState($=!1){let n=this.telInput.getAttribute("value"),s=this.telInput.value,a=n&&n.charAt(0)==="+"&&(!s||s.charAt(0)!=="+")?n:s,p=this._getDialCode(a),m=n2(a),{initialCountry:y}=this.options;if(p&&!m)this._updateCountryFromNumber(a);else if(y!=="auto"||$){let C=y?y.toLowerCase():"";C&&this._getCountryData(C,!0)?this._setCountry(C):p&&m?this._setCountry("us"):this._setCountry()}a&&this._updateValFromNumber(a)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let $=this.telInput.closest("label");$&&$.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!f.utils?f.documentReady()?f.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{f.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){f.autoCountry?this.handleAutoCountry():f.startedLoadingAutoCountry||(f.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup(($="")=>{let n=$.toLowerCase();n&&this._getCountryData(n,!0)?(f.autoCountry=n,setTimeout(()=>Q("handleAutoCountry"))):(this._setInitialState(!0),Q("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),Q("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:$,formatAsYouType:n,separateDialCode:s}=this.options,l=!1;this._handleInputEvent=a=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let p=a&&a.data&&/[^+0-9]/.test(a.data),m=a&&a.inputType==="insertFromPaste"&&this.telInput.value;if(p||m&&!$?l=!0:/[^+0-9]/.test(this.telInput.value)||(l=!1),n&&!l){let y=this.telInput.selectionStart||0,b=this.telInput.value.substring(0,y).replace(/[^+0-9]/g,"").length,_=a&&a.inputType==="deleteContentForward",T=this._formatNumberAsYouType(),P=P2(b,T,y,_);this.telInput.value=T,this.telInput.setSelectionRange(P,P)}},this.telInput.addEventListener("input",this._handleInputEvent),($||s)&&(this._handleKeydownEvent=a=>{if(a.key&&a.key.length===1&&!a.altKey&&!a.ctrlKey&&!a.metaKey){if(s&&a.key==="+"){a.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if($){let p=this.telInput.selectionStart===0&&a.key==="+",m=/^[0-9]$/.test(a.key),y=p||m,C=this._getFullNumber(),b=f.utils.getCoreNumber(C,this.selectedCountryData.iso2),_=this.maxCoreNumberLength&&b.length>=this.maxCoreNumberLength;(!y||_)&&a.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap($){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&$.length>n?$.substr(0,n):$}_trigger($){let n=new Event($,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(n)}_openDropdown(){let{fixDropdownWidth:$}=this.options;$&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let $=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${$.top+n}px`,this.dropdown.style.left=`${$.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=l=>{let a=l.target?.closest(".iti__country");a&&this._highlightListItem(a,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=l=>{let a=l.target?.closest(".iti__country");a&&this._selectListItem(a)},this.countryList.addEventListener("click",this._handleClickCountryList);let $=!0;this._handleClickOffToClose=()=>{$||this._closeDropdown(),$=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=l=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(l.key)&&(l.preventDefault(),l.stopPropagation(),l.key==="ArrowUp"||l.key==="ArrowDown"?this._handleUpDownKey(l.key):l.key==="Enter"?this._handleEnterKey():l.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let n=()=>{let l=this.searchInput.value.trim();l?this._filterCountries(l):this._filterCountries("",!0)},s=null;this._handleSearchChange=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",l=>l.stopPropagation())}_filterCountries($,n=!1){let s=!0;this.countryList.innerHTML="";let l=$2($);for(let a=0;a1&&(n=$==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber($){let n=$;if(this.options.formatOnDisplay&&f.utils&&this.selectedCountryData){let s=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:l,INTERNATIONAL:a}=f.utils.numberFormat,p=s?l:a;n=f.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber($){let n=$.indexOf("+"),s=n?$.substring(n):$,l=this.selectedCountryData.dialCode;s&&l==="1"&&s.charAt(0)!=="+"&&(s.charAt(0)!=="1"&&(s=`1${s}`),s=`+${s}`),this.options.separateDialCode&&l&&s.charAt(0)!=="+"&&(s=`+${l}${s}`);let p=this._getDialCode(s,!0),m=u1(s),y=null;if(p){let C=this.dialCodeToIso2Map[u1(p)],b=C.indexOf(this.selectedCountryData.iso2)!==-1&&m.length<=p.length-1;if(!(l==="1"&&n2(m))&&!b){for(let T=0;Tp){let _=l-m;n.scrollTop=b-_}}_updateDialCode($){let n=this.telInput.value,s=`+${$}`,l;if(n.charAt(0)==="+"){let a=this._getDialCode(n);a?l=n.replace(a,s):l=s,this.telInput.value=l}}_getDialCode($,n){let s="";if($.charAt(0)==="+"){let l="";for(let a=0;a<$.length;a++){let p=$.charAt(a);if(!isNaN(parseInt(p,10))){if(l+=p,n)this.dialCodeToIso2Map[l]&&(s=$.substr(0,a+1));else if(this.dialCodes[l]){s=$.substr(0,a+1);break}if(l.length===this.dialCodeMaxLen)break}}}return s}_getFullNumber(){let $=this.telInput.value.trim(),{dialCode:n}=this.selectedCountryData,s,l=u1($);return this.options.separateDialCode&&$.charAt(0)!=="+"&&n&&l?s=`+${n}`:s="",s+$}_beforeSetNumber($){let n=$;if(this.options.separateDialCode){let s=this._getDialCode(n);if(s){s=`+${this.selectedCountryData.dialCode}`;let l=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substr(l)}}return this._cap(n)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let $=this._getFullNumber(),n=f.utils?f.utils.formatNumberAsYouType($,this.selectedCountryData.iso2):$,{dialCode:s}=this.selectedCountryData;return this.options.separateDialCode&&this.telInput.value.charAt(0)!=="+"&&n.includes(`+${s}`)?(n.split(`+${s}`)[1]||"").trim():n}handleAutoCountry(){this.options.initialCountry==="auto"&&f.autoCountry&&(this.defaultCountry=f.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){f.utils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let s=this.telInput.closest("label");s&&s.removeEventListener("click",this._handleLabelClick)}let{form:$}=this.telInput;this._handleHiddenInputSubmit&&$&&$.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let n=this.telInput.parentNode;n?.parentNode?.insertBefore(this.telInput,n),n?.parentNode?.removeChild(n),delete f.instances[this.id]}getExtension(){return f.utils?f.utils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber($){if(f.utils){let{iso2:n}=this.selectedCountryData;return f.utils.formatNumber(this._getFullNumber(),n,$)}return""}getNumberType(){return f.utils?f.utils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(f.utils){let{iso2:$}=this.selectedCountryData;return f.utils.getValidationError(this._getFullNumber(),$)}return-99}isValidNumber($=!0){let n=this._getFullNumber();return/\p{L}/u.test(n)?!1:f.utils?f.utils.isPossibleNumber(n,this.selectedCountryData.iso2,$):null}isValidNumberPrecise(){let $=this._getFullNumber();return/\p{L}/u.test($)?!1:f.utils?f.utils.isValidNumber($,this.selectedCountryData.iso2):null}setCountry($){let n=$.toLowerCase();this.selectedCountryData.iso2!==n&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber($){let n=this._updateCountryFromNumber($);this._updateValFromNumber($),n&&this._triggerCountryChange()}setPlaceholderNumberType($){this.options.placeholderNumberType=$,this._updatePlaceholder()}},R2=v=>!f.utils&&!f.startedLoadingUtilsScript?(f.startedLoadingUtilsScript=!0,new Promise(($,n)=>{import(v).then(({default:s})=>{f.utils=s,Q("handleUtils"),$(!0)}).catch(()=>{Q("rejectUtilsScriptPromise"),n()})})):null,f=Object.assign((v,$)=>{let n=new g1(v,$);return n._init(),v.setAttribute("data-intl-tel-input-id",n.id.toString()),f.instances[n.id]=n,n},{defaults:i2,documentReady:()=>document.readyState==="complete",getCountryData:()=>X,getInstance:v=>{let $=v.getAttribute("data-intl-tel-input-id");return $?f.instances[$]:null},instances:{},loadUtils:R2,version:"22.0.2"}),f1=f;(function(){var v=this||self;function $(d,t){d=d.split(".");var e=v;d[0]in e||typeof e.execScript>"u"||e.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?e[i]&&e[i]!==Object.prototype[i]?e=e[i]:e=e[i]={}:e[i]=t}function n(d,t){function e(){}e.prototype=t.prototype,d.ma=t.prototype,d.prototype=new e,d.prototype.constructor=d,d.sa=function(i,r,o){for(var u=Array(arguments.length-2),h=2;hd.length?!1:k(T2,d)}function A1(d){return k(_2,d)?$1(d,C2):$1(d,a1)}function N1(d){var t=A1(d.toString());x(d),d.g(t)}function M1(d){return d!=null&&(B(d,9)!=1||N(d,9)[0]!=-1)}function $1(d,t){for(var e=new w,i,r=d.length,o=0;ot?2:o[o.length-1]=r&&r<=i;++r)if(e=parseInt(d.substring(0,r),10),e in W)return t.g(d.substring(r)),e;return 0}function O1(d,t,e,i,r,o){if(t.length==0)return 0;t=new w(t);var u;e!=null&&(u=c(e,11)),u==null&&(u="NonMatch");var h=t.toString();if(h.length==0)u=20;else if(Z.test(h))h=h.replace(Z,""),x(t),t.g(A1(h)),u=1;else{if(h=new RegExp(u),N1(t),u=t.toString(),u.search(h)==0){h=u.match(h)[0].length;var g=u.substring(h).match(w1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=k1(t,i),d!=0)return E(o,1,d),d;throw Error("Invalid country calling code")}return e!=null&&(u=I(e,10),h=""+u,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new w(g.substring(h.length)),g=c(e,1),g=new RegExp(I(g,2)),B1(h,e,null),h=h.toString(),!k(g,t.toString())&&k(g,h)||r1(d,t.toString(),e,-1)==3))?(i.g(h),r&&E(o,6,10),E(o,1,u),u):(E(o,1,0),0)}function B1(d,t,e){var i=d.toString(),r=i.length,o=c(t,15);if(r!=0&&o!=null&&o.length!=0){var u=new RegExp("^(?:"+o+")");if(r=u.exec(i)){o=new RegExp(I(c(t,1),2));var h=k(o,i),g=r.length-1;t=c(t,16),t==null||t.length==0||r[g]==null||r[g].length==0?(!h||k(o,i.substring(r[0].length)))&&(e!=null&&0=t.length)o="";else{var u=t.indexOf(";",o);o=u!==-1?t.substring(o,u):t.substring(o)}var h=o;if(h==null?u=!0:h.length===0?u=!1:(u=S2.exec(h),h=w2.exec(h),u=u!==null||h!==null),!u||(o!=null?(o.charAt(0)==="+"&&r.g(o),o=t.indexOf("tel:"),r.g(t.substring(0<=o?o+4:0,t.indexOf(";phone-context=")))):(o=r.g,u=t??"",h=u.search(v2),0<=h?(u=u.substring(h),u=u.replace(b2,""),h=u.search(I2),0<=h&&(u=u.substring(0,h))):u="",o.call(r,u)),o=r.toString(),u=o.indexOf(";isub="),0t.h.length||(u!=null&&(e=new w,r=new w(t.toString()),B1(r,u,e),d=r1(d,r.toString(),u,-1),d!=2&&d!=4&&d!=5&&(t=r,i&&0d))throw Error("The string supplied is too short to be a phone number");if(17{try{let e=d.replace(/[^+0-9]/g,""),i=new A2(t);t="";for(let r=0;r{try{let r=L.g(),o=V(r,d,t);var i=s1(r,o,-1);return i==0||i==4?r.format(o,typeof e>"u"?0:e):d}catch{return d}}),$("intlTelInputUtilsTemp.getExampleNumber",(d,t,e,i)=>{try{let g=L.g();d:{var r=g;if(n1(d)){var o=i1(H(r,d),e);try{if(D(o,6)){var u=c(o,6),h=G1(r,u,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),$("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(V(L.g(),d,t),3)}catch{return""}}),$("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let u=L.g(),h=V(u,d,t);var e=P1(u,h),i=Y(u,I(h,1),e);if(i==null)var r=-1;else{var o=J(h);r=h1(o,i)}return r}catch{return-99}}),$("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let e=L.g(),i=V(e,d,t);return s1(e,i,-1)}catch(e){return e.message==="Invalid country calling code"?1:3>=d.length||e.message==="Phone number too short after IDD"||e.message==="The string supplied is too short to be a phone number"?2:e.message==="The string supplied is too long to be a phone number"?3:-99}}),$("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=L.g();var e=V(g,d,t),i=P1(g,e);d=g;var r=I(e,1),o=Y(d,r,i);if(o==null||i!="001"&&r!=R1(d,i))var u=!1;else{var h=J(e);u=h1(h,o)!=-1}return u}catch{return!1}}),$("intlTelInputUtilsTemp.isPossibleNumber",(d,t,e)=>{try{let i=L.g(),r=V(i,d,t);return e?s1(i,r,1)===0:s1(i,r,-1)===0}catch{return!1}}),$("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(V(L.g(),d,t),2).toString()}catch{return""}}),$("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),$("intlTelInputUtilsTemp.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1}),$("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var k2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var r2=k2;f1.utils=r2;var s2=f1;import O2,{useRef as o2,useEffect as B2}from"react";var G2=({initialValue:v="",onChangeNumber:$=()=>{},onChangeCountry:n=()=>{},onChangeValidity:s=()=>{},onChangeErrorCode:l=()=>{},usePreciseValidation:a=!1,initOptions:p={},inputProps:m={}})=>{let y=o2(null),C=o2(null),b=()=>{let _=C.current?.getNumber()||"",T=C.current?.getSelectedCountryData().iso2||"";if($(_),n(T),C.current)if(a?C.current.isValidNumberPrecise():C.current.isValidNumber())s(!0),l(null);else{let U=C.current.getValidationError();s(!1),l(U)}};return B2(()=>{let _=y.current;return _&&(C.current=s2(_,p),_.addEventListener("countrychange",b),C.current.promise.then(b)),()=>{_&&_.removeEventListener("countrychange",b),C.current?.destroy()}},[]),O2.createElement("input",{type:"tel",ref:y,onInput:b,defaultValue:v,...m})},$0=G2;export{$0 as default}; +var X1=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["ca","1",1,["204","226","236","249","250","263","289","306","343","354","365","367","368","382","387","403","416","418","428","431","437","438","450","584","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"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],Q1=[];for(let v=0;vv.replace(/\D/g,""),$2=(v="")=>v.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),n2=v=>{let $=u1(v);if($.charAt(0)==="1"){let n=$.substr(1,3);return x2.indexOf(n)!==-1}return!1},P2=(v,$,n,s)=>{if(n===0&&!s)return 0;let l=0;for(let a=0;a<$.length;a++){if(/[+0-9]/.test($[a])&&l++,l===v&&!s)return a+1;if(s&&l===v+1)return a}return $.length},A=(v,$,n)=>{let s=document.createElement(v);return $&&Object.entries($).forEach(([l,a])=>s.setAttribute(l,a)),n&&n.appendChild(s),s},Q=v=>{let{instances:$}=f;Object.values($).forEach(n=>n[v]())},g1=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_handleHiddenInputSubmit;_handleLabelClick;_handleClickSelectedCountry;_handleCountryContainerKeydown;_handleInputEvent;_handleKeydownEvent;_handleWindowScroll;_handleMouseoverCountryList;_handleClickCountryList;_handleClickOffToClose;_handleKeydownOnDropdown;_handleSearchChange;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor($,n={}){this.id=D2++,this.telInput=$,this.highlightedItem=null,this.options=Object.assign({},i2,n),this.hadInitialPlaceholder=!!$.getAttribute("placeholder")}_init(){this.options.useFullscreenPopup&&(this.options.fixDropdownWidth=!1),this.options.separateDialCode&&(this.options.allowDropdown=!0,this.options.nationalMode=!1),!this.options.showFlags&&!this.options.separateDialCode&&(this.options.nationalMode=!1),this.options.useFullscreenPopup&&!this.options.dropdownContainer&&(this.options.dropdownContainer=document.body),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.i18n={...e2,...this.options.i18n};let $=new Promise((s,l)=>{this.resolveAutoCountryPromise=s,this.rejectAutoCountryPromise=l}),n=new Promise((s,l)=>{this.resolveUtilsScriptPromise=s,this.rejectUtilsScriptPromise=l});this.promise=Promise.all([$,n]),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners(),this._initRequests()}_processCountryData(){this._processAllCountries(),this._processDialCodes(),this._translateCountryNames(),this.options.countryOrder&&(this.options.countryOrder=this.options.countryOrder.map($=>$.toLowerCase())),this._sortCountries()}_sortCountries(){this.countries.sort(($,n)=>{let{countryOrder:s}=this.options;if(s){let l=s.indexOf($.iso2),a=s.indexOf(n.iso2),p=l>-1,m=a>-1;if(p||m)return p&&m?l-a:p?-1:1}return $.namen.name?1:0})}_addToDialCodeMap($,n,s){n.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=n.length),this.dialCodeToIso2Map.hasOwnProperty(n)||(this.dialCodeToIso2Map[n]=[]);for(let a=0;al.toLowerCase());this.countries=X.filter(l=>s.indexOf(l.iso2)>-1)}else if(n.length){let s=n.map(l=>l.toLowerCase());this.countries=X.filter(l=>s.indexOf(l.iso2)===-1)}else this.countries=X}_translateCountryNames(){for(let $=0;$
`),p+=`${l.name}`,p+=`+${l.dialCode}`,a.insertAdjacentHTML("beforeend",p)}}_setInitialState($=!1){let n=this.telInput.getAttribute("value"),s=this.telInput.value,a=n&&n.charAt(0)==="+"&&(!s||s.charAt(0)!=="+")?n:s,p=this._getDialCode(a),m=n2(a),{initialCountry:y}=this.options;if(p&&!m)this._updateCountryFromNumber(a);else if(y!=="auto"||$){let C=y?y.toLowerCase():"";C&&this._getCountryData(C,!0)?this._setCountry(C):p&&m?this._setCountry("us"):this._setCountry()}a&&this._updateValFromNumber(a)}_initListeners(){this._initTelInputListeners(),this.options.allowDropdown&&this._initDropdownListeners(),(this.hiddenInput||this.hiddenInputCountry)&&this.telInput.form&&this._initHiddenInputListener()}_initHiddenInputListener(){this._handleHiddenInputSubmit=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.telInput.form?.addEventListener("submit",this._handleHiddenInputSubmit)}_initDropdownListeners(){this._handleLabelClick=n=>{this.dropdownContent.classList.contains("iti__hide")?this.telInput.focus():n.preventDefault()};let $=this.telInput.closest("label");$&&$.addEventListener("click",this._handleLabelClick),this._handleClickSelectedCountry=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.telInput.disabled&&!this.telInput.readOnly&&this._openDropdown()},this.selectedCountry.addEventListener("click",this._handleClickSelectedCountry),this._handleCountryContainerKeydown=n=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),this._openDropdown()),n.key==="Tab"&&this._closeDropdown()},this.countryContainer.addEventListener("keydown",this._handleCountryContainerKeydown)}_initRequests(){this.options.utilsScript&&!f.utils?f.documentReady()?f.loadUtils(this.options.utilsScript):window.addEventListener("load",()=>{f.loadUtils(this.options.utilsScript)}):this.resolveUtilsScriptPromise(),this.options.initialCountry==="auto"&&!this.selectedCountryData.iso2?this._loadAutoCountry():this.resolveAutoCountryPromise()}_loadAutoCountry(){f.autoCountry?this.handleAutoCountry():f.startedLoadingAutoCountry||(f.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function"&&this.options.geoIpLookup(($="")=>{let n=$.toLowerCase();n&&this._getCountryData(n,!0)?(f.autoCountry=n,setTimeout(()=>Q("handleAutoCountry"))):(this._setInitialState(!0),Q("rejectAutoCountryPromise"))},()=>{this._setInitialState(!0),Q("rejectAutoCountryPromise")}))}_initTelInputListeners(){let{strictMode:$,formatAsYouType:n,separateDialCode:s}=this.options,l=!1;this._handleInputEvent=a=>{this._updateCountryFromNumber(this.telInput.value)&&this._triggerCountryChange();let p=a&&a.data&&/[^+0-9]/.test(a.data),m=a&&a.inputType==="insertFromPaste"&&this.telInput.value;if(p||m&&!$?l=!0:/[^+0-9]/.test(this.telInput.value)||(l=!1),n&&!l){let y=this.telInput.selectionStart||0,b=this.telInput.value.substring(0,y).replace(/[^+0-9]/g,"").length,_=a&&a.inputType==="deleteContentForward",T=this._formatNumberAsYouType(),P=P2(b,T,y,_);this.telInput.value=T,this.telInput.setSelectionRange(P,P)}},this.telInput.addEventListener("input",this._handleInputEvent),($||s)&&(this._handleKeydownEvent=a=>{if(a.key&&a.key.length===1&&!a.altKey&&!a.ctrlKey&&!a.metaKey){if(s&&a.key==="+"){a.preventDefault(),this._openDropdown(),this.searchInput.value="+",this._filterCountries("",!0);return}if($){let p=this.telInput.selectionStart===0&&a.key==="+",m=/^[0-9]$/.test(a.key),y=p||m,C=this._getFullNumber(),b=f.utils.getCoreNumber(C,this.selectedCountryData.iso2),_=this.maxCoreNumberLength&&b.length>=this.maxCoreNumberLength;(!y||_)&&a.preventDefault()}}},this.telInput.addEventListener("keydown",this._handleKeydownEvent))}_cap($){let n=parseInt(this.telInput.getAttribute("maxlength")||"",10);return n&&$.length>n?$.substr(0,n):$}_trigger($){let n=new Event($,{bubbles:!0,cancelable:!0});this.telInput.dispatchEvent(n)}_openDropdown(){let{fixDropdownWidth:$}=this.options;$&&(this.dropdownContent.style.width=`${this.telInput.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._setDropdownPosition();let n=this.countryList.firstElementChild;n&&(this._highlightListItem(n,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._bindDropdownListeners(),this.dropdownArrow.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_setDropdownPosition(){if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),!this.options.useFullscreenPopup){let $=this.telInput.getBoundingClientRect(),n=this.telInput.offsetHeight;this.options.dropdownContainer&&(this.dropdown.style.top=`${$.top+n}px`,this.dropdown.style.left=`${$.left}px`,this._handleWindowScroll=()=>this._closeDropdown(),window.addEventListener("scroll",this._handleWindowScroll))}}_bindDropdownListeners(){this._handleMouseoverCountryList=l=>{let a=l.target?.closest(".iti__country");a&&this._highlightListItem(a,!1)},this.countryList.addEventListener("mouseover",this._handleMouseoverCountryList),this._handleClickCountryList=l=>{let a=l.target?.closest(".iti__country");a&&this._selectListItem(a)},this.countryList.addEventListener("click",this._handleClickCountryList);let $=!0;this._handleClickOffToClose=()=>{$||this._closeDropdown(),$=!1},document.documentElement.addEventListener("click",this._handleClickOffToClose),this._handleKeydownOnDropdown=l=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(l.key)&&(l.preventDefault(),l.stopPropagation(),l.key==="ArrowUp"||l.key==="ArrowDown"?this._handleUpDownKey(l.key):l.key==="Enter"?this._handleEnterKey():l.key==="Escape"&&this._closeDropdown())},document.addEventListener("keydown",this._handleKeydownOnDropdown);let n=()=>{let l=this.searchInput.value.trim();l?this._filterCountries(l):this._filterCountries("",!0)},s=null;this._handleSearchChange=()=>{s&&clearTimeout(s),s=setTimeout(()=>{n(),s=null},100)},this.searchInput.addEventListener("input",this._handleSearchChange),this.searchInput.addEventListener("click",l=>l.stopPropagation())}_filterCountries($,n=!1){let s=!0;this.countryList.innerHTML="";let l=$2($);for(let a=0;a1&&(n=$==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),n&&(this._scrollTo(n),this._highlightListItem(n,!1))}_handleEnterKey(){this.highlightedItem&&this._selectListItem(this.highlightedItem)}_updateValFromNumber($){let n=$;if(this.options.formatOnDisplay&&f.utils&&this.selectedCountryData){let s=this.options.nationalMode||n.charAt(0)!=="+"&&!this.options.separateDialCode,{NATIONAL:l,INTERNATIONAL:a}=f.utils.numberFormat,p=s?l:a;n=f.utils.formatNumber(n,this.selectedCountryData.iso2,p)}n=this._beforeSetNumber(n),this.telInput.value=n}_updateCountryFromNumber($){let n=$.indexOf("+"),s=n?$.substring(n):$,l=this.selectedCountryData.dialCode;s&&l==="1"&&s.charAt(0)!=="+"&&(s.charAt(0)!=="1"&&(s=`1${s}`),s=`+${s}`),this.options.separateDialCode&&l&&s.charAt(0)!=="+"&&(s=`+${l}${s}`);let p=this._getDialCode(s,!0),m=u1(s),y=null;if(p){let C=this.dialCodeToIso2Map[u1(p)],b=C.indexOf(this.selectedCountryData.iso2)!==-1&&m.length<=p.length-1;if(!(l==="1"&&n2(m))&&!b){for(let T=0;Tp){let _=l-m;n.scrollTop=b-_}}_updateDialCode($){let n=this.telInput.value,s=`+${$}`,l;if(n.charAt(0)==="+"){let a=this._getDialCode(n);a?l=n.replace(a,s):l=s,this.telInput.value=l}}_getDialCode($,n){let s="";if($.charAt(0)==="+"){let l="";for(let a=0;a<$.length;a++){let p=$.charAt(a);if(!isNaN(parseInt(p,10))){if(l+=p,n)this.dialCodeToIso2Map[l]&&(s=$.substr(0,a+1));else if(this.dialCodes[l]){s=$.substr(0,a+1);break}if(l.length===this.dialCodeMaxLen)break}}}return s}_getFullNumber(){let $=this.telInput.value.trim(),{dialCode:n}=this.selectedCountryData,s,l=u1($);return this.options.separateDialCode&&$.charAt(0)!=="+"&&n&&l?s=`+${n}`:s="",s+$}_beforeSetNumber($){let n=$;if(this.options.separateDialCode){let s=this._getDialCode(n);if(s){s=`+${this.selectedCountryData.dialCode}`;let l=n[s.length]===" "||n[s.length]==="-"?s.length+1:s.length;n=n.substr(l)}}return this._cap(n)}_triggerCountryChange(){this._trigger("countrychange")}_formatNumberAsYouType(){let $=this._getFullNumber(),n=f.utils?f.utils.formatNumberAsYouType($,this.selectedCountryData.iso2):$,{dialCode:s}=this.selectedCountryData;return this.options.separateDialCode&&this.telInput.value.charAt(0)!=="+"&&n.includes(`+${s}`)?(n.split(`+${s}`)[1]||"").trim():n}handleAutoCountry(){this.options.initialCountry==="auto"&&f.autoCountry&&(this.defaultCountry=f.autoCountry,this.telInput.value||this.setCountry(this.defaultCountry),this.resolveAutoCountryPromise())}handleUtils(){f.utils&&(this.telInput.value&&this._updateValFromNumber(this.telInput.value),this.selectedCountryData.iso2&&(this._updatePlaceholder(),this._updateMaxLength())),this.resolveUtilsScriptPromise()}destroy(){if(this.options.allowDropdown){this._closeDropdown(),this.selectedCountry.removeEventListener("click",this._handleClickSelectedCountry),this.countryContainer.removeEventListener("keydown",this._handleCountryContainerKeydown);let s=this.telInput.closest("label");s&&s.removeEventListener("click",this._handleLabelClick)}let{form:$}=this.telInput;this._handleHiddenInputSubmit&&$&&$.removeEventListener("submit",this._handleHiddenInputSubmit),this.telInput.removeEventListener("input",this._handleInputEvent),this._handleKeydownEvent&&this.telInput.removeEventListener("keydown",this._handleKeydownEvent),this.telInput.removeAttribute("data-intl-tel-input-id");let n=this.telInput.parentNode;n?.parentNode?.insertBefore(this.telInput,n),n?.parentNode?.removeChild(n),delete f.instances[this.id]}getExtension(){return f.utils?f.utils.getExtension(this._getFullNumber(),this.selectedCountryData.iso2):""}getNumber($){if(f.utils){let{iso2:n}=this.selectedCountryData;return f.utils.formatNumber(this._getFullNumber(),n,$)}return""}getNumberType(){return f.utils?f.utils.getNumberType(this._getFullNumber(),this.selectedCountryData.iso2):-99}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(f.utils){let{iso2:$}=this.selectedCountryData;return f.utils.getValidationError(this._getFullNumber(),$)}return-99}isValidNumber($=!0){let n=this._getFullNumber();return/\p{L}/u.test(n)?!1:f.utils?f.utils.isPossibleNumber(n,this.selectedCountryData.iso2,$):null}isValidNumberPrecise(){let $=this._getFullNumber();return/\p{L}/u.test($)?!1:f.utils?f.utils.isValidNumber($,this.selectedCountryData.iso2):null}setCountry($){let n=$.toLowerCase();this.selectedCountryData.iso2!==n&&(this._setCountry(n),this._updateDialCode(this.selectedCountryData.dialCode),this._triggerCountryChange())}setNumber($){let n=this._updateCountryFromNumber($);this._updateValFromNumber($),n&&this._triggerCountryChange()}setPlaceholderNumberType($){this.options.placeholderNumberType=$,this._updatePlaceholder()}},R2=v=>!f.utils&&!f.startedLoadingUtilsScript?(f.startedLoadingUtilsScript=!0,new Promise(($,n)=>{import(v).then(({default:s})=>{f.utils=s,Q("handleUtils"),$(!0)}).catch(()=>{Q("rejectUtilsScriptPromise"),n()})})):null,f=Object.assign((v,$)=>{let n=new g1(v,$);return n._init(),v.setAttribute("data-intl-tel-input-id",n.id.toString()),f.instances[n.id]=n,n},{defaults:i2,documentReady:()=>document.readyState==="complete",getCountryData:()=>X,getInstance:v=>{let $=v.getAttribute("data-intl-tel-input-id");return $?f.instances[$]:null},instances:{},loadUtils:R2,version:"23.0.0"}),f1=f;(function(){var v=this||self;function $(d,t){d=d.split(".");var e=v;d[0]in e||typeof e.execScript>"u"||e.execScript("var "+d[0]);for(var i;d.length&&(i=d.shift());)d.length||t===void 0?e[i]&&e[i]!==Object.prototype[i]?e=e[i]:e=e[i]={}:e[i]=t}function n(d,t){function e(){}e.prototype=t.prototype,d.ma=t.prototype,d.prototype=new e,d.prototype.constructor=d,d.sa=function(i,r,o){for(var u=Array(arguments.length-2),h=2;hd.length?!1:k(T2,d)}function A1(d){return k(_2,d)?$1(d,C2):$1(d,a1)}function N1(d){var t=A1(d.toString());x(d),d.g(t)}function M1(d){return d!=null&&(B(d,9)!=1||N(d,9)[0]!=-1)}function $1(d,t){for(var e=new w,i,r=d.length,o=0;ot?2:o[o.length-1]=r&&r<=i;++r)if(e=parseInt(d.substring(0,r),10),e in W)return t.g(d.substring(r)),e;return 0}function O1(d,t,e,i,r,o){if(t.length==0)return 0;t=new w(t);var u;e!=null&&(u=c(e,11)),u==null&&(u="NonMatch");var h=t.toString();if(h.length==0)u=20;else if(Z.test(h))h=h.replace(Z,""),x(t),t.g(A1(h)),u=1;else{if(h=new RegExp(u),N1(t),u=t.toString(),u.search(h)==0){h=u.match(h)[0].length;var g=u.substring(h).match(w1);g&&g[1]!=null&&0=t.h.length)throw Error("Phone number too short after IDD");if(d=k1(t,i),d!=0)return E(o,1,d),d;throw Error("Invalid country calling code")}return e!=null&&(u=I(e,10),h=""+u,g=t.toString(),g.lastIndexOf(h,0)==0&&(h=new w(g.substring(h.length)),g=c(e,1),g=new RegExp(I(g,2)),B1(h,e,null),h=h.toString(),!k(g,t.toString())&&k(g,h)||r1(d,t.toString(),e,-1)==3))?(i.g(h),r&&E(o,6,10),E(o,1,u),u):(E(o,1,0),0)}function B1(d,t,e){var i=d.toString(),r=i.length,o=c(t,15);if(r!=0&&o!=null&&o.length!=0){var u=new RegExp("^(?:"+o+")");if(r=u.exec(i)){o=new RegExp(I(c(t,1),2));var h=k(o,i),g=r.length-1;t=c(t,16),t==null||t.length==0||r[g]==null||r[g].length==0?(!h||k(o,i.substring(r[0].length)))&&(e!=null&&0=t.length)o="";else{var u=t.indexOf(";",o);o=u!==-1?t.substring(o,u):t.substring(o)}var h=o;if(h==null?u=!0:h.length===0?u=!1:(u=S2.exec(h),h=w2.exec(h),u=u!==null||h!==null),!u||(o!=null?(o.charAt(0)==="+"&&r.g(o),o=t.indexOf("tel:"),r.g(t.substring(0<=o?o+4:0,t.indexOf(";phone-context=")))):(o=r.g,u=t??"",h=u.search(v2),0<=h?(u=u.substring(h),u=u.replace(b2,""),h=u.search(I2),0<=h&&(u=u.substring(0,h))):u="",o.call(r,u)),o=r.toString(),u=o.indexOf(";isub="),0t.h.length||(u!=null&&(e=new w,r=new w(t.toString()),B1(r,u,e),d=r1(d,r.toString(),u,-1),d!=2&&d!=4&&d!=5&&(t=r,i&&0d))throw Error("The string supplied is too short to be a phone number");if(17{try{let e=d.replace(/[^+0-9]/g,""),i=new A2(t);t="";for(let r=0;r{try{let r=L.g(),o=V(r,d,t);var i=s1(r,o,-1);return i==0||i==4?r.format(o,typeof e>"u"?0:e):d}catch{return d}}),$("intlTelInputUtilsTemp.getExampleNumber",(d,t,e,i)=>{try{let g=L.g();d:{var r=g;if(n1(d)){var o=i1(H(r,d),e);try{if(D(o,6)){var u=c(o,6),h=G1(r,u,d,!1);break d}}catch{}}h=null}return g.format(h,i?0:t?2:1)}catch{return""}}),$("intlTelInputUtilsTemp.getExtension",(d,t)=>{try{return c(V(L.g(),d,t),3)}catch{return""}}),$("intlTelInputUtilsTemp.getNumberType",(d,t)=>{try{let u=L.g(),h=V(u,d,t);var e=P1(u,h),i=Y(u,I(h,1),e);if(i==null)var r=-1;else{var o=J(h);r=h1(o,i)}return r}catch{return-99}}),$("intlTelInputUtilsTemp.getValidationError",(d,t)=>{try{let e=L.g(),i=V(e,d,t);return s1(e,i,-1)}catch(e){return e.message==="Invalid country calling code"?1:3>=d.length||e.message==="Phone number too short after IDD"||e.message==="The string supplied is too short to be a phone number"?2:e.message==="The string supplied is too long to be a phone number"?3:-99}}),$("intlTelInputUtilsTemp.isValidNumber",(d,t)=>{try{let g=L.g();var e=V(g,d,t),i=P1(g,e);d=g;var r=I(e,1),o=Y(d,r,i);if(o==null||i!="001"&&r!=R1(d,i))var u=!1;else{var h=J(e);u=h1(h,o)!=-1}return u}catch{return!1}}),$("intlTelInputUtilsTemp.isPossibleNumber",(d,t,e)=>{try{let i=L.g(),r=V(i,d,t);return e?s1(i,r,1)===0:s1(i,r,-1)===0}catch{return!1}}),$("intlTelInputUtilsTemp.getCoreNumber",(d,t)=>{try{return c(V(L.g(),d,t),2).toString()}catch{return""}}),$("intlTelInputUtilsTemp.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3}),$("intlTelInputUtilsTemp.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1}),$("intlTelInputUtilsTemp.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5})})();var k2=window.intlTelInputUtilsTemp;delete window.intlTelInputUtilsTemp;var r2=k2;f1.utils=r2;var s2=f1;import O2,{useRef as o2,useEffect as B2}from"react";var G2=({initialValue:v="",onChangeNumber:$=()=>{},onChangeCountry:n=()=>{},onChangeValidity:s=()=>{},onChangeErrorCode:l=()=>{},usePreciseValidation:a=!1,initOptions:p={},inputProps:m={}})=>{let y=o2(null),C=o2(null),b=()=>{let _=C.current?.getNumber()||"",T=C.current?.getSelectedCountryData().iso2||"";if($(_),n(T),C.current)if(a?C.current.isValidNumberPrecise():C.current.isValidNumber())s(!0),l(null);else{let U=C.current.getValidationError();s(!1),l(U)}};return B2(()=>{let _=y.current;return _&&(C.current=s2(_,p),_.addEventListener("countrychange",b),C.current.promise.then(b)),()=>{_&&_.removeEventListener("countrychange",b),C.current?.destroy()}},[]),O2.createElement("input",{type:"tel",ref:y,onInput:b,defaultValue:v,...m})},$0=G2;export{$0 as default}; diff --git a/react/demo/simple-bundle.js b/react/demo/simple-bundle.js index 8d765a3b5..d5689d84c 100644 --- a/react/demo/simple-bundle.js +++ b/react/demo/simple-bundle.js @@ -26288,7 +26288,7 @@ //* A map from instance ID to instance object. instances: {}, loadUtils, - version: "22.0.2" + version: "23.0.0" } ); var intl_tel_input_default = intlTelInput; diff --git a/react/demo/validation-bundle.js b/react/demo/validation-bundle.js index e32283e9c..885a8ec20 100644 --- a/react/demo/validation-bundle.js +++ b/react/demo/validation-bundle.js @@ -26288,7 +26288,7 @@ //* A map from instance ID to instance object. instances: {}, loadUtils, - version: "22.0.2" + version: "23.0.0" } ); var intl_tel_input_default = intlTelInput;