react-intl-tel-input
Version:
Telephone input component. Rewrite intl-tel-input in React.js.
7 lines • 48.6 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define(["react","react-dom"],t):"object"==typeof exports?exports.IntlTelInput=t(require("react"),require("react-dom")):e.IntlTelInput=t(e.React,e.ReactDOM)}(this,function(e,t){return function(e){function t(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return e[o].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="./",t(0)}([function(e,t,n){e.exports=n(11)},function(t,n){t.exports=e},function(e,t,n){var o,r;/*!
Copyright (c) 2016 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o))e.push(n.apply(null,o));else if("object"===r)for(var a in o)i.call(o,a)&&o[a]&&e.push(a)}}return e.join(" ")}var i={}.hasOwnProperty;"undefined"!=typeof e&&e.exports?e.exports=n:(o=[],r=function(){return n}.apply(t,o),!(void 0!==r&&(e.exports=r)))}()},function(e,n){e.exports=t},function(e,t){"use strict";function n(e){return e.map(function(e){return{name:e[0],iso2:e[1],dialCode:e[2],priority:e[3]||0,areaCodes:e[4]||null}})}function o(e){a=n(e||i)}function r(){return a||o(),a}Object.defineProperty(t,"__esModule",{value:!0});var i=[["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 (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","wf","681"],["Western Sahara (الصحراء الغربية)","eh","212",1],["Yemen (اليمن)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1]],a=void 0,s={initialize:o,getCountries:r};t["default"]=s},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},i=n(4),a=o(i);t["default"]={arraysEqual:function(e,t){if(e===t)return!0;if(null===e||null===t)return!1;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0},shallowEquals:function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n]){if(!Array.isArray(e[n])||!Array.isArray(t[n]))return!1;if(!this.arraysEqual(e[n],t[n]))return!1}for(var o in t)if(e.hasOwnProperty(o)===!1)return!1;return!0},trim:function(e){var t=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;return e?e.replace(t,""):""},isNumeric:function(e){return e-parseFloat(e)>=0},retrieveLiIndex:function(e){if(!e)return-1;for(var t=e.parentNode.childNodes,n=0,o=0,r=t.length;o<r;o++){if(t[o]===e)return n;1===t[o].nodeType&&"li"===t[o].tagName.toLowerCase()&&n++}return-1},getNumeric:function(e){return e.replace(/\D/g,"")},startsWith:function(e,t){return e.substr(0,t.length).toUpperCase()===t},isWindow:function(e){return null!==e&&e===e.window},getWindow:function(e){return this.isWindow(e)?e:9===e.nodeType&&e.defaultView},offset:function(e){var t=void 0,n=void 0,o={top:0,left:0},i=e&&e.ownerDocument;return t=i.documentElement,"undefined"!==r(e.getBoundingClientRect)&&(o=e.getBoundingClientRect()),n=this.getWindow(i),{top:o.top+n.pageYOffset-t.clientTop,left:o.left+n.pageXOffset-t.clientLeft}},getOuterHeight:function(e){return e.offsetHeight+parseFloat(window.getComputedStyle(e).getPropertyValue("margin-top"))+parseFloat(window.getComputedStyle(e).getPropertyValue("margin-bottom"))},getCountryData:function(e,t,n,o,r){for(var i=n?a["default"].getCountries():e,s=0;s<i.length;s++)if(i[s].iso2===t)return i[s];return o?null:("function"==typeof r&&r(t),{})},hasClass:function(e,t){return e.classList?e.classList.contains(t):!!e.className.match(new RegExp("(\\s|^)"+t+"(\\s|$)"))},addClass:function(e,t){e.classList?e.classList.add(t):this.hasClass(e,t)||(e.className+=" "+t)},removeClass:function(e,t){if(e.classList)e.classList.remove(t);else if(this.hasClass(e,t)){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ")}}}},function(e,t){},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function s(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return e.bind.apply(e,[e].concat(n))}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),u=n(1),d=o(u),p=n(3),c=n(2),h=o(c),f=n(5),y=o(f),g=function(e){function t(){r(this,t);var e=i(this,Object.getPrototypeOf(t).call(this));return e.handleMouseOver=e.handleMouseOver.bind(e),e.setFlag=e.setFlag.bind(e),e.appendListItem=e.appendListItem.bind(e),e.setDropdownPosition=e.setDropdownPosition.bind(e),e}return a(t,e),l(t,[{key:"componentWillReceiveProps",value:function(e){e.showDropdown&&((0,p.findDOMNode)(this.refs.listElement).setAttribute("class","country-list v-hide"),this.setDropdownPosition())}},{key:"shouldComponentUpdate",value:function(e){return!y["default"].shallowEquals(this.props,e)}},{key:"setDropdownPosition",value:function(){y["default"].removeClass((0,p.findDOMNode)(this.refs.listElement),"hide");var e=this.props.inputTop,t=void 0!==window.pageYOffset?window.pageYOffset:(document.documentElement||document.body.parentNode||document.body).scrollTop,n=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,o=this.props.inputOuterHeight,r=y["default"].getOuterHeight((0,p.findDOMNode)(this.refs.listElement)),i=e+o+r<t+n,a=e-r>t,s=!i&&a?"-"+(r-1)+"px":"";(0,p.findDOMNode)(this.refs.listElement).style.top=s,(0,p.findDOMNode)(this.refs.listElement).setAttribute("class","country-list")}},{key:"setFlag",value:function(e){this.props.setFlag(e)}},{key:"appendListItem",value:function(e,t){var n=this,o=this.props.preferredCountries.length;return e.map(function(e,r){var i="preferred"===t?r:r+o,a={country:!0,highlight:n.props.highlightedCountry===i},l=void 0;return a[t]=!0,l=(0,h["default"])(a),d["default"].createElement("li",{key:"country-"+r,className:l,"data-dial-code":e.dialCode,"data-country-code":e.iso2,onMouseOver:n.handleMouseOver,onClick:s(n.setFlag,e.iso2)},d["default"].createElement("div",{ref:"selectedFlag",className:"flag-box"},d["default"].createElement("div",{ref:"selectedFlagInner",className:"iti-flag "+e.iso2})),d["default"].createElement("span",{className:"country-name"},e.name),d["default"].createElement("span",{className:"dial-code"},"+",e.dialCode))})}},{key:"handleMouseOver",value:function(e){if(e.currentTarget.getAttribute("class").indexOf("country")>-1){var t=y["default"].retrieveLiIndex(e.currentTarget);this.props.changeHighlightCountry(!0,t)}}},{key:"render",value:function(){var e="",t=this.props.preferredCountries,n=void 0,o=this.props.countries,r=(0,h["default"])({"country-list":!0,hide:!this.props.showDropdown}),i=void 0;return t.length&&(n=this.appendListItem(t,"preferred"),i=d["default"].createElement("div",{className:"divider"})),e=this.appendListItem(o,""),d["default"].createElement("ul",{ref:"listElement",className:r},n,i,e)}}]),t}(u.Component);g.propTypes={dropdownContainer:u.PropTypes.string,setFlag:u.PropTypes.func,countries:u.PropTypes.array,inputTop:u.PropTypes.number,inputOuterHeight:u.PropTypes.number,preferredCountries:u.PropTypes.array,highlightedCountry:u.PropTypes.number,changeHighlightCountry:u.PropTypes.func,showDropdown:u.PropTypes.bool},t["default"]=g},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(1),u=o(l),d=n(2),p=o(d),c=n(7),h=o(c),f=n(9),y=o(f),g=function(e){function t(){return r(this,t),i(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),s(t,[{key:"render",value:function(){var e=this,t={"iti-flag":!0},n=void 0,o=(0,p["default"])({"iti-arrow":!0,up:this.props.showDropdown}),r=function(){return""};this.props.separateDialCode&&(r=function(){return u["default"].createElement("div",{className:"selected-dial-code"},e.props.dialCode)});var i=function(){return""};this.props.allowDropdown&&(i=function(){return u["default"].createElement("div",{className:o})}),this.props.countryCode&&(t[this.props.countryCode]=!0),n=(0,p["default"])(t);var a=function(){return""};return this.props.dropdownContainer?this.props.showDropdown&&(a=function(){return u["default"].createElement(y["default"],null,u["default"].createElement(h["default"],{ref:"countryList",dropdownContainer:e.props.dropdownContainer,isMobile:e.props.isMobile,showDropdown:e.props.showDropdown,setFlag:e.props.setFlag,countries:e.props.countries,inputTop:e.props.inputTop,inputOuterHeight:e.props.inputOuterHeight,preferredCountries:e.props.preferredCountries,highlightedCountry:e.props.highlightedCountry,changeHighlightCountry:e.props.changeHighlightCountry}))}):a=function(){return u["default"].createElement(h["default"],{ref:"countryList",dropdownContainer:e.props.dropdownContainer,isMobile:e.props.isMobile,showDropdown:e.props.showDropdown,setFlag:e.props.setFlag,countries:e.props.countries,inputTop:e.props.inputTop,inputOuterHeight:e.props.inputOuterHeight,preferredCountries:e.props.preferredCountries,highlightedCountry:e.props.highlightedCountry,changeHighlightCountry:e.props.changeHighlightCountry})},u["default"].createElement("div",{className:"flag-container"},u["default"].createElement("div",{className:"selected-flag",tabIndex:this.props.allowDropdown?"0":"",onClick:this.props.clickSelectedFlag,onKeyDown:this.props.handleSelectedFlagKeydown,title:this.props.titleTip},u["default"].createElement("div",{className:n}),r(),i()),a())}}]),t}(l.Component);g.propTypes={allowDropdown:l.PropTypes.bool,dropdownContainer:l.PropTypes.string,separateDialCode:l.PropTypes.bool,dialCode:l.PropTypes.string,countryCode:l.PropTypes.string,showDropdown:l.PropTypes.bool,clickSelectedFlag:l.PropTypes.func,handleSelectedFlagKeydown:l.PropTypes.func,isMobile:l.PropTypes.bool,setFlag:l.PropTypes.func,countries:l.PropTypes.array,inputTop:l.PropTypes.number,inputOuterHeight:l.PropTypes.number,preferredCountries:l.PropTypes.array,highlightedCountry:l.PropTypes.number,changeHighlightCountry:l.PropTypes.func,titleTip:l.PropTypes.string},t["default"]=g},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(1),u=o(l),d=n(3),p=o(d),c=function(e){function t(){return r(this,t),i(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),s(t,[{key:"componentDidMount",value:function(){this.modalTarget=document.createElement("div"),this.modalTarget.className="intl-tel-input iti-container",document.body.appendChild(this.modalTarget),this._render()}},{key:"componentWillUpdate",value:function(){this._render()}},{key:"componentWillUnmount",value:function(){p["default"].unmountComponentAtNode(this.modalTarget),document.body.removeChild(this.modalTarget)}},{key:"_render",value:function(){p["default"].render(u["default"].createElement("div",null,this.props.children),this.modalTarget)}},{key:"render",value:function(){return u["default"].createElement("noscript",null)}}]),t}(l.Component);c.propTypes={children:l.PropTypes.object},t["default"]=c},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(1),u=o(l),d=function(e){function t(){return r(this,t),i(this,Object.getPrototypeOf(t).apply(this,arguments))}return a(t,e),s(t,[{key:"render",value:function(){return u["default"].createElement("input",{type:"tel",autoComplete:"off",className:this.props.className,disabled:!!this.props.disabled&&"disabled",readOnly:!!this.props.readonly&&"readonly",name:this.props.fieldName,id:this.props.fieldId,value:this.props.value,placeholder:this.props.placeholder,onChange:this.props.handleInputChange,onBlur:this.props.handleOnBlur,autoFocus:this.props.autoFocus})}}]),t}(l.Component);d.propTypes={className:l.PropTypes.string,disabled:l.PropTypes.bool,readonly:l.PropTypes.bool,fieldName:l.PropTypes.string,fieldId:l.PropTypes.string,value:l.PropTypes.string,placeholder:l.PropTypes.string,handleInputChange:l.PropTypes.func,handleKeyPress:l.PropTypes.func,handleOnBlur:l.PropTypes.func,autoFocus:l.PropTypes.bool},t["default"]=d},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),l=n(1),u=o(l),d=n(3),p=n(2),c=o(p),h=n(4),f=o(h),y=n(8),g=o(y),m=n(10),C=o(m),b=n(5),v=o(b),w=n(12),D=o(w);n(6);var k=function(e){function t(e){r(this,t);var n=i(this,Object.getPrototypeOf(t).call(this,e));return n.wrapperClass={},n.autoCountry="",n.tempCountry="",n.startedLoadingAutoCountry=!1,n.deferreds=[],n.autoCountryDeferred=new D["default"].Deferred,n.utilsScriptDeferred=new D["default"].Deferred,n.isOpening=!1,n.isMobile=/Android.+Mobile|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),n.preferredCountries=[],n.countries=[],n.countryCodes={},n.windowLoaded=!1,n.keys={UP:38,DOWN:40,ENTER:13,ESC:27,PLUS:43,A:65,Z:90,SPACE:32,TAB:9},n.query="",n.state={showDropdown:!1,highlightedCountry:0,value:"",disabled:e.disabled,readonly:!1,offsetTop:0,outerHeight:0,placeholder:"",title:"",countryCode:"us",dialCode:""},n.selectedCountryData={},n.addCountryCode=n.addCountryCode.bind(n),n.autoCountryLoaded=n.autoCountryLoaded.bind(n),n.getDialCode=n.getDialCode.bind(n),n.handleOnBlur=n.handleOnBlur.bind(n),n.handleSelectedFlagKeydown=n.handleSelectedFlagKeydown.bind(n),n.setInitialState=n.setInitialState.bind(n),n.setNumber=n.setNumber.bind(n),n.scrollTo=n.scrollTo.bind(n),n.notifyPhoneNumberChange=n.notifyPhoneNumberChange.bind(n),n.isValidNumber=n.isValidNumber.bind(n),n.isValidNumberForRegion=n.isValidNumberForRegion.bind(n),n.isUnknownNanp=n.isUnknownNanp.bind(n),n.initRequests=n.initRequests.bind(n),n.updateFlagFromNumber=n.updateFlagFromNumber.bind(n),n.updatePlaceholder=n.updatePlaceholder.bind(n),n.loadAutoCountry=n.loadAutoCountry.bind(n),n.loadUtils=n.loadUtils.bind(n),n.processCountryData=n.processCountryData.bind(n),n.getNumber=n.getNumber.bind(n),n.setFlag=n.setFlag.bind(n),n.clickSelectedFlag=n.clickSelectedFlag.bind(n),n.updateValFromNumber=n.updateValFromNumber.bind(n),n.handleWindowScroll=n.handleWindowScroll.bind(n),n.handleDocumentKeyDown=n.handleDocumentKeyDown.bind(n),n.handleDocumentClick=n.handleDocumentClick.bind(n),n.bindDocumentClick=n.bindDocumentClick.bind(n),n.unbindDocumentClick=n.unbindDocumentClick.bind(n),n.searchForCountry=n.searchForCountry.bind(n),n.handleEnterKey=n.handleEnterKey.bind(n),n.toggleDropdown=n.toggleDropdown.bind(n),n.handleUpDownKey=n.handleUpDownKey.bind(n),n.handleInputChange=n.handleInputChange.bind(n),n.changeHighlightCountry=n.changeHighlightCountry.bind(n),n}return a(t,e),s(t,[{key:"componentDidMount",value:function(){var e=this;this.initialPlaceholder=this.props.placeholder,this.autoHideDialCode=this.props.autoHideDialCode,this.allowDropdown=this.props.allowDropdown,this.nationalMode=this.props.nationalMode,this.dropdownContainer="",this.nationalMode&&(this.autoHideDialCode=!1),this.props.separateDialCode&&(this.autoHideDialCode=!1,this.nationalMode=!1,this.allowDropdown=!0),this.processCountryData.call(this),this.tempCountry=this.getTempCountry(this.props.defaultCountry),"complete"===document.readyState?this.windowLoaded=!0:window.addEventListener("load",function(){e.windowLoaded=!0}),this.generateMarkup(),this.setInitialState(),this.initRequests(),this.deferreds.push(this.autoCountryDeferred.promise()),this.deferreds.push(this.utilsScriptDeferred.promise()),D["default"].when(this.deferreds).done(function(){e.setInitialState()}),document.addEventListener("keydown",this.handleDocumentKeyDown)}},{key:"componentWillUpdate",value:function(e,t){t.showDropdown?(document.addEventListener("keydown",this.handleDocumentKeyDown),this.bindDocumentClick()):(document.removeEventListener("keydown",this.handleDocumentKeyDown),this.unbindDocumentClick())}},{key:"componentDidUpdate",value:function(e,t){t.value!==this.state.value&&this.notifyPhoneNumberChange(this.state.value)}},{key:"componentWillReceiveProps",value:function(e){this.props.value!==e.value&&this.setState({value:e.value})}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleDocumentKeyDown),this.unbindDocumentClick()}},{key:"getTempCountry",value:function(e){if("auto"===e)return"auto";var t=v["default"].getCountryData(this.countries,e);return t.iso2||(t=this.props.preferredCountries.length>0?v["default"].getCountryData(this.countries,this.props.preferredCountries[0]):f["default"].getCountries()[0]),t.iso2}},{key:"setNumber",value:function(e,t){this.updateFlagFromNumber(e),this.updateValFromNumber(e,!t)}},{key:"getExtension",value:function(){return window.intlTelInputUtils?window.intlTelInputUtils.getExtension(this.getFullNumber(),this.selectedCountryData.iso2):""}},{key:"getNumber",value:function(e){return window.intlTelInputUtils?window.intlTelInputUtils.formatNumber(this.getFullNumber(),this.selectedCountryData.iso2,e):""}},{key:"generateMarkup",value:function(){this.wrapperClass["allow-dropdown"]=this.allowDropdown,this.wrapperClass["separate-dial-code"]=this.props.separateDialCode,this.isMobile&&(v["default"].addClass(document.querySelector("body"),"iti-mobile"),this.dropdownContainer="body",window.addEventListener("scroll",this.handleWindowScroll))}},{key:"autoCountryLoaded",value:function(){"auto"===this.tempCountry&&(this.tempCountry=this.autoCountry,this.autoCountryDeferred.resolve())}},{key:"loadUtils",value:function(){var e=this;if(window.intlTelInputUtils)return void this.utilsScriptDeferred.resolve();var t=new XMLHttpRequest;t.open("GET",this.props.utilsScript,!0),t.onload=function(){if(t.status>=200&&t.status<400){var n=t.responseText;if(n&&!document.getElementById("intlTelInputUtils")){var o=document.getElementsByTagName("body")[0],r=document.createElement("script");r.id="intlTelInputUtils",r.text=n,o.appendChild(r)}e.utilsScriptDeferred.resolve()}},t.send()}},{key:"handleSelectedFlagKeydown",value:function(e){this.state.showDropdown||e.which!==this.keys.UP&&e.which!==this.keys.DOWN&&e.which!==this.keys.SPACE&&e.which!==this.keys.ENTER||(e.preventDefault(),e.stopPropagation(),this.toggleDropdown(!0)),e.which===this.keys.TAB&&this.toggleDropdown(!1)}},{key:"processCountryData",value:function(){f["default"].initialize(this.props.countriesData),this.processAllCountries.call(this),this.processCountryCodes.call(this),this.processPreferredCountries.call(this)}},{key:"addCountryCode",value:function(e,t,n,o){n in e||(e[n]=[]);var r=o||0;return e[n][r]=t,e}},{key:"filterCountries",value:function(e,t){var n=void 0;for(n=0;n<e.length;n++)e[n]=e[n].toLowerCase();for(this.countries=[],n=0;n<f["default"].getCountries().length;n++)t(e.indexOf(f["default"].getCountries()[n].iso2))&&this.countries.push(f["default"].getCountries()[n])}},{key:"processAllCountries",value:function(){this.props.onlyCountries.length?this.filterCountries(this.props.onlyCountries,function(e){return e!==-1}):this.props.excludeCountries.length?this.filterCountries(this.props.excludeCountries,function(e){return e===-1}):this.countries=f["default"].getCountries()}},{key:"processCountryCodes",value:function(){this.countryCodes={};for(var e=0;e<this.countries.length;e++){var t=this.countries[e];if(this.addCountryCode(this.countryCodes,t.iso2,t.dialCode,t.priority),t.areaCodes)for(var n=0;n<t.areaCodes.length;n++)this.addCountryCode(this.countryCodes,t.iso2,t.dialCode+t.areaCodes[n])}}},{key:"processPreferredCountries",value:function(){this.preferredCountries=[];for(var e=0,t=this.props.preferredCountries.length;e<t;e++){var n=this.props.preferredCountries[e].toLowerCase(),o=v["default"].getCountryData(this.countries,n,!0);o&&this.preferredCountries.push(o)}}},{key:"setInitialState",value:function(){var e=this.props.value||"";this.getDialCode(e)?this.updateFlagFromNumber(e,!0):"auto"!==this.tempCountry&&(this.tempCountry?this.setFlag(this.tempCountry,!0):(this.defaultCountry=this.preferredCountries.length?this.preferredCountries[0].iso2:this.countries[0].iso2,e||this.setFlag(this.defaultCountry,!0)),e||this.nationalMode||this.autoHideDialCode||this.props.separateDialCode||this.setState({value:"+"+this.selectedCountryData.dialCode})),e&&this.updateValFromNumber(e,this.props.formatOnInit)}},{key:"initRequests",value:function(){var e=this;this.props.utilsScript?this.windowLoaded?this.loadUtils():window.addEventListener("load",function(){e.loadUtils()}):this.utilsScriptDeferred.resolve(),"auto"===this.tempCountry?this.loadAutoCountry():this.autoCountryDeferred.resolve()}},{key:"loadAutoCountry",value:function(){var e=this,t=void 0!==window.localStorage?window.localStorage.getItem("itiAutoCountry"):"";t&&(this.autoCountry=t),this.autoCountry?this.autoCountryLoaded():this.startedLoadingAutoCountry||(this.startedLoadingAutoCountry=!0,
"function"==typeof this.props.geoIpLookup&&this.props.geoIpLookup(function(t){e.autoCountry=t.toLowerCase(),void 0!==window.localStorage&&window.localStorage.setItem("itiAutoCountry",e.autoCountry),e.autoCountryLoaded()}))}},{key:"cap",value:function(e){var t=(0,d.findDOMNode)(this.refs.telInput).getAttribute("maxlength");return t&&e.length>t?e.substr(0,t):e}},{key:"removeEmptyDialCode",value:function(){var e=this.state.value,t="+"===e.charAt(0);if(t){var n=v["default"].getNumeric(e);n&&this.selectedCountryData.dialCode!==n||this.setState({value:""})}}},{key:"handleUpDownKey",value:function(e){var t=(0,d.findDOMNode)(this.refs.flagDropDown).querySelectorAll(".highlight")[0],n=t?t.previousElementSibling:void 0,o=t?t.nextElementSibling:void 0,r=e===this.keys.UP?n:o;if(r){r.getAttribute("class").indexOf("divider")>-1&&(r=e===this.keys.UP?r.previousElementSibling:r.nextElementSibling),this.scrollTo(r);var i=v["default"].retrieveLiIndex(r);this.setState({showDropdown:!0,highlightedCountry:i})}}},{key:"handleEnterKey",value:function(){var e=this,t=(0,d.findDOMNode)(this.refs.flagDropDown).querySelectorAll(".highlight")[0];if(t){var n=v["default"].retrieveLiIndex(t),o=t.getAttribute("data-country-code");this.setState({showDropdown:!1,highlightedCountry:n,countryCode:o},function(){e.setFlag(e.state.countryCode),e.unbindDocumentClick()})}}},{key:"searchForCountry",value:function(e){for(var t=0,n=this.countries.length;t<n;t++)if(v["default"].startsWith(this.countries[t].name,e)){var o=(0,d.findDOMNode)(this.refs.flagDropDown).querySelector('.country-list [data-country-code="'+this.countries[t].iso2+'"]:not(.preferred)'),r=v["default"].retrieveLiIndex(o);this.setState({showDropdown:!0,highlightedCountry:r}),this.scrollTo(o,!0);break}}},{key:"updateValFromNumber",value:function(e,t){var n=this;if(t&&window.intlTelInputUtils&&this.selectedCountryData){var o=this.props.separateDialCode||!this.nationalMode&&"+"===e.charAt(0)?window.intlTelInputUtils.numberFormat.INTERNATIONAL:window.intlTelInputUtils.numberFormat.NATIONAL;e=window.intlTelInputUtils.formatNumber(e,this.selectedCountryData.iso2,o)}e=this.beforeSetNumber(e),this.setState({showDropdown:!1,value:e},function(){n.unbindDocumentClick()})}},{key:"updateFlagFromNumber",value:function(e,t){e&&this.nationalMode&&this.selectedCountryData&&"1"===this.selectedCountryData.dialCode&&"+"!==e.charAt(0)&&("1"!==e.charAt(0)&&(e="1"+e),e="+"+e);var n=this.getDialCode(e),o=null;if(n){var r=this.countryCodes[v["default"].getNumeric(n)],i=this.selectedCountryData&&r.indexOf(this.selectedCountryData.iso2)!==-1;if(!i||this.isUnknownNanp(e,n))for(var a=0;a<r.length;a++)if(r[a]){o=r[a];break}}else"+"===e.charAt(0)&&v["default"].getNumeric(e).length?o="":e&&"+"!==e||(o=this.defaultCountry);null!==o&&this.setFlag(o,t)}},{key:"isUnknownNanp",value:function(e,t){return"+1"===t&&v["default"].getNumeric(e).length>=4}},{key:"setFlag",value:function(e,t){var n=this,o=this.selectedCountryData&&this.selectedCountryData.iso2?this.selectedCountryData:{};this.selectedCountryData=e?v["default"].getCountryData(this.countries,e,!1,!1,this.props.noCountryDataHandler):{},this.selectedCountryData.iso2&&(this.defaultCountry=this.selectedCountryData.iso2);var r=e?this.selectedCountryData.name+": +"+this.selectedCountryData.dialCode:"Unknown",i=this.state.dialCode;this.props.separateDialCode&&(i=this.selectedCountryData.dialCode?"+"+this.selectedCountryData.dialCode:"",o.dialCode&&delete this.wrapperClass["iti-sdc-"+(o.dialCode.length+1)],i&&(this.wrapperClass["iti-sdc-"+i.length]=!0));var a=0;if(e&&"auto"!==e){for(var s=0,l=this.countries.length;s<l;s++)this.countries[s].iso2===e&&(a=s);a+=this.preferredCountries.length}this.state.showDropdown&&(0,d.findDOMNode)(this.refs.telInput).focus(),this.setState({showDropdown:!1,highlightedCountry:a,countryCode:e,title:r,dialCode:i},function(){if(n.updatePlaceholder(),n.wrapperClass.active=!1,!t&&o.iso2!==e&&"function"==typeof n.props.onSelectFlag){var r=n.state.value,i=n.selectedCountryData.iso2,a=n.isValidNumberForRegion(r,i);n.props.onSelectFlag(a,r,n.selectedCountryData)}})}},{key:"handleOnBlur",value:function(){if(this.removeEmptyDialCode(),"function"==typeof this.props.onPhoneNumberBlur){var e=this.state.value,t=this.isValidNumber(e),n=this.formatFullNumber(e);this.props.onPhoneNumberBlur(t,e,this.selectedCountryData,n,this.getExtension())}}},{key:"bindDocumentClick",value:function(){this.isOpening=!0,document.querySelector("html").addEventListener("click",this.handleDocumentClick)}},{key:"unbindDocumentClick",value:function(){document.querySelector("html").removeEventListener("click",this.handleDocumentClick)}},{key:"clickSelectedFlag",value:function(){var e=this;this.state.showDropdown||this.state.disabled||this.state.readonly||this.setState({showDropdown:!0,offsetTop:v["default"].offset((0,d.findDOMNode)(this.refs.telInput)).top,outerHeight:v["default"].getOuterHeight((0,d.findDOMNode)(this.refs.telInput))},function(){var t=(0,d.findDOMNode)(e.refs.flagDropDown).querySelector(".highlight");t&&e.scrollTo(t,!0)})}},{key:"updatePlaceholder",value:function(){if(this.initialPlaceholder)this.setState({placeholder:this.initialPlaceholder});else if(window.intlTelInputUtils&&this.props.autoPlaceholder&&this.selectedCountryData){var e=window.intlTelInputUtils.numberType[this.props.numberType],t=this.selectedCountryData.iso2?window.intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2,this.nationalMode,e):"";t=this.beforeSetNumber(t),"function"==typeof this.props.customPlaceholder&&(t=this.props.customPlaceholder(t,this.selectedCountryData)),this.setState({placeholder:t})}}},{key:"toggleDropdown",value:function(e){var t=this;this.setState({showDropdown:!!e},function(){t.state.showDropdown||t.unbindDocumentClick()})}},{key:"scrollTo",value:function(e,t){try{var n=(0,d.findDOMNode)(this.refs.flagDropDown).querySelector(".country-list"),o=parseFloat(window.getComputedStyle(n).getPropertyValue("height"),10),r=v["default"].offset(n).top,i=r+o,a=v["default"].getOuterHeight(e),s=v["default"].offset(e).top,l=s+a,u=o/2-a/2,p=s-r+n.scrollTop;if(s<r)t&&(p-=u),n.scrollTop=p;else if(l>i){t&&(p+=u);var c=o-a;n.scrollTop=p-c}}catch(h){}}},{key:"getDialCode",value:function(e){var t="";if("+"===e.charAt(0))for(var n="",o=0,r=e.length;o<r;o++){var i=e.charAt(o);if(v["default"].isNumeric(i)&&(n+=i,this.countryCodes[n]&&(t=e.substr(0,o+1)),4===n.length))break}return t}},{key:"getFullNumber",value:function(){var e=this.props.separateDialCode?"+"+this.selectedCountryData.dialCode:"";return e+this.state.value}},{key:"isValidNumber",value:function(e){var t=v["default"].trim(e),n=this.nationalMode?this.selectedCountryData.iso2:"";return!!window.intlTelInputUtils&&window.intlTelInputUtils.isValidNumber(t,n)}},{key:"isValidNumberForRegion",value:function(e,t){var n=v["default"].trim(e);return!!window.intlTelInputUtils&&window.intlTelInputUtils.isValidNumberForRegion(n,t)}},{key:"formatFullNumber",value:function(e){return window.intlTelInputUtils?this.getNumber(window.intlTelInputUtils.numberFormat.INTERNATIONAL):e}},{key:"notifyPhoneNumberChange",value:function(e){if("function"==typeof this.props.onPhoneNumberChange){var t=this.isValidNumber(e),n=this.formatFullNumber(e);this.props.onPhoneNumberChange(t,e,this.selectedCountryData,n,this.getExtension())}}},{key:"beforeSetNumber",value:function(e){if(this.props.separateDialCode){var t=this.getDialCode(e);if(t){null!==this.selectedCountryData.areaCodes&&(t="+"+this.selectedCountryData.dialCode);var n=" "===e[t.length]||"-"===e[t.length]?t.length+1:t.length;e=e.substr(n)}}return this.cap(e)}},{key:"handleWindowScroll",value:function(){var e=this;this.setState({showDropdown:!1},function(){window.removeEventListener("scroll",e.handleDocumentScroll)})}},{key:"handleDocumentKeyDown",value:function(e){var t=this,n=void 0;e.preventDefault(),e.which===this.keys.UP||e.which===this.keys.DOWN?this.handleUpDownKey(e.which):e.which===this.keys.ENTER?this.handleEnterKey():e.which===this.keys.ESC?this.setState({showDropdown:!1}):(e.which>=this.keys.A&&e.which<=this.keys.Z||e.which===this.keys.SPACE)&&(n&&clearTimeout(n),this.query||(this.query=""),this.query+=String.fromCharCode(e.which),this.searchForCountry(this.query),n=setTimeout(function(){t.query=""},1e3))}},{key:"handleDocumentClick",value:function(e){(null===e.target.getAttribute("class")||e.target.getAttribute("class")&&e.target.getAttribute("class").indexOf("country")===-1)&&(this.isOpening=!1),this.isOpening||this.toggleDropdown(!1),this.isOpening=!1}},{key:"handleInputChange",value:function(e){var t=this;this.setState({value:e.target.value},function(){t.updateFlagFromNumber(t.state.value)})}},{key:"changeHighlightCountry",value:function(e,t){this.setState({showDropdown:e,highlightedCountry:t})}},{key:"render",value:function(){this.wrapperClass[this.props.css[0]]=!0;var e=this.props.css[1];this.state.showDropdown&&(this.wrapperClass.expanded=!0);var t=(0,c["default"])(this.wrapperClass),n=this.selectedCountryData?this.selectedCountryData.name+": +"+this.selectedCountryData.dialCode:"Unknown";return u["default"].createElement("div",{className:t},u["default"].createElement(g["default"],{ref:"flagDropDown",allowDropdown:this.allowDropdown,dropdownContainer:this.dropdownContainer,separateDialCode:this.props.separateDialCode,dialCode:this.state.dialCode,clickSelectedFlag:this.clickSelectedFlag,setFlag:this.setFlag,countryCode:this.state.countryCode,isMobile:this.isMobile,handleSelectedFlagKeydown:this.handleSelectedFlagKeydown,changeHighlightCountry:this.changeHighlightCountry,countries:this.countries,showDropdown:this.state.showDropdown,inputTop:this.state.offsetTop,inputOuterHeight:this.state.outerHeight,preferredCountries:this.preferredCountries,highlightedCountry:this.state.highlightedCountry,titleTip:n}),u["default"].createElement(C["default"],{ref:"telInput",handleInputChange:this.handleInputChange,handleOnBlur:this.handleOnBlur,className:e,disabled:this.state.disabled,readonly:this.state.readonly,fieldName:this.props.fieldName,fieldId:this.props.fieldId,value:this.state.value,placeholder:this.state.placeholder,autoFocus:this.props.autoFocus}))}}]),t}(l.Component);k.defaultProps={css:["intl-tel-input",""],fieldName:"",fieldId:"",value:"",countriesData:null,allowDropdown:!0,autoHideDialCode:!0,autoPlaceholder:!0,customPlaceholder:null,excludeCountries:[],formatOnInit:!0,separateDialCode:!1,defaultCountry:"",geoIpLookup:null,nationalMode:!0,numberType:"MOBILE",noCountryDataHandler:null,onlyCountries:[],preferredCountries:["us","gb"],utilsScript:"",onPhoneNumberChange:null,onPhoneNumberBlur:null,onSelectFlag:null,disabled:!1,autoFocus:!1},k.propTypes={css:l.PropTypes.arrayOf(l.PropTypes.string),fieldName:l.PropTypes.string,fieldId:l.PropTypes.string,value:l.PropTypes.string,countriesData:l.PropTypes.arrayOf(l.PropTypes.array),allowDropdown:l.PropTypes.bool,autoHideDialCode:l.PropTypes.bool,autoPlaceholder:l.PropTypes.bool,customPlaceholder:l.PropTypes.func,excludeCountries:l.PropTypes.arrayOf(l.PropTypes.string),formatOnInit:l.PropTypes.bool,separateDialCode:l.PropTypes.bool,defaultCountry:l.PropTypes.string,geoIpLookup:l.PropTypes.func,nationalMode:l.PropTypes.bool,numberType:l.PropTypes.string,noCountryDataHandler:l.PropTypes.func,onlyCountries:l.PropTypes.arrayOf(l.PropTypes.string),preferredCountries:l.PropTypes.arrayOf(l.PropTypes.string),utilsScript:l.PropTypes.string,onPhoneNumberChange:l.PropTypes.func,onPhoneNumberBlur:l.PropTypes.func,onSelectFlag:l.PropTypes.func,disabled:l.PropTypes.bool,placeholder:l.PropTypes.string,autoFocus:l.PropTypes.bool},t["default"]=k},function(e,t){!function(t){function n(e){var t=C[e]={};return p(e.split(/\s+/),function(e){t[e]=!0}),t}var o={},r=Array.prototype,i=Object.prototype,a=i.hasOwnProperty,s=i.toString,l=r.forEach,u=r.indexOf,d=r.slice,p=function(e,t,n){var r,i,s;if(e)if(l&&e.forEach===l)e.forEach(t,n);else if(e.length===+e.length){for(i=0,s=e.length;i<s;i++)if(i in e&&t.call(n,e[i],i,e)===o)return}else for(r in e)if(a.call(e,r)&&t.call(n,e[r],r,e)===o)return},c=function(e){return!!(e&&e.constructor&&e.call&&e.apply)},h=function(e){return p(d.call(arguments,1),function(t){var n;for(n in t)void 0!==t[n]&&(e[n]=t[n])}),e},f=function(e,t,n){var o;if(t){if(u)return u.call(t,e,n);for(o=t.length,n=n?n<0?Math.max(0,o+n):n:0;n<o;n++)if(n in t&&t[n]===e)return n}return-1},y={};p("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){y["[object "+e+"]"]=e.toLowerCase()});var g=function(e){return null==e?String(e):y[s.call(e)]||"object"},m={},C={};m.Callbacks=function(e){e="string"==typeof e?C[e]||n(e):h({},e);var t,o,r,i,a,s,l=[],u=!e.once&&[],d=function(n){for(t=e.memory&&n,o=!0,s=i||0,i=0,a=l.length,r=!0;l&&s<a;s++)if(l[s].apply(n[0],n[1])===!1&&e.stopOnFalse){t=!1;break}r=!1,l&&(u?u.length&&d(u.shift()):t?l=[]:c.disable())},c={add:function(){if(l){var n=l.length;!function o(t){p(t,function(t){var n=g(t);"function"===n?e.unique&&c.has(t)||l.push(t):t&&t.length&&"string"!==n&&o(t)})}(arguments),r?a=l.length:t&&(i=n,d(t))}return this},remove:function(){return l&&p(arguments,function(e){for(var t;(t=f(e,l,t))>-1;)l.splice(t,1),r&&(t<=a&&a--,t<=s&&s--)}),this},has:function(e){return f(e,l)>-1},empty:function(){return l=[],this},disable:function(){return l=u=t=void 0,this},disabled:function(){return!l},lock:function(){return u=void 0,t||c.disable(),this},locked:function(){return!u},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!l||o&&!u||(r?u.push(t):d(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!o}};return c},m.Deferred=function(e){var t=[["resolve","done",m.Callbacks("once memory"),"resolved"],["reject","fail",m.Callbacks("once memory"),"rejected"],["notify","progress",m.Callbacks("memory")]],n="pending",o={state:function(){return n},always:function(){return r.done(arguments).fail(arguments),this},then:function(){var e=arguments;return m.Deferred(function(n){p(t,function(t,o){var i=t[0],a=e[o];r[t[1]](c(a)?function(){var e;try{e=a.apply(this,arguments)}catch(t){return void n.reject(t)}e&&c(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n["notify"!==i?"resolveWith":i+"With"](this===r?n:this,[e])}:n[i])}),e=null}).promise()},promise:function(e){return null!=e?h(e,o):o}},r={};return o.pipe=o.then,p(t,function(e,i){var a=e[2],s=e[3];o[e[1]]=a.add,s&&a.add(function(){n=s},t[1^i][2].disable,t[2][2].lock),r[e[0]]=a.fire,r[e[0]+"With"]=a.fireWith}),o.promise(r),e&&e.call(r,r),r},m.when=function(e){var t,n,o,r=0,i="array"===g(e)&&1===arguments.length?e:d.call(arguments),a=i.length,s=1!==a||e&&c(e.promise)?a:0,l=1===s?e:m.Deferred(),u=function(e,n,o){return function(r){n[e]=this,o[e]=arguments.length>1?d.call(arguments):r,o===t?l.notifyWith(n,o):--s||l.resolveWith(n,o)}};if(a>1)for(t=new Array(a),n=new Array(a),o=new Array(a);r<a;r++)i[r]&&c(i[r].promise)?i[r].promise().done(u(r,o,i)).fail(l.reject).progress(u(r,n,t)):--s;return s||l.resolveWith(o,i),l.promise()},"undefined"!=typeof e&&e.exports?e.exports=m:"undefined"!=typeof t._?t._.mixin(m):t._=m}(this)}])});