intl-tel-input 23.0.10 → 23.0.12
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 +34 -24
- package/build/js/data.js +1 -1
- package/build/js/data.min.js +1 -1
- package/build/js/intlTelInput.d.ts +1 -0
- package/build/js/intlTelInput.js +33 -14
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +262 -189
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/build/js/utils.js +36 -37
- package/package.json +1 -1
- package/react/README.md +9 -4
- package/react/build/IntlTelInput.cjs +32 -13
- package/react/build/IntlTelInput.d.ts +1 -0
- package/react/build/IntlTelInput.js +32 -13
- package/react/build/IntlTelInputWithUtils.cjs +261 -188
- package/react/build/IntlTelInputWithUtils.js +261 -188
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# International Telephone Input [](https://app.travis-ci.com/jackocnr/intl-tel-input) <img src="https://img.shields.io/github/package-json/v/jackocnr/intl-tel-input.svg" alt="version"/> <img src="https://img.shields.io/npm/dm/intl-tel-input.svg" alt="downloads"/>
|
|
2
2
|
|
|
3
|
-
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/react.png" alt="React logo" width="16px" /> NEWS: we now have our own <a href="https://intl-tel-input
|
|
3
|
+
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/react.png" alt="React logo" width="16px" /> NEWS: we now have our own <a href="https://github.com/jackocnr/intl-tel-input/tree/master/react">React component</a>! Play with it on <a href="https://intl-tel-input.com/storybook/?path=/docs/intltelinput--vanilla">Storybook</a>.
|
|
4
4
|
|
|
5
5
|
<img src="https://raw.github.com/jackocnr/intl-tel-input/master/screenshots/typescript.png" alt="Typescript logo" width="16px" /> NEWS: we now have our own Typescript type definitions, so no need to use `@types/intl-tel-input` anymore!
|
|
6
6
|
|
|
@@ -25,10 +25,11 @@ Use <a href="https://www.twilio.com/blog/international-telephone-input-twilio?ut
|
|
|
25
25
|
- [Getting Started](#getting-started-using-a-cdn)
|
|
26
26
|
- [Recommended Usage](#recommended-usage)
|
|
27
27
|
- [Initialisation Options](#initialisation-options)
|
|
28
|
-
- [
|
|
28
|
+
- [Instance Methods](#instance-methods)
|
|
29
29
|
- [Static Methods](#static-methods)
|
|
30
30
|
- [Events](#events)
|
|
31
31
|
- [Utilities Script](#utilities-script)
|
|
32
|
+
- [Loading The Utilities Script](#loading-the-utilities-script)
|
|
32
33
|
- [Troubleshooting](#troubleshooting)
|
|
33
34
|
- [Contributing](#contributing)
|
|
34
35
|
- [Attributions](#attributions)
|
|
@@ -55,7 +56,7 @@ By default, on mobile devices we show a fullscreen popup instead of the inline d
|
|
|
55
56
|
* Easily customise styles by overriding CSS variables
|
|
56
57
|
* React component included
|
|
57
58
|
* Translations for country names (etc) provided in many different languages
|
|
58
|
-
* Lots of initialisation options for customisation, as well as
|
|
59
|
+
* Lots of initialisation options for customisation, as well as instance methods/events for interaction
|
|
59
60
|
|
|
60
61
|
## Browser Compatibility
|
|
61
62
|
| Chrome | Firefox | Safari | Edge |
|
|
@@ -67,16 +68,16 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
67
68
|
## Getting Started (Using a CDN)
|
|
68
69
|
1. Add the CSS
|
|
69
70
|
```html
|
|
70
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.
|
|
71
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.12/build/css/intlTelInput.css">
|
|
71
72
|
```
|
|
72
73
|
|
|
73
74
|
2. Add the plugin script and initialise it on your input element
|
|
74
75
|
```html
|
|
75
|
-
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.
|
|
76
|
+
<script src="https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.12/build/js/intlTelInput.min.js"></script>
|
|
76
77
|
<script>
|
|
77
78
|
const input = document.querySelector("#phone");
|
|
78
79
|
window.intlTelInput(input, {
|
|
79
|
-
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.
|
|
80
|
+
utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.12/build/js/utils.js",
|
|
80
81
|
});
|
|
81
82
|
</script>
|
|
82
83
|
```
|
|
@@ -136,7 +137,7 @@ _Note: We have now dropped support for all versions of Internet Explorer because
|
|
|
136
137
|
```
|
|
137
138
|
|
|
138
139
|
## Recommended Usage
|
|
139
|
-
We highly recommend you
|
|
140
|
+
We highly recommend you [load the included utils.js](#loading-the-utilities-script), which enables formatting and validation etc. 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.
|
|
140
141
|
|
|
141
142
|
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 in the input, 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).
|
|
142
143
|
|
|
@@ -149,11 +150,11 @@ When you initialise the plugin, the first argument is the input element, and the
|
|
|
149
150
|
|
|
150
151
|
**allowDropdown**
|
|
151
152
|
Type: `Boolean` Default: `true`
|
|
152
|
-
Whether or not to allow the dropdown. If disabled, there is no dropdown arrow, and the selected country is not clickable. Also, if showFlags is enabled we display the selected flag on the right instead because it is just a marker of state. Play with this option on [Storybook](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--allowdropdown) (using the React component).
|
|
153
|
+
Whether or not to allow the dropdown. If disabled, there is no dropdown arrow, and the selected country is not clickable. Also, if showFlags is enabled we display the selected flag on the right instead because it is just a marker of state. Note that if `separateDialCode` is enabled, `allowDropdown` is forced to `true` as the dropdown is required when the user types "+" in this case. Play with this option on [Storybook](https://intl-tel-input.com/storybook/?path=/docs/intltelinput--allowdropdown) (using the React component).
|
|
153
154
|
|
|
154
155
|
**autoPlaceholder**
|
|
155
156
|
Type: `String` Default: `"polite"`
|
|
156
|
-
Set the input's placeholder to an example number for the selected country, and update it if the country changes. You can specify the number type using the `placeholderNumberType` option. By default it is set to `"polite"`, which means it will only set the placeholder if the input doesn't already have one. You can also set it to `"aggressive"`, which will replace any existing placeholder, or `"off"`. Requires the
|
|
157
|
+
Set the input's placeholder to an example number for the selected country, and update it if the country changes. You can specify the number type using the `placeholderNumberType` option. By default it is set to `"polite"`, which means it will only set the placeholder if the input doesn't already have one. You can also set it to `"aggressive"`, which will replace any existing placeholder, or `"off"`. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
157
158
|
|
|
158
159
|
**containerClass**
|
|
159
160
|
Type: `String` Default: `""`
|
|
@@ -189,11 +190,11 @@ Fix the dropdown width to the input width (rather than being as wide as the long
|
|
|
189
190
|
|
|
190
191
|
**formatAsYouType**
|
|
191
192
|
Type: `Boolean` Default: `true`
|
|
192
|
-
Automatically format the number as the user types. This feature will be disabled if the user types their own formatting characters. Requires the
|
|
193
|
+
Automatically format the number as the user types. This feature will be disabled if the user types their own formatting characters. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
193
194
|
|
|
194
195
|
**formatOnDisplay**
|
|
195
196
|
Type: `Boolean` Default: `true`
|
|
196
|
-
Format the input value (according to the `nationalMode` option) during initialisation, and on `setNumber`. Requires the
|
|
197
|
+
Format the input value (according to the `nationalMode` option) during initialisation, and on `setNumber`. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
197
198
|
|
|
198
199
|
**geoIpLookup**
|
|
199
200
|
Type: `Function` Default: `null`
|
|
@@ -217,7 +218,7 @@ _Note that the `failure` callback must be called in the event of an error, hence
|
|
|
217
218
|
Type: `Function` Default: `null`
|
|
218
219
|
Allows the creation of hidden input fields within a form to store the full international telephone number and the selected country code. It accepts a function that receives the name of the main telephone input as an argument. This function should return an object with `phone` and (optionally) `country` properties to specify the names of the hidden inputs for the phone number and country code, respectively. This is useful for non-Ajax form submissions to ensure the full international number and country code are captured, especially when `nationalMode` is enabled.
|
|
219
220
|
|
|
220
|
-
***Note**: This feature requires the input to be inside a `<form>` element, as it listens for the `submit` event on the closest form element. Also note that since this uses `getNumber` internally, firstly it requires the
|
|
221
|
+
***Note**: This feature requires the input to be inside a `<form>` element, as it listens for the `submit` event on the closest form element. Also note that since this uses `getNumber` internally, firstly it requires the [utils script to be loaded](#loading-the-utilities-script), and secondly it expects a valid number and so will only work correctly if you have used `isValidNumber` to validate the number before allowing the form submit to go through.
|
|
221
222
|
|
|
222
223
|
```js
|
|
223
224
|
intlTelInput(input, {
|
|
@@ -304,7 +305,7 @@ Display the selected country dial code next to the input, so it looks like it's
|
|
|
304
305
|
|
|
305
306
|
**strictMode**
|
|
306
307
|
Type: `Boolean` Default: `false`
|
|
307
|
-
As the user types in the input, ignore any irrelevant characters. Basically, the user can only enter numeric characters, and an optional plus at the beginning. Cap the length at the maximum valid number length (this respects `validationNumberType`). Requires the
|
|
308
|
+
As the user types in the input, ignore any irrelevant characters. Basically, the user can only enter numeric characters, and an optional plus at the beginning. Cap the length at the maximum valid number length (this respects `validationNumberType`). Requires the [utils script to be loaded](#loading-the-utilities-script). [See example](https://intl-tel-input.com/examples/strict-mode.html).
|
|
308
309
|
|
|
309
310
|
**useFullscreenPopup**
|
|
310
311
|
Type: `Boolean` Default: `true on mobile devices, false otherwise`
|
|
@@ -312,13 +313,13 @@ Control when the country list appears as a fullscreen popup vs an inline dropdow
|
|
|
312
313
|
|
|
313
314
|
**utilsScript**
|
|
314
315
|
Type: `String` Default: `""` Example: `"/build/js/utils.js"`
|
|
315
|
-
|
|
316
|
+
This is one way to (lazy) load the included utils.js (to enable formatting/validation etc) - see [Loading The Utilities Script](#loading-the-utilities-script) for more options. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.12/build/js/utils.js"`. The script is loaded via a [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) statement, which means the URL cannot be relative - it must be absolute. The script is only fetched when you initialise the plugin, and additionally, only when the page has finished loading (on the window load event) to prevent blocking (the script is ~260KB). When instantiating the plugin, a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned under the `promise` instance property, so you can do something like `iti.promise.then(callback)` to know when initialisation requests like this have finished. See [Utilities Script](#utilities-script) for more information.
|
|
316
317
|
|
|
317
318
|
**validationNumberType**
|
|
318
319
|
Type: `String` Default: `"MOBILE"`
|
|
319
320
|
Specify [one of the keys](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L162) from the enum `intlTelInput.utils.numberType` (e.g. `"FIXED_LINE"`) to set the number type to enforce during validation with `isValidNumber`, as well as the number length to enforce with `strictMode`. Set it to `null` to not enforce any particular type.
|
|
320
321
|
|
|
321
|
-
##
|
|
322
|
+
## Instance Methods
|
|
322
323
|
In these examples, `iti` refers to the plugin instance which gets returned when you initialise the plugin e.g.
|
|
323
324
|
```js
|
|
324
325
|
const iti = intlTelInput(input);
|
|
@@ -331,14 +332,14 @@ iti.destroy();
|
|
|
331
332
|
```
|
|
332
333
|
|
|
333
334
|
**getExtension**
|
|
334
|
-
Get the extension from the current number. Requires the
|
|
335
|
+
Get the extension from the current number. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
335
336
|
```js
|
|
336
337
|
const extension = iti.getExtension();
|
|
337
338
|
```
|
|
338
339
|
Returns a string e.g. if the input value was `"(702) 555-5555 ext. 1234"`, this would return `"1234"`
|
|
339
340
|
|
|
340
341
|
**getNumber**
|
|
341
|
-
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 `intlTelInput.utils.numberFormat` - which you can see [here](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L153). Requires the
|
|
342
|
+
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 `intlTelInput.utils.numberFormat` - which you can see [here](https://github.com/jackocnr/intl-tel-input/blob/master/src/js/utils.js#L153). Requires the [utils script to be loaded](#loading-the-utilities-script). _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._
|
|
342
343
|
```js
|
|
343
344
|
const number = iti.getNumber();
|
|
344
345
|
// or
|
|
@@ -347,7 +348,7 @@ const number = iti.getNumber(intlTelInput.utils.numberFormat.E164);
|
|
|
347
348
|
Returns a string e.g. `"+17024181234"`
|
|
348
349
|
|
|
349
350
|
**getNumberType**
|
|
350
|
-
Get the type (fixed-line/mobile/toll-free etc) of the current number. Requires the
|
|
351
|
+
Get the type (fixed-line/mobile/toll-free etc) of the current number. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
351
352
|
```js
|
|
352
353
|
const numberType = iti.getNumberType();
|
|
353
354
|
```
|
|
@@ -374,7 +375,7 @@ Returns something like this:
|
|
|
374
375
|
```
|
|
375
376
|
|
|
376
377
|
**getValidationError**
|
|
377
|
-
Get more information about a validation error. Requires the
|
|
378
|
+
Get more information about a validation error. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
378
379
|
```js
|
|
379
380
|
const error = iti.getValidationError();
|
|
380
381
|
```
|
|
@@ -386,21 +387,21 @@ if (error === intlTelInput.utils.validationError.TOO_SHORT) {
|
|
|
386
387
|
```
|
|
387
388
|
|
|
388
389
|
**isValidNumber**
|
|
389
|
-
Check if the current number is valid based on its length - [see example](https://intl-tel-input.com/examples/validation-practical.html), which should be sufficient for most use cases. See `isValidNumberPrecise` for more precise validation, but the advantage of `isValidNumber` 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 this method returns `false`, you can use `getValidationError` to get more information. Respects the `validationNumberType` option (which is set to "MOBILE" by default). Requires the
|
|
390
|
+
Check if the current number is valid based on its length - [see example](https://intl-tel-input.com/examples/validation-practical.html), which should be sufficient for most use cases. See `isValidNumberPrecise` for more precise validation, but the advantage of `isValidNumber` 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 this method returns `false`, you can use `getValidationError` to get more information. Respects the `validationNumberType` option (which is set to "MOBILE" by default). Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
390
391
|
```js
|
|
391
392
|
const isValid = iti.isValidNumber();
|
|
392
393
|
```
|
|
393
394
|
Returns: `true`/`false`
|
|
394
395
|
|
|
395
396
|
**isValidNumberPrecise**
|
|
396
|
-
Check if the current number is valid using precise matching rules for each country/area code etc - [see example](https://intl-tel-input.com/examples/validation.html). Note that these 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 `isValidNumber` above. If validation fails, you can use `getValidationError` to get more information. Requires the
|
|
397
|
+
Check if the current number is valid using precise matching rules for each country/area code etc - [see example](https://intl-tel-input.com/examples/validation.html). Note that these 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 `isValidNumber` above. If validation fails, you can use `getValidationError` to get more information. Requires the [utils script to be loaded](#loading-the-utilities-script).
|
|
397
398
|
```js
|
|
398
399
|
const isValid = iti.isValidNumberPrecise();
|
|
399
400
|
```
|
|
400
401
|
Returns: `true`/`false`
|
|
401
402
|
|
|
402
403
|
**setCountry**
|
|
403
|
-
Change the country
|
|
404
|
+
Change the selected country. It should be rare, if ever, that you need to do this, as the selected country gets updated automatically when calling `setNumber` and passing a number including an international dial code, which is the recommended usage. Note you can omit the country code argument to set the country to the default empty (globe) state.
|
|
404
405
|
```js
|
|
405
406
|
iti.setCountry("gb");
|
|
406
407
|
```
|
|
@@ -442,7 +443,7 @@ iti.isValidNumber(); // etc
|
|
|
442
443
|
```
|
|
443
444
|
|
|
444
445
|
**loadUtils**
|
|
445
|
-
An alternative to the `utilsScript` option, this method lets you manually load the utils.js script on demand, to enable formatting/validation etc. See [Utilities Script](#utilities-script) for more information. This method should only be called once per page. A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned so you can use `loadUtils().then(callback)` to know when it's finished.
|
|
446
|
+
An alternative to the `utilsScript` option, this method lets you manually load the utils.js script on demand, to enable formatting/validation etc. See [Loading The Utilities Script](#loading-the-utilities-script) for more information. This method should only be called once per page. A [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) object is returned so you can use `loadUtils().then(callback)` to know when it's finished.
|
|
446
447
|
```js
|
|
447
448
|
intlTelInput.loadUtils("/build/js/utils.js");
|
|
448
449
|
```
|
|
@@ -473,10 +474,19 @@ The utilities script ([build/js/utils.js](build/js/utils.js)) is a custom build
|
|
|
473
474
|
* Placeholder set to an example number for the selected country - even specify the type of number (e.g. mobile) using the `placeholderNumberType` option
|
|
474
475
|
* Extract the standardised (E.164) international number with `getNumber` even when using the `nationalMode` option
|
|
475
476
|
|
|
476
|
-
International number formatting/validation is hard (it varies by country/district, and we currently support ~230 countries). The only comprehensive solution we have found is libphonenumber, from which we have precompiled the relevant parts into a single JavaScript file and included in the build directory. Unfortunately, even after modification, it is still ~260KB
|
|
477
|
+
International number formatting/validation is hard (it varies by country/district, and we currently support ~230 countries). The only comprehensive solution we have found is libphonenumber, from which we have precompiled the relevant parts into a single JavaScript file and included in the build directory. Unfortunately, even after modification, it is still ~260KB. See the section below on the best way to load it.
|
|
477
478
|
|
|
478
479
|
To recompile the utils script yourself (e.g. to update the version of libphonenumber it is built from), see the [contributing guide](https://github.com/jackocnr/intl-tel-input/blob/master/.github/CONTRIBUTING.md#updating-to-a-new-version-of-libphonenumber).
|
|
479
480
|
|
|
481
|
+
## Loading The Utilities Script
|
|
482
|
+
The utils script provides lots of great functionality (see above section), but comes at the cost of increased filesize (~260KB). There are two main ways to load the utils script, depending on whether you're concerned about filesize or not.
|
|
483
|
+
|
|
484
|
+
**Option 1: intlTelInputWithUtils**
|
|
485
|
+
If you're not concerned about filesize, the easiest thing to do is to just use the full bundle /build/js/intlTelInputWithUtils.js, which comes with the utils script included. This script can be used exactly like the main intlTelInput.js - so it can either be loaded directly onto the page (which defines `window.intlTelInput` like usual), or it can be imported like so: `import intlTelInput from "intl-tel-input/intlTelInputWithUtils"`.
|
|
486
|
+
|
|
487
|
+
**Option 2: utilsScript**
|
|
488
|
+
If you *are* concerned about filesize, you can lazy load the utils script when the plugin intitialises, using the `utilsScript` initialisation option. You will need to host the [utils.js](https://github.com/jackocnr/intl-tel-input/blob/master/build/js/utils.js) file, and then set the `utilsScript` option to that URL, or alternatively just point it to a CDN hosted version e.g. `"https://cdn.jsdelivr.net/npm/intl-tel-input@23.0.12/build/js/utils.js"`. If you want more control over when this file is lazy loaded, you can instead use the `loadUtils` static method directly.
|
|
489
|
+
|
|
480
490
|
## Troubleshooting
|
|
481
491
|
|
|
482
492
|
**Full width input**
|
package/build/js/data.js
CHANGED
package/build/js/data.min.js
CHANGED
package/build/js/intlTelInput.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v23.0.
|
|
2
|
+
* International Telephone Input v23.0.12
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -1519,6 +1519,7 @@ var factoryOutput = (() => {
|
|
|
1519
1519
|
options;
|
|
1520
1520
|
hadInitialPlaceholder;
|
|
1521
1521
|
isRTL;
|
|
1522
|
+
isAndroid;
|
|
1522
1523
|
selectedCountryData;
|
|
1523
1524
|
countries;
|
|
1524
1525
|
dialCodeMaxLen;
|
|
@@ -1577,6 +1578,7 @@ var factoryOutput = (() => {
|
|
|
1577
1578
|
if (this.options.useFullscreenPopup && !this.options.dropdownContainer) {
|
|
1578
1579
|
this.options.dropdownContainer = document.body;
|
|
1579
1580
|
}
|
|
1581
|
+
this.isAndroid = typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
|
|
1580
1582
|
this.isRTL = !!this.telInput.closest("[dir=rtl]");
|
|
1581
1583
|
this.options.i18n = { ...en_default, ...this.options.i18n };
|
|
1582
1584
|
const autoCountryPromise = new Promise((resolve, reject) => {
|
|
@@ -1894,10 +1896,11 @@ var factoryOutput = (() => {
|
|
|
1894
1896
|
const val = useAttribute ? attributeValue : inputValue;
|
|
1895
1897
|
const dialCode = this._getDialCode(val);
|
|
1896
1898
|
const isRegionlessNanpNumber = isRegionlessNanp(val);
|
|
1897
|
-
const { initialCountry } = this.options;
|
|
1899
|
+
const { initialCountry, geoIpLookup } = this.options;
|
|
1900
|
+
const isAutoCountry = initialCountry === "auto" && geoIpLookup;
|
|
1898
1901
|
if (dialCode && !isRegionlessNanpNumber) {
|
|
1899
1902
|
this._updateCountryFromNumber(val);
|
|
1900
|
-
} else if (
|
|
1903
|
+
} else if (!isAutoCountry || overrideAutoCountry) {
|
|
1901
1904
|
const lowerInitialCountry = initialCountry ? initialCountry.toLowerCase() : "";
|
|
1902
1905
|
const isValidInitialCountry = lowerInitialCountry && this._getCountryData(lowerInitialCountry, true);
|
|
1903
1906
|
if (isValidInitialCountry) {
|
|
@@ -1976,18 +1979,20 @@ var factoryOutput = (() => {
|
|
|
1976
1979
|
}
|
|
1977
1980
|
//* Init many requests: utils script / geo ip lookup.
|
|
1978
1981
|
_initRequests() {
|
|
1979
|
-
|
|
1982
|
+
const { utilsScript, initialCountry, geoIpLookup } = this.options;
|
|
1983
|
+
if (utilsScript && !intlTelInput.utils) {
|
|
1980
1984
|
if (intlTelInput.documentReady()) {
|
|
1981
|
-
intlTelInput.loadUtils(
|
|
1985
|
+
intlTelInput.loadUtils(utilsScript);
|
|
1982
1986
|
} else {
|
|
1983
1987
|
window.addEventListener("load", () => {
|
|
1984
|
-
intlTelInput.loadUtils(
|
|
1988
|
+
intlTelInput.loadUtils(utilsScript);
|
|
1985
1989
|
});
|
|
1986
1990
|
}
|
|
1987
1991
|
} else {
|
|
1988
1992
|
this.resolveUtilsScriptPromise();
|
|
1989
1993
|
}
|
|
1990
|
-
|
|
1994
|
+
const isAutoCountry = initialCountry === "auto" && geoIpLookup;
|
|
1995
|
+
if (isAutoCountry && !this.selectedCountryData.iso2) {
|
|
1991
1996
|
this._loadAutoCountry();
|
|
1992
1997
|
} else {
|
|
1993
1998
|
this.resolveAutoCountryPromise();
|
|
@@ -2024,7 +2029,20 @@ var factoryOutput = (() => {
|
|
|
2024
2029
|
_initTelInputListeners() {
|
|
2025
2030
|
const { strictMode, formatAsYouType, separateDialCode, formatOnDisplay } = this.options;
|
|
2026
2031
|
let userOverrideFormatting = false;
|
|
2032
|
+
const openDropdownWithPlus = () => {
|
|
2033
|
+
this._openDropdown();
|
|
2034
|
+
this.searchInput.value = "+";
|
|
2035
|
+
this._filterCountries("", true);
|
|
2036
|
+
};
|
|
2027
2037
|
this._handleInputEvent = (e) => {
|
|
2038
|
+
if (this.isAndroid && e?.data === "+" && separateDialCode) {
|
|
2039
|
+
const currentCaretPos = this.telInput.selectionStart || 0;
|
|
2040
|
+
const valueBeforeCaret = this.telInput.value.substring(0, currentCaretPos - 1);
|
|
2041
|
+
const valueAfterCaret = this.telInput.value.substring(currentCaretPos);
|
|
2042
|
+
this.telInput.value = valueBeforeCaret + valueAfterCaret;
|
|
2043
|
+
openDropdownWithPlus();
|
|
2044
|
+
return;
|
|
2045
|
+
}
|
|
2028
2046
|
if (this._updateCountryFromNumber(this.telInput.value)) {
|
|
2029
2047
|
this._triggerCountryChange();
|
|
2030
2048
|
}
|
|
@@ -2053,9 +2071,7 @@ var factoryOutput = (() => {
|
|
|
2053
2071
|
if (e.key && e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
|
|
2054
2072
|
if (separateDialCode && e.key === "+") {
|
|
2055
2073
|
e.preventDefault();
|
|
2056
|
-
|
|
2057
|
-
this.searchInput.value = "+";
|
|
2058
|
-
this._filterCountries("", true);
|
|
2074
|
+
openDropdownWithPlus();
|
|
2059
2075
|
return;
|
|
2060
2076
|
}
|
|
2061
2077
|
if (strictMode) {
|
|
@@ -2607,7 +2623,8 @@ var factoryOutput = (() => {
|
|
|
2607
2623
|
handleAutoCountry() {
|
|
2608
2624
|
if (this.options.initialCountry === "auto" && intlTelInput.autoCountry) {
|
|
2609
2625
|
this.defaultCountry = intlTelInput.autoCountry;
|
|
2610
|
-
|
|
2626
|
+
const hasSelectedCountryOrGlobe = this.selectedCountryData.iso2 || this.selectedCountryInner.classList.contains("iti__globe");
|
|
2627
|
+
if (!hasSelectedCountryOrGlobe) {
|
|
2611
2628
|
this.setCountry(this.defaultCountry);
|
|
2612
2629
|
}
|
|
2613
2630
|
this.resolveAutoCountryPromise();
|
|
@@ -2722,8 +2739,10 @@ var factoryOutput = (() => {
|
|
|
2722
2739
|
}
|
|
2723
2740
|
//* Update the selected country, and update the input val accordingly.
|
|
2724
2741
|
setCountry(iso2) {
|
|
2725
|
-
const iso2Lower = iso2
|
|
2726
|
-
|
|
2742
|
+
const iso2Lower = iso2?.toLowerCase();
|
|
2743
|
+
const currentCountry = this.selectedCountryData.iso2;
|
|
2744
|
+
const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
|
|
2745
|
+
if (isCountryChange) {
|
|
2727
2746
|
this._setCountry(iso2Lower);
|
|
2728
2747
|
this._updateDialCode(this.selectedCountryData.dialCode);
|
|
2729
2748
|
this._triggerCountryChange();
|
|
@@ -2785,7 +2804,7 @@ var factoryOutput = (() => {
|
|
|
2785
2804
|
//* A map from instance ID to instance object.
|
|
2786
2805
|
instances: {},
|
|
2787
2806
|
loadUtils,
|
|
2788
|
-
version: "23.0.
|
|
2807
|
+
version: "23.0.12"
|
|
2789
2808
|
}
|
|
2790
2809
|
);
|
|
2791
2810
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v23.0.
|
|
2
|
+
* International Telephone Input v23.0.12
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
}
|
|
14
14
|
}(() => {
|
|
15
15
|
|
|
16
|
-
var factoryOutput=(()=>{var _=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var x=Object.prototype.hasOwnProperty;var P=(a,t)=>{for(var e in t)_(a,e,{get:t[e],enumerable:!0})},H=(a,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of M(t))!x.call(a,n)&&n!==e&&_(a,n,{get:()=>t[n],enumerable:!(i=S(t,n))||i.enumerable});return a};var O=a=>H(_({},"__esModule",{value:!0}),a);var K={};P(K,{Iti:()=>v,default:()=>B});var L=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],T=[];for(let a=0;a<L.length;a++){let t=L[a];T[a]={name:"",iso2:t[0],dialCode:t[1],priority:t[2]||0,areaCodes:t[3]||null,nodeById:{}}}var y=T;var E={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var D={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"};var I={...E,...D};for(let a=0;a<y.length;a++)y[a].name=I[y[a].iso2];var R=0,A={allowDropdown:!0,autoPlaceholder:"polite",containerClass:"",countryOrder:null,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:"",validationNumberType:"MOBILE"},z=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],b=a=>a.replace(/\D/g,""),N=(a="")=>a.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),k=a=>{let t=b(a);if(t.charAt(0)==="1"){let e=t.substr(1,3);return z.indexOf(e)!==-1}return!1},j=(a,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s<t.length;s++){if(/[+0-9]/.test(t[s])&&n++,n===a&&!i)return s+1;if(i&&n===a+1)return s}return t.length},c=(a,t,e)=>{let i=document.createElement(a);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},f=a=>{let{instances:t}=o;Object.values(t).forEach(e=>e[a]())},v=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_a14;_a9;_a10;_a11;_a12;_handleKeydownEvent;_a4;_a0;_a1;_a2;_a3;_a7;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(t,e={}){this.id=R++,this.a=t,this.c=null,this.d=Object.assign({},A,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.separateDialCode&&(this.d.allowDropdown=!0,this.d.nationalMode=!1),!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.i18n={...I,...this.d.i18n};let t=new Promise((i,n)=>{this.h=i,this.i=n}),e=new Promise((i,n)=>{this.i0=i,this.i1=n});this.promise=Promise.all([t,e]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this._sortCountries()}_sortCountries(){this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),r=n>-1,l=s>-1;if(r||l)return r&&l?n-s:r?-1:1}return t.name<e.name?-1:t.name>e.name?1:0})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;s<this.q[e].length;s++)if(this.q[e][s]===t)return;let n=i!==void 0?i:this.q[e].length;this.q[e][n]=t}_d(){let{onlyCountries:t,excludeCountries:e}=this.d;if(t.length){let i=t.map(n=>n.toLowerCase());this.p=y.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=y.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=y}_d0(){for(let t=0;t<this.p.length;t++){let e=this.p[t].iso2.toLowerCase();this.d.i18n.hasOwnProperty(e)&&(this.p[t].name=this.d.i18n[e])}}_d2(){this.dialCodes={},this.dialCodeMaxLen=0,this.q={};for(let t=0;t<this.p.length;t++){let e=this.p[t];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._c(e.iso2,e.dialCode,e.priority)}for(let t=0;t<this.p.length;t++){let e=this.p[t];if(e.areaCodes){let i=this.q[e.dialCode][0];for(let n=0;n<e.areaCodes.length;n++){let s=e.areaCodes[n];for(let r=1;r<s.length;r++){let l=e.dialCode+s.substr(0,r);this._c(i,l),this._c(e.iso2,l)}this._c(e.iso2,e.dialCode+s)}}}}_f(){this.a.classList.add("iti__tel-input"),!this.a.hasAttribute("autocomplete")&&!(this.a.form&&this.a.form.hasAttribute("autocomplete"))&&this.a.setAttribute("autocomplete","off");let{allowDropdown:t,separateDialCode:e,showFlags:i,containerClass:n,hiddenInput:s,dropdownContainer:r,fixDropdownWidth:l,useFullscreenPopup:u,i18n:d}=this.d,h="iti";t&&(h+=" iti--allow-dropdown"),i&&(h+=" iti--show-flags"),n&&(h+=` ${n}`),u||(h+=" iti--inline-dropdown");let g=c("div",{class:h});if(this.a.parentNode?.insertBefore(g,this.a),t||i){this.k=c("div",{class:"iti__country-container"},g),this.selectedCountry=c("button",{type:"button",class:"iti__selected-country",...t&&{"aria-expanded":"false","aria-label":this.d.i18n.selectedCountryAriaLabel,"aria-haspopup":"true","aria-controls":`iti-${this.id}__dropdown-content`,role:"combobox"}},this.k);let p=c("div",{class:"iti__selected-country-primary"},this.selectedCountry);if(this.l=c("div",null,p),this.selectedCountryA11yText=c("span",{class:"iti__a11y-text"},this.l),this.a.disabled?this.selectedCountry.setAttribute("aria-disabled","true"):this.selectedCountry.setAttribute("tabindex","0"),t&&(this.u=c("div",{class:"iti__arrow","aria-hidden":"true"},p)),e&&(this.t=c("div",{class:"iti__selected-dial-code"},this.selectedCountry)),t){let m=l?"":"iti--flexible-dropdown-width";if(this.dropdownContent=c("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${m}`}),this.searchInput=c("input",{type:"text",class:"iti__search-input",placeholder:d.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":d.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=c("span",{class:"iti__a11y-text"},this.dropdownContent),this.countryList=c("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":d.countryListAriaLabel},this.dropdownContent),this._g(this.p,"iti__standard"),this._p4(),r){let C="iti iti--container";u?C+=" iti--fullscreen-popup":C+=" iti--inline-dropdown",this.dropdown=c("div",{class:C}),this.dropdown.appendChild(this.dropdownContent)}else this.k.appendChild(this.dropdownContent)}}if(g.appendChild(this.a),s){let p=this.a.getAttribute("name")||"",m=s(p);m.phone&&(this.hiddenInput=c("input",{type:"hidden",name:m.phone}),g.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=c("input",{type:"hidden",name:m.country}),g.appendChild(this.hiddenInputCountry))}}_g(t,e){for(let i=0;i<t.length;i++){let n=t[i],s=c("li",{id:`iti-${this.id}__item-${n.iso2}`,class:`iti__country ${e}`,tabindex:"-1",role:"option","data-dial-code":n.dialCode,"data-country-code":n.iso2,"aria-selected":"false"},this.countryList);n.nodeById[this.id]=s;let r="";this.d.showFlags&&(r+=`<div class='iti__flag-box'><div class='iti__flag iti__${n.iso2}'></div></div>`),r+=`<span class='iti__country-name'>${n.name}</span>`,r+=`<span class='iti__dial-code'>+${n.dialCode}</span>`,s.insertAdjacentHTML("beforeend",r)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,r=this._5(s),l=k(s),{initialCountry:u}=this.d;if(r&&!l)this._v(s);else if(u!=="auto"||t){let d=u?u.toLowerCase():"";d&&this._y(d,!0)?this._z(d):r&&l?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){this.d.utilsScript&&!o.utils?o.documentReady()?o.loadUtils(this.d.utilsScript):window.addEventListener("load",()=>{o.loadUtils(this.d.utilsScript)}):this.i0(),this.d.initialCountry==="auto"&&!this.s.iso2?this._i4():this.h()}_i4(){o.autoCountry?this.handleAutoCountry():o.startedLoadingAutoCountry||(o.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(o.autoCountry=e,setTimeout(()=>f("handleAutoCountry"))):(this._h(!0),f("rejectAutoCountryPromise"))},()=>{this._h(!0),f("rejectAutoCountryPromise")}))}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n}=this.d,s=!1;this._a12=r=>{this._v(this.a.value)&&this._8();let l=r?.data&&/[^+0-9]/.test(r.data),u=r?.inputType==="insertFromPaste"&&this.a.value;l||u&&!t?s=!0:/[^+0-9]/.test(this.a.value)||(s=!1);let d=r?.detail&&r.detail.isSetNumber&&!n;if(e&&!s&&!d){let h=this.a.selectionStart||0,p=this.a.value.substring(0,h).replace(/[^+0-9]/g,"").length,m=r?.inputType==="deleteContentForward",C=this._9(),w=j(p,C,h,m);this.a.value=C,this.a.setSelectionRange(w,w)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=r=>{if(r.key&&r.key.length===1&&!r.altKey&&!r.ctrlKey&&!r.metaKey){if(i&&r.key==="+"){r.preventDefault(),this._n(),this.searchInput.value="+",this._p3("",!0);return}if(t){let l=this.a.selectionStart===0&&r.key==="+",u=/^[0-9]$/.test(r.key),d=l||u,h=this._6(),g=o.utils.getCoreNumber(h,this.s.iso2),p=this.maxCoreNumberLength&&g.length>=this.maxCoreNumberLength,m=this.a.value.substring(this.a.selectionStart,this.a.selectionEnd),C=/\d/.test(m);(!d||p&&!C)&&r.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t}=this.d;t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o();let e=this.countryList.firstElementChild;e&&(this._x(e,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2),this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2())},document.addEventListener("keydown",this._a3);let e=()=>{let n=this.searchInput.value.trim();n?this._p3(n):this._p3("",!0)},i=null;this._a7=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_p3(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=N(t);for(let s=0;s<this.p.length;s++){let r=this.p[s],l=N(r.name),u=`+${r.dialCode}`;if(e||l.includes(n)||u.includes(n)||r.iso2.includes(n)){let d=r.nodeById[this.id];d&&this.countryList.appendChild(d),i&&(this._x(d,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&o.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=o.utils.numberFormat,r=i?n:s;e=o.utils.formatNumber(e,this.s.iso2,r)}e=this._7(e),this.a.value=e}_v(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let r=this._5(i,!0),l=b(i),u=null;if(r){let d=this.q[b(r)],h=d.indexOf(this.s.iso2)!==-1&&l.length<=r.length-1;if(!(n==="1"&&k(l))&&!h){for(let p=0;p<d.length;p++)if(d[p]){u=d[p];break}}}else i.charAt(0)==="+"&&l.length?u="":(!i||i==="+")&&!this.s.iso2&&(u=this.j);return u!==null?this._z(u):!1}_x(t,e){let i=this.c;if(i&&(i.classList.remove("iti__highlight"),i.setAttribute("aria-selected","false")),this.c=t,this.c){this.c.classList.add("iti__highlight"),this.c.setAttribute("aria-selected","true");let n=this.c.getAttribute("id")||"";this.selectedCountry.setAttribute("aria-activedescendant",n),this.searchInput.setAttribute("aria-activedescendant",n)}e&&this.c.focus()}_y(t,e){for(let i=0;i<this.p.length;i++)if(this.p[i].iso2===t)return this.p[i];if(e)return null;throw new Error(`No country data for '${t}'`)}_z(t){let{separateDialCode:e,showFlags:i,i18n:n}=this.d,s=this.s.iso2?this.s:{};if(this.s=t?this._y(t,!1)||{}:{},this.s.iso2&&(this.j=this.s.iso2),this.l){let r="",l="";t&&i?(r=`iti__flag iti__${t}`,l=`${this.s.name} +${this.s.dialCode}`):(r="iti__flag iti__globe",l=n.noCountrySelected),this.l.className=r,this.selectedCountryA11yText.textContent=l}if(this._z3(t,e),e){let r=this.s.dialCode?`+${this.s.dialCode}`:"";this.t.innerHTML=r;let u=(this.selectedCountry.offsetWidth||this._z2())+8;this.isRTL?this.a.style.paddingRight=`${u}px`:this.a.style.paddingLeft=`${u}px`}return this._0(),this._updateMaxLength(),s.iso2!==t}_updateMaxLength(){let{strictMode:t,placeholderNumberType:e,validationNumberType:i}=this.d;if(t&&o.utils)if(this.s.iso2){let n=o.utils.numberType[e],s=o.utils.getExampleNumber(this.s.iso2,!1,n,!0),r=s;for(;o.utils.isPossibleNumber(s,this.s.iso2,i);)r=s,s+="0";let l=o.utils.getCoreNumber(r,this.s.iso2);this.maxCoreNumberLength=l.length}else this.maxCoreNumberLength=null}_z3(t=null,e){if(!this.selectedCountry)return;let i;t&&!e?i=`${this.s.name}: +${this.s.dialCode}`:t?i=this.s.name:i="Unknown",this.selectedCountry.setAttribute("title",i)}_z2(){if(this.a.parentNode){let t=this.a.parentNode.cloneNode(!1);t.style.visibility="hidden",document.body.appendChild(t);let e=this.k.cloneNode();t.appendChild(e);let i=this.selectedCountry.cloneNode(!0);e.appendChild(i);let n=i.offsetWidth;return document.body.removeChild(t),n}return 0}_0(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.d,s=t==="aggressive"||!this.e&&t==="polite";if(o.utils&&s){let r=o.utils.numberType[e],l=this.s.iso2?o.utils.getExampleNumber(this.s.iso2,i,r):"";l=this._7(l),typeof n=="function"&&(l=n(l,this.s)),this.a.setAttribute("placeholder",l)}}_1(t){let e=this._z(t.getAttribute("data-country-code"));this._2(),this._4(t.getAttribute("data-dial-code")),this.a.focus(),e&&this._8()}_2(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.c&&this.c.setAttribute("aria-selected","false"),this.searchInput.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),this.searchInput.removeEventListener("input",this._a7),document.documentElement.removeEventListener("click",this._a2),this.countryList.removeEventListener("mouseover",this._a0),this.countryList.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.d.useFullscreenPopup||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_3(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,s=e.getBoundingClientRect().top+i,r=s+n,l=t.offsetHeight,u=t.getBoundingClientRect().top+i,d=u+l,h=u-s+e.scrollTop;if(u<s)e.scrollTop=h;else if(d>r){let g=n-l;e.scrollTop=h-g}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s<t.length;s++){let r=t.charAt(s);if(!isNaN(parseInt(r,10))){if(n+=r,e)this.q[n]&&(i=t.substr(0,s+1));else if(this.dialCodes[n]){i=t.substr(0,s+1);break}if(n.length===this.dialCodeMaxLen)break}}}return i}_6(){let t=this.a.value.trim(),{dialCode:e}=this.s,i,n=b(t);return this.d.separateDialCode&&t.charAt(0)!=="+"&&e&&n?i=`+${e}`:i="",i+t}_7(t){let e=t;if(this.d.separateDialCode){let i=this._5(e);if(i){i=`+${this.s.dialCode}`;let n=e[i.length]===" "||e[i.length]==="-"?i.length+1:i.length;e=e.substr(n)}}return this._j2(e)}_8(){this._trigger("countrychange")}_9(){let t=this._6(),e=o.utils?o.utils.formatNumberAsYouType(t,this.s.iso2):t,{dialCode:i}=this.s;return this.d.separateDialCode&&this.a.value.charAt(0)!=="+"&&e.includes(`+${i}`)?(e.split(`+${i}`)[1]||"").trim():e}handleAutoCountry(){this.d.initialCountry==="auto"&&o.autoCountry&&(this.j=o.autoCountry,this.a.value||this.setCountry(this.j),this.h())}handleUtils(){o.utils&&(this.a.value&&this._u(this.a.value),this.s.iso2&&(this._0(),this._updateMaxLength())),this.i0()}destroy(){if(this.d.allowDropdown){this._2(),this.selectedCountry.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);let i=this.a.closest("label");i&&i.removeEventListener("click",this._a9)}let{form:t}=this.a;this._a14&&t&&t.removeEventListener("submit",this._a14),this.a.removeEventListener("input",this._a12),this._handleKeydownEvent&&this.a.removeEventListener("keydown",this._handleKeydownEvent),this.a.removeAttribute("data-intl-tel-input-id");let e=this.a.parentNode;e?.parentNode?.insertBefore(this.a,e),e?.parentNode?.removeChild(e),delete o.instances[this.id]}getExtension(){return o.utils?o.utils.getExtension(this._6(),this.s.iso2):""}getNumber(t){if(o.utils){let{iso2:e}=this.s;return o.utils.formatNumber(this._6(),e,t)}return""}getNumberType(){return o.utils?o.utils.getNumberType(this._6(),this.s.iso2):-99}getSelectedCountryData(){return this.s}getValidationError(){if(o.utils){let{iso2:t}=this.s;return o.utils.getValidationError(this._6(),t)}return-99}isValidNumber(){let t=this._6();return/\p{L}/u.test(t)?!1:o.utils?o.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberType):null}isValidNumberPrecise(){let t=this._6();return/\p{L}/u.test(t)?!1:o.utils?o.utils.isValidNumber(t,this.s.iso2):null}setCountry(t){let e=t.toLowerCase();this.s.iso2!==e&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}},F=a=>!o.utils&&!o.startedLoadingUtilsScript?(o.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(/* webpackIgnore: true */ a).then(({default:i})=>{o.utils=i,f("handleUtils"),t(!0)}).catch(()=>{f("rejectUtilsScriptPromise"),e()})})):null,o=Object.assign((a,t)=>{let e=new v(a,t);return e._init(),a.setAttribute("data-intl-tel-input-id",e.id.toString()),o.instances[e.id]=e,e},{defaults:A,documentReady:()=>document.readyState==="complete",getCountryData:()=>y,getInstance:a=>{let t=a.getAttribute("data-intl-tel-input-id");return t?o.instances[t]:null},instances:{},loadUtils:F,version:"23.0.10"}),B=o;return O(K);})();
|
|
16
|
+
var factoryOutput=(()=>{var I=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var P=Object.prototype.hasOwnProperty;var H=(l,t)=>{for(var e in t)I(l,e,{get:t[e],enumerable:!0})},O=(l,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of x(t))!P.call(l,n)&&n!==e&&I(l,n,{get:()=>t[n],enumerable:!(i=M(t,n))||i.enumerable});return l};var R=l=>O(I({},"__esModule",{value:!0}),l);var U={};H(U,{Iti:()=>_,default:()=>K});var T=[["af","93"],["al","355"],["dz","213"],["as","1",5,["684"]],["ad","376"],["ao","244"],["ai","1",6,["264"]],["ag","1",7,["268"]],["ar","54"],["am","374"],["aw","297"],["ac","247"],["au","61",0],["at","43"],["az","994"],["bs","1",8,["242"]],["bh","973"],["bd","880"],["bb","1",9,["246"]],["by","375"],["be","32"],["bz","501"],["bj","229"],["bm","1",10,["441"]],["bt","975"],["bo","591"],["ba","387"],["bw","267"],["br","55"],["io","246"],["vg","1",11,["284"]],["bn","673"],["bg","359"],["bf","226"],["bi","257"],["kh","855"],["cm","237"],["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","879","902","905"]],["cv","238"],["bq","599",1,["3","4","7"]],["ky","1",12,["345"]],["cf","236"],["td","235"],["cl","56"],["cn","86"],["cx","61",2,["89164"]],["cc","61",1,["89162"]],["co","57"],["km","269"],["cg","242"],["cd","243"],["ck","682"],["cr","506"],["ci","225"],["hr","385"],["cu","53"],["cw","599",0],["cy","357"],["cz","420"],["dk","45"],["dj","253"],["dm","1",13,["767"]],["do","1",2,["809","829","849"]],["ec","593"],["eg","20"],["sv","503"],["gq","240"],["er","291"],["ee","372"],["sz","268"],["et","251"],["fk","500"],["fo","298"],["fj","679"],["fi","358",0],["fr","33"],["gf","594"],["pf","689"],["ga","241"],["gm","220"],["ge","995"],["de","49"],["gh","233"],["gi","350"],["gr","30"],["gl","299"],["gd","1",14,["473"]],["gp","590",0],["gu","1",15,["671"]],["gt","502"],["gg","44",1,["1481","7781","7839","7911"]],["gn","224"],["gw","245"],["gy","592"],["ht","509"],["hn","504"],["hk","852"],["hu","36"],["is","354"],["in","91"],["id","62"],["ir","98"],["iq","964"],["ie","353"],["im","44",2,["1624","74576","7524","7924","7624"]],["il","972"],["it","39",0],["jm","1",4,["876","658"]],["jp","81"],["je","44",3,["1534","7509","7700","7797","7829","7937"]],["jo","962"],["kz","7",1,["33","7"]],["ke","254"],["ki","686"],["xk","383"],["kw","965"],["kg","996"],["la","856"],["lv","371"],["lb","961"],["ls","266"],["lr","231"],["ly","218"],["li","423"],["lt","370"],["lu","352"],["mo","853"],["mg","261"],["mw","265"],["my","60"],["mv","960"],["ml","223"],["mt","356"],["mh","692"],["mq","596"],["mr","222"],["mu","230"],["yt","262",1,["269","639"]],["mx","52"],["fm","691"],["md","373"],["mc","377"],["mn","976"],["me","382"],["ms","1",16,["664"]],["ma","212",0],["mz","258"],["mm","95"],["na","264"],["nr","674"],["np","977"],["nl","31"],["nc","687"],["nz","64"],["ni","505"],["ne","227"],["ng","234"],["nu","683"],["nf","672"],["kp","850"],["mk","389"],["mp","1",17,["670"]],["no","47",0],["om","968"],["pk","92"],["pw","680"],["ps","970"],["pa","507"],["pg","675"],["py","595"],["pe","51"],["ph","63"],["pl","48"],["pt","351"],["pr","1",3,["787","939"]],["qa","974"],["re","262",0],["ro","40"],["ru","7",0],["rw","250"],["ws","685"],["sm","378"],["st","239"],["sa","966"],["sn","221"],["rs","381"],["sc","248"],["sl","232"],["sg","65"],["sx","1",21,["721"]],["sk","421"],["si","386"],["sb","677"],["so","252"],["za","27"],["kr","82"],["ss","211"],["es","34"],["lk","94"],["bl","590",1],["sh","290"],["kn","1",18,["869"]],["lc","1",19,["758"]],["mf","590",2],["pm","508"],["vc","1",20,["784"]],["sd","249"],["sr","597"],["sj","47",1,["79"]],["se","46"],["ch","41"],["sy","963"],["tw","886"],["tj","992"],["tz","255"],["th","66"],["tl","670"],["tg","228"],["tk","690"],["to","676"],["tt","1",22,["868"]],["tn","216"],["tr","90"],["tm","993"],["tc","1",23,["649"]],["tv","688"],["ug","256"],["ua","380"],["ae","971"],["gb","44",0],["us","1",0],["uy","598"],["vi","1",24,["340"]],["uz","998"],["vu","678"],["va","39",1,["06698"]],["ve","58"],["vn","84"],["wf","681"],["eh","212",1,["5288","5289"]],["ye","967"],["zm","260"],["zw","263"],["ax","358",1,["18"]]],E=[];for(let l=0;l<T.length;l++){let t=T[l];E[l]={name:"",iso2:t[0],dialCode:t[1],priority:t[2]||0,areaCodes:t[3]||null,nodeById:{}}}var C=E;var D={af:"Afghanistan",ax:"\xC5land Islands",al:"Albania",dz:"Algeria",as:"American Samoa",ad:"Andorra",ao:"Angola",ai:"Anguilla",aq:"Antarctica",ag:"Antigua & Barbuda",ar:"Argentina",am:"Armenia",aw:"Aruba",au:"Australia",at:"Austria",az:"Azerbaijan",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesh",bb:"Barbados",by:"Belarus",be:"Belgium",bz:"Belize",bj:"Benin",bm:"Bermuda",bt:"Bhutan",bo:"Bolivia",ba:"Bosnia & Herzegovina",bw:"Botswana",bv:"Bouvet Island",br:"Brazil",io:"British Indian Ocean Territory",vg:"British Virgin Islands",bn:"Brunei",bg:"Bulgaria",bf:"Burkina Faso",bi:"Burundi",kh:"Cambodia",cm:"Cameroon",ca:"Canada",cv:"Cape Verde",bq:"Caribbean Netherlands",ky:"Cayman Islands",cf:"Central African Republic",td:"Chad",cl:"Chile",cn:"China",cx:"Christmas Island",cc:"Cocos (Keeling) Islands",co:"Colombia",km:"Comoros",cg:"Congo - Brazzaville",cd:"Congo - Kinshasa",ck:"Cook Islands",cr:"Costa Rica",ci:"C\xF4te d\u2019Ivoire",hr:"Croatia",cu:"Cuba",cw:"Cura\xE7ao",cy:"Cyprus",cz:"Czechia",dk:"Denmark",dj:"Djibouti",dm:"Dominica",do:"Dominican Republic",ec:"Ecuador",eg:"Egypt",sv:"El Salvador",gq:"Equatorial Guinea",er:"Eritrea",ee:"Estonia",sz:"Eswatini",et:"Ethiopia",fk:"Falkland Islands",fo:"Faroe Islands",fj:"Fiji",fi:"Finland",fr:"France",gf:"French Guiana",pf:"French Polynesia",tf:"French Southern Territories",ga:"Gabon",gm:"Gambia",ge:"Georgia",de:"Germany",gh:"Ghana",gi:"Gibraltar",gr:"Greece",gl:"Greenland",gd:"Grenada",gp:"Guadeloupe",gu:"Guam",gt:"Guatemala",gg:"Guernsey",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hm:"Heard & McDonald Islands",hn:"Honduras",hk:"Hong Kong SAR China",hu:"Hungary",is:"Iceland",in:"India",id:"Indonesia",ir:"Iran",iq:"Iraq",ie:"Ireland",im:"Isle of Man",il:"Israel",it:"Italy",jm:"Jamaica",jp:"Japan",je:"Jersey",jo:"Jordan",kz:"Kazakhstan",ke:"Kenya",ki:"Kiribati",kw:"Kuwait",kg:"Kyrgyzstan",la:"Laos",lv:"Latvia",lb:"Lebanon",ls:"Lesotho",lr:"Liberia",ly:"Libya",li:"Liechtenstein",lt:"Lithuania",lu:"Luxembourg",mo:"Macao SAR China",mg:"Madagascar",mw:"Malawi",my:"Malaysia",mv:"Maldives",ml:"Mali",mt:"Malta",mh:"Marshall Islands",mq:"Martinique",mr:"Mauritania",mu:"Mauritius",yt:"Mayotte",mx:"Mexico",fm:"Micronesia",md:"Moldova",mc:"Monaco",mn:"Mongolia",me:"Montenegro",ms:"Montserrat",ma:"Morocco",mz:"Mozambique",mm:"Myanmar (Burma)",na:"Namibia",nr:"Nauru",np:"Nepal",nl:"Netherlands",nc:"New Caledonia",nz:"New Zealand",ni:"Nicaragua",ne:"Niger",ng:"Nigeria",nu:"Niue",nf:"Norfolk Island",kp:"North Korea",mk:"North Macedonia",mp:"Northern Mariana Islands",no:"Norway",om:"Oman",pk:"Pakistan",pw:"Palau",ps:"Palestinian Territories",pa:"Panama",pg:"Papua New Guinea",py:"Paraguay",pe:"Peru",ph:"Philippines",pn:"Pitcairn Islands",pl:"Poland",pt:"Portugal",pr:"Puerto Rico",qa:"Qatar",re:"R\xE9union",ro:"Romania",ru:"Russia",rw:"Rwanda",ws:"Samoa",sm:"San Marino",st:"S\xE3o Tom\xE9 & Pr\xEDncipe",sa:"Saudi Arabia",sn:"Senegal",rs:"Serbia",sc:"Seychelles",sl:"Sierra Leone",sg:"Singapore",sx:"Sint Maarten",sk:"Slovakia",si:"Slovenia",sb:"Solomon Islands",so:"Somalia",za:"South Africa",gs:"South Georgia & South Sandwich Islands",kr:"South Korea",ss:"South Sudan",es:"Spain",lk:"Sri Lanka",bl:"St. Barth\xE9lemy",sh:"St. Helena",kn:"St. Kitts & Nevis",lc:"St. Lucia",mf:"St. Martin",pm:"St. Pierre & Miquelon",vc:"St. Vincent & Grenadines",sd:"Sudan",sr:"Suriname",sj:"Svalbard & Jan Mayen",se:"Sweden",ch:"Switzerland",sy:"Syria",tw:"Taiwan",tj:"Tajikistan",tz:"Tanzania",th:"Thailand",tl:"Timor-Leste",tg:"Togo",tk:"Tokelau",to:"Tonga",tt:"Trinidad & Tobago",tn:"Tunisia",tr:"Turkey",tm:"Turkmenistan",tc:"Turks & Caicos Islands",tv:"Tuvalu",um:"U.S. Outlying Islands",vi:"U.S. Virgin Islands",ug:"Uganda",ua:"Ukraine",ae:"United Arab Emirates",gb:"United Kingdom",us:"United States",uy:"Uruguay",uz:"Uzbekistan",vu:"Vanuatu",va:"Vatican City",ve:"Venezuela",vn:"Vietnam",wf:"Wallis & Futuna",eh:"Western Sahara",ye:"Yemen",zm:"Zambia",zw:"Zimbabwe"};var A={selectedCountryAriaLabel:"Selected country",noCountrySelected:"No country selected",countryListAriaLabel:"List of countries",searchPlaceholder:"Search",zeroSearchResults:"No results found",oneSearchResult:"1 result found",multipleSearchResults:"${count} results found",ac:"Ascension Island",xk:"Kosovo"};var w={...D,...A};for(let l=0;l<C.length;l++)C[l].name=w[C[l].iso2];var z=0,S={allowDropdown:!0,autoPlaceholder:"polite",containerClass:"",countryOrder:null,customPlaceholder:null,dropdownContainer:null,excludeCountries:[],fixDropdownWidth:!0,formatAsYouType:!0,formatOnDisplay:!0,geoIpLookup:null,hiddenInput:null,i18n:{},initialCountry:"",nationalMode:!0,onlyCountries:[],placeholderNumberType:"MOBILE",showFlags:!0,separateDialCode:!1,strictMode:!1,useFullscreenPopup:typeof navigator<"u"&&typeof window<"u"?/Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||window.innerWidth<=500:!1,utilsScript:"",validationNumberType:"MOBILE"},j=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],v=l=>l.replace(/\D/g,""),N=(l="")=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase(),k=l=>{let t=v(l);if(t.charAt(0)==="1"){let e=t.substr(1,3);return j.indexOf(e)!==-1}return!1},F=(l,t,e,i)=>{if(e===0&&!i)return 0;let n=0;for(let s=0;s<t.length;s++){if(/[+0-9]/.test(t[s])&&n++,n===l&&!i)return s+1;if(i&&n===l+1)return s}return t.length},p=(l,t,e)=>{let i=document.createElement(l);return t&&Object.entries(t).forEach(([n,s])=>i.setAttribute(n,s)),e&&e.appendChild(i),i},f=l=>{let{instances:t}=a;Object.values(t).forEach(e=>e[l]())},_=class{id;promise;telInput;highlightedItem;options;hadInitialPlaceholder;isRTL;isAndroid;selectedCountryData;countries;dialCodeMaxLen;dialCodeToIso2Map;dialCodes;countryContainer;selectedCountry;selectedCountryInner;selectedCountryA11yText;selectedDialCode;dropdownArrow;dropdownContent;searchInput;searchResultsA11yText;countryList;dropdown;hiddenInput;hiddenInputCountry;maxCoreNumberLength;defaultCountry;_a14;_a9;_a10;_a11;_a12;_handleKeydownEvent;_a4;_a0;_a1;_a2;_a3;_a7;resolveAutoCountryPromise;rejectAutoCountryPromise;resolveUtilsScriptPromise;rejectUtilsScriptPromise;constructor(t,e={}){this.id=z++,this.a=t,this.c=null,this.d=Object.assign({},S,e),this.e=!!t.getAttribute("placeholder")}_init(){this.d.useFullscreenPopup&&(this.d.fixDropdownWidth=!1),this.d.separateDialCode&&(this.d.allowDropdown=!0,this.d.nationalMode=!1),!this.d.showFlags&&!this.d.separateDialCode&&(this.d.nationalMode=!1),this.d.useFullscreenPopup&&!this.d.dropdownContainer&&(this.d.dropdownContainer=document.body),this.isAndroid=typeof navigator<"u"?/Android/i.test(navigator.userAgent):!1,this.isRTL=!!this.a.closest("[dir=rtl]"),this.d.i18n={...w,...this.d.i18n};let t=new Promise((i,n)=>{this.h=i,this.i=n}),e=new Promise((i,n)=>{this.i0=i,this.i1=n});this.promise=Promise.all([t,e]),this.s={},this._b(),this._f(),this._h(),this._i(),this._i3()}_b(){this._d(),this._d2(),this._d0(),this.d.countryOrder&&(this.d.countryOrder=this.d.countryOrder.map(t=>t.toLowerCase())),this._sortCountries()}_sortCountries(){this.p.sort((t,e)=>{let{countryOrder:i}=this.d;if(i){let n=i.indexOf(t.iso2),s=i.indexOf(e.iso2),o=n>-1,r=s>-1;if(o||r)return o&&r?n-s:o?-1:1}return t.name<e.name?-1:t.name>e.name?1:0})}_c(t,e,i){e.length>this.dialCodeMaxLen&&(this.dialCodeMaxLen=e.length),this.q.hasOwnProperty(e)||(this.q[e]=[]);for(let s=0;s<this.q[e].length;s++)if(this.q[e][s]===t)return;let n=i!==void 0?i:this.q[e].length;this.q[e][n]=t}_d(){let{onlyCountries:t,excludeCountries:e}=this.d;if(t.length){let i=t.map(n=>n.toLowerCase());this.p=C.filter(n=>i.indexOf(n.iso2)>-1)}else if(e.length){let i=e.map(n=>n.toLowerCase());this.p=C.filter(n=>i.indexOf(n.iso2)===-1)}else this.p=C}_d0(){for(let t=0;t<this.p.length;t++){let e=this.p[t].iso2.toLowerCase();this.d.i18n.hasOwnProperty(e)&&(this.p[t].name=this.d.i18n[e])}}_d2(){this.dialCodes={},this.dialCodeMaxLen=0,this.q={};for(let t=0;t<this.p.length;t++){let e=this.p[t];this.dialCodes[e.dialCode]||(this.dialCodes[e.dialCode]=!0),this._c(e.iso2,e.dialCode,e.priority)}for(let t=0;t<this.p.length;t++){let e=this.p[t];if(e.areaCodes){let i=this.q[e.dialCode][0];for(let n=0;n<e.areaCodes.length;n++){let s=e.areaCodes[n];for(let o=1;o<s.length;o++){let r=e.dialCode+s.substr(0,o);this._c(i,r),this._c(e.iso2,r)}this._c(e.iso2,e.dialCode+s)}}}}_f(){this.a.classList.add("iti__tel-input"),!this.a.hasAttribute("autocomplete")&&!(this.a.form&&this.a.form.hasAttribute("autocomplete"))&&this.a.setAttribute("autocomplete","off");let{allowDropdown:t,separateDialCode:e,showFlags:i,containerClass:n,hiddenInput:s,dropdownContainer:o,fixDropdownWidth:r,useFullscreenPopup:u,i18n:d}=this.d,c="iti";t&&(c+=" iti--allow-dropdown"),i&&(c+=" iti--show-flags"),n&&(c+=` ${n}`),u||(c+=" iti--inline-dropdown");let h=p("div",{class:c});if(this.a.parentNode?.insertBefore(h,this.a),t||i){this.k=p("div",{class:"iti__country-container"},h),this.selectedCountry=p("button",{type:"button",class:"iti__selected-country",...t&&{"aria-expanded":"false","aria-label":this.d.i18n.selectedCountryAriaLabel,"aria-haspopup":"true","aria-controls":`iti-${this.id}__dropdown-content`,role:"combobox"}},this.k);let g=p("div",{class:"iti__selected-country-primary"},this.selectedCountry);if(this.l=p("div",null,g),this.selectedCountryA11yText=p("span",{class:"iti__a11y-text"},this.l),this.a.disabled?this.selectedCountry.setAttribute("aria-disabled","true"):this.selectedCountry.setAttribute("tabindex","0"),t&&(this.u=p("div",{class:"iti__arrow","aria-hidden":"true"},g)),e&&(this.t=p("div",{class:"iti__selected-dial-code"},this.selectedCountry)),t){let m=r?"":"iti--flexible-dropdown-width";if(this.dropdownContent=p("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content iti__hide ${m}`}),this.searchInput=p("input",{type:"text",class:"iti__search-input",placeholder:d.searchPlaceholder,role:"combobox","aria-expanded":"true","aria-label":d.searchPlaceholder,"aria-controls":`iti-${this.id}__country-listbox`,"aria-autocomplete":"list",autocomplete:"off"},this.dropdownContent),this.searchResultsA11yText=p("span",{class:"iti__a11y-text"},this.dropdownContent),this.countryList=p("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox","aria-label":d.countryListAriaLabel},this.dropdownContent),this._g(this.p,"iti__standard"),this._p4(),o){let y="iti iti--container";u?y+=" iti--fullscreen-popup":y+=" iti--inline-dropdown",this.dropdown=p("div",{class:y}),this.dropdown.appendChild(this.dropdownContent)}else this.k.appendChild(this.dropdownContent)}}if(h.appendChild(this.a),s){let g=this.a.getAttribute("name")||"",m=s(g);m.phone&&(this.hiddenInput=p("input",{type:"hidden",name:m.phone}),h.appendChild(this.hiddenInput)),m.country&&(this.hiddenInputCountry=p("input",{type:"hidden",name:m.country}),h.appendChild(this.hiddenInputCountry))}}_g(t,e){for(let i=0;i<t.length;i++){let n=t[i],s=p("li",{id:`iti-${this.id}__item-${n.iso2}`,class:`iti__country ${e}`,tabindex:"-1",role:"option","data-dial-code":n.dialCode,"data-country-code":n.iso2,"aria-selected":"false"},this.countryList);n.nodeById[this.id]=s;let o="";this.d.showFlags&&(o+=`<div class='iti__flag-box'><div class='iti__flag iti__${n.iso2}'></div></div>`),o+=`<span class='iti__country-name'>${n.name}</span>`,o+=`<span class='iti__dial-code'>+${n.dialCode}</span>`,s.insertAdjacentHTML("beforeend",o)}}_h(t=!1){let e=this.a.getAttribute("value"),i=this.a.value,s=e&&e.charAt(0)==="+"&&(!i||i.charAt(0)!=="+")?e:i,o=this._5(s),r=k(s),{initialCountry:u,geoIpLookup:d}=this.d,c=u==="auto"&&d;if(o&&!r)this._v(s);else if(!c||t){let h=u?u.toLowerCase():"";h&&this._y(h,!0)?this._z(h):o&&r?this._z("us"):this._z()}s&&this._u(s)}_i(){this._j(),this.d.allowDropdown&&this._i2(),(this.hiddenInput||this.hiddenInputCountry)&&this.a.form&&this._i0()}_i0(){this._a14=()=>{this.hiddenInput&&(this.hiddenInput.value=this.getNumber()),this.hiddenInputCountry&&(this.hiddenInputCountry.value=this.getSelectedCountryData().iso2||"")},this.a.form?.addEventListener("submit",this._a14)}_i2(){this._a9=e=>{this.dropdownContent.classList.contains("iti__hide")?this.a.focus():e.preventDefault()};let t=this.a.closest("label");t&&t.addEventListener("click",this._a9),this._a10=()=>{this.dropdownContent.classList.contains("iti__hide")&&!this.a.disabled&&!this.a.readOnly&&this._n()},this.selectedCountry.addEventListener("click",this._a10),this._a11=e=>{this.dropdownContent.classList.contains("iti__hide")&&["ArrowUp","ArrowDown"," ","Enter"].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),this._n()),e.key==="Tab"&&this._2()},this.k.addEventListener("keydown",this._a11)}_i3(){let{utilsScript:t,initialCountry:e,geoIpLookup:i}=this.d;t&&!a.utils?a.documentReady()?a.loadUtils(t):window.addEventListener("load",()=>{a.loadUtils(t)}):this.i0(),e==="auto"&&i&&!this.s.iso2?this._i4():this.h()}_i4(){a.autoCountry?this.handleAutoCountry():a.startedLoadingAutoCountry||(a.startedLoadingAutoCountry=!0,typeof this.d.geoIpLookup=="function"&&this.d.geoIpLookup((t="")=>{let e=t.toLowerCase();e&&this._y(e,!0)?(a.autoCountry=e,setTimeout(()=>f("handleAutoCountry"))):(this._h(!0),f("rejectAutoCountryPromise"))},()=>{this._h(!0),f("rejectAutoCountryPromise")}))}_j(){let{strictMode:t,formatAsYouType:e,separateDialCode:i,formatOnDisplay:n}=this.d,s=!1,o=()=>{this._n(),this.searchInput.value="+",this._p3("",!0)};this._a12=r=>{if(this.isAndroid&&r?.data==="+"&&i){let h=this.a.selectionStart||0,g=this.a.value.substring(0,h-1),m=this.a.value.substring(h);this.a.value=g+m,o();return}this._v(this.a.value)&&this._8();let u=r?.data&&/[^+0-9]/.test(r.data),d=r?.inputType==="insertFromPaste"&&this.a.value;u||d&&!t?s=!0:/[^+0-9]/.test(this.a.value)||(s=!1);let c=r?.detail&&r.detail.isSetNumber&&!n;if(e&&!s&&!c){let h=this.a.selectionStart||0,m=this.a.value.substring(0,h).replace(/[^+0-9]/g,"").length,y=r?.inputType==="deleteContentForward",b=this._9(),L=F(m,b,h,y);this.a.value=b,this.a.setSelectionRange(L,L)}},this.a.addEventListener("input",this._a12),(t||i)&&(this._handleKeydownEvent=r=>{if(r.key&&r.key.length===1&&!r.altKey&&!r.ctrlKey&&!r.metaKey){if(i&&r.key==="+"){r.preventDefault(),o();return}if(t){let u=this.a.selectionStart===0&&r.key==="+",d=/^[0-9]$/.test(r.key),c=u||d,h=this._6(),g=a.utils.getCoreNumber(h,this.s.iso2),m=this.maxCoreNumberLength&&g.length>=this.maxCoreNumberLength,y=this.a.value.substring(this.a.selectionStart,this.a.selectionEnd),b=/\d/.test(y);(!c||m&&!b)&&r.preventDefault()}}},this.a.addEventListener("keydown",this._handleKeydownEvent))}_j2(t){let e=parseInt(this.a.getAttribute("maxlength")||"",10);return e&&t.length>e?t.substr(0,e):t}_trigger(t,e={}){let i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.a.dispatchEvent(i)}_n(){let{fixDropdownWidth:t}=this.d;t&&(this.dropdownContent.style.width=`${this.a.offsetWidth}px`),this.dropdownContent.classList.remove("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","true"),this._o();let e=this.countryList.firstElementChild;e&&(this._x(e,!1),this.countryList.scrollTop=0),this.searchInput.focus(),this._p(),this.u.classList.add("iti__arrow--up"),this._trigger("open:countrydropdown")}_o(){if(this.d.dropdownContainer&&this.d.dropdownContainer.appendChild(this.dropdown),!this.d.useFullscreenPopup){let t=this.a.getBoundingClientRect(),e=this.a.offsetHeight;this.d.dropdownContainer&&(this.dropdown.style.top=`${t.top+e}px`,this.dropdown.style.left=`${t.left}px`,this._a4=()=>this._2(),window.addEventListener("scroll",this._a4))}}_p(){this._a0=n=>{let s=n.target?.closest(".iti__country");s&&this._x(s,!1)},this.countryList.addEventListener("mouseover",this._a0),this._a1=n=>{let s=n.target?.closest(".iti__country");s&&this._1(s)},this.countryList.addEventListener("click",this._a1);let t=!0;this._a2=()=>{t||this._2(),t=!1},document.documentElement.addEventListener("click",this._a2),this._a3=n=>{["ArrowUp","ArrowDown","Enter","Escape"].includes(n.key)&&(n.preventDefault(),n.stopPropagation(),n.key==="ArrowUp"||n.key==="ArrowDown"?this._q(n.key):n.key==="Enter"?this._r():n.key==="Escape"&&this._2())},document.addEventListener("keydown",this._a3);let e=()=>{let n=this.searchInput.value.trim();n?this._p3(n):this._p3("",!0)},i=null;this._a7=()=>{i&&clearTimeout(i),i=setTimeout(()=>{e(),i=null},100)},this.searchInput.addEventListener("input",this._a7),this.searchInput.addEventListener("click",n=>n.stopPropagation())}_p3(t,e=!1){let i=!0;this.countryList.innerHTML="";let n=N(t);for(let s=0;s<this.p.length;s++){let o=this.p[s],r=N(o.name),u=`+${o.dialCode}`;if(e||r.includes(n)||u.includes(n)||o.iso2.includes(n)){let d=o.nodeById[this.id];d&&this.countryList.appendChild(d),i&&(this._x(d,!1),i=!1)}}i&&this._x(null,!1),this.countryList.scrollTop=0,this._p4()}_p4(){let{i18n:t}=this.d,e=this.countryList.childElementCount,i;e===0?i=t.zeroSearchResults:e===1?i=t.oneSearchResult:i=t.multipleSearchResults.replace("${count}",e.toString()),this.searchResultsA11yText.textContent=i}_q(t){let e=t==="ArrowUp"?this.c?.previousElementSibling:this.c?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t==="ArrowUp"?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this._3(e),this._x(e,!1))}_r(){this.c&&this._1(this.c)}_u(t){let e=t;if(this.d.formatOnDisplay&&a.utils&&this.s){let i=this.d.nationalMode||e.charAt(0)!=="+"&&!this.d.separateDialCode,{NATIONAL:n,INTERNATIONAL:s}=a.utils.numberFormat,o=i?n:s;e=a.utils.formatNumber(e,this.s.iso2,o)}e=this._7(e),this.a.value=e}_v(t){let e=t.indexOf("+"),i=e?t.substring(e):t,n=this.s.dialCode;i&&n==="1"&&i.charAt(0)!=="+"&&(i.charAt(0)!=="1"&&(i=`1${i}`),i=`+${i}`),this.d.separateDialCode&&n&&i.charAt(0)!=="+"&&(i=`+${n}${i}`);let o=this._5(i,!0),r=v(i),u=null;if(o){let d=this.q[v(o)],c=d.indexOf(this.s.iso2)!==-1&&r.length<=o.length-1;if(!(n==="1"&&k(r))&&!c){for(let g=0;g<d.length;g++)if(d[g]){u=d[g];break}}}else i.charAt(0)==="+"&&r.length?u="":(!i||i==="+")&&!this.s.iso2&&(u=this.j);return u!==null?this._z(u):!1}_x(t,e){let i=this.c;if(i&&(i.classList.remove("iti__highlight"),i.setAttribute("aria-selected","false")),this.c=t,this.c){this.c.classList.add("iti__highlight"),this.c.setAttribute("aria-selected","true");let n=this.c.getAttribute("id")||"";this.selectedCountry.setAttribute("aria-activedescendant",n),this.searchInput.setAttribute("aria-activedescendant",n)}e&&this.c.focus()}_y(t,e){for(let i=0;i<this.p.length;i++)if(this.p[i].iso2===t)return this.p[i];if(e)return null;throw new Error(`No country data for '${t}'`)}_z(t){let{separateDialCode:e,showFlags:i,i18n:n}=this.d,s=this.s.iso2?this.s:{};if(this.s=t?this._y(t,!1)||{}:{},this.s.iso2&&(this.j=this.s.iso2),this.l){let o="",r="";t&&i?(o=`iti__flag iti__${t}`,r=`${this.s.name} +${this.s.dialCode}`):(o="iti__flag iti__globe",r=n.noCountrySelected),this.l.className=o,this.selectedCountryA11yText.textContent=r}if(this._z3(t,e),e){let o=this.s.dialCode?`+${this.s.dialCode}`:"";this.t.innerHTML=o;let u=(this.selectedCountry.offsetWidth||this._z2())+8;this.isRTL?this.a.style.paddingRight=`${u}px`:this.a.style.paddingLeft=`${u}px`}return this._0(),this._updateMaxLength(),s.iso2!==t}_updateMaxLength(){let{strictMode:t,placeholderNumberType:e,validationNumberType:i}=this.d;if(t&&a.utils)if(this.s.iso2){let n=a.utils.numberType[e],s=a.utils.getExampleNumber(this.s.iso2,!1,n,!0),o=s;for(;a.utils.isPossibleNumber(s,this.s.iso2,i);)o=s,s+="0";let r=a.utils.getCoreNumber(o,this.s.iso2);this.maxCoreNumberLength=r.length}else this.maxCoreNumberLength=null}_z3(t=null,e){if(!this.selectedCountry)return;let i;t&&!e?i=`${this.s.name}: +${this.s.dialCode}`:t?i=this.s.name:i="Unknown",this.selectedCountry.setAttribute("title",i)}_z2(){if(this.a.parentNode){let t=this.a.parentNode.cloneNode(!1);t.style.visibility="hidden",document.body.appendChild(t);let e=this.k.cloneNode();t.appendChild(e);let i=this.selectedCountry.cloneNode(!0);e.appendChild(i);let n=i.offsetWidth;return document.body.removeChild(t),n}return 0}_0(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:i,customPlaceholder:n}=this.d,s=t==="aggressive"||!this.e&&t==="polite";if(a.utils&&s){let o=a.utils.numberType[e],r=this.s.iso2?a.utils.getExampleNumber(this.s.iso2,i,o):"";r=this._7(r),typeof n=="function"&&(r=n(r,this.s)),this.a.setAttribute("placeholder",r)}}_1(t){let e=this._z(t.getAttribute("data-country-code"));this._2(),this._4(t.getAttribute("data-dial-code")),this.a.focus(),e&&this._8()}_2(){this.dropdownContent.classList.add("iti__hide"),this.selectedCountry.setAttribute("aria-expanded","false"),this.selectedCountry.removeAttribute("aria-activedescendant"),this.c&&this.c.setAttribute("aria-selected","false"),this.searchInput.removeAttribute("aria-activedescendant"),this.u.classList.remove("iti__arrow--up"),document.removeEventListener("keydown",this._a3),this.searchInput.removeEventListener("input",this._a7),document.documentElement.removeEventListener("click",this._a2),this.countryList.removeEventListener("mouseover",this._a0),this.countryList.removeEventListener("click",this._a1),this.d.dropdownContainer&&(this.d.useFullscreenPopup||window.removeEventListener("scroll",this._a4),this.dropdown.parentNode&&this.dropdown.parentNode.removeChild(this.dropdown)),this._trigger("close:countrydropdown")}_3(t){let e=this.countryList,i=document.documentElement.scrollTop,n=e.offsetHeight,s=e.getBoundingClientRect().top+i,o=s+n,r=t.offsetHeight,u=t.getBoundingClientRect().top+i,d=u+r,c=u-s+e.scrollTop;if(u<s)e.scrollTop=c;else if(d>o){let h=n-r;e.scrollTop=c-h}}_4(t){let e=this.a.value,i=`+${t}`,n;if(e.charAt(0)==="+"){let s=this._5(e);s?n=e.replace(s,i):n=i,this.a.value=n}}_5(t,e){let i="";if(t.charAt(0)==="+"){let n="";for(let s=0;s<t.length;s++){let o=t.charAt(s);if(!isNaN(parseInt(o,10))){if(n+=o,e)this.q[n]&&(i=t.substr(0,s+1));else if(this.dialCodes[n]){i=t.substr(0,s+1);break}if(n.length===this.dialCodeMaxLen)break}}}return i}_6(){let t=this.a.value.trim(),{dialCode:e}=this.s,i,n=v(t);return this.d.separateDialCode&&t.charAt(0)!=="+"&&e&&n?i=`+${e}`:i="",i+t}_7(t){let e=t;if(this.d.separateDialCode){let i=this._5(e);if(i){i=`+${this.s.dialCode}`;let n=e[i.length]===" "||e[i.length]==="-"?i.length+1:i.length;e=e.substr(n)}}return this._j2(e)}_8(){this._trigger("countrychange")}_9(){let t=this._6(),e=a.utils?a.utils.formatNumberAsYouType(t,this.s.iso2):t,{dialCode:i}=this.s;return this.d.separateDialCode&&this.a.value.charAt(0)!=="+"&&e.includes(`+${i}`)?(e.split(`+${i}`)[1]||"").trim():e}handleAutoCountry(){this.d.initialCountry==="auto"&&a.autoCountry&&(this.j=a.autoCountry,this.s.iso2||this.l.classList.contains("iti__globe")||this.setCountry(this.j),this.h())}handleUtils(){a.utils&&(this.a.value&&this._u(this.a.value),this.s.iso2&&(this._0(),this._updateMaxLength())),this.i0()}destroy(){if(this.d.allowDropdown){this._2(),this.selectedCountry.removeEventListener("click",this._a10),this.k.removeEventListener("keydown",this._a11);let i=this.a.closest("label");i&&i.removeEventListener("click",this._a9)}let{form:t}=this.a;this._a14&&t&&t.removeEventListener("submit",this._a14),this.a.removeEventListener("input",this._a12),this._handleKeydownEvent&&this.a.removeEventListener("keydown",this._handleKeydownEvent),this.a.removeAttribute("data-intl-tel-input-id");let e=this.a.parentNode;e?.parentNode?.insertBefore(this.a,e),e?.parentNode?.removeChild(e),delete a.instances[this.id]}getExtension(){return a.utils?a.utils.getExtension(this._6(),this.s.iso2):""}getNumber(t){if(a.utils){let{iso2:e}=this.s;return a.utils.formatNumber(this._6(),e,t)}return""}getNumberType(){return a.utils?a.utils.getNumberType(this._6(),this.s.iso2):-99}getSelectedCountryData(){return this.s}getValidationError(){if(a.utils){let{iso2:t}=this.s;return a.utils.getValidationError(this._6(),t)}return-99}isValidNumber(){let t=this._6();return/\p{L}/u.test(t)?!1:a.utils?a.utils.isPossibleNumber(t,this.s.iso2,this.d.validationNumberType):null}isValidNumberPrecise(){let t=this._6();return/\p{L}/u.test(t)?!1:a.utils?a.utils.isValidNumber(t,this.s.iso2):null}setCountry(t){let e=t?.toLowerCase(),i=this.s.iso2;(t&&e!==i||!t&&i)&&(this._z(e),this._4(this.s.dialCode),this._8())}setNumber(t){let e=this._v(t);this._u(t),e&&this._8(),this._trigger("input",{isSetNumber:!0})}setPlaceholderNumberType(t){this.d.placeholderNumberType=t,this._0()}},B=l=>!a.utils&&!a.startedLoadingUtilsScript?(a.startedLoadingUtilsScript=!0,new Promise((t,e)=>{import(/* webpackIgnore: true */ l).then(({default:i})=>{a.utils=i,f("handleUtils"),t(!0)}).catch(()=>{f("rejectUtilsScriptPromise"),e()})})):null,a=Object.assign((l,t)=>{let e=new _(l,t);return e._init(),l.setAttribute("data-intl-tel-input-id",e.id.toString()),a.instances[e.id]=e,e},{defaults:S,documentReady:()=>document.readyState==="complete",getCountryData:()=>C,getInstance:l=>{let t=l.getAttribute("data-intl-tel-input-id");return t?a.instances[t]:null},instances:{},loadUtils:B,version:"23.0.12"}),K=a;return R(U);})();
|
|
17
17
|
|
|
18
18
|
// UMD
|
|
19
19
|
return factoryOutput.default;
|