intl-tel-input 26.7.4 → 26.7.5
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/angular/build/IntlTelInput.js +25 -8
- package/angular/build/IntlTelInputWithUtils.js +25 -8
- package/angular/build/types/intl-tel-input.d.ts +1 -0
- 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 +25 -9
- package/build/js/intlTelInput.min.js +2 -2
- package/build/js/intlTelInputWithUtils.js +25 -9
- package/build/js/intlTelInputWithUtils.min.js +2 -2
- package/package.json +1 -1
- package/react/build/IntlTelInput.cjs +27 -8
- package/react/build/IntlTelInput.d.ts +1 -0
- package/react/build/IntlTelInput.js +27 -8
- package/react/build/IntlTelInputWithUtils.cjs +27 -8
- package/react/build/IntlTelInputWithUtils.js +27 -8
- package/svelte/build/IntlTelInput.mjs +19 -10
- package/svelte/build/IntlTelInputWithUtils.mjs +19 -10
- package/vue/build/IntlTelInput.vue.d.ts +2 -0
- package/vue/build/IntlTelInputWithUtils.vue.d.ts +2 -0
- package/vue/build/exports/IntlTelInput.mjs +1 -1
- package/vue/build/exports/IntlTelInputWithUtils.mjs +1 -1
- package/vue/build/{intl-tel-input-DmnH_ier.mjs → intl-tel-input-Blq9KJbV.mjs} +19 -10
- package/vue/build/intl-tel-input.d.ts +1 -0
|
@@ -3863,16 +3863,21 @@ var Iti = class {
|
|
|
3863
3863
|
delete intlTelInput.instances[this.id];
|
|
3864
3864
|
}
|
|
3865
3865
|
}
|
|
3866
|
+
// check if the instance is still valid (not destroyed/unmounted)
|
|
3867
|
+
getIsValid() {
|
|
3868
|
+
var _a;
|
|
3869
|
+
return !!((_a = this.ui) === null || _a === void 0 ? void 0 : _a.telInput);
|
|
3870
|
+
}
|
|
3866
3871
|
//* Get the extension from the current number.
|
|
3867
3872
|
getExtension() {
|
|
3868
|
-
if (intlTelInput.utils) {
|
|
3873
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3869
3874
|
return intlTelInput.utils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
3870
3875
|
}
|
|
3871
3876
|
return "";
|
|
3872
3877
|
}
|
|
3873
3878
|
//* Format the number to the given format.
|
|
3874
3879
|
getNumber(format) {
|
|
3875
|
-
if (intlTelInput.utils) {
|
|
3880
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3876
3881
|
const { iso2 } = this.selectedCountryData;
|
|
3877
3882
|
const fullNumber = this._getFullNumber();
|
|
3878
3883
|
const formattedNumber = intlTelInput.utils.formatNumber(fullNumber, iso2, format);
|
|
@@ -3883,7 +3888,7 @@ var Iti = class {
|
|
|
3883
3888
|
}
|
|
3884
3889
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
3885
3890
|
getNumberType() {
|
|
3886
|
-
if (intlTelInput.utils) {
|
|
3891
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3887
3892
|
return intlTelInput.utils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
3888
3893
|
}
|
|
3889
3894
|
return SENTINELS.UNKNOWN_NUMBER_TYPE;
|
|
@@ -3894,7 +3899,7 @@ var Iti = class {
|
|
|
3894
3899
|
}
|
|
3895
3900
|
//* Get the validation error.
|
|
3896
3901
|
getValidationError() {
|
|
3897
|
-
if (intlTelInput.utils) {
|
|
3902
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3898
3903
|
const { iso2 } = this.selectedCountryData;
|
|
3899
3904
|
return intlTelInput.utils.getValidationError(this._getFullNumber(), iso2);
|
|
3900
3905
|
}
|
|
@@ -3903,10 +3908,10 @@ var Iti = class {
|
|
|
3903
3908
|
//* Validate the input val using number length only
|
|
3904
3909
|
isValidNumber() {
|
|
3905
3910
|
const { dialCode, iso2 } = this.selectedCountryData;
|
|
3906
|
-
if (dialCode === UK.DIAL_CODE && intlTelInput.utils) {
|
|
3911
|
+
if (dialCode === UK.DIAL_CODE && intlTelInput.utils && this.ui.telInput) {
|
|
3907
3912
|
const number = this._getFullNumber();
|
|
3908
3913
|
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
3909
|
-
if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
3914
|
+
if (coreNumber && coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
3910
3915
|
return false;
|
|
3911
3916
|
}
|
|
3912
3917
|
}
|
|
@@ -3921,7 +3926,7 @@ var Iti = class {
|
|
|
3921
3926
|
}
|
|
3922
3927
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
3923
3928
|
_validateNumber(precise) {
|
|
3924
|
-
if (!intlTelInput.utils) {
|
|
3929
|
+
if (!intlTelInput.utils || !this.ui.telInput) {
|
|
3925
3930
|
return null;
|
|
3926
3931
|
}
|
|
3927
3932
|
const { allowNumberExtensions, allowPhonewords } = this.options;
|
|
@@ -3953,6 +3958,9 @@ var Iti = class {
|
|
|
3953
3958
|
}
|
|
3954
3959
|
//* Update the selected country, and update the input val accordingly.
|
|
3955
3960
|
setCountry(iso2) {
|
|
3961
|
+
if (!this.ui.telInput) {
|
|
3962
|
+
return;
|
|
3963
|
+
}
|
|
3956
3964
|
const iso2Lower = iso2 === null || iso2 === void 0 ? void 0 : iso2.toLowerCase();
|
|
3957
3965
|
if (!isIso22(iso2Lower)) {
|
|
3958
3966
|
throw new Error(`Invalid country code: '${iso2Lower}'`);
|
|
@@ -3971,6 +3979,9 @@ var Iti = class {
|
|
|
3971
3979
|
}
|
|
3972
3980
|
//* Set the input value and update the country.
|
|
3973
3981
|
setNumber(number) {
|
|
3982
|
+
if (!this.ui.telInput) {
|
|
3983
|
+
return;
|
|
3984
|
+
}
|
|
3974
3985
|
const normalisedNumber = this.numerals.normalise(number);
|
|
3975
3986
|
const countryChanged = this._updateCountryFromNumber(normalisedNumber);
|
|
3976
3987
|
this._updateValFromNumber(normalisedNumber);
|
|
@@ -3981,10 +3992,16 @@ var Iti = class {
|
|
|
3981
3992
|
}
|
|
3982
3993
|
//* Set the placeholder number typ
|
|
3983
3994
|
setPlaceholderNumberType(type) {
|
|
3995
|
+
if (!this.ui.telInput) {
|
|
3996
|
+
return;
|
|
3997
|
+
}
|
|
3984
3998
|
this.options.placeholderNumberType = type;
|
|
3985
3999
|
this._updatePlaceholder();
|
|
3986
4000
|
}
|
|
3987
4001
|
setDisabled(disabled) {
|
|
4002
|
+
if (!this.ui.telInput) {
|
|
4003
|
+
return;
|
|
4004
|
+
}
|
|
3988
4005
|
this.ui.telInput.disabled = disabled;
|
|
3989
4006
|
if (disabled) {
|
|
3990
4007
|
this.ui.selectedCountry.setAttribute("disabled", "true");
|
|
@@ -4050,7 +4067,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
4050
4067
|
attachUtils,
|
|
4051
4068
|
startedLoadingUtilsScript: false,
|
|
4052
4069
|
startedLoadingAutoCountry: false,
|
|
4053
|
-
version: "26.7.
|
|
4070
|
+
version: "26.7.5"
|
|
4054
4071
|
});
|
|
4055
4072
|
var intl_tel_input_default = intlTelInput;
|
|
4056
4073
|
|
|
@@ -3863,16 +3863,21 @@ var Iti = class {
|
|
|
3863
3863
|
delete intlTelInput.instances[this.id];
|
|
3864
3864
|
}
|
|
3865
3865
|
}
|
|
3866
|
+
// check if the instance is still valid (not destroyed/unmounted)
|
|
3867
|
+
getIsValid() {
|
|
3868
|
+
var _a;
|
|
3869
|
+
return !!((_a = this.ui) === null || _a === void 0 ? void 0 : _a.telInput);
|
|
3870
|
+
}
|
|
3866
3871
|
//* Get the extension from the current number.
|
|
3867
3872
|
getExtension() {
|
|
3868
|
-
if (intlTelInput.utils) {
|
|
3873
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3869
3874
|
return intlTelInput.utils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
3870
3875
|
}
|
|
3871
3876
|
return "";
|
|
3872
3877
|
}
|
|
3873
3878
|
//* Format the number to the given format.
|
|
3874
3879
|
getNumber(format) {
|
|
3875
|
-
if (intlTelInput.utils) {
|
|
3880
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3876
3881
|
const { iso2 } = this.selectedCountryData;
|
|
3877
3882
|
const fullNumber = this._getFullNumber();
|
|
3878
3883
|
const formattedNumber = intlTelInput.utils.formatNumber(fullNumber, iso2, format);
|
|
@@ -3883,7 +3888,7 @@ var Iti = class {
|
|
|
3883
3888
|
}
|
|
3884
3889
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
3885
3890
|
getNumberType() {
|
|
3886
|
-
if (intlTelInput.utils) {
|
|
3891
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3887
3892
|
return intlTelInput.utils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
|
|
3888
3893
|
}
|
|
3889
3894
|
return SENTINELS.UNKNOWN_NUMBER_TYPE;
|
|
@@ -3894,7 +3899,7 @@ var Iti = class {
|
|
|
3894
3899
|
}
|
|
3895
3900
|
//* Get the validation error.
|
|
3896
3901
|
getValidationError() {
|
|
3897
|
-
if (intlTelInput.utils) {
|
|
3902
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
3898
3903
|
const { iso2 } = this.selectedCountryData;
|
|
3899
3904
|
return intlTelInput.utils.getValidationError(this._getFullNumber(), iso2);
|
|
3900
3905
|
}
|
|
@@ -3903,10 +3908,10 @@ var Iti = class {
|
|
|
3903
3908
|
//* Validate the input val using number length only
|
|
3904
3909
|
isValidNumber() {
|
|
3905
3910
|
const { dialCode, iso2 } = this.selectedCountryData;
|
|
3906
|
-
if (dialCode === UK.DIAL_CODE && intlTelInput.utils) {
|
|
3911
|
+
if (dialCode === UK.DIAL_CODE && intlTelInput.utils && this.ui.telInput) {
|
|
3907
3912
|
const number = this._getFullNumber();
|
|
3908
3913
|
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
3909
|
-
if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
3914
|
+
if (coreNumber && coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
3910
3915
|
return false;
|
|
3911
3916
|
}
|
|
3912
3917
|
}
|
|
@@ -3921,7 +3926,7 @@ var Iti = class {
|
|
|
3921
3926
|
}
|
|
3922
3927
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
3923
3928
|
_validateNumber(precise) {
|
|
3924
|
-
if (!intlTelInput.utils) {
|
|
3929
|
+
if (!intlTelInput.utils || !this.ui.telInput) {
|
|
3925
3930
|
return null;
|
|
3926
3931
|
}
|
|
3927
3932
|
const { allowNumberExtensions, allowPhonewords } = this.options;
|
|
@@ -3953,6 +3958,9 @@ var Iti = class {
|
|
|
3953
3958
|
}
|
|
3954
3959
|
//* Update the selected country, and update the input val accordingly.
|
|
3955
3960
|
setCountry(iso2) {
|
|
3961
|
+
if (!this.ui.telInput) {
|
|
3962
|
+
return;
|
|
3963
|
+
}
|
|
3956
3964
|
const iso2Lower = iso2 === null || iso2 === void 0 ? void 0 : iso2.toLowerCase();
|
|
3957
3965
|
if (!isIso22(iso2Lower)) {
|
|
3958
3966
|
throw new Error(`Invalid country code: '${iso2Lower}'`);
|
|
@@ -3971,6 +3979,9 @@ var Iti = class {
|
|
|
3971
3979
|
}
|
|
3972
3980
|
//* Set the input value and update the country.
|
|
3973
3981
|
setNumber(number) {
|
|
3982
|
+
if (!this.ui.telInput) {
|
|
3983
|
+
return;
|
|
3984
|
+
}
|
|
3974
3985
|
const normalisedNumber = this.numerals.normalise(number);
|
|
3975
3986
|
const countryChanged = this._updateCountryFromNumber(normalisedNumber);
|
|
3976
3987
|
this._updateValFromNumber(normalisedNumber);
|
|
@@ -3981,10 +3992,16 @@ var Iti = class {
|
|
|
3981
3992
|
}
|
|
3982
3993
|
//* Set the placeholder number typ
|
|
3983
3994
|
setPlaceholderNumberType(type) {
|
|
3995
|
+
if (!this.ui.telInput) {
|
|
3996
|
+
return;
|
|
3997
|
+
}
|
|
3984
3998
|
this.options.placeholderNumberType = type;
|
|
3985
3999
|
this._updatePlaceholder();
|
|
3986
4000
|
}
|
|
3987
4001
|
setDisabled(disabled) {
|
|
4002
|
+
if (!this.ui.telInput) {
|
|
4003
|
+
return;
|
|
4004
|
+
}
|
|
3988
4005
|
this.ui.telInput.disabled = disabled;
|
|
3989
4006
|
if (disabled) {
|
|
3990
4007
|
this.ui.selectedCountry.setAttribute("disabled", "true");
|
|
@@ -4050,7 +4067,7 @@ var intlTelInput = Object.assign((input, options) => {
|
|
|
4050
4067
|
attachUtils,
|
|
4051
4068
|
startedLoadingUtilsScript: false,
|
|
4052
4069
|
startedLoadingAutoCountry: false,
|
|
4053
|
-
version: "26.7.
|
|
4070
|
+
version: "26.7.5"
|
|
4054
4071
|
});
|
|
4055
4072
|
var intl_tel_input_default = intlTelInput;
|
|
4056
4073
|
|
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 v26.7.
|
|
2
|
+
* International Telephone Input v26.7.5
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -4079,9 +4079,13 @@ var factoryOutput = (() => {
|
|
|
4079
4079
|
delete intlTelInput.instances[this.id];
|
|
4080
4080
|
}
|
|
4081
4081
|
}
|
|
4082
|
+
// check if the instance is still valid (not destroyed/unmounted)
|
|
4083
|
+
getIsValid() {
|
|
4084
|
+
return !!this.ui?.telInput;
|
|
4085
|
+
}
|
|
4082
4086
|
//* Get the extension from the current number.
|
|
4083
4087
|
getExtension() {
|
|
4084
|
-
if (intlTelInput.utils) {
|
|
4088
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4085
4089
|
return intlTelInput.utils.getExtension(
|
|
4086
4090
|
this._getFullNumber(),
|
|
4087
4091
|
this.selectedCountryData.iso2
|
|
@@ -4091,7 +4095,7 @@ var factoryOutput = (() => {
|
|
|
4091
4095
|
}
|
|
4092
4096
|
//* Format the number to the given format.
|
|
4093
4097
|
getNumber(format) {
|
|
4094
|
-
if (intlTelInput.utils) {
|
|
4098
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4095
4099
|
const { iso2 } = this.selectedCountryData;
|
|
4096
4100
|
const fullNumber = this._getFullNumber();
|
|
4097
4101
|
const formattedNumber = intlTelInput.utils.formatNumber(
|
|
@@ -4106,7 +4110,7 @@ var factoryOutput = (() => {
|
|
|
4106
4110
|
}
|
|
4107
4111
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
4108
4112
|
getNumberType() {
|
|
4109
|
-
if (intlTelInput.utils) {
|
|
4113
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4110
4114
|
return intlTelInput.utils.getNumberType(
|
|
4111
4115
|
this._getFullNumber(),
|
|
4112
4116
|
this.selectedCountryData.iso2
|
|
@@ -4120,7 +4124,7 @@ var factoryOutput = (() => {
|
|
|
4120
4124
|
}
|
|
4121
4125
|
//* Get the validation error.
|
|
4122
4126
|
getValidationError() {
|
|
4123
|
-
if (intlTelInput.utils) {
|
|
4127
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4124
4128
|
const { iso2 } = this.selectedCountryData;
|
|
4125
4129
|
return intlTelInput.utils.getValidationError(this._getFullNumber(), iso2);
|
|
4126
4130
|
}
|
|
@@ -4129,10 +4133,10 @@ var factoryOutput = (() => {
|
|
|
4129
4133
|
//* Validate the input val using number length only
|
|
4130
4134
|
isValidNumber() {
|
|
4131
4135
|
const { dialCode, iso2 } = this.selectedCountryData;
|
|
4132
|
-
if (dialCode === UK.DIAL_CODE && intlTelInput.utils) {
|
|
4136
|
+
if (dialCode === UK.DIAL_CODE && intlTelInput.utils && this.ui.telInput) {
|
|
4133
4137
|
const number = this._getFullNumber();
|
|
4134
4138
|
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
4135
|
-
if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
4139
|
+
if (coreNumber && coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
4136
4140
|
return false;
|
|
4137
4141
|
}
|
|
4138
4142
|
}
|
|
@@ -4151,7 +4155,7 @@ var factoryOutput = (() => {
|
|
|
4151
4155
|
}
|
|
4152
4156
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
4153
4157
|
_validateNumber(precise) {
|
|
4154
|
-
if (!intlTelInput.utils) {
|
|
4158
|
+
if (!intlTelInput.utils || !this.ui.telInput) {
|
|
4155
4159
|
return null;
|
|
4156
4160
|
}
|
|
4157
4161
|
const { allowNumberExtensions, allowPhonewords } = this.options;
|
|
@@ -4187,6 +4191,9 @@ var factoryOutput = (() => {
|
|
|
4187
4191
|
}
|
|
4188
4192
|
//* Update the selected country, and update the input val accordingly.
|
|
4189
4193
|
setCountry(iso2) {
|
|
4194
|
+
if (!this.ui.telInput) {
|
|
4195
|
+
return;
|
|
4196
|
+
}
|
|
4190
4197
|
const iso2Lower = iso2?.toLowerCase();
|
|
4191
4198
|
if (!isIso22(iso2Lower)) {
|
|
4192
4199
|
throw new Error(`Invalid country code: '${iso2Lower}'`);
|
|
@@ -4205,6 +4212,9 @@ var factoryOutput = (() => {
|
|
|
4205
4212
|
}
|
|
4206
4213
|
//* Set the input value and update the country.
|
|
4207
4214
|
setNumber(number) {
|
|
4215
|
+
if (!this.ui.telInput) {
|
|
4216
|
+
return;
|
|
4217
|
+
}
|
|
4208
4218
|
const normalisedNumber = this.numerals.normalise(number);
|
|
4209
4219
|
const countryChanged = this._updateCountryFromNumber(normalisedNumber);
|
|
4210
4220
|
this._updateValFromNumber(normalisedNumber);
|
|
@@ -4215,10 +4225,16 @@ var factoryOutput = (() => {
|
|
|
4215
4225
|
}
|
|
4216
4226
|
//* Set the placeholder number typ
|
|
4217
4227
|
setPlaceholderNumberType(type) {
|
|
4228
|
+
if (!this.ui.telInput) {
|
|
4229
|
+
return;
|
|
4230
|
+
}
|
|
4218
4231
|
this.options.placeholderNumberType = type;
|
|
4219
4232
|
this._updatePlaceholder();
|
|
4220
4233
|
}
|
|
4221
4234
|
setDisabled(disabled) {
|
|
4235
|
+
if (!this.ui.telInput) {
|
|
4236
|
+
return;
|
|
4237
|
+
}
|
|
4222
4238
|
this.ui.telInput.disabled = disabled;
|
|
4223
4239
|
if (disabled) {
|
|
4224
4240
|
this.ui.selectedCountry.setAttribute("disabled", "true");
|
|
@@ -4292,7 +4308,7 @@ var factoryOutput = (() => {
|
|
|
4292
4308
|
attachUtils,
|
|
4293
4309
|
startedLoadingUtilsScript: false,
|
|
4294
4310
|
startedLoadingAutoCountry: false,
|
|
4295
|
-
version: "26.7.
|
|
4311
|
+
version: "26.7.5"
|
|
4296
4312
|
}
|
|
4297
4313
|
);
|
|
4298
4314
|
var intl_tel_input_default = intlTelInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v26.7.
|
|
2
|
+
* International Telephone Input v26.7.5
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -31,7 +31,7 @@ var factoryOutput=(()=>{var Y=Object.defineProperty;var At=Object.getOwnProperty
|
|
|
31
31
|
<svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
|
|
32
32
|
<path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
|
|
33
33
|
<path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
|
|
34
|
-
</svg>`;var M=class s{constructor(t,e,n){this.searchKeyupTimer=null;this.inlineDropdownHeight=null;this.dropdownForContainer=null;this.highlightedItem=null;this.selectedItem=null;t.dataset.intlTelInputId=n.toString(),this.telInput=t,this.options=e,this.id=n,this.a=!!t.getAttribute("placeholder"),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.o=this.telInput.style.paddingLeft)}static validateInput(t){let e=t?.tagName;if(!(!!t&&typeof t=="object"&&e==="INPUT"&&typeof t.setAttribute=="function")){let i=Object.prototype.toString.call(t);throw new TypeError(`The first argument must be an HTMLInputElement, not ${i}`)}}generateMarkup(t){this.countries=t,this.telInput.classList.add("iti__tel-input"),this.telInput.hasAttribute("autocomplete")||this.telInput.setAttribute("autocomplete","tel"),this.telInput.hasAttribute("inputmode")||this.telInput.setAttribute("inputmode","tel");let e=this._au();this._av(e),e.appendChild(this.telInput),this._ay(),this._az(e)}_au(){let{allowDropdown:t,showFlags:e,containerClass:n,useFullscreenPopup:i}=this.options,o=V({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!i,[n]:!!n}),r=C("div",{class:o});return this.isRTL&&r.setAttribute("dir","ltr"),this.telInput.before(r),r}_av(t){let{allowDropdown:e,separateDialCode:n,showFlags:i}=this.options;if(e||i||n){this.countryContainer=C("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.selectedCountry=C("button",{type:"button",class:"iti__selected-country",[p.EXPANDED]:"false",[p.LABEL]:this.options.i18n.noCountrySelected,[p.HASPOPUP]:"dialog",[p.CONTROLS]:`iti-${this.id}__dropdown-content`},this.countryContainer),this.telInput.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=C("div",{class:"iti__selected-country"},this.countryContainer);let o=C("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=C("div",{class:h.FLAG},o),e&&(this.dropdownArrow=C("div",{class:"iti__arrow",[p.HIDDEN]:"true"},o)),n&&(this.selectedDialCode=C("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e&&this._aw()}}_maybeEnsureDropdownWidthSet(){let{fixDropdownWidth:t}=this.options;if(t&&!this.dropdownContent.style.width){let e=this.telInput.offsetWidth;e>0&&(this.dropdownContent.style.width=`${e}px`)}}_aw(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:n,i18n:i,dropdownContainer:o,containerClass:r}=this.options,l=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=C("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${l}`,role:"dialog",[p.MODAL]:"true"}),this.isRTL&&this.dropdownContent.setAttribute("dir","rtl"),n&&this._ax(),this.countryList=C("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[p.LABEL]:i.countryListAriaLabel},this.dropdownContent),this._ba(),n&&this.updateSearchResultsA11yText(),e||(this._maybeEnsureDropdownWidthSet(),this.inlineDropdownHeight=this.getHiddenInlineDropdownHeight(),n&&(this.dropdownContent.style.height=`${this.inlineDropdownHeight}px`)),o){let a=V({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[r]:!!r});this.dropdownForContainer=C("div",{class:a}),this.dropdownForContainer.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_ax(){let{i18n:t,searchInputClass:e}=this.options,n=C("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=C("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},n),this.searchIcon.innerHTML=ft(),this.searchInput=C("input",{id:`iti-${this.id}__search-input`,type:"search",class:`iti__search-input ${e}`,placeholder:t.searchPlaceholder,role:"combobox",[p.EXPANDED]:"true",[p.LABEL]:t.searchPlaceholder,[p.CONTROLS]:`iti-${this.id}__country-listbox`,[p.AUTOCOMPLETE]:"list",autocomplete:"off"},n),this.k=C("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},n),this.k.innerHTML=gt(this.id),this.l=C("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=C("div",{class:`iti__no-results ${h.HIDE}`,[p.HIDDEN]:"true"},this.dropdownContent),this.searchNoResults.textContent=t.searchEmptyState}_ay(){this.countryContainer&&(this.updateInputPadding(),this.countryContainer.classList.remove(h.V_HIDE))}_az(t){let{hiddenInput:e}=this.options;if(e){let n=this.telInput.getAttribute("name")||"",i=e(n);if(i.phone){let o=this.telInput.form?.querySelector(`input[name="${i.phone}"]`);o?this.hiddenInput=o:(this.hiddenInput=C("input",{type:"hidden",name:i.phone}),t.appendChild(this.hiddenInput))}if(i.country){let o=this.telInput.form?.querySelector(`input[name="${i.country}"]`);o?this.m=o:(this.m=C("input",{type:"hidden",name:i.country}),t.appendChild(this.m))}}}_ba(){let t=document.createDocumentFragment();for(let e=0;e<this.countries.length;e++){let n=this.countries[e],i=V({[h.COUNTRY_ITEM]:!0}),o=C("li",{id:`iti-${this.id}__item-${n.iso2}`,class:i,tabindex:"-1",role:"option",[p.SELECTED]:"false"});o.dataset.dialCode=n.dialCode,o.dataset.countryCode=n.iso2,n.nodeById[this.id]=o,this.options.showFlags&&C("div",{class:`${h.FLAG} iti__${n.iso2}`},o);let r=C("span",{class:"iti__country-name"},o);r.textContent=`${n.name} `;let l=C("span",{class:"iti__dial-code"},r);this.isRTL&&l.setAttribute("dir","ltr"),l.textContent=`(+${n.dialCode})`,t.appendChild(o)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?v.SANE_SELECTED_WITH_DIAL_WIDTH:v.SANE_SELECTED_NO_DIAL_WIDTH,n=(this.selectedCountry.offsetWidth||this._bb()||t)+v.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${n}px`}}static getBody(){let t;try{t=window.top.document.body}catch{t=document.body}return t}_bb(){if(this.telInput.parentNode){let t=s.getBody(),e=this.telInput.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let n=this.countryContainer.cloneNode();e.appendChild(n);let i=this.selectedCountry.cloneNode(!0);n.appendChild(i);let o=i.offsetWidth;return t.removeChild(e),o}return 0}getHiddenInlineDropdownHeight(){let t=s.getBody();this.dropdownContent.classList.remove(h.HIDE);let e=C("div",{class:"iti iti--inline-dropdown"});e.appendChild(this.dropdownContent),e.style.visibility="hidden",t.appendChild(e);let n=this.dropdownContent.offsetHeight;return t.removeChild(e),e.style.visibility="",this.dropdownContent.classList.add(h.HIDE),n>0?n:v.SANE_DROPDOWN_HEIGHT}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount;this.l.textContent=t.searchSummaryAria(e)}filterCountriesByQuery(t){let e;t===""?e=this.countries:e=mt(this.countries,t),this.filterCountries(e)}doFilter(){let t=this.searchInput.value.trim();this.filterCountriesByQuery(t),this.searchInput.value?this.k.classList.remove(h.HIDE):this.k.classList.add(h.HIDE)}handleSearchChange(){this.searchKeyupTimer&&clearTimeout(this.searchKeyupTimer),this.searchKeyupTimer=setTimeout(()=>{this.doFilter(),this.searchKeyupTimer=null},k.SEARCH_DEBOUNCE_MS)}handleSearchClear(){this.searchInput.value="",this.searchInput.focus(),this.doFilter()}scrollTo(t){let e=this.countryList,n=document.documentElement.scrollTop,i=e.offsetHeight,o=e.getBoundingClientRect().top+n,r=o+i,l=t.offsetHeight,a=t.getBoundingClientRect().top+n,d=a+l,c=a-o+e.scrollTop;if(a<o)e.scrollTop=c;else if(d>r){let m=i-l;e.scrollTop=c-m}}highlightListItem(t,e){let n=this.highlightedItem;if(n&&n.classList.remove(h.HIGHLIGHT),this.highlightedItem=t,this.highlightedItem&&(this.highlightedItem.classList.add(h.HIGHLIGHT),this.options.countrySearch)){let i=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,i)}e&&this.highlightedItem.focus()}handleUpDownKey(t){let e=t===g.ARROW_UP?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t===g.ARROW_UP?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this.scrollTo(e),this.highlightListItem(e,!1))}updateSelectedItem(t){if(this.selectedItem&&this.selectedItem.dataset.countryCode!==t&&(this.selectedItem.setAttribute(p.SELECTED,"false"),this.selectedItem.querySelector(".iti__country-check")?.remove(),this.selectedItem=null),t&&!this.selectedItem){let e=this.countryList.querySelector(`[data-country-code="${t}"]`);if(e){e.setAttribute(p.SELECTED,"true");let n=C("span",{class:"iti__country-check",[p.HIDDEN]:"true"},e);n.innerHTML=It(),this.selectedItem=e}}}filterCountries(t){this.countryList.innerHTML="";let e=!0;for(let n of t){let i=n.nodeById[this.id];i&&(this.countryList.appendChild(i),e&&(this.highlightListItem(i,!1),e=!1))}e?(this.highlightListItem(null,!1),this.searchNoResults&&this.searchNoResults.classList.remove(h.HIDE)):this.searchNoResults&&this.searchNoResults.classList.add(h.HIDE),this.countryList.scrollTop=0,this.updateSearchResultsA11yText()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.options.separateDialCode&&(this.telInput.style.paddingLeft=this.o);let t=this.telInput.parentNode;t.before(this.telInput),t.remove(),this.telInput=null,this.countryContainer=null,this.selectedCountry=null,this.selectedCountryInner=null,this.selectedDialCode=null,this.dropdownArrow=null,this.dropdownContent=null,this.searchInput=null,this.searchIcon=null,this.k=null,this.searchNoResults=null,this.l=null,this.countryList=null,this.dropdownForContainer=null,this.hiddenInput=null,this.m=null,this.highlightedItem=null,this.selectedItem=null;for(let e of this.countries)delete e.nodeById[this.id];this.countries=null}openDropdown(){let{countrySearch:t,dropdownAlwaysOpen:e,dropdownContainer:n}=this.options;if(this._maybeEnsureDropdownWidthSet(),n)this._handleDropdownContainer();else{let i=this._shouldPositionInlineDropdownBelowInput(),o=this.telInput.offsetHeight+v.DROPDOWN_MARGIN;i?this.dropdownContent.style.top=`${o}px`:this.dropdownContent.style.bottom=`${o}px`}if(this.dropdownContent.classList.remove(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"true"),t){let i=this.countryList.firstElementChild;i&&(this.highlightListItem(i,!1),this.countryList.scrollTop=0),e||this.searchInput.focus()}this.dropdownArrow.classList.add(h.ARROW_UP)}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.options;this.dropdownContent.classList.add(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"false"),t&&(this.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),this.highlightedItem&&(this.highlightedItem.classList.remove(h.HIGHLIGHT),this.highlightedItem=null)),this.dropdownArrow.classList.remove(h.ARROW_UP),e?(this.dropdownForContainer.remove(),this.dropdownForContainer.style.top="",this.dropdownForContainer.style.bottom=""):(this.dropdownContent.style.top="",this.dropdownContent.style.bottom="")}_shouldPositionInlineDropdownBelowInput(){if(this.options.dropdownAlwaysOpen)return!0;let t=this.telInput.getBoundingClientRect(),e=t.top,n=window.innerHeight-t.bottom;return n>=this.inlineDropdownHeight||n>=e}_handleDropdownContainer(){let{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(t){if(!e){let n=this.telInput.getBoundingClientRect();this.dropdownForContainer.style.left=`${n.left}px`,this._shouldPositionInlineDropdownBelowInput()?this.dropdownForContainer.style.top=`${n.bottom+v.DROPDOWN_MARGIN}px`:(this.dropdownForContainer.style.top="unset",this.dropdownForContainer.style.bottom=`${window.innerHeight-n.top+v.DROPDOWN_MARGIN}px`)}t.appendChild(this.dropdownForContainer)}}isDropdownClosed(){return this.dropdownContent.classList.contains(h.HIDE)}setCountry(t){let{allowDropdown:e,showFlags:n,separateDialCode:i,i18n:o}=this.options,{name:r,dialCode:l,iso2:a=""}=t;if(e&&this.updateSelectedItem(a),this.selectedCountry){let d=a&&n?`${h.FLAG} iti__${a}`:`${h.FLAG} ${h.GLOBE}`,c,m,I;a?(m=r,c=o.selectedCountryAriaLabel.replace("${countryName}",r).replace("${dialCode}",`+${l}`),I=n?"":J()):(m=o.noCountrySelected,c=o.noCountrySelected,I=J()),this.selectedCountryInner.className=d,this.selectedCountry.setAttribute("title",m),this.selectedCountry.setAttribute(p.LABEL,c),this.selectedCountryInner.innerHTML=I}if(i){let d=l?`+${l}`:"";this.selectedDialCode.textContent=d,this.updateInputPadding()}}};var bt=s=>{let{onlyCountries:t,excludeCountries:e}=s;if(t?.length){let n=t.map(i=>i.toLowerCase());return L.filter(i=>n.includes(i.iso2))}else if(e?.length){let n=e.map(i=>i.toLowerCase());return L.filter(i=>!n.includes(i.iso2))}return L},_t=(s,t)=>{let{countryNameLocale:e,i18n:n}=t,i;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?i=new Intl.DisplayNames(e,{type:"region"}):i=null}catch(o){console.error(o),i=null}for(let o of s)o.name=n[o.iso2]||i?.of(o.iso2.toUpperCase())||""},Et=s=>{let t=new Set,e=0,n={},i=(r,l)=>{if(!r||!l)return;l.length>e&&(e=l.length),n.hasOwnProperty(l)||(n[l]=[]);let a=n[l];a.includes(r)||a.push(r)},o=[...s].sort((r,l)=>r.priority-l.priority);for(let r of o){t.has(r.dialCode)||t.add(r.dialCode);for(let l=1;l<r.dialCode.length;l++){let a=r.dialCode.substring(0,l);i(r.iso2,a)}if(i(r.iso2,r.dialCode),r.areaCodes){let l=n[r.dialCode][0];for(let a of r.areaCodes){for(let d=1;d<a.length;d++){let c=a.substring(0,d),m=r.dialCode+c;i(l,m),i(r.iso2,m)}i(r.iso2,r.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLen:e,dialCodeToIso2Map:n}},wt=(s,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),s.sort((e,n)=>{let{countryOrder:i}=t;if(i){let o=i.indexOf(e.iso2),r=i.indexOf(n.iso2),l=o>-1,a=r>-1;if(l||a)return l&&a?o-r:l?-1:1}return e.name.localeCompare(n.name)})},vt=s=>{for(let t of s)t.normalisedName=$(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var $t=new Set(["800","808","870","881","882","883","888","979"]),Z=s=>{let t=S(s).slice(0,3);return s.startsWith("+")&&$t.has(t)};var tt=(s,t,e,n)=>{let i=s;if(e&&t){let o=`+${n.dialCode}`,r=i[o.length]===" "||i[o.length]==="-"?o.length+1:o.length;i=i.substring(r)}return i},Lt=(s,t,e,n,i)=>{let o=e?e.formatNumberAsYouType(s,n.iso2):s,{dialCode:r}=n;return i&&t.charAt(0)!=="+"&&o.includes(`+${r}`)?(o.split(`+${r}`)[1]||"").trim():o};var Dt=(s,t,e,n)=>{if(e===0&&!n)return 0;let i=0;for(let o=0;o<t.length;o++){if(/[+0-9]/.test(t[o])&&i++,i===s&&!n)return o+1;if(n&&i===s+1)return o}return t.length};var Vt=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],et=s=>{let t=S(s);if(t.startsWith(U.NANP)&&t.length>=4){let e=t.substring(1,4);return Vt.includes(e)}return!1};var G=class{constructor(){}updateNumeralSet(t){/[\u0660-\u0669]/.test(t)?this.userNumeralSet="arabic-indic":/[\u06F0-\u06F9]/.test(t)?this.userNumeralSet="persian":this.userNumeralSet="ascii"}denormalise(t,e){if(this.userNumeralSet||this.updateNumeralSet(e),this.userNumeralSet==="ascii")return t;let n=this.userNumeralSet==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,i=>String.fromCharCode(n+Number(i)))}normalise(t){if(!t)return"";if(this.updateNumeralSet(t),this.userNumeralSet==="ascii")return t;let e=this.userNumeralSet==="arabic-indic"?1632:1776,n=this.userNumeralSet==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return t.replace(n,i=>String.fromCharCode(48+(i.charCodeAt(0)-e)))}isAscii(){return this.userNumeralSet==="ascii"}};var Gt=0,Kt=new Set(L.map(s=>s.iso2)),nt=s=>Kt.has(s),K=class{constructor(t,e={}){this.id=Gt++,M.validateInput(t);let n=ht(e);this.options={...W,...n},pt(this.options),this.ui=new M(t,this.options,this.id),this.i=Ct(),this.numerals=new G,this.promise=this._c(this.options),this.countries=bt(this.options);let{dialCodes:i,dialCodeMaxLen:o,dialCodeToIso2Map:r}=Et(this.countries);this.dialCodes=i,this.dialCodeMaxLen=o,this.dialCodeToIso2Map=r,this.j=new Map(this.countries.map(l=>[l.iso2,l])),this._init()}_getTelInputValue(){let t=this.ui.telInput.value.trim();return this.numerals.normalise(t)}_setTelInputValue(t){let e=this.ui.telInput.value;this.ui.telInput.value=this.numerals.denormalise(t,e)}_c(t){let{initialCountry:e,geoIpLookup:n,loadUtils:i}=t,o=e===O.AUTO&&!!n,r=!!i&&!u.utils,l;o?l=new Promise((d,c)=>{this.b=d,this.c=c}):(l=Promise.resolve(void 0),this.b=()=>{},this.c=()=>{});let a;return r?a=new Promise((d,c)=>{this.d=d,this.e=c}):(a=Promise.resolve(void 0),this.d=()=>{},this.e=()=>{}),Promise.all([l,a])}_init(){this.selectedCountryData={},this.g=new AbortController,this._a(),this.ui.generateMarkup(this.countries),this._d(),this._e(),this._h(),this.options.dropdownAlwaysOpen&&this._l()}_a(){_t(this.countries,this.options),wt(this.countries,this.options),vt(this.countries)}_d(t=!1){let e=this.ui.telInput.getAttribute("value"),n=this.numerals.normalise(e),i=this._getTelInputValue(),r=n&&n.startsWith("+")&&(!i||!i.startsWith("+"))?n:i,l=this._ao(r),a=et(r),{initialCountry:d,geoIpLookup:c}=this.options,I=d===O.AUTO&&c&&!t,_=d.toLowerCase(),f=nt(_);l?a?f?this._aj(_):I||this._aj(ot.ISO2):this._ai(r):f?this._aj(_):I||this._aj(""),r&&this._ah(r)}_e(){this._j(),this.options.allowDropdown&&this._g(),(this.ui.hiddenInput||this.ui.m)&&this.ui.telInput.form&&this._f()}_f(){let t=()=>{this.ui.hiddenInput&&(this.ui.hiddenInput.value=this.getNumber()),this.ui.m&&(this.ui.m.value=this.selectedCountryData.iso2||"")};this.ui.telInput.form?.addEventListener("submit",t,{signal:this.g.signal})}_g(){let t=this.g.signal,e=r=>{this.ui.isDropdownClosed()?this.ui.telInput.focus():r.preventDefault()},n=this.ui.telInput.closest("label");n&&n.addEventListener("click",e,{signal:t});let i=()=>{this.ui.isDropdownClosed()&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",i,{signal:t});let o=r=>{let l=[g.ARROW_UP,g.ARROW_DOWN,g.SPACE,g.ENTER];this.ui.isDropdownClosed()&&l.includes(r.key)&&(r.preventDefault(),r.stopPropagation(),this._l()),r.key===g.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",o,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:n}=this.options;if(t&&!u.utils){let o=()=>{u.attachUtils(t)?.catch(()=>{})};if(u.documentReady())o();else{let r=()=>{o()};window.addEventListener("load",r,{signal:this.g.signal})}}else this.d();e===O.AUTO&&n&&(this.selectedCountryData.iso2?this.b():this._i())}_i(){if(u.autoCountry)this.handleAutoCountry();else if(this.ui.selectedCountryInner.classList.add(h.LOADING),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function")){let t=(n="")=>{this.ui.selectedCountryInner.classList.remove(h.LOADING);let i=n.toLowerCase();nt(i)?(u.autoCountry=i,setTimeout(()=>H("handleAutoCountry"))):H("handleAutoCountryFailure")},e=()=>{this.ui.selectedCountryInner.classList.remove(h.LOADING),H("handleAutoCountryFailure")};this.options.geoIpLookup(t,e)}}_m(){this._l(),this.ui.searchInput.value="+",this.ui.filterCountriesByQuery("")}_j(){this._p(),this._n(),this._o()}_p(){let{strictMode:t,formatAsYouType:e,separateDialCode:n,allowDropdown:i,countrySearch:o}=this.options,r=!1;T.ALPHA_UNICODE.test(this._getTelInputValue())&&(r=!0);let l=a=>{let d=this._getTelInputValue();if(this.i&&a?.data==="+"&&n&&i&&o){let f=this.ui.telInput.selectionStart||0,D=d.substring(0,f-1),E=d.substring(f);this._setTelInputValue(D+E),this._m();return}this._ai(d)&&this._ar();let c=a?.data&&T.NON_PLUS_NUMERIC.test(a.data),m=a?.inputType===z.PASTE&&d;c||m&&!t?r=!0:T.NON_PLUS_NUMERIC.test(d)||(r=!1);let I=a?.detail&&a.detail.isSetNumber,_=this.numerals.isAscii();if(e&&!r&&!I&&_){let f=this.ui.telInput.selectionStart||0,E=d.substring(0,f).replace(T.NON_PLUS_NUMERIC_GLOBAL,"").length,N=a?.inputType===z.DELETE_FWD,y=this._ap(),A=Lt(y,d,u.utils,this.selectedCountryData,n),w=Dt(E,A,f,N);this._setTelInputValue(A),this.ui.telInput.setSelectionRange(w,w)}if(n&&d.startsWith("+")&&this.selectedCountryData.dialCode){let f=tt(d,!0,n,this.selectedCountryData);this._setTelInputValue(f)}};this.ui.telInput.addEventListener("input",l,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:n,countrySearch:i}=this.options;if(t||e){let o=r=>{if(r.key&&r.key.length===1&&!r.altKey&&!r.ctrlKey&&!r.metaKey){if(e&&n&&i&&r.key==="+"){r.preventDefault(),this._m();return}if(t){let l=this._getTelInputValue(),d=!l.startsWith("+")&&this.ui.telInput.selectionStart===0&&r.key==="+",c=this.numerals.normalise(r.key),m=/^[0-9]$/.test(c),I=e?m:d||m,_=this.ui.telInput,f=_.selectionStart,D=_.selectionEnd,E=l.slice(0,f),N=l.slice(D),y=E+r.key+N,A=this._ap(y),w=u.utils.getCoreNumber(A,this.selectedCountryData.iso2),j=this.n&&w.length>this.n,Nt=this._s(A)!==null;(!I||j&&!Nt&&!d)&&r.preventDefault()}}};this.ui.telInput.addEventListener("keydown",o,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let n=this.ui.telInput,i=n.selectionStart,o=n.selectionEnd,r=this._getTelInputValue(),l=r.slice(0,i),a=r.slice(o),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),m=this.numerals.normalise(c),I=i===0&&o>0,_=!r.startsWith("+")||I,f=m.replace(T.NON_PLUS_NUMERIC_GLOBAL,""),D=f.startsWith("+"),E=f.replace(/\+/g,""),N=D&&_?`+${E}`:E,y=l+N+a;if(y.length>5){let w=u.utils.getCoreNumber(y,d);for(;w.length===0&&y.length>0;)y=y.slice(0,-1),w=u.utils.getCoreNumber(y,d);if(!w)return;if(this.n&&w.length>this.n)if(n.selectionEnd===r.length){let j=w.length-this.n;y=y.slice(0,y.length-j)}else return}this._setTelInputValue(y);let A=i+N.length;n.setSelectionRange(A,A),n.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.ui.telInput.addEventListener("paste",t,{signal:this.g.signal})}}_k(t){let e=Number(this.ui.telInput.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}_as(t,e={}){let n=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.ui.telInput.dispatchEvent(n)}_l(){let{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(this.h=new AbortController,this.ui.openDropdown(),!e&&t){let n=()=>this._am();window.addEventListener("scroll",n,{signal:this.h.signal})}this._y(),this._as(R.OPEN_COUNTRY_DROPDOWN)}_y(){let t=this.h.signal;this._z(t),this._aa(t),this.options.dropdownAlwaysOpen||this._ab(t),this._ac(t),this.options.countrySearch&&this._ad(t)}_z(t){let e=n=>{let i=n.target?.closest(`.${h.COUNTRY_ITEM}`);i&&this.ui.highlightListItem(i,!1)};this.ui.countryList.addEventListener("mouseover",e,{signal:t})}_aa(t){let e=n=>{let i=n.target?.closest(`.${h.COUNTRY_ITEM}`);i&&this._al(i)};this.ui.countryList.addEventListener("click",e,{signal:t})}_ab(t){let e=n=>{!!n.target.closest(`#iti-${this.id}__dropdown-content`)||this._am()};setTimeout(()=>{document.documentElement.addEventListener("click",e,{signal:t})},0)}_ac(t){let e="",n=null,i=o=>{[g.ARROW_UP,g.ARROW_DOWN,g.ENTER,g.ESC].includes(o.key)&&(o.preventDefault(),o.stopPropagation(),o.key===g.ARROW_UP||o.key===g.ARROW_DOWN?this.ui.handleUpDownKey(o.key):o.key===g.ENTER?this._ag():o.key===g.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&T.HIDDEN_SEARCH_CHAR.test(o.key)&&(o.stopPropagation(),n&&clearTimeout(n),e+=o.key.toLowerCase(),this._q(e),n=setTimeout(()=>{e=""},k.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",i,{signal:t})}_ad(t){this.ui.searchInput.addEventListener("input",()=>this.ui.handleSearchChange(),{signal:t}),this.ui.k.addEventListener("click",()=>this.ui.handleSearchClear(),{signal:t})}_q(t){let e=yt(this.countries,t);if(e){let n=e.nodeById[this.id];this.ui.highlightListItem(n,!1),this.ui.scrollTo(n)}}_ag(){this.ui.highlightedItem&&this._al(this.ui.highlightedItem)}_ah(t){let{formatOnDisplay:e,nationalMode:n,separateDialCode:i}=this.options,o=t;if(e&&u.utils&&this.selectedCountryData){let r=Z(t),l=n&&!r||!o.startsWith("+")&&!i,{NATIONAL:a,INTERNATIONAL:d}=u.utils.numberFormat,c=l?a:d;o=u.utils.formatNumber(o,this.selectedCountryData.iso2,c)}o=this._aq(o),this._setTelInputValue(o)}_ai(t){let e=this._s(t);return e!==null?this._aj(e):!1}_r(t){let{dialCode:e,nationalPrefix:n}=this.selectedCountryData;if(t.startsWith("+")||!e)return t;let r=n&&t.startsWith(n)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${r}`}_s(t){let e=t.indexOf("+"),n=e?t.substring(e):t,i=this.selectedCountryData.iso2,o=this.selectedCountryData.dialCode;n=this._r(n);let r=this._ao(n,!0),l=S(n);if(r){let a=S(r),d=this.dialCodeToIso2Map[a];if(d.length===1)return d[0]===i?null:d[0];if(!i&&this.f&&d.includes(this.f))return this.f;if(o===U.NANP&&et(l))return null;let{areaCodes:m,priority:I}=this.selectedCountryData;if(m){let N=m.map(y=>`${o}${y}`);for(let y of N)if(l.startsWith(y))return null}let f=m&&!(I===0)&&l.length>a.length,D=i&&d.includes(i)&&!f,E=i===d[0];if(!D&&!E)return d[0]}else if(n.startsWith("+")&&l.length){let a=this.selectedCountryData.dialCode||"";return a&&a.startsWith(l)?null:""}else if((!n||n==="+")&&!i&&this.f)return this.f;return null}_aj(t){let e=this.selectedCountryData.iso2||"";return this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.setCountry(this.selectedCountryData),this._ak(),this._t(),e!==t}_t(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:n}=this.options,{iso2:i}=this.selectedCountryData;if(t&&u.utils)if(i){let o=u.utils.numberType[e],r=u.utils.getExampleNumber(i,!1,o,!0),l=r;for(;u.utils.isPossibleNumber(r,i,n);)l=r,r+="0";let a=u.utils.getCoreNumber(l,i);this.n=a.length,i==="by"&&(this.n=a.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:n,customPlaceholder:i}=this.options,o=t===P.AGGRESSIVE||!this.ui.a&&t===P.POLITE;if(u.utils&&o){let r=u.utils.numberType[e],l=this.selectedCountryData.iso2?u.utils.getExampleNumber(this.selectedCountryData.iso2,n,r):"";l=this._aq(l),typeof i=="function"&&(l=i(l,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",l)}}_al(t){let e=t.dataset[q.COUNTRY_CODE],n=this._aj(e);this._am();let i=t.dataset[q.DIAL_CODE];if(this._an(i),this.options.formatOnDisplay){let o=this._getTelInputValue();this._ah(o)}this.ui.telInput.focus(),n&&this._ar()}_am(t){this.ui.isDropdownClosed()||this.options.dropdownAlwaysOpen&&!t||(this.ui.closeDropdown(),this.h.abort(),this.h=null,this._as(R.CLOSE_COUNTRY_DROPDOWN))}_an(t){let e=this._getTelInputValue(),n=`+${t}`,i;if(e.startsWith("+")){let o=this._ao(e);o?i=e.replace(o,n):i=n,this._setTelInputValue(i)}}_ao(t,e){let n="";if(t.startsWith("+")){let i="",o=!1;for(let r=0;r<t.length;r++){let l=t.charAt(r);if(/[0-9]/.test(l)){if(i+=l,!!!this.dialCodeToIso2Map[i])break;if(this.dialCodes.has(i)){if(n=t.substring(0,r+1),o=!0,!e)break}else e&&o&&(n=t.substring(0,r+1));if(i.length===this.dialCodeMaxLen)break}}}return n}_ap(t){let e=t?this.numerals.normalise(t):this._getTelInputValue(),{dialCode:n}=this.selectedCountryData,i,o=S(e);return this.options.separateDialCode&&!e.startsWith("+")&&n&&o?i=`+${n}`:i="",i+e}_aq(t){let e=!!this._ao(t),n=tt(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(n)}_ar(){this._as(R.COUNTRY_CHANGE)}handleAutoCountry(){if(!this.ui?.telInput){this.b?.();return}this.options.initialCountry===O.AUTO&&u.autoCountry&&(this.f=u.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleAutoCountryFailure(){if(!this.ui?.telInput){this.c?.();return}this._d(!0),this.c()}handleUtils(){if(!this.ui?.telInput){this.d?.();return}if(u.utils){let t=this._getTelInputValue();t&&this._ah(t),this.selectedCountryData.iso2&&(this._ak(),this._t())}this.d()}handleUtilsFailure(t){if(!this.ui?.telInput){this.e?.(t);return}this.e(t)}destroy(){this.ui.telInput&&(this.options.allowDropdown&&this._am(!0),this.g.abort(),this.g=null,this.ui.destroy(),u.instances instanceof Map?u.instances.delete(this.id):delete u.instances[this.id])}getExtension(){return u.utils?u.utils.getExtension(this._ap(),this.selectedCountryData.iso2):""}getNumber(t){if(u.utils){let{iso2:e}=this.selectedCountryData,n=this._ap(),i=u.utils.formatNumber(n,e,t),o=this.ui.telInput.value;return this.numerals.denormalise(i,o)}return""}getNumberType(){return u.utils?u.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):X.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(u.utils){let{iso2:t}=this.selectedCountryData;return u.utils.getValidationError(this._ap(),t)}return X.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===B.DIAL_CODE&&u.utils){let n=this._ap(),i=u.utils.getCoreNumber(n,e);if(i[0]===B.MOBILE_PREFIX&&i.length!==B.MOBILE_CORE_LENGTH)return!1}return this._v(!1)}isValidNumberPrecise(){return this._v(!0)}_u(t){return u.utils?u.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}_v(t){if(!u.utils)return null;let{allowNumberExtensions:e,allowPhonewords:n}=this.options,i=a=>t?this._w(a):this._u(a),o=this._ap();if(!this.selectedCountryData.iso2&&!Z(o)||!i(o))return!1;if(o.search(T.ALPHA_UNICODE)>-1){let a=this.selectedCountryData.iso2;return u.utils.getExtension(o,a)?e:n}return!0}_w(t){return u.utils?u.utils.isValidNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}setCountry(t){let e=t?.toLowerCase();if(!nt(e))throw new Error(`Invalid country code: '${e}'`);let n=this.selectedCountryData.iso2;if(t&&e!==n||!t&&n){if(this._aj(e),this._an(this.selectedCountryData.dialCode),this.options.formatOnDisplay){let o=this._getTelInputValue();this._ah(o)}this._ar()}}setNumber(t){let e=this.numerals.normalise(t),n=this._ai(e);this._ah(e),n&&this._ar(),this._as(R.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.options.placeholderNumberType=t,this._ak()}setDisabled(t){this.ui.telInput.disabled=t,t?this.ui.selectedCountry.setAttribute("disabled","true"):this.ui.selectedCountry.removeAttribute("disabled")}},jt=s=>{if(!u.utils&&!u.startedLoadingUtilsScript){let t;if(typeof s=="function")try{t=Promise.resolve(s())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof s}`));return u.startedLoadingUtilsScript=!0,t.then(e=>{let n=e?.default;if(!n||typeof n!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return u.utils=n,H("handleUtils"),!0}).catch(e=>{throw H("handleUtilsFailure",e),e})}return null},H=(s,...t)=>{Object.values(u.instances).forEach(e=>{let n=e[s];typeof n=="function"&&n.apply(e,t)})},u=Object.assign((s,t)=>{let e=new K(s,t);return u.instances[e.id]=e,s.iti=e,e},{defaults:W,documentReady:()=>document.readyState==="complete",getCountryData:()=>L,getInstance:s=>{let t=s.dataset.intlTelInputId;return t?u.instances[t]:null},instances:{},attachUtils:jt,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.7.4"}),Yt=u;return Mt(zt);})();
|
|
34
|
+
</svg>`;var M=class s{constructor(t,e,n){this.searchKeyupTimer=null;this.inlineDropdownHeight=null;this.dropdownForContainer=null;this.highlightedItem=null;this.selectedItem=null;t.dataset.intlTelInputId=n.toString(),this.telInput=t,this.options=e,this.id=n,this.a=!!t.getAttribute("placeholder"),this.isRTL=!!this.telInput.closest("[dir=rtl]"),this.options.separateDialCode&&(this.o=this.telInput.style.paddingLeft)}static validateInput(t){let e=t?.tagName;if(!(!!t&&typeof t=="object"&&e==="INPUT"&&typeof t.setAttribute=="function")){let i=Object.prototype.toString.call(t);throw new TypeError(`The first argument must be an HTMLInputElement, not ${i}`)}}generateMarkup(t){this.countries=t,this.telInput.classList.add("iti__tel-input"),this.telInput.hasAttribute("autocomplete")||this.telInput.setAttribute("autocomplete","tel"),this.telInput.hasAttribute("inputmode")||this.telInput.setAttribute("inputmode","tel");let e=this._au();this._av(e),e.appendChild(this.telInput),this._ay(),this._az(e)}_au(){let{allowDropdown:t,showFlags:e,containerClass:n,useFullscreenPopup:i}=this.options,o=V({iti:!0,"iti--allow-dropdown":t,"iti--show-flags":e,"iti--inline-dropdown":!i,[n]:!!n}),r=C("div",{class:o});return this.isRTL&&r.setAttribute("dir","ltr"),this.telInput.before(r),r}_av(t){let{allowDropdown:e,separateDialCode:n,showFlags:i}=this.options;if(e||i||n){this.countryContainer=C("div",{class:`iti__country-container ${h.V_HIDE}`},t),e?(this.selectedCountry=C("button",{type:"button",class:"iti__selected-country",[p.EXPANDED]:"false",[p.LABEL]:this.options.i18n.noCountrySelected,[p.HASPOPUP]:"dialog",[p.CONTROLS]:`iti-${this.id}__dropdown-content`},this.countryContainer),this.telInput.disabled&&this.selectedCountry.setAttribute("disabled","true")):this.selectedCountry=C("div",{class:"iti__selected-country"},this.countryContainer);let o=C("div",{class:"iti__selected-country-primary"},this.selectedCountry);this.selectedCountryInner=C("div",{class:h.FLAG},o),e&&(this.dropdownArrow=C("div",{class:"iti__arrow",[p.HIDDEN]:"true"},o)),n&&(this.selectedDialCode=C("div",{class:"iti__selected-dial-code"},this.selectedCountry)),e&&this._aw()}}_maybeEnsureDropdownWidthSet(){let{fixDropdownWidth:t}=this.options;if(t&&!this.dropdownContent.style.width){let e=this.telInput.offsetWidth;e>0&&(this.dropdownContent.style.width=`${e}px`)}}_aw(){let{fixDropdownWidth:t,useFullscreenPopup:e,countrySearch:n,i18n:i,dropdownContainer:o,containerClass:r}=this.options,l=t?"":"iti--flexible-dropdown-width";if(this.dropdownContent=C("div",{id:`iti-${this.id}__dropdown-content`,class:`iti__dropdown-content ${h.HIDE} ${l}`,role:"dialog",[p.MODAL]:"true"}),this.isRTL&&this.dropdownContent.setAttribute("dir","rtl"),n&&this._ax(),this.countryList=C("ul",{class:"iti__country-list",id:`iti-${this.id}__country-listbox`,role:"listbox",[p.LABEL]:i.countryListAriaLabel},this.dropdownContent),this._ba(),n&&this.updateSearchResultsA11yText(),e||(this._maybeEnsureDropdownWidthSet(),this.inlineDropdownHeight=this.getHiddenInlineDropdownHeight(),n&&(this.dropdownContent.style.height=`${this.inlineDropdownHeight}px`)),o){let a=V({iti:!0,"iti--container":!0,"iti--fullscreen-popup":e,"iti--inline-dropdown":!e,[r]:!!r});this.dropdownForContainer=C("div",{class:a}),this.dropdownForContainer.appendChild(this.dropdownContent)}else this.countryContainer.appendChild(this.dropdownContent)}_ax(){let{i18n:t,searchInputClass:e}=this.options,n=C("div",{class:"iti__search-input-wrapper"},this.dropdownContent);this.searchIcon=C("span",{class:"iti__search-icon",[p.HIDDEN]:"true"},n),this.searchIcon.innerHTML=ft(),this.searchInput=C("input",{id:`iti-${this.id}__search-input`,type:"search",class:`iti__search-input ${e}`,placeholder:t.searchPlaceholder,role:"combobox",[p.EXPANDED]:"true",[p.LABEL]:t.searchPlaceholder,[p.CONTROLS]:`iti-${this.id}__country-listbox`,[p.AUTOCOMPLETE]:"list",autocomplete:"off"},n),this.k=C("button",{type:"button",class:`iti__search-clear ${h.HIDE}`,[p.LABEL]:t.clearSearchAriaLabel,tabindex:"-1"},n),this.k.innerHTML=gt(this.id),this.l=C("span",{class:"iti__a11y-text"},this.dropdownContent),this.searchNoResults=C("div",{class:`iti__no-results ${h.HIDE}`,[p.HIDDEN]:"true"},this.dropdownContent),this.searchNoResults.textContent=t.searchEmptyState}_ay(){this.countryContainer&&(this.updateInputPadding(),this.countryContainer.classList.remove(h.V_HIDE))}_az(t){let{hiddenInput:e}=this.options;if(e){let n=this.telInput.getAttribute("name")||"",i=e(n);if(i.phone){let o=this.telInput.form?.querySelector(`input[name="${i.phone}"]`);o?this.hiddenInput=o:(this.hiddenInput=C("input",{type:"hidden",name:i.phone}),t.appendChild(this.hiddenInput))}if(i.country){let o=this.telInput.form?.querySelector(`input[name="${i.country}"]`);o?this.m=o:(this.m=C("input",{type:"hidden",name:i.country}),t.appendChild(this.m))}}}_ba(){let t=document.createDocumentFragment();for(let e=0;e<this.countries.length;e++){let n=this.countries[e],i=V({[h.COUNTRY_ITEM]:!0}),o=C("li",{id:`iti-${this.id}__item-${n.iso2}`,class:i,tabindex:"-1",role:"option",[p.SELECTED]:"false"});o.dataset.dialCode=n.dialCode,o.dataset.countryCode=n.iso2,n.nodeById[this.id]=o,this.options.showFlags&&C("div",{class:`${h.FLAG} iti__${n.iso2}`},o);let r=C("span",{class:"iti__country-name"},o);r.textContent=`${n.name} `;let l=C("span",{class:"iti__dial-code"},r);this.isRTL&&l.setAttribute("dir","ltr"),l.textContent=`(+${n.dialCode})`,t.appendChild(o)}this.countryList.appendChild(t)}updateInputPadding(){if(this.selectedCountry){let t=this.options.separateDialCode?v.SANE_SELECTED_WITH_DIAL_WIDTH:v.SANE_SELECTED_NO_DIAL_WIDTH,n=(this.selectedCountry.offsetWidth||this._bb()||t)+v.INPUT_PADDING_EXTRA_LEFT;this.telInput.style.paddingLeft=`${n}px`}}static getBody(){let t;try{t=window.top.document.body}catch{t=document.body}return t}_bb(){if(this.telInput.parentNode){let t=s.getBody(),e=this.telInput.parentNode.cloneNode(!1);e.style.visibility="hidden",t.appendChild(e);let n=this.countryContainer.cloneNode();e.appendChild(n);let i=this.selectedCountry.cloneNode(!0);n.appendChild(i);let o=i.offsetWidth;return t.removeChild(e),o}return 0}getHiddenInlineDropdownHeight(){let t=s.getBody();this.dropdownContent.classList.remove(h.HIDE);let e=C("div",{class:"iti iti--inline-dropdown"});e.appendChild(this.dropdownContent),e.style.visibility="hidden",t.appendChild(e);let n=this.dropdownContent.offsetHeight;return t.removeChild(e),e.style.visibility="",this.dropdownContent.classList.add(h.HIDE),n>0?n:v.SANE_DROPDOWN_HEIGHT}updateSearchResultsA11yText(){let{i18n:t}=this.options,e=this.countryList.childElementCount;this.l.textContent=t.searchSummaryAria(e)}filterCountriesByQuery(t){let e;t===""?e=this.countries:e=mt(this.countries,t),this.filterCountries(e)}doFilter(){let t=this.searchInput.value.trim();this.filterCountriesByQuery(t),this.searchInput.value?this.k.classList.remove(h.HIDE):this.k.classList.add(h.HIDE)}handleSearchChange(){this.searchKeyupTimer&&clearTimeout(this.searchKeyupTimer),this.searchKeyupTimer=setTimeout(()=>{this.doFilter(),this.searchKeyupTimer=null},k.SEARCH_DEBOUNCE_MS)}handleSearchClear(){this.searchInput.value="",this.searchInput.focus(),this.doFilter()}scrollTo(t){let e=this.countryList,n=document.documentElement.scrollTop,i=e.offsetHeight,o=e.getBoundingClientRect().top+n,r=o+i,l=t.offsetHeight,a=t.getBoundingClientRect().top+n,d=a+l,c=a-o+e.scrollTop;if(a<o)e.scrollTop=c;else if(d>r){let m=i-l;e.scrollTop=c-m}}highlightListItem(t,e){let n=this.highlightedItem;if(n&&n.classList.remove(h.HIGHLIGHT),this.highlightedItem=t,this.highlightedItem&&(this.highlightedItem.classList.add(h.HIGHLIGHT),this.options.countrySearch)){let i=this.highlightedItem.getAttribute("id")||"";this.searchInput.setAttribute(p.ACTIVE_DESCENDANT,i)}e&&this.highlightedItem.focus()}handleUpDownKey(t){let e=t===g.ARROW_UP?this.highlightedItem?.previousElementSibling:this.highlightedItem?.nextElementSibling;!e&&this.countryList.childElementCount>1&&(e=t===g.ARROW_UP?this.countryList.lastElementChild:this.countryList.firstElementChild),e&&(this.scrollTo(e),this.highlightListItem(e,!1))}updateSelectedItem(t){if(this.selectedItem&&this.selectedItem.dataset.countryCode!==t&&(this.selectedItem.setAttribute(p.SELECTED,"false"),this.selectedItem.querySelector(".iti__country-check")?.remove(),this.selectedItem=null),t&&!this.selectedItem){let e=this.countryList.querySelector(`[data-country-code="${t}"]`);if(e){e.setAttribute(p.SELECTED,"true");let n=C("span",{class:"iti__country-check",[p.HIDDEN]:"true"},e);n.innerHTML=It(),this.selectedItem=e}}}filterCountries(t){this.countryList.innerHTML="";let e=!0;for(let n of t){let i=n.nodeById[this.id];i&&(this.countryList.appendChild(i),e&&(this.highlightListItem(i,!1),e=!1))}e?(this.highlightListItem(null,!1),this.searchNoResults&&this.searchNoResults.classList.remove(h.HIDE)):this.searchNoResults&&this.searchNoResults.classList.add(h.HIDE),this.countryList.scrollTop=0,this.updateSearchResultsA11yText()}destroy(){this.telInput.iti=void 0,delete this.telInput.dataset.intlTelInputId,this.options.separateDialCode&&(this.telInput.style.paddingLeft=this.o);let t=this.telInput.parentNode;t.before(this.telInput),t.remove(),this.telInput=null,this.countryContainer=null,this.selectedCountry=null,this.selectedCountryInner=null,this.selectedDialCode=null,this.dropdownArrow=null,this.dropdownContent=null,this.searchInput=null,this.searchIcon=null,this.k=null,this.searchNoResults=null,this.l=null,this.countryList=null,this.dropdownForContainer=null,this.hiddenInput=null,this.m=null,this.highlightedItem=null,this.selectedItem=null;for(let e of this.countries)delete e.nodeById[this.id];this.countries=null}openDropdown(){let{countrySearch:t,dropdownAlwaysOpen:e,dropdownContainer:n}=this.options;if(this._maybeEnsureDropdownWidthSet(),n)this._handleDropdownContainer();else{let i=this._shouldPositionInlineDropdownBelowInput(),o=this.telInput.offsetHeight+v.DROPDOWN_MARGIN;i?this.dropdownContent.style.top=`${o}px`:this.dropdownContent.style.bottom=`${o}px`}if(this.dropdownContent.classList.remove(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"true"),t){let i=this.countryList.firstElementChild;i&&(this.highlightListItem(i,!1),this.countryList.scrollTop=0),e||this.searchInput.focus()}this.dropdownArrow.classList.add(h.ARROW_UP)}closeDropdown(){let{countrySearch:t,dropdownContainer:e}=this.options;this.dropdownContent.classList.add(h.HIDE),this.selectedCountry.setAttribute(p.EXPANDED,"false"),t&&(this.searchInput.removeAttribute(p.ACTIVE_DESCENDANT),this.highlightedItem&&(this.highlightedItem.classList.remove(h.HIGHLIGHT),this.highlightedItem=null)),this.dropdownArrow.classList.remove(h.ARROW_UP),e?(this.dropdownForContainer.remove(),this.dropdownForContainer.style.top="",this.dropdownForContainer.style.bottom=""):(this.dropdownContent.style.top="",this.dropdownContent.style.bottom="")}_shouldPositionInlineDropdownBelowInput(){if(this.options.dropdownAlwaysOpen)return!0;let t=this.telInput.getBoundingClientRect(),e=t.top,n=window.innerHeight-t.bottom;return n>=this.inlineDropdownHeight||n>=e}_handleDropdownContainer(){let{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(t){if(!e){let n=this.telInput.getBoundingClientRect();this.dropdownForContainer.style.left=`${n.left}px`,this._shouldPositionInlineDropdownBelowInput()?this.dropdownForContainer.style.top=`${n.bottom+v.DROPDOWN_MARGIN}px`:(this.dropdownForContainer.style.top="unset",this.dropdownForContainer.style.bottom=`${window.innerHeight-n.top+v.DROPDOWN_MARGIN}px`)}t.appendChild(this.dropdownForContainer)}}isDropdownClosed(){return this.dropdownContent.classList.contains(h.HIDE)}setCountry(t){let{allowDropdown:e,showFlags:n,separateDialCode:i,i18n:o}=this.options,{name:r,dialCode:l,iso2:a=""}=t;if(e&&this.updateSelectedItem(a),this.selectedCountry){let d=a&&n?`${h.FLAG} iti__${a}`:`${h.FLAG} ${h.GLOBE}`,c,m,I;a?(m=r,c=o.selectedCountryAriaLabel.replace("${countryName}",r).replace("${dialCode}",`+${l}`),I=n?"":J()):(m=o.noCountrySelected,c=o.noCountrySelected,I=J()),this.selectedCountryInner.className=d,this.selectedCountry.setAttribute("title",m),this.selectedCountry.setAttribute(p.LABEL,c),this.selectedCountryInner.innerHTML=I}if(i){let d=l?`+${l}`:"";this.selectedDialCode.textContent=d,this.updateInputPadding()}}};var bt=s=>{let{onlyCountries:t,excludeCountries:e}=s;if(t?.length){let n=t.map(i=>i.toLowerCase());return L.filter(i=>n.includes(i.iso2))}else if(e?.length){let n=e.map(i=>i.toLowerCase());return L.filter(i=>!n.includes(i.iso2))}return L},_t=(s,t)=>{let{countryNameLocale:e,i18n:n}=t,i;try{typeof Intl<"u"&&typeof Intl.DisplayNames=="function"?i=new Intl.DisplayNames(e,{type:"region"}):i=null}catch(o){console.error(o),i=null}for(let o of s)o.name=n[o.iso2]||i?.of(o.iso2.toUpperCase())||""},Et=s=>{let t=new Set,e=0,n={},i=(r,l)=>{if(!r||!l)return;l.length>e&&(e=l.length),n.hasOwnProperty(l)||(n[l]=[]);let a=n[l];a.includes(r)||a.push(r)},o=[...s].sort((r,l)=>r.priority-l.priority);for(let r of o){t.has(r.dialCode)||t.add(r.dialCode);for(let l=1;l<r.dialCode.length;l++){let a=r.dialCode.substring(0,l);i(r.iso2,a)}if(i(r.iso2,r.dialCode),r.areaCodes){let l=n[r.dialCode][0];for(let a of r.areaCodes){for(let d=1;d<a.length;d++){let c=a.substring(0,d),m=r.dialCode+c;i(l,m),i(r.iso2,m)}i(r.iso2,r.dialCode+a)}}}return{dialCodes:t,dialCodeMaxLen:e,dialCodeToIso2Map:n}},wt=(s,t)=>{t.countryOrder&&(t.countryOrder=t.countryOrder.map(e=>e.toLowerCase())),s.sort((e,n)=>{let{countryOrder:i}=t;if(i){let o=i.indexOf(e.iso2),r=i.indexOf(n.iso2),l=o>-1,a=r>-1;if(l||a)return l&&a?o-r:l?-1:1}return e.name.localeCompare(n.name)})},vt=s=>{for(let t of s)t.normalisedName=$(t.name),t.initials=t.normalisedName.split(/[^a-z]/).map(e=>e[0]).join(""),t.dialCodePlus=`+${t.dialCode}`};var $t=new Set(["800","808","870","881","882","883","888","979"]),Z=s=>{let t=S(s).slice(0,3);return s.startsWith("+")&&$t.has(t)};var tt=(s,t,e,n)=>{let i=s;if(e&&t){let o=`+${n.dialCode}`,r=i[o.length]===" "||i[o.length]==="-"?o.length+1:o.length;i=i.substring(r)}return i},Lt=(s,t,e,n,i)=>{let o=e?e.formatNumberAsYouType(s,n.iso2):s,{dialCode:r}=n;return i&&t.charAt(0)!=="+"&&o.includes(`+${r}`)?(o.split(`+${r}`)[1]||"").trim():o};var Dt=(s,t,e,n)=>{if(e===0&&!n)return 0;let i=0;for(let o=0;o<t.length;o++){if(/[+0-9]/.test(t[o])&&i++,i===s&&!n)return o+1;if(n&&i===s+1)return o}return t.length};var Vt=["800","822","833","844","855","866","877","880","881","882","883","884","885","886","887","888","889"],et=s=>{let t=S(s);if(t.startsWith(U.NANP)&&t.length>=4){let e=t.substring(1,4);return Vt.includes(e)}return!1};var G=class{constructor(){}updateNumeralSet(t){/[\u0660-\u0669]/.test(t)?this.userNumeralSet="arabic-indic":/[\u06F0-\u06F9]/.test(t)?this.userNumeralSet="persian":this.userNumeralSet="ascii"}denormalise(t,e){if(this.userNumeralSet||this.updateNumeralSet(e),this.userNumeralSet==="ascii")return t;let n=this.userNumeralSet==="arabic-indic"?1632:1776;return t.replace(/[0-9]/g,i=>String.fromCharCode(n+Number(i)))}normalise(t){if(!t)return"";if(this.updateNumeralSet(t),this.userNumeralSet==="ascii")return t;let e=this.userNumeralSet==="arabic-indic"?1632:1776,n=this.userNumeralSet==="arabic-indic"?/[\u0660-\u0669]/g:/[\u06F0-\u06F9]/g;return t.replace(n,i=>String.fromCharCode(48+(i.charCodeAt(0)-e)))}isAscii(){return this.userNumeralSet==="ascii"}};var Gt=0,Kt=new Set(L.map(s=>s.iso2)),nt=s=>Kt.has(s),K=class{constructor(t,e={}){this.id=Gt++,M.validateInput(t);let n=ht(e);this.options={...W,...n},pt(this.options),this.ui=new M(t,this.options,this.id),this.i=Ct(),this.numerals=new G,this.promise=this._c(this.options),this.countries=bt(this.options);let{dialCodes:i,dialCodeMaxLen:o,dialCodeToIso2Map:r}=Et(this.countries);this.dialCodes=i,this.dialCodeMaxLen=o,this.dialCodeToIso2Map=r,this.j=new Map(this.countries.map(l=>[l.iso2,l])),this._init()}_getTelInputValue(){let t=this.ui.telInput.value.trim();return this.numerals.normalise(t)}_setTelInputValue(t){let e=this.ui.telInput.value;this.ui.telInput.value=this.numerals.denormalise(t,e)}_c(t){let{initialCountry:e,geoIpLookup:n,loadUtils:i}=t,o=e===O.AUTO&&!!n,r=!!i&&!u.utils,l;o?l=new Promise((d,c)=>{this.b=d,this.c=c}):(l=Promise.resolve(void 0),this.b=()=>{},this.c=()=>{});let a;return r?a=new Promise((d,c)=>{this.d=d,this.e=c}):(a=Promise.resolve(void 0),this.d=()=>{},this.e=()=>{}),Promise.all([l,a])}_init(){this.selectedCountryData={},this.g=new AbortController,this._a(),this.ui.generateMarkup(this.countries),this._d(),this._e(),this._h(),this.options.dropdownAlwaysOpen&&this._l()}_a(){_t(this.countries,this.options),wt(this.countries,this.options),vt(this.countries)}_d(t=!1){let e=this.ui.telInput.getAttribute("value"),n=this.numerals.normalise(e),i=this._getTelInputValue(),r=n&&n.startsWith("+")&&(!i||!i.startsWith("+"))?n:i,l=this._ao(r),a=et(r),{initialCountry:d,geoIpLookup:c}=this.options,I=d===O.AUTO&&c&&!t,_=d.toLowerCase(),f=nt(_);l?a?f?this._aj(_):I||this._aj(ot.ISO2):this._ai(r):f?this._aj(_):I||this._aj(""),r&&this._ah(r)}_e(){this._j(),this.options.allowDropdown&&this._g(),(this.ui.hiddenInput||this.ui.m)&&this.ui.telInput.form&&this._f()}_f(){let t=()=>{this.ui.hiddenInput&&(this.ui.hiddenInput.value=this.getNumber()),this.ui.m&&(this.ui.m.value=this.selectedCountryData.iso2||"")};this.ui.telInput.form?.addEventListener("submit",t,{signal:this.g.signal})}_g(){let t=this.g.signal,e=r=>{this.ui.isDropdownClosed()?this.ui.telInput.focus():r.preventDefault()},n=this.ui.telInput.closest("label");n&&n.addEventListener("click",e,{signal:t});let i=()=>{this.ui.isDropdownClosed()&&!this.ui.telInput.disabled&&!this.ui.telInput.readOnly&&this._l()};this.ui.selectedCountry.addEventListener("click",i,{signal:t});let o=r=>{let l=[g.ARROW_UP,g.ARROW_DOWN,g.SPACE,g.ENTER];this.ui.isDropdownClosed()&&l.includes(r.key)&&(r.preventDefault(),r.stopPropagation(),this._l()),r.key===g.TAB&&this._am()};this.ui.countryContainer.addEventListener("keydown",o,{signal:t})}_h(){let{loadUtils:t,initialCountry:e,geoIpLookup:n}=this.options;if(t&&!u.utils){let o=()=>{u.attachUtils(t)?.catch(()=>{})};if(u.documentReady())o();else{let r=()=>{o()};window.addEventListener("load",r,{signal:this.g.signal})}}else this.d();e===O.AUTO&&n&&(this.selectedCountryData.iso2?this.b():this._i())}_i(){if(u.autoCountry)this.handleAutoCountry();else if(this.ui.selectedCountryInner.classList.add(h.LOADING),!u.startedLoadingAutoCountry&&(u.startedLoadingAutoCountry=!0,typeof this.options.geoIpLookup=="function")){let t=(n="")=>{this.ui.selectedCountryInner.classList.remove(h.LOADING);let i=n.toLowerCase();nt(i)?(u.autoCountry=i,setTimeout(()=>H("handleAutoCountry"))):H("handleAutoCountryFailure")},e=()=>{this.ui.selectedCountryInner.classList.remove(h.LOADING),H("handleAutoCountryFailure")};this.options.geoIpLookup(t,e)}}_m(){this._l(),this.ui.searchInput.value="+",this.ui.filterCountriesByQuery("")}_j(){this._p(),this._n(),this._o()}_p(){let{strictMode:t,formatAsYouType:e,separateDialCode:n,allowDropdown:i,countrySearch:o}=this.options,r=!1;T.ALPHA_UNICODE.test(this._getTelInputValue())&&(r=!0);let l=a=>{let d=this._getTelInputValue();if(this.i&&a?.data==="+"&&n&&i&&o){let f=this.ui.telInput.selectionStart||0,D=d.substring(0,f-1),E=d.substring(f);this._setTelInputValue(D+E),this._m();return}this._ai(d)&&this._ar();let c=a?.data&&T.NON_PLUS_NUMERIC.test(a.data),m=a?.inputType===z.PASTE&&d;c||m&&!t?r=!0:T.NON_PLUS_NUMERIC.test(d)||(r=!1);let I=a?.detail&&a.detail.isSetNumber,_=this.numerals.isAscii();if(e&&!r&&!I&&_){let f=this.ui.telInput.selectionStart||0,E=d.substring(0,f).replace(T.NON_PLUS_NUMERIC_GLOBAL,"").length,N=a?.inputType===z.DELETE_FWD,y=this._ap(),A=Lt(y,d,u.utils,this.selectedCountryData,n),w=Dt(E,A,f,N);this._setTelInputValue(A),this.ui.telInput.setSelectionRange(w,w)}if(n&&d.startsWith("+")&&this.selectedCountryData.dialCode){let f=tt(d,!0,n,this.selectedCountryData);this._setTelInputValue(f)}};this.ui.telInput.addEventListener("input",l,{signal:this.g.signal})}_n(){let{strictMode:t,separateDialCode:e,allowDropdown:n,countrySearch:i}=this.options;if(t||e){let o=r=>{if(r.key&&r.key.length===1&&!r.altKey&&!r.ctrlKey&&!r.metaKey){if(e&&n&&i&&r.key==="+"){r.preventDefault(),this._m();return}if(t){let l=this._getTelInputValue(),d=!l.startsWith("+")&&this.ui.telInput.selectionStart===0&&r.key==="+",c=this.numerals.normalise(r.key),m=/^[0-9]$/.test(c),I=e?m:d||m,_=this.ui.telInput,f=_.selectionStart,D=_.selectionEnd,E=l.slice(0,f),N=l.slice(D),y=E+r.key+N,A=this._ap(y),w=u.utils.getCoreNumber(A,this.selectedCountryData.iso2),j=this.n&&w.length>this.n,Nt=this._s(A)!==null;(!I||j&&!Nt&&!d)&&r.preventDefault()}}};this.ui.telInput.addEventListener("keydown",o,{signal:this.g.signal})}}_o(){if(this.options.strictMode){let t=e=>{e.preventDefault();let n=this.ui.telInput,i=n.selectionStart,o=n.selectionEnd,r=this._getTelInputValue(),l=r.slice(0,i),a=r.slice(o),d=this.selectedCountryData.iso2,c=e.clipboardData.getData("text"),m=this.numerals.normalise(c),I=i===0&&o>0,_=!r.startsWith("+")||I,f=m.replace(T.NON_PLUS_NUMERIC_GLOBAL,""),D=f.startsWith("+"),E=f.replace(/\+/g,""),N=D&&_?`+${E}`:E,y=l+N+a;if(y.length>5){let w=u.utils.getCoreNumber(y,d);for(;w.length===0&&y.length>0;)y=y.slice(0,-1),w=u.utils.getCoreNumber(y,d);if(!w)return;if(this.n&&w.length>this.n)if(n.selectionEnd===r.length){let j=w.length-this.n;y=y.slice(0,y.length-j)}else return}this._setTelInputValue(y);let A=i+N.length;n.setSelectionRange(A,A),n.dispatchEvent(new InputEvent("input",{bubbles:!0}))};this.ui.telInput.addEventListener("paste",t,{signal:this.g.signal})}}_k(t){let e=Number(this.ui.telInput.getAttribute("maxlength"));return e&&t.length>e?t.substring(0,e):t}_as(t,e={}){let n=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:e});this.ui.telInput.dispatchEvent(n)}_l(){let{dropdownContainer:t,useFullscreenPopup:e}=this.options;if(this.h=new AbortController,this.ui.openDropdown(),!e&&t){let n=()=>this._am();window.addEventListener("scroll",n,{signal:this.h.signal})}this._y(),this._as(R.OPEN_COUNTRY_DROPDOWN)}_y(){let t=this.h.signal;this._z(t),this._aa(t),this.options.dropdownAlwaysOpen||this._ab(t),this._ac(t),this.options.countrySearch&&this._ad(t)}_z(t){let e=n=>{let i=n.target?.closest(`.${h.COUNTRY_ITEM}`);i&&this.ui.highlightListItem(i,!1)};this.ui.countryList.addEventListener("mouseover",e,{signal:t})}_aa(t){let e=n=>{let i=n.target?.closest(`.${h.COUNTRY_ITEM}`);i&&this._al(i)};this.ui.countryList.addEventListener("click",e,{signal:t})}_ab(t){let e=n=>{!!n.target.closest(`#iti-${this.id}__dropdown-content`)||this._am()};setTimeout(()=>{document.documentElement.addEventListener("click",e,{signal:t})},0)}_ac(t){let e="",n=null,i=o=>{[g.ARROW_UP,g.ARROW_DOWN,g.ENTER,g.ESC].includes(o.key)&&(o.preventDefault(),o.stopPropagation(),o.key===g.ARROW_UP||o.key===g.ARROW_DOWN?this.ui.handleUpDownKey(o.key):o.key===g.ENTER?this._ag():o.key===g.ESC&&(this._am(),this.ui.selectedCountry.focus())),!this.options.countrySearch&&T.HIDDEN_SEARCH_CHAR.test(o.key)&&(o.stopPropagation(),n&&clearTimeout(n),e+=o.key.toLowerCase(),this._q(e),n=setTimeout(()=>{e=""},k.HIDDEN_SEARCH_RESET_MS))};document.addEventListener("keydown",i,{signal:t})}_ad(t){this.ui.searchInput.addEventListener("input",()=>this.ui.handleSearchChange(),{signal:t}),this.ui.k.addEventListener("click",()=>this.ui.handleSearchClear(),{signal:t})}_q(t){let e=yt(this.countries,t);if(e){let n=e.nodeById[this.id];this.ui.highlightListItem(n,!1),this.ui.scrollTo(n)}}_ag(){this.ui.highlightedItem&&this._al(this.ui.highlightedItem)}_ah(t){let{formatOnDisplay:e,nationalMode:n,separateDialCode:i}=this.options,o=t;if(e&&u.utils&&this.selectedCountryData){let r=Z(t),l=n&&!r||!o.startsWith("+")&&!i,{NATIONAL:a,INTERNATIONAL:d}=u.utils.numberFormat,c=l?a:d;o=u.utils.formatNumber(o,this.selectedCountryData.iso2,c)}o=this._aq(o),this._setTelInputValue(o)}_ai(t){let e=this._s(t);return e!==null?this._aj(e):!1}_r(t){let{dialCode:e,nationalPrefix:n}=this.selectedCountryData;if(t.startsWith("+")||!e)return t;let r=n&&t.startsWith(n)&&!this.options.separateDialCode?t.substring(1):t;return`+${e}${r}`}_s(t){let e=t.indexOf("+"),n=e?t.substring(e):t,i=this.selectedCountryData.iso2,o=this.selectedCountryData.dialCode;n=this._r(n);let r=this._ao(n,!0),l=S(n);if(r){let a=S(r),d=this.dialCodeToIso2Map[a];if(d.length===1)return d[0]===i?null:d[0];if(!i&&this.f&&d.includes(this.f))return this.f;if(o===U.NANP&&et(l))return null;let{areaCodes:m,priority:I}=this.selectedCountryData;if(m){let N=m.map(y=>`${o}${y}`);for(let y of N)if(l.startsWith(y))return null}let f=m&&!(I===0)&&l.length>a.length,D=i&&d.includes(i)&&!f,E=i===d[0];if(!D&&!E)return d[0]}else if(n.startsWith("+")&&l.length){let a=this.selectedCountryData.dialCode||"";return a&&a.startsWith(l)?null:""}else if((!n||n==="+")&&!i&&this.f)return this.f;return null}_aj(t){let e=this.selectedCountryData.iso2||"";return this.selectedCountryData=t?this.j.get(t):{},this.selectedCountryData.iso2&&(this.f=this.selectedCountryData.iso2),this.ui.setCountry(this.selectedCountryData),this._ak(),this._t(),e!==t}_t(){let{strictMode:t,placeholderNumberType:e,allowedNumberTypes:n}=this.options,{iso2:i}=this.selectedCountryData;if(t&&u.utils)if(i){let o=u.utils.numberType[e],r=u.utils.getExampleNumber(i,!1,o,!0),l=r;for(;u.utils.isPossibleNumber(r,i,n);)l=r,r+="0";let a=u.utils.getCoreNumber(l,i);this.n=a.length,i==="by"&&(this.n=a.length+1)}else this.n=null}_ak(){let{autoPlaceholder:t,placeholderNumberType:e,nationalMode:n,customPlaceholder:i}=this.options,o=t===P.AGGRESSIVE||!this.ui.a&&t===P.POLITE;if(u.utils&&o){let r=u.utils.numberType[e],l=this.selectedCountryData.iso2?u.utils.getExampleNumber(this.selectedCountryData.iso2,n,r):"";l=this._aq(l),typeof i=="function"&&(l=i(l,this.selectedCountryData)),this.ui.telInput.setAttribute("placeholder",l)}}_al(t){let e=t.dataset[q.COUNTRY_CODE],n=this._aj(e);this._am();let i=t.dataset[q.DIAL_CODE];if(this._an(i),this.options.formatOnDisplay){let o=this._getTelInputValue();this._ah(o)}this.ui.telInput.focus(),n&&this._ar()}_am(t){this.ui.isDropdownClosed()||this.options.dropdownAlwaysOpen&&!t||(this.ui.closeDropdown(),this.h.abort(),this.h=null,this._as(R.CLOSE_COUNTRY_DROPDOWN))}_an(t){let e=this._getTelInputValue(),n=`+${t}`,i;if(e.startsWith("+")){let o=this._ao(e);o?i=e.replace(o,n):i=n,this._setTelInputValue(i)}}_ao(t,e){let n="";if(t.startsWith("+")){let i="",o=!1;for(let r=0;r<t.length;r++){let l=t.charAt(r);if(/[0-9]/.test(l)){if(i+=l,!!!this.dialCodeToIso2Map[i])break;if(this.dialCodes.has(i)){if(n=t.substring(0,r+1),o=!0,!e)break}else e&&o&&(n=t.substring(0,r+1));if(i.length===this.dialCodeMaxLen)break}}}return n}_ap(t){let e=t?this.numerals.normalise(t):this._getTelInputValue(),{dialCode:n}=this.selectedCountryData,i,o=S(e);return this.options.separateDialCode&&!e.startsWith("+")&&n&&o?i=`+${n}`:i="",i+e}_aq(t){let e=!!this._ao(t),n=tt(t,e,this.options.separateDialCode,this.selectedCountryData);return this._k(n)}_ar(){this._as(R.COUNTRY_CHANGE)}handleAutoCountry(){if(!this.ui?.telInput){this.b?.();return}this.options.initialCountry===O.AUTO&&u.autoCountry&&(this.f=u.autoCountry,this.selectedCountryData.iso2||this.ui.selectedCountryInner.classList.contains(h.GLOBE)||this.setCountry(this.f),this.b())}handleAutoCountryFailure(){if(!this.ui?.telInput){this.c?.();return}this._d(!0),this.c()}handleUtils(){if(!this.ui?.telInput){this.d?.();return}if(u.utils){let t=this._getTelInputValue();t&&this._ah(t),this.selectedCountryData.iso2&&(this._ak(),this._t())}this.d()}handleUtilsFailure(t){if(!this.ui?.telInput){this.e?.(t);return}this.e(t)}destroy(){this.ui.telInput&&(this.options.allowDropdown&&this._am(!0),this.g.abort(),this.g=null,this.ui.destroy(),u.instances instanceof Map?u.instances.delete(this.id):delete u.instances[this.id])}getIsValid(){return!!this.ui?.telInput}getExtension(){return u.utils&&this.ui.telInput?u.utils.getExtension(this._ap(),this.selectedCountryData.iso2):""}getNumber(t){if(u.utils&&this.ui.telInput){let{iso2:e}=this.selectedCountryData,n=this._ap(),i=u.utils.formatNumber(n,e,t),o=this.ui.telInput.value;return this.numerals.denormalise(i,o)}return""}getNumberType(){return u.utils&&this.ui.telInput?u.utils.getNumberType(this._ap(),this.selectedCountryData.iso2):X.UNKNOWN_NUMBER_TYPE}getSelectedCountryData(){return this.selectedCountryData}getValidationError(){if(u.utils&&this.ui.telInput){let{iso2:t}=this.selectedCountryData;return u.utils.getValidationError(this._ap(),t)}return X.UNKNOWN_VALIDATION_ERROR}isValidNumber(){let{dialCode:t,iso2:e}=this.selectedCountryData;if(t===B.DIAL_CODE&&u.utils&&this.ui.telInput){let n=this._ap(),i=u.utils.getCoreNumber(n,e);if(i&&i[0]===B.MOBILE_PREFIX&&i.length!==B.MOBILE_CORE_LENGTH)return!1}return this._v(!1)}isValidNumberPrecise(){return this._v(!0)}_u(t){return u.utils?u.utils.isPossibleNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}_v(t){if(!u.utils||!this.ui.telInput)return null;let{allowNumberExtensions:e,allowPhonewords:n}=this.options,i=a=>t?this._w(a):this._u(a),o=this._ap();if(!this.selectedCountryData.iso2&&!Z(o)||!i(o))return!1;if(o.search(T.ALPHA_UNICODE)>-1){let a=this.selectedCountryData.iso2;return u.utils.getExtension(o,a)?e:n}return!0}_w(t){return u.utils?u.utils.isValidNumber(t,this.selectedCountryData.iso2,this.options.allowedNumberTypes):null}setCountry(t){if(!this.ui.telInput)return;let e=t?.toLowerCase();if(!nt(e))throw new Error(`Invalid country code: '${e}'`);let n=this.selectedCountryData.iso2;if(t&&e!==n||!t&&n){if(this._aj(e),this._an(this.selectedCountryData.dialCode),this.options.formatOnDisplay){let o=this._getTelInputValue();this._ah(o)}this._ar()}}setNumber(t){if(!this.ui.telInput)return;let e=this.numerals.normalise(t),n=this._ai(e);this._ah(e),n&&this._ar(),this._as(R.INPUT,{isSetNumber:!0})}setPlaceholderNumberType(t){this.ui.telInput&&(this.options.placeholderNumberType=t,this._ak())}setDisabled(t){this.ui.telInput&&(this.ui.telInput.disabled=t,t?this.ui.selectedCountry.setAttribute("disabled","true"):this.ui.selectedCountry.removeAttribute("disabled"))}},jt=s=>{if(!u.utils&&!u.startedLoadingUtilsScript){let t;if(typeof s=="function")try{t=Promise.resolve(s())}catch(e){return Promise.reject(e)}else return Promise.reject(new TypeError(`The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof s}`));return u.startedLoadingUtilsScript=!0,t.then(e=>{let n=e?.default;if(!n||typeof n!="object")throw new TypeError("The loader function passed to attachUtils did not resolve to a module object with utils as its default export.");return u.utils=n,H("handleUtils"),!0}).catch(e=>{throw H("handleUtilsFailure",e),e})}return null},H=(s,...t)=>{Object.values(u.instances).forEach(e=>{let n=e[s];typeof n=="function"&&n.apply(e,t)})},u=Object.assign((s,t)=>{let e=new K(s,t);return u.instances[e.id]=e,s.iti=e,e},{defaults:W,documentReady:()=>document.readyState==="complete",getCountryData:()=>L,getInstance:s=>{let t=s.dataset.intlTelInputId;return t?u.instances[t]:null},instances:{},attachUtils:jt,startedLoadingUtilsScript:!1,startedLoadingAutoCountry:!1,version:"26.7.5"}),Yt=u;return Mt(zt);})();
|
|
35
35
|
|
|
36
36
|
// UMD
|
|
37
37
|
return factoryOutput.default;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* International Telephone Input v26.7.
|
|
2
|
+
* International Telephone Input v26.7.5
|
|
3
3
|
* https://github.com/jackocnr/intl-tel-input.git
|
|
4
4
|
* Licensed under the MIT license
|
|
5
5
|
*/
|
|
@@ -4078,9 +4078,13 @@ var factoryOutput = (() => {
|
|
|
4078
4078
|
delete intlTelInput.instances[this.id];
|
|
4079
4079
|
}
|
|
4080
4080
|
}
|
|
4081
|
+
// check if the instance is still valid (not destroyed/unmounted)
|
|
4082
|
+
getIsValid() {
|
|
4083
|
+
return !!this.ui?.telInput;
|
|
4084
|
+
}
|
|
4081
4085
|
//* Get the extension from the current number.
|
|
4082
4086
|
getExtension() {
|
|
4083
|
-
if (intlTelInput.utils) {
|
|
4087
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4084
4088
|
return intlTelInput.utils.getExtension(
|
|
4085
4089
|
this._getFullNumber(),
|
|
4086
4090
|
this.selectedCountryData.iso2
|
|
@@ -4090,7 +4094,7 @@ var factoryOutput = (() => {
|
|
|
4090
4094
|
}
|
|
4091
4095
|
//* Format the number to the given format.
|
|
4092
4096
|
getNumber(format) {
|
|
4093
|
-
if (intlTelInput.utils) {
|
|
4097
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4094
4098
|
const { iso2 } = this.selectedCountryData;
|
|
4095
4099
|
const fullNumber = this._getFullNumber();
|
|
4096
4100
|
const formattedNumber = intlTelInput.utils.formatNumber(
|
|
@@ -4105,7 +4109,7 @@ var factoryOutput = (() => {
|
|
|
4105
4109
|
}
|
|
4106
4110
|
//* Get the type of the entered number e.g. landline/mobile.
|
|
4107
4111
|
getNumberType() {
|
|
4108
|
-
if (intlTelInput.utils) {
|
|
4112
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4109
4113
|
return intlTelInput.utils.getNumberType(
|
|
4110
4114
|
this._getFullNumber(),
|
|
4111
4115
|
this.selectedCountryData.iso2
|
|
@@ -4119,7 +4123,7 @@ var factoryOutput = (() => {
|
|
|
4119
4123
|
}
|
|
4120
4124
|
//* Get the validation error.
|
|
4121
4125
|
getValidationError() {
|
|
4122
|
-
if (intlTelInput.utils) {
|
|
4126
|
+
if (intlTelInput.utils && this.ui.telInput) {
|
|
4123
4127
|
const { iso2 } = this.selectedCountryData;
|
|
4124
4128
|
return intlTelInput.utils.getValidationError(this._getFullNumber(), iso2);
|
|
4125
4129
|
}
|
|
@@ -4128,10 +4132,10 @@ var factoryOutput = (() => {
|
|
|
4128
4132
|
//* Validate the input val using number length only
|
|
4129
4133
|
isValidNumber() {
|
|
4130
4134
|
const { dialCode, iso2 } = this.selectedCountryData;
|
|
4131
|
-
if (dialCode === UK.DIAL_CODE && intlTelInput.utils) {
|
|
4135
|
+
if (dialCode === UK.DIAL_CODE && intlTelInput.utils && this.ui.telInput) {
|
|
4132
4136
|
const number = this._getFullNumber();
|
|
4133
4137
|
const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
|
|
4134
|
-
if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
4138
|
+
if (coreNumber && coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
|
|
4135
4139
|
return false;
|
|
4136
4140
|
}
|
|
4137
4141
|
}
|
|
@@ -4150,7 +4154,7 @@ var factoryOutput = (() => {
|
|
|
4150
4154
|
}
|
|
4151
4155
|
//* Shared internal validation logic to handle alpha character extension rules.
|
|
4152
4156
|
_validateNumber(precise) {
|
|
4153
|
-
if (!intlTelInput.utils) {
|
|
4157
|
+
if (!intlTelInput.utils || !this.ui.telInput) {
|
|
4154
4158
|
return null;
|
|
4155
4159
|
}
|
|
4156
4160
|
const { allowNumberExtensions, allowPhonewords } = this.options;
|
|
@@ -4186,6 +4190,9 @@ var factoryOutput = (() => {
|
|
|
4186
4190
|
}
|
|
4187
4191
|
//* Update the selected country, and update the input val accordingly.
|
|
4188
4192
|
setCountry(iso2) {
|
|
4193
|
+
if (!this.ui.telInput) {
|
|
4194
|
+
return;
|
|
4195
|
+
}
|
|
4189
4196
|
const iso2Lower = iso2?.toLowerCase();
|
|
4190
4197
|
if (!isIso22(iso2Lower)) {
|
|
4191
4198
|
throw new Error(`Invalid country code: '${iso2Lower}'`);
|
|
@@ -4204,6 +4211,9 @@ var factoryOutput = (() => {
|
|
|
4204
4211
|
}
|
|
4205
4212
|
//* Set the input value and update the country.
|
|
4206
4213
|
setNumber(number) {
|
|
4214
|
+
if (!this.ui.telInput) {
|
|
4215
|
+
return;
|
|
4216
|
+
}
|
|
4207
4217
|
const normalisedNumber = this.numerals.normalise(number);
|
|
4208
4218
|
const countryChanged = this._updateCountryFromNumber(normalisedNumber);
|
|
4209
4219
|
this._updateValFromNumber(normalisedNumber);
|
|
@@ -4214,10 +4224,16 @@ var factoryOutput = (() => {
|
|
|
4214
4224
|
}
|
|
4215
4225
|
//* Set the placeholder number typ
|
|
4216
4226
|
setPlaceholderNumberType(type) {
|
|
4227
|
+
if (!this.ui.telInput) {
|
|
4228
|
+
return;
|
|
4229
|
+
}
|
|
4217
4230
|
this.options.placeholderNumberType = type;
|
|
4218
4231
|
this._updatePlaceholder();
|
|
4219
4232
|
}
|
|
4220
4233
|
setDisabled(disabled) {
|
|
4234
|
+
if (!this.ui.telInput) {
|
|
4235
|
+
return;
|
|
4236
|
+
}
|
|
4221
4237
|
this.ui.telInput.disabled = disabled;
|
|
4222
4238
|
if (disabled) {
|
|
4223
4239
|
this.ui.selectedCountry.setAttribute("disabled", "true");
|
|
@@ -4291,7 +4307,7 @@ var factoryOutput = (() => {
|
|
|
4291
4307
|
attachUtils,
|
|
4292
4308
|
startedLoadingUtilsScript: false,
|
|
4293
4309
|
startedLoadingAutoCountry: false,
|
|
4294
|
-
version: "26.7.
|
|
4310
|
+
version: "26.7.5"
|
|
4295
4311
|
}
|
|
4296
4312
|
);
|
|
4297
4313
|
var intl_tel_input_default = intlTelInput;
|