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