Socket
Socket
Sign inDemoInstall

@impak-finance/vanilla-intl-tel-input

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

2

dist/js/vanilla-intl-tel-input.min.js

@@ -1,1 +0,1 @@

!function(e){var t={};function i(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=0)}([function(e,t,i){i(1),e.exports=i(4)},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},a=function(){function e(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,i,n){return i&&e(t.prototype,i),n&&e(t,n),t}}(),o=s(i(2)),r=s(i(3));function s(e){return e&&e.__esModule?e:{default:e}}function l(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)}var u=function(){function e(t){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.telInput=document.querySelector(t),this.isGoodBrowser=Boolean(this.telInput.setSelectionRange),this.hadInitialPlaceholder=Boolean(this.telInput.placeholder),this.options=n({},o.default,i),this.keys={UP:38,DOWN:40,ENTER:13,ESC:27,PLUS:43,A:65,Z:90,SPACE:32,TAB:9},this.regionlessNanpNumbers=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],this._init()}return a(e,[{key:"_init",value:function(){this.options.nationalMode&&(this.options.autoHideDialCode=!1),this.options.separateDialCode&&(this.options.autoHideDialCode=this.options.nationalMode=!1),this.isMobile=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.isMobile&&(document.querySelector("body").classList.add("iti-mobile"),this.options.dropdownContainer||(this.options.dropdownContainer="body")),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners()}},{key:"_processCountryData",value:function(){this._processAllCountries(),this._processCountryCodes(),this._processPreferredCountries()}},{key:"_addCountryCode",value:function(e,t,i){t in this.countryCodes||(this.countryCodes[t]=[]);var n=i||0;this.countryCodes[t][n]=e}},{key:"_processAllCountries",value:function(){if(this.options.onlyCountries.length){var e=this.options.onlyCountries.map(function(e){return e.toLowerCase()});this.countries=r.default.filter(function(t){return e.includes(t.iso2)})}else if(this.options.excludeCountries.length){var t=this.options.excludeCountries.map(function(e){return e.toLowerCase()});this.countries=r.default.filter(function(e){return t.includes(e.iso2)})}else this.countries=r.default}},{key:"_processCountryCodes",value:function(){this.countryCodes={};var e=!0,t=!1,i=void 0;try{for(var n,a=this.countries[Symbol.iterator]();!(e=(n=a.next()).done);e=!0){var o=n.value;if(this._addCountryCode(o.iso2,o.dialCode,o.priority),o.areaCodes)for(var r in o.areaCodes)this._addCountryCode(o.iso2,o.dialCode+o.areaCodes[r])}}catch(e){t=!0,i=e}finally{try{!e&&a.return&&a.return()}finally{if(t)throw i}}}},{key:"_processPreferredCountries",value:function(){this.preferredCountries=[];var e=!0,t=!1,i=void 0;try{for(var n,a=this.options.preferredCountries[Symbol.iterator]();!(e=(n=a.next()).done);e=!0){var o=n.value.toLowerCase(),r=this._getCountryData(o,!1,!0);r&&(this.preferredCountries=[].concat(l(this.preferredCountries),[r]))}}catch(e){t=!0,i=e}finally{try{!e&&a.return&&a.return()}finally{if(t)throw i}}}},{key:"_generateMarkup",value:function(){this.telInput.setAttribute("autocomplete","off");var e="intl-tel-input";this.options.allowDropdown&&(e+=" allow-dropdown"),this.options.separateDialCode&&(e+=" separate-dial-code");var t=document.createElement("div");t.className=e,this.telInput.parentNode.insertBefore(t,this.telInput),this.telInput=t.appendChild(this.telInput);var i=document.createElement("div");i.className="flag-container",this.flagsContainer=this.telInput.parentNode.insertBefore(i,this.telInput);var n=document.createElement("div");n.className="selected-flag",this.flagsContainer.appendChild(n);var a=document.createElement("div");if(a.className="iti-flag",this.selectedFlagInner=n.appendChild(a),this.options.separateDialCode){var o=document.createElement("div");o.className="selected-dial-code",this.selectedDialCode=n.appendChild(o)}if(this.options.allowDropdown){n.setAttribute("tabindex","0");var r=document.createElement("div");if(r.className="iti-arrow",n.appendChild(r),this.countryList=document.createElement("ul"),this.countryList.className="country-list hide",this.preferredCountries.length){this._appendListItems(this.preferredCountries,"preferred");var s=document.createElement("li");s.className="divider",this.countryList.appendChild(s)}if(this._appendListItems(this.countries,""),this.countryListItems=this.countryList.querySelectorAll(".country"),this.options.dropdownContainer){var l=document.createElement("div");l.className="intl-tel-input iti-container",this.dropdown=this.countryList.appendChild(l)}else this.flagsContainer.appendChild(this.countryList)}if(this.options.hiddenInput){var u=document.createElement("input");u.type="hidden",u.name=this.options.hiddenInput;var d=this.telInput.parentNode;this.hiddenInput=d.insertBefore(u,this.telInput)}}},{key:"_appendListItems",value:function(e,t){var i="",n=!0,a=!1,o=void 0;try{for(var r,s=e[Symbol.iterator]();!(n=(r=s.next()).done);n=!0){var l=r.value;i+='\n <li class="country '+t+'" data-dial-code="'+l.dialCode+'" data-country-code="'+l.iso2+'">\n <div class="flag-box"><div class="iti-flag '+l.iso2+'"></div></div>\n <span class="country-name">'+l.name+"</span>\n <span class='dial-code'>"+l.dialCode+"</span>\n </li>\n "}}catch(e){a=!0,o=e}finally{try{!n&&s.return&&s.return()}finally{if(a)throw o}}this.countryList.insertAdjacentHTML("beforeend",i)}},{key:"_setInitialState",value:function(){var e=this.telInput.value;this._getDialCode(e)&&(!this._isRegionlessNanp(e)||this.options.nationalMode&&!this.options.initialCountry)?this._updateFlagFromNumber(e):"auto"!==this.options.initialCountry&&(this.options.initialCountry?this._setFlag(this.options.initialCountry.toLowerCase()):(this.defaultCountry=this.preferredCountries.length?this.preferredCountries[0].iso2:this.countries[0].iso2,e||this._setFlag(this.defaultCountry)),e||this.options.nationalMode||this.options.autoHideDialCode||this.options.separateDialCode||(this.telInput.value="+"+this.selectedCountryData.dialCode)),e&&this._updateValueFromNumber(e)}},{key:"_initListeners",value:function(){this._initKeyListeners(),this.options.autoHideDialCode&&this._initFocusListeners(),this.options.allowDropdown&&this._initDropdownListeners(),this.hiddenInput&&this._initHiddenInputListener()}},{key:"_initHiddenInputListener",value:function(){var e=this,t=this.telInput.closest("form");t.length&&t.addEventListener("submit",function(){return e.hiddenInput.value=e.getNumber()})}},{key:"_initDropdownListeners",value:function(){var e=this,t=this.telInput.closest("label");t&&t.addEventListener("click",function(t){e.countryList.classList.contains("hide")?e.telInput.focus():t.preventDefault()}),this.selectedFlagInner.parentNode.addEventListener("click",function(){!e.countryList.classList.contains("hide")||e.telInput.disabled||e.telInput.readonly||e._showDropdown()}),this.flagsContainer.addEventListener("keydown",function(t){!e.countryList.classList.contains("hide")||"ArrowUp"!==t.key&&"ArrowDown"!==t.key&&" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),t.stopPropagation(),e._showDropdown()),"Tab"===t.key&&e._closeDropdown()})}},{key:"_initKeyListeners",value:function(){var e=this;this.telInput.addEventListener("keyup",function(){e._updateFlagFromNumber(e.telInput.value)&&e._triggerCountryChange()}),this.telInput.addEventListener("cut paste",function(){setTimeout(function(){e._updateFlagFromNumber(e.telInput.value)&&e._triggerCountryChange()})})}},{key:"_cap",value:function(e){var t=this.telInput.getAttribute("maxlength");return t&&e.length>t?e.substr(0,Number(t)):e}},{key:"_initFocusListeners",value:function(){var e=this;this.telInput.addEventListener("mousedown",function(t){e.telInput===document.activeElement||e.telInput.value||(t.preventDefault(),e.telInput.focus())}),this.telInput.addEventListener("focus",function(){e.telInput.value||e.telInput.readonly||!e.selectedCountryData.dialCode||(e.telInput.value="+"+e.selectedCountryData.dialCode,e.telInput.addEventListener("keydown",function(t){187===t.keyCode&&(e.telInput.value="")}),setTimeout(function(){if(e.isGoodBrowser){var t=e.telInput.value.length;e.telInput.setSelectionRange(t,t)}}))});var t=this.telInput.closest("form");t&&t.addEventListener("submit",function(){return e._removeEmptyDialCode()}),this.telInput.addEventListener("blur",function(){return e._removeEmptyDialCode()})}},{key:"_removeEmptyDialCode",value:function(){var e=this,t=this.telInput.value;if("+"===t.charAt(0)){var i=this._getNumeric(t);i&&this.selectedCountryData.dialCode!==i||(this.telInput.value="")}this.telInput.removeEventListener("keydown",function(t){187===t.keyCode&&(e.telInput.value="")})}},{key:"_getNumeric",value:function(e){return e.replace(/\D/g,"")}},{key:"_showDropdown",value:function(){this._setDropdownPosition();var e=this.countryList.querySelector(".active");e&&(this._highlightListItem(e),this._scrollTo(e)),this._bindDropdownListeners(),document.querySelector(".selected-flag .iti-arrow").classList.add("up");var t=new CustomEvent("open:countrydropdown");this.telInput.dispatchEvent(t)}},{key:"_setDropdownPosition",value:function(){var e=this;if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),this.countryList.classList.remove("hide"),this.dropdownHeight=this.countryList.offsetHeight,!this.isMobile){var t=this.telInput.getBoundingClientRect(),i=t.top,n=window.scrollY,a=i+this.telInput.offsetHeight+this.dropdownHeight<n+window.innerHeight,o=i-this.dropdownHeight>n;if(this.countryList.classList.toggle("dropup",!a&&o),this.options.dropdownContainer){var r=!a&&o?0:this.telInput.offsetHeight;this.dropdown.style.cssText="top: "+(i+r)+"; left: "+t.left,window.addEventListener("scroll",function(){return e._closeDropdown()})}}}},{key:"_bindDropdownListeners",value:function(){var e=this;this.countryList.querySelectorAll(".country").forEach(function(t){t.addEventListener("mouseover",function(t){return e._highlightListItem(t.target)}),t.addEventListener("click",function(t){var i=t.target;i.classList.contains("country")||(i=i.closest(".country")),e._selectListItem(i)})}),document.querySelector("html").addEventListener("click",function(t){return e._closeDropdownEventHandler(t)}),this.query="",this.queryTimer=null,document.addEventListener("keydown",this._queryEventHandler)}},{key:"_closeDropdownEventHandler",value:function(e){e.stopPropagation(),e.target.classList.contains("flag-container")||e.target.classList.contains("selected-flag")||e.target.classList.contains("iti-flag")||e.target.classList.contains("iti-arrow")||(this.dropdownIsOpening||this._closeDropdown(),this.dropdownIsOpening=!1)}},{key:"_queryEventHandler",value:function(e){var t=this;e.preventDefault(),"ArrowUp"===e.key||"ArrowDown"===e.key?this._handleUpDownKey(e.key):"Enter"===e.key?this._handleEnterKey():"Escape"===e.key?this._closeDropdown():(e.keyCode>=65&&e.keyCode<=90||" "===e.key)&&(this.queryTimer&&clearTimeout(this.queryTimer),this.query+=String.fromCharCode(e.keyCode),this._searchForCountry(this.query),this.queryTimer=setTimeout(function(){return t.query=""},1e3))}},{key:"_handleUpDownKey",value:function(e){var t=this.countryList.querySelector(".highlight"),i="ArrowUp"===e?t.previousElementSibling:t.nextElementSibling;i&&(i.classList.contains("divider")&&(i="ArrowUp"===e?i.previousElementSibling:i.nextElementSibling),this._highlightListItem(i),this._scrollTo(i))}},{key:"_handleEnterKey",value:function(){var e=this.countryList.querySelector(".highlight");e&&this._selectListItem(e)}},{key:"_searchForCountry",value:function(e){var t=!0,i=!1,n=void 0;try{for(var a,o=this.countries[Symbol.iterator]();!(t=(a=o.next()).done);t=!0){var r=a.value;if(r.name.startsWith(e)){var s=this.countryList.querySelector('[data-country-code="'+r.iso2+'"]:not(.preferred)');this._highlightListItem(s),this._scrollTo(s,!0);break}}}catch(e){i=!0,n=e}finally{try{!t&&o.return&&o.return()}finally{if(i)throw n}}}},{key:"_updateValueFromNumber",value:function(e){if(this.options.formatOnDisplay&&window.intlTelInputUtils&&this.selectedCountryData){var t=void 0;t=this.options.separateDialCode||!this.options.nationalMode&&"+"===e.charAt(0)?intlTelInputUtils.numberFormat.INTERNATIONAL:intlTelInputUtils.numberFormat.NATIONAL,e=intlTelInputUtils.formatNumber(e,this.selectedCountryData.iso2,t)}e=this._beforeSetNumber(e),this.telInput.value=e}},{key:"_updateFlagFromNumber",value:function(e){e&&this.options.nationalMode&&"1"===this.selectedCountryData.dialCode&&"+"!==e.charAt(0)&&("1"!==e.charAt(0)&&(e="1"+e),e="+"+e);var t=this._getDialCode(e),i=this._getNumeric(e),n=null;if(t){var a=this.countryCodes[this._getNumeric(t)],o=a.includes(this.selectedCountryData.iso2),r="+1"===t&&i.length>=4;if((!("1"===this.selectedCountryData.dialCode)||!this._isRegionlessNanp(i))&&(!o||r)){var s=!0,l=!1,u=void 0;try{for(var d,c=a[Symbol.iterator]();!(s=(d=c.next()).done);s=!0){var h=d.value;h&&(n=h);break}}catch(e){l=!0,u=e}finally{try{!s&&c.return&&c.return()}finally{if(l)throw u}}}}else"+"===e.charAt(0)&&i.length?n="":e&&"+"!==e||(n=this.defaultCountry);return null!==n&&this._setFlag(n)}},{key:"_isRegionlessNanp",value:function(e){var t=this._getNumeric(e);if("1"===t.charAt(0)){var i=t.substr(1,3);return this.regionlessNanpNumbers.includes(i)}return!1}},{key:"_highlightListItem",value:function(e){var t=e.classList.contains("country");this.countryListItems.forEach(function(e){t&&e.classList.remove("highlight")}),t&&e.classList.add("highlight")}},{key:"_getCountryData",value:function(e,t,i){var n=t?r.default:this.countries,a=!0,o=!1,s=void 0;try{for(var l,u=n[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var d=l.value;if(d.iso2===e)return d}}catch(e){o=!0,s=e}finally{try{!a&&u.return&&u.return()}finally{if(o)throw s}}if(i)return null;throw new Error("No country data for "+e)}},{key:"_setFlag",value:function(e){var t=this.selectedCountryData.iso2?this.selectedCountryData:{};this.selectedCountryData=e?this._getCountryData(e,!1,!1):{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.selectedFlagInner.className="",this.selectedFlagInner.classList.add("iti-flag",e);var i=e?this.selectedCountryData.name+": +"+this.selectedCountryData.dialCode:"Unknown";if(this.selectedFlagInner.parentNode.title=i,this.options.separateDialCode){var n=this.selectedCountryData.dialCode?"+"+this.selectedCountryData.dialCode:"",a=this.telInput.parentNode;t.dialCode&&a.classList.remove("iti-sdc-"+(t.dialCode.length+1)),n&&a.classList.add("iti-sdc-"+n.length),this.selectedDialCode.innerText=n}this._updatePlaceholder();var o=!0,r=!1,s=void 0;try{for(var l,u=this.countryListItems[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){l.value.classList.remove("active")}}catch(e){r=!0,s=e}finally{try{!o&&u.return&&u.return()}finally{if(r)throw s}}return e&&this.countryList.querySelector(".iti-flag."+e).closest(".country").classList.add("active"),t.iso2!==e}},{key:"_updatePlaceholder",value:function(){var e="aggressive"===this.options.autoPlaceholder||!this.hadInitialPlaceholder&&(!0===this.options.autoPlaceholder||"polite"===this.options.autoPlaceholder);if(window.intlTelInputUtils&&e){var t=intlTelInputUtils.numberType[this.options.placeholderNumberType],i=this.selectedCountryData.iso2?intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,this.options.nationalMode,t):"";i=this._beforeSetNumber(i),"function"==typeof this.options.customPlaceholder&&(i=this.options.customPlaceholder(i,this.selectedCountryData)),this.telInput.setAttribute("placeholder",i)}}},{key:"_selectListItem",value:function(e){var t=this._setFlag(e.dataset.countryCode);if(this._closeDropdown(),this._updateDialCode(e.dataset.dialCode,!0),this.telInput.focus(),this.isGoodBrowser){var i=this.telInput.value.length;this.telInput.setSelectionRange(i,i)}t&&this._triggerCountryChange()}},{key:"_closeDropdown",value:function(){var e=this;this.countryList.classList.add("hide"),document.querySelector(".selected-flag .iti-arrow").classList.remove("up"),document.removeEventListener("keydown",this._queryEventHandler),document.querySelector("html").removeEventListener("click",this._closeDropdownEventHandler),this.options.dropdownContainer&&(this.isMobile||window.removeEventListener("scroll",function(){return e._closeDropdown()}),this.dropdown.remove());var t=new CustomEvent("close:countrydropdown");this.telInput.dispatchEvent(t)}},{key:"_scrollTo",value:function(e,t){var i=this.countryList,n=i.offsetHeight,a=i.getBoundingClientRect().top,o=a+n,r=e.offsetHeight,s=i.getBoundingClientRect().top,l=s+r,u=n/2-r/2,d=s-a+i.scrollTop;if(s<a)t&&(d-=u),i.scrollTop=d;else if(l>o){t&&(d+=u);var c=n-r;i.scrollTop=d-c}}},{key:"_updateDialCode",value:function(e,t){var i=this.telInput.value,n=void 0;if(e="+"+e,"+"===i.charAt(0)){var a=this._getDialCode(i);n=a?i.replace(a,e):e}else{if(this.options.nationalMode||this.options.separateDialCode)return;if(i)n=e+i;else{if(!t&&this.options.autoHideDialCode)return;n=e}}this.telInput.value=n}},{key:"_getDialCode",value:function(e){var t,i="";if("+"===e.charAt(0))for(var n="",a=0;a<e.length;a++){var o=e.charAt(a);if(t=o,!Array.isArray(t)&&t-parseFloat(t)+1>=0&&(n+=o,this.countryCodes[n]&&(i=e.substr(0,a+1)),4===n.length))break}return i}},{key:"_getFullNumber",value:function(){var e=this.telInput.value.trim(),t=this.selectedCountryData.dialCode,i=this._getNumeric(e),n="1"===i.charAt(0)?i:"1"+i;return(this.options.separateDialCode?"+"+t:"+"!==e.charAt(0)&&"1"!==e.charAt(0)&&t&&"1"===t.charAt(0)&&4===t.length&&t!==n.substr(0,4)?t.substr(1):"")+e}},{key:"_beforeSetNumber",value:function(e){if(this.options.separateDialCode){var t=this._getDialCode(e);if(t){null!==this.selectedCountryData.areaCodes&&(t="+"+this.selectedCountryData.dialCode);var i=" "===e[t.length]||"-"===e[t.length]?t.length+1:t.length;e=e.substr(i)}}return this._cap(e)}},{key:"_triggerCountryChange",value:function(){var e=new CustomEvent("countrychange",{detail:this.selectedCountryData});this.telInput.dispatchEvent(e)}}]),e}();window.IntlTelInput=u,t.default=u},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default={allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:"polite",customPlaceholder:null,dropdownContainer:"",excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,utilsScript:""}},function(e,t,i){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1684"],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1264"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1242"],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1246"],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1441"],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1284"],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1],["Cayman Islands","ky","1345"],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2],["Cocos (Keeling) Islands","cc","61",1],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1473"],["Guadeloupe","gp","590",0],["Guam","gu","1671"],["Guatemala","gt","502"],["Guernsey","gg","44",1],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1876"],["Japan (日本)","jp","81"],["Jersey","je","44",3],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1664"],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1670"],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1721"],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1],["Swaziland","sz","268"],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1649"],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1340"],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1]];for(var a in n){var o=n[a];n[a]={name:o[0],iso2:o[1],dialCode:o[2],priority:o[3]||0,areaCodes:o[4]||null}}t.default=n},function(e,t,i){}]);
!function(t){var e={};function i(n){if(e[n])return e[n].exports;var a=e[n]={i:n,l:!1,exports:{}};return t[n].call(a.exports,a,a.exports,i),a.l=!0,a.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},i.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){i(1),t.exports=i(4)},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])}return t},a=function(){function t(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,i,n){return i&&t(e.prototype,i),n&&t(e,n),e}}(),o=s(i(2)),r=s(i(3));function s(t){return t&&t.__esModule?t:{default:t}}function l(t){if(Array.isArray(t)){for(var e=0,i=Array(t.length);e<t.length;e++)i[e]=t[e];return i}return Array.from(t)}var u=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.telInput=document.querySelector(e),this.isGoodBrowser=Boolean(this.telInput.setSelectionRange),this.hadInitialPlaceholder=Boolean(this.telInput.placeholder),this.options=n({},o.default,i),this.keys={UP:38,DOWN:40,ENTER:13,ESC:27,PLUS:43,A:65,Z:90,SPACE:32,TAB:9},this.regionlessNanpNumbers=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],this._init()}return a(t,[{key:"_init",value:function(){this.options.nationalMode&&(this.options.autoHideDialCode=!1),this.options.separateDialCode&&(this.options.autoHideDialCode=this.options.nationalMode=!1),this.isMobile=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.isMobile&&(document.querySelector("body").classList.add("iti-mobile"),this.options.dropdownContainer||(this.options.dropdownContainer="body")),this.selectedCountryData={},this._processCountryData(),this._generateMarkup(),this._setInitialState(),this._initListeners()}},{key:"_processCountryData",value:function(){this._processAllCountries(),this._processCountryCodes(),this._processPreferredCountries()}},{key:"_addCountryCode",value:function(t,e,i){e in this.countryCodes||(this.countryCodes[e]=[]);var n=i||0;this.countryCodes[e][n]=t}},{key:"_processAllCountries",value:function(){if(this.options.onlyCountries.length){var t=this.options.onlyCountries.map(function(t){return t.toLowerCase()});this.countries=r.default.filter(function(e){return t.includes(e.iso2)})}else if(this.options.excludeCountries.length){var e=this.options.excludeCountries.map(function(t){return t.toLowerCase()});this.countries=r.default.filter(function(t){return e.includes(t.iso2)})}else this.countries=r.default}},{key:"_processCountryCodes",value:function(){this.countryCodes={};var t=!0,e=!1,i=void 0;try{for(var n,a=this.countries[Symbol.iterator]();!(t=(n=a.next()).done);t=!0){var o=n.value;if(this._addCountryCode(o.iso2,o.dialCode,o.priority),o.areaCodes)for(var r in o.areaCodes)this._addCountryCode(o.iso2,o.dialCode+o.areaCodes[r])}}catch(t){e=!0,i=t}finally{try{!t&&a.return&&a.return()}finally{if(e)throw i}}}},{key:"_processPreferredCountries",value:function(){this.preferredCountries=[];var t=!0,e=!1,i=void 0;try{for(var n,a=this.options.preferredCountries[Symbol.iterator]();!(t=(n=a.next()).done);t=!0){var o=n.value.toLowerCase(),r=this._getCountryData(o,!1,!0);r&&(this.preferredCountries=[].concat(l(this.preferredCountries),[r]))}}catch(t){e=!0,i=t}finally{try{!t&&a.return&&a.return()}finally{if(e)throw i}}}},{key:"_generateMarkup",value:function(){this.telInput.setAttribute("autocomplete","off");var t="intl-tel-input";this.options.allowDropdown&&(t+=" allow-dropdown"),this.options.separateDialCode&&(t+=" separate-dial-code");var e=document.createElement("div");e.className=t,this.telInput.parentNode.insertBefore(e,this.telInput),this.telInput=e.appendChild(this.telInput);var i=document.createElement("div");i.className="flag-container",this.flagsContainer=this.telInput.parentNode.insertBefore(i,this.telInput);var n=document.createElement("div");n.className="selected-flag",this.flagsContainer.appendChild(n);var a=document.createElement("div");if(a.className="iti-flag",this.selectedFlagInner=n.appendChild(a),this.options.separateDialCode){var o=document.createElement("div");o.className="selected-dial-code",this.selectedDialCode=n.appendChild(o)}if(this.options.allowDropdown){n.setAttribute("tabindex","0");var r=document.createElement("div");if(r.className="iti-arrow",n.appendChild(r),this.countryList=document.createElement("ul"),this.countryList.className="country-list hide",this.preferredCountries.length){this._appendListItems(this.preferredCountries,"preferred");var s=document.createElement("li");s.className="divider",this.countryList.appendChild(s)}if(this._appendListItems(this.countries,""),this.countryListItems=this.countryList.querySelectorAll(".country"),this.options.dropdownContainer){var l=document.createElement("div");l.className="intl-tel-input iti-container",this.dropdown=this.countryList.appendChild(l)}else this.flagsContainer.appendChild(this.countryList)}if(this.options.hiddenInput){var u=document.createElement("input");u.type="hidden",u.name=this.options.hiddenInput;var d=this.telInput.parentNode;this.hiddenInput=d.insertBefore(u,this.telInput)}}},{key:"_appendListItems",value:function(t,e){var i="",n=!0,a=!1,o=void 0;try{for(var r,s=t[Symbol.iterator]();!(n=(r=s.next()).done);n=!0){var l=r.value;i+='\n <li class="country '+e+'" data-dial-code="'+l.dialCode+'" data-country-code="'+l.iso2+'">\n <div class="flag-box"><div class="iti-flag '+l.iso2+'"></div></div>\n <span class="country-name">'+l.name+"</span>\n <span class='dial-code'>"+l.dialCode+"</span>\n </li>\n "}}catch(t){a=!0,o=t}finally{try{!n&&s.return&&s.return()}finally{if(a)throw o}}this.countryList.insertAdjacentHTML("beforeend",i)}},{key:"_setInitialState",value:function(){var t=this.telInput.value;this._getDialCode(t)&&(!this._isRegionlessNanp(t)||this.options.nationalMode&&!this.options.initialCountry)?this._updateFlagFromNumber(t):"auto"!==this.options.initialCountry&&(this.options.initialCountry?this._setFlag(this.options.initialCountry.toLowerCase()):(this.defaultCountry=this.preferredCountries.length?this.preferredCountries[0].iso2:this.countries[0].iso2,t||this._setFlag(this.defaultCountry)),t||this.options.nationalMode||this.options.autoHideDialCode||this.options.separateDialCode||(this.telInput.value="+"+this.selectedCountryData.dialCode)),t&&this._updateValueFromNumber(t)}},{key:"_initListeners",value:function(){this._initKeyListeners(),this.options.autoHideDialCode&&this._initFocusListeners(),this.options.allowDropdown&&this._initDropdownListeners(),this.hiddenInput&&this._initHiddenInputListener()}},{key:"_initHiddenInputListener",value:function(){var t=this,e=this.telInput.closest("form");e.length&&e.addEventListener("submit",function(){return t.hiddenInput.value=t.getNumber()})}},{key:"_initDropdownListeners",value:function(){var t=this,e=this.telInput.closest("label");e&&e.addEventListener("click",function(e){t.countryList.classList.contains("hide")?t.telInput.focus():e.preventDefault()}),this.selectedFlagInner.parentNode.addEventListener("click",function(){!t.countryList.classList.contains("hide")||t.telInput.disabled||t.telInput.readonly||t._showDropdown()}),this.flagsContainer.addEventListener("keydown",function(e){!t.countryList.classList.contains("hide")||"ArrowUp"!==e.key&&"ArrowDown"!==e.key&&" "!==e.key&&"Enter"!==e.key||(e.preventDefault(),e.stopPropagation(),t._showDropdown()),"Tab"===e.key&&t._closeDropdown()})}},{key:"_initKeyListeners",value:function(){var t=this;this.telInput.addEventListener("keyup",function(){t._updateFlagFromNumber(t.telInput.value)&&t._triggerCountryChange()}),this.telInput.addEventListener("cut paste",function(){setTimeout(function(){t._updateFlagFromNumber(t.telInput.value)&&t._triggerCountryChange()})})}},{key:"_cap",value:function(t){var e=this.telInput.getAttribute("maxlength");return e&&t.length>e?t.substr(0,Number(e)):t}},{key:"_initFocusListeners",value:function(){var t=this;this.telInput.addEventListener("mousedown",function(e){t.telInput===document.activeElement||t.telInput.value||(e.preventDefault(),t.telInput.focus())}),this.telInput.addEventListener("focus",function(){t.telInput.value||t.telInput.readonly||!t.selectedCountryData.dialCode||(t.telInput.value="+"+t.selectedCountryData.dialCode,t.telInput.addEventListener("keydown",function(e){187===e.keyCode&&(t.telInput.value="")}),setTimeout(function(){if(t.isGoodBrowser){var e=t.telInput.value.length;t.telInput.setSelectionRange(e,e)}}))});var e=this.telInput.closest("form");e&&e.addEventListener("submit",function(){return t._removeEmptyDialCode()}),this.telInput.addEventListener("blur",function(){return t._removeEmptyDialCode()})}},{key:"_removeEmptyDialCode",value:function(){var t=this,e=this.telInput.value;if("+"===e.charAt(0)){var i=this._getNumeric(e);i&&this.selectedCountryData.dialCode!==i||(this.telInput.value="")}this.telInput.removeEventListener("keydown",function(e){187===e.keyCode&&(t.telInput.value="")})}},{key:"_getNumeric",value:function(t){return t.replace(/\D/g,"")}},{key:"_showDropdown",value:function(){this._setDropdownPosition();var t=this.countryList.querySelector(".active");t&&(this._highlightListItem(t),this._scrollTo(t)),this._bindDropdownListeners(),document.querySelector(".selected-flag .iti-arrow").classList.add("up");var e=new CustomEvent("open:countrydropdown");this.telInput.dispatchEvent(e)}},{key:"_setDropdownPosition",value:function(){var t=this;if(this.options.dropdownContainer&&this.options.dropdownContainer.appendChild(this.dropdown),this.countryList.classList.remove("hide"),this.dropdownHeight=this.countryList.offsetHeight,!this.isMobile){var e=this.telInput.getBoundingClientRect(),i=e.top,n=window.scrollY,a=i+this.telInput.offsetHeight+this.dropdownHeight<n+window.innerHeight,o=i-this.dropdownHeight>n;if(this.countryList.classList.toggle("dropup",!a&&o),this.options.dropdownContainer){var r=!a&&o?0:this.telInput.offsetHeight;this.dropdown.style.cssText="top: "+(i+r)+"; left: "+e.left,window.addEventListener("scroll",function(){return t._closeDropdown()})}}}},{key:"_bindDropdownListeners",value:function(){var t=this;this.countryList.querySelectorAll(".country").forEach(function(e){e.addEventListener("mouseover",function(e){return t._highlightListItem(e.target)}),e.addEventListener("click",function(e){var i=e.target;i.classList.contains("country")||(i=i.closest(".country")),t._selectListItem(i)})}),document.querySelector("html").addEventListener("click",function(e){return t._closeDropdownEventHandler(e)}),this.query="",this.queryTimer=null,document.addEventListener("keydown",this._queryEventHandler)}},{key:"_closeDropdownEventHandler",value:function(t){t.stopPropagation(),t.target.classList.contains("flag-container")||t.target.classList.contains("selected-flag")||t.target.classList.contains("iti-flag")||t.target.classList.contains("iti-arrow")||(this.dropdownIsOpening||this._closeDropdown(),this.dropdownIsOpening=!1)}},{key:"_queryEventHandler",value:function(t){var e=this;t.preventDefault(),"ArrowUp"===t.key||"ArrowDown"===t.key?this._handleUpDownKey(t.key):"Enter"===t.key?this._handleEnterKey():"Escape"===t.key?this._closeDropdown():(t.keyCode>=65&&t.keyCode<=90||" "===t.key)&&(this.queryTimer&&clearTimeout(this.queryTimer),this.query+=String.fromCharCode(t.keyCode),this._searchForCountry(this.query),this.queryTimer=setTimeout(function(){return e.query=""},1e3))}},{key:"_handleUpDownKey",value:function(t){var e=this.countryList.querySelector(".highlight"),i="ArrowUp"===t?e.previousElementSibling:e.nextElementSibling;i&&(i.classList.contains("divider")&&(i="ArrowUp"===t?i.previousElementSibling:i.nextElementSibling),this._highlightListItem(i),this._scrollTo(i))}},{key:"_handleEnterKey",value:function(){var t=this.countryList.querySelector(".highlight");t&&this._selectListItem(t)}},{key:"_searchForCountry",value:function(t){var e=!0,i=!1,n=void 0;try{for(var a,o=this.countries[Symbol.iterator]();!(e=(a=o.next()).done);e=!0){var r=a.value;if(r.name.startsWith(t)){var s=this.countryList.querySelector('[data-country-code="'+r.iso2+'"]:not(.preferred)');this._highlightListItem(s),this._scrollTo(s,!0);break}}}catch(t){i=!0,n=t}finally{try{!e&&o.return&&o.return()}finally{if(i)throw n}}}},{key:"_updateValueFromNumber",value:function(t){if(this.options.formatOnDisplay&&window.intlTelInputUtils&&this.selectedCountryData){var e=void 0;e=this.options.separateDialCode||!this.options.nationalMode&&"+"===t.charAt(0)?intlTelInputUtils.numberFormat.INTERNATIONAL:intlTelInputUtils.numberFormat.NATIONAL,t=intlTelInputUtils.formatNumber(t,this.selectedCountryData.iso2,e)}t=this._beforeSetNumber(t),this.telInput.value=t}},{key:"_updateFlagFromNumber",value:function(t){t&&this.options.nationalMode&&"1"===this.selectedCountryData.dialCode&&"+"!==t.charAt(0)&&("1"!==t.charAt(0)&&(t="1"+t),t="+"+t);var e=this._getDialCode(t),i=this._getNumeric(t),n=null;if(e){var a=this.countryCodes[this._getNumeric(e)],o=a.includes(this.selectedCountryData.iso2),r="+1"===e&&i.length>=4;if((!("1"===this.selectedCountryData.dialCode)||!this._isRegionlessNanp(i))&&(!o||r)){var s=!0,l=!1,u=void 0;try{for(var d,c=a[Symbol.iterator]();!(s=(d=c.next()).done);s=!0){var h=d.value;h&&(n=h);break}}catch(t){l=!0,u=t}finally{try{!s&&c.return&&c.return()}finally{if(l)throw u}}}}else"+"===t.charAt(0)&&i.length?n="":t&&"+"!==t||(n=this.defaultCountry);return null!==n&&this._setFlag(n)}},{key:"_isRegionlessNanp",value:function(t){var e=this._getNumeric(t);if("1"===e.charAt(0)){var i=e.substr(1,3);return this.regionlessNanpNumbers.includes(i)}return!1}},{key:"_highlightListItem",value:function(t){var e=t.classList.contains("country");this.countryListItems.forEach(function(t){e&&t.classList.remove("highlight")}),e&&t.classList.add("highlight")}},{key:"_getCountryData",value:function(t,e,i){var n=e?r.default:this.countries,a=!0,o=!1,s=void 0;try{for(var l,u=n[Symbol.iterator]();!(a=(l=u.next()).done);a=!0){var d=l.value;if(d.iso2===t)return d}}catch(t){o=!0,s=t}finally{try{!a&&u.return&&u.return()}finally{if(o)throw s}}if(i)return null;throw new Error("No country data for "+t)}},{key:"_setFlag",value:function(t){var e=this.selectedCountryData.iso2?this.selectedCountryData:{};this.selectedCountryData=t?this._getCountryData(t,!1,!1):{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2),this.selectedFlagInner.className="",this.selectedFlagInner.classList.add("iti-flag",t);var i=t?this.selectedCountryData.name+": +"+this.selectedCountryData.dialCode:"Unknown";if(this.selectedFlagInner.parentNode.title=i,this.options.separateDialCode){var n=this.selectedCountryData.dialCode?"+"+this.selectedCountryData.dialCode:"",a=this.telInput.parentNode;e.dialCode&&a.classList.remove("iti-sdc-"+(e.dialCode.length+1)),n&&a.classList.add("iti-sdc-"+n.length),this.selectedDialCode.innerText=n}this._updatePlaceholder();var o=!0,r=!1,s=void 0;try{for(var l,u=this.countryListItems[Symbol.iterator]();!(o=(l=u.next()).done);o=!0){l.value.classList.remove("active")}}catch(t){r=!0,s=t}finally{try{!o&&u.return&&u.return()}finally{if(r)throw s}}return t&&this.countryList.querySelector(".iti-flag."+t).closest(".country").classList.add("active"),e.iso2!==t}},{key:"_updatePlaceholder",value:function(){var t="aggressive"===this.options.autoPlaceholder||!this.hadInitialPlaceholder&&(!0===this.options.autoPlaceholder||"polite"===this.options.autoPlaceholder);if(window.intlTelInputUtils&&t){var e=intlTelInputUtils.numberType[this.options.placeholderNumberType],i=this.selectedCountryData.iso2?intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,this.options.nationalMode,e):"";i=this._beforeSetNumber(i),"function"==typeof this.options.customPlaceholder&&(i=this.options.customPlaceholder(i,this.selectedCountryData)),this.telInput.setAttribute("placeholder",i)}}},{key:"_selectListItem",value:function(t){var e=this._setFlag(t.dataset.countryCode);if(this._closeDropdown(),this._updateDialCode(t.dataset.dialCode,!0),this.telInput.focus(),this.isGoodBrowser){var i=this.telInput.value.length;this.telInput.setSelectionRange(i,i)}e&&this._triggerCountryChange()}},{key:"_closeDropdown",value:function(){var t=this;this.countryList.classList.add("hide"),document.querySelector(".selected-flag .iti-arrow").classList.remove("up"),document.removeEventListener("keydown",this._queryEventHandler),document.querySelector("html").removeEventListener("click",this._closeDropdownEventHandler),this.options.dropdownContainer&&(this.isMobile||window.removeEventListener("scroll",function(){return t._closeDropdown()}),this.dropdown.remove());var e=new CustomEvent("close:countrydropdown");this.telInput.dispatchEvent(e)}},{key:"_scrollTo",value:function(t,e){var i=this.countryList,n=i.offsetHeight,a=i.getBoundingClientRect().top,o=a+n,r=t.offsetHeight,s=i.getBoundingClientRect().top,l=s+r,u=n/2-r/2,d=s-a+i.scrollTop;if(s<a)e&&(d-=u),i.scrollTop=d;else if(l>o){e&&(d+=u);var c=n-r;i.scrollTop=d-c}}},{key:"_updateDialCode",value:function(t,e){var i=this.telInput.value,n=void 0;if(t="+"+t,"+"===i.charAt(0)){var a=this._getDialCode(i);n=a?i.replace(a,t):t}else{if(this.options.nationalMode||this.options.separateDialCode)return;if(i)n=t+i;else{if(!e&&this.options.autoHideDialCode)return;n=t}}this.telInput.value=n}},{key:"_getDialCode",value:function(t){var e,i="";if("+"===t.charAt(0))for(var n="",a=0;a<t.length;a++){var o=t.charAt(a);if(e=o,!Array.isArray(e)&&e-parseFloat(e)+1>=0&&(n+=o,this.countryCodes[n]&&(i=t.substr(0,a+1)),4===n.length))break}return i}},{key:"_getFullNumber",value:function(){var t=this.telInput.value.trim(),e=this.selectedCountryData.dialCode,i=this._getNumeric(t),n="1"===i.charAt(0)?i:"1"+i;return(this.options.separateDialCode?"+"+e:"+"!==t.charAt(0)&&"1"!==t.charAt(0)&&e&&"1"===e.charAt(0)&&4===e.length&&e!==n.substr(0,4)?e.substr(1):"")+t}},{key:"_beforeSetNumber",value:function(t){if(this.options.separateDialCode){var e=this._getDialCode(t);if(e){null!==this.selectedCountryData.areaCodes&&(e="+"+this.selectedCountryData.dialCode);var i=" "===t[e.length]||"-"===t[e.length]?e.length+1:e.length;t=t.substr(i)}}return this._cap(t)}},{key:"_triggerCountryChange",value:function(){var t=new CustomEvent("countrychange",{detail:this.selectedCountryData});this.telInput.dispatchEvent(t)}},{key:"getNumber",value:function(t){return window.intlTelInputUtils?intlTelInputUtils.formatNumber(this._getFullNumber(),this.selectedCountryData.iso2,t):""}}]),t}();window.IntlTelInput=u,e.default=u},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default={allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:"polite",customPlaceholder:null,dropdownContainer:"",excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,utilsScript:""}},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=[["Afghanistan (‫افغانستان‬‎)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (‫الجزائر‬‎)","dz","213"],["American Samoa","as","1684"],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1264"],["Antigua and Barbuda","ag","1268"],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1242"],["Bahrain (‫البحرين‬‎)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1246"],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1441"],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1284"],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","289","306","343","365","387","403","416","418","431","437","438","450","506","514","519","548","579","581","587","604","613","639","647","672","705","709","742","778","780","782","807","819","825","867","873","902","905"]],["Cape Verde (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1],["Cayman Islands","ky","1345"],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","td","235"],["Chile","cl","56"],["China (中国)","cn","86"],["Christmas Island","cx","61",2],["Cocos (Keeling) Islands","cc","61",1],["Colombia","co","57"],["Comoros (‫جزر القمر‬‎)","km","269"],["Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1767"],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (‫مصر‬‎)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1473"],["Guadeloupe","gp","590",0],["Guam","gu","1671"],["Guatemala","gt","502"],["Guernsey","gg","44",1],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (‫ایران‬‎)","ir","98"],["Iraq (‫العراق‬‎)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2],["Israel (‫ישראל‬‎)","il","972"],["Italy (Italia)","it","39",0],["Jamaica","jm","1876"],["Japan (日本)","jp","81"],["Jersey","je","44",3],["Jordan (‫الأردن‬‎)","jo","962"],["Kazakhstan (Казахстан)","kz","7",1],["Kenya","ke","254"],["Kiribati","ki","686"],["Kosovo","xk","383"],["Kuwait (‫الكويت‬‎)","kw","965"],["Kyrgyzstan (Кыргызстан)","kg","996"],["Laos (ລາວ)","la","856"],["Latvia (Latvija)","lv","371"],["Lebanon (‫لبنان‬‎)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (‫ليبيا‬‎)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Macedonia (FYROM) (Македонија)","mk","389"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (‫موريتانيا‬‎)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1664"],["Morocco (‫المغرب‬‎)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["Northern Mariana Islands","mp","1670"],["Norway (Norge)","no","47",0],["Oman (‫عُمان‬‎)","om","968"],["Pakistan (‫پاکستان‬‎)","pk","92"],["Palau","pw","680"],["Palestine (‫فلسطين‬‎)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (‫قطر‬‎)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1869"],["Saint Lucia","lc","1758"],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1784"],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (‫المملكة العربية السعودية‬‎)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1721"],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (‫جنوب السودان‬‎)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්‍රී ලංකාව)","lk","94"],["Sudan (‫السودان‬‎)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1],["Swaziland","sz","268"],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (‫سوريا‬‎)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1868"],["Tunisia (‫تونس‬‎)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1649"],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1340"],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (‫الإمارات العربية المتحدة‬‎)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (‫الصحراء الغربية‬‎)","eh","212",1],["Yemen (‫اليمن‬‎)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1]];for(var a in n){var o=n[a];n[a]={name:o[0],iso2:o[1],dialCode:o[2],priority:o[3]||0,areaCodes:o[4]||null}}e.default=n},function(t,e,i){}]);
{
"name": "@impak-finance/vanilla-intl-tel-input",
"version": "1.0.2",
"version": "1.0.3",
"description": "A vanilla version of the jQuery plugin for entering international telephone numbers",

@@ -5,0 +5,0 @@ "main": "index.js",

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc