intl-tel-input 19.2.0 → 19.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1091,11 +1091,11 @@ var require_react_development = __commonJS({
1091
1091
  var dispatcher = resolveDispatcher();
1092
1092
  return dispatcher.useReducer(reducer, initialArg, init);
1093
1093
  }
1094
- function useRef2(initialValue) {
1094
+ function useRef(initialValue) {
1095
1095
  var dispatcher = resolveDispatcher();
1096
1096
  return dispatcher.useRef(initialValue);
1097
1097
  }
1098
- function useEffect2(create, deps) {
1098
+ function useEffect(create, deps) {
1099
1099
  var dispatcher = resolveDispatcher();
1100
1100
  return dispatcher.useEffect(create, deps);
1101
1101
  }
@@ -1877,14 +1877,14 @@ var require_react_development = __commonJS({
1877
1877
  exports.useContext = useContext;
1878
1878
  exports.useDebugValue = useDebugValue;
1879
1879
  exports.useDeferredValue = useDeferredValue;
1880
- exports.useEffect = useEffect2;
1880
+ exports.useEffect = useEffect;
1881
1881
  exports.useId = useId;
1882
1882
  exports.useImperativeHandle = useImperativeHandle;
1883
1883
  exports.useInsertionEffect = useInsertionEffect;
1884
1884
  exports.useLayoutEffect = useLayoutEffect;
1885
1885
  exports.useMemo = useMemo;
1886
1886
  exports.useReducer = useReducer;
1887
- exports.useRef = useRef2;
1887
+ exports.useRef = useRef;
1888
1888
  exports.useState = useState2;
1889
1889
  exports.useSyncExternalStore = useSyncExternalStore;
1890
1890
  exports.useTransition = useTransition;
@@ -2381,9 +2381,9 @@ var require_react_dom_development = __commonJS({
2381
2381
  if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== "undefined" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === "function") {
2382
2382
  __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2383
2383
  }
2384
- var React3 = require_react();
2384
+ var React2 = require_react();
2385
2385
  var Scheduler = require_scheduler();
2386
- var ReactSharedInternals = React3.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2386
+ var ReactSharedInternals = React2.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
2387
2387
  var suppressWarning = false;
2388
2388
  function setSuppressWarning(newSuppressWarning) {
2389
2389
  {
@@ -3988,7 +3988,7 @@ var require_react_dom_development = __commonJS({
3988
3988
  {
3989
3989
  if (props.value == null) {
3990
3990
  if (typeof props.children === "object" && props.children !== null) {
3991
- React3.Children.forEach(props.children, function(child) {
3991
+ React2.Children.forEach(props.children, function(child) {
3992
3992
  if (child == null) {
3993
3993
  return;
3994
3994
  }
@@ -12435,7 +12435,7 @@ var require_react_dom_development = __commonJS({
12435
12435
  }
12436
12436
  }
12437
12437
  var fakeInternalInstance = {};
12438
- var emptyRefsObject = new React3.Component().refs;
12438
+ var emptyRefsObject = new React2.Component().refs;
12439
12439
  var didWarnAboutStateAssignmentForComponent;
12440
12440
  var didWarnAboutUninitializedState;
12441
12441
  var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate;
@@ -24283,1592 +24283,649 @@ var require_prop_types = __commonJS({
24283
24283
  }
24284
24284
  });
24285
24285
 
24286
- // build/js/intlTelInput.js
24287
- var require_intlTelInput = __commonJS({
24288
- "build/js/intlTelInput.js"(exports, module2) {
24289
- (function(factory) {
24290
- if (typeof module2 === "object" && module2.exports)
24291
- module2.exports = factory();
24292
- else
24293
- window.intlTelInput = factory();
24294
- })(function(undefined2) {
24295
- "use strict";
24296
- return function() {
24297
- var allCountries = [["Afghanistan", "af", "93"], ["Albania", "al", "355"], ["Algeria", "dz", "213"], ["American Samoa", "as", "1", 5, ["684"]], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Anguilla", "ai", "1", 6, ["264"]], ["Antigua & Barbuda", "ag", "1", 7, ["268"]], ["Argentina", "ar", "54"], ["Armenia", "am", "374"], ["Aruba", "aw", "297"], ["Ascension Island", "ac", "247"], ["Australia", "au", "61", 0], ["Austria", "at", "43"], ["Azerbaijan", "az", "994"], ["Bahamas", "bs", "1", 8, ["242"]], ["Bahrain", "bh", "973"], ["Bangladesh", "bd", "880"], ["Barbados", "bb", "1", 9, ["246"]], ["Belarus", "by", "375"], ["Belgium", "be", "32"], ["Belize", "bz", "501"], ["Benin", "bj", "229"], ["Bermuda", "bm", "1", 10, ["441"]], ["Bhutan", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia & Herzegovina", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil", "br", "55"], ["British Indian Ocean Territory", "io", "246"], ["British Virgin Islands", "vg", "1", 11, ["284"]], ["Brunei", "bn", "673"], ["Bulgaria", "bg", "359"], ["Burkina Faso", "bf", "226"], ["Burundi", "bi", "257"], ["Cambodia", "kh", "855"], ["Cameroon", "cm", "237"], ["Canada", "ca", "1", 1, ["204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], ["Cape Verde", "cv", "238"], ["Caribbean Netherlands", "bq", "599", 1, ["3", "4", "7"]], ["Cayman Islands", "ky", "1", 12, ["345"]], ["Central African Republic", "cf", "236"], ["Chad", "td", "235"], ["Chile", "cl", "56"], ["China", "cn", "86"], ["Christmas Island", "cx", "61", 2, ["89164"]], ["Cocos (Keeling) Islands", "cc", "61", 1, ["89162"]], ["Colombia", "co", "57"], ["Comoros", "km", "269"], ["Congo - Brazzaville", "cg", "242"], ["Congo - Kinshasa", "cd", "243"], ["Cook Islands", "ck", "682"], ["Costa Rica", "cr", "506"], ["C\xF4te d\u2019Ivoire", "ci", "225"], ["Croatia", "hr", "385"], ["Cuba", "cu", "53"], ["Cura\xE7ao", "cw", "599", 0], ["Cyprus", "cy", "357"], ["Czech Republic", "cz", "420"], ["Denmark", "dk", "45"], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1", 13, ["767"]], ["Dominican Republic", "do", "1", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt", "eg", "20"], ["El Salvador", "sv", "503"], ["Equatorial Guinea", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia", "ee", "372"], ["Eswatini", "sz", "268"], ["Ethiopia", "et", "251"], ["Falkland Islands", "fk", "500"], ["Faroe Islands", "fo", "298"], ["Fiji", "fj", "679"], ["Finland", "fi", "358", 0], ["France", "fr", "33"], ["French Guiana", "gf", "594"], ["French Polynesia", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia", "ge", "995"], ["Germany", "de", "49"], ["Ghana", "gh", "233"], ["Gibraltar", "gi", "350"], ["Greece", "gr", "30"], ["Greenland", "gl", "299"], ["Grenada", "gd", "1", 14, ["473"]], ["Guadeloupe", "gp", "590", 0], ["Guam", "gu", "1", 15, ["671"]], ["Guatemala", "gt", "502"], ["Guernsey", "gg", "44", 1, ["1481", "7781", "7839", "7911"]], ["Guinea", "gn", "224"], ["Guinea-Bissau", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509"], ["Honduras", "hn", "504"], ["Hong Kong", "hk", "852"], ["Hungary", "hu", "36"], ["Iceland", "is", "354"], ["India", "in", "91"], ["Indonesia", "id", "62"], ["Iran", "ir", "98"], ["Iraq", "iq", "964"], ["Ireland", "ie", "353"], ["Isle of Man", "im", "44", 2, ["1624", "74576", "7524", "7924", "7624"]], ["Israel", "il", "972"], ["Italy", "it", "39", 0], ["Jamaica", "jm", "1", 4, ["876", "658"]], ["Japan", "jp", "81"], ["Jersey", "je", "44", 3, ["1534", "7509", "7700", "7797", "7829", "7937"]], ["Jordan", "jo", "962"], ["Kazakhstan", "kz", "7", 1, ["33", "7"]], ["Kenya", "ke", "254"], ["Kiribati", "ki", "686"], ["Kosovo", "xk", "383"], ["Kuwait", "kw", "965"], ["Kyrgyzstan", "kg", "996"], ["Laos", "la", "856"], ["Latvia", "lv", "371"], ["Lebanon", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau", "mo", "853"], ["Madagascar", "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", "mu", "230"], ["Mayotte", "yt", "262", 1, ["269", "639"]], ["Mexico", "mx", "52"], ["Micronesia", "fm", "691"], ["Moldova", "md", "373"], ["Monaco", "mc", "377"], ["Mongolia", "mn", "976"], ["Montenegro", "me", "382"], ["Montserrat", "ms", "1", 16, ["664"]], ["Morocco", "ma", "212", 0], ["Mozambique", "mz", "258"], ["Myanmar (Burma)", "mm", "95"], ["Namibia", "na", "264"], ["Nauru", "nr", "674"], ["Nepal", "np", "977"], ["Netherlands", "nl", "31"], ["New Caledonia", "nc", "687"], ["New Zealand", "nz", "64"], ["Nicaragua", "ni", "505"], ["Niger", "ne", "227"], ["Nigeria", "ng", "234"], ["Niue", "nu", "683"], ["Norfolk Island", "nf", "672"], ["North Korea", "kp", "850"], ["North Macedonia", "mk", "389"], ["Northern Mariana Islands", "mp", "1", 17, ["670"]], ["Norway", "no", "47", 0], ["Oman", "om", "968"], ["Pakistan", "pk", "92"], ["Palau", "pw", "680"], ["Palestine", "ps", "970"], ["Panama", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru", "pe", "51"], ["Philippines", "ph", "63"], ["Poland", "pl", "48"], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", 3, ["787", "939"]], ["Qatar", "qa", "974"], ["R\xE9union", "re", "262", 0], ["Romania", "ro", "40"], ["Russia", "ru", "7", 0], ["Rwanda", "rw", "250"], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["S\xE3o Tom\xE9 & Pr\xEDncipe", "st", "239"], ["Saudi Arabia", "sa", "966"], ["Senegal", "sn", "221"], ["Serbia", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65"], ["Sint Maarten", "sx", "1", 21, ["721"]], ["Slovakia", "sk", "421"], ["Slovenia", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia", "so", "252"], ["South Africa", "za", "27"], ["South Korea", "kr", "82"], ["South Sudan", "ss", "211"], ["Spain", "es", "34"], ["Sri Lanka", "lk", "94"], ["St Barth\xE9lemy", "bl", "590", 1], ["St Helena", "sh", "290"], ["St Kitts & Nevis", "kn", "1", 18, ["869"]], ["St Lucia", "lc", "1", 19, ["758"]], ["St Martin", "mf", "590", 2], ["St Pierre & Miquelon", "pm", "508"], ["St Vincent & Grenadines", "vc", "1", 20, ["784"]], ["Sudan", "sd", "249"], ["Suriname", "sr", "597"], ["Svalbard & Jan Mayen", "sj", "47", 1, ["79"]], ["Sweden", "se", "46"], ["Switzerland", "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 & Tobago", "tt", "1", 22, ["868"]], ["Tunisia", "tn", "216"], ["Turkey", "tr", "90"], ["Turkmenistan", "tm", "993"], ["Turks & Caicos Islands", "tc", "1", 23, ["649"]], ["Tuvalu", "tv", "688"], ["Uganda", "ug", "256"], ["Ukraine", "ua", "380"], ["United Arab Emirates", "ae", "971"], ["United Kingdom", "gb", "44", 0], ["United States", "us", "1", 0], ["Uruguay", "uy", "598"], ["US Virgin Islands", "vi", "1", 24, ["340"]], ["Uzbekistan", "uz", "998"], ["Vanuatu", "vu", "678"], ["Vatican City", "va", "39", 1, ["06698"]], ["Venezuela", "ve", "58"], ["Vietnam", "vn", "84"], ["Wallis & Futuna", "wf", "681"], ["Western Sahara", "eh", "212", 1, ["5288", "5289"]], ["Yemen", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"], ["\xC5land Islands", "ax", "358", 1, ["18"]]];
24298
- for (var i = 0; i < allCountries.length; i++) {
24299
- var c = allCountries[i];
24300
- allCountries[i] = {
24301
- name: c[0],
24302
- iso2: c[1],
24303
- dialCode: c[2],
24304
- priority: c[3] || 0,
24305
- areaCodes: c[4] || null
24306
- };
24307
- }
24286
+ // react/build/IntlTelInput.cjs.js
24287
+ var require_IntlTelInput_cjs = __commonJS({
24288
+ "react/build/IntlTelInput.cjs.js"(exports, module2) {
24289
+ var Q = Object.create;
24290
+ var A = Object.defineProperty;
24291
+ var X = Object.getOwnPropertyDescriptor;
24292
+ var tt = Object.getOwnPropertyNames;
24293
+ var et = Object.getPrototypeOf;
24294
+ var it = Object.prototype.hasOwnProperty;
24295
+ var nt = (p, h) => () => (h || p((h = { exports: {} }).exports, h), h.exports);
24296
+ var ot = (p, h) => {
24297
+ for (var f in h)
24298
+ A(p, f, { get: h[f], enumerable: true });
24299
+ };
24300
+ var G = (p, h, f, m) => {
24301
+ if (h && typeof h == "object" || typeof h == "function")
24302
+ for (let _ of tt(h))
24303
+ !it.call(p, _) && _ !== f && A(p, _, { get: () => h[_], enumerable: !(m = X(h, _)) || m.enumerable });
24304
+ return p;
24305
+ };
24306
+ var x = (p, h, f) => (f = p != null ? Q(et(p)) : {}, G(h || !p || !p.__esModule ? A(f, "default", { value: p, enumerable: true }) : f, p));
24307
+ var rt = (p) => G(A({}, "__esModule", { value: true }), p);
24308
+ var R = nt((ut, T) => {
24309
+ (function(p) {
24310
+ typeof T == "object" && T.exports ? T.exports = p() : window.intlTelInput = p();
24311
+ })(function(p) {
24308
24312
  "use strict";
24309
- function _objectSpread(target) {
24310
- for (var i2 = 1; i2 < arguments.length; i2++) {
24311
- var source = arguments[i2] != null ? Object(arguments[i2]) : {};
24312
- var ownKeys = Object.keys(source);
24313
- if (typeof Object.getOwnPropertySymbols === "function") {
24314
- ownKeys.push.apply(ownKeys, Object.getOwnPropertySymbols(source).filter(function(sym) {
24315
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
24316
- }));
24313
+ return function() {
24314
+ for (var h = [["Afghanistan", "af", "93"], ["Albania", "al", "355"], ["Algeria", "dz", "213"], ["American Samoa", "as", "1", 5, ["684"]], ["Andorra", "ad", "376"], ["Angola", "ao", "244"], ["Anguilla", "ai", "1", 6, ["264"]], ["Antigua & Barbuda", "ag", "1", 7, ["268"]], ["Argentina", "ar", "54"], ["Armenia", "am", "374"], ["Aruba", "aw", "297"], ["Ascension Island", "ac", "247"], ["Australia", "au", "61", 0], ["Austria", "at", "43"], ["Azerbaijan", "az", "994"], ["Bahamas", "bs", "1", 8, ["242"]], ["Bahrain", "bh", "973"], ["Bangladesh", "bd", "880"], ["Barbados", "bb", "1", 9, ["246"]], ["Belarus", "by", "375"], ["Belgium", "be", "32"], ["Belize", "bz", "501"], ["Benin", "bj", "229"], ["Bermuda", "bm", "1", 10, ["441"]], ["Bhutan", "bt", "975"], ["Bolivia", "bo", "591"], ["Bosnia & Herzegovina", "ba", "387"], ["Botswana", "bw", "267"], ["Brazil", "br", "55"], ["British Indian Ocean Territory", "io", "246"], ["British Virgin Islands", "vg", "1", 11, ["284"]], ["Brunei", "bn", "673"], ["Bulgaria", "bg", "359"], ["Burkina Faso", "bf", "226"], ["Burundi", "bi", "257"], ["Cambodia", "kh", "855"], ["Cameroon", "cm", "237"], ["Canada", "ca", "1", 1, ["204", "226", "236", "249", "250", "263", "289", "306", "343", "354", "365", "367", "368", "382", "387", "403", "416", "418", "428", "431", "437", "438", "450", "584", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905"]], ["Cape Verde", "cv", "238"], ["Caribbean Netherlands", "bq", "599", 1, ["3", "4", "7"]], ["Cayman Islands", "ky", "1", 12, ["345"]], ["Central African Republic", "cf", "236"], ["Chad", "td", "235"], ["Chile", "cl", "56"], ["China", "cn", "86"], ["Christmas Island", "cx", "61", 2, ["89164"]], ["Cocos (Keeling) Islands", "cc", "61", 1, ["89162"]], ["Colombia", "co", "57"], ["Comoros", "km", "269"], ["Congo - Brazzaville", "cg", "242"], ["Congo - Kinshasa", "cd", "243"], ["Cook Islands", "ck", "682"], ["Costa Rica", "cr", "506"], ["C\xF4te d\u2019Ivoire", "ci", "225"], ["Croatia", "hr", "385"], ["Cuba", "cu", "53"], ["Cura\xE7ao", "cw", "599", 0], ["Cyprus", "cy", "357"], ["Czech Republic", "cz", "420"], ["Denmark", "dk", "45"], ["Djibouti", "dj", "253"], ["Dominica", "dm", "1", 13, ["767"]], ["Dominican Republic", "do", "1", 2, ["809", "829", "849"]], ["Ecuador", "ec", "593"], ["Egypt", "eg", "20"], ["El Salvador", "sv", "503"], ["Equatorial Guinea", "gq", "240"], ["Eritrea", "er", "291"], ["Estonia", "ee", "372"], ["Eswatini", "sz", "268"], ["Ethiopia", "et", "251"], ["Falkland Islands", "fk", "500"], ["Faroe Islands", "fo", "298"], ["Fiji", "fj", "679"], ["Finland", "fi", "358", 0], ["France", "fr", "33"], ["French Guiana", "gf", "594"], ["French Polynesia", "pf", "689"], ["Gabon", "ga", "241"], ["Gambia", "gm", "220"], ["Georgia", "ge", "995"], ["Germany", "de", "49"], ["Ghana", "gh", "233"], ["Gibraltar", "gi", "350"], ["Greece", "gr", "30"], ["Greenland", "gl", "299"], ["Grenada", "gd", "1", 14, ["473"]], ["Guadeloupe", "gp", "590", 0], ["Guam", "gu", "1", 15, ["671"]], ["Guatemala", "gt", "502"], ["Guernsey", "gg", "44", 1, ["1481", "7781", "7839", "7911"]], ["Guinea", "gn", "224"], ["Guinea-Bissau", "gw", "245"], ["Guyana", "gy", "592"], ["Haiti", "ht", "509"], ["Honduras", "hn", "504"], ["Hong Kong", "hk", "852"], ["Hungary", "hu", "36"], ["Iceland", "is", "354"], ["India", "in", "91"], ["Indonesia", "id", "62"], ["Iran", "ir", "98"], ["Iraq", "iq", "964"], ["Ireland", "ie", "353"], ["Isle of Man", "im", "44", 2, ["1624", "74576", "7524", "7924", "7624"]], ["Israel", "il", "972"], ["Italy", "it", "39", 0], ["Jamaica", "jm", "1", 4, ["876", "658"]], ["Japan", "jp", "81"], ["Jersey", "je", "44", 3, ["1534", "7509", "7700", "7797", "7829", "7937"]], ["Jordan", "jo", "962"], ["Kazakhstan", "kz", "7", 1, ["33", "7"]], ["Kenya", "ke", "254"], ["Kiribati", "ki", "686"], ["Kosovo", "xk", "383"], ["Kuwait", "kw", "965"], ["Kyrgyzstan", "kg", "996"], ["Laos", "la", "856"], ["Latvia", "lv", "371"], ["Lebanon", "lb", "961"], ["Lesotho", "ls", "266"], ["Liberia", "lr", "231"], ["Libya", "ly", "218"], ["Liechtenstein", "li", "423"], ["Lithuania", "lt", "370"], ["Luxembourg", "lu", "352"], ["Macau", "mo", "853"], ["Madagascar", "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", "mu", "230"], ["Mayotte", "yt", "262", 1, ["269", "639"]], ["Mexico", "mx", "52"], ["Micronesia", "fm", "691"], ["Moldova", "md", "373"], ["Monaco", "mc", "377"], ["Mongolia", "mn", "976"], ["Montenegro", "me", "382"], ["Montserrat", "ms", "1", 16, ["664"]], ["Morocco", "ma", "212", 0], ["Mozambique", "mz", "258"], ["Myanmar (Burma)", "mm", "95"], ["Namibia", "na", "264"], ["Nauru", "nr", "674"], ["Nepal", "np", "977"], ["Netherlands", "nl", "31"], ["New Caledonia", "nc", "687"], ["New Zealand", "nz", "64"], ["Nicaragua", "ni", "505"], ["Niger", "ne", "227"], ["Nigeria", "ng", "234"], ["Niue", "nu", "683"], ["Norfolk Island", "nf", "672"], ["North Korea", "kp", "850"], ["North Macedonia", "mk", "389"], ["Northern Mariana Islands", "mp", "1", 17, ["670"]], ["Norway", "no", "47", 0], ["Oman", "om", "968"], ["Pakistan", "pk", "92"], ["Palau", "pw", "680"], ["Palestine", "ps", "970"], ["Panama", "pa", "507"], ["Papua New Guinea", "pg", "675"], ["Paraguay", "py", "595"], ["Peru", "pe", "51"], ["Philippines", "ph", "63"], ["Poland", "pl", "48"], ["Portugal", "pt", "351"], ["Puerto Rico", "pr", "1", 3, ["787", "939"]], ["Qatar", "qa", "974"], ["R\xE9union", "re", "262", 0], ["Romania", "ro", "40"], ["Russia", "ru", "7", 0], ["Rwanda", "rw", "250"], ["Samoa", "ws", "685"], ["San Marino", "sm", "378"], ["S\xE3o Tom\xE9 & Pr\xEDncipe", "st", "239"], ["Saudi Arabia", "sa", "966"], ["Senegal", "sn", "221"], ["Serbia", "rs", "381"], ["Seychelles", "sc", "248"], ["Sierra Leone", "sl", "232"], ["Singapore", "sg", "65"], ["Sint Maarten", "sx", "1", 21, ["721"]], ["Slovakia", "sk", "421"], ["Slovenia", "si", "386"], ["Solomon Islands", "sb", "677"], ["Somalia", "so", "252"], ["South Africa", "za", "27"], ["South Korea", "kr", "82"], ["South Sudan", "ss", "211"], ["Spain", "es", "34"], ["Sri Lanka", "lk", "94"], ["St Barth\xE9lemy", "bl", "590", 1], ["St Helena", "sh", "290"], ["St Kitts & Nevis", "kn", "1", 18, ["869"]], ["St Lucia", "lc", "1", 19, ["758"]], ["St Martin", "mf", "590", 2], ["St Pierre & Miquelon", "pm", "508"], ["St Vincent & Grenadines", "vc", "1", 20, ["784"]], ["Sudan", "sd", "249"], ["Suriname", "sr", "597"], ["Svalbard & Jan Mayen", "sj", "47", 1, ["79"]], ["Sweden", "se", "46"], ["Switzerland", "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 & Tobago", "tt", "1", 22, ["868"]], ["Tunisia", "tn", "216"], ["Turkey", "tr", "90"], ["Turkmenistan", "tm", "993"], ["Turks & Caicos Islands", "tc", "1", 23, ["649"]], ["Tuvalu", "tv", "688"], ["Uganda", "ug", "256"], ["Ukraine", "ua", "380"], ["United Arab Emirates", "ae", "971"], ["United Kingdom", "gb", "44", 0], ["United States", "us", "1", 0], ["Uruguay", "uy", "598"], ["US Virgin Islands", "vi", "1", 24, ["340"]], ["Uzbekistan", "uz", "998"], ["Vanuatu", "vu", "678"], ["Vatican City", "va", "39", 1, ["06698"]], ["Venezuela", "ve", "58"], ["Vietnam", "vn", "84"], ["Wallis & Futuna", "wf", "681"], ["Western Sahara", "eh", "212", 1, ["5288", "5289"]], ["Yemen", "ye", "967"], ["Zambia", "zm", "260"], ["Zimbabwe", "zw", "263"], ["\xC5land Islands", "ax", "358", 1, ["18"]]], f = 0; f < h.length; f++) {
24315
+ var m = h[f];
24316
+ h[f] = { name: m[0], iso2: m[1], dialCode: m[2], priority: m[3] || 0, areaCodes: m[4] || null };
24317
+ }
24318
+ function _(s) {
24319
+ for (var n = 1; n < arguments.length; n++) {
24320
+ var t = arguments[n] != null ? Object(arguments[n]) : {}, e = Object.keys(t);
24321
+ typeof Object.getOwnPropertySymbols == "function" && e.push.apply(e, Object.getOwnPropertySymbols(t).filter(function(i) {
24322
+ return Object.getOwnPropertyDescriptor(t, i).enumerable;
24323
+ })), e.forEach(function(i) {
24324
+ N(s, i, t[i]);
24325
+ });
24317
24326
  }
24318
- ownKeys.forEach(function(key) {
24319
- _defineProperty(target, key, source[key]);
24320
- });
24327
+ return s;
24321
24328
  }
24322
- return target;
24323
- }
24324
- function _defineProperty(obj, key, value) {
24325
- key = _toPropertyKey(key);
24326
- if (key in obj) {
24327
- Object.defineProperty(obj, key, {
24328
- value,
24329
- enumerable: true,
24330
- configurable: true,
24331
- writable: true
24332
- });
24333
- } else {
24334
- obj[key] = value;
24329
+ function N(s, n, t) {
24330
+ return n = M(n), n in s ? Object.defineProperty(s, n, { value: t, enumerable: true, configurable: true, writable: true }) : s[n] = t, s;
24335
24331
  }
24336
- return obj;
24337
- }
24338
- function _slicedToArray(arr, i2) {
24339
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i2) || _unsupportedIterableToArray(arr, i2) || _nonIterableRest();
24340
- }
24341
- function _nonIterableRest() {
24342
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
24343
- }
24344
- function _unsupportedIterableToArray(o, minLen) {
24345
- if (!o)
24346
- return;
24347
- if (typeof o === "string")
24348
- return _arrayLikeToArray(o, minLen);
24349
- var n = Object.prototype.toString.call(o).slice(8, -1);
24350
- if (n === "Object" && o.constructor)
24351
- n = o.constructor.name;
24352
- if (n === "Map" || n === "Set")
24353
- return Array.from(o);
24354
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
24355
- return _arrayLikeToArray(o, minLen);
24356
- }
24357
- function _arrayLikeToArray(arr, len) {
24358
- if (len == null || len > arr.length)
24359
- len = arr.length;
24360
- for (var i2 = 0, arr2 = new Array(len); i2 < len; i2++) {
24361
- arr2[i2] = arr[i2];
24362
- }
24363
- return arr2;
24364
- }
24365
- function _iterableToArrayLimit(arr, i2) {
24366
- var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
24367
- if (null != _i) {
24368
- var _s, _e, _x, _r, _arr = [], _n = true, _d = false;
24369
- try {
24370
- if (_x = (_i = _i.call(arr)).next, 0 === i2) {
24371
- if (Object(_i) !== _i)
24372
- return;
24373
- _n = false;
24374
- } else
24375
- for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i2); _n = true) {
24376
- }
24377
- } catch (err) {
24378
- _d = true, _e = err;
24379
- } finally {
24332
+ function b(s, n) {
24333
+ return P(s) || F(s, n) || I(s, n) || C();
24334
+ }
24335
+ function C() {
24336
+ throw new TypeError(`Invalid attempt to destructure non-iterable instance.
24337
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
24338
+ }
24339
+ function I(s, n) {
24340
+ if (s) {
24341
+ if (typeof s == "string")
24342
+ return k(s, n);
24343
+ var t = Object.prototype.toString.call(s).slice(8, -1);
24344
+ if (t === "Object" && s.constructor && (t = s.constructor.name), t === "Map" || t === "Set")
24345
+ return Array.from(s);
24346
+ if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))
24347
+ return k(s, n);
24348
+ }
24349
+ }
24350
+ function k(s, n) {
24351
+ (n == null || n > s.length) && (n = s.length);
24352
+ for (var t = 0, e = new Array(n); t < n; t++)
24353
+ e[t] = s[t];
24354
+ return e;
24355
+ }
24356
+ function F(s, n) {
24357
+ var t = s == null ? null : typeof Symbol < "u" && s[Symbol.iterator] || s["@@iterator"];
24358
+ if (t != null) {
24359
+ var e, i, o, r, a = [], l = true, u = false;
24380
24360
  try {
24381
- if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r))
24382
- return;
24361
+ if (o = (t = t.call(s)).next, n === 0) {
24362
+ if (Object(t) !== t)
24363
+ return;
24364
+ l = false;
24365
+ } else
24366
+ for (; !(l = (e = o.call(t)).done) && (a.push(e.value), a.length !== n); l = true)
24367
+ ;
24368
+ } catch (c) {
24369
+ u = true, i = c;
24383
24370
  } finally {
24384
- if (_d)
24385
- throw _e;
24371
+ try {
24372
+ if (!l && t.return != null && (r = t.return(), Object(r) !== r))
24373
+ return;
24374
+ } finally {
24375
+ if (u)
24376
+ throw i;
24377
+ }
24386
24378
  }
24379
+ return a;
24387
24380
  }
24388
- return _arr;
24389
24381
  }
24390
- }
24391
- function _arrayWithHoles(arr) {
24392
- if (Array.isArray(arr))
24393
- return arr;
24394
- }
24395
- function _classCallCheck(instance, Constructor) {
24396
- if (!(instance instanceof Constructor)) {
24397
- throw new TypeError("Cannot call a class as a function");
24382
+ function P(s) {
24383
+ if (Array.isArray(s))
24384
+ return s;
24398
24385
  }
24399
- }
24400
- function _defineProperties(target, props) {
24401
- for (var i2 = 0; i2 < props.length; i2++) {
24402
- var descriptor = props[i2];
24403
- descriptor.enumerable = descriptor.enumerable || false;
24404
- descriptor.configurable = true;
24405
- if ("value" in descriptor)
24406
- descriptor.writable = true;
24407
- Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
24386
+ function z(s, n) {
24387
+ if (!(s instanceof n))
24388
+ throw new TypeError("Cannot call a class as a function");
24408
24389
  }
24409
- }
24410
- function _createClass(Constructor, protoProps, staticProps) {
24411
- if (protoProps)
24412
- _defineProperties(Constructor.prototype, protoProps);
24413
- if (staticProps)
24414
- _defineProperties(Constructor, staticProps);
24415
- Object.defineProperty(Constructor, "prototype", {
24416
- writable: false
24417
- });
24418
- return Constructor;
24419
- }
24420
- function _toPropertyKey(arg) {
24421
- var key = _toPrimitive(arg, "string");
24422
- return typeof key === "symbol" ? key : String(key);
24423
- }
24424
- function _toPrimitive(input, hint) {
24425
- if (typeof input !== "object" || input === null)
24426
- return input;
24427
- var prim = input[Symbol.toPrimitive];
24428
- if (prim !== undefined2) {
24429
- var res = prim.call(input, hint || "default");
24430
- if (typeof res !== "object")
24431
- return res;
24432
- throw new TypeError("@@toPrimitive must return a primitive value.");
24433
- }
24434
- return (hint === "string" ? String : Number)(input);
24435
- }
24436
- var intlTelInputGlobals = {
24437
- getInstance: function getInstance(input) {
24438
- var id2 = input.getAttribute("data-intl-tel-input-id");
24439
- return window.intlTelInputGlobals.instances[id2];
24440
- },
24441
- instances: {},
24442
- // using a global like this allows us to mock it in the tests
24443
- documentReady: function documentReady() {
24444
- return document.readyState === "complete";
24390
+ function U(s, n) {
24391
+ for (var t = 0; t < n.length; t++) {
24392
+ var e = n[t];
24393
+ e.enumerable = e.enumerable || false, e.configurable = true, "value" in e && (e.writable = true), Object.defineProperty(s, M(e.key), e);
24394
+ }
24445
24395
  }
24446
- };
24447
- if (typeof window === "object") {
24448
- window.intlTelInputGlobals = intlTelInputGlobals;
24449
- }
24450
- var id = 0;
24451
- var defaults = {
24452
- // whether or not to allow the dropdown
24453
- allowDropdown: true,
24454
- // auto insert dial code (A) on init, (B) on user selecting a country, (C) on calling setCountry
24455
- // also listen for blur/submit and auto remove dial code if that's all there is
24456
- autoInsertDialCode: false,
24457
- // add a placeholder in the input with an example number for the selected country
24458
- autoPlaceholder: "polite",
24459
- // add a country search input at the top of the dropdown
24460
- countrySearch: true,
24461
- // modify the parentClass
24462
- containerClass: "",
24463
- // modify the auto placeholder
24464
- customPlaceholder: null,
24465
- // append menu to specified element
24466
- dropdownContainer: null,
24467
- // don't display these countries
24468
- excludeCountries: [],
24469
- // fix the dropdown width to the input width (rather than being as wide as the longest country name)
24470
- fixDropdownWidth: true,
24471
- // format the number as the user types
24472
- formatAsYouType: true,
24473
- // format the input value during initialisation and on setNumber
24474
- formatOnDisplay: true,
24475
- // geoIp lookup function
24476
- geoIpLookup: null,
24477
- // inject a hidden input with this name, and on submit, populate it with the result of getNumber
24478
- hiddenInput: null,
24479
- // internationalise the plugin text e.g. search input placeholder, country names
24480
- i18n: {},
24481
- // initial country
24482
- initialCountry: "",
24483
- // national vs international formatting for numbers e.g. placeholders and displaying existing numbers
24484
- nationalMode: true,
24485
- // display only these countries
24486
- onlyCountries: [],
24487
- // number type to use for placeholders
24488
- placeholderNumberType: "MOBILE",
24489
- // the countries at the top of the list
24490
- preferredCountries: [],
24491
- // option to hide the flags - must be used with showSelectedDialCode, or allowDropdown=false
24492
- showFlags: true,
24493
- // display the international dial code next to the selected flag
24494
- showSelectedDialCode: false,
24495
- // use full screen popup instead of dropdown for country list
24496
- useFullscreenPopup: typeof navigator !== "undefined" && typeof window !== "undefined" ? (
24497
- // we cannot just test screen size as some smartphones/website meta tags will report desktop
24498
- // resolutions
24499
- // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'
24500
- /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500
24501
- ) : false,
24502
- // specify the path to the libphonenumber script to enable validation/formatting
24503
- utilsScript: ""
24504
- };
24505
- var regionlessNanpNumbers = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"];
24506
- var forEachInstance = function forEachInstance2(method) {
24507
- var instances = window.intlTelInputGlobals.instances;
24508
- Object.values(instances).forEach(function(instance) {
24509
- return instance[method]();
24510
- });
24511
- };
24512
- var Iti = /* @__PURE__ */ function() {
24513
- function Iti2(input) {
24514
- var customOptions = arguments.length > 1 && arguments[1] !== undefined2 ? arguments[1] : {};
24515
- _classCallCheck(this, Iti2);
24516
- this.id = id++;
24517
- this.telInput = input;
24518
- this.activeItem = null;
24519
- this.highlightedItem = null;
24520
- this.options = Object.assign({}, defaults, customOptions);
24521
- this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
24522
- }
24523
- _createClass(Iti2, [{
24524
- key: "_init",
24525
- value: function _init() {
24526
- var _this = this;
24527
- if (this.options.useFullscreenPopup) {
24528
- this.options.fixDropdownWidth = false;
24529
- }
24530
- if (this.options.countrySearch && !this.options.useFullscreenPopup) {
24531
- this.options.fixDropdownWidth = true;
24532
- }
24533
- if (this.options.nationalMode) {
24534
- this.options.autoInsertDialCode = false;
24535
- }
24536
- if (this.options.showSelectedDialCode) {
24537
- this.options.autoInsertDialCode = false;
24538
- }
24539
- var forceShowFlags = this.options.allowDropdown && !this.options.showSelectedDialCode;
24540
- if (!this.options.showFlags && forceShowFlags) {
24541
- this.options.showFlags = true;
24542
- }
24543
- if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
24544
- this.options.dropdownContainer = document.body;
24545
- }
24546
- this.isRTL = !!this.telInput.closest("[dir=rtl]");
24547
- if (typeof Promise !== "undefined") {
24548
- var autoCountryPromise = new Promise(function(resolve, reject) {
24549
- _this.resolveAutoCountryPromise = resolve;
24550
- _this.rejectAutoCountryPromise = reject;
24551
- });
24552
- var utilsScriptPromise = new Promise(function(resolve, reject) {
24553
- _this.resolveUtilsScriptPromise = resolve;
24554
- _this.rejectUtilsScriptPromise = reject;
24396
+ function V(s, n, t) {
24397
+ return n && U(s.prototype, n), t && U(s, t), Object.defineProperty(s, "prototype", { writable: false }), s;
24398
+ }
24399
+ function M(s) {
24400
+ var n = H(s, "string");
24401
+ return typeof n == "symbol" ? n : String(n);
24402
+ }
24403
+ function H(s, n) {
24404
+ if (typeof s != "object" || s === null)
24405
+ return s;
24406
+ var t = s[Symbol.toPrimitive];
24407
+ if (t !== p) {
24408
+ var e = t.call(s, n || "default");
24409
+ if (typeof e != "object")
24410
+ return e;
24411
+ throw new TypeError("@@toPrimitive must return a primitive value.");
24412
+ }
24413
+ return (n === "string" ? String : Number)(s);
24414
+ }
24415
+ var L = { getInstance: function(n) {
24416
+ var t = n.getAttribute("data-intl-tel-input-id");
24417
+ return window.intlTelInputGlobals.instances[t];
24418
+ }, instances: {}, documentReady: function() {
24419
+ return document.readyState === "complete";
24420
+ } };
24421
+ typeof window == "object" && (window.intlTelInputGlobals = L);
24422
+ var W = 0, B = { allowDropdown: true, autoInsertDialCode: false, autoPlaceholder: "polite", countrySearch: true, containerClass: "", customPlaceholder: null, dropdownContainer: null, excludeCountries: [], fixDropdownWidth: true, formatAsYouType: true, formatOnDisplay: true, geoIpLookup: null, hiddenInput: null, i18n: {}, initialCountry: "", nationalMode: true, onlyCountries: [], placeholderNumberType: "MOBILE", preferredCountries: [], showFlags: true, showSelectedDialCode: false, useFullscreenPopup: typeof navigator < "u" && typeof window < "u" ? /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) || window.innerWidth <= 500 : false, utilsScript: "" }, q = ["800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889"], S = function(n) {
24423
+ var t = window.intlTelInputGlobals.instances;
24424
+ Object.values(t).forEach(function(e) {
24425
+ return e[n]();
24426
+ });
24427
+ }, Y = function() {
24428
+ function s(n) {
24429
+ var t = arguments.length > 1 && arguments[1] !== p ? arguments[1] : {};
24430
+ z(this, s), this.id = W++, this.telInput = n, this.activeItem = null, this.highlightedItem = null, this.options = Object.assign({}, B, t), this.hadInitialPlaceholder = !!n.getAttribute("placeholder");
24431
+ }
24432
+ return V(s, [{ key: "_init", value: function() {
24433
+ var t = this;
24434
+ this.options.useFullscreenPopup && (this.options.fixDropdownWidth = false), this.options.countrySearch && !this.options.useFullscreenPopup && (this.options.fixDropdownWidth = true), this.options.nationalMode && (this.options.autoInsertDialCode = false), this.options.showSelectedDialCode && (this.options.autoInsertDialCode = false);
24435
+ var e = this.options.allowDropdown && !this.options.showSelectedDialCode;
24436
+ if (!this.options.showFlags && e && (this.options.showFlags = true), this.options.useFullscreenPopup && !this.options.dropdownContainer && (this.options.dropdownContainer = document.body), this.isRTL = !!this.telInput.closest("[dir=rtl]"), typeof Promise < "u") {
24437
+ var i = new Promise(function(r, a) {
24438
+ t.resolveAutoCountryPromise = r, t.rejectAutoCountryPromise = a;
24439
+ }), o = new Promise(function(r, a) {
24440
+ t.resolveUtilsScriptPromise = r, t.rejectUtilsScriptPromise = a;
24555
24441
  });
24556
- this.promise = Promise.all([autoCountryPromise, utilsScriptPromise]);
24557
- } else {
24442
+ this.promise = Promise.all([i, o]);
24443
+ } else
24558
24444
  this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {
24445
+ }, this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {
24559
24446
  };
24560
- this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {
24561
- };
24562
- }
24563
- this.selectedCountryData = {};
24564
- this._processCountryData();
24565
- this._generateMarkup();
24566
- this._setInitialState();
24567
- this._initListeners();
24568
- this._initRequests();
24569
- }
24570
- }, {
24571
- key: "_processCountryData",
24572
- value: function _processCountryData() {
24573
- this._processAllCountries();
24574
- this._processCountryCodes();
24575
- this._processPreferredCountries();
24576
- this._translateCountryNames();
24577
- if (this.options.onlyCountries.length || this.options.i18n) {
24578
- this.countries.sort(this._countryNameSort);
24579
- }
24580
- }
24581
- }, {
24582
- key: "_addCountryCode",
24583
- value: function _addCountryCode(iso2, countryCode, priority) {
24584
- if (countryCode.length > this.countryCodeMaxLen) {
24585
- this.countryCodeMaxLen = countryCode.length;
24586
- }
24587
- if (!this.countryCodes.hasOwnProperty(countryCode)) {
24588
- this.countryCodes[countryCode] = [];
24589
- }
24590
- for (var i2 = 0; i2 < this.countryCodes[countryCode].length; i2++) {
24591
- if (this.countryCodes[countryCode][i2] === iso2) {
24447
+ this.selectedCountryData = {}, this._processCountryData(), this._generateMarkup(), this._setInitialState(), this._initListeners(), this._initRequests();
24448
+ } }, { key: "_processCountryData", value: function() {
24449
+ this._processAllCountries(), this._processCountryCodes(), this._processPreferredCountries(), this._translateCountryNames(), (this.options.onlyCountries.length || this.options.i18n) && this.countries.sort(this._countryNameSort);
24450
+ } }, { key: "_addCountryCode", value: function(t, e, i) {
24451
+ e.length > this.countryCodeMaxLen && (this.countryCodeMaxLen = e.length), this.countryCodes.hasOwnProperty(e) || (this.countryCodes[e] = []);
24452
+ for (var o = 0; o < this.countryCodes[e].length; o++)
24453
+ if (this.countryCodes[e][o] === t)
24592
24454
  return;
24593
- }
24594
- }
24595
- var index = priority !== undefined2 ? priority : this.countryCodes[countryCode].length;
24596
- this.countryCodes[countryCode][index] = iso2;
24597
- }
24598
- }, {
24599
- key: "_processAllCountries",
24600
- value: function _processAllCountries() {
24455
+ var r = i !== p ? i : this.countryCodes[e].length;
24456
+ this.countryCodes[e][r] = t;
24457
+ } }, { key: "_processAllCountries", value: function() {
24601
24458
  if (this.options.onlyCountries.length) {
24602
- var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) {
24603
- return country.toLowerCase();
24459
+ var t = this.options.onlyCountries.map(function(i) {
24460
+ return i.toLowerCase();
24604
24461
  });
24605
- this.countries = allCountries.filter(function(country) {
24606
- return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;
24462
+ this.countries = h.filter(function(i) {
24463
+ return t.indexOf(i.iso2) > -1;
24607
24464
  });
24608
24465
  } else if (this.options.excludeCountries.length) {
24609
- var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) {
24610
- return country.toLowerCase();
24466
+ var e = this.options.excludeCountries.map(function(i) {
24467
+ return i.toLowerCase();
24611
24468
  });
24612
- this.countries = allCountries.filter(function(country) {
24613
- return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;
24469
+ this.countries = h.filter(function(i) {
24470
+ return e.indexOf(i.iso2) === -1;
24614
24471
  });
24615
- } else {
24616
- this.countries = allCountries;
24617
- }
24618
- }
24619
- }, {
24620
- key: "_translateCountryNames",
24621
- value: function _translateCountryNames() {
24622
- for (var i2 = 0; i2 < this.countries.length; i2++) {
24623
- var iso = this.countries[i2].iso2.toLowerCase();
24624
- if (this.options.i18n.hasOwnProperty(iso)) {
24625
- this.countries[i2].name = this.options.i18n[iso];
24626
- }
24627
- }
24628
- }
24629
- }, {
24630
- key: "_countryNameSort",
24631
- value: function _countryNameSort(a, b) {
24632
- if (a.name < b.name) {
24633
- return -1;
24634
- }
24635
- if (a.name > b.name) {
24636
- return 1;
24637
- }
24638
- return 0;
24639
- }
24640
- }, {
24641
- key: "_processCountryCodes",
24642
- value: function _processCountryCodes() {
24643
- this.countryCodeMaxLen = 0;
24644
- this.dialCodes = {};
24645
- this.countryCodes = {};
24646
- for (var i2 = 0; i2 < this.countries.length; i2++) {
24647
- var c2 = this.countries[i2];
24648
- if (!this.dialCodes[c2.dialCode]) {
24649
- this.dialCodes[c2.dialCode] = true;
24650
- }
24651
- this._addCountryCode(c2.iso2, c2.dialCode, c2.priority);
24652
- }
24653
- for (var _i = 0; _i < this.countries.length; _i++) {
24654
- var _c = this.countries[_i];
24655
- if (_c.areaCodes) {
24656
- var rootCountryCode = this.countryCodes[_c.dialCode][0];
24657
- for (var j = 0; j < _c.areaCodes.length; j++) {
24658
- var areaCode = _c.areaCodes[j];
24659
- for (var k = 1; k < areaCode.length; k++) {
24660
- var partialDialCode = _c.dialCode + areaCode.substr(0, k);
24661
- this._addCountryCode(rootCountryCode, partialDialCode);
24662
- this._addCountryCode(_c.iso2, partialDialCode);
24472
+ } else
24473
+ this.countries = h;
24474
+ } }, { key: "_translateCountryNames", value: function() {
24475
+ for (var t = 0; t < this.countries.length; t++) {
24476
+ var e = this.countries[t].iso2.toLowerCase();
24477
+ this.options.i18n.hasOwnProperty(e) && (this.countries[t].name = this.options.i18n[e]);
24478
+ }
24479
+ } }, { key: "_countryNameSort", value: function(t, e) {
24480
+ return t.name < e.name ? -1 : t.name > e.name ? 1 : 0;
24481
+ } }, { key: "_processCountryCodes", value: function() {
24482
+ this.countryCodeMaxLen = 0, this.dialCodes = {}, this.countryCodes = {};
24483
+ for (var t = 0; t < this.countries.length; t++) {
24484
+ var e = this.countries[t];
24485
+ this.dialCodes[e.dialCode] || (this.dialCodes[e.dialCode] = true), this._addCountryCode(e.iso2, e.dialCode, e.priority);
24486
+ }
24487
+ for (var i = 0; i < this.countries.length; i++) {
24488
+ var o = this.countries[i];
24489
+ if (o.areaCodes)
24490
+ for (var r = this.countryCodes[o.dialCode][0], a = 0; a < o.areaCodes.length; a++) {
24491
+ for (var l = o.areaCodes[a], u = 1; u < l.length; u++) {
24492
+ var c = o.dialCode + l.substr(0, u);
24493
+ this._addCountryCode(r, c), this._addCountryCode(o.iso2, c);
24663
24494
  }
24664
- this._addCountryCode(_c.iso2, _c.dialCode + areaCode);
24495
+ this._addCountryCode(o.iso2, o.dialCode + l);
24665
24496
  }
24666
- }
24667
24497
  }
24668
- }
24669
- }, {
24670
- key: "_processPreferredCountries",
24671
- value: function _processPreferredCountries() {
24498
+ } }, { key: "_processPreferredCountries", value: function() {
24672
24499
  this.preferredCountries = [];
24673
- for (var i2 = 0; i2 < this.options.preferredCountries.length; i2++) {
24674
- var countryCode = this.options.preferredCountries[i2].toLowerCase();
24675
- var countryData = this._getCountryData(countryCode, false, true);
24676
- if (countryData) {
24677
- this.preferredCountries.push(countryData);
24678
- }
24679
- }
24680
- }
24681
- }, {
24682
- key: "_createEl",
24683
- value: function _createEl(name, attrs, container2) {
24684
- var el = document.createElement(name);
24685
- if (attrs) {
24686
- Object.entries(attrs).forEach(function(_ref) {
24687
- var _ref2 = _slicedToArray(_ref, 2), key = _ref2[0], value = _ref2[1];
24688
- return el.setAttribute(key, value);
24689
- });
24690
- }
24691
- if (container2) {
24692
- container2.appendChild(el);
24693
- }
24694
- return el;
24695
- }
24696
- }, {
24697
- key: "_generateMarkup",
24698
- value: function _generateMarkup() {
24699
- this.telInput.classList.add("iti__tel-input");
24700
- if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
24701
- this.telInput.setAttribute("autocomplete", "off");
24702
- }
24703
- var _this$options = this.options, allowDropdown = _this$options.allowDropdown, showSelectedDialCode = _this$options.showSelectedDialCode, showFlags = _this$options.showFlags, containerClass = _this$options.containerClass, hiddenInput = _this$options.hiddenInput, dropdownContainer = _this$options.dropdownContainer, fixDropdownWidth = _this$options.fixDropdownWidth, useFullscreenPopup = _this$options.useFullscreenPopup, countrySearch = _this$options.countrySearch;
24704
- var parentClass = "iti";
24705
- if (allowDropdown) {
24706
- parentClass += " iti--allow-dropdown";
24707
- }
24708
- if (showSelectedDialCode) {
24709
- parentClass += " iti--show-selected-dial-code";
24710
- }
24711
- if (showFlags) {
24712
- parentClass += " iti--show-flags";
24713
- }
24714
- if (containerClass) {
24715
- parentClass += " ".concat(containerClass);
24716
- }
24717
- if (!useFullscreenPopup) {
24718
- parentClass += " iti--inline-dropdown";
24719
- }
24720
- var wrapper = this._createEl("div", {
24721
- "class": parentClass
24722
- });
24723
- this.telInput.parentNode.insertBefore(wrapper, this.telInput);
24724
- var showFlagsContainer = allowDropdown || showFlags || showSelectedDialCode;
24725
- if (showFlagsContainer) {
24726
- this.flagsContainer = this._createEl("div", {
24727
- "class": "iti__flag-container"
24728
- }, wrapper);
24729
- }
24730
- wrapper.appendChild(this.telInput);
24731
- if (showFlagsContainer) {
24732
- this.selectedFlag = this._createEl("div", _objectSpread({
24733
- "class": "iti__selected-flag"
24734
- }, allowDropdown && {
24735
- role: "combobox",
24736
- "aria-haspopup": "listbox",
24737
- "aria-controls": "iti-".concat(this.id, "__country-listbox"),
24738
- "aria-expanded": "false",
24739
- "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country"
24740
- }), this.flagsContainer);
24741
- }
24742
- if (showFlags) {
24743
- this.selectedFlagInner = this._createEl("div", {
24744
- "class": "iti__flag"
24745
- }, this.selectedFlag);
24746
- }
24747
- if (this.selectedFlag && this.telInput.disabled) {
24748
- this.selectedFlag.setAttribute("aria-disabled", "true");
24749
- }
24750
- if (showSelectedDialCode) {
24751
- this.selectedDialCode = this._createEl("div", {
24752
- "class": "iti__selected-dial-code"
24753
- }, this.selectedFlag);
24754
- }
24755
- if (allowDropdown) {
24756
- if (!this.telInput.disabled) {
24757
- this.selectedFlag.setAttribute("tabindex", "0");
24758
- }
24759
- this.dropdownArrow = this._createEl("div", {
24760
- "class": "iti__arrow"
24761
- }, this.selectedFlag);
24762
- var extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
24763
- this.dropdownContent = this._createEl("div", {
24764
- "class": "iti__dropdown-content iti__hide ".concat(extraClasses)
24765
- });
24766
- if (countrySearch) {
24767
- this.searchInput = this._createEl("input", {
24768
- type: "text",
24769
- "class": "iti__search-input",
24770
- placeholder: this.options.i18n.searchPlaceholder || "Search"
24771
- }, this.dropdownContent);
24772
- }
24773
- this.countryList = this._createEl("ul", {
24774
- "class": "iti__country-list",
24775
- id: "iti-".concat(this.id, "__country-listbox"),
24776
- role: "listbox",
24777
- "aria-label": this.options.i18n.countryListAriaLabel || "List of countries"
24778
- }, this.dropdownContent);
24779
- if (this.preferredCountries.length && !countrySearch) {
24780
- this._appendListItems(this.preferredCountries, "iti__preferred", true);
24781
- this._createEl("li", {
24782
- "class": "iti__divider",
24783
- "aria-hidden": "true"
24784
- }, this.countryList);
24785
- }
24786
- this._appendListItems(this.countries, "iti__standard");
24787
- if (dropdownContainer) {
24788
- var dropdownClasses = "iti iti--container";
24789
- if (useFullscreenPopup) {
24790
- dropdownClasses += " iti--fullscreen-popup";
24791
- } else {
24792
- dropdownClasses += " iti--inline-dropdown";
24793
- }
24794
- if (countrySearch) {
24795
- dropdownClasses += " iti--country-search";
24796
- }
24797
- this.dropdown = this._createEl("div", {
24798
- "class": dropdownClasses
24799
- });
24800
- this.dropdown.appendChild(this.dropdownContent);
24801
- } else {
24500
+ for (var t = 0; t < this.options.preferredCountries.length; t++) {
24501
+ var e = this.options.preferredCountries[t].toLowerCase(), i = this._getCountryData(e, false, true);
24502
+ i && this.preferredCountries.push(i);
24503
+ }
24504
+ } }, { key: "_createEl", value: function(t, e, i) {
24505
+ var o = document.createElement(t);
24506
+ return e && Object.entries(e).forEach(function(r) {
24507
+ var a = b(r, 2), l = a[0], u = a[1];
24508
+ return o.setAttribute(l, u);
24509
+ }), i && i.appendChild(o), o;
24510
+ } }, { key: "_generateMarkup", value: function() {
24511
+ this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
24512
+ var t = this.options, e = t.allowDropdown, i = t.showSelectedDialCode, o = t.showFlags, r = t.containerClass, a = t.hiddenInput, l = t.dropdownContainer, u = t.fixDropdownWidth, c = t.useFullscreenPopup, v = t.countrySearch, g = "iti";
24513
+ e && (g += " iti--allow-dropdown"), i && (g += " iti--show-selected-dial-code"), o && (g += " iti--show-flags"), r && (g += " ".concat(r)), c || (g += " iti--inline-dropdown");
24514
+ var y = this._createEl("div", { class: g });
24515
+ this.telInput.parentNode.insertBefore(y, this.telInput);
24516
+ var D = e || o || i;
24517
+ if (D && (this.flagsContainer = this._createEl("div", { class: "iti__flag-container" }, y)), y.appendChild(this.telInput), D && (this.selectedFlag = this._createEl("div", _({ class: "iti__selected-flag" }, e && { role: "combobox", "aria-haspopup": "listbox", "aria-controls": "iti-".concat(this.id, "__country-listbox"), "aria-expanded": "false", "aria-label": this.options.i18n.selectedCountryAriaLabel || "Selected country" }), this.flagsContainer)), o && (this.selectedFlagInner = this._createEl("div", { class: "iti__flag" }, this.selectedFlag)), this.selectedFlag && this.telInput.disabled && this.selectedFlag.setAttribute("aria-disabled", "true"), i && (this.selectedDialCode = this._createEl("div", { class: "iti__selected-dial-code" }, this.selectedFlag)), e) {
24518
+ this.telInput.disabled || this.selectedFlag.setAttribute("tabindex", "0"), this.dropdownArrow = this._createEl("div", { class: "iti__arrow" }, this.selectedFlag);
24519
+ var J = u ? "" : "iti--flexible-dropdown-width";
24520
+ if (this.dropdownContent = this._createEl("div", { class: "iti__dropdown-content iti__hide ".concat(J) }), v && (this.searchInput = this._createEl("input", { type: "text", class: "iti__search-input", placeholder: this.options.i18n.searchPlaceholder || "Search" }, this.dropdownContent)), this.countryList = this._createEl("ul", { class: "iti__country-list", id: "iti-".concat(this.id, "__country-listbox"), role: "listbox", "aria-label": this.options.i18n.countryListAriaLabel || "List of countries" }, this.dropdownContent), this.preferredCountries.length && !v && (this._appendListItems(this.preferredCountries, "iti__preferred", true), this._createEl("li", { class: "iti__divider", "aria-hidden": "true" }, this.countryList)), this._appendListItems(this.countries, "iti__standard"), l) {
24521
+ var E = "iti iti--container";
24522
+ c ? E += " iti--fullscreen-popup" : E += " iti--inline-dropdown", v && (E += " iti--country-search"), this.dropdown = this._createEl("div", { class: E }), this.dropdown.appendChild(this.dropdownContent);
24523
+ } else
24802
24524
  this.flagsContainer.appendChild(this.dropdownContent);
24803
- }
24804
24525
  }
24805
- if (hiddenInput) {
24806
- var telInputName = this.telInput.getAttribute("name");
24807
- var hiddenInputName = hiddenInput(telInputName);
24808
- this.hiddenInput = this._createEl("input", {
24809
- type: "hidden",
24810
- name: hiddenInputName
24811
- });
24812
- wrapper.appendChild(this.hiddenInput);
24813
- }
24814
- }
24815
- }, {
24816
- key: "_appendListItems",
24817
- value: function _appendListItems(countries, className, preferred) {
24818
- for (var i2 = 0; i2 < countries.length; i2++) {
24819
- var c2 = countries[i2];
24820
- var idSuffix = preferred ? "-preferred" : "";
24821
- var listItem = this._createEl("li", {
24822
- id: "iti-".concat(this.id, "__item-").concat(c2.iso2).concat(idSuffix),
24823
- "class": "iti__country ".concat(className),
24824
- tabindex: "-1",
24825
- role: "option",
24826
- "data-dial-code": c2.dialCode,
24827
- "data-country-code": c2.iso2,
24828
- "aria-selected": "false"
24829
- }, this.countryList);
24830
- c2.node = listItem;
24831
- var content = "";
24832
- if (this.options.showFlags) {
24833
- content += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(c2.iso2, "'></div></div>");
24834
- }
24835
- content += "<span class='iti__country-name'>".concat(c2.name, "</span>");
24836
- content += "<span class='iti__dial-code'>+".concat(c2.dialCode, "</span>");
24837
- listItem.insertAdjacentHTML("beforeend", content);
24838
- }
24839
- }
24840
- }, {
24841
- key: "_setInitialState",
24842
- value: function _setInitialState() {
24843
- var attributeValue = this.telInput.getAttribute("value");
24844
- var inputValue = this.telInput.value;
24845
- var useAttribute = attributeValue && attributeValue.charAt(0) === "+" && (!inputValue || inputValue.charAt(0) !== "+");
24846
- var val = useAttribute ? attributeValue : inputValue;
24847
- var dialCode = this._getDialCode(val);
24848
- var isRegionlessNanp = this._isRegionlessNanp(val);
24849
- var _this$options2 = this.options, initialCountry = _this$options2.initialCountry, autoInsertDialCode = _this$options2.autoInsertDialCode;
24850
- if (dialCode && !isRegionlessNanp) {
24851
- this._updateFlagFromNumber(val);
24852
- } else if (initialCountry !== "auto") {
24853
- var isValidInitialCountry = initialCountry && this._getCountryData(initialCountry, false, true);
24854
- if (isValidInitialCountry) {
24855
- this._setFlag(initialCountry.toLowerCase());
24856
- } else {
24857
- if (dialCode && isRegionlessNanp) {
24858
- this._setFlag("us");
24859
- } else {
24860
- this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;
24861
- if (!val) {
24862
- this._setFlag(this.defaultCountry);
24863
- }
24864
- }
24865
- }
24866
- if (!val && autoInsertDialCode) {
24867
- this.telInput.value = "+".concat(this.selectedCountryData.dialCode);
24868
- }
24869
- }
24870
- if (val) {
24871
- this._updateValFromNumber(val);
24872
- }
24873
- }
24874
- }, {
24875
- key: "_initListeners",
24876
- value: function _initListeners() {
24877
- this._initKeyListeners();
24878
- if (this.options.autoInsertDialCode) {
24879
- this._initBlurListeners();
24880
- }
24881
- if (this.options.allowDropdown) {
24882
- this._initDropdownListeners();
24883
- }
24884
- if (this.hiddenInput) {
24885
- this._initHiddenInputListener();
24886
- }
24887
- }
24888
- }, {
24889
- key: "_initHiddenInputListener",
24890
- value: function _initHiddenInputListener() {
24891
- var _this2 = this;
24526
+ if (a) {
24527
+ var Z = this.telInput.getAttribute("name"), $ = a(Z);
24528
+ this.hiddenInput = this._createEl("input", { type: "hidden", name: $ }), y.appendChild(this.hiddenInput);
24529
+ }
24530
+ } }, { key: "_appendListItems", value: function(t, e, i) {
24531
+ for (var o = 0; o < t.length; o++) {
24532
+ var r = t[o], a = i ? "-preferred" : "", l = this._createEl("li", { id: "iti-".concat(this.id, "__item-").concat(r.iso2).concat(a), class: "iti__country ".concat(e), tabindex: "-1", role: "option", "data-dial-code": r.dialCode, "data-country-code": r.iso2, "aria-selected": "false" }, this.countryList);
24533
+ r.node = l;
24534
+ var u = "";
24535
+ this.options.showFlags && (u += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(r.iso2, "'></div></div>")), u += "<span class='iti__country-name'>".concat(r.name, "</span>"), u += "<span class='iti__dial-code'>+".concat(r.dialCode, "</span>"), l.insertAdjacentHTML("beforeend", u);
24536
+ }
24537
+ } }, { key: "_setInitialState", value: function() {
24538
+ var t = this.telInput.getAttribute("value"), e = this.telInput.value, i = t && t.charAt(0) === "+" && (!e || e.charAt(0) !== "+"), o = i ? t : e, r = this._getDialCode(o), a = this._isRegionlessNanp(o), l = this.options, u = l.initialCountry, c = l.autoInsertDialCode;
24539
+ if (r && !a)
24540
+ this._updateFlagFromNumber(o);
24541
+ else if (u !== "auto") {
24542
+ var v = u && this._getCountryData(u, false, true);
24543
+ v ? this._setFlag(u.toLowerCase()) : r && a ? this._setFlag("us") : (this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2, o || this._setFlag(this.defaultCountry)), !o && c && (this.telInput.value = "+".concat(this.selectedCountryData.dialCode));
24544
+ }
24545
+ o && this._updateValFromNumber(o);
24546
+ } }, { key: "_initListeners", value: function() {
24547
+ this._initKeyListeners(), this.options.autoInsertDialCode && this._initBlurListeners(), this.options.allowDropdown && this._initDropdownListeners(), this.hiddenInput && this._initHiddenInputListener();
24548
+ } }, { key: "_initHiddenInputListener", value: function() {
24549
+ var t = this;
24892
24550
  this._handleHiddenInputSubmit = function() {
24893
- _this2.hiddenInput.value = _this2.getNumber();
24551
+ t.hiddenInput.value = t.getNumber();
24552
+ }, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
24553
+ } }, { key: "_initDropdownListeners", value: function() {
24554
+ var t = this;
24555
+ this._handleLabelClick = function(i) {
24556
+ t.dropdownContent.classList.contains("iti__hide") ? t.telInput.focus() : i.preventDefault();
24894
24557
  };
24895
- if (this.telInput.form) {
24896
- this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
24897
- }
24898
- }
24899
- }, {
24900
- key: "_initDropdownListeners",
24901
- value: function _initDropdownListeners() {
24902
- var _this3 = this;
24903
- this._handleLabelClick = function(e) {
24904
- if (_this3.dropdownContent.classList.contains("iti__hide")) {
24905
- _this3.telInput.focus();
24906
- } else {
24907
- e.preventDefault();
24908
- }
24909
- };
24910
- var label = this.telInput.closest("label");
24911
- if (label) {
24912
- label.addEventListener("click", this._handleLabelClick);
24913
- }
24914
- this._handleClickSelectedFlag = function() {
24915
- if (_this3.dropdownContent.classList.contains("iti__hide") && !_this3.telInput.disabled && !_this3.telInput.readOnly) {
24916
- _this3._showDropdown();
24917
- }
24918
- };
24919
- this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag);
24920
- this._handleFlagsContainerKeydown = function(e) {
24921
- var isDropdownHidden = _this3.dropdownContent.classList.contains("iti__hide");
24922
- if (isDropdownHidden && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(e.key)) {
24923
- e.preventDefault();
24924
- e.stopPropagation();
24925
- _this3._showDropdown();
24926
- }
24927
- if (e.key === "Tab") {
24928
- _this3._closeDropdown();
24929
- }
24930
- };
24931
- this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
24932
- }
24933
- }, {
24934
- key: "_initRequests",
24935
- value: function _initRequests() {
24936
- var _this4 = this;
24937
- if (this.options.utilsScript && !window.intlTelInputUtils) {
24938
- if (window.intlTelInputGlobals.documentReady()) {
24939
- window.intlTelInputGlobals.loadUtils(this.options.utilsScript);
24940
- } else {
24941
- window.addEventListener("load", function() {
24942
- window.intlTelInputGlobals.loadUtils(_this4.options.utilsScript);
24943
- });
24944
- }
24945
- } else {
24946
- this.resolveUtilsScriptPromise();
24947
- }
24948
- if (this.options.initialCountry === "auto") {
24949
- this._loadAutoCountry();
24950
- } else {
24951
- this.resolveAutoCountryPromise();
24952
- }
24953
- }
24954
- }, {
24955
- key: "_loadAutoCountry",
24956
- value: function _loadAutoCountry() {
24957
- if (window.intlTelInputGlobals.autoCountry) {
24958
- this.handleAutoCountry();
24959
- } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) {
24960
- window.intlTelInputGlobals.startedLoadingAutoCountry = true;
24961
- if (typeof this.options.geoIpLookup === "function") {
24962
- this.options.geoIpLookup(function(countryCode) {
24963
- window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase();
24964
- setTimeout(function() {
24965
- return forEachInstance("handleAutoCountry");
24966
- });
24967
- }, function() {
24968
- return forEachInstance("rejectAutoCountryPromise");
24969
- });
24970
- }
24971
- }
24972
- }
24973
- }, {
24974
- key: "_initKeyListeners",
24975
- value: function _initKeyListeners() {
24976
- var _this5 = this;
24977
- var userOverrideFormatting = false;
24978
- this._handleKeyEvent = function(e) {
24979
- if (_this5._updateFlagFromNumber(_this5.telInput.value)) {
24980
- _this5._triggerCountryChange();
24981
- }
24982
- if (e && e.data && /[^+0-9]/.test(e.data)) {
24983
- userOverrideFormatting = true;
24984
- } else if (!/[^+0-9]/.test(_this5.telInput.value)) {
24985
- userOverrideFormatting = false;
24986
- }
24987
- if (_this5.options.formatAsYouType && !userOverrideFormatting) {
24988
- var currentCaretPos = _this5.telInput.selectionStart;
24989
- var valueBeforeCaret = _this5.telInput.value.substring(0, currentCaretPos);
24990
- var relevantCharsBeforeCaret = valueBeforeCaret.replace(/[^+0-9]/g, "").length;
24991
- var isDeleteForwards = e && e.inputType === "deleteContentForward";
24992
- var formattedValue = _this5._formatNumberAsYouType();
24993
- var newCaretPos = _this5._translateCursorPosition(relevantCharsBeforeCaret, formattedValue, currentCaretPos, isDeleteForwards);
24994
- _this5.telInput.value = formattedValue;
24995
- _this5.telInput.setSelectionRange(newCaretPos, newCaretPos);
24996
- }
24997
- };
24998
- this.telInput.addEventListener("input", this._handleKeyEvent);
24999
- this._handleClipboardEvent = function() {
25000
- setTimeout(_this5._handleKeyEvent);
25001
- };
25002
- this.telInput.addEventListener("cut", this._handleClipboardEvent);
25003
- this.telInput.addEventListener("paste", this._handleClipboardEvent);
25004
- }
25005
- }, {
25006
- key: "_translateCursorPosition",
25007
- value: function _translateCursorPosition(relevantChars, formattedValue, prevCaretPos, isDeleteForwards) {
25008
- if (prevCaretPos === 0 && !isDeleteForwards) {
24558
+ var e = this.telInput.closest("label");
24559
+ e && e.addEventListener("click", this._handleLabelClick), this._handleClickSelectedFlag = function() {
24560
+ t.dropdownContent.classList.contains("iti__hide") && !t.telInput.disabled && !t.telInput.readOnly && t._showDropdown();
24561
+ }, this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag), this._handleFlagsContainerKeydown = function(i) {
24562
+ var o = t.dropdownContent.classList.contains("iti__hide");
24563
+ o && ["ArrowUp", "ArrowDown", " ", "Enter"].includes(i.key) && (i.preventDefault(), i.stopPropagation(), t._showDropdown()), i.key === "Tab" && t._closeDropdown();
24564
+ }, this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
24565
+ } }, { key: "_initRequests", value: function() {
24566
+ var t = this;
24567
+ this.options.utilsScript && !window.intlTelInputUtils ? window.intlTelInputGlobals.documentReady() ? window.intlTelInputGlobals.loadUtils(this.options.utilsScript) : window.addEventListener("load", function() {
24568
+ window.intlTelInputGlobals.loadUtils(t.options.utilsScript);
24569
+ }) : this.resolveUtilsScriptPromise(), this.options.initialCountry === "auto" ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
24570
+ } }, { key: "_loadAutoCountry", value: function() {
24571
+ window.intlTelInputGlobals.autoCountry ? this.handleAutoCountry() : window.intlTelInputGlobals.startedLoadingAutoCountry || (window.intlTelInputGlobals.startedLoadingAutoCountry = true, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(function(t) {
24572
+ window.intlTelInputGlobals.autoCountry = t.toLowerCase(), setTimeout(function() {
24573
+ return S("handleAutoCountry");
24574
+ });
24575
+ }, function() {
24576
+ return S("rejectAutoCountryPromise");
24577
+ }));
24578
+ } }, { key: "_initKeyListeners", value: function() {
24579
+ var t = this, e = false;
24580
+ this._handleKeyEvent = function(i) {
24581
+ if (t._updateFlagFromNumber(t.telInput.value) && t._triggerCountryChange(), i && i.data && /[^+0-9]/.test(i.data) ? e = true : /[^+0-9]/.test(t.telInput.value) || (e = false), t.options.formatAsYouType && !e) {
24582
+ var o = t.telInput.selectionStart, r = t.telInput.value.substring(0, o), a = r.replace(/[^+0-9]/g, "").length, l = i && i.inputType === "deleteContentForward", u = t._formatNumberAsYouType(), c = t._translateCursorPosition(a, u, o, l);
24583
+ t.telInput.value = u, t.telInput.setSelectionRange(c, c);
24584
+ }
24585
+ }, this.telInput.addEventListener("input", this._handleKeyEvent), this._handleClipboardEvent = function() {
24586
+ setTimeout(t._handleKeyEvent);
24587
+ }, this.telInput.addEventListener("cut", this._handleClipboardEvent), this.telInput.addEventListener("paste", this._handleClipboardEvent);
24588
+ } }, { key: "_translateCursorPosition", value: function(t, e, i, o) {
24589
+ if (i === 0 && !o)
25009
24590
  return 0;
25010
- }
25011
- var count = 0;
25012
- for (var i2 = 0; i2 < formattedValue.length; i2++) {
25013
- if (/[+0-9]/.test(formattedValue[i2])) {
25014
- count++;
25015
- }
25016
- if (count === relevantChars && !isDeleteForwards) {
25017
- return i2 + 1;
25018
- }
25019
- if (isDeleteForwards && count === relevantChars + 1) {
25020
- return i2;
25021
- }
25022
- }
25023
- return formattedValue.length;
25024
- }
25025
- }, {
25026
- key: "_cap",
25027
- value: function _cap(number) {
25028
- var max = this.telInput.getAttribute("maxlength");
25029
- return max && number.length > max ? number.substr(0, max) : number;
25030
- }
25031
- }, {
25032
- key: "_initBlurListeners",
25033
- value: function _initBlurListeners() {
25034
- var _this6 = this;
24591
+ for (var r = 0, a = 0; a < e.length; a++) {
24592
+ if (/[+0-9]/.test(e[a]) && r++, r === t && !o)
24593
+ return a + 1;
24594
+ if (o && r === t + 1)
24595
+ return a;
24596
+ }
24597
+ return e.length;
24598
+ } }, { key: "_cap", value: function(t) {
24599
+ var e = this.telInput.getAttribute("maxlength");
24600
+ return e && t.length > e ? t.substr(0, e) : t;
24601
+ } }, { key: "_initBlurListeners", value: function() {
24602
+ var t = this;
25035
24603
  this._handleSubmitOrBlurEvent = function() {
25036
- _this6._removeEmptyDialCode();
25037
- };
25038
- if (this.telInput.form) {
25039
- this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent);
25040
- }
25041
- this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
25042
- }
25043
- }, {
25044
- key: "_removeEmptyDialCode",
25045
- value: function _removeEmptyDialCode() {
24604
+ t._removeEmptyDialCode();
24605
+ }, this.telInput.form && this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
24606
+ } }, { key: "_removeEmptyDialCode", value: function() {
25046
24607
  if (this.telInput.value.charAt(0) === "+") {
25047
- var numeric = this._getNumeric(this.telInput.value);
25048
- if (!numeric || this.selectedCountryData.dialCode === numeric) {
25049
- this.telInput.value = "";
25050
- }
24608
+ var t = this._getNumeric(this.telInput.value);
24609
+ (!t || this.selectedCountryData.dialCode === t) && (this.telInput.value = "");
25051
24610
  }
25052
- }
25053
- }, {
25054
- key: "_getNumeric",
25055
- value: function _getNumeric(s) {
25056
- return s.replace(/\D/g, "");
25057
- }
25058
- }, {
25059
- key: "_trigger",
25060
- value: function _trigger(name) {
25061
- var e = new Event(name, {
25062
- bubbles: true,
25063
- cancelable: true
25064
- });
24611
+ } }, { key: "_getNumeric", value: function(t) {
24612
+ return t.replace(/\D/g, "");
24613
+ } }, { key: "_trigger", value: function(t) {
24614
+ var e = new Event(t, { bubbles: true, cancelable: true });
25065
24615
  this.telInput.dispatchEvent(e);
25066
- }
25067
- }, {
25068
- key: "_showDropdown",
25069
- value: function _showDropdown() {
25070
- if (this.options.fixDropdownWidth) {
25071
- this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px");
25072
- }
25073
- this.dropdownContent.classList.remove("iti__hide");
25074
- this.selectedFlag.setAttribute("aria-expanded", "true");
25075
- this._setDropdownPosition();
25076
- if (this.options.countrySearch) {
25077
- this._highlightListItem(this.countryList.firstElementChild, false);
25078
- this.searchInput.focus();
25079
- } else if (this.activeItem) {
25080
- this._highlightListItem(this.activeItem, false);
25081
- this._scrollTo(this.activeItem, true);
25082
- }
25083
- this._bindDropdownListeners();
25084
- this.dropdownArrow.classList.add("iti__arrow--up");
25085
- this._trigger("open:countrydropdown");
25086
- }
25087
- }, {
25088
- key: "_toggleClass",
25089
- value: function _toggleClass(el, className, shouldHaveClass) {
25090
- if (shouldHaveClass && !el.classList.contains(className)) {
25091
- el.classList.add(className);
25092
- } else if (!shouldHaveClass && el.classList.contains(className)) {
25093
- el.classList.remove(className);
25094
- }
25095
- }
25096
- }, {
25097
- key: "_setDropdownPosition",
25098
- value: function _setDropdownPosition() {
25099
- var _this7 = this;
25100
- if (this.options.dropdownContainer) {
25101
- this.options.dropdownContainer.appendChild(this.dropdown);
25102
- }
25103
- if (!this.options.useFullscreenPopup) {
25104
- var pos = this.telInput.getBoundingClientRect();
25105
- var windowTop = document.documentElement.scrollTop;
25106
- var inputTop = pos.top + windowTop;
25107
- var dropdownHeight = this.dropdownContent.offsetHeight;
25108
- var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight;
25109
- var dropdownFitsAbove = inputTop - dropdownHeight > windowTop;
25110
- var positionDropdownAboveInput = !this.options.countrySearch && !dropdownFitsBelow && dropdownFitsAbove;
25111
- this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", positionDropdownAboveInput);
25112
- if (this.options.dropdownContainer) {
25113
- var extraTop = positionDropdownAboveInput ? 0 : this.telInput.offsetHeight;
25114
- this.dropdown.style.top = "".concat(inputTop + extraTop, "px");
25115
- this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px");
25116
- this._handleWindowScroll = function() {
25117
- return _this7._closeDropdown();
25118
- };
25119
- window.addEventListener("scroll", this._handleWindowScroll);
25120
- }
25121
- }
25122
- }
25123
- }, {
25124
- key: "_bindDropdownListeners",
25125
- value: function _bindDropdownListeners() {
25126
- var _this8 = this;
25127
- this._handleMouseoverCountryList = function(e) {
25128
- var listItem = e.target.closest(".iti__country");
25129
- if (listItem) {
25130
- _this8._highlightListItem(listItem, false);
25131
- }
25132
- };
25133
- this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
25134
- this._handleClickCountryList = function(e) {
25135
- var listItem = e.target.closest(".iti__country");
25136
- if (listItem) {
25137
- _this8._selectListItem(listItem);
25138
- }
25139
- };
25140
- this.countryList.addEventListener("click", this._handleClickCountryList);
25141
- var isOpening = true;
24616
+ } }, { key: "_showDropdown", value: function() {
24617
+ this.options.fixDropdownWidth && (this.dropdownContent.style.width = "".concat(this.telInput.offsetWidth, "px")), this.dropdownContent.classList.remove("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "true"), this._setDropdownPosition(), this.options.countrySearch ? (this._highlightListItem(this.countryList.firstElementChild, false), this.searchInput.focus()) : this.activeItem && (this._highlightListItem(this.activeItem, false), this._scrollTo(this.activeItem, true)), this._bindDropdownListeners(), this.dropdownArrow.classList.add("iti__arrow--up"), this._trigger("open:countrydropdown");
24618
+ } }, { key: "_toggleClass", value: function(t, e, i) {
24619
+ i && !t.classList.contains(e) ? t.classList.add(e) : !i && t.classList.contains(e) && t.classList.remove(e);
24620
+ } }, { key: "_setDropdownPosition", value: function() {
24621
+ var t = this;
24622
+ if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.dropdown), !this.options.useFullscreenPopup) {
24623
+ var e = this.telInput.getBoundingClientRect(), i = document.documentElement.scrollTop, o = e.top + i, r = this.dropdownContent.offsetHeight, a = o + this.telInput.offsetHeight + r < i + window.innerHeight, l = o - r > i, u = !this.options.countrySearch && !a && l;
24624
+ if (this._toggleClass(this.dropdownContent, "iti__dropdown-content--dropup", u), this.options.dropdownContainer) {
24625
+ var c = u ? 0 : this.telInput.offsetHeight;
24626
+ this.dropdown.style.top = "".concat(o + c, "px"), this.dropdown.style.left = "".concat(e.left + document.body.scrollLeft, "px"), this._handleWindowScroll = function() {
24627
+ return t._closeDropdown();
24628
+ }, window.addEventListener("scroll", this._handleWindowScroll);
24629
+ }
24630
+ }
24631
+ } }, { key: "_bindDropdownListeners", value: function() {
24632
+ var t = this;
24633
+ this._handleMouseoverCountryList = function(l) {
24634
+ var u = l.target.closest(".iti__country");
24635
+ u && t._highlightListItem(u, false);
24636
+ }, this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList), this._handleClickCountryList = function(l) {
24637
+ var u = l.target.closest(".iti__country");
24638
+ u && t._selectListItem(u);
24639
+ }, this.countryList.addEventListener("click", this._handleClickCountryList);
24640
+ var e = true;
25142
24641
  this._handleClickOffToClose = function() {
25143
- if (!isOpening) {
25144
- _this8._closeDropdown();
25145
- }
25146
- isOpening = false;
25147
- };
25148
- document.documentElement.addEventListener("click", this._handleClickOffToClose);
25149
- var query = "";
25150
- var queryTimer = null;
25151
- this._handleKeydownOnDropdown = function(e) {
25152
- if (["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(e.key)) {
25153
- e.preventDefault();
25154
- e.stopPropagation();
25155
- if (e.key === "ArrowUp" || e.key === "ArrowDown") {
25156
- _this8._handleUpDownKey(e.key);
25157
- } else if (e.key === "Enter") {
25158
- _this8._handleEnterKey();
25159
- } else if (e.key === "Escape") {
25160
- _this8._closeDropdown();
25161
- }
25162
- }
25163
- if (!_this8.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {
25164
- e.stopPropagation();
25165
- if (queryTimer) {
25166
- clearTimeout(queryTimer);
25167
- }
25168
- query += e.key.toLowerCase();
25169
- _this8._searchForCountry(query);
25170
- queryTimer = setTimeout(function() {
25171
- query = "";
25172
- }, 1e3);
25173
- }
25174
- };
25175
- document.addEventListener("keydown", this._handleKeydownOnDropdown);
25176
- if (this.options.countrySearch) {
25177
- var doFilter = function doFilter2() {
25178
- var inputQuery = _this8.searchInput.value.trim();
25179
- if (inputQuery) {
25180
- _this8._filterCountries(inputQuery.toLowerCase());
25181
- } else {
25182
- _this8._filterCountries(null, true);
25183
- }
25184
- };
25185
- var keyupTimer = null;
24642
+ e || t._closeDropdown(), e = false;
24643
+ }, document.documentElement.addEventListener("click", this._handleClickOffToClose);
24644
+ var i = "", o = null;
24645
+ if (this._handleKeydownOnDropdown = function(l) {
24646
+ ["ArrowUp", "ArrowDown", "Enter", "Escape"].includes(l.key) && (l.preventDefault(), l.stopPropagation(), l.key === "ArrowUp" || l.key === "ArrowDown" ? t._handleUpDownKey(l.key) : l.key === "Enter" ? t._handleEnterKey() : l.key === "Escape" && t._closeDropdown()), !t.options.countrySearch && /^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(l.key) && (l.stopPropagation(), o && clearTimeout(o), i += l.key.toLowerCase(), t._searchForCountry(i), o = setTimeout(function() {
24647
+ i = "";
24648
+ }, 1e3));
24649
+ }, document.addEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch) {
24650
+ var r = function() {
24651
+ var u = t.searchInput.value.trim();
24652
+ u ? t._filterCountries(u.toLowerCase()) : t._filterCountries(null, true);
24653
+ }, a = null;
25186
24654
  this._handleSearchChange = function() {
25187
- if (keyupTimer) {
25188
- clearTimeout(keyupTimer);
25189
- }
25190
- keyupTimer = setTimeout(function() {
25191
- doFilter();
25192
- keyupTimer = null;
24655
+ a && clearTimeout(a), a = setTimeout(function() {
24656
+ r(), a = null;
25193
24657
  }, 100);
25194
- };
25195
- this.searchInput.addEventListener("input", this._handleSearchChange);
25196
- this.searchInput.addEventListener("click", function(e) {
25197
- return e.stopPropagation();
24658
+ }, this.searchInput.addEventListener("input", this._handleSearchChange), this.searchInput.addEventListener("click", function(l) {
24659
+ return l.stopPropagation();
25198
24660
  });
25199
24661
  }
25200
- }
25201
- }, {
25202
- key: "_filterCountries",
25203
- value: function _filterCountries(query) {
25204
- var isReset = arguments.length > 1 && arguments[1] !== undefined2 ? arguments[1] : false;
25205
- var isFirst = true;
24662
+ } }, { key: "_filterCountries", value: function(t) {
24663
+ var e = arguments.length > 1 && arguments[1] !== p ? arguments[1] : false, i = true;
25206
24664
  this.countryList.innerHTML = "";
25207
- for (var i2 = 0; i2 < this.countries.length; i2++) {
25208
- var c2 = this.countries[i2];
25209
- var nameLower = c2.name.toLowerCase();
25210
- var fullDialCode = "+".concat(c2.dialCode);
25211
- if (isReset || nameLower.includes(query) || fullDialCode.includes(query) || c2.iso2.includes(query)) {
25212
- this.countryList.appendChild(c2.node);
25213
- if (isFirst) {
25214
- this._highlightListItem(c2.node, false);
25215
- isFirst = false;
25216
- }
25217
- }
25218
- }
25219
- }
25220
- }, {
25221
- key: "_handleUpDownKey",
25222
- value: function _handleUpDownKey(key) {
25223
- var next = key === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
25224
- if (next) {
25225
- if (next.classList.contains("iti__divider")) {
25226
- next = key === "ArrowUp" ? next.previousElementSibling : next.nextElementSibling;
25227
- }
25228
- } else if (this.countryList.childElementCount > 1) {
25229
- next = key === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild;
25230
- }
25231
- if (next) {
25232
- var doFocus = !this.options.countrySearch;
25233
- this._highlightListItem(next, doFocus);
25234
- if (this.options.countrySearch) {
25235
- this._scrollTo(next, false);
25236
- }
25237
- }
25238
- }
25239
- }, {
25240
- key: "_handleEnterKey",
25241
- value: function _handleEnterKey() {
25242
- if (this.highlightedItem) {
25243
- this._selectListItem(this.highlightedItem);
25244
- }
25245
- }
25246
- }, {
25247
- key: "_searchForCountry",
25248
- value: function _searchForCountry(query) {
25249
- for (var i2 = 0; i2 < this.countries.length; i2++) {
25250
- if (this._startsWith(this.countries[i2].name, query)) {
25251
- var listItem = this.countries[i2].node;
25252
- this._highlightListItem(listItem, false);
25253
- this._scrollTo(listItem, true);
24665
+ for (var o = 0; o < this.countries.length; o++) {
24666
+ var r = this.countries[o], a = r.name.toLowerCase(), l = "+".concat(r.dialCode);
24667
+ (e || a.includes(t) || l.includes(t) || r.iso2.includes(t)) && (this.countryList.appendChild(r.node), i && (this._highlightListItem(r.node, false), i = false));
24668
+ }
24669
+ } }, { key: "_handleUpDownKey", value: function(t) {
24670
+ var e = t === "ArrowUp" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
24671
+ if (e ? e.classList.contains("iti__divider") && (e = t === "ArrowUp" ? e.previousElementSibling : e.nextElementSibling) : this.countryList.childElementCount > 1 && (e = t === "ArrowUp" ? this.countryList.lastElementChild : this.countryList.firstElementChild), e) {
24672
+ var i = !this.options.countrySearch;
24673
+ this._highlightListItem(e, i), this.options.countrySearch && this._scrollTo(e, false);
24674
+ }
24675
+ } }, { key: "_handleEnterKey", value: function() {
24676
+ this.highlightedItem && this._selectListItem(this.highlightedItem);
24677
+ } }, { key: "_searchForCountry", value: function(t) {
24678
+ for (var e = 0; e < this.countries.length; e++)
24679
+ if (this._startsWith(this.countries[e].name, t)) {
24680
+ var i = this.countries[e].node;
24681
+ this._highlightListItem(i, false), this._scrollTo(i, true);
25254
24682
  break;
25255
24683
  }
25256
- }
25257
- }
25258
- }, {
25259
- key: "_startsWith",
25260
- value: function _startsWith(a, b) {
25261
- return a.substr(0, b.length).toLowerCase() === b;
25262
- }
25263
- }, {
25264
- key: "_updateValFromNumber",
25265
- value: function _updateValFromNumber(fullNumber) {
25266
- var number = fullNumber;
24684
+ } }, { key: "_startsWith", value: function(t, e) {
24685
+ return t.substr(0, e.length).toLowerCase() === e;
24686
+ } }, { key: "_updateValFromNumber", value: function(t) {
24687
+ var e = t;
25267
24688
  if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
25268
- var useNational = this.options.nationalMode || number.charAt(0) !== "+" && !this.options.showSelectedDialCode;
25269
- var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;
25270
- var format = useNational ? NATIONAL : INTERNATIONAL;
25271
- number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);
25272
- }
25273
- number = this._beforeSetNumber(number);
25274
- this.telInput.value = number;
25275
- }
25276
- }, {
25277
- key: "_updateFlagFromNumber",
25278
- value: function _updateFlagFromNumber(fullNumber) {
25279
- var plusIndex = fullNumber.indexOf("+");
25280
- var number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber;
25281
- var selectedDialCode = this.selectedCountryData.dialCode;
25282
- var isNanp = selectedDialCode === "1";
25283
- if (number && isNanp && number.charAt(0) !== "+") {
25284
- if (number.charAt(0) !== "1") {
25285
- number = "1".concat(number);
25286
- }
25287
- number = "+".concat(number);
25288
- }
25289
- if (this.options.showSelectedDialCode && selectedDialCode && number.charAt(0) !== "+") {
25290
- number = "+".concat(selectedDialCode).concat(number);
25291
- }
25292
- var dialCode = this._getDialCode(number, true);
25293
- var numeric = this._getNumeric(number);
25294
- var countryCode = null;
25295
- if (dialCode) {
25296
- var countryCodes = this.countryCodes[this._getNumeric(dialCode)];
25297
- var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1;
25298
- var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric);
25299
- if (!isRegionlessNanpNumber && !alreadySelected) {
25300
- for (var j = 0; j < countryCodes.length; j++) {
25301
- if (countryCodes[j]) {
25302
- countryCode = countryCodes[j];
24689
+ var i = this.options.nationalMode || e.charAt(0) !== "+" && !this.options.showSelectedDialCode, o = intlTelInputUtils.numberFormat, r = o.NATIONAL, a = o.INTERNATIONAL, l = i ? r : a;
24690
+ e = intlTelInputUtils.formatNumber(e, this.selectedCountryData.iso2, l);
24691
+ }
24692
+ e = this._beforeSetNumber(e), this.telInput.value = e;
24693
+ } }, { key: "_updateFlagFromNumber", value: function(t) {
24694
+ var e = t.indexOf("+"), i = e ? t.substring(e) : t, o = this.selectedCountryData.dialCode, r = o === "1";
24695
+ i && r && i.charAt(0) !== "+" && (i.charAt(0) !== "1" && (i = "1".concat(i)), i = "+".concat(i)), this.options.showSelectedDialCode && o && i.charAt(0) !== "+" && (i = "+".concat(o).concat(i));
24696
+ var a = this._getDialCode(i, true), l = this._getNumeric(i), u = null;
24697
+ if (a) {
24698
+ var c = this.countryCodes[this._getNumeric(a)], v = c.indexOf(this.selectedCountryData.iso2) !== -1 && l.length <= a.length - 1, g = o === "1" && this._isRegionlessNanp(l);
24699
+ if (!g && !v) {
24700
+ for (var y = 0; y < c.length; y++)
24701
+ if (c[y]) {
24702
+ u = c[y];
25303
24703
  break;
25304
24704
  }
25305
- }
25306
24705
  }
25307
- } else if (number.charAt(0) === "+" && numeric.length) {
25308
- countryCode = "";
25309
- } else if (!number || number === "+") {
25310
- countryCode = this.defaultCountry;
25311
- }
25312
- if (countryCode !== null) {
25313
- return this._setFlag(countryCode);
25314
- }
25315
- return false;
25316
- }
25317
- }, {
25318
- key: "_isRegionlessNanp",
25319
- value: function _isRegionlessNanp(number) {
25320
- var numeric = this._getNumeric(number);
25321
- if (numeric.charAt(0) === "1") {
25322
- var areaCode = numeric.substr(1, 3);
25323
- return regionlessNanpNumbers.indexOf(areaCode) !== -1;
24706
+ } else
24707
+ i.charAt(0) === "+" && l.length ? u = "" : (!i || i === "+") && (u = this.defaultCountry);
24708
+ return u !== null ? this._setFlag(u) : false;
24709
+ } }, { key: "_isRegionlessNanp", value: function(t) {
24710
+ var e = this._getNumeric(t);
24711
+ if (e.charAt(0) === "1") {
24712
+ var i = e.substr(1, 3);
24713
+ return q.indexOf(i) !== -1;
25324
24714
  }
25325
24715
  return false;
25326
- }
25327
- }, {
25328
- key: "_highlightListItem",
25329
- value: function _highlightListItem(listItem, shouldFocus) {
25330
- var prevItem = this.highlightedItem;
25331
- if (prevItem) {
25332
- prevItem.classList.remove("iti__highlight");
25333
- }
25334
- this.highlightedItem = listItem;
25335
- this.highlightedItem.classList.add("iti__highlight");
25336
- this.selectedFlag.setAttribute("aria-activedescendant", listItem.getAttribute("id"));
25337
- if (shouldFocus) {
25338
- this.highlightedItem.focus();
25339
- }
25340
- }
25341
- }, {
25342
- key: "_getCountryData",
25343
- value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) {
25344
- var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
25345
- for (var i2 = 0; i2 < countryList.length; i2++) {
25346
- if (countryList[i2].iso2 === countryCode) {
25347
- return countryList[i2];
25348
- }
25349
- }
25350
- if (allowFail) {
24716
+ } }, { key: "_highlightListItem", value: function(t, e) {
24717
+ var i = this.highlightedItem;
24718
+ i && i.classList.remove("iti__highlight"), this.highlightedItem = t, this.highlightedItem.classList.add("iti__highlight"), this.selectedFlag.setAttribute("aria-activedescendant", t.getAttribute("id")), e && this.highlightedItem.focus();
24719
+ } }, { key: "_getCountryData", value: function(t, e, i) {
24720
+ for (var o = e ? h : this.countries, r = 0; r < o.length; r++)
24721
+ if (o[r].iso2 === t)
24722
+ return o[r];
24723
+ if (i)
25351
24724
  return null;
25352
- }
25353
- throw new Error("No country data for '".concat(countryCode, "'"));
25354
- }
25355
- }, {
25356
- key: "_setFlag",
25357
- value: function _setFlag(countryCode) {
25358
- var _this$options3 = this.options, allowDropdown = _this$options3.allowDropdown, showSelectedDialCode = _this$options3.showSelectedDialCode, showFlags = _this$options3.showFlags;
25359
- var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
25360
- this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
25361
- if (this.selectedCountryData.iso2) {
25362
- this.defaultCountry = this.selectedCountryData.iso2;
25363
- }
25364
- if (showFlags) {
25365
- this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode));
25366
- }
25367
- this._setSelectedCountryFlagTitleAttribute(countryCode, showSelectedDialCode);
25368
- if (showSelectedDialCode) {
25369
- var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
25370
- this.selectedDialCode.innerHTML = dialCode;
25371
- var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
25372
- if (this.isRTL) {
25373
- this.telInput.style.paddingRight = "".concat(selectedFlagWidth + 6, "px");
25374
- } else {
25375
- this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px");
25376
- }
25377
- }
25378
- this._updatePlaceholder();
25379
- if (allowDropdown) {
25380
- var prevItem = this.activeItem;
25381
- if (prevItem) {
25382
- prevItem.classList.remove("iti__active");
25383
- prevItem.setAttribute("aria-selected", "false");
25384
- }
25385
- if (countryCode) {
25386
- var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode));
25387
- nextItem.setAttribute("aria-selected", "true");
25388
- nextItem.classList.add("iti__active");
25389
- this.activeItem = nextItem;
25390
- }
25391
- }
25392
- return prevCountry.iso2 !== countryCode;
25393
- }
25394
- }, {
25395
- key: "_setSelectedCountryFlagTitleAttribute",
25396
- value: function _setSelectedCountryFlagTitleAttribute(countryCode, showSelectedDialCode) {
25397
- if (!this.selectedFlag) {
25398
- return;
25399
- }
25400
- var title;
25401
- if (countryCode && !showSelectedDialCode) {
25402
- title = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode);
25403
- } else if (countryCode) {
25404
- title = this.selectedCountryData.name;
25405
- } else {
25406
- title = "Unknown";
25407
- }
25408
- this.selectedFlag.setAttribute("title", title);
25409
- }
25410
- }, {
25411
- key: "_getHiddenSelectedFlagWidth",
25412
- value: function _getHiddenSelectedFlagWidth() {
25413
- var containerClone = this.telInput.parentNode.cloneNode();
25414
- containerClone.style.visibility = "hidden";
25415
- document.body.appendChild(containerClone);
25416
- var flagsContainerClone = this.flagsContainer.cloneNode();
25417
- containerClone.appendChild(flagsContainerClone);
25418
- var selectedFlagClone = this.selectedFlag.cloneNode(true);
25419
- flagsContainerClone.appendChild(selectedFlagClone);
25420
- var width = selectedFlagClone.offsetWidth;
25421
- containerClone.parentNode.removeChild(containerClone);
25422
- return width;
25423
- }
25424
- }, {
25425
- key: "_updatePlaceholder",
25426
- value: function _updatePlaceholder() {
25427
- var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
25428
- if (window.intlTelInputUtils && shouldSetPlaceholder) {
25429
- var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType];
25430
- var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : "";
25431
- placeholder = this._beforeSetNumber(placeholder);
25432
- if (typeof this.options.customPlaceholder === "function") {
25433
- placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);
25434
- }
25435
- this.telInput.setAttribute("placeholder", placeholder);
25436
- }
25437
- }
25438
- }, {
25439
- key: "_selectListItem",
25440
- value: function _selectListItem(listItem) {
25441
- var flagChanged = this._setFlag(listItem.getAttribute("data-country-code"));
25442
- this._closeDropdown();
25443
- this._updateDialCode(listItem.getAttribute("data-dial-code"));
25444
- this.telInput.focus();
25445
- if (flagChanged) {
25446
- this._triggerCountryChange();
25447
- }
25448
- }
25449
- }, {
25450
- key: "_closeDropdown",
25451
- value: function _closeDropdown() {
25452
- this.dropdownContent.classList.add("iti__hide");
25453
- this.selectedFlag.setAttribute("aria-expanded", "false");
25454
- this.selectedFlag.removeAttribute("aria-activedescendant");
25455
- this.dropdownArrow.classList.remove("iti__arrow--up");
25456
- document.removeEventListener("keydown", this._handleKeydownOnDropdown);
25457
- if (this.options.countrySearch) {
25458
- this.searchInput.removeEventListener("input", this._handleSearchChange);
25459
- }
25460
- document.documentElement.removeEventListener("click", this._handleClickOffToClose);
25461
- this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList);
25462
- this.countryList.removeEventListener("click", this._handleClickCountryList);
25463
- if (this.options.dropdownContainer) {
25464
- if (!this.options.useFullscreenPopup) {
25465
- window.removeEventListener("scroll", this._handleWindowScroll);
25466
- }
25467
- if (this.dropdown.parentNode) {
25468
- this.dropdown.parentNode.removeChild(this.dropdown);
25469
- }
25470
- }
25471
- this._trigger("close:countrydropdown");
25472
- }
25473
- }, {
25474
- key: "_scrollTo",
25475
- value: function _scrollTo(element, middle) {
25476
- var container2 = this.dropdownContent;
25477
- var windowTop = document.documentElement.scrollTop;
25478
- var containerHeight = container2.offsetHeight;
25479
- var containerTop = container2.getBoundingClientRect().top + windowTop;
25480
- var containerBottom = containerTop + containerHeight;
25481
- var elementHeight = element.offsetHeight;
25482
- var elementTop = element.getBoundingClientRect().top + windowTop;
25483
- var elementBottom = elementTop + elementHeight;
25484
- var newScrollTop = elementTop - containerTop + container2.scrollTop;
25485
- var middleOffset = containerHeight / 2 - elementHeight / 2;
25486
- if (elementTop < containerTop) {
25487
- if (middle) {
25488
- newScrollTop -= middleOffset;
25489
- }
25490
- container2.scrollTop = newScrollTop;
25491
- } else if (elementBottom > containerBottom) {
25492
- if (middle) {
25493
- newScrollTop += middleOffset;
25494
- }
25495
- var heightDifference = containerHeight - elementHeight;
25496
- container2.scrollTop = newScrollTop - heightDifference;
25497
- }
25498
- }
25499
- }, {
25500
- key: "_updateDialCode",
25501
- value: function _updateDialCode(newDialCodeBare) {
25502
- var inputVal = this.telInput.value;
25503
- var newDialCode = "+".concat(newDialCodeBare);
25504
- var newNumber;
25505
- if (inputVal.charAt(0) === "+") {
25506
- var prevDialCode = this._getDialCode(inputVal);
25507
- if (prevDialCode) {
25508
- newNumber = inputVal.replace(prevDialCode, newDialCode);
25509
- } else {
25510
- newNumber = newDialCode;
25511
- }
25512
- this.telInput.value = newNumber;
25513
- } else if (this.options.autoInsertDialCode) {
25514
- if (inputVal) {
25515
- newNumber = newDialCode + inputVal;
25516
- } else {
25517
- newNumber = newDialCode;
25518
- }
25519
- this.telInput.value = newNumber;
25520
- }
25521
- }
25522
- }, {
25523
- key: "_getDialCode",
25524
- value: function _getDialCode(number, includeAreaCode) {
25525
- var dialCode = "";
25526
- if (number.charAt(0) === "+") {
25527
- var numericChars = "";
25528
- for (var i2 = 0; i2 < number.length; i2++) {
25529
- var c2 = number.charAt(i2);
25530
- if (!isNaN(parseInt(c2, 10))) {
25531
- numericChars += c2;
25532
- if (includeAreaCode) {
25533
- if (this.countryCodes[numericChars]) {
25534
- dialCode = number.substr(0, i2 + 1);
25535
- }
25536
- } else {
25537
- if (this.dialCodes[numericChars]) {
25538
- dialCode = number.substr(0, i2 + 1);
25539
- break;
25540
- }
25541
- }
25542
- if (numericChars.length === this.countryCodeMaxLen) {
24725
+ throw new Error("No country data for '".concat(t, "'"));
24726
+ } }, { key: "_setFlag", value: function(t) {
24727
+ var e = this.options, i = e.allowDropdown, o = e.showSelectedDialCode, r = e.showFlags, a = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
24728
+ if (this.selectedCountryData = t ? this._getCountryData(t, false, false) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), r && this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(t)), this._setSelectedCountryFlagTitleAttribute(t, o), o) {
24729
+ var l = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
24730
+ this.selectedDialCode.innerHTML = l;
24731
+ var u = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
24732
+ this.isRTL ? this.telInput.style.paddingRight = "".concat(u + 6, "px") : this.telInput.style.paddingLeft = "".concat(u + 6, "px");
24733
+ }
24734
+ if (this._updatePlaceholder(), i) {
24735
+ var c = this.activeItem;
24736
+ if (c && (c.classList.remove("iti__active"), c.setAttribute("aria-selected", "false")), t) {
24737
+ var v = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(t, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(t));
24738
+ v.setAttribute("aria-selected", "true"), v.classList.add("iti__active"), this.activeItem = v;
24739
+ }
24740
+ }
24741
+ return a.iso2 !== t;
24742
+ } }, { key: "_setSelectedCountryFlagTitleAttribute", value: function(t, e) {
24743
+ if (this.selectedFlag) {
24744
+ var i;
24745
+ t && !e ? i = "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : t ? i = this.selectedCountryData.name : i = "Unknown", this.selectedFlag.setAttribute("title", i);
24746
+ }
24747
+ } }, { key: "_getHiddenSelectedFlagWidth", value: function() {
24748
+ var t = this.telInput.parentNode.cloneNode();
24749
+ t.style.visibility = "hidden", document.body.appendChild(t);
24750
+ var e = this.flagsContainer.cloneNode();
24751
+ t.appendChild(e);
24752
+ var i = this.selectedFlag.cloneNode(true);
24753
+ e.appendChild(i);
24754
+ var o = i.offsetWidth;
24755
+ return t.parentNode.removeChild(t), o;
24756
+ } }, { key: "_updatePlaceholder", value: function() {
24757
+ var t = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
24758
+ if (window.intlTelInputUtils && t) {
24759
+ var e = intlTelInputUtils.numberType[this.options.placeholderNumberType], i = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, e) : "";
24760
+ i = this._beforeSetNumber(i), typeof this.options.customPlaceholder == "function" && (i = this.options.customPlaceholder(i, this.selectedCountryData)), this.telInput.setAttribute("placeholder", i);
24761
+ }
24762
+ } }, { key: "_selectListItem", value: function(t) {
24763
+ var e = this._setFlag(t.getAttribute("data-country-code"));
24764
+ this._closeDropdown(), this._updateDialCode(t.getAttribute("data-dial-code")), this.telInput.focus(), e && this._triggerCountryChange();
24765
+ } }, { key: "_closeDropdown", value: function() {
24766
+ this.dropdownContent.classList.add("iti__hide"), this.selectedFlag.setAttribute("aria-expanded", "false"), this.selectedFlag.removeAttribute("aria-activedescendant"), this.dropdownArrow.classList.remove("iti__arrow--up"), document.removeEventListener("keydown", this._handleKeydownOnDropdown), this.options.countrySearch && this.searchInput.removeEventListener("input", this._handleSearchChange), document.documentElement.removeEventListener("click", this._handleClickOffToClose), this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList), this.countryList.removeEventListener("click", this._handleClickCountryList), this.options.dropdownContainer && (this.options.useFullscreenPopup || window.removeEventListener("scroll", this._handleWindowScroll), this.dropdown.parentNode && this.dropdown.parentNode.removeChild(this.dropdown)), this._trigger("close:countrydropdown");
24767
+ } }, { key: "_scrollTo", value: function(t, e) {
24768
+ var i = this.dropdownContent, o = document.documentElement.scrollTop, r = i.offsetHeight, a = i.getBoundingClientRect().top + o, l = a + r, u = t.offsetHeight, c = t.getBoundingClientRect().top + o, v = c + u, g = c - a + i.scrollTop, y = r / 2 - u / 2;
24769
+ if (c < a)
24770
+ e && (g -= y), i.scrollTop = g;
24771
+ else if (v > l) {
24772
+ e && (g += y);
24773
+ var D = r - u;
24774
+ i.scrollTop = g - D;
24775
+ }
24776
+ } }, { key: "_updateDialCode", value: function(t) {
24777
+ var e = this.telInput.value, i = "+".concat(t), o;
24778
+ if (e.charAt(0) === "+") {
24779
+ var r = this._getDialCode(e);
24780
+ r ? o = e.replace(r, i) : o = i, this.telInput.value = o;
24781
+ } else
24782
+ this.options.autoInsertDialCode && (e ? o = i + e : o = i, this.telInput.value = o);
24783
+ } }, { key: "_getDialCode", value: function(t, e) {
24784
+ var i = "";
24785
+ if (t.charAt(0) === "+")
24786
+ for (var o = "", r = 0; r < t.length; r++) {
24787
+ var a = t.charAt(r);
24788
+ if (!isNaN(parseInt(a, 10))) {
24789
+ if (o += a, e)
24790
+ this.countryCodes[o] && (i = t.substr(0, r + 1));
24791
+ else if (this.dialCodes[o]) {
24792
+ i = t.substr(0, r + 1);
25543
24793
  break;
25544
24794
  }
24795
+ if (o.length === this.countryCodeMaxLen)
24796
+ break;
25545
24797
  }
25546
24798
  }
25547
- }
25548
- return dialCode;
25549
- }
25550
- }, {
25551
- key: "_getFullNumber",
25552
- value: function _getFullNumber() {
25553
- var val = this.telInput.value.trim();
25554
- var dialCode = this.selectedCountryData.dialCode;
25555
- var prefix;
25556
- var numericVal = this._getNumeric(val);
25557
- if (this.options.showSelectedDialCode && val.charAt(0) !== "+" && dialCode && numericVal) {
25558
- prefix = "+".concat(dialCode);
25559
- } else {
25560
- prefix = "";
25561
- }
25562
- return prefix + val;
25563
- }
25564
- }, {
25565
- key: "_beforeSetNumber",
25566
- value: function _beforeSetNumber(fullNumber) {
25567
- var number = fullNumber;
24799
+ return i;
24800
+ } }, { key: "_getFullNumber", value: function() {
24801
+ var t = this.telInput.value.trim(), e = this.selectedCountryData.dialCode, i, o = this._getNumeric(t);
24802
+ return this.options.showSelectedDialCode && t.charAt(0) !== "+" && e && o ? i = "+".concat(e) : i = "", i + t;
24803
+ } }, { key: "_beforeSetNumber", value: function(t) {
24804
+ var e = t;
25568
24805
  if (this.options.showSelectedDialCode) {
25569
- var dialCode = this._getDialCode(number);
25570
- if (dialCode) {
25571
- dialCode = "+".concat(this.selectedCountryData.dialCode);
25572
- var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
25573
- number = number.substr(start);
24806
+ var i = this._getDialCode(e);
24807
+ if (i) {
24808
+ i = "+".concat(this.selectedCountryData.dialCode);
24809
+ var o = e[i.length] === " " || e[i.length] === "-" ? i.length + 1 : i.length;
24810
+ e = e.substr(o);
25574
24811
  }
25575
24812
  }
25576
- return this._cap(number);
25577
- }
25578
- }, {
25579
- key: "_triggerCountryChange",
25580
- value: function _triggerCountryChange() {
24813
+ return this._cap(e);
24814
+ } }, { key: "_triggerCountryChange", value: function() {
25581
24815
  this._trigger("countrychange");
25582
- }
25583
- }, {
25584
- key: "_formatNumberAsYouType",
25585
- value: function _formatNumberAsYouType() {
25586
- var val = this._getFullNumber().trim();
25587
- var result = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(val, this.selectedCountryData.iso2) : val;
24816
+ } }, { key: "_formatNumberAsYouType", value: function() {
24817
+ var t = this._getFullNumber().trim(), e = window.intlTelInputUtils ? intlTelInputUtils.formatNumberAsYouType(t, this.selectedCountryData.iso2) : t;
25588
24818
  if (this.options.showSelectedDialCode && this.telInput.value.charAt(0) !== "+") {
25589
- var dialCode = this.selectedCountryData.dialCode;
25590
- return result.split("+".concat(dialCode))[1].trim();
25591
- }
25592
- return result;
25593
- }
25594
- }, {
25595
- key: "handleAutoCountry",
25596
- value: function handleAutoCountry() {
25597
- if (this.options.initialCountry === "auto") {
25598
- this.defaultCountry = window.intlTelInputGlobals.autoCountry;
25599
- if (!this.telInput.value) {
25600
- this.setCountry(this.defaultCountry);
25601
- }
25602
- this.resolveAutoCountryPromise();
25603
- }
25604
- }
25605
- }, {
25606
- key: "handleUtils",
25607
- value: function handleUtils() {
25608
- if (window.intlTelInputUtils) {
25609
- if (this.telInput.value) {
25610
- this._updateValFromNumber(this.telInput.value);
25611
- }
25612
- this._updatePlaceholder();
25613
- }
25614
- this.resolveUtilsScriptPromise();
25615
- }
25616
- }, {
25617
- key: "destroy",
25618
- value: function destroy() {
25619
- var form = this.telInput.form;
24819
+ var i = this.selectedCountryData.dialCode;
24820
+ return e.split("+".concat(i))[1].trim();
24821
+ }
24822
+ return e;
24823
+ } }, { key: "handleAutoCountry", value: function() {
24824
+ this.options.initialCountry === "auto" && (this.defaultCountry = window.intlTelInputGlobals.autoCountry, this.telInput.value || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
24825
+ } }, { key: "handleUtils", value: function() {
24826
+ window.intlTelInputUtils && (this.telInput.value && this._updateValFromNumber(this.telInput.value), this._updatePlaceholder()), this.resolveUtilsScriptPromise();
24827
+ } }, { key: "destroy", value: function() {
24828
+ var t = this.telInput.form;
25620
24829
  if (this.options.allowDropdown) {
25621
- this._closeDropdown();
25622
- this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag);
25623
- this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
25624
- var label = this.telInput.closest("label");
25625
- if (label) {
25626
- label.removeEventListener("click", this._handleLabelClick);
25627
- }
25628
- }
25629
- if (this.hiddenInput && form) {
25630
- form.removeEventListener("submit", this._handleHiddenInputSubmit);
25631
- }
25632
- if (this.options.autoInsertDialCode) {
25633
- if (form) {
25634
- form.removeEventListener("submit", this._handleSubmitOrBlurEvent);
25635
- }
25636
- this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent);
25637
- }
25638
- this.telInput.removeEventListener("input", this._handleKeyEvent);
25639
- this.telInput.removeEventListener("cut", this._handleClipboardEvent);
25640
- this.telInput.removeEventListener("paste", this._handleClipboardEvent);
25641
- this.telInput.removeAttribute("data-intl-tel-input-id");
25642
- var wrapper = this.telInput.parentNode;
25643
- wrapper.parentNode.insertBefore(this.telInput, wrapper);
25644
- wrapper.parentNode.removeChild(wrapper);
25645
- delete window.intlTelInputGlobals.instances[this.id];
25646
- }
25647
- }, {
25648
- key: "getExtension",
25649
- value: function getExtension() {
25650
- if (window.intlTelInputUtils) {
25651
- return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
25652
- }
25653
- return "";
25654
- }
25655
- }, {
25656
- key: "getNumber",
25657
- value: function getNumber(format) {
24830
+ this._closeDropdown(), this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag), this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
24831
+ var e = this.telInput.closest("label");
24832
+ e && e.removeEventListener("click", this._handleLabelClick);
24833
+ }
24834
+ this.hiddenInput && t && t.removeEventListener("submit", this._handleHiddenInputSubmit), this.options.autoInsertDialCode && (t && t.removeEventListener("submit", this._handleSubmitOrBlurEvent), this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent)), this.telInput.removeEventListener("input", this._handleKeyEvent), this.telInput.removeEventListener("cut", this._handleClipboardEvent), this.telInput.removeEventListener("paste", this._handleClipboardEvent), this.telInput.removeAttribute("data-intl-tel-input-id");
24835
+ var i = this.telInput.parentNode;
24836
+ i.parentNode.insertBefore(this.telInput, i), i.parentNode.removeChild(i), delete window.intlTelInputGlobals.instances[this.id];
24837
+ } }, { key: "getExtension", value: function() {
24838
+ return window.intlTelInputUtils ? intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2) : "";
24839
+ } }, { key: "getNumber", value: function(t) {
25658
24840
  if (window.intlTelInputUtils) {
25659
- var iso2 = this.selectedCountryData.iso2;
25660
- return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format);
24841
+ var e = this.selectedCountryData.iso2;
24842
+ return intlTelInputUtils.formatNumber(this._getFullNumber(), e, t);
25661
24843
  }
25662
24844
  return "";
25663
- }
25664
- }, {
25665
- key: "getNumberType",
25666
- value: function getNumberType() {
25667
- if (window.intlTelInputUtils) {
25668
- return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
25669
- }
25670
- return -99;
25671
- }
25672
- }, {
25673
- key: "getSelectedCountryData",
25674
- value: function getSelectedCountryData() {
24845
+ } }, { key: "getNumberType", value: function() {
24846
+ return window.intlTelInputUtils ? intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2) : -99;
24847
+ } }, { key: "getSelectedCountryData", value: function() {
25675
24848
  return this.selectedCountryData;
25676
- }
25677
- }, {
25678
- key: "getValidationError",
25679
- value: function getValidationError() {
24849
+ } }, { key: "getValidationError", value: function() {
25680
24850
  if (window.intlTelInputUtils) {
25681
- var iso2 = this.selectedCountryData.iso2;
25682
- return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2);
24851
+ var t = this.selectedCountryData.iso2;
24852
+ return intlTelInputUtils.getValidationError(this._getFullNumber(), t);
25683
24853
  }
25684
24854
  return -99;
25685
- }
25686
- }, {
25687
- key: "isValidNumber",
25688
- value: function isValidNumber() {
25689
- var val = this._getFullNumber().trim();
25690
- return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null;
25691
- }
25692
- }, {
25693
- key: "isValidNumberPrecise",
25694
- value: function isValidNumberPrecise() {
25695
- var val = this._getFullNumber().trim();
25696
- return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null;
25697
- }
25698
- }, {
25699
- key: "setCountry",
25700
- value: function setCountry(originalCountryCode) {
25701
- var countryCode = originalCountryCode.toLowerCase();
25702
- if (this.selectedCountryData.iso2 !== countryCode) {
25703
- this._setFlag(countryCode);
25704
- this._updateDialCode(this.selectedCountryData.dialCode);
25705
- this._triggerCountryChange();
25706
- }
25707
- }
25708
- }, {
25709
- key: "setNumber",
25710
- value: function setNumber(number) {
25711
- var flagChanged = this._updateFlagFromNumber(number);
25712
- this._updateValFromNumber(number);
25713
- if (flagChanged) {
25714
- this._triggerCountryChange();
25715
- }
25716
- }
25717
- }, {
25718
- key: "setPlaceholderNumberType",
25719
- value: function setPlaceholderNumberType(type) {
25720
- this.options.placeholderNumberType = type;
25721
- this._updatePlaceholder();
25722
- }
25723
- }]);
25724
- return Iti2;
25725
- }();
25726
- intlTelInputGlobals.getCountryData = function() {
25727
- return allCountries;
25728
- };
25729
- var injectScript = function injectScript2(path, handleSuccess, handleFailure) {
25730
- var script = document.createElement("script");
25731
- script.onload = function() {
25732
- forEachInstance("handleUtils");
25733
- if (handleSuccess) {
25734
- handleSuccess();
25735
- }
24855
+ } }, { key: "isValidNumber", value: function() {
24856
+ var t = this._getFullNumber().trim();
24857
+ return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(t, this.selectedCountryData.iso2) : null;
24858
+ } }, { key: "isValidNumberPrecise", value: function() {
24859
+ var t = this._getFullNumber().trim();
24860
+ return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(t, this.selectedCountryData.iso2) : null;
24861
+ } }, { key: "setCountry", value: function(t) {
24862
+ var e = t.toLowerCase();
24863
+ this.selectedCountryData.iso2 !== e && (this._setFlag(e), this._updateDialCode(this.selectedCountryData.dialCode), this._triggerCountryChange());
24864
+ } }, { key: "setNumber", value: function(t) {
24865
+ var e = this._updateFlagFromNumber(t);
24866
+ this._updateValFromNumber(t), e && this._triggerCountryChange();
24867
+ } }, { key: "setPlaceholderNumberType", value: function(t) {
24868
+ this.options.placeholderNumberType = t, this._updatePlaceholder();
24869
+ } }]), s;
24870
+ }();
24871
+ L.getCountryData = function() {
24872
+ return h;
25736
24873
  };
25737
- script.onerror = function() {
25738
- forEachInstance("rejectUtilsScriptPromise");
25739
- if (handleFailure) {
25740
- handleFailure();
25741
- }
24874
+ var j = function(n, t, e) {
24875
+ var i = document.createElement("script");
24876
+ i.onload = function() {
24877
+ S("handleUtils"), t && t();
24878
+ }, i.onerror = function() {
24879
+ S("rejectUtilsScriptPromise"), e && e();
24880
+ }, i.className = "iti-load-utils", i.async = true, i.src = n, document.body.appendChild(i);
25742
24881
  };
25743
- script.className = "iti-load-utils";
25744
- script.async = true;
25745
- script.src = path;
25746
- document.body.appendChild(script);
25747
- };
25748
- intlTelInputGlobals.loadUtils = function(path) {
25749
- if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
25750
- window.intlTelInputGlobals.startedLoadingUtilsScript = true;
25751
- if (typeof Promise !== "undefined") {
25752
- return new Promise(function(resolve, reject) {
25753
- return injectScript(path, resolve, reject);
25754
- });
24882
+ return L.loadUtils = function(s) {
24883
+ if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
24884
+ if (window.intlTelInputGlobals.startedLoadingUtilsScript = true, typeof Promise < "u")
24885
+ return new Promise(function(n, t) {
24886
+ return j(s, n, t);
24887
+ });
24888
+ j(s);
25755
24889
  }
25756
- injectScript(path);
25757
- }
25758
- return null;
25759
- };
25760
- intlTelInputGlobals.defaults = defaults;
25761
- intlTelInputGlobals.version = "19.1.1";
25762
- return function(input, options) {
25763
- var iti = new Iti(input, options);
25764
- iti._init();
25765
- input.setAttribute("data-intl-tel-input-id", iti.id);
25766
- window.intlTelInputGlobals.instances[iti.id] = iti;
25767
- return iti;
25768
- };
25769
- }();
24890
+ return null;
24891
+ }, L.defaults = B, L.version = "19.2.0", function(s, n) {
24892
+ var t = new Y(s, n);
24893
+ return t._init(), s.setAttribute("data-intl-tel-input-id", t.id), window.intlTelInputGlobals.instances[t.id] = t, t;
24894
+ };
24895
+ }();
24896
+ });
25770
24897
  });
24898
+ var at = {};
24899
+ ot(at, { default: () => st });
24900
+ module2.exports = rt(at);
24901
+ var w = x(require_react());
24902
+ var d = x(require_prop_types());
24903
+ var K = x(R());
24904
+ var O = ({ initialValue: p, setCountryIso: h, setNumber: f, setIsValid: m, setErrorCode: _, initOptions: N }) => {
24905
+ let b = (0, w.useRef)(null), C = (0, w.useRef)(null), I = () => {
24906
+ let k = C.current.getNumber(), F = C.current.getSelectedCountryData().iso2;
24907
+ if (f(k), h(F), C.current.isValidNumber())
24908
+ m(true), _(null);
24909
+ else {
24910
+ let P = C.current.getValidationError();
24911
+ m(false), _(P);
24912
+ }
24913
+ };
24914
+ return (0, w.useEffect)(() => (C.current = (0, K.default)(b.current, N), b.current.addEventListener("countrychange", I), () => {
24915
+ b.current.removeEventListener("countrychange", I), C.current.destroy();
24916
+ }), []), w.default.createElement("input", { type: "phone", ref: b, onInput: I, defaultValue: p });
24917
+ };
24918
+ O.propTypes = { initialValue: d.default.string, setNumber: d.default.func.isRequired, setCountryIso: d.default.func, setIsValid: d.default.func.isRequired, setErrorCode: d.default.func.isRequired, initOptions: d.default.shape({ allowDropdown: d.default.bool, autoInsertDialCode: d.default.bool, autoPlaceholder: d.default.string, containerClass: d.default.string, countrySearch: d.default.bool, customPlaceholder: d.default.func, dropdownContainer: d.default.node, excludeCountries: d.default.arrayOf(d.default.string), fixDropdownWidth: d.default.bool, formatAsYouType: d.default.bool, formatOnDisplay: d.default.bool, geoIpLookup: d.default.func, hiddenInput: d.default.func, i18n: d.default.objectOf(d.default.string), initialCountry: d.default.string, nationalMode: d.default.bool, onlyCountries: d.default.arrayOf(d.default.string), placeholderNumberType: d.default.string, preferredCountries: d.default.arrayOf(d.default.string), showFlags: d.default.bool, showSelectedDialCode: d.default.bool, useFullscreenPopup: d.default.bool, utilsScript: d.default.string }) };
24919
+ O.defaultProps = { initialValue: "", setCountryIso: () => {
24920
+ }, initOptions: {} };
24921
+ var st = O;
25771
24922
  }
25772
24923
  });
25773
24924
 
25774
- // index.js
25775
- var require_intl_tel_input = __commonJS({
25776
- "index.js"(exports, module2) {
25777
- module2.exports = require_intlTelInput();
25778
- }
25779
- });
25780
-
25781
- // react/DemoApp.js
25782
- var import_react2 = __toESM(require_react());
25783
- var import_client = __toESM(require_client());
25784
-
25785
- // react/IntlTelInput.js
24925
+ // react/demo/ValidationApp.js
25786
24926
  var import_react = __toESM(require_react());
25787
- var import_prop_types = __toESM(require_prop_types());
25788
- var import__ = __toESM(require_intl_tel_input());
25789
- var IntlTelInput = ({
25790
- initialValue,
25791
- setCountryIso,
25792
- setNumber,
25793
- setIsValid,
25794
- setErrorCode,
25795
- initOptions
25796
- }) => {
25797
- const inputRef = (0, import_react.useRef)(null);
25798
- const itiRef = (0, import_react.useRef)(null);
25799
- const update = () => {
25800
- const num = itiRef.current.getNumber();
25801
- const countryIso = itiRef.current.getSelectedCountryData().iso2;
25802
- setNumber(num);
25803
- setCountryIso(countryIso);
25804
- if (itiRef.current.isValidNumber()) {
25805
- setIsValid(true);
25806
- setErrorCode(null);
25807
- } else {
25808
- const errorCode = itiRef.current.getValidationError();
25809
- setIsValid(false);
25810
- setErrorCode(errorCode);
25811
- }
25812
- };
25813
- (0, import_react.useEffect)(() => {
25814
- itiRef.current = (0, import__.default)(inputRef.current, initOptions);
25815
- inputRef.current.addEventListener("countrychange", update);
25816
- return () => {
25817
- inputRef.current.removeEventListener("countrychange", update);
25818
- itiRef.current.destroy();
25819
- };
25820
- }, []);
25821
- return /* @__PURE__ */ import_react.default.createElement(
25822
- "input",
25823
- {
25824
- type: "phone",
25825
- ref: inputRef,
25826
- onInput: update,
25827
- defaultValue: initialValue
25828
- }
25829
- );
25830
- };
25831
- IntlTelInput.propTypes = {
25832
- initialValue: import_prop_types.default.string,
25833
- setNumber: import_prop_types.default.func.isRequired,
25834
- setCountryIso: import_prop_types.default.func,
25835
- setIsValid: import_prop_types.default.func.isRequired,
25836
- setErrorCode: import_prop_types.default.func.isRequired,
25837
- initOptions: import_prop_types.default.shape({
25838
- allowDropdown: import_prop_types.default.bool,
25839
- autoInsertDialCode: import_prop_types.default.bool,
25840
- autoPlaceholder: import_prop_types.default.string,
25841
- containerClass: import_prop_types.default.string,
25842
- countrySearch: import_prop_types.default.bool,
25843
- customPlaceholder: import_prop_types.default.func,
25844
- dropdownContainer: import_prop_types.default.node,
25845
- excludeCountries: import_prop_types.default.arrayOf(import_prop_types.default.string),
25846
- fixDropdownWidth: import_prop_types.default.bool,
25847
- formatAsYouType: import_prop_types.default.bool,
25848
- formatOnDisplay: import_prop_types.default.bool,
25849
- geoIpLookup: import_prop_types.default.func,
25850
- hiddenInput: import_prop_types.default.func,
25851
- i18n: import_prop_types.default.objectOf(import_prop_types.default.string),
25852
- initialCountry: import_prop_types.default.string,
25853
- nationalMode: import_prop_types.default.bool,
25854
- onlyCountries: import_prop_types.default.arrayOf(import_prop_types.default.string),
25855
- placeholderNumberType: import_prop_types.default.string,
25856
- preferredCountries: import_prop_types.default.arrayOf(import_prop_types.default.string),
25857
- showFlags: import_prop_types.default.bool,
25858
- showSelectedDialCode: import_prop_types.default.bool,
25859
- useFullscreenPopup: import_prop_types.default.bool,
25860
- utilsScript: import_prop_types.default.string
25861
- })
25862
- };
25863
- IntlTelInput.defaultProps = {
25864
- initialValue: "",
25865
- setCountryIso: () => {
25866
- },
25867
- initOptions: {}
25868
- };
25869
- var IntlTelInput_default = IntlTelInput;
25870
-
25871
- // react/DemoApp.js
24927
+ var import_client = __toESM(require_client());
24928
+ var import_IntlTelInput = __toESM(require_IntlTelInput_cjs());
25872
24929
  var errorMap = [
25873
24930
  "Invalid number",
25874
24931
  "Invalid country code",
@@ -25877,10 +24934,10 @@ var errorMap = [
25877
24934
  "Invalid number"
25878
24935
  ];
25879
24936
  var DemoApp = () => {
25880
- const [isValid, setIsValid] = (0, import_react2.useState)(null);
25881
- const [number, setNumber] = (0, import_react2.useState)(null);
25882
- const [errorCode, setErrorCode] = (0, import_react2.useState)(null);
25883
- const [notice, setNotice] = (0, import_react2.useState)(null);
24937
+ const [isValid, setIsValid] = (0, import_react.useState)(null);
24938
+ const [number, setNumber] = (0, import_react.useState)(null);
24939
+ const [errorCode, setErrorCode] = (0, import_react.useState)(null);
24940
+ const [notice, setNotice] = (0, import_react.useState)(null);
25884
24941
  const handleSubmit = () => {
25885
24942
  if (isValid) {
25886
24943
  setNotice(`Valid number: ${number}`);
@@ -25889,22 +24946,22 @@ var DemoApp = () => {
25889
24946
  setNotice(errorMessage);
25890
24947
  }
25891
24948
  };
25892
- return /* @__PURE__ */ import_react2.default.createElement("form", null, /* @__PURE__ */ import_react2.default.createElement(
25893
- IntlTelInput_default,
24949
+ return /* @__PURE__ */ import_react.default.createElement("form", null, /* @__PURE__ */ import_react.default.createElement(
24950
+ import_IntlTelInput.default,
25894
24951
  {
25895
- setIsValid,
25896
24952
  setNumber,
24953
+ setIsValid,
25897
24954
  setErrorCode,
25898
24955
  initOptions: {
25899
24956
  initialCountry: "us",
25900
- utilsScript: "../build/js/utils.js"
24957
+ utilsScript: "../../build/js/utils.js"
25901
24958
  }
25902
24959
  }
25903
- ), /* @__PURE__ */ import_react2.default.createElement("button", { type: "button", onClick: handleSubmit }, "Validate"), notice && /* @__PURE__ */ import_react2.default.createElement("div", { className: "notice" }, notice));
24960
+ ), /* @__PURE__ */ import_react.default.createElement("button", { type: "button", onClick: handleSubmit }, "Validate"), notice && /* @__PURE__ */ import_react.default.createElement("div", { className: "notice" }, notice));
25904
24961
  };
25905
24962
  var container = document.getElementById("app");
25906
24963
  var root = (0, import_client.createRoot)(container);
25907
- root.render(/* @__PURE__ */ import_react2.default.createElement(DemoApp, null));
24964
+ root.render(/* @__PURE__ */ import_react.default.createElement(DemoApp, null));
25908
24965
  /*! Bundled license information:
25909
24966
 
25910
24967
  react/cjs/react.development.js: