UNPKG

react-phone-number-input

Version:
12 lines 190 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("React")):"function"==typeof define&&define.amd?define("react-phone-number-input",["React"],e):"object"==typeof exports?exports["react-phone-number-input"]=e(require("React")):t["react-phone-number-input"]=e(t.React)}(window,function(t){return function(t){var e={};function d(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,d),r.l=!0,r.exports}return d.m=t,d.c=e,d.d=function(t,e,n){d.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:n})},d.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},d.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return d.d(e,"a",e),e},d.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},d.p="",d(d.s=24)}([function(t,e,d){"use strict";d.r(e);var n=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name=this.constructor.name,this.message=e,this.stack=new Error(e).stack},r=n;(n.prototype=Object.create(Error.prototype)).constructor=n;var a=2,o=17,i=3,u="0-90-9٠-٩۰-۹",$="-‐-―−ー-//..  ­​⁠ ()()[]\\[\\]~⁓∼~";function l(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments[1];return new RegExp("^(?:"+e+")$").test(t)}var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c=function(){function t(t,e){for(var d=0;d<e.length;d++){var n=e[d];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,d,n){return d&&t(e.prototype,d),n&&t(e,n),e}}();function f(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var h="1.2.0",p=" ext. ",y=function(){function t(e){f(this,t),function(t){if(!t)throw new Error("[libphonenumber-js] `metadata` argument not passed. Check your arguments.");if(!C(t)||!C(t.countries)||!C(t.country_calling_codes)&&!C(t.country_phone_code_to_countries))throw new Error("[libphonenumber-js] `metadata` argument was passed but it's not a valid metadata. Must be an object having `.countries` and `.country_calling_codes` child object properties. Got "+(C(t)?"an object of shape: { "+Object.keys(t).join(", ")+" }":"a "+_(t)+": "+t)+".")}(e),this.metadata=e,this.v1=!e.version,this.v2=void 0!==e.version&&-1===function(t,e){for(var d=t.split("."),n=e.split("."),r=0;r<3;r++){var a=Number(d[r]),o=Number(n[r]);if(a>o)return 1;if(o>a)return-1;if(!isNaN(a)&&isNaN(o))return 1;if(isNaN(a)&&!isNaN(o))return-1}return 0}(e.version,h),this.v3=void 0!==e.version}return c(t,[{key:"hasCountry",value:function(t){return void 0!==this.metadata.countries[t]}},{key:"country",value:function(t){if(!t)return this._country=void 0,this.country_metadata=void 0,this;if(!this.hasCountry(t))throw new Error("Unknown country: "+t);return this._country=t,this.country_metadata=this.metadata.countries[t],this}},{key:"getDefaultCountryMetadataForRegion",value:function(){return this.metadata.countries[this.countryCallingCodes()[this.countryCallingCode()][0]]}},{key:"countryCallingCode",value:function(){return this.country_metadata[0]}},{key:"IDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.country_metadata[1]}},{key:"defaultIDDPrefix",value:function(){if(!this.v1&&!this.v2)return this.country_metadata[12]}},{key:"nationalNumberPattern",value:function(){return this.v1||this.v2?this.country_metadata[1]:this.country_metadata[2]}},{key:"possibleLengths",value:function(){if(!this.v1)return this.country_metadata[this.v2?2:3]}},{key:"_getFormats",value:function(t){return t[this.v1?2:this.v2?3:4]}},{key:"formats",value:function(){var t=this,e=this._getFormats(this.country_metadata)||this._getFormats(this.getDefaultCountryMetadataForRegion())||[];return e.map(function(e){return new v(e,t)})}},{key:"nationalPrefix",value:function(){return this.country_metadata[this.v1?3:this.v2?4:5]}},{key:"_getNationalPrefixFormattingRule",value:function(t){return t[this.v1?4:this.v2?5:6]}},{key:"nationalPrefixFormattingRule",value:function(){return this._getNationalPrefixFormattingRule(this.country_metadata)||this._getNationalPrefixFormattingRule(this.getDefaultCountryMetadataForRegion())}},{key:"nationalPrefixForParsing",value:function(){return this.country_metadata[this.v1?5:this.v2?6:7]||this.nationalPrefix()}},{key:"nationalPrefixTransformRule",value:function(){return this.country_metadata[this.v1?6:this.v2?7:8]}},{key:"_getNationalPrefixIsOptionalWhenFormatting",value:function(){return!!this.country_metadata[this.v1?7:this.v2?8:9]}},{key:"nationalPrefixIsOptionalWhenFormatting",value:function(){return this._getNationalPrefixIsOptionalWhenFormatting(this.country_metadata)||this._getNationalPrefixIsOptionalWhenFormatting(this.getDefaultCountryMetadataForRegion())}},{key:"leadingDigits",value:function(){return this.country_metadata[this.v1?8:this.v2?9:10]}},{key:"types",value:function(){return this.country_metadata[this.v1?9:this.v2?10:11]}},{key:"hasTypes",value:function(){return(!this.types()||0!==this.types().length)&&!!this.types()}},{key:"type",value:function(t){if(this.hasTypes()&&b(this.types(),t))return new g(b(this.types(),t),this)}},{key:"ext",value:function(){return this.v1||this.v2?p:this.country_metadata[13]||p}},{key:"countryCallingCodes",value:function(){return this.v1?this.metadata.country_phone_code_to_countries:this.metadata.country_calling_codes}},{key:"chooseCountryByCountryCallingCode",value:function(t){var e=this.countryCallingCodes()[t][0];this.hasCountry(e)&&this.country(e)}},{key:"selectedCountry",value:function(){return this._country}}]),t}(),m=y,v=function(){function t(e,d){f(this,t),this._format=e,this.metadata=d}return c(t,[{key:"pattern",value:function(){return this._format[0]}},{key:"format",value:function(){return this._format[1]}},{key:"leadingDigitsPatterns",value:function(){return this._format[2]||[]}},{key:"nationalPrefixFormattingRule",value:function(){return this._format[3]||this.metadata.nationalPrefixFormattingRule()}},{key:"nationalPrefixIsOptionalWhenFormatting",value:function(){return!!this._format[4]||this.metadata.nationalPrefixIsOptionalWhenFormatting()}},{key:"nationalPrefixIsMandatoryWhenFormatting",value:function(){return this.usesNationalPrefix()&&!this.nationalPrefixIsOptionalWhenFormatting()}},{key:"usesNationalPrefix",value:function(){return this.nationalPrefixFormattingRule()&&"$1"!==this.nationalPrefixFormattingRule()&&/\d/.test(this.nationalPrefixFormattingRule().replace("$1",""))}},{key:"internationalFormat",value:function(){return this._format[5]||this.format()}}]),t}(),g=function(){function t(e,d){f(this,t),this.type=e,this.metadata=d}return c(t,[{key:"pattern",value:function(){return this.metadata.v1?this.type:this.type[0]}},{key:"possibleLengths",value:function(){if(!this.metadata.v1)return this.type[1]||this.metadata.possibleLengths()}}]),t}();function b(t,e){switch(e){case"FIXED_LINE":return t[0];case"MOBILE":return t[1];case"TOLL_FREE":return t[2];case"PREMIUM_RATE":return t[3];case"PERSONAL_NUMBER":return t[4];case"VOICEMAIL":return t[5];case"UAN":return t[6];case"PAGER":return t[7];case"VOIP":return t[8];case"SHARED_COST":return t[9]}}var C=function(t){return"object"===(void 0===t?"undefined":s(t))},_=function(t){return void 0===t?"undefined":s(t)};function N(t,e){return(e=new y(e)).hasCountry(t)?e.country(t).ext():p}function S(t,e){if((e=new y(e)).hasCountry(t))return e.country(t).countryCallingCode();throw new Error("Unknown country: "+t)}function P(t,e){return void 0!==e.countries[t]}var I=";ext=",x="(["+u+"]{1,7})";function O(t){var e="xx##~~";switch(t){case"parsing":e=",;"+e}return I+x+"|[  \\t,]*(?:e?xt(?:ensi(?:ó?|ó))?n?|e?xtn?|доб|["+e+"]|int|anexo|int)[:\\..]?[  \\t,-]*"+x+"#?|[- ]+(["+u+"]{1,5})#"}var E=O("parsing"),w=O("matching"),A=new RegExp("(?:"+E+")$","i");var R=new RegExp("^"+("["+u+"]{"+a+"}")+"$|^"+("[++]{0,1}(?:["+$+"]*["+u+"]){3,}["+$+u+"]*")+"(?:"+E+")?$","i");function T(t){return t.length>=a&&R.test(t)}var M={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","0":"0","1":"1","2":"2","3":"3","4":"4","5":"5","6":"6","7":"7","8":"8","9":"9","٠":"0","١":"1","٢":"2","٣":"3","٤":"4","٥":"5","٦":"6","٧":"7","٨":"8","٩":"9","۰":"0","۱":"1","۲":"2","۳":"3","۴":"4","۵":"5","۶":"6","۷":"7","۸":"8","۹":"9"};function F(t){return M[t]}function k(t){var e="",d=t.split(""),n=Array.isArray(d),r=0;for(d=n?d:d[Symbol.iterator]();;){var a;if(n){if(r>=d.length)break;a=d[r++]}else{if((r=d.next()).done)break;a=r.value}var o=F(a);o&&(e+=o)}return e}function L(t){var e="",d=t.split(""),n=Array.isArray(d),r=0;for(d=n?d:d[Symbol.iterator]();;){var a;if(n){if(r>=d.length)break;a=d[r++]}else{if((r=d.next()).done)break;a=r.value}e+=B(a,e)||""}return e}function B(t,e){if("+"===t){if(e)return;return"+"}return F(t)}var D=["MOBILE","PREMIUM_RATE","TOLL_FREE","SHARED_COST","VOIP","PERSONAL_NUMBER","PAGER","UAN","VOICEMAIL"];function G(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=arguments[2];if(t.country){if(!(d=new m(d)).hasCountry(t.country))throw new Error("Unknown country: "+t.country);var n=e.v2?t.nationalNumber:t.phone;if(d.country(t.country),l(n,d.nationalNumberPattern())){if(U(n,"FIXED_LINE",d))return d.type("MOBILE")&&""===d.type("MOBILE").pattern()?"FIXED_LINE_OR_MOBILE":d.type("MOBILE")?U(n,"MOBILE",d)?"FIXED_LINE_OR_MOBILE":"FIXED_LINE":"FIXED_LINE_OR_MOBILE";var r=D,a=Array.isArray(r),o=0;for(r=a?r:r[Symbol.iterator]();;){var i;if(a){if(o>=r.length)break;i=r[o++]}else{if((o=r.next()).done)break;i=o.value}var u=i;if(U(n,u,d))return u}}}}function U(t,e,d){return!(!(e=d.type(e))||!e.pattern())&&(!(e.possibleLengths()&&e.possibleLengths().indexOf(t.length)<0)&&l(t,e.pattern()))}function j(t,e,d){var n=d.type(e),r=n&&n.possibleLengths()||d.possibleLengths();if("FIXED_LINE_OR_MOBILE"===e){if(!d.type("FIXED_LINE"))return j(t,"MOBILE",d);var a=d.type("MOBILE");a&&(r=function(t,e){var d=t.slice(),n=e,r=Array.isArray(n),a=0;for(n=r?n:n[Symbol.iterator]();;){var o;if(r){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var i=o;t.indexOf(i)<0&&d.push(i)}return d.sort(function(t,e){return t-e})}(r,a.possibleLengths()))}else if(e&&!n)return"INVALID_LENGTH";var o=t.length,i=r[0];return i===o?"IS_POSSIBLE":i>o?"TOO_SHORT":r[r.length-1]<o?"TOO_LONG":r.indexOf(o,1)>=0?"IS_POSSIBLE":"INVALID_LENGTH"}function K(t,e,d){switch(j(t,void 0,d)){case"IS_POSSIBLE":return!0;default:return!1}}var W=new RegExp("(["+u+"])"),V=/^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;var H=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var d=[],n=!0,r=!1,a=void 0;try{for(var o,i=t[Symbol.iterator]();!(n=(o=i.next()).done)&&(d.push(o.value),!e||d.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{!n&&i.return&&i.return()}finally{if(r)throw a}}return d}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function Z(t){var e=void 0,d=void 0,n=(t=t.replace(/^tel:/,"tel=")).split(";"),r=Array.isArray(n),a=0;for(n=r?n:n[Symbol.iterator]();;){var o;if(r){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var i=o.split("="),u=H(i,2),$=u[0],l=u[1];switch($){case"tel":e=l;break;case"ext":d=l;break;case"phone-context":"+"===l[0]&&(e=l+e)}}if(!T(e))return{};var s={number:e};return d&&(s.ext=d),s}function Y(t){var e=t.number,d=t.ext;if(!e)return"";if("+"!==e[0])throw new Error('"formatRFC3966()" expects "number" to be in E.164 format.');return"tel:"+e+(d?";ext="+d:"")}function q(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=arguments[2];if(d=new m(d),!t.country)return!1;if(!d.hasCountry(t.country))throw new Error("Unknown country: "+t.country);return d.country(t.country),d.hasTypes()?void 0!==G(t,e,d.metadata):l(e.v2?t.nationalNumber:t.phone,d.nationalNumberPattern())}var z=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n])}return t},J={formatExtension:function(t,e,d){return""+t+d.ext()+e}};function X(t,e,d,n){if(d=d?z({},J,d):J,n=new m(n),t.country){if(!n.hasCountry(t.country))throw new Error("Unknown country: "+t.country);n.country(t.country)}else{if(!t.countryCallingCode)return t.phone||"";n.chooseCountryByCountryCallingCode(t.countryCallingCode)}var r=n.countryCallingCode(),a=d.v2?t.nationalNumber:t.phone;switch(e){case"NATIONAL":return a?nt(et(a,"NATIONAL",n),t.ext,n,d.formatExtension):"";case"INTERNATIONAL":return a?nt("+"+r+" "+et(a,"INTERNATIONAL",n),t.ext,n,d.formatExtension):"+"+r;case"E.164":return"+"+r+a;case"RFC3966":return Y({number:"+"+r+a,ext:t.ext});case"IDD":if(!d.fromCountry)return;var o=function(t,e){var d=new m(e);return d.country(t),V.test(d.IDDPrefix())?d.IDDPrefix():d.defaultIDDPrefix()}(d.fromCountry,n.metadata);if(!o)return;if(d.humanReadable){var i=r&&function(t,e,d,n){var r=new m(n.metadata);if(r.country(d),e===r.countryCallingCode())return"1"===e?e+" "+et(t,"NATIONAL",n):et(t,"NATIONAL",n)}(a,n.countryCallingCode(),d.fromCountry,n);return nt(i||o+" "+r+" "+et(a,"INTERNATIONAL",n),t.ext,n,d.formatExtension)}return""+o+r+a;default:throw new Error('Unknown "format" argument passed to "formatNumber()": "'+e+'"')}}var Q=/(\$\d)/;function tt(t,e,d,n,r){var a=t.replace(new RegExp(e.pattern()),d?e.internationalFormat():!e.nationalPrefixFormattingRule()||e.nationalPrefixIsOptionalWhenFormatting()&&!n?e.format():e.format().replace(Q,e.nationalPrefixFormattingRule()));return d?dt(a):a}function et(t,e,d){var n=function(t,e){for(var d=t,n=Array.isArray(d),r=0,d=n?d:d[Symbol.iterator]();;){var a;if(n){if(r>=d.length)break;a=d[r++]}else{if((r=d.next()).done)break;a=r.value}var o=a;if(o.leadingDigitsPatterns().length>0){var i=o.leadingDigitsPatterns()[o.leadingDigitsPatterns().length-1];if(0!==e.search(i))continue}if(l(e,o.pattern()))return o}}(d.formats(),t);return n?tt(t,n,"INTERNATIONAL"===e,!0):t}function dt(t){return t.replace(new RegExp("["+$+"]+","g")," ").trim()}function nt(t,e,d,n){return e?n(t,e,d):t}var rt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n])}return t},at=function(){function t(t,e){for(var d=0;d<e.length;d++){var n=e[d];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,d,n){return d&&t(e.prototype,d),n&&t(e,n),e}}();var ot=function(){function t(e,d,n){if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e)throw new TypeError("`countryCallingCode` not passed");if(!d)throw new TypeError("`nationalNumber` not passed");if(it(e)){this.country=e;var r=new m(n);r.country(e),e=r.countryCallingCode()}this.countryCallingCode=e,this.nationalNumber=d,this.number="+"+this.countryCallingCode+this.nationalNumber,this.metadata=n}return at(t,[{key:"isPossible",value:function(){return function(t,e,d){if(void 0===e&&(e={}),d=new m(d),e.v2){if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");d.chooseCountryByCountryCallingCode(t.countryCallingCode)}else{if(!t.phone)return!1;if(t.country){if(!d.hasCountry(t.country))throw new Error("Unknown country: "+t.country);d.country(t.country)}else{if(!t.countryCallingCode)throw new Error("Invalid phone number object passed");d.chooseCountryByCountryCallingCode(t.countryCallingCode)}}if(!d.possibleLengths())throw new Error("Metadata too old");return K(t.phone||t.nationalNumber,0,d)}(this,{v2:!0},this.metadata)}},{key:"isValid",value:function(){return q(this,{v2:!0},this.metadata)}},{key:"getType",value:function(){return G(this,{v2:!0},this.metadata)}},{key:"format",value:function(t,e){return X(this,t,e?rt({},e,{v2:!0}):{v2:!0},this.metadata)}},{key:"formatNational",value:function(t){return this.format("NATIONAL",t)}},{key:"formatInternational",value:function(t){return this.format("INTERNATIONAL",t)}},{key:"getURI",value:function(t){return this.format("RFC3966",t)}}]),t}(),it=function(t){return/^[A-Z]{2}$/.test(t)},ut=250,$t=new RegExp("[++"+u+"]"),lt=new RegExp("[^"+u+"]+$");function st(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},d=arguments[2];if(d=new m(d),e.defaultCountry&&!d.hasCountry(e.defaultCountry)){if(e.v2)throw new r("INVALID_COUNTRY");throw new Error("Unknown country: "+e.defaultCountry)}var n=function(t,e){if(t&&0===t.indexOf("tel:"))return Z(t);var d=ct(t,e);if(!d||!T(d))return{};var n=function(t){var e=t.search(A);if(e<0)return{};for(var d=t.slice(0,e),n=t.match(A),r=1;r<n.length;){if(null!=n[r]&&n[r].length>0)return{number:d,ext:n[r]};r++}}(d);if(n.ext)return n;return{number:d}}(t,e.v2),i=n.number,u=n.ext;if(!i){if(e.v2)throw new r("NOT_A_NUMBER");return{}}var $=function(t,e,d){var n=pt(t,e,d.metadata),r=n.countryCallingCode,a=n.number;if(!a)return{countryCallingCode:r};var o=void 0;if(r)d.chooseCountryByCountryCallingCode(r);else{if(!e)return{};d.country(e),o=e,r=S(e,d.metadata)}var i=function(t,e){var d=L(t),n=void 0,r=ft(d,e),a=r.number,o=r.carrierCode;if(e.possibleLengths())switch(j(a,void 0,e)){case"TOO_SHORT":case"INVALID_LENGTH":break;default:d=a,n=o}else l(d,e.nationalNumberPattern())&&!l(a,e.nationalNumberPattern())||(d=a,n=o);return{national_number:d,carrier_code:n}}(a,d),u=i.national_number,$=i.carrier_code,s=ht(r,u,d);s&&(o=s,d.country(o));return{country:o,countryCallingCode:r,national_number:u,carrierCode:$}}(i,e.defaultCountry,d),s=$.country,c=$.national_number,f=$.countryCallingCode,h=$.carrierCode;if(!d.selectedCountry()){if(e.v2)throw new r("INVALID_COUNTRY");return{}}if(c.length<a){if(e.v2)throw new r("TOO_SHORT");return{}}if(c.length>o){if(e.v2)throw new r("TOO_LONG");return{}}if(e.v2){var p=new ot(f,c,d.metadata);return s&&(p.country=s),h&&(p.carrierCode=h),u&&(p.ext=u),p}var y=!(!s||!l(c,d.nationalNumberPattern()));return e.extended?{country:s,countryCallingCode:f,carrierCode:h,valid:y,possible:!!y||!0===e.extended&&d.possibleLengths()&&K(c,0,d),phone:c,ext:u}:y?function(t,e,d){var n={country:t,phone:e};d&&(n.ext=d);return n}(s,c,u):{}}function ct(t,e){if(t)if(t.length>ut){if(e)throw new r("TOO_LONG")}else{var d=t.search($t);if(!(d<0))return t.slice(d).replace(lt,"")}}function ft(t,e){if(!t||!e.nationalPrefixForParsing())return{number:t};var d=new RegExp("^(?:"+e.nationalPrefixForParsing()+")"),n=d.exec(t);if(!n)return{number:t};var r=void 0,a=n.length-1;if(e.nationalPrefixTransformRule()&&n[a])r=t.replace(d,e.nationalPrefixTransformRule());else{var o=n[0];r=t.slice(o.length)}var i=void 0;return a>0&&(i=n[1]),{number:r,carrierCode:i}}function ht(t,e,d){var n=d.countryCallingCodes()[t];return 1===n.length?n[0]:function(t,e,d){d=new m(d);for(var n=t,r=Array.isArray(n),a=0,n=r?n:n[Symbol.iterator]();;){var o;if(r){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}var i=o;if(d.country(i),d.leadingDigits()){if(e&&0===e.search(d.leadingDigits()))return i}else if(G({phone:e,country:i},void 0,d.metadata))return i}}(n,e,d.metadata)}function pt(t,e,d){if(!(t=L(t)))return{};if("+"!==t[0]){var n=function(t,e,d){if(e){var n=new m(d);n.country(e);var r=new RegExp(n.IDDPrefix());if(0===t.search(r)){var a=(t=t.slice(t.match(r)[0].length)).match(W);if(!(a&&null!=a[1]&&a[1].length>0&&"0"===a[1]))return t}}}(t,e,d);if(!n||n===t)return{number:t};t="+"+n}if("0"===t[1])return{};d=new m(d);for(var r=2;r-1<=i&&r<=t.length;){var a=t.slice(1,r);if(d.countryCallingCodes()[a])return{countryCallingCode:a,number:t.slice(r)};r++}return{}}var yt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n])}return t};function mt(t,e,d){return st(t,yt({},e,{v2:!0}),d)}var vt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n])}return t},bt=function(){return function(t,e){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return function(t,e){var d=[],n=!0,r=!1,a=void 0;try{for(var o,i=t[Symbol.iterator]();!(n=(o=i.next()).done)&&(d.push(o.value),!e||d.length!==e);n=!0);}catch(t){r=!0,a=t}finally{try{!n&&i.return&&i.return()}finally{if(r)throw a}}return d}(t,e);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}();function Ct(){var t=_t(arguments);return mt(t.text,t.options,t.metadata)}function _t(t){var e=Array.prototype.slice.call(t),d=bt(e,4),n=d[0],r=d[1],a=d[2],o=d[3],i=void 0,u=void 0,$=void 0;if("string"!=typeof n)throw new TypeError("A text for parsing must be a string.");if(i=n,r&&"string"!=typeof r){if(!Nt(r))throw new Error("Invalid second argument: "+r);a?(u=r,$=a):$=r}else o?(u=a,$=o):(u=void 0,$=a),r&&(u=gt({defaultCountry:r},u));return{text:i,options:u,metadata:$}}var Nt=function(t){return"object"===(void 0===t?"undefined":vt(t))},St=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n])}return t};function Pt(){var t=_t(arguments);return function(t,e,d){e&&e.defaultCountry&&!P(e.defaultCountry,d)&&(e=St({},e,{defaultCountry:void 0}));try{return mt(t,e,d)}catch(t){if(!(t instanceof r))throw t}}(t.text,t.options,t.metadata)}var It=function(){function t(t,e){for(var d=0;d<e.length;d++){var n=e[d];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,d,n){return d&&t(e.prototype,d),n&&t(e,n),e}}();function xt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}var Ot=function t(e,d){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;xt(this,t),this.key=e,this.value=d,this.next=n,this.prev=r},Et=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;xt(this,t),this.size=0,this.limit=e,this.head=null,this.tail=null,this.cache={}}return It(t,[{key:"put",value:function(t,e){if(this.ensureLimit(),this.head){var d=new Ot(t,e,this.head);this.head.prev=d,this.head=d}else this.head=this.tail=new Ot(t,e);this.cache[t]=this.head,this.size++}},{key:"get",value:function(t){if(this.cache[t]){var e=this.cache[t].value;return this.remove(t),this.put(t,e),e}console.log("Item not available in cache for key "+t)}},{key:"ensureLimit",value:function(){this.size===this.limit&&this.remove(this.tail.key)}},{key:"remove",value:function(t){var e=this.cache[t];null!==e.prev?e.prev.next=e.next:this.head=e.next,null!==e.next?e.next.prev=e.prev:this.tail=e.prev,delete this.cache[t],this.size--}},{key:"clear",value:function(){this.head=null,this.tail=null,this.size=0,this.cache={}}}]),t}(),wt=function(){function t(t,e){for(var d=0;d<e.length;d++){var n=e[d];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,d,n){return d&&t(e.prototype,d),n&&t(e,n),e}}();var At=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.cache=new Et(e)}return wt(t,[{key:"getPatternForRegExp",value:function(t){var e=this.cache.get(t);return e||(e=new RegExp("^"+t),this.cache.put(t,e)),e}}]),t}();function Rt(t,e){if(t<0||e<=0||e<t)throw new TypeError;return"{"+t+","+e+"}"}function Tt(t,e){var d=e.search(t);return d>=0?e.slice(0,d):e}var Mt="   ᠎ - \u2028\u2029   ",Ft="["+Mt+"]",kt="A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Lt=new RegExp("[A-Za-zªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎↃↄⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々〆〱-〵〻〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛥꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),Bt=new RegExp("[$¢-¥֏؋৲৳৻૱௹฿៛₠-₹꠸﷼﹩$¢£¥₩]"),Dt=new RegExp("[̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-ٰٟۖ-ۜ۟-۪ۤۧۨ-ܑۭܰ-݊ަ-ް߫-߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛ࣤ-ࣾऀ-ंऺ़ु-ै्॑-ॗॢॣঁ়ু-ৄ্ৢৣਁਂ਼ੁੂੇੈੋ-੍ੑੰੱੵઁં઼ુ-ૅેૈ્ૢૣଁ଼ିୁ-ୄ୍ୖୢୣஂீ்ా-ీె-ైొ-్ౕౖౢౣ಼ಿೆೌ್ೢೣു-ൄ്ൢൣ්ි-ුූัิ-ฺ็-๎ັິ-ູົຼ່-ໍཱ༹༘༙༵༷-ཾྀ-྄྆྇ྍ-ྗྙ-ྼ࿆ိ-ူဲ-့္်ွှၘၙၞ-ၠၱ-ၴႂႅႆႍႝ፝-፟ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴឵ិ-ួំ៉-៓៝᠋-᠍ᢩᤠ-ᤢᤧᤨᤲ᤹-᤻ᨘᨗᩖᩘ-ᩞ᩠ᩢᩥ-ᩬᩳ-᩿᩼ᬀ-ᬃ᬴ᬶ-ᬺᬼᭂ᭫-᭳ᮀᮁᮢ-ᮥᮨᮩ᯦᮫ᯨᯩᯭᯯ-ᯱᰬ-ᰳᰶ᰷᳐-᳔᳒-᳢᳠-᳨᳭᳴᷀-ᷦ᷼-᷿⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〭꙯ꙴ-꙽ꚟ꛰꛱ꠂ꠆ꠋꠥꠦ꣄꣠-꣱ꤦ-꤭ꥇ-ꥑꦀ-ꦂ꦳ꦶ-ꦹꦼꨩ-ꨮꨱꨲꨵꨶꩃꩌꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫬꫭ꫶ꯥꯨ꯭ﬞ︀-️︠-︦]"),Gt=new RegExp("[\0-€-ÿĀ-ſḀ-ỿƀ-ɏ̀-ͯ]");function Ut(t){return!(!Lt.test(t)&&!Dt.test(t))&&Gt.test(t)}function jt(t){return"%"===t||Bt.test(t)}var Kt={POSSIBLE:function(t,e,d){return!0},VALID:function(t,e,d){return!(!q(t,void 0,d)||!Wt(t,e.toString(),d))},STRICT_GROUPING:function(t,e,d,n){var r=e.toString();return!(!q(t,void 0,d)||!Wt(t,r,d)||Ht(t,r)||!Vt(t,d))&&Zt(t,e,d,zt,n)},EXACT_GROUPING:function(t,e,d,n){var r=e.toString();return!(!q(t,void 0,d)||!Wt(t,r,d)||Ht(t,r)||!Vt(t,d))&&Zt(t,e,d,qt,n)}};function Wt(t,e,d){for(var n=0;n<e.length-1;n++){var r=e.charAt(n);if("x"===r||"X"===r){var a=e.charAt(n+1);if("x"===a||"X"===a){if(n++,util.isNumberMatch(t,e.substring(n))!=MatchType.NSN_MATCH)return!1}else if(k(e.substring(n))!==t.ext)return!1}}return!0}function Vt(t,e){if("FROM_DEFAULT_COUNTRY"!=t.getCountryCodeSource())return!0;var d=util.getRegionCodeForCountryCode(t.getCountryCode()),n=util.getMetadataForRegion(d);if(null==n)return!0;var r=util.getNationalSignificantNumber(t),a=util.chooseFormattingPatternForNumber(n.numberFormats(),r);if(a&&a.getNationalPrefixFormattingRule().length>0){if(a.getNationalPrefixOptionalWhenFormatting())return!0;if(PhoneNumberUtil.formattingRuleHasFirstGroupOnly(a.getNationalPrefixFormattingRule()))return!0;var o=PhoneNumberUtil.normalizeDigitsOnly(t.getRawInput());return util.maybeStripNationalPrefixAndCarrierCode(o,n,null)}return!0}function Ht(t,e){var d=e.indexOf("/");if(d<0)return!1;var n=e.indexOf("/",d+1);return!(n<0)&&(!(t.getCountryCodeSource()===CountryCodeSource.FROM_NUMBER_WITH_PLUS_SIGN||t.getCountryCodeSource()===CountryCodeSource.FROM_NUMBER_WITHOUT_PLUS_SIGN)||PhoneNumberUtil.normalizeDigitsOnly(e.substring(0,d))!==String(t.getCountryCode())||e.slice(n+1).indexOf("/")>=0)}function Zt(t,e,d,n,r){var a=normalizeDigits(e,!0),o=Yt(d,t,null);if(n(d,t,a,o))return!0;var i=MetadataManager.getAlternateFormatsForCountry(t.getCountryCode()),u=util.getNationalSignificantNumber(t);if(i){var $=i.numberFormats(),l=Array.isArray($),s=0;for($=l?$:$[Symbol.iterator]();;){var c;if(l){if(s>=$.length)break;c=$[s++]}else{if((s=$.next()).done)break;c=s.value}var f=c;if(f.leadingDigitsPatterns().length>0)if(!r.getPatternForRegExp("^"+f.leadingDigitsPatterns()[0]).test(u))continue;if(n(d,t,a,o=Yt(d,t,f)))return!0}}return!1}function Yt(t,e,d){if(d){var n=util.getNationalSignificantNumber(e);return util.formatNsnUsingPattern(n,d,"RFC3966",t).split("-")}var r=formatNumber(e,"RFC3966",t),a=r.indexOf(";");a<0&&(a=r.length);var o=r.indexOf("-")+1;return r.slice(o,a).split("-")}function qt(t,e,d,n){var r=d.split(NON_DIGITS_PATTERN),a=e.hasExtension()?r.length-2:r.length-1;if(1==r.length||r[a].contains(util.getNationalSignificantNumber(e)))return!0;for(var o,i,u=n.length-1;u>0&&a>=0;){if(r[a]!==n[u])return!1;u--,a--}return a>=0&&(o=r[a],i=n[0],o.indexOf(i,o.length-i.length)===o.length-i.length)}function zt(t,e,d,n){var r,a,o=0;if(e.getCountryCodeSource()!==CountryCodeSource.FROM_DEFAULT_COUNTRY){var i=String(e.getCountryCode());o=d.indexOf(i)+i.length()}for(var u=0;u<n.length;u++){if((o=d.indexOf(n[u],o))<0)return!1;if(o+=n[u].length(),0==u&&o<d.length()){var $=util.getRegionCodeForCountryCode(e.getCountryCode());if(null!=util.getNddPrefixForRegion($,!0)&&Character.isDigit(d.charAt(o))){var l=util.getNationalSignificantNumber(e);return r=d.slice(o-n[u].length),a=l,0===r.indexOf(a)}}}return d.slice(o).contains(e.getExtension())}var Jt=/[\\/] *x/;function Xt(t){return Tt(Jt,t)}var Qt=/(?:(?:[0-3]?\d\/[01]?\d)|(?:[01]?\d\/[0-3]?\d))\/(?:[12]\d)?\d{2}/,te=/[12]\d{3}[-/]?[01]\d[-/]?[0-3]\d +[0-2]\d$/,ee=/^:[0-5]\d/;function de(t,e,d){if(Qt.test(t))return!1;if(te.test(t)){var n=d.slice(e+t.length);if(ee.test(n))return!1}return!0}var ne=new RegExp("^[(\\[([++]"),re=Rt(0,3),ae=new RegExp("^(?:[(\\[([])?(?:[^(\\[([)\\])]]+[)\\])]])?[^(\\[([)\\])]]+(?:[(\\[([][^(\\[([)\\])]]+[)\\])]])"+re+"[^(\\[([)\\])]]*$"),oe=/\d{1,5}-+\d{1,5}\s{0,4}\(\d{1,4}/;var ie=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n])}return t},ue=function(){function t(t,e){for(var d=0;d<e.length;d++){var n=e[d];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,d,n){return d&&t(e.prototype,d),n&&t(e,n),e}}();var $e=["\\/+(.*)/","(\\([^(]*)","(?:"+Ft+"-|-"+Ft+")"+Ft+"*(.+)","[‒-―-]"+Ft+"*(.+)","\\.+"+Ft+"*([^.]+)",Ft+"+([^   ᠎ - \u2028\u2029   ]+)"],le=Rt(0,2),se=Rt(0,4),ce=o+i,fe=Rt(0,ce),he="["+$+"]"+se,pe="[0-9٠-٩۰-۹߀-߉०-९০-৯੦-੯૦-૯୦-୯௦-௯౦-౯೦-೯൦-൯๐-๙໐-໙༠-༩၀-၉႐-႙០-៩᠐-᠙᥆-᥏᧐-᧙᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙꘠-꘩꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9]"+Rt(1,ce),ye="(?:[(\\[([++]"+he+")"+le+pe+"(?:"+he+pe+")"+fe+"(?:"+w+")?",me=new RegExp("[^0-9²³¹¼-¾٠-٩۰-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵๐-๙໐-໙༠-༳၀-၉႐-႙፩-፼ᛮ-ᛰ០-៩៰-៹᠐-᠙᥆-᥏᧐-᧚᪀-᪉᪐-᪙᭐-᭙᮰-᮹᱀-᱉᱐-᱙⁰⁴-⁹₀-₉⅐-ↂↅ-↉①-⒛⓪-⓿❶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-㉏㉑-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-꠵꣐-꣙꤀-꤉꧐-꧙꩐-꩙꯰-꯹0-9"+kt+"#]+$"),ve=Number.MAX_SAFE_INTEGER||Math.pow(2,53)-1,ge=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments[2];if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.state="NOT_READY",this.searchIndex=0,this.regExpCache=new At(32),!(d=ie({},d,{defaultCountry:d.defaultCountry&&P(d.defaultCountry,n)?d.defaultCountry:void 0,leniency:d.leniency||d.extended?"POSSIBLE":"VALID",maxTries:d.maxTries||ve})).leniency)throw new TypeError("`Leniency` not supplied");if(d.maxTries<0)throw new TypeError("`maxTries` not supplied");if(this.text=e,this.options=d,this.metadata=n,this.leniency=Kt[d.leniency],!this.leniency)throw new TypeError("Unknown leniency: "+d.leniency+".");this.maxTries=d.maxTries,this.PATTERN=new RegExp(ye,"ig")}return ue(t,[{key:"find",value:function(){for(var t=void 0;this.maxTries>0&&null!==(t=this.PATTERN.exec(this.text));){var e=t[0],d=t.index;if(de(e=Xt(e),d,this.text)){var n=this.parseAndVerify(e,d,this.text)||this.extractInnerMatch(e,d,this.text);if(n){if(this.options.v2){var r=new ot(n.country,n.phone,this.metadata);return n.ext&&(r.ext=n.ext),{startsAt:n.startsAt,endsAt:n.endsAt,number:r}}return n}}this.maxTries--}}},{key:"extractInnerMatch",value:function(t,e,d){var n=$e,r=Array.isArray(n),a=0;for(n=r?n:n[Symbol.iterator]();;){var o;if(r){if(a>=n.length)break;o=n[a++]}else{if((a=n.next()).done)break;o=a.value}for(var i=!0,u=void 0,$=new RegExp(o,"g");null!==(u=$.exec(t))&&this.maxTries>0;){if(i){var l=Tt(me,t.slice(0,u.index)),s=this.parseAndVerify(l,e,d);if(s)return s;this.maxTries--,i=!1}var c=Tt(me,u[1]),f=this.parseAndVerify(c,e+u.index,d);if(f)return f;this.maxTries--}}}},{key:"parseAndVerify",value:function(t,e,d){if(function(t,e,d,n){if(ae.test(t)&&!oe.test(t)){if("POSSIBLE"!==n){if(e>0&&!ne.test(t)){var r=d[e-1];if(jt(r)||Ut(r))return!1}var a=e+t.length;if(a<d.length){var o=d[a];if(jt(o)||Ut(o))return!1}}return!0}}(t,e,d,this.options.leniency)){var n=st(t,{extended:!0,defaultCountry:this.options.defaultCountry},this.metadata);if(n.possible&&this.leniency(n,t,this.metadata,this.regExpCache)){var r={startsAt:e,endsAt:e+t.length,country:n.country,phone:n.phone};return n.ext&&(r.ext=n.ext),r}}}},{key:"hasNext",value:function(){return"NOT_READY"===this.state&&(this.lastMatch=this.find(),this.lastMatch?this.state="READY":this.state="DONE"),"READY"===this.state}},{key:"next",value:function(){if(!this.hasNext())throw new Error("No next element");var t=this.lastMatch;return this.lastMatch=null,this.state="NOT_READY",t}}]),t}();function be(){var t=_t(arguments);return function(t,e,d){for(var n=new ge(t,e,d),r=[];n.hasNext();)r.push(n.next());return r}(t.text,t.options,t.metadata)}function Ce(){var t,e,d,n=_t(arguments),r=n.text,a=n.options,o=n.metadata,i=new ge(r,a,o);return t={},e=Symbol.iterator,d=function(){return{next:function(){return i.hasNext()?{done:!1,value:i.next()}:{done:!0}}}},e in t?Object.defineProperty(t,e,{value:d,enumerable:!0,configurable:!0,writable:!0}):t[e]=d,t}var _e=function(){function t(t,e){for(var d=0;d<e.length;d++){var n=e[d];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,d,n){return d&&t(e.prototype,d),n&&t(e,n),e}}();var Ne=Ae("9",15),Se=new RegExp("x"),Pe=function(){return/\[([^\[\]])*\]/g},Ie=function(){return/\d(?=[^,}][^,}])/g},xe=new RegExp("^["+$+"]*(\\$\\d["+$+"]*)+$"),Oe=new RegExp("^"+("[++]{0,1}["+$+u+"]*")+"$","i"),Ee=function(){function t(e,d){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.options={},this.metadata=new m(d),e&&this.metadata.hasCountry(e)&&(this.defaultCountry=e),this.reset()}return _e(t,[{key:"input",value:function(t){var e=ct(t)||"";return e||t&&t.indexOf("+")>=0&&(e="+"),Oe.test(e)?this.processInput(L(e)):this.currentOutput}},{key:"processInput",value:function(t){if("+"===t[0]&&(this.parsedInput||(this.parsedInput+="+",this.resetCountriness()),t=t.slice(1)),this.parsedInput+=t,this.nationalNumber+=t,this.isInternational())if(this.countryCallingCode)this.country||this.determineTheCountry();else{if(!this.nationalNumber)return this.parsedInput;if(!this.extractCountryCallingCode())return this.parsedInput;this.initialize_phone_number_formats_for_this_country_calling_code(),this.resetFormat(),this.determineTheCountry()}else{var e=this.nationalPrefix;this.nationalNumber=this.nationalPrefix+this.nationalNumber,this.extractNationalPrefix(),this.nationalPrefix!==e&&(this.matching_formats=void 0,this.resetFormat())}if(!this.nationalNumber)return this.format_as_non_formatted_number();this.match_formats_by_leading_digits();var d=this.formatNationalNumber(t);return d?this.formatFullNumber(d):this.format_as_non_formatted_number()}},{key:"format_as_non_formatted_number",value:function(){return this.isInternational()&&this.countryCallingCode?"+"+this.countryCallingCode+this.nationalNumber:this.parsedInput}},{key:"formatNationalNumber",value:function(t){var e=void 0;this.chosenFormat&&(e=this.formatNextNationalNumberDigits(t));var d=this.attempt_to_format_complete_phone_number();return d||(this.chooseAnotherFormat()?this.reformatNationalNumber():e)}},{key:"reset",value:function(){return this.parsedInput="",this.currentOutput="",this.nationalPrefix="",this.nationalNumber="",this.carrierCode="",this.resetCountriness(),this.resetFormat(),this}},{key:"resetCountry",value:function(){this.isInternational()?this.country=void 0:this.country=this.defaultCountry}},{key:"resetCountriness",value:function(){this.resetCountry(),this.defaultCountry&&!this.isInternational()?(this.metadata.country(this.defaultCountry),this.countryCallingCode=this.metadata.countryCallingCode(),this.initialize_phone_number_formats_for_this_country_calling_code()):(this.metadata.country(void 0),this.countryCallingCode=void 0,this.available_formats=[],this.matching_formats=void 0)}},{key:"resetFormat",value:function(){this.chosenFormat=void 0,this.template=void 0,this.partially_populated_template=void 0,this.last_match_position=-1}},{key:"reformatNationalNumber",value:function(){return this.formatNextNationalNumberDigits(this.nationalNumber)}},{key:"initialize_phone_number_formats_for_this_country_calling_code",value:function(){this.available_formats=this.metadata.formats().filter(function(t){return xe.test(t.internationalFormat())}),this.matching_formats=void 0}},{key:"match_formats_by_leading_digits",value:function(){var t=this.nationalNumber,e=t.length-3;e<0&&(e=0);var d=this.had_enough_leading_digits&&this.matching_formats||this.available_formats;this.had_enough_leading_digits=this.shouldFormat(),this.matching_formats=d.filter(function(d){var n=d.leadingDigitsPatterns().length;if(0===n)return!0;var r=Math.min(e,n-1),a=d.leadingDigitsPatterns()[r];return new RegExp("^("+a+")").test(t)}),this.chosenFormat&&-1===this.matching_formats.indexOf(this.chosenFormat)&&this.resetFormat()}},{key:"shouldFormat",value:function(){return this.nationalNumber.length>=3}},{key:"attempt_to_format_complete_phone_number",value:function(){var t=this.matching_formats,e=Array.isArray(t),d=0;for(t=e?t:t[Symbol.iterator]();;){var n;if(e){if(d>=t.length)break;n=t[d++]}else{if((d=t.next()).done)break;n=d.value}var r=n;if(new RegExp("^(?:"+r.pattern()+")$").test(this.nationalNumber)&&this.isFormatApplicable(r)){this.resetFormat(),this.chosenFormat=r;var a=tt(this.nationalNumber,r,this.isInternational(),""!==this.nationalPrefix,this.metadata);if(this.nationalPrefix&&"1"===this.countryCallingCode&&(a="1 "+a),this.createFormattingTemplate(r))this.reformatNationalNumber();else{var o=this.formatFullNumber(a);this.template=o.replace(/[\d\+]/g,"x"),this.partially_populated_template=o}return a}}}},{key:"formatFullNumber",value:function(t){return this.isInternational()?"+"+this.countryCallingCode+" "+t:t}},{key:"extractCountryCallingCode",value:function(){var t=pt(this.parsedInput,this.defaultCountry,this.metadata.metadata),e=t.countryCallingCode,d=t.number;if(e)return this.countryCallingCode=e,this.nationalNumber=d,this.metadata.chooseCountryByCountryCallingCode(e),void 0!==this.metadata.selectedCountry()}},{key:"extractNationalPrefix",value:function(){if(this.nationalPrefix="",this.metadata.selectedCountry()){var t=ft(this.nationalNumber,this.metadata),e=t.number,d=t.carrierCode;if(d&&(this.carrierCode=d),this.metadata.possibleLengths()&&(!this.isPossibleNumber(this.nationalNumber)||this.isPossibleNumber(e))||!l(this.nationalNumber,this.metadata.nationalNumberPattern())||l(e,this.metadata.nationalNumberPattern()))return this.nationalPrefix=this.nationalNumber.slice(0,this.nationalNumber.length-e.length),this.nationalNumber=e,this.nationalPrefix}}},{key:"isPossibleNumber",value:function(t){switch(j(t,void 0,this.metadata)){case"IS_POSSIBLE":return!0;default:return!1}}},{key:"chooseAnotherFormat",value:function(){var t=this.matching_formats,e=Array.isArray(t),d=0;for(t=e?t:t[Symbol.iterator]();;){var n;if(e){if(d>=t.length)break;n=t[d++]}else{if((d=t.next()).done)break;n=d.value}var r=n;if(this.chosenFormat===r)return;if(this.isFormatApplicable(r)&&this.createFormattingTemplate(r))return this.chosenFormat=r,this.last_match_position=-1,!0}this.resetCountry(),this.resetFormat()}},{key:"isFormatApplicable",value:function(t){return!(!this.isInternational()&&!this.nationalPrefix&&t.nationalPrefixIsMandatoryWhenFormatting())&&!(this.nationalPrefix&&!t.usesNationalPrefix()&&!t.nationalPrefixIsOptionalWhenFormatting())}},{key:"createFormattingTemplate",value:function(t){if(!(t.pattern().indexOf("|")>=0)){var e=this.getTemplateForNumberFormatPattern(t);if(e)return this.partially_populated_template=e,this.isInternational()?this.template="x"+Ae("x",this.countryCallingCode.length)+" "+e:this.template=e.replace(/\d/g,"x"),this.template}}},{key:"getTemplateForNumberFormatPattern",value:function(t){var e=t.pattern();e=e.replace(Pe(),"\\d").replace(Ie(),"\\d");var d=Ne.match(e)[0];if(!(this.nationalNumber.length>d.length)){var n=this.getFormatFormat(t),r=new RegExp("^"+e+"$"),a=this.nationalNumber.replace(/\d/g,"9");return r.test(a)&&(d=a),d.replace(new RegExp(e),n).replace(new RegExp("9","g"),"x")}}},{key:"formatNextNationalNumberDigits",value:function(t){var e=t.split(""),d=Array.isArray(e),n=0;for(e=d?e:e[Symbol.iterator]();;){var r;if(d){if(n>=e.length)break;r=e[n++]}else{if((n=e.next()).done)break;r=n.value}var a=r;if(-1===this.partially_populated_template.slice(this.last_match_position+1).search(Se))return this.chosenFormat=void 0,this.template=void 0,void(this.partially_populated_template=void 0);this.last_match_position=this.partially_populated_template.search(Se),this.partially_populated_template=this.partially_populated_template.replace(Se,a)}return we(this.partially_populated_template,this.last_match_position+1)}},{key:"isInternational",value:function(){return this.parsedInput&&"+"===this.parsedInput[0]}},{key:"getFormatFormat",value:function(t){if(this.isInternational())return dt(t.internationalFormat());if(t.nationalPrefixFormattingRule()){if(this.nationalPrefix||!t.usesNationalPrefix())return t.format().replace(Q,t.nationalPrefixFormattingRule())}else if("1"===this.countryCallingCode&&"1"===this.nationalPrefix)return"1 "+t.format();return t.format()}},{key:"determineTheCountry",value:function(){this.country=ht(this.countryCallingCode,this.nationalNumber,this.metadata)}},{key:"getNumber",value:function(){if(this.countryCallingCode&&this.nationalNumber){var t=new ot(this.country||this.countryCallingCode,this.nationalNumber,this.metadata.metadata);return this.carrierCode&&(t.carrierCode=this.carrierCode),t}}},{key:"getNationalNumber",value:function(){return this.nationalNumber}},{key:"getTemplate",value:function(){if(this.template){for(var t=-1,e=0;e<this.parsedInput.length;)t=this.template.indexOf("x",t+1),e++;return we(this.template,t+1)}}}]),t}();function we(t,e){return")"===t[e]&&e++,function(t){for(var e=[],d=0;d<t.length;)"("===t[d]?e.push(d):")"===t[d]&&e.pop(),d++;var n=0,r="";e.push(t.length);var a=e,o=Array.isArray(a),i=0;for(a=o?a:a[Symbol.iterator]();;){var u;if(o){if(i>=a.length)break;u=a[i++]}else{if((i=a.next()).done)break;u=i.value}var $=u;r+=t.slice(n,$),n=$+1}return r}(t.slice(0,e))}function Ae(t,e){if(e<1)return"";for(var d="";e>1;)1&e&&(d+=t),e>>=1,t+=t;return d+t}function Re(t,e,d){if(e[t])return new ot(t,e[t],d)}function Te(t,e,d){return d||(d=e,e=void 0),new Ee(e,d).input(t)}d.d(e,"ParseError",function(){return r}),d.d(e,"parsePhoneNumber",function(){return Ct}),d.d(e,"parsePhoneNumberFromString",function(){return Pt}),d.d(e,"findNumbers",function(){return be}),d.d(e,"searchNumbers",function(){return Ce}),d.d(e,"PhoneNumberMatcher",function(){return ge}),d.d(e,"AsYouType",function(){return Ee}),d.d(e,"Metadata",function(){return m}),d.d(e,"isSupportedCountry",function(){return P}),d.d(e,"getCountryCallingCode",function(){return S}),d.d(e,"getExtPrefix",function(){return N}),d.d(e,"getExampleNumber",function(){return Re}),d.d(e,"formatIncompletePhoneNumber",function(){return Te}),d.d(e,"parseIncompletePhoneNumber",function(){return L}),d.d(e,"parsePhoneNumberCharacter",function(){return B}),d.d(e,"parseDigits",function(){return k}),d.d(e,"parseRFC3966",function(){return Z}),d.d(e,"formatRFC3966",function(){return Y})},function(t,e,d){t.exports=d(21)()},function(e,d){e.exports=t},function(t,e,d){var n; /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ /*! Copyright (c) 2016 Jed Watson. Licensed under the MIT License (MIT), see http://jedwatson.github.io/classnames */ !function(){"use strict";var d={}.hasOwnProperty;function r(){for(var t=[],e=0;e<arguments.length;e++){var n=arguments[e];if(n){var a=typeof n;if("string"===a||"number"===a)t.push(n);else if(Array.isArray(n))t.push(r.apply(null,n));else if("object"===a)for(var o in n)d.call(n,o)&&n[o]&&t.push(o)}}return t.join(" ")}void 0!==t&&t.exports?t.exports=r:void 0===(n=function(){return r}.apply(e,[]))||(t.exports=n)}()},function(t,e,d){"use strict";var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t};Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var r,a,o,i,u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var d=arguments[e];for(var n in d)Object.prototype.hasOwnProperty.call(d,n)&&(t[n]=d[n])}return t},$=function(){function t(t,e){for(var d=0;d<e.length;d++){var n=e[d];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,d,n){return d&&t(e.prototype,d),n&&t(e,n),e}}(),l=b(d(2)),s=b(d(1)),c=b(d(3)),f=d(9),h=d(0),p=b(d(19)),y=b(d(18)),m=d(7),v=d(17),g=d(8);function b(t){return t&&t.__esModule?t:{default:t}}var C=l.default.PureComponent||l.default.Component,_=(0,f.polyfill)((o=a=function(t){function e(t){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var d=function(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!==(void 0===e?"undefined":n(e))&&"function"!=typeof e?t:e}(this,(e.__proto__||Object.getPrototypeOf(e)).call(this,t));i.call(d);var r=d.props,a=r.value,o=r.labels,u=r.international,$=r.metadata,l=d.props,s=l.country,c=l.countries,f=l.countryOptions;s&&(d.isCountrySupportedWithError(s)||(s=void 0)),c=x(c,$),f=O(f,$);var h=(0,v.parsePhoneNumber)(a,$),p=(0,v.getPreSelectedCountry)(h,s,c||(0,g.getCountryCodes)(o).filter(function(t){return"ZZ"===t||$.countries[t]}),u,$);return d.state={props:d.props,country:p,countries:c,country_select_options:N(c,f,d.props),parsed_input:S(a,h,d.props),value:a},d}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+(void 0===e?"undefined":n(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)}(e,C),$(e,[{key:"componentDidMount",value:function(){var t=this.props.onCountryChange,e=this.props.country,d=this.state.country;t&&(e&&this.isCountrySupportedWithError(e)||(e=void 0),d!==e&&t(d))}},{key:"componentDidUpdate",value:function(t,e){var d=this.props.onCountryChange;d&&this.state.country!==e.country&&d(this.state.country)}},{key:"render",value:function(){var t=this.props,e=t.name,d=t.disabled,n=t.disablePhoneInput,r=t.autoComplete,a=t.countrySelectTabIndex,o=t.showCountrySelect,i=t.style,$=t.className,s=t.inputClassName,f=t.getInputClassName,p=t.countrySelectProperties,y=t.error,m=t.indicateInvalid,v=t.countrySelectComponent,g=t.inputComponent,b=t.ext,C=(t.country,t.countries,t.countryOptions,t.labels),_=(t.flags,t.flagComponent,t.flagsPath,t.international,t.internationalIcon,t.displayInitialValueAsLocalNumber,t.onCountryChange,t.limitMaxLength,t.metadata),N=function(t,e){var d={};for(var n in t)e.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(t,n)&&(d[n]=t[n]);return d}(t,["name","disabled","disablePhoneInput","autoComplete","countrySelectTabIndex","showCountrySelect","style","className","inputClassName","getInputClassName","countrySelectProperties","error","indicateInvalid","countrySelectComponent","inputComponent","ext","country","countries","countryOptions","labels","flags","flagComponent","flagsPath","international","internationalIcon","displayInitialValueAsLocalNumber","onCountryChange","limitMaxLength","metadata"]),S=this.state,P=S.country,I=S.hidePhoneInputField,x=S.country_select_options,O=S.parsed_input,E=S.isFocused,w={};if(p)for(var A in p)this.props.hasOwnProperty(A)&&(w[p[A]]=this.props[A],delete N[A]);return l.default.createElement("div",{style:i,className:(0,c.default)("react-phone-number-input",{"react-phone-number-input--focus":E,"react-phone-number-input--invalid":y&&m},$)},l.default.createElement("div",{className:"react-phone-number-input__row"},o&&l.default.createElement(v,u({},w,{ref:this.storeCountrySelectInstance,name:e?e+"__country":void 0,value:P,options:x,onChange:this.onCountryChange,onFocus:this._onFocus,onBlur:this._onBlur,disabled:d,tabIndex:a,hidePhoneInputField:this.hidePhoneInputField,focusPhoneInputField:this.focus,"aria-label":C.country,className:"react-phone-number-input__country"})),!I&&l.default.createElement(g,u({type:"tel",name:e},N,{ref:this.storePhoneNumberInputInstance,metadata:_,country:P,value:O||"",onChange:this.onChange,onFocus:this.onFocus,onBlur:this.onBlur,onKeyDown:this.onPhoneNumberKeyDown,disabled:d||n,autoComplete:r,className:(0,c.default)("react-phone-number-input__input","react-phone-number-input__phone",{"react-phone-number-in