intl-tel-input 18.1.8 → 18.2.0
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.
- package/README.md +24 -17
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput-jquery.js +8 -2
- package/build/js/intlTelInput-jquery.min.js +2 -2
- package/build/js/intlTelInput.js +8 -2
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/utils.js +40 -40
- package/composer.json +1 -1
- package/package.json +1 -1
- package/spec.html +2 -0
- package/src/js/intlTelInput.js +8 -0
- package/src/js/utils.js +14 -0
- package/src/spec/tests/methods/isPossibleNumber.js +56 -0
- package/src/spec/tests/methods/isValidNumber.js +7 -7
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ _Note: In v12.0.0 we dropped support for IE9 and IE10, because they are [no long
|
|
|
59
59
|
```html
|
|
60
60
|
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@18.1.1/build/js/intlTelInput.min.js"></script>
|
|
61
61
|
<script>
|
|
62
|
-
|
|
62
|
+
const input = document.querySelector("#phone");
|
|
63
63
|
window.intlTelInput(input, {
|
|
64
64
|
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@18.1.1/build/js/utils.js",
|
|
65
65
|
});
|
|
@@ -111,7 +111,7 @@ _Note: In v12.0.0 we dropped support for IE9 and IE10, because they are [no long
|
|
|
111
111
|
```html
|
|
112
112
|
<script src="path/to/intlTelInput.js"></script>
|
|
113
113
|
<script>
|
|
114
|
-
|
|
114
|
+
const input = document.querySelector("#phone");
|
|
115
115
|
window.intlTelInput(input, {
|
|
116
116
|
utilsScript: "path/to/utils.js"
|
|
117
117
|
});
|
|
@@ -121,9 +121,9 @@ _Note: In v12.0.0 we dropped support for IE9 and IE10, because they are [no long
|
|
|
121
121
|
## Recommended Usage
|
|
122
122
|
We highly recommend you (lazy) load the included utils.js using the `utilsScript` option. Then the plugin is built to always deal with numbers in the full international format (e.g. "+17024181234") and convert them accordingly - even when `nationalMode` or `separateDialCode` is enabled. We recommend you get, store, and set numbers exclusively in this format for simplicity - then you don't have to deal with handling the country code separately, as full international numbers include the country code information.
|
|
123
123
|
|
|
124
|
-
You can always get the full international number (including country code) using `getNumber`, then you only have to store that one string in your database (you don't have to store the country separately), and then the next time you initialise the plugin with that number it will automatically set the country and format it according to the options you specify (e.g. when using `nationalMode` it will automatically
|
|
124
|
+
You can always get the full international number (including country code) using `getNumber`, then you only have to store that one string in your database (you don't have to store the country separately), and then the next time you initialise the plugin with that number it will automatically set the country and format it according to the options you specify (e.g. when using `nationalMode` it will automatically display the number in national format, removing the international dial code).
|
|
125
125
|
|
|
126
|
-
Finally, make sure you have `<meta charset="utf-8">` in the `<head>` section of your page, else you will get an error as the JS contains some special unicode characters.
|
|
126
|
+
Finally, make sure you have `<meta charset="utf-8">` in the `<head>` section of your page, else you will get an error as the JS contains some special unicode characters for localised country names.
|
|
127
127
|
|
|
128
128
|
|
|
129
129
|
## Initialisation Options
|
|
@@ -247,7 +247,7 @@ Enable formatting/validation etc. by specifying the URL of the included utils.js
|
|
|
247
247
|
|
|
248
248
|
|
|
249
249
|
## Public Methods
|
|
250
|
-
In these examples, `iti` refers to the plugin instance which gets returned when you initialise the plugin e.g. `
|
|
250
|
+
In these examples, `iti` refers to the plugin instance which gets returned when you initialise the plugin e.g. `const iti = intlTelInput(input)`
|
|
251
251
|
|
|
252
252
|
**destroy**
|
|
253
253
|
Remove the plugin from the input, and unbind any event listeners.
|
|
@@ -258,23 +258,23 @@ iti.destroy();
|
|
|
258
258
|
**getExtension**
|
|
259
259
|
Get the extension from the current number. Requires the `utilsScript` option.
|
|
260
260
|
```js
|
|
261
|
-
|
|
261
|
+
const extension = iti.getExtension();
|
|
262
262
|
```
|
|
263
263
|
Returns a string e.g. if the input value was `"(702) 555-5555 ext. 1234"`, this would return `"1234"`
|
|
264
264
|
|
|
265
265
|
**getNumber**
|
|
266
266
|
Get the current number in the given format (defaults to [E.164 standard](https://en.wikipedia.org/wiki/E.164)). The different formats are available in the enum `intlTelInputUtils.numberFormat` - which you can see [here](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L109). Requires the `utilsScript` option. _Note that even if `nationalMode` is enabled, this can still return a full international number. Also note that this method expects a valid number, and so should only be used after validation._
|
|
267
267
|
```js
|
|
268
|
-
|
|
268
|
+
const number = iti.getNumber();
|
|
269
269
|
// or
|
|
270
|
-
|
|
270
|
+
const number = iti.getNumber(intlTelInputUtils.numberFormat.E164);
|
|
271
271
|
```
|
|
272
272
|
Returns a string e.g. `"+17024181234"`
|
|
273
273
|
|
|
274
274
|
**getNumberType**
|
|
275
275
|
Get the type (fixed-line/mobile/toll-free etc) of the current number. Requires the `utilsScript` option.
|
|
276
276
|
```js
|
|
277
|
-
|
|
277
|
+
const numberType = iti.getNumberType();
|
|
278
278
|
```
|
|
279
279
|
Returns an integer, which you can match against the [various options](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L119) in the global enum `intlTelInputUtils.numberType` e.g.
|
|
280
280
|
```js
|
|
@@ -287,7 +287,7 @@ _Note that in the US there's no way to differentiate between fixed-line and mobi
|
|
|
287
287
|
**getSelectedCountryData**
|
|
288
288
|
Get the country data for the currently selected flag.
|
|
289
289
|
```js
|
|
290
|
-
|
|
290
|
+
const countryData = iti.getSelectedCountryData();
|
|
291
291
|
```
|
|
292
292
|
Returns something like this:
|
|
293
293
|
```js
|
|
@@ -301,7 +301,7 @@ Returns something like this:
|
|
|
301
301
|
**getValidationError**
|
|
302
302
|
Get more information about a validation error. Requires the `utilsScript` option.
|
|
303
303
|
```js
|
|
304
|
-
|
|
304
|
+
const error = iti.getValidationError();
|
|
305
305
|
```
|
|
306
306
|
Returns an integer, which you can match against the [various options](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L153) in the global enum `intlTelInputUtils.validationError` e.g.
|
|
307
307
|
```js
|
|
@@ -310,10 +310,17 @@ if (error === intlTelInputUtils.validationError.TOO_SHORT) {
|
|
|
310
310
|
}
|
|
311
311
|
```
|
|
312
312
|
|
|
313
|
+
**isPossibleNumber**
|
|
314
|
+
Check if the current number is possible. This is a simple form of validation that only checks the length of the number but should be sufficient for most use cases. See `isValidNumber` for more accurate validation, but the advantage of `isPossibleNumber` is that it is much more future-proof as while countries around the world regularly update their number rules, they very rarely change their number lengths. If it returns false, you can use `getValidationError` to get more information. Requires the `utilsScript` option.
|
|
315
|
+
```js
|
|
316
|
+
const isPossible = iti.isPossibleNumber();
|
|
317
|
+
```
|
|
318
|
+
Returns: `true`/`false`
|
|
319
|
+
|
|
313
320
|
**isValidNumber**
|
|
314
|
-
|
|
321
|
+
Check if the current number is valid - [see example](https://intl-tel-input.com/examples/validation.html). This is a very accurate validation check (with specific rules for each dial code etc). Note that these valid number rules change each month for various countries around the world, so you need to be careful to keep the plugin up-to-date else you will start rejecting valid numbers. For a simpler and more future-proof form of validation, see `isPossibleNumber` above. If validation fails, you can use `getValidationError` to get more information. Requires the `utilsScript` option.
|
|
315
322
|
```js
|
|
316
|
-
|
|
323
|
+
const isValid = iti.isValidNumber();
|
|
317
324
|
```
|
|
318
325
|
Returns: `true`/`false`
|
|
319
326
|
|
|
@@ -341,7 +348,7 @@ iti.setPlaceholderNumberType("FIXED_LINE");
|
|
|
341
348
|
**getCountryData**
|
|
342
349
|
Retrieve the plugin's country data - either to re-use elsewhere e.g. to generate your own country dropdown - [see example](https://intl-tel-input.com/examples/country-sync.html), or alternatively, you could use it to modify the country data. Note that any modifications must be done before initialising the plugin.
|
|
343
350
|
```js
|
|
344
|
-
|
|
351
|
+
const countryData = window.intlTelInputGlobals.getCountryData();
|
|
345
352
|
```
|
|
346
353
|
Returns an array of country objects:
|
|
347
354
|
```js
|
|
@@ -355,8 +362,8 @@ Returns an array of country objects:
|
|
|
355
362
|
**getInstance**
|
|
356
363
|
After initialising the plugin, you can always access the instance again using this method, by just passing in the relevant input element.
|
|
357
364
|
```js
|
|
358
|
-
|
|
359
|
-
|
|
365
|
+
const input = document.querySelector('#phone');
|
|
366
|
+
const iti = window.intlTelInputGlobals.getInstance(input);
|
|
360
367
|
iti.isValidNumber(); // etc
|
|
361
368
|
```
|
|
362
369
|
|
|
@@ -412,7 +419,7 @@ If you have a scrolling container other than `window` which is causing problems
|
|
|
412
419
|
|
|
413
420
|
```js
|
|
414
421
|
scrollingElement.addEventListener("scroll", function() {
|
|
415
|
-
|
|
422
|
+
const e = document.createEvent('Event');
|
|
416
423
|
e.initEvent("scroll", true, true);
|
|
417
424
|
window.dispatchEvent(e);
|
|
418
425
|
});
|
package/build/js/data.js
CHANGED
package/build/js/data.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v18.
|
|
2
|
+
* International Telephone Input v18.2.0
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1456,6 +1456,12 @@
|
|
|
1456
1456
|
var val = this._getFullNumber().trim();
|
|
1457
1457
|
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null;
|
|
1458
1458
|
}
|
|
1459
|
+
}, {
|
|
1460
|
+
key: "isPossibleNumber",
|
|
1461
|
+
value: function isPossibleNumber() {
|
|
1462
|
+
var val = this._getFullNumber().trim();
|
|
1463
|
+
return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null;
|
|
1464
|
+
}
|
|
1459
1465
|
}, {
|
|
1460
1466
|
key: "setCountry",
|
|
1461
1467
|
value: function setCountry(originalCountryCode) {
|
|
@@ -1537,7 +1543,7 @@
|
|
|
1537
1543
|
// default options
|
|
1538
1544
|
intlTelInputGlobals.defaults = defaults;
|
|
1539
1545
|
// version
|
|
1540
|
-
intlTelInputGlobals.version = "18.
|
|
1546
|
+
intlTelInputGlobals.version = "18.2.0";
|
|
1541
1547
|
var pluginName = "intlTelInput";
|
|
1542
1548
|
// A really lightweight plugin wrapper around the constructor,
|
|
1543
1549
|
// preventing against multiple instantiations
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v18.
|
|
2
|
+
* International Telephone Input v18.2.0
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
!function(a){"object"==typeof module&&module.exports?module.exports=a(require("jquery")):"function"==typeof define&&define.amd?define(["jquery"],function(b){a(b)}):a(jQuery)}(function(a,b){"use strict";function c(a){for(var b=1;b<arguments.length;b++){var c=null!=arguments[b]?Object(arguments[b]):{},e=Object.keys(c);"function"==typeof Object.getOwnPropertySymbols&&e.push.apply(e,Object.getOwnPropertySymbols(c).filter(function(a){return Object.getOwnPropertyDescriptor(c,a).enumerable})),e.forEach(function(b){d(a,b,c[b])})}return a}function d(a,b,c){return b=h(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function e(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function f(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,h(d.key),d)}}function g(a,b,c){return b&&f(a.prototype,b),c&&f(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function h(a){var b=i(a,"string");return"symbol"==typeof b?b:String(b)}function i(a,c){if("object"!=typeof a||null===a)return a;var d=a[Symbol.toPrimitive];if(d!==b){var e=d.call(a,c||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===c?String:Number)(a)}for(var j=[["Afghanistan (افغانستان)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (الجزائر)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (البحرين)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","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 (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","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 (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (مصر)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (ایران)","ir","98"],["Iraq (العراق)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (ישראל)","il","972"],["Italy (Italia)","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 (Latvija)","lv","371"],["Lebanon (لبنان)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (ليبيا)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (موريتانيا)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (المغرب)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["North Macedonia (Северна Македонија)","mk","389"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (عُمان)","om","968"],["Pakistan (پاکستان)","pk","92"],["Palau","pw","680"],["Palestine (فلسطين)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (قطر)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (المملكة العربية السعودية)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (جنوب السودان)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්රී ලංකාව)","lk","94"],["Sudan (السودان)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (سوريا)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (تونس)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (الإمارات العربية المتحدة)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (الصحراء الغربية)","eh","212",1,["5288","5289"]],["Yemen (اليمن)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],k=0;k<j.length;k++){var l=j[k];j[k]={name:l[0],iso2:l[1],dialCode:l[2],priority:l[3]||0,areaCodes:l[4]||null}}var m={getInstance:function(a){var b=a.getAttribute("data-intl-tel-input-id");return window.intlTelInputGlobals.instances[b]},instances:{},documentReady:function(){return"complete"===document.readyState}};"object"==typeof window&&(window.intlTelInputGlobals=m);var n=0,o={allowDropdown:!0,autoInsertDialCode:!1,autoPlaceholder:"polite",customContainer:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",localizedCountries:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,showFlags:!0,utilsScript:""},p=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],q=function(a,b){for(var c=Object.keys(a),d=0;d<c.length;d++)b(c[d],a[c[d]])},r=function(a){q(window.intlTelInputGlobals.instances,function(b){window.intlTelInputGlobals.instances[b][a]()})},s=function(){function a(b,c){var d=this;e(this,a),this.id=n++,this.a=b,this.b=null,this.c=null;var f=c||{};this.d={},q(o,function(a,b){d.d[a]=f.hasOwnProperty(a)?f[a]:b}),this.e=Boolean(b.getAttribute("placeholder"))}return g(a,[{key:"_init",value:function(){var a=this;this.d.nationalMode&&(this.d.autoInsertDialCode=!1),this.d.separateDialCode&&(this.d.autoInsertDialCode=!1);var b=this.d.allowDropdown&&!this.d.separateDialCode;if(!this.d.showFlags&&b&&(this.d.showFlags=!0),this.g=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.g&&(document.body.classList.add("iti-mobile"),this.d.dropdownContainer||(this.d.dropdownContainer=document.body)),this.isRTL=!!this.a.closest("[dir=rtl]"),"undefined"!=typeof Promise){var c=new Promise(function(b,c){a.h=b,a.i=c}),d=new Promise(function(b,c){a.i0=b,a.i1=c});this.promise=Promise.all([c,d])}else this.h=this.i=function(){},this.i0=this.i1=function(){};this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}},{key:"_b",value:function(){this._d(),this._d2(),this._e(),this.d.localizedCountries&&this._d0(),(this.d.onlyCountries.length||this.d.localizedCountries)&&this.p.sort(this._d1)}},{key:"_c",value:function(a,c,d){c.length>this.countryCodeMaxLen&&(this.countryCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e<this.q[c].length;e++)if(this.q[c][e]===a)return;var f=d!==b?d:this.q[c].length;this.q[c][f]=a}},{key:"_d",value:function(){if(this.d.onlyCountries.length){var a=this.d.onlyCountries.map(function(a){return a.toLowerCase()});this.p=j.filter(function(b){return a.indexOf(b.iso2)>-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=j.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=j}},{key:"_d0",value:function(){for(var a=0;a<this.p.length;a++){var b=this.p[a].iso2.toLowerCase();this.d.localizedCountries.hasOwnProperty(b)&&(this.p[a].name=this.d.localizedCountries[b])}}},{key:"_d1",value:function(a,b){return a.name<b.name?-1:a.name>b.name?1:0}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var a=0;a<this.p.length;a++){var b=this.p[a];this.dialCodes[b.dialCode]||(this.dialCodes[b.dialCode]=!0),this._c(b.iso2,b.dialCode,b.priority)}for(var c=0;c<this.p.length;c++){var d=this.p[c];if(d.areaCodes)for(var e=this.q[d.dialCode][0],f=0;f<d.areaCodes.length;f++){for(var g=d.areaCodes[f],h=1;h<g.length;h++){var i=d.dialCode+g.substr(0,h);this._c(e,i),this._c(d.iso2,i)}this._c(d.iso2,d.dialCode+g)}}}},{key:"_e",value:function(){this.preferredCountries=[];for(var a=0;a<this.d.preferredCountries.length;a++){var b=this.d.preferredCountries[a].toLowerCase(),c=this._y(b,!1,!0);c&&this.preferredCountries.push(c)}}},{key:"_e2",value:function(a,b,c){var d=document.createElement(a);return b&&q(b,function(a,b){return d.setAttribute(a,b)}),c&&c.appendChild(d),d}},{key:"_f",value:function(){this.a.hasAttribute("autocomplete")||this.a.form&&this.a.form.hasAttribute("autocomplete")||this.a.setAttribute("autocomplete","off");var a=this.d,b=a.allowDropdown,d=a.separateDialCode,e=a.showFlags,f=a.customContainer,g=a.hiddenInput,h=a.dropdownContainer,i="iti";b&&(i+=" iti--allow-dropdown"),d&&(i+=" iti--separate-dial-code"),e&&(i+=" iti--show-flags"),f&&(i+=" ".concat(f));var j=this._e2("div",{"class":i});this.a.parentNode.insertBefore(j,this.a);var k=b||e||d;if(k&&(this.k=this._e2("div",{"class":"iti__flag-container"},j)),j.appendChild(this.a),k&&(this.selectedFlag=this._e2("div",c({"class":"iti__selected-flag"},b&&{role:"combobox","aria-haspopup":"listbox","aria-controls":"iti-".concat(this.id,"__country-listbox"),"aria-expanded":"false","aria-label":"Telephone country code"}),this.k)),e&&(this.l=this._e2("div",{"class":"iti__flag"},this.selectedFlag)),this.selectedFlag&&this.a.disabled&&this.selectedFlag.setAttribute("aria-disabled","true"),d&&(this.t=this._e2("div",{"class":"iti__selected-dial-code"},this.selectedFlag)),b&&(this.a.disabled||this.selectedFlag.setAttribute("tabindex","0"),this.u=this._e2("div",{"class":"iti__arrow"},this.selectedFlag),this.m=this._e2("ul",{"class":"iti__country-list iti__hide",id:"iti-".concat(this.id,"__country-listbox"),role:"listbox","aria-label":"List of countries"}),this.preferredCountries.length&&(this._g(this.preferredCountries,"iti__preferred",!0),this._e2("li",{"class":"iti__divider",role:"separator","aria-disabled":"true"},this.m)),this._g(this.p,"iti__standard"),h?(this.dropdown=this._e2("div",{"class":"iti iti--container"}),this.dropdown.appendChild(this.m)):this.k.appendChild(this.m)),g){var l=g,m=this.a.getAttribute("name");if(m){var n=m.lastIndexOf("[");-1!==n&&(l="".concat(m.substr(0,n),"[").concat(l,"]"))}this.hiddenInput=this._e2("input",{type:"hidden",name:l}),j.appendChild(this.hiddenInput)}}},{key:"_g",value:function(a,b,c){for(var d="",e=0;e<a.length;e++){var f=a[e],g=c?"-preferred":"";d+="<li class='iti__country ".concat(b,"' tabIndex='-1' id='iti-").concat(this.id,"__item-").concat(f.iso2).concat(g,"' role='option' data-dial-code='").concat(f.dialCode,"' data-country-code='").concat(f.iso2,"' aria-selected='false'>"),this.d.showFlags&&(d+="<div class='iti__flag-box'><div class='iti__flag iti__".concat(f.iso2,"'></div></div>")),d+="<span class='iti__country-name'>".concat(f.name,"</span>"),d+="<span class='iti__dial-code'>+".concat(f.dialCode,"</span>"),d+="</li>"}this.m.insertAdjacentHTML("beforeend",d)}},{key:"_h",value:function(){var a=this.a.getAttribute("value"),b=this.a.value,c=a&&"+"===a.charAt(0)&&(!b||"+"!==b.charAt(0)),d=c?a:b,e=this._5(d),f=this._w(d),g=this.d,h=g.initialCountry,i=g.autoInsertDialCode;e&&!f?this._v(d):"auto"!==h&&(h?this._z(h.toLowerCase()):e&&f?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,d||this._z(this.j)),!d&&i&&(this.a.value="+".concat(this.s.dialCode))),d&&this._u(d)}},{key:"_i",value:function(){this._j(),this.d.autoInsertDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(a){window.intlTelInputGlobals.autoCountry=a.toLowerCase(),setTimeout(function(){return r("handleAutoCountry")})},function(){return r("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var b=document.createEvent("Event");b.initEvent(a,!0,!0),this.a.dispatchEvent(b)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var b=this.a.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=b.top+c,e=this.m.offsetHeight,f=d+this.a.offsetHeight+e<c+window.innerHeight,g=d-e>c;if(this._n2(this.m,"iti__country-list--dropup",!f&&g),this.d.dropdownContainer){var h=!f&&g?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+h,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("iti__country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"Up"===b.key||"ArrowDown"===b.key||"Down"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a||"Up"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("iti__divider")&&(b="ArrowUp"===a||"Up"===a?b.previousElementSibling:b.nextElementSibling),this._x(b,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;b<this.p.length;b++)if(this._t(this.p[b].name,a)){var c=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(this.p[b].iso2));this._x(c,!1),this._3(c,!0);break}}},{key:"_t",value:function(a,b){return a.substr(0,b.length).toLowerCase()===b}},{key:"_u",value:function(a){var b=a;if(this.d.formatOnDisplay&&window.intlTelInputUtils&&this.s){var c=this.d.nationalMode||"+"!==b.charAt(0)&&!this.d.separateDialCode,d=intlTelInputUtils.numberFormat,e=d.NATIONAL,f=d.INTERNATIONAL,g=c?e:f;b=intlTelInputUtils.formatNumber(b,this.s.iso2,g)}b=this._7(b),this.a.value=b}},{key:"_v",value:function(a){var b=a,c=this.s.dialCode,d="1"===c;b&&d&&"+"!==b.charAt(0)&&("1"!==b.charAt(0)&&(b="1".concat(b)),b="+".concat(b)),this.d.separateDialCode&&c&&"+"!==b.charAt(0)&&(b="+".concat(c).concat(b));var e=this._5(b,!0),f=this._m(b),g=null;if(e){var h=this.q[this._m(e)],i=-1!==h.indexOf(this.s.iso2)&&f.length<=e.length-1;if(!("1"===c&&this._w(f))&&!i)for(var j=0;j<h.length;j++)if(h[j]){g=h[j];break}}else"+"===b.charAt(0)&&f.length?g="":b&&"+"!==b||(g=this.j);return null!==g&&this._z(g)}},{key:"_w",value:function(a){var b=this._m(a);if("1"===b.charAt(0)){var c=b.substr(1,3);return-1!==p.indexOf(c)}return!1}},{key:"_x",value:function(a,b){var c=this.c;c&&c.classList.remove("iti__highlight"),this.c=a,this.c.classList.add("iti__highlight"),this.selectedFlag.setAttribute("aria-activedescendant",a.getAttribute("id")),b&&this.c.focus()}},{key:"_y",value:function(a,b,c){for(var d=b?j:this.p,e=0;e<d.length;e++)if(d[e].iso2===a)return d[e];if(c)return null;throw new Error("No country data for '".concat(a,"'"))}},{key:"_z",value:function(a){var b=this.d,c=b.allowDropdown,d=b.separateDialCode,e=b.showFlags,f=this.s.iso2?this.s:{};if(this.s=a?this._y(a,!1,!1):{},this.s.iso2&&(this.j=this.s.iso2),e&&this.l.setAttribute("class","iti__flag iti__".concat(a)),this._setSelectedCountryFlagTitleAttribute(a,d),d){var g=this.s.dialCode?"+".concat(this.s.dialCode):"";this.t.innerHTML=g;var h=this.selectedFlag.offsetWidth||this._z2();this.isRTL?this.a.style.paddingRight="".concat(h+6,"px"):this.a.style.paddingLeft="".concat(h+6,"px")}if(this._0(),c){var i=this.b;if(i&&(i.classList.remove("iti__active"),i.setAttribute("aria-selected","false")),a){var j=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a,"-preferred"))||this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a));j.setAttribute("aria-selected","true"),j.classList.add("iti__active"),this.b=j}}return f.iso2!==a}},{key:"_setSelectedCountryFlagTitleAttribute",value:function(a,b){if(this.selectedFlag){var c;c=a&&!b?"".concat(this.s.name,": +").concat(this.s.dialCode):a?this.s.name:"Unknown",this.selectedFlag.setAttribute("title",c)}}},{key:"_z2",value:function(){var a=this.a.parentNode.cloneNode();a.style.visibility="hidden",document.body.appendChild(a);var b=this.k.cloneNode();a.appendChild(b);var c=this.selectedFlag.cloneNode(!0);b.appendChild(c);var d=c.offsetWidth;return a.parentNode.removeChild(a),d}},{key:"_0",value:function(){var a="aggressive"===this.d.autoPlaceholder||!this.e&&"polite"===this.d.autoPlaceholder;if(window.intlTelInputUtils&&a){var b=intlTelInputUtils.numberType[this.d.placeholderNumberType],c=this.s.iso2?intlTelInputUtils.getExampleNumber(this.s.iso2,this.d.nationalMode,b):"";c=this._7(c),"function"==typeof this.d.customPlaceholder&&(c=this.d.customPlaceholder(c,this.s)),this.a.setAttribute("placeholder",c)}}},{key:"_1",value:function(a){var b=this._z(a.getAttribute("data-country-code"));this._2(),this._4(a.getAttribute("data-dial-code")),this.a.focus();var c=this.a.value.length;this.a.setSelectionRange(c,c),b&&this._m2CountryChange()}},{key:"_2",value:function(){this.m.classList.add("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","false"),this.selectedFlag.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),document.documentElement.removeEventListener("click",this._a2),this.m.removeEventListener("mouseover",this._a0),this.m.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.g||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._m2("close:countrydropdown")}},{key:"_3",value:function(a,b){var c=this.m,d=window.pageYOffset||document.documentElement.scrollTop,e=c.offsetHeight,f=c.getBoundingClientRect().top+d,g=f+e,h=a.offsetHeight,i=a.getBoundingClientRect().top+d,j=i+h,k=i-f+c.scrollTop,l=e/2-h/2;if(i<f)b&&(k-=l),c.scrollTop=k;else if(j>g){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a){var b,c=this.a.value,d="+".concat(a);if("+"===c.charAt(0)){var e=this._5(c);b=e?c.replace(e,d):d,this.a.value=b}else this.d.autoInsertDialCode&&(b=c?d+c:d,this.a.value=b)}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;e<a.length;e++){var f=a.charAt(e);if(!isNaN(parseInt(f,10))){if(d+=f,b)this.q[d]&&(c=a.substr(0,e+1));else if(this.dialCodes[d]){c=a.substr(0,e+1);break}if(d.length===this.countryCodeMaxLen)break}}return c}},{key:"_6",value:function(){var a=this.a.value.trim(),b=this.s.dialCode,c=this._m(a);return(this.d.separateDialCode&&"+"!==a.charAt(0)&&b&&c?"+".concat(b):"")+a}},{key:"_7",value:function(a){var b=a;if(this.d.separateDialCode){var c=this._5(b);if(c){c="+".concat(this.s.dialCode);var d=" "===b[c.length]||"-"===b[c.length]?c.length+1:c.length;b=b.substr(d)}}return this._j2(b)}},{key:"_m2CountryChange",value:function(){this._m2("countrychange")}},{key:"handleAutoCountry",value:function(){"auto"===this.d.initialCountry&&(this.j=window.intlTelInputGlobals.autoCountry,this.a.value||this.setCountry(this.j),this.h())}},{key:"handleUtils",
|
|
8
|
-
value:function(){window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this._0()),this.i0()}},{key:"destroy",value:function(){var a=this.a.form;if(this.d.allowDropdown){this._2(),this.selectedFlag.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);var b=this._i1();b&&b.removeEventListener("click",this._a9)}this.hiddenInput&&a&&a.removeEventListener("submit",this._a14),this.d.autoInsertDialCode&&(a&&a.removeEventListener("submit",this._a8),this.a.removeEventListener("blur",this._a8)),this.a.removeEventListener("keyup",this._a12),this.a.removeEventListener("cut",this._a13),this.a.removeEventListener("paste",this._a13),this.a.removeAttribute("data-intl-tel-input-id");var c=this.a.parentNode;c.parentNode.insertBefore(this.a,c),c.parentNode.removeChild(c),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}},{key:"getNumber",value:function(a){if(window.intlTelInputUtils){var b=this.s.iso2;return intlTelInputUtils.formatNumber(this._6(),b,a)}return""}},{key:"getNumberType",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.s}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var a=this.s.iso2;return intlTelInputUtils.getValidationError(this._6(),a)}return-99}},{key:"isValidNumber",value:function(){var a=this._6().trim();return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(a,this.s.iso2):null}},{key:"setCountry",value:function(a){var b=a.toLowerCase();this.s.iso2!==b&&(this._z(b),this._4(this.s.dialCode),this._m2CountryChange())}},{key:"setNumber",value:function(a){var b=this._v(a);this._u(a),b&&this._m2CountryChange()}},{key:"setPlaceholderNumberType",value:function(a){this.d.placeholderNumberType=a,this._0()}}]),a}();m.getCountryData=function(){return j};var t=function(a,b,c){var d=document.createElement("script");d.onload=function(){r("handleUtils"),b&&b()},d.onerror=function(){r("rejectUtilsScriptPromise"),c&&c()},d.className="iti-load-utils",d.async=!0,d.src=a,document.body.appendChild(d)};m.loadUtils=function(a){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise(function(b,c){return t(a,b,c)});t(a)}return null},m.defaults=o,m.version="18.
|
|
8
|
+
value:function(){window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this._0()),this.i0()}},{key:"destroy",value:function(){var a=this.a.form;if(this.d.allowDropdown){this._2(),this.selectedFlag.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);var b=this._i1();b&&b.removeEventListener("click",this._a9)}this.hiddenInput&&a&&a.removeEventListener("submit",this._a14),this.d.autoInsertDialCode&&(a&&a.removeEventListener("submit",this._a8),this.a.removeEventListener("blur",this._a8)),this.a.removeEventListener("keyup",this._a12),this.a.removeEventListener("cut",this._a13),this.a.removeEventListener("paste",this._a13),this.a.removeAttribute("data-intl-tel-input-id");var c=this.a.parentNode;c.parentNode.insertBefore(this.a,c),c.parentNode.removeChild(c),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}},{key:"getNumber",value:function(a){if(window.intlTelInputUtils){var b=this.s.iso2;return intlTelInputUtils.formatNumber(this._6(),b,a)}return""}},{key:"getNumberType",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.s}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var a=this.s.iso2;return intlTelInputUtils.getValidationError(this._6(),a)}return-99}},{key:"isValidNumber",value:function(){var a=this._6().trim();return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(a,this.s.iso2):null}},{key:"isPossibleNumber",value:function(){var a=this._6().trim();return window.intlTelInputUtils?intlTelInputUtils.isPossibleNumber(a,this.s.iso2):null}},{key:"setCountry",value:function(a){var b=a.toLowerCase();this.s.iso2!==b&&(this._z(b),this._4(this.s.dialCode),this._m2CountryChange())}},{key:"setNumber",value:function(a){var b=this._v(a);this._u(a),b&&this._m2CountryChange()}},{key:"setPlaceholderNumberType",value:function(a){this.d.placeholderNumberType=a,this._0()}}]),a}();m.getCountryData=function(){return j};var t=function(a,b,c){var d=document.createElement("script");d.onload=function(){r("handleUtils"),b&&b()},d.onerror=function(){r("rejectUtilsScriptPromise"),c&&c()},d.className="iti-load-utils",d.async=!0,d.src=a,document.body.appendChild(d)};m.loadUtils=function(a){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise(function(b,c){return t(a,b,c)});t(a)}return null},m.defaults=o,m.version="18.2.0";a.fn.intlTelInput=function(c){var d=arguments;if(c===b||"object"==typeof c)return this.each(function(){if(!a.data(this,"plugin_intlTelInput")){var b=new s(this,c);b._init(),window.intlTelInputGlobals.instances[b.id]=b,a.data(this,"plugin_intlTelInput",b)}});if("string"==typeof c&&"_"!==c[0]){var e;return this.each(function(){var b=a.data(this,"plugin_intlTelInput");b instanceof s&&"function"==typeof b[c]&&(e=b[c].apply(b,Array.prototype.slice.call(d,1))),"destroy"===c&&a.data(this,"plugin_intlTelInput",null)}),e!==b?e:this}}});
|
package/build/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v18.
|
|
2
|
+
* International Telephone Input v18.2.0
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1451,6 +1451,12 @@
|
|
|
1451
1451
|
var val = this._getFullNumber().trim();
|
|
1452
1452
|
return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, this.selectedCountryData.iso2) : null;
|
|
1453
1453
|
}
|
|
1454
|
+
}, {
|
|
1455
|
+
key: "isPossibleNumber",
|
|
1456
|
+
value: function isPossibleNumber() {
|
|
1457
|
+
var val = this._getFullNumber().trim();
|
|
1458
|
+
return window.intlTelInputUtils ? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2) : null;
|
|
1459
|
+
}
|
|
1454
1460
|
}, {
|
|
1455
1461
|
key: "setCountry",
|
|
1456
1462
|
value: function setCountry(originalCountryCode) {
|
|
@@ -1532,7 +1538,7 @@
|
|
|
1532
1538
|
// default options
|
|
1533
1539
|
intlTelInputGlobals.defaults = defaults;
|
|
1534
1540
|
// version
|
|
1535
|
-
intlTelInputGlobals.version = "18.
|
|
1541
|
+
intlTelInputGlobals.version = "18.2.0";
|
|
1536
1542
|
// convenience wrapper
|
|
1537
1543
|
return function(input, options) {
|
|
1538
1544
|
var iti = new Iti(input, options);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v18.
|
|
2
|
+
* International Telephone Input v18.2.0
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
!function(a){"object"==typeof module&&module.exports?module.exports=a():window.intlTelInput=a()}(function(a){"use strict";return function(){function b(a){for(var b=1;b<arguments.length;b++){var d=null!=arguments[b]?Object(arguments[b]):{},e=Object.keys(d);"function"==typeof Object.getOwnPropertySymbols&&e.push.apply(e,Object.getOwnPropertySymbols(d).filter(function(a){return Object.getOwnPropertyDescriptor(d,a).enumerable})),e.forEach(function(b){c(a,b,d[b])})}return a}function c(a,b,c){return b=g(b),b in a?Object.defineProperty(a,b,{value:c,enumerable:!0,configurable:!0,writable:!0}):a[b]=c,a}function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,g(d.key),d)}}function f(a,b,c){return b&&e(a.prototype,b),c&&e(a,c),Object.defineProperty(a,"prototype",{writable:!1}),a}function g(a){var b=h(a,"string");return"symbol"==typeof b?b:String(b)}function h(b,c){if("object"!=typeof b||null===b)return b;var d=b[Symbol.toPrimitive];if(d!==a){var e=d.call(b,c||"default");if("object"!=typeof e)return e;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===c?String:Number)(b)}for(var i=[["Afghanistan (افغانستان)","af","93"],["Albania (Shqipëri)","al","355"],["Algeria (الجزائر)","dz","213"],["American Samoa","as","1",5,["684"]],["Andorra","ad","376"],["Angola","ao","244"],["Anguilla","ai","1",6,["264"]],["Antigua and Barbuda","ag","1",7,["268"]],["Argentina","ar","54"],["Armenia (Հայաստան)","am","374"],["Aruba","aw","297"],["Ascension Island","ac","247"],["Australia","au","61",0],["Austria (Österreich)","at","43"],["Azerbaijan (Azərbaycan)","az","994"],["Bahamas","bs","1",8,["242"]],["Bahrain (البحرين)","bh","973"],["Bangladesh (বাংলাদেশ)","bd","880"],["Barbados","bb","1",9,["246"]],["Belarus (Беларусь)","by","375"],["Belgium (België)","be","32"],["Belize","bz","501"],["Benin (Bénin)","bj","229"],["Bermuda","bm","1",10,["441"]],["Bhutan (འབྲུག)","bt","975"],["Bolivia","bo","591"],["Bosnia and Herzegovina (Босна и Херцеговина)","ba","387"],["Botswana","bw","267"],["Brazil (Brasil)","br","55"],["British Indian Ocean Territory","io","246"],["British Virgin Islands","vg","1",11,["284"]],["Brunei","bn","673"],["Bulgaria (България)","bg","359"],["Burkina Faso","bf","226"],["Burundi (Uburundi)","bi","257"],["Cambodia (កម្ពុជា)","kh","855"],["Cameroon (Cameroun)","cm","237"],["Canada","ca","1",1,["204","226","236","249","250","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 (Kabu Verdi)","cv","238"],["Caribbean Netherlands","bq","599",1,["3","4","7"]],["Cayman Islands","ky","1",12,["345"]],["Central African Republic (République centrafricaine)","cf","236"],["Chad (Tchad)","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 (DRC) (Jamhuri ya Kidemokrasia ya Kongo)","cd","243"],["Congo (Republic) (Congo-Brazzaville)","cg","242"],["Cook Islands","ck","682"],["Costa Rica","cr","506"],["Côte d’Ivoire","ci","225"],["Croatia (Hrvatska)","hr","385"],["Cuba","cu","53"],["Curaçao","cw","599",0],["Cyprus (Κύπρος)","cy","357"],["Czech Republic (Česká republika)","cz","420"],["Denmark (Danmark)","dk","45"],["Djibouti","dj","253"],["Dominica","dm","1",13,["767"]],["Dominican Republic (República Dominicana)","do","1",2,["809","829","849"]],["Ecuador","ec","593"],["Egypt (مصر)","eg","20"],["El Salvador","sv","503"],["Equatorial Guinea (Guinea Ecuatorial)","gq","240"],["Eritrea","er","291"],["Estonia (Eesti)","ee","372"],["Eswatini","sz","268"],["Ethiopia","et","251"],["Falkland Islands (Islas Malvinas)","fk","500"],["Faroe Islands (Føroyar)","fo","298"],["Fiji","fj","679"],["Finland (Suomi)","fi","358",0],["France","fr","33"],["French Guiana (Guyane française)","gf","594"],["French Polynesia (Polynésie française)","pf","689"],["Gabon","ga","241"],["Gambia","gm","220"],["Georgia (საქართველო)","ge","995"],["Germany (Deutschland)","de","49"],["Ghana (Gaana)","gh","233"],["Gibraltar","gi","350"],["Greece (Ελλάδα)","gr","30"],["Greenland (Kalaallit Nunaat)","gl","299"],["Grenada","gd","1",14,["473"]],["Guadeloupe","gp","590",0],["Guam","gu","1",15,["671"]],["Guatemala","gt","502"],["Guernsey","gg","44",1,["1481","7781","7839","7911"]],["Guinea (Guinée)","gn","224"],["Guinea-Bissau (Guiné Bissau)","gw","245"],["Guyana","gy","592"],["Haiti","ht","509"],["Honduras","hn","504"],["Hong Kong (香港)","hk","852"],["Hungary (Magyarország)","hu","36"],["Iceland (Ísland)","is","354"],["India (भारत)","in","91"],["Indonesia","id","62"],["Iran (ایران)","ir","98"],["Iraq (العراق)","iq","964"],["Ireland","ie","353"],["Isle of Man","im","44",2,["1624","74576","7524","7924","7624"]],["Israel (ישראל)","il","972"],["Italy (Italia)","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 (Latvija)","lv","371"],["Lebanon (لبنان)","lb","961"],["Lesotho","ls","266"],["Liberia","lr","231"],["Libya (ليبيا)","ly","218"],["Liechtenstein","li","423"],["Lithuania (Lietuva)","lt","370"],["Luxembourg","lu","352"],["Macau (澳門)","mo","853"],["Madagascar (Madagasikara)","mg","261"],["Malawi","mw","265"],["Malaysia","my","60"],["Maldives","mv","960"],["Mali","ml","223"],["Malta","mt","356"],["Marshall Islands","mh","692"],["Martinique","mq","596"],["Mauritania (موريتانيا)","mr","222"],["Mauritius (Moris)","mu","230"],["Mayotte","yt","262",1,["269","639"]],["Mexico (México)","mx","52"],["Micronesia","fm","691"],["Moldova (Republica Moldova)","md","373"],["Monaco","mc","377"],["Mongolia (Монгол)","mn","976"],["Montenegro (Crna Gora)","me","382"],["Montserrat","ms","1",16,["664"]],["Morocco (المغرب)","ma","212",0],["Mozambique (Moçambique)","mz","258"],["Myanmar (Burma) (မြန်မာ)","mm","95"],["Namibia (Namibië)","na","264"],["Nauru","nr","674"],["Nepal (नेपाल)","np","977"],["Netherlands (Nederland)","nl","31"],["New Caledonia (Nouvelle-Calédonie)","nc","687"],["New Zealand","nz","64"],["Nicaragua","ni","505"],["Niger (Nijar)","ne","227"],["Nigeria","ng","234"],["Niue","nu","683"],["Norfolk Island","nf","672"],["North Korea (조선 민주주의 인민 공화국)","kp","850"],["North Macedonia (Северна Македонија)","mk","389"],["Northern Mariana Islands","mp","1",17,["670"]],["Norway (Norge)","no","47",0],["Oman (عُمان)","om","968"],["Pakistan (پاکستان)","pk","92"],["Palau","pw","680"],["Palestine (فلسطين)","ps","970"],["Panama (Panamá)","pa","507"],["Papua New Guinea","pg","675"],["Paraguay","py","595"],["Peru (Perú)","pe","51"],["Philippines","ph","63"],["Poland (Polska)","pl","48"],["Portugal","pt","351"],["Puerto Rico","pr","1",3,["787","939"]],["Qatar (قطر)","qa","974"],["Réunion (La Réunion)","re","262",0],["Romania (România)","ro","40"],["Russia (Россия)","ru","7",0],["Rwanda","rw","250"],["Saint Barthélemy","bl","590",1],["Saint Helena","sh","290"],["Saint Kitts and Nevis","kn","1",18,["869"]],["Saint Lucia","lc","1",19,["758"]],["Saint Martin (Saint-Martin (partie française))","mf","590",2],["Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)","pm","508"],["Saint Vincent and the Grenadines","vc","1",20,["784"]],["Samoa","ws","685"],["San Marino","sm","378"],["São Tomé and Príncipe (São Tomé e Príncipe)","st","239"],["Saudi Arabia (المملكة العربية السعودية)","sa","966"],["Senegal (Sénégal)","sn","221"],["Serbia (Србија)","rs","381"],["Seychelles","sc","248"],["Sierra Leone","sl","232"],["Singapore","sg","65"],["Sint Maarten","sx","1",21,["721"]],["Slovakia (Slovensko)","sk","421"],["Slovenia (Slovenija)","si","386"],["Solomon Islands","sb","677"],["Somalia (Soomaaliya)","so","252"],["South Africa","za","27"],["South Korea (대한민국)","kr","82"],["South Sudan (جنوب السودان)","ss","211"],["Spain (España)","es","34"],["Sri Lanka (ශ්රී ලංකාව)","lk","94"],["Sudan (السودان)","sd","249"],["Suriname","sr","597"],["Svalbard and Jan Mayen","sj","47",1,["79"]],["Sweden (Sverige)","se","46"],["Switzerland (Schweiz)","ch","41"],["Syria (سوريا)","sy","963"],["Taiwan (台灣)","tw","886"],["Tajikistan","tj","992"],["Tanzania","tz","255"],["Thailand (ไทย)","th","66"],["Timor-Leste","tl","670"],["Togo","tg","228"],["Tokelau","tk","690"],["Tonga","to","676"],["Trinidad and Tobago","tt","1",22,["868"]],["Tunisia (تونس)","tn","216"],["Turkey (Türkiye)","tr","90"],["Turkmenistan","tm","993"],["Turks and Caicos Islands","tc","1",23,["649"]],["Tuvalu","tv","688"],["U.S. Virgin Islands","vi","1",24,["340"]],["Uganda","ug","256"],["Ukraine (Україна)","ua","380"],["United Arab Emirates (الإمارات العربية المتحدة)","ae","971"],["United Kingdom","gb","44",0],["United States","us","1",0],["Uruguay","uy","598"],["Uzbekistan (Oʻzbekiston)","uz","998"],["Vanuatu","vu","678"],["Vatican City (Città del Vaticano)","va","39",1,["06698"]],["Venezuela","ve","58"],["Vietnam (Việt Nam)","vn","84"],["Wallis and Futuna (Wallis-et-Futuna)","wf","681"],["Western Sahara (الصحراء الغربية)","eh","212",1,["5288","5289"]],["Yemen (اليمن)","ye","967"],["Zambia","zm","260"],["Zimbabwe","zw","263"],["Åland Islands","ax","358",1,["18"]]],j=0;j<i.length;j++){var k=i[j];i[j]={name:k[0],iso2:k[1],dialCode:k[2],priority:k[3]||0,areaCodes:k[4]||null}}var l={getInstance:function(a){var b=a.getAttribute("data-intl-tel-input-id");return window.intlTelInputGlobals.instances[b]},instances:{},documentReady:function(){return"complete"===document.readyState}};"object"==typeof window&&(window.intlTelInputGlobals=l);var m=0,n={allowDropdown:!0,autoInsertDialCode:!1,autoPlaceholder:"polite",customContainer:"",customPlaceholder:null,dropdownContainer:null,excludeCountries:[],formatOnDisplay:!0,geoIpLookup:null,hiddenInput:"",initialCountry:"",localizedCountries:null,nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",preferredCountries:["us","gb"],separateDialCode:!1,showFlags:!0,utilsScript:""},o=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],p=function(a,b){for(var c=Object.keys(a),d=0;d<c.length;d++)b(c[d],a[c[d]])},q=function(a){p(window.intlTelInputGlobals.instances,function(b){window.intlTelInputGlobals.instances[b][a]()})},r=function(){function c(a,b){var e=this;d(this,c),this.id=m++,this.a=a,this.b=null,this.c=null;var f=b||{};this.d={},p(n,function(a,b){e.d[a]=f.hasOwnProperty(a)?f[a]:b}),this.e=Boolean(a.getAttribute("placeholder"))}return f(c,[{key:"_init",value:function(){var a=this;this.d.nationalMode&&(this.d.autoInsertDialCode=!1),this.d.separateDialCode&&(this.d.autoInsertDialCode=!1);var b=this.d.allowDropdown&&!this.d.separateDialCode;if(!this.d.showFlags&&b&&(this.d.showFlags=!0),this.g=/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent),this.g&&(document.body.classList.add("iti-mobile"),this.d.dropdownContainer||(this.d.dropdownContainer=document.body)),this.isRTL=!!this.a.closest("[dir=rtl]"),"undefined"!=typeof Promise){var c=new Promise(function(b,c){a.h=b,a.i=c}),d=new Promise(function(b,c){a.i0=b,a.i1=c});this.promise=Promise.all([c,d])}else this.h=this.i=function(){},this.i0=this.i1=function(){};this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}},{key:"_b",value:function(){this._d(),this._d2(),this._e(),this.d.localizedCountries&&this._d0(),(this.d.onlyCountries.length||this.d.localizedCountries)&&this.p.sort(this._d1)}},{key:"_c",value:function(b,c,d){c.length>this.countryCodeMaxLen&&(this.countryCodeMaxLen=c.length),this.q.hasOwnProperty(c)||(this.q[c]=[]);for(var e=0;e<this.q[c].length;e++)if(this.q[c][e]===b)return;var f=d!==a?d:this.q[c].length;this.q[c][f]=b}},{key:"_d",value:function(){if(this.d.onlyCountries.length){var a=this.d.onlyCountries.map(function(a){return a.toLowerCase()});this.p=i.filter(function(b){return a.indexOf(b.iso2)>-1})}else if(this.d.excludeCountries.length){var b=this.d.excludeCountries.map(function(a){return a.toLowerCase()});this.p=i.filter(function(a){return-1===b.indexOf(a.iso2)})}else this.p=i}},{key:"_d0",value:function(){for(var a=0;a<this.p.length;a++){var b=this.p[a].iso2.toLowerCase();this.d.localizedCountries.hasOwnProperty(b)&&(this.p[a].name=this.d.localizedCountries[b])}}},{key:"_d1",value:function(a,b){return a.name<b.name?-1:a.name>b.name?1:0}},{key:"_d2",value:function(){this.countryCodeMaxLen=0,this.dialCodes={},this.q={};for(var a=0;a<this.p.length;a++){var b=this.p[a];this.dialCodes[b.dialCode]||(this.dialCodes[b.dialCode]=!0),this._c(b.iso2,b.dialCode,b.priority)}for(var c=0;c<this.p.length;c++){var d=this.p[c];if(d.areaCodes)for(var e=this.q[d.dialCode][0],f=0;f<d.areaCodes.length;f++){for(var g=d.areaCodes[f],h=1;h<g.length;h++){var i=d.dialCode+g.substr(0,h);this._c(e,i),this._c(d.iso2,i)}this._c(d.iso2,d.dialCode+g)}}}},{key:"_e",value:function(){this.preferredCountries=[];for(var a=0;a<this.d.preferredCountries.length;a++){var b=this.d.preferredCountries[a].toLowerCase(),c=this._y(b,!1,!0);c&&this.preferredCountries.push(c)}}},{key:"_e2",value:function(a,b,c){var d=document.createElement(a);return b&&p(b,function(a,b){return d.setAttribute(a,b)}),c&&c.appendChild(d),d}},{key:"_f",value:function(){this.a.hasAttribute("autocomplete")||this.a.form&&this.a.form.hasAttribute("autocomplete")||this.a.setAttribute("autocomplete","off");var a=this.d,c=a.allowDropdown,d=a.separateDialCode,e=a.showFlags,f=a.customContainer,g=a.hiddenInput,h=a.dropdownContainer,i="iti";c&&(i+=" iti--allow-dropdown"),d&&(i+=" iti--separate-dial-code"),e&&(i+=" iti--show-flags"),f&&(i+=" ".concat(f));var j=this._e2("div",{"class":i});this.a.parentNode.insertBefore(j,this.a);var k=c||e||d;if(k&&(this.k=this._e2("div",{"class":"iti__flag-container"},j)),j.appendChild(this.a),k&&(this.selectedFlag=this._e2("div",b({"class":"iti__selected-flag"},c&&{role:"combobox","aria-haspopup":"listbox","aria-controls":"iti-".concat(this.id,"__country-listbox"),"aria-expanded":"false","aria-label":"Telephone country code"}),this.k)),e&&(this.l=this._e2("div",{"class":"iti__flag"},this.selectedFlag)),this.selectedFlag&&this.a.disabled&&this.selectedFlag.setAttribute("aria-disabled","true"),d&&(this.t=this._e2("div",{"class":"iti__selected-dial-code"},this.selectedFlag)),c&&(this.a.disabled||this.selectedFlag.setAttribute("tabindex","0"),this.u=this._e2("div",{"class":"iti__arrow"},this.selectedFlag),this.m=this._e2("ul",{"class":"iti__country-list iti__hide",id:"iti-".concat(this.id,"__country-listbox"),role:"listbox","aria-label":"List of countries"}),this.preferredCountries.length&&(this._g(this.preferredCountries,"iti__preferred",!0),this._e2("li",{"class":"iti__divider",role:"separator","aria-disabled":"true"},this.m)),this._g(this.p,"iti__standard"),h?(this.dropdown=this._e2("div",{"class":"iti iti--container"}),this.dropdown.appendChild(this.m)):this.k.appendChild(this.m)),g){var l=g,m=this.a.getAttribute("name");if(m){var n=m.lastIndexOf("[");-1!==n&&(l="".concat(m.substr(0,n),"[").concat(l,"]"))}this.hiddenInput=this._e2("input",{type:"hidden",name:l}),j.appendChild(this.hiddenInput)}}},{key:"_g",value:function(a,b,c){for(var d="",e=0;e<a.length;e++){var f=a[e],g=c?"-preferred":"";d+="<li class='iti__country ".concat(b,"' tabIndex='-1' id='iti-").concat(this.id,"__item-").concat(f.iso2).concat(g,"' role='option' data-dial-code='").concat(f.dialCode,"' data-country-code='").concat(f.iso2,"' aria-selected='false'>"),this.d.showFlags&&(d+="<div class='iti__flag-box'><div class='iti__flag iti__".concat(f.iso2,"'></div></div>")),d+="<span class='iti__country-name'>".concat(f.name,"</span>"),d+="<span class='iti__dial-code'>+".concat(f.dialCode,"</span>"),d+="</li>"}this.m.insertAdjacentHTML("beforeend",d)}},{key:"_h",value:function(){var a=this.a.getAttribute("value"),b=this.a.value,c=a&&"+"===a.charAt(0)&&(!b||"+"!==b.charAt(0)),d=c?a:b,e=this._5(d),f=this._w(d),g=this.d,h=g.initialCountry,i=g.autoInsertDialCode;e&&!f?this._v(d):"auto"!==h&&(h?this._z(h.toLowerCase()):e&&f?this._z("us"):(this.j=this.preferredCountries.length?this.preferredCountries[0].iso2:this.p[0].iso2,d||this._z(this.j)),!d&&i&&(this.a.value="+".concat(this.s.dialCode))),d&&this._u(d)}},{key:"_i",value:function(){this._j(),this.d.autoInsertDialCode&&this._l(),this.d.allowDropdown&&this._i2(),this.hiddenInput&&this._i0()}},{key:"_i0",value:function(){var a=this;this._a14=function(){a.hiddenInput.value=a.getNumber()},this.a.form&&this.a.form.addEventListener("submit",this._a14)}},{key:"_i1",value:function(){for(var a=this.a;a&&"LABEL"!==a.tagName;)a=a.parentNode;return a}},{key:"_i2",value:function(){var a=this;this._a9=function(b){a.m.classList.contains("iti__hide")?a.a.focus():b.preventDefault()};var b=this._i1();b&&b.addEventListener("click",this._a9),this._a10=function(){!a.m.classList.contains("iti__hide")||a.a.disabled||a.a.readOnly||a._n()},this.selectedFlag.addEventListener("click",this._a10),this._a11=function(b){a.m.classList.contains("iti__hide")&&-1!==["ArrowUp","Up","ArrowDown","Down"," ","Enter"].indexOf(b.key)&&(b.preventDefault(),b.stopPropagation(),a._n()),"Tab"===b.key&&a._2()},this.k.addEventListener("keydown",this._a11)}},{key:"_i3",value:function(){var a=this;this.d.utilsScript&&!window.intlTelInputUtils?window.intlTelInputGlobals.documentReady()?window.intlTelInputGlobals.loadUtils(this.d.utilsScript):window.addEventListener("load",function(){window.intlTelInputGlobals.loadUtils(a.d.utilsScript)}):this.i0(),"auto"===this.d.initialCountry?this._i4():this.h()}},{key:"_i4",value:function(){window.intlTelInputGlobals.autoCountry?this.handleAutoCountry():window.intlTelInputGlobals.startedLoadingAutoCountry||(window.intlTelInputGlobals.startedLoadingAutoCountry=!0,"function"==typeof this.d.geoIpLookup&&this.d.geoIpLookup(function(a){window.intlTelInputGlobals.autoCountry=a.toLowerCase(),setTimeout(function(){return q("handleAutoCountry")})},function(){return q("rejectAutoCountryPromise")}))}},{key:"_j",value:function(){var a=this;this._a12=function(){a._v(a.a.value)&&a._m2CountryChange()},this.a.addEventListener("keyup",this._a12),this._a13=function(){setTimeout(a._a12)},this.a.addEventListener("cut",this._a13),this.a.addEventListener("paste",this._a13)}},{key:"_j2",value:function(a){var b=this.a.getAttribute("maxlength");return b&&a.length>b?a.substr(0,b):a}},{key:"_l",value:function(){var a=this;this._a8=function(){a._l2()},this.a.form&&this.a.form.addEventListener("submit",this._a8),this.a.addEventListener("blur",this._a8)}},{key:"_l2",value:function(){if("+"===this.a.value.charAt(0)){var a=this._m(this.a.value);a&&this.s.dialCode!==a||(this.a.value="")}}},{key:"_m",value:function(a){return a.replace(/\D/g,"")}},{key:"_m2",value:function(a){var b=document.createEvent("Event");b.initEvent(a,!0,!0),this.a.dispatchEvent(b)}},{key:"_n",value:function(){this.m.classList.remove("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","true"),this._o(),this.b&&(this._x(this.b,!1),this._3(this.b,!0)),this._p(),this.u.classList.add("iti__arrow--up"),this._m2("open:countrydropdown")}},{key:"_n2",value:function(a,b,c){c&&!a.classList.contains(b)?a.classList.add(b):!c&&a.classList.contains(b)&&a.classList.remove(b)}},{key:"_o",value:function(){var a=this;if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.g){var b=this.a.getBoundingClientRect(),c=window.pageYOffset||document.documentElement.scrollTop,d=b.top+c,e=this.m.offsetHeight,f=d+this.a.offsetHeight+e<c+window.innerHeight,g=d-e>c;if(this._n2(this.m,"iti__country-list--dropup",!f&&g),this.d.dropdownContainer){var h=!f&&g?0:this.a.offsetHeight;this.dropdown.style.top="".concat(d+h,"px"),this.dropdown.style.left="".concat(b.left+document.body.scrollLeft,"px"),this._a4=function(){return a._2()},window.addEventListener("scroll",this._a4)}}}},{key:"_o2",value:function(a){for(var b=a;b&&b!==this.m&&!b.classList.contains("iti__country");)b=b.parentNode;return b===this.m?null:b}},{key:"_p",value:function(){var a=this;this._a0=function(b){var c=a._o2(b.target);c&&a._x(c,!1)},this.m.addEventListener("mouseover",this._a0),this._a1=function(b){var c=a._o2(b.target);c&&a._1(c)},this.m.addEventListener("click",this._a1);var b=!0;this._a2=function(){b||a._2(),b=!1},document.documentElement.addEventListener("click",this._a2);var c="",d=null;this._a3=function(b){b.preventDefault(),"ArrowUp"===b.key||"Up"===b.key||"ArrowDown"===b.key||"Down"===b.key?a._q(b.key):"Enter"===b.key?a._r():"Escape"===b.key?a._2():/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(b.key)&&(d&&clearTimeout(d),c+=b.key.toLowerCase(),a._s(c),d=setTimeout(function(){c=""},1e3))},document.addEventListener("keydown",this._a3)}},{key:"_q",value:function(a){var b="ArrowUp"===a||"Up"===a?this.c.previousElementSibling:this.c.nextElementSibling;b&&(b.classList.contains("iti__divider")&&(b="ArrowUp"===a||"Up"===a?b.previousElementSibling:b.nextElementSibling),this._x(b,!0))}},{key:"_r",value:function(){this.c&&this._1(this.c)}},{key:"_s",value:function(a){for(var b=0;b<this.p.length;b++)if(this._t(this.p[b].name,a)){var c=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(this.p[b].iso2));this._x(c,!1),this._3(c,!0);break}}},{key:"_t",value:function(a,b){return a.substr(0,b.length).toLowerCase()===b}},{key:"_u",value:function(a){var b=a;if(this.d.formatOnDisplay&&window.intlTelInputUtils&&this.s){var c=this.d.nationalMode||"+"!==b.charAt(0)&&!this.d.separateDialCode,d=intlTelInputUtils.numberFormat,e=d.NATIONAL,f=d.INTERNATIONAL,g=c?e:f;b=intlTelInputUtils.formatNumber(b,this.s.iso2,g)}b=this._7(b),this.a.value=b}},{key:"_v",value:function(a){var b=a,c=this.s.dialCode,d="1"===c;b&&d&&"+"!==b.charAt(0)&&("1"!==b.charAt(0)&&(b="1".concat(b)),b="+".concat(b)),this.d.separateDialCode&&c&&"+"!==b.charAt(0)&&(b="+".concat(c).concat(b));var e=this._5(b,!0),f=this._m(b),g=null;if(e){var h=this.q[this._m(e)],i=-1!==h.indexOf(this.s.iso2)&&f.length<=e.length-1;if(!("1"===c&&this._w(f))&&!i)for(var j=0;j<h.length;j++)if(h[j]){g=h[j];break}}else"+"===b.charAt(0)&&f.length?g="":b&&"+"!==b||(g=this.j);return null!==g&&this._z(g)}},{key:"_w",value:function(a){var b=this._m(a);if("1"===b.charAt(0)){var c=b.substr(1,3);return-1!==o.indexOf(c)}return!1}},{key:"_x",value:function(a,b){var c=this.c;c&&c.classList.remove("iti__highlight"),this.c=a,this.c.classList.add("iti__highlight"),this.selectedFlag.setAttribute("aria-activedescendant",a.getAttribute("id")),b&&this.c.focus()}},{key:"_y",value:function(a,b,c){for(var d=b?i:this.p,e=0;e<d.length;e++)if(d[e].iso2===a)return d[e];if(c)return null;throw new Error("No country data for '".concat(a,"'"))}},{key:"_z",value:function(a){var b=this.d,c=b.allowDropdown,d=b.separateDialCode,e=b.showFlags,f=this.s.iso2?this.s:{};if(this.s=a?this._y(a,!1,!1):{},this.s.iso2&&(this.j=this.s.iso2),e&&this.l.setAttribute("class","iti__flag iti__".concat(a)),this._setSelectedCountryFlagTitleAttribute(a,d),d){var g=this.s.dialCode?"+".concat(this.s.dialCode):"";this.t.innerHTML=g;var h=this.selectedFlag.offsetWidth||this._z2();this.isRTL?this.a.style.paddingRight="".concat(h+6,"px"):this.a.style.paddingLeft="".concat(h+6,"px")}if(this._0(),c){var i=this.b;if(i&&(i.classList.remove("iti__active"),i.setAttribute("aria-selected","false")),a){var j=this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a,"-preferred"))||this.m.querySelector("#iti-".concat(this.id,"__item-").concat(a));j.setAttribute("aria-selected","true"),j.classList.add("iti__active"),this.b=j}}return f.iso2!==a}},{key:"_setSelectedCountryFlagTitleAttribute",value:function(a,b){if(this.selectedFlag){var c;c=a&&!b?"".concat(this.s.name,": +").concat(this.s.dialCode):a?this.s.name:"Unknown",this.selectedFlag.setAttribute("title",c)}}},{key:"_z2",value:function(){var a=this.a.parentNode.cloneNode();a.style.visibility="hidden",document.body.appendChild(a);var b=this.k.cloneNode();a.appendChild(b);var c=this.selectedFlag.cloneNode(!0);b.appendChild(c);var d=c.offsetWidth;return a.parentNode.removeChild(a),d}},{key:"_0",value:function(){var a="aggressive"===this.d.autoPlaceholder||!this.e&&"polite"===this.d.autoPlaceholder;if(window.intlTelInputUtils&&a){var b=intlTelInputUtils.numberType[this.d.placeholderNumberType],c=this.s.iso2?intlTelInputUtils.getExampleNumber(this.s.iso2,this.d.nationalMode,b):"";c=this._7(c),"function"==typeof this.d.customPlaceholder&&(c=this.d.customPlaceholder(c,this.s)),this.a.setAttribute("placeholder",c)}}},{key:"_1",value:function(a){var b=this._z(a.getAttribute("data-country-code"));this._2(),this._4(a.getAttribute("data-dial-code")),this.a.focus();var c=this.a.value.length;this.a.setSelectionRange(c,c),b&&this._m2CountryChange()}},{key:"_2",value:function(){this.m.classList.add("iti__hide"),this.selectedFlag.setAttribute("aria-expanded","false"),this.selectedFlag.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),document.documentElement.removeEventListener("click",this._a2),this.m.removeEventListener("mouseover",this._a0),this.m.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.g||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._m2("close:countrydropdown")}},{key:"_3",value:function(a,b){var c=this.m,d=window.pageYOffset||document.documentElement.scrollTop,e=c.offsetHeight,f=c.getBoundingClientRect().top+d,g=f+e,h=a.offsetHeight,i=a.getBoundingClientRect().top+d,j=i+h,k=i-f+c.scrollTop,l=e/2-h/2;if(i<f)b&&(k-=l),c.scrollTop=k;else if(j>g){b&&(k+=l);var m=e-h;c.scrollTop=k-m}}},{key:"_4",value:function(a){var b,c=this.a.value,d="+".concat(a);if("+"===c.charAt(0)){var e=this._5(c);b=e?c.replace(e,d):d,this.a.value=b}else this.d.autoInsertDialCode&&(b=c?d+c:d,this.a.value=b)}},{key:"_5",value:function(a,b){var c="";if("+"===a.charAt(0))for(var d="",e=0;e<a.length;e++){var f=a.charAt(e);if(!isNaN(parseInt(f,10))){if(d+=f,b)this.q[d]&&(c=a.substr(0,e+1));else if(this.dialCodes[d]){c=a.substr(0,e+1);break}if(d.length===this.countryCodeMaxLen)break}}return c}},{key:"_6",value:function(){var a=this.a.value.trim(),b=this.s.dialCode,c=this._m(a);return(this.d.separateDialCode&&"+"!==a.charAt(0)&&b&&c?"+".concat(b):"")+a}},{key:"_7",value:function(a){var b=a;if(this.d.separateDialCode){var c=this._5(b);if(c){c="+".concat(this.s.dialCode);var d=" "===b[c.length]||"-"===b[c.length]?c.length+1:c.length;b=b.substr(d)}}return this._j2(b)}},{key:"_m2CountryChange",value:function(){this._m2("countrychange")}},{key:"handleAutoCountry",value:function(){"auto"===this.d.initialCountry&&(this.j=window.intlTelInputGlobals.autoCountry,this.a.value||this.setCountry(this.j),this.h())}},{key:"handleUtils",value:function(){
|
|
8
|
-
window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this._0()),this.i0()}},{key:"destroy",value:function(){var a=this.a.form;if(this.d.allowDropdown){this._2(),this.selectedFlag.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);var b=this._i1();b&&b.removeEventListener("click",this._a9)}this.hiddenInput&&a&&a.removeEventListener("submit",this._a14),this.d.autoInsertDialCode&&(a&&a.removeEventListener("submit",this._a8),this.a.removeEventListener("blur",this._a8)),this.a.removeEventListener("keyup",this._a12),this.a.removeEventListener("cut",this._a13),this.a.removeEventListener("paste",this._a13),this.a.removeAttribute("data-intl-tel-input-id");var c=this.a.parentNode;c.parentNode.insertBefore(this.a,c),c.parentNode.removeChild(c),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}},{key:"getNumber",value:function(a){if(window.intlTelInputUtils){var b=this.s.iso2;return intlTelInputUtils.formatNumber(this._6(),b,a)}return""}},{key:"getNumberType",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.s}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var a=this.s.iso2;return intlTelInputUtils.getValidationError(this._6(),a)}return-99}},{key:"isValidNumber",value:function(){var a=this._6().trim();return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(a,this.s.iso2):null}},{key:"setCountry",value:function(a){var b=a.toLowerCase();this.s.iso2!==b&&(this._z(b),this._4(this.s.dialCode),this._m2CountryChange())}},{key:"setNumber",value:function(a){var b=this._v(a);this._u(a),b&&this._m2CountryChange()}},{key:"setPlaceholderNumberType",value:function(a){this.d.placeholderNumberType=a,this._0()}}]),c}();l.getCountryData=function(){return i};var s=function(a,b,c){var d=document.createElement("script");d.onload=function(){q("handleUtils"),b&&b()},d.onerror=function(){q("rejectUtilsScriptPromise"),c&&c()},d.className="iti-load-utils",d.async=!0,d.src=a,document.body.appendChild(d)};return l.loadUtils=function(a){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise(function(b,c){return s(a,b,c)});s(a)}return null},l.defaults=n,l.version="18.
|
|
8
|
+
window.intlTelInputUtils&&(this.a.value&&this._u(this.a.value),this._0()),this.i0()}},{key:"destroy",value:function(){var a=this.a.form;if(this.d.allowDropdown){this._2(),this.selectedFlag.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);var b=this._i1();b&&b.removeEventListener("click",this._a9)}this.hiddenInput&&a&&a.removeEventListener("submit",this._a14),this.d.autoInsertDialCode&&(a&&a.removeEventListener("submit",this._a8),this.a.removeEventListener("blur",this._a8)),this.a.removeEventListener("keyup",this._a12),this.a.removeEventListener("cut",this._a13),this.a.removeEventListener("paste",this._a13),this.a.removeAttribute("data-intl-tel-input-id");var c=this.a.parentNode;c.parentNode.insertBefore(this.a,c),c.parentNode.removeChild(c),delete window.intlTelInputGlobals.instances[this.id]}},{key:"getExtension",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getExtension(this._6(),this.s.iso2):""}},{key:"getNumber",value:function(a){if(window.intlTelInputUtils){var b=this.s.iso2;return intlTelInputUtils.formatNumber(this._6(),b,a)}return""}},{key:"getNumberType",value:function(){return window.intlTelInputUtils?intlTelInputUtils.getNumberType(this._6(),this.s.iso2):-99}},{key:"getSelectedCountryData",value:function(){return this.s}},{key:"getValidationError",value:function(){if(window.intlTelInputUtils){var a=this.s.iso2;return intlTelInputUtils.getValidationError(this._6(),a)}return-99}},{key:"isValidNumber",value:function(){var a=this._6().trim();return window.intlTelInputUtils?intlTelInputUtils.isValidNumber(a,this.s.iso2):null}},{key:"isPossibleNumber",value:function(){var a=this._6().trim();return window.intlTelInputUtils?intlTelInputUtils.isPossibleNumber(a,this.s.iso2):null}},{key:"setCountry",value:function(a){var b=a.toLowerCase();this.s.iso2!==b&&(this._z(b),this._4(this.s.dialCode),this._m2CountryChange())}},{key:"setNumber",value:function(a){var b=this._v(a);this._u(a),b&&this._m2CountryChange()}},{key:"setPlaceholderNumberType",value:function(a){this.d.placeholderNumberType=a,this._0()}}]),c}();l.getCountryData=function(){return i};var s=function(a,b,c){var d=document.createElement("script");d.onload=function(){q("handleUtils"),b&&b()},d.onerror=function(){q("rejectUtilsScriptPromise"),c&&c()},d.className="iti-load-utils",d.async=!0,d.src=a,document.body.appendChild(d)};return l.loadUtils=function(a){if(!window.intlTelInputUtils&&!window.intlTelInputGlobals.startedLoadingUtilsScript){if(window.intlTelInputGlobals.startedLoadingUtilsScript=!0,"undefined"!=typeof Promise)return new Promise(function(b,c){return s(a,b,c)});s(a)}return null},l.defaults=n,l.version="18.2.0",function(a,b){var c=new r(a,b);return c._init(),a.setAttribute("data-intl-tel-input-id",c.id),window.intlTelInputGlobals.instances[c.id]=c,c}}()});
|
package/build/js/utils.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
var aa=this||self;function k(a,b){a=a.split(".");var c=aa;a[0]in c||"undefined"==typeof c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)a.length||void 0===b?c[d]&&c[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}:c[d]=b}function m(a,b){function c(){}c.prototype=b.prototype;a.$=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.fa=function(d,f,e){for(var g=Array(arguments.length-2),h=2;h<arguments.length;h++)g[h-2]=arguments[h];return b.prototype[f].apply(d,g)}};function ba(a){const b=[];let c=0;for(const d in a)b[c++]=a[d];return b};function ca(a,b){this.g=a;this.m=!!b.o;this.i=b.h;this.v=b.type;this.u=!1;switch(this.i){case da:case ea:case fa:case ha:case ia:case ja:case ka:this.u=!0}this.l=b.defaultValue}var ka=1,ja=2,da=3,ea=4,fa=6,ha=16,ia=18;function la(a,b){this.i=a;this.g={};for(a=0;a<b.length;a++){var c=b[a];this.g[c.g]=c}}function ma(a){a=ba(a.g);a.sort(function(b,c){return b.g-c.g});return a};function n(){this.g={};this.l=this.j().g;this.i=this.m=null}n.prototype.has=function(a){return null!=this.g[a.g]};n.prototype.get=function(a,b){return p(this,a.g,b)};n.prototype.set=function(a,b){q(this,a.g,b)};n.prototype.add=function(a,b){r(this,a.g,b)};
|
|
7
|
-
function
|
|
8
|
-
function
|
|
9
|
-
function
|
|
7
|
+
function na(a,b){for(var c=ma(a.j()),d=0;d<c.length;d++){var f=c[d],e=f.g;if(null!=b.g[e]){a.i&&delete a.i[f.g];var g=11==f.i||10==f.i;if(f.m){f=t(b,e);for(var h=0;h<f.length;h++)r(a,e,g?f[h].clone():f[h])}else f=u(b,e),g?(g=u(a,e))?na(g,f):q(a,e,f.clone()):q(a,e,f)}}}n.prototype.clone=function(){var a=new this.constructor;a!=this&&(a.g={},a.i&&(a.i={}),na(a,this));return a};
|
|
8
|
+
function u(a,b){var c=a.g[b];if(null==c)return null;if(a.m){if(!(b in a.i)){var d=a.m,f=a.l[b];if(null!=c)if(f.m){for(var e=[],g=0;g<c.length;g++)e[g]=d.i(f,c[g]);c=e}else c=d.i(f,c);return a.i[b]=c}return a.i[b]}return c}function p(a,b,c){var d=u(a,b);return a.l[b].m?d[c||0]:d}function v(a,b){if(null!=a.g[b])a=p(a,b);else a:{a=a.l[b];if(void 0===a.l)if(b=a.v,b===Boolean)a.l=!1;else if(b===Number)a.l=0;else if(b===String)a.l=a.u?"0":"";else{a=new b;break a}a=a.l}return a}
|
|
9
|
+
function t(a,b){return u(a,b)||[]}function w(a,b){return a.l[b].m?null!=a.g[b]?a.g[b].length:0:null!=a.g[b]?1:0}function q(a,b,c){a.g[b]=c;a.i&&(a.i[b]=c)}function r(a,b,c){a.g[b]||(a.g[b]=[]);a.g[b].push(c);a.i&&delete a.i[b]}function x(a,b){var c=[],d;for(d in b)0!=d&&c.push(new ca(d,b[d]));return new la(a,c)};function y(){}y.prototype.g=function(a){new a.i;throw Error("Unimplemented");};y.prototype.i=function(a,b){if(11==a.i||10==a.i)return b instanceof n?b:this.g(a.v.prototype.j(),b);if(14==a.i)return"string"===typeof b&&oa.test(b)&&(a=Number(b),0<a)?a:b;if(!a.u)return b;a=a.v;if(a===String){if("number"===typeof b)return String(b)}else if(a===Number&&"string"===typeof b&&("Infinity"===b||"-Infinity"===b||"NaN"===b||oa.test(b)))return Number(b);return b};var oa=/^-?[0-9]+$/;function z(){}m(z,y);z.prototype.g=function(a,b){a=new a.i;a.m=this;a.g=b;a.i={};return a};function B(){}m(B,z);B.prototype.i=function(a,b){return 8==a.i?!!b:y.prototype.i.apply(this,arguments)};B.prototype.g=function(a,b){return B.$.g.call(this,a,b)};function C(a,b){null!=a&&this.g.apply(this,arguments)}C.prototype.i="";C.prototype.set=function(a){this.i=""+a};C.prototype.g=function(a,b,c){this.i+=String(a);if(null!=b)for(let d=1;d<arguments.length;d++)this.i+=arguments[d];return this};C.prototype.toString=function(){return this.i};/*
|
|
10
10
|
|
|
11
11
|
Protocol Buffer 2 Copyright 2008 Google Inc.
|
|
12
12
|
All other code copyright its respective owners.
|
|
@@ -24,14 +24,14 @@ function u(a,b){return v(a,b)||[]}function x(a,b){return a.l[b].m?null!=a.g[b]?a
|
|
|
24
24
|
See the License for the specific language governing permissions and
|
|
25
25
|
limitations under the License.
|
|
26
26
|
*/
|
|
27
|
-
function
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
29:{name:"short_code",h:11,type:
|
|
32
|
-
h:9,type:String},16:{name:"national_prefix_transform_rule",h:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",h:8,defaultValue:!1,type:Boolean},19:{name:"number_format",o:!0,h:11,type:
|
|
33
|
-
|
|
34
|
-
h:9,type:String}}));return a};
|
|
27
|
+
function D(){n.call(this)}m(D,n);var pa=null;function E(){n.call(this)}m(E,n);var qa=null;function F(){n.call(this)}m(F,n);var ra=null;
|
|
28
|
+
D.prototype.j=function(){var a=pa;a||(pa=a=x(D,{0:{name:"NumberFormat",s:"i18n.phonenumbers.NumberFormat"},1:{name:"pattern",required:!0,h:9,type:String},2:{name:"format",required:!0,h:9,type:String},3:{name:"leading_digits_pattern",o:!0,h:9,type:String},4:{name:"national_prefix_formatting_rule",h:9,type:String},6:{name:"national_prefix_optional_when_formatting",h:8,defaultValue:!1,type:Boolean},5:{name:"domestic_carrier_code_formatting_rule",h:9,type:String}}));return a};D.j=D.prototype.j;
|
|
29
|
+
E.prototype.j=function(){var a=qa;a||(qa=a=x(E,{0:{name:"PhoneNumberDesc",s:"i18n.phonenumbers.PhoneNumberDesc"},2:{name:"national_number_pattern",h:9,type:String},9:{name:"possible_length",o:!0,h:5,type:Number},10:{name:"possible_length_local_only",o:!0,h:5,type:Number},6:{name:"example_number",h:9,type:String}}));return a};E.j=E.prototype.j;
|
|
30
|
+
F.prototype.j=function(){var a=ra;a||(ra=a=x(F,{0:{name:"PhoneMetadata",s:"i18n.phonenumbers.PhoneMetadata"},1:{name:"general_desc",h:11,type:E},2:{name:"fixed_line",h:11,type:E},3:{name:"mobile",h:11,type:E},4:{name:"toll_free",h:11,type:E},5:{name:"premium_rate",h:11,type:E},6:{name:"shared_cost",h:11,type:E},7:{name:"personal_number",h:11,type:E},8:{name:"voip",h:11,type:E},21:{name:"pager",h:11,type:E},25:{name:"uan",h:11,type:E},27:{name:"emergency",h:11,type:E},28:{name:"voicemail",h:11,type:E},
|
|
31
|
+
29:{name:"short_code",h:11,type:E},30:{name:"standard_rate",h:11,type:E},31:{name:"carrier_specific",h:11,type:E},33:{name:"sms_services",h:11,type:E},24:{name:"no_international_dialling",h:11,type:E},9:{name:"id",required:!0,h:9,type:String},10:{name:"country_code",h:5,type:Number},11:{name:"international_prefix",h:9,type:String},17:{name:"preferred_international_prefix",h:9,type:String},12:{name:"national_prefix",h:9,type:String},13:{name:"preferred_extn_prefix",h:9,type:String},15:{name:"national_prefix_for_parsing",
|
|
32
|
+
h:9,type:String},16:{name:"national_prefix_transform_rule",h:9,type:String},18:{name:"same_mobile_and_fixed_line_pattern",h:8,defaultValue:!1,type:Boolean},19:{name:"number_format",o:!0,h:11,type:D},20:{name:"intl_number_format",o:!0,h:11,type:D},22:{name:"main_country_for_code",h:8,defaultValue:!1,type:Boolean},23:{name:"leading_digits",h:9,type:String}}));return a};F.j=F.prototype.j;function H(){n.call(this)}m(H,n);var sa=null,ta={ea:0,da:1,ca:5,ba:10,aa:20};
|
|
33
|
+
H.prototype.j=function(){var a=sa;a||(sa=a=x(H,{0:{name:"PhoneNumber",s:"i18n.phonenumbers.PhoneNumber"},1:{name:"country_code",required:!0,h:5,type:Number},2:{name:"national_number",required:!0,h:4,type:Number},3:{name:"extension",h:9,type:String},4:{name:"italian_leading_zero",h:8,type:Boolean},8:{name:"number_of_leading_zeros",h:5,defaultValue:1,type:Number},5:{name:"raw_input",h:9,type:String},6:{name:"country_code_source",h:14,defaultValue:0,type:ta},7:{name:"preferred_domestic_carrier_code",
|
|
34
|
+
h:9,type:String}}));return a};H.ctor=H;H.ctor.j=H.prototype.j;/*
|
|
35
35
|
|
|
36
36
|
Copyright (C) 2010 The Libphonenumber Authors
|
|
37
37
|
|
|
@@ -47,11 +47,11 @@ h:9,type:String}}));return a};I.ctor=I;I.ctor.j=I.prototype.j;/*
|
|
|
47
47
|
See the License for the specific language governing permissions and
|
|
48
48
|
limitations under the License.
|
|
49
49
|
*/
|
|
50
|
-
var
|
|
50
|
+
var I={1:"US AG AI AS BB BM BS CA DM DO GD GU JM KN KY LC MP MS PR SX TC TT VC VG VI".split(" "),7:["RU","KZ"],20:["EG"],27:["ZA"],30:["GR"],31:["NL"],32:["BE"],33:["FR"],34:["ES"],36:["HU"],39:["IT","VA"],40:["RO"],41:["CH"],43:["AT"],44:["GB","GG","IM","JE"],45:["DK"],46:["SE"],47:["NO","SJ"],48:["PL"],49:["DE"],51:["PE"],52:["MX"],53:["CU"],54:["AR"],55:["BR"],56:["CL"],57:["CO"],58:["VE"],60:["MY"],61:["AU","CC","CX"],62:["ID"],63:["PH"],64:["NZ"],65:["SG"],66:["TH"],81:["JP"],82:["KR"],84:["VN"],
|
|
51
51
|
86:["CN"],90:["TR"],91:["IN"],92:["PK"],93:["AF"],94:["LK"],95:["MM"],98:["IR"],211:["SS"],212:["MA","EH"],213:["DZ"],216:["TN"],218:["LY"],220:["GM"],221:["SN"],222:["MR"],223:["ML"],224:["GN"],225:["CI"],226:["BF"],227:["NE"],228:["TG"],229:["BJ"],230:["MU"],231:["LR"],232:["SL"],233:["GH"],234:["NG"],235:["TD"],236:["CF"],237:["CM"],238:["CV"],239:["ST"],240:["GQ"],241:["GA"],242:["CG"],243:["CD"],244:["AO"],245:["GW"],246:["IO"],247:["AC"],248:["SC"],249:["SD"],250:["RW"],251:["ET"],252:["SO"],
|
|
52
52
|
253:["DJ"],254:["KE"],255:["TZ"],256:["UG"],257:["BI"],258:["MZ"],260:["ZM"],261:["MG"],262:["RE","YT"],263:["ZW"],264:["NA"],265:["MW"],266:["LS"],267:["BW"],268:["SZ"],269:["KM"],290:["SH","TA"],291:["ER"],297:["AW"],298:["FO"],299:["GL"],350:["GI"],351:["PT"],352:["LU"],353:["IE"],354:["IS"],355:["AL"],356:["MT"],357:["CY"],358:["FI","AX"],359:["BG"],370:["LT"],371:["LV"],372:["EE"],373:["MD"],374:["AM"],375:["BY"],376:["AD"],377:["MC"],378:["SM"],380:["UA"],381:["RS"],382:["ME"],383:["XK"],385:["HR"],
|
|
53
53
|
386:["SI"],387:["BA"],389:["MK"],420:["CZ"],421:["SK"],423:["LI"],500:["FK"],501:["BZ"],502:["GT"],503:["SV"],504:["HN"],505:["NI"],506:["CR"],507:["PA"],508:["PM"],509:["HT"],590:["GP","BL","MF"],591:["BO"],592:["GY"],593:["EC"],594:["GF"],595:["PY"],596:["MQ"],597:["SR"],598:["UY"],599:["CW","BQ"],670:["TL"],672:["NF"],673:["BN"],674:["NR"],675:["PG"],676:["TO"],677:["SB"],678:["VU"],679:["FJ"],680:["PW"],681:["WF"],682:["CK"],683:["NU"],685:["WS"],686:["KI"],687:["NC"],688:["TV"],689:["PF"],690:["TK"],
|
|
54
|
-
691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},
|
|
54
|
+
691:["FM"],692:["MH"],800:["001"],808:["001"],850:["KP"],852:["HK"],853:["MO"],855:["KH"],856:["LA"],870:["001"],878:["001"],880:["BD"],881:["001"],882:["001"],883:["001"],886:["TW"],888:["001"],960:["MV"],961:["LB"],962:["JO"],963:["SY"],964:["IQ"],965:["KW"],966:["SA"],967:["YE"],968:["OM"],970:["PS"],971:["AE"],972:["IL"],973:["BH"],974:["QA"],975:["BT"],976:["MN"],977:["NP"],979:["001"],992:["TJ"],993:["TM"],994:["AZ"],995:["GE"],996:["KG"],998:["UZ"]},ua={AC:[,[,,"(?:[01589]\\d|[46])\\d{4}",
|
|
55
55
|
,,,,,,[5,6]],[,,"6[2-467]\\d{3}",,,,"62889",,,[5]],[,,"4\\d{4}",,,,"40123",,,[5]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],"AC",247,"00",,,,,,,,,,[,,,,,,,,,[-1]],,,[,,,,,,,,,[-1]],[,,"(?:0[1-9]|[1589]\\d)\\d{4}",,,,"542011",,,[6]],,,[,,,,,,,,,[-1]]],AD:[,[,,"(?:1|6\\d)\\d{7}|[135-9]\\d{5}",,,,,,,[6,8,9]],[,,"[78]\\d{5}",,,,"712345",,,[6]],[,,"690\\d{6}|[356]\\d{5}",,,,"312345",,,[6,9]],[,,"180[02]\\d{4}",,,,"18001234",,,[8]],[,,"[19]\\d{5}",,,,"912345",,,[6]],
|
|
56
56
|
[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],"AD",376,"00",,,,,,,,[[,"(\\d{3})(\\d{3})","$1 $2",["[135-9]"]],[,"(\\d{4})(\\d{4})","$1 $2",["1"]],[,"(\\d{3})(\\d{3})(\\d{3})","$1 $2 $3",["6"]]],,[,,,,,,,,,[-1]],,,[,,"1800\\d{4}",,,,,,,[8]],[,,,,,,,,,[-1]],,,[,,,,,,,,,[-1]]],AE:[,[,,"(?:[4-7]\\d|9[0-689])\\d{7}|800\\d{2,9}|[2-4679]\\d{7}",,,,,,,[5,6,7,8,9,10,11,12]],[,,"[2-4679][2-8]\\d{6}",,,,"22345678",,,[8],[7]],[,,"5[024-68]\\d{7}",,,,"501234567",,,[9]],[,,"400\\d{6}|800\\d{2,9}",,,,"800123456"],
|
|
57
57
|
[,,"900[02]\\d{5}",,,,"900234567",,,[9]],[,,"700[05]\\d{5}",,,,"700012345",,,[9]],[,,,,,,,,,[-1]],[,,,,,,,,,[-1]],"AE",971,"00","0",,,"0",,,,[[,"(\\d{3})(\\d{2,9})","$1 $2",["60|8"]],[,"(\\d)(\\d{3})(\\d{4})","$1 $2 $3",["[236]|[479][2-8]"],"0$1"],[,"(\\d{3})(\\d)(\\d{5})","$1 $2 $3",["[479]"]],[,"(\\d{2})(\\d{3})(\\d{4})","$1 $2 $3",["5"],"0$1"]],,[,,,,,,,,,[-1]],,,[,,,,,,,,,[-1]],[,,"600[25]\\d{5}",,,,"600212345",,,[9]],,,[,,,,,,,,,[-1]]],AF:[,[,,"[2-7]\\d{8}",,,,,,,[9],[7]],[,,"(?:[25][0-8]|[34][0-4]|6[0-5])[2-9]\\d{6}",
|
|
@@ -478,31 +478,31 @@ TD:[,[,,"(?:22|[69]\\d|77)\\d{6}",,,,,,,[8]],[,,"22(?:[37-9]0|5[0-5]|6[89])\\d{4
|
|
|
478
478
|
See the License for the specific language governing permissions and
|
|
479
479
|
limitations under the License.
|
|
480
480
|
*/
|
|
481
|
-
function
|
|
482
|
-
var
|
|
481
|
+
function J(){this.g={}}J.i=void 0;J.g=function(){return J.i?J.i:J.i=new J};
|
|
482
|
+
var va={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9"},wa={0:"0",1:"1",2:"2",3:"3",4:"4",5:"5",6:"6",
|
|
483
483
|
7:"7",8:"8",9:"9","\uff10":"0","\uff11":"1","\uff12":"2","\uff13":"3","\uff14":"4","\uff15":"5","\uff16":"6","\uff17":"7","\uff18":"8","\uff19":"9","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u06f0":"0","\u06f1":"1","\u06f2":"2","\u06f3":"3","\u06f4":"4","\u06f5":"5","\u06f6":"6","\u06f7":"7","\u06f8":"8","\u06f9":"9",A:"2",B:"2",C:"2",D:"3",E:"3",F:"3",G:"4",H:"4",I:"4",J:"5",K:"5",L:"5",M:"6",N:"6",O:"6",P:"7",
|
|
484
|
-
Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},
|
|
485
|
-
|
|
486
|
-
function
|
|
487
|
-
var
|
|
488
|
-
function
|
|
489
|
-
function
|
|
490
|
-
g=
|
|
491
|
-
function
|
|
492
|
-
function
|
|
493
|
-
function
|
|
494
|
-
function
|
|
495
|
-
function
|
|
496
|
-
function Pa(a,b,c,d,f,e){if(0==b.length)return 0;b=new
|
|
497
|
-
a:{a=b.toString();if(0!=a.length&&"0"!=a.charAt(0))for(f=a.length,b=1;3>=b&&b<=f;++b)if(c=parseInt(a.substring(0,b),10),c in
|
|
498
|
-
function Qa(a,b,c){var d=a.toString(),f=d.length,e=p(b,15);if(0!=f&&null!=e&&0!=e.length){var g=new RegExp("^(?:"+e+")");if(f=g.exec(d)){e=new RegExp(
|
|
499
|
-
function Z(a,b,c){if(!
|
|
500
|
-
function Ra(a,b,c,d){if(null==b)throw Error("The string supplied did not seem to be a phone number");if(250<b.length)throw Error("The string supplied is too long to be a phone number");var f=new
|
|
501
|
-
null!=e?("+"===e.charAt(0)&&f.g(e),e=b.indexOf("tel:"),f.g(b.substring(0<=e?e+4:0,b.indexOf(";phone-context=")))):(e=f.g,g=b??"",h=g.search(
|
|
502
|
-
e=new
|
|
503
|
-
1,h)):d&&(delete e.g[6],e.i&&delete e.i[6]));if(2>b.i.length)throw Error("The string supplied is too short to be a phone number");null!=g&&(c=new
|
|
504
|
-
1;a<d.length-1&&"0"==d.charAt(a);)a++;1!=a&&q(e,8,a)}q(e,2,parseInt(d,10));return e}function
|
|
505
|
-
k("intlTelInputUtils.getNumberType",(a,b)=>{try{const h=
|
|
506
|
-
k("intlTelInputUtils.getValidationError",(a,b)=>{try{const c=
|
|
507
|
-
k("intlTelInputUtils.isValidNumber",(a,b)=>{try{const
|
|
508
|
-
k("intlTelInputUtils.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1});k("intlTelInputUtils.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5});})();
|
|
484
|
+
Q:"7",R:"7",S:"7",T:"8",U:"8",V:"8",W:"9",X:"9",Y:"9",Z:"9"},K=RegExp("^[+\uff0b]+"),xa=RegExp("([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])"),ya=RegExp("[+\uff0b0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]"),za=/[\\\/] *x/,Aa=RegExp("[^0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9A-Za-z#]+$"),Ba=/(?:.*?[A-Za-z]){3}.*/,Ca=RegExp("^\\+([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]|[\\-\\.\\(\\)]?)*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]|[\\-\\.\\(\\)]?)*$"),
|
|
485
|
+
Da=RegExp("^([A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]+((\\-)*[A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])*\\.)*[A-Za-z]+((\\-)*[A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9])*\\.?$");function L(a){return"([0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{1,"+a+"})"}
|
|
486
|
+
function Ea(){return";ext="+L("20")+"|[ \u00a0\\t,]*(?:e?xt(?:ensi(?:o\u0301?|\u00f3))?n?|\uff45?\uff58\uff54\uff4e?|\u0434\u043e\u0431|anexo)[:\\.\uff0e]?[ \u00a0\\t,-]*"+(L("20")+"#?|[ \u00a0\\t,]*(?:[x\uff58#\uff03~\uff5e]|int|\uff49\uff4e\uff54)[:\\.\uff0e]?[ \u00a0\\t,-]*")+(L("9")+"#?|[- ]+")+(L("6")+"#|[ \u00a0\\t]*(?:,{2}|;)[:\\.\uff0e]?[ \u00a0\\t,-]*")+(L("15")+"#?|[ \u00a0\\t]*(?:,)+[:\\.\uff0e]?[ \u00a0\\t,-]*")+(L("9")+"#?")}
|
|
487
|
+
var Fa=new RegExp("(?:"+Ea()+")$","i"),Ga=new RegExp("^[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]{2}$|^[+\uff0b]*(?:[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*]*[0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]){3,}[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e*A-Za-z0-9\uff10-\uff19\u0660-\u0669\u06f0-\u06f9]*(?:"+Ea()+")?$","i"),Ha=/(\$\d)/;
|
|
488
|
+
function Ia(a){return 2>a.length?!1:M(Ga,a)}function Ja(a){return M(Ba,a)?N(a,wa):N(a,va)}function Ka(a){var b=Ja(a.toString());a.i="";a.g(b)}function La(a){return null!=a&&(1!=w(a,9)||-1!=t(a,9)[0])}function N(a,b){for(var c=new C,d,f=a.length,e=0;e<f;++e)d=a.charAt(e),d=b[d.toUpperCase()],null!=d&&c.g(d);return c.toString()}function O(a){return null!=a&&isNaN(a)&&a.toUpperCase()in ua}
|
|
489
|
+
function Ma(a,b,c){if(0==p(b,2)&&null!=b.g[5]){var d=v(b,5);if(0<d.length)return d}d=v(b,1);var f=P(b);if(0==c)return Na(d,0,f,"");if(!(d in I))return f;a=Q(a,d,R(d));b=null!=b.g[3]&&0!=p(b,3).length?3==c?";ext="+p(b,3):null!=a.g[13]?p(a,13)+v(b,3):" ext. "+v(b,3):"";a:{a=0==t(a,20).length||2==c?t(a,19):t(a,20);for(var e,g=a.length,h=0;h<g;++h){e=a[h];var l=w(e,3);if(0==l||0==f.search(p(e,3,l-1)))if(l=new RegExp(p(e,1)),M(l,f)){a=e;break a}}a=null}null!=a&&(g=a,a=v(g,2),e=new RegExp(p(g,1)),v(g,5),
|
|
490
|
+
g=v(g,4),f=2==c&&null!=g&&0<g.length?f.replace(e,a.replace(Ha,g)):f.replace(e,a),3==c&&(f=f.replace(RegExp("^[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+"),""),f=f.replace(RegExp("[-x\u2010-\u2015\u2212\u30fc\uff0d-\uff0f \u00a0\u00ad\u200b\u2060\u3000()\uff08\uff09\uff3b\uff3d.\\[\\]/~\u2053\u223c\uff5e]+","g"),"-")));return Na(d,c,f,b)}function Q(a,b,c){return"001"==c?S(a,""+b):S(a,c)}
|
|
491
|
+
function P(a){if(null==a.g[2])return"";var b=""+p(a,2);return null!=a.g[4]&&p(a,4)&&0<v(a,8)?Array(v(a,8)+1).join("0")+b:b}function Na(a,b,c,d){switch(b){case 0:return"+"+a+c+d;case 1:return"+"+a+" "+c+d;case 3:return"tel:+"+a+"-"+c+d;default:return c+d}}
|
|
492
|
+
function T(a,b){switch(b){case 4:return p(a,5);case 3:return p(a,4);case 1:return p(a,3);case 0:case 2:return p(a,2);case 5:return p(a,6);case 6:return p(a,8);case 7:return p(a,7);case 8:return p(a,21);case 9:return p(a,25);case 10:return p(a,28);default:return p(a,1)}}function U(a,b){return V(a,p(b,1))?V(a,p(b,5))?4:V(a,p(b,4))?3:V(a,p(b,6))?5:V(a,p(b,8))?6:V(a,p(b,7))?7:V(a,p(b,21))?8:V(a,p(b,25))?9:V(a,p(b,28))?10:V(a,p(b,2))?p(b,18)||V(a,p(b,3))?2:0:!p(b,18)&&V(a,p(b,3))?1:-1:-1}
|
|
493
|
+
function S(a,b){if(null==b)return null;b=b.toUpperCase();var c=a.g[b];if(null==c){c=ua[b];if(null==c)return null;c=(new B).g(F.j(),c);a.g[b]=c}return c}function V(a,b){var c=a.length;return 0<w(b,9)&&-1==t(b,9).indexOf(c)?!1:M(v(b,2),a)}
|
|
494
|
+
function Oa(a,b){if(null==b)return null;var c=v(b,1);c=I[c];if(null==c)a=null;else if(1==c.length)a=c[0];else a:{b=P(b);for(var d,f=c.length,e=0;e<f;e++){d=c[e];var g=S(a,d);if(null!=g.g[23]){if(0==b.search(p(g,23))){a=d;break a}}else if(-1!=U(b,g)){a=d;break a}}a=null}return a}function R(a){a=I[a];return null==a?"ZZ":a[0]}
|
|
495
|
+
function W(a,b,c,d){var f=T(c,d),e=0==w(f,9)?t(p(c,1),9):t(f,9);f=t(f,10);if(2==d)if(La(T(c,0)))a=T(c,1),La(a)&&(e=e.concat(0==w(a,9)?t(p(c,1),9):t(a,9)),e.sort(),0==f.length?f=t(a,10):(f=f.concat(t(a,10)),f.sort()));else return W(a,b,c,1);if(-1==e[0])return 5;b=b.length;if(-1<f.indexOf(b))return 4;c=e[0];return c==b?0:c>b?2:e[e.length-1]<b?3:-1<e.indexOf(b,1)?0:5}function X(a,b){var c=P(b);b=v(b,1);if(!(b in I))return 1;b=Q(a,b,R(b));return W(a,c,b,-1)}
|
|
496
|
+
function Pa(a,b,c,d,f,e){if(0==b.length)return 0;b=new C(b);var g;null!=c&&(g=p(c,11));null==g&&(g="NonMatch");var h=b.toString();if(0==h.length)g=20;else if(K.test(h))h=h.replace(K,""),b.i="",b.g(Ja(h)),g=1;else{h=new RegExp(g);Ka(b);g=b.toString();if(0==g.search(h)){h=g.match(h)[0].length;var l=g.substring(h).match(xa);l&&null!=l[1]&&0<l[1].length&&"0"==N(l[1],va)?g=!1:(b.i="",b.g(g.substring(h)),g=!0)}else g=!1;g=g?5:20}f&&q(e,6,g);if(20!=g){if(2>=b.i.length)throw Error("Phone number too short after IDD");
|
|
497
|
+
a:{a=b.toString();if(0!=a.length&&"0"!=a.charAt(0))for(f=a.length,b=1;3>=b&&b<=f;++b)if(c=parseInt(a.substring(0,b),10),c in I){d.g(a.substring(b));d=c;break a}d=0}if(0!=d)return q(e,1,d),d;throw Error("Invalid country calling code");}if(null!=c&&(g=v(c,10),h=""+g,l=b.toString(),0==l.lastIndexOf(h,0)&&(h=new C(l.substring(h.length)),l=p(c,1),l=new RegExp(v(l,2)),Qa(h,c,null),h=h.toString(),!M(l,b.toString())&&M(l,h)||3==W(a,b.toString(),c,-1))))return d.g(h),f&&q(e,6,10),q(e,1,g),g;q(e,1,0);return 0}
|
|
498
|
+
function Qa(a,b,c){var d=a.toString(),f=d.length,e=p(b,15);if(0!=f&&null!=e&&0!=e.length){var g=new RegExp("^(?:"+e+")");if(f=g.exec(d)){e=new RegExp(v(p(b,1),2));var h=M(e,d),l=f.length-1;b=p(b,16);if(null==b||0==b.length||null==f[l]||0==f[l].length){if(!h||M(e,d.substring(f[0].length)))null!=c&&0<l&&null!=f[l]&&c.g(f[1]),a.set(d.substring(f[0].length))}else if(d=d.replace(g,b),!h||M(e,d))null!=c&&0<l&&c.g(f[1]),a.set(d)}}}
|
|
499
|
+
function Z(a,b,c){if(!O(c)&&0<b.length&&"+"!=b.charAt(0))throw Error("Invalid country calling code");return Ra(a,b,c,!0)}
|
|
500
|
+
function Ra(a,b,c,d){if(null==b)throw Error("The string supplied did not seem to be a phone number");if(250<b.length)throw Error("The string supplied is too long to be a phone number");var f=new C;var e=b.indexOf(";phone-context=");if(-1===e)e=null;else if(e+=15,e>=b.length)e="";else{var g=b.indexOf(";",e);e=-1!==g?b.substring(e,g):b.substring(e)}var h=e;null==h?g=!0:0===h.length?g=!1:(g=Ca.exec(h),h=Da.exec(h),g=null!==g||null!==h);if(!g)throw Error("The string supplied did not seem to be a phone number");
|
|
501
|
+
null!=e?("+"===e.charAt(0)&&f.g(e),e=b.indexOf("tel:"),f.g(b.substring(0<=e?e+4:0,b.indexOf(";phone-context=")))):(e=f.g,g=b??"",h=g.search(ya),0<=h?(g=g.substring(h),g=g.replace(Aa,""),h=g.search(za),0<=h&&(g=g.substring(0,h))):g="",e.call(f,g));e=f.toString();g=e.indexOf(";isub=");0<g&&(f.i="",f.g(e.substring(0,g)));if(!Ia(f.toString()))throw Error("The string supplied did not seem to be a phone number");e=f.toString();if(!(O(c)||null!=e&&0<e.length&&K.test(e)))throw Error("Invalid country calling code");
|
|
502
|
+
e=new H;d&&q(e,5,b);a:{b=f.toString();g=b.search(Fa);if(0<=g&&Ia(b.substring(0,g))){h=b.match(Fa);for(var l=h.length,A=1;A<l;++A)if(null!=h[A]&&0<h[A].length){f.i="";f.g(b.substring(0,g));b=h[A];break a}}b=""}0<b.length&&q(e,3,b);g=S(a,c);b=new C;h=0;l=f.toString();try{h=Pa(a,l,g,b,d,e)}catch(G){if("Invalid country calling code"==G.message&&K.test(l)){if(l=l.replace(K,""),h=Pa(a,l,g,b,d,e),0==h)throw G;}else throw G;}0!=h?(f=R(h),f!=c&&(g=Q(a,h,f))):(Ka(f),b.g(f.toString()),null!=c?(h=v(g,10),q(e,
|
|
503
|
+
1,h)):d&&(delete e.g[6],e.i&&delete e.i[6]));if(2>b.i.length)throw Error("The string supplied is too short to be a phone number");null!=g&&(c=new C,f=new C(b.toString()),Qa(f,g,c),a=W(a,f.toString(),g,-1),2!=a&&4!=a&&5!=a&&(b=f,d&&0<c.toString().length&&q(e,7,c.toString())));d=b.toString();a=d.length;if(2>a)throw Error("The string supplied is too short to be a phone number");if(17<a)throw Error("The string supplied is too long to be a phone number");if(1<d.length&&"0"==d.charAt(0)){q(e,4,!0);for(a=
|
|
504
|
+
1;a<d.length-1&&"0"==d.charAt(a);)a++;1!=a&&q(e,8,a)}q(e,2,parseInt(d,10));return e}function M(a,b){return(a="string"==typeof a?b.match("^(?:"+a+")$"):b.match(a))&&a[0].length==b.length?!0:!1};k("intlTelInputUtils",{});k("intlTelInputUtils.formatNumber",(a,b,c)=>{try{const f=J.g(),e=Z(f,a,b);var d=X(f,e);return 0==d||4==d?Ma(f,e,"undefined"===typeof c?0:c):a}catch(f){return a}});k("intlTelInputUtils.getExampleNumber",(a,b,c)=>{try{const h=J.g();a:{var d=h;if(O(a)){var f=T(S(d,a),c);try{if(null!=f.g[6]){var e=p(f,6);var g=Ra(d,e,a,!1);break a}}catch(l){}}g=null}return Ma(h,g,b?2:1)}catch(h){return""}});k("intlTelInputUtils.getExtension",(a,b)=>{try{return p(Z(J.g(),a,b),3)}catch(c){return""}});
|
|
505
|
+
k("intlTelInputUtils.getNumberType",(a,b)=>{try{const h=J.g();var c=Z(h,a,b);a=h;var d=Oa(a,c),f=Q(a,v(c,1),d);if(null==f)var e=-1;else{var g=P(c);e=U(g,f)}return e}catch(h){return-99}});
|
|
506
|
+
k("intlTelInputUtils.getValidationError",(a,b)=>{try{const c=J.g(),d=Z(c,a,b);return X(c,d)}catch(c){return"Invalid country calling code"===c.message?1:"Phone number too short after IDD"===c.message||"The string supplied is too short to be a phone number"===c.message?2:"The string supplied is too long to be a phone number"===c.message?3:-99}});
|
|
507
|
+
k("intlTelInputUtils.isValidNumber",(a,b)=>{try{const Y=J.g();var c=Z(Y,a,b);a=Y;var d=Oa(a,c);var f=v(c,1),e=Q(a,f,d),g;if(!(g=null==e)){var h;if(h="001"!=d){var l=S(a,d);if(null==l)throw Error("Invalid region code: "+d);var A=v(l,10);h=f!=A}g=h}if(g)var G=!1;else{var Sa=P(c);G=-1!=U(Sa,e)}return G}catch(Y){return!1}});k("intlTelInputUtils.isPossibleNumber",(a,b)=>{try{const c=J.g(),d=Z(c,a,b);return 0===X(c,d)}catch(c){return!1}});
|
|
508
|
+
k("intlTelInputUtils.numberFormat",{E164:0,INTERNATIONAL:1,NATIONAL:2,RFC3966:3});k("intlTelInputUtils.numberType",{FIXED_LINE:0,MOBILE:1,FIXED_LINE_OR_MOBILE:2,TOLL_FREE:3,PREMIUM_RATE:4,SHARED_COST:5,VOIP:6,PERSONAL_NUMBER:7,PAGER:8,UAN:9,VOICEMAIL:10,UNKNOWN:-1});k("intlTelInputUtils.validationError",{IS_POSSIBLE:0,INVALID_COUNTRY_CODE:1,TOO_SHORT:2,TOO_LONG:3,IS_POSSIBLE_LOCAL_ONLY:4,INVALID_LENGTH:5});})();
|
package/composer.json
CHANGED
package/package.json
CHANGED
package/spec.html
CHANGED
|
@@ -60,6 +60,8 @@
|
|
|
60
60
|
|
|
61
61
|
<script src="src/spec/tests/methods/getValidationError.js"></script>
|
|
62
62
|
|
|
63
|
+
<script src="src/spec/tests/methods/isPossibleNumber.js"></script>
|
|
64
|
+
|
|
63
65
|
<script src="src/spec/tests/methods/isValidNumber.js"></script>
|
|
64
66
|
|
|
65
67
|
<script src="src/spec/tests/methods/setCountry.js"></script>
|
package/src/js/intlTelInput.js
CHANGED
|
@@ -1657,6 +1657,14 @@ class Iti {
|
|
|
1657
1657
|
: null;
|
|
1658
1658
|
}
|
|
1659
1659
|
|
|
1660
|
+
// check if input val is possible number (weaker validation, but more future-proof) - assumes the global function isPossibleNumber (from utilsScript)
|
|
1661
|
+
isPossibleNumber() {
|
|
1662
|
+
const val = this._getFullNumber().trim();
|
|
1663
|
+
return window.intlTelInputUtils
|
|
1664
|
+
? intlTelInputUtils.isPossibleNumber(val, this.selectedCountryData.iso2)
|
|
1665
|
+
: null;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1660
1668
|
// update the selected flag, and update the input val accordingly
|
|
1661
1669
|
setCountry(originalCountryCode) {
|
|
1662
1670
|
const countryCode = originalCountryCode.toLowerCase();
|
package/src/js/utils.js
CHANGED
|
@@ -102,6 +102,19 @@ const isValidNumber = (number, countryCode) => {
|
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
+
// check if given number is possible
|
|
106
|
+
const isPossibleNumber = (number, countryCode) => {
|
|
107
|
+
try {
|
|
108
|
+
const phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
|
|
109
|
+
const numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode);
|
|
110
|
+
// can't use phoneUtil.isPossibleNumber directly as it accepts IS_POSSIBLE_LOCAL_ONLY numbers e.g. local numbers that are much shorter
|
|
111
|
+
const result = phoneUtil.isPossibleNumberWithReason(numberObj);
|
|
112
|
+
return result === i18n.phonenumbers.PhoneNumberUtil.ValidationResult.IS_POSSIBLE;
|
|
113
|
+
} catch (e) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
105
118
|
/********************
|
|
106
119
|
* NOTE: for following sections, keys must be in quotes to force closure compiler to preserve them
|
|
107
120
|
********************/
|
|
@@ -149,6 +162,7 @@ goog.exportSymbol("intlTelInputUtils.getExtension", getExtension);
|
|
|
149
162
|
goog.exportSymbol("intlTelInputUtils.getNumberType", getNumberType);
|
|
150
163
|
goog.exportSymbol("intlTelInputUtils.getValidationError", getValidationError);
|
|
151
164
|
goog.exportSymbol("intlTelInputUtils.isValidNumber", isValidNumber);
|
|
165
|
+
goog.exportSymbol("intlTelInputUtils.isPossibleNumber", isPossibleNumber);
|
|
152
166
|
// enums
|
|
153
167
|
goog.exportSymbol("intlTelInputUtils.numberFormat", numberFormat);
|
|
154
168
|
goog.exportSymbol("intlTelInputUtils.numberType", numberType);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
describe("isPossibleNumber:", function() {
|
|
4
|
+
|
|
5
|
+
beforeEach(function() {
|
|
6
|
+
intlSetup(true);
|
|
7
|
+
input = $("<input>").wrap("div");
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
afterEach(function() {
|
|
11
|
+
intlTeardown();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
describe("init plugin and call public method isPossibleNumber", function() {
|
|
17
|
+
|
|
18
|
+
beforeEach(function() {
|
|
19
|
+
iti = window.intlTelInput(input[0]);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("returns true for: valid intl number", function() {
|
|
23
|
+
iti.setNumber("+44 7733 123456");
|
|
24
|
+
expect(iti.isPossibleNumber()).toBeTruthy();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it("returns true for: possible but invalid (bad dial code) intl number", function() {
|
|
28
|
+
iti.setNumber("+44 9999 123456");
|
|
29
|
+
expect(iti.isPossibleNumber()).toBeTruthy();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it("returns false for: invalid (too short by 2 digits) intl number", function() {
|
|
33
|
+
iti.setNumber("+44 7733 1234");
|
|
34
|
+
expect(iti.isPossibleNumber()).toBeFalsy();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
// guess this is a quirk of UK phone numbers that some valid ones are only 10 digits (e.g. 0773312345)
|
|
38
|
+
it("returns true for: invalid (too short by 1 digit) intl number", function() {
|
|
39
|
+
iti.setNumber("+44 7733 12345");
|
|
40
|
+
expect(iti.isPossibleNumber()).toBeTruthy();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it("returns false for: invalid (too long) intl number", function() {
|
|
44
|
+
iti.setNumber("+44 7733 1234567");
|
|
45
|
+
expect(iti.isPossibleNumber()).toBeFalsy();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("returns null when utils script is not available", function() {
|
|
49
|
+
delete window.intlTelInputUtils;
|
|
50
|
+
iti.setNumber("+44 7733 123456");
|
|
51
|
+
expect(iti.isPossibleNumber()).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
});
|
|
@@ -24,22 +24,22 @@ describe("isValidNumber:", function() {
|
|
|
24
24
|
expect(iti.isValidNumber()).toBeTruthy();
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
it("returns false for: invalid intl number", function() {
|
|
27
|
+
it("returns false for: invalid (too short) intl number", function() {
|
|
28
28
|
iti.setNumber("+44 7733 123");
|
|
29
29
|
expect(iti.isValidNumber()).toBeFalsy();
|
|
30
30
|
});
|
|
31
31
|
|
|
32
|
+
it("returns false for: possible but invalid (bad dial code) intl number", function() {
|
|
33
|
+
iti.setNumber("+44 9999 123456");
|
|
34
|
+
expect(iti.isValidNumber()).toBeFalsy();
|
|
35
|
+
});
|
|
36
|
+
|
|
32
37
|
it("returns null when utils script is not available", function() {
|
|
33
38
|
delete window.intlTelInputUtils;
|
|
34
39
|
iti.setNumber("+44 7733 123456");
|
|
35
40
|
expect(iti.isValidNumber()).toBeNull();
|
|
36
41
|
});
|
|
37
42
|
|
|
38
|
-
/*it("returns false for: valid intl number containing alpha chars", function() {
|
|
39
|
-
iti.setNumber("+44 7733 123 abc");
|
|
40
|
-
expect(iti.isValidNumber()).toBeFalsy();
|
|
41
|
-
});*/
|
|
42
|
-
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
|
|
@@ -62,7 +62,7 @@ describe("isValidNumber:", function() {
|
|
|
62
62
|
expect(iti.isValidNumber()).toBeTruthy();
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
it("returns false for: correct selected country, invalid number", function() {
|
|
65
|
+
it("returns false for: correct selected country, invalid (too short) number", function() {
|
|
66
66
|
iti.setCountry("gb");
|
|
67
67
|
iti.setNumber("07733 123");
|
|
68
68
|
expect(iti.isValidNumber()).toBeFalsy();
|