intl-tel-input 26.9.2 → 27.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (253) hide show
  1. package/angular/README.md +1 -1
  2. package/angular/dist/IntlTelInput.d.ts +97 -0
  3. package/angular/dist/IntlTelInput.js +4812 -0
  4. package/angular/dist/IntlTelInputWithUtils.d.ts +3 -0
  5. package/angular/{build → dist}/IntlTelInputWithUtils.js +2342 -2096
  6. package/{build → dist}/css/demo.css +1 -1
  7. package/dist/css/intlTelInput-no-assets.css +1 -0
  8. package/dist/css/intlTelInput-no-assets.min.css +1 -0
  9. package/dist/css/intlTelInput.css +1 -0
  10. package/dist/css/intlTelInput.min.css +1 -0
  11. package/dist/img/flags.png +0 -0
  12. package/dist/img/flags.webp +0 -0
  13. package/dist/img/flags@2x.png +0 -0
  14. package/dist/img/flags@2x.webp +0 -0
  15. package/dist/js/data.d.ts +1616 -0
  16. package/{build → dist}/js/data.js +5 -17
  17. package/dist/js/data.min.js +7 -0
  18. package/dist/js/data.mjs +1708 -0
  19. package/{build/js/i18n/ar/index.js → dist/js/i18n/ar.js} +1 -0
  20. package/{build/js/i18n/bg/index.js → dist/js/i18n/bg.js} +1 -0
  21. package/{build/js/i18n/bn/index.js → dist/js/i18n/bn.js} +1 -0
  22. package/{build/js/i18n/bs/index.js → dist/js/i18n/bs.js} +1 -0
  23. package/{build/js/i18n/ca/index.js → dist/js/i18n/ca.js} +1 -0
  24. package/{build/js/i18n/cs/index.js → dist/js/i18n/cs.js} +1 -0
  25. package/{build/js/i18n/da/index.js → dist/js/i18n/da.js} +1 -0
  26. package/{build/js/i18n/de/index.js → dist/js/i18n/de.js} +1 -0
  27. package/{build/js/i18n/el/index.js → dist/js/i18n/el.js} +1 -0
  28. package/{build/js/i18n/en/index.js → dist/js/i18n/en.js} +3 -2
  29. package/{build/js/i18n/es/index.js → dist/js/i18n/es.js} +1 -0
  30. package/{build/js/i18n/et/index.js → dist/js/i18n/et.js} +1 -0
  31. package/{build/js/i18n/fa/index.js → dist/js/i18n/fa.js} +1 -0
  32. package/{build/js/i18n/fi/index.js → dist/js/i18n/fi.js} +1 -0
  33. package/{build/js/i18n/fr/index.js → dist/js/i18n/fr.js} +1 -0
  34. package/{build/js/i18n/hi/index.js → dist/js/i18n/hi.js} +1 -0
  35. package/{build/js/i18n/hr/index.js → dist/js/i18n/hr.js} +1 -0
  36. package/{build/js/i18n/hu/index.js → dist/js/i18n/hu.js} +1 -0
  37. package/{build/js/i18n/id/index.js → dist/js/i18n/id.js} +1 -0
  38. package/{build → dist}/js/i18n/index.js +1 -0
  39. package/{build/js/i18n/it/index.js → dist/js/i18n/it.js} +1 -0
  40. package/{build/js/i18n/ja/index.js → dist/js/i18n/ja.js} +1 -0
  41. package/{build/js/i18n/kn/index.js → dist/js/i18n/kn.js} +1 -0
  42. package/{build/js/i18n/ko/index.js → dist/js/i18n/ko.js} +1 -0
  43. package/{build/js/i18n/lt/index.js → dist/js/i18n/lt.js} +1 -0
  44. package/{build/js/i18n/mr/index.js → dist/js/i18n/mr.js} +1 -0
  45. package/{build/js/i18n/nl/index.js → dist/js/i18n/nl.js} +1 -0
  46. package/{build/js/i18n/no/index.js → dist/js/i18n/no.js} +1 -0
  47. package/{build/js/i18n/pl/index.js → dist/js/i18n/pl.js} +1 -0
  48. package/{build/js/i18n/pt/index.js → dist/js/i18n/pt.js} +1 -0
  49. package/{build/js/i18n/ro/index.js → dist/js/i18n/ro.js} +1 -0
  50. package/{build/js/i18n/ru/index.js → dist/js/i18n/ru.js} +1 -0
  51. package/{build/js/i18n/sk/index.js → dist/js/i18n/sk.js} +1 -0
  52. package/{build/js/i18n/sl/index.js → dist/js/i18n/sl.js} +1 -0
  53. package/{build/js/i18n/sq/index.js → dist/js/i18n/sq.js} +1 -0
  54. package/{build/js/i18n/sr/index.js → dist/js/i18n/sr.js} +1 -0
  55. package/{build/js/i18n/sv/index.js → dist/js/i18n/sv.js} +1 -0
  56. package/{build/js/i18n/te/index.js → dist/js/i18n/te.js} +1 -0
  57. package/{build/js/i18n/th/index.js → dist/js/i18n/th.js} +1 -0
  58. package/{build/js/i18n/tr/index.js → dist/js/i18n/tr.js} +1 -0
  59. package/dist/js/i18n/types.js +1 -0
  60. package/{build/js/i18n/uk/index.js → dist/js/i18n/uk.js} +1 -0
  61. package/{build/js/i18n/ur/index.js → dist/js/i18n/ur.js} +1 -0
  62. package/{build/js/i18n/uz/index.js → dist/js/i18n/uz.js} +1 -0
  63. package/{build/js/i18n/vi/index.js → dist/js/i18n/vi.js} +1 -0
  64. package/{build/js/i18n/zh-hk/index.js → dist/js/i18n/zh-hk.js} +1 -0
  65. package/{build/js/i18n/zh/index.js → dist/js/i18n/zh.js} +1 -0
  66. package/dist/js/i18n.d.ts +1697 -0
  67. package/dist/js/intlTelInput.d.ts +1773 -0
  68. package/{build → dist}/js/intlTelInput.js +228 -215
  69. package/dist/js/intlTelInput.min.js +25 -0
  70. package/{react/build/IntlTelInput.cjs → dist/js/intlTelInput.mjs} +230 -340
  71. package/{build → dist}/js/intlTelInputWithUtils.js +531 -498
  72. package/dist/js/intlTelInputWithUtils.min.js +25 -0
  73. package/{react/build/IntlTelInputWithUtils.cjs → dist/js/intlTelInputWithUtils.mjs} +530 -621
  74. package/{build → dist}/js/utils.js +46 -47
  75. package/package.json +122 -122
  76. package/react/README.md +1 -1
  77. package/react/dist/IntlTelInput.d.ts +20 -0
  78. package/react/{build → dist}/IntlTelInput.js +274 -255
  79. package/react/dist/IntlTelInputWithUtils.d.ts +4 -0
  80. package/react/{build → dist}/IntlTelInputWithUtils.js +580 -542
  81. package/svelte/README.md +1 -1
  82. package/svelte/src/IntlTelInput.svelte +199 -0
  83. package/svelte/src/IntlTelInputWithUtils.svelte +15 -0
  84. package/svelte/src/shims.d.ts +4 -0
  85. package/vue/README.md +1 -1
  86. package/vue/dist/IntlTelInput-D7r449B2.js +2577 -0
  87. package/vue/dist/IntlTelInput.js +5 -0
  88. package/vue/dist/IntlTelInputWithUtils.js +49385 -0
  89. package/vue/dist/src/IntlTelInput.vue.d.ts +35 -0
  90. package/vue/dist/src/index.d.ts +4 -0
  91. package/vue/dist/src/indexWithUtils.d.ts +3 -0
  92. package/angular/build/IntlTelInput.js +0 -4501
  93. package/angular/build/types/intl-tel-input/angular.d.ts +0 -65
  94. package/angular/build/types/intl-tel-input/angularWithUtils.d.ts +0 -65
  95. package/angular/build/types/intl-tel-input/data.d.ts +0 -20
  96. package/angular/build/types/intl-tel-input/i18n/ar/index.d.ts +0 -3
  97. package/angular/build/types/intl-tel-input/i18n/bg/index.d.ts +0 -3
  98. package/angular/build/types/intl-tel-input/i18n/bn/index.d.ts +0 -3
  99. package/angular/build/types/intl-tel-input/i18n/bs/index.d.ts +0 -3
  100. package/angular/build/types/intl-tel-input/i18n/ca/index.d.ts +0 -3
  101. package/angular/build/types/intl-tel-input/i18n/cs/index.d.ts +0 -3
  102. package/angular/build/types/intl-tel-input/i18n/da/index.d.ts +0 -3
  103. package/angular/build/types/intl-tel-input/i18n/de/index.d.ts +0 -3
  104. package/angular/build/types/intl-tel-input/i18n/el/index.d.ts +0 -3
  105. package/angular/build/types/intl-tel-input/i18n/en/index.d.ts +0 -3
  106. package/angular/build/types/intl-tel-input/i18n/es/index.d.ts +0 -3
  107. package/angular/build/types/intl-tel-input/i18n/et/index.d.ts +0 -3
  108. package/angular/build/types/intl-tel-input/i18n/fa/index.d.ts +0 -3
  109. package/angular/build/types/intl-tel-input/i18n/fi/index.d.ts +0 -3
  110. package/angular/build/types/intl-tel-input/i18n/fr/index.d.ts +0 -3
  111. package/angular/build/types/intl-tel-input/i18n/hi/index.d.ts +0 -3
  112. package/angular/build/types/intl-tel-input/i18n/hr/index.d.ts +0 -3
  113. package/angular/build/types/intl-tel-input/i18n/hu/index.d.ts +0 -3
  114. package/angular/build/types/intl-tel-input/i18n/id/index.d.ts +0 -3
  115. package/angular/build/types/intl-tel-input/i18n/index.d.ts +0 -45
  116. package/angular/build/types/intl-tel-input/i18n/it/index.d.ts +0 -3
  117. package/angular/build/types/intl-tel-input/i18n/ja/index.d.ts +0 -3
  118. package/angular/build/types/intl-tel-input/i18n/kn/index.d.ts +0 -3
  119. package/angular/build/types/intl-tel-input/i18n/ko/index.d.ts +0 -3
  120. package/angular/build/types/intl-tel-input/i18n/lt/index.d.ts +0 -3
  121. package/angular/build/types/intl-tel-input/i18n/mr/index.d.ts +0 -3
  122. package/angular/build/types/intl-tel-input/i18n/nl/index.d.ts +0 -3
  123. package/angular/build/types/intl-tel-input/i18n/no/index.d.ts +0 -3
  124. package/angular/build/types/intl-tel-input/i18n/pl/index.d.ts +0 -3
  125. package/angular/build/types/intl-tel-input/i18n/pt/index.d.ts +0 -3
  126. package/angular/build/types/intl-tel-input/i18n/ro/index.d.ts +0 -3
  127. package/angular/build/types/intl-tel-input/i18n/ru/index.d.ts +0 -3
  128. package/angular/build/types/intl-tel-input/i18n/sk/index.d.ts +0 -3
  129. package/angular/build/types/intl-tel-input/i18n/sl/index.d.ts +0 -3
  130. package/angular/build/types/intl-tel-input/i18n/sq/index.d.ts +0 -3
  131. package/angular/build/types/intl-tel-input/i18n/sr/index.d.ts +0 -3
  132. package/angular/build/types/intl-tel-input/i18n/sv/index.d.ts +0 -3
  133. package/angular/build/types/intl-tel-input/i18n/te/index.d.ts +0 -3
  134. package/angular/build/types/intl-tel-input/i18n/th/index.d.ts +0 -3
  135. package/angular/build/types/intl-tel-input/i18n/tr/index.d.ts +0 -3
  136. package/angular/build/types/intl-tel-input/i18n/types.d.ts +0 -10
  137. package/angular/build/types/intl-tel-input/i18n/uk/index.d.ts +0 -3
  138. package/angular/build/types/intl-tel-input/i18n/ur/index.d.ts +0 -3
  139. package/angular/build/types/intl-tel-input/i18n/uz/index.d.ts +0 -3
  140. package/angular/build/types/intl-tel-input/i18n/vi/index.d.ts +0 -3
  141. package/angular/build/types/intl-tel-input/i18n/zh/index.d.ts +0 -3
  142. package/angular/build/types/intl-tel-input/i18n/zh-hk/index.d.ts +0 -3
  143. package/angular/build/types/intl-tel-input/intlTelInputWithUtils.d.ts +0 -2
  144. package/angular/build/types/intl-tel-input/utils.d.ts +0 -2
  145. package/angular/build/types/intl-tel-input.d.ts +0 -46
  146. package/angular/build/types/modules/constants.d.ts +0 -94
  147. package/angular/build/types/modules/core/countrySearch.d.ts +0 -17
  148. package/angular/build/types/modules/core/icons.d.ts +0 -11
  149. package/angular/build/types/modules/core/numerals.d.ts +0 -7
  150. package/angular/build/types/modules/core/options.d.ts +0 -8
  151. package/angular/build/types/modules/core/ui.d.ts +0 -30
  152. package/angular/build/types/modules/data/country-data.d.ts +0 -12
  153. package/angular/build/types/modules/data/intl-regionless.d.ts +0 -2
  154. package/angular/build/types/modules/data/nanp-regionless.d.ts +0 -2
  155. package/angular/build/types/modules/format/caret.d.ts +0 -1
  156. package/angular/build/types/modules/format/formatting.d.ts +0 -3
  157. package/angular/build/types/modules/types/events.d.ts +0 -10
  158. package/angular/build/types/modules/types/forEachInstanceArgsMap.d.ts +0 -6
  159. package/angular/build/types/modules/types/public-api.d.ts +0 -65
  160. package/angular/build/types/modules/utils/dom.d.ts +0 -6
  161. package/angular/build/types/modules/utils/isAndroid.d.ts +0 -1
  162. package/angular/build/types/modules/utils/string.d.ts +0 -2
  163. package/build/css/intlTelInput-no-assets.css +0 -1323
  164. package/build/css/intlTelInput-no-assets.min.css +0 -1
  165. package/build/css/intlTelInput.css +0 -1327
  166. package/build/css/intlTelInput.min.css +0 -1
  167. package/build/img/flags.png +0 -0
  168. package/build/img/flags.webp +0 -0
  169. package/build/img/flags@2x.png +0 -0
  170. package/build/img/flags@2x.webp +0 -0
  171. package/build/js/data.min.js +0 -20
  172. package/build/js/i18n/types.js +0 -0
  173. package/build/js/intlTelInput.d.ts +0 -671
  174. package/build/js/intlTelInput.min.js +0 -38
  175. package/build/js/intlTelInputWithUtils.min.js +0 -38
  176. package/index.js +0 -1
  177. package/react/build/IntlTelInput.d.ts +0 -721
  178. package/svelte/build/IntlTelInput.mjs +0 -5294
  179. package/svelte/build/IntlTelInputWithUtils.mjs +0 -11381
  180. package/vue/build/IntlTelInput.vue.d.ts +0 -34
  181. package/vue/build/IntlTelInputWithUtils.vue.d.ts +0 -34
  182. package/vue/build/exports/IntlTelInput.d.ts +0 -3
  183. package/vue/build/exports/IntlTelInput.mjs +0 -86
  184. package/vue/build/exports/IntlTelInputWithUtils.d.ts +0 -3
  185. package/vue/build/exports/IntlTelInputWithUtils.mjs +0 -6173
  186. package/vue/build/intl-tel-input/data.d.ts +0 -20
  187. package/vue/build/intl-tel-input/i18n/ar/index.d.ts +0 -3
  188. package/vue/build/intl-tel-input/i18n/bg/index.d.ts +0 -3
  189. package/vue/build/intl-tel-input/i18n/bn/index.d.ts +0 -3
  190. package/vue/build/intl-tel-input/i18n/bs/index.d.ts +0 -3
  191. package/vue/build/intl-tel-input/i18n/ca/index.d.ts +0 -3
  192. package/vue/build/intl-tel-input/i18n/cs/index.d.ts +0 -3
  193. package/vue/build/intl-tel-input/i18n/da/index.d.ts +0 -3
  194. package/vue/build/intl-tel-input/i18n/de/index.d.ts +0 -3
  195. package/vue/build/intl-tel-input/i18n/el/index.d.ts +0 -3
  196. package/vue/build/intl-tel-input/i18n/en/index.d.ts +0 -3
  197. package/vue/build/intl-tel-input/i18n/es/index.d.ts +0 -3
  198. package/vue/build/intl-tel-input/i18n/et/index.d.ts +0 -3
  199. package/vue/build/intl-tel-input/i18n/fa/index.d.ts +0 -3
  200. package/vue/build/intl-tel-input/i18n/fi/index.d.ts +0 -3
  201. package/vue/build/intl-tel-input/i18n/fr/index.d.ts +0 -3
  202. package/vue/build/intl-tel-input/i18n/hi/index.d.ts +0 -3
  203. package/vue/build/intl-tel-input/i18n/hr/index.d.ts +0 -3
  204. package/vue/build/intl-tel-input/i18n/hu/index.d.ts +0 -3
  205. package/vue/build/intl-tel-input/i18n/id/index.d.ts +0 -3
  206. package/vue/build/intl-tel-input/i18n/index.d.ts +0 -45
  207. package/vue/build/intl-tel-input/i18n/it/index.d.ts +0 -3
  208. package/vue/build/intl-tel-input/i18n/ja/index.d.ts +0 -3
  209. package/vue/build/intl-tel-input/i18n/kn/index.d.ts +0 -3
  210. package/vue/build/intl-tel-input/i18n/ko/index.d.ts +0 -3
  211. package/vue/build/intl-tel-input/i18n/lt/index.d.ts +0 -3
  212. package/vue/build/intl-tel-input/i18n/mr/index.d.ts +0 -3
  213. package/vue/build/intl-tel-input/i18n/nl/index.d.ts +0 -3
  214. package/vue/build/intl-tel-input/i18n/no/index.d.ts +0 -3
  215. package/vue/build/intl-tel-input/i18n/pl/index.d.ts +0 -3
  216. package/vue/build/intl-tel-input/i18n/pt/index.d.ts +0 -3
  217. package/vue/build/intl-tel-input/i18n/ro/index.d.ts +0 -3
  218. package/vue/build/intl-tel-input/i18n/ru/index.d.ts +0 -3
  219. package/vue/build/intl-tel-input/i18n/sk/index.d.ts +0 -3
  220. package/vue/build/intl-tel-input/i18n/sl/index.d.ts +0 -3
  221. package/vue/build/intl-tel-input/i18n/sq/index.d.ts +0 -3
  222. package/vue/build/intl-tel-input/i18n/sr/index.d.ts +0 -3
  223. package/vue/build/intl-tel-input/i18n/sv/index.d.ts +0 -3
  224. package/vue/build/intl-tel-input/i18n/te/index.d.ts +0 -3
  225. package/vue/build/intl-tel-input/i18n/th/index.d.ts +0 -3
  226. package/vue/build/intl-tel-input/i18n/tr/index.d.ts +0 -3
  227. package/vue/build/intl-tel-input/i18n/types.d.ts +0 -10
  228. package/vue/build/intl-tel-input/i18n/uk/index.d.ts +0 -3
  229. package/vue/build/intl-tel-input/i18n/ur/index.d.ts +0 -3
  230. package/vue/build/intl-tel-input/i18n/uz/index.d.ts +0 -3
  231. package/vue/build/intl-tel-input/i18n/vi/index.d.ts +0 -3
  232. package/vue/build/intl-tel-input/i18n/zh/index.d.ts +0 -3
  233. package/vue/build/intl-tel-input/i18n/zh-hk/index.d.ts +0 -3
  234. package/vue/build/intl-tel-input/intlTelInputWithUtils.d.ts +0 -2
  235. package/vue/build/intl-tel-input-MeSkUgHd.mjs +0 -3438
  236. package/vue/build/intl-tel-input.d.ts +0 -46
  237. package/vue/build/modules/constants.d.ts +0 -94
  238. package/vue/build/modules/core/countrySearch.d.ts +0 -17
  239. package/vue/build/modules/core/icons.d.ts +0 -11
  240. package/vue/build/modules/core/numerals.d.ts +0 -7
  241. package/vue/build/modules/core/options.d.ts +0 -8
  242. package/vue/build/modules/core/ui.d.ts +0 -30
  243. package/vue/build/modules/data/country-data.d.ts +0 -12
  244. package/vue/build/modules/data/intl-regionless.d.ts +0 -2
  245. package/vue/build/modules/data/nanp-regionless.d.ts +0 -2
  246. package/vue/build/modules/format/caret.d.ts +0 -1
  247. package/vue/build/modules/format/formatting.d.ts +0 -3
  248. package/vue/build/modules/types/events.d.ts +0 -10
  249. package/vue/build/modules/types/forEachInstanceArgsMap.d.ts +0 -6
  250. package/vue/build/modules/types/public-api.d.ts +0 -65
  251. package/vue/build/modules/utils/dom.d.ts +0 -6
  252. package/vue/build/modules/utils/isAndroid.d.ts +0 -1
  253. package/vue/build/modules/utils/string.d.ts +0 -2
@@ -1,19 +1,10 @@
1
1
  /*
2
- * International Telephone Input v26.9.2
2
+ * International Telephone Input v27.0.0
3
3
  * https://github.com/jackocnr/intl-tel-input.git
4
4
  * Licensed under the MIT license
5
5
  */
6
-
7
- // UMD
8
- (function(factory) {
9
- if (typeof module === 'object' && module.exports) {
10
- module.exports = factory();
11
- } else {
12
- window.intlTelInput = factory();
13
- }
14
- }(() => {
15
-
16
- var factoryOutput = (() => {
6
+ "use strict";
7
+ var _factory = (() => {
17
8
  var __defProp = Object.defineProperty;
18
9
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
19
10
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -39,7 +30,7 @@ var factoryOutput = (() => {
39
30
  default: () => intl_tel_input_default
40
31
  });
41
32
 
42
- // src/js/intl-tel-input/data.ts
33
+ // src/js/data.ts
43
34
  var rawCountryData = [
44
35
  [
45
36
  "af",
@@ -1742,7 +1733,7 @@ var factoryOutput = (() => {
1742
1733
  var isIso2 = (val) => iso2Set.has(val);
1743
1734
  var data_default = allCountries;
1744
1735
 
1745
- // src/js/modules/constants.ts
1736
+ // src/js/constants.ts
1746
1737
  var EVENTS = {
1747
1738
  OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1748
1739
  CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
@@ -1863,10 +1854,10 @@ var factoryOutput = (() => {
1863
1854
  MODAL: "aria-modal"
1864
1855
  };
1865
1856
 
1866
- // src/js/intl-tel-input/i18n/en/index.ts
1857
+ // src/js/i18n/en.ts
1867
1858
  var interfaceTranslations = {
1868
- selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1869
- noCountrySelected: "Select country",
1859
+ selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
1860
+ noCountrySelected: "Select country for phone number",
1870
1861
  countryListAriaLabel: "List of countries",
1871
1862
  searchPlaceholder: "Search",
1872
1863
  clearSearchAriaLabel: "Clear search",
@@ -1883,7 +1874,7 @@ var factoryOutput = (() => {
1883
1874
  };
1884
1875
  var en_default = interfaceTranslations;
1885
1876
 
1886
- // src/js/modules/core/options.ts
1877
+ // src/js/core/options.ts
1887
1878
  var mq = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
1888
1879
  var isNarrowViewport = () => mq(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
1889
1880
  var computeDefaultUseFullscreenPopup = () => {
@@ -1920,7 +1911,7 @@ var factoryOutput = (() => {
1920
1911
  //* Append menu to specified element.
1921
1912
  dropdownContainer: null,
1922
1913
  //* Don't display these countries.
1923
- excludeCountries: [],
1914
+ excludeCountries: null,
1924
1915
  //* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
1925
1916
  fixDropdownWidth: true,
1926
1917
  //* Format the number as the user types
@@ -1940,7 +1931,7 @@ var factoryOutput = (() => {
1940
1931
  //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
1941
1932
  nationalMode: true,
1942
1933
  //* Display only these countries.
1943
- onlyCountries: [],
1934
+ onlyCountries: null,
1944
1935
  //* Number type to use for placeholders.
1945
1936
  placeholderNumberType: "MOBILE",
1946
1937
  //* Add custom classes to the search input element.
@@ -1958,7 +1949,9 @@ var factoryOutput = (() => {
1958
1949
  var isPlainObject = (val) => Boolean(val) && typeof val === "object" && !Array.isArray(val);
1959
1950
  var isFn = (val) => typeof val === "function";
1960
1951
  var isElLike = (val) => {
1961
- if (!val || typeof val !== "object") return false;
1952
+ if (!val || typeof val !== "object") {
1953
+ return false;
1954
+ }
1962
1955
  const v = val;
1963
1956
  return v.nodeType === 1 && typeof v.tagName === "string" && typeof v.appendChild === "function";
1964
1957
  };
@@ -2073,9 +2066,13 @@ var factoryOutput = (() => {
2073
2066
  break;
2074
2067
  case "excludeCountries":
2075
2068
  case "onlyCountries": {
2076
- const filtered = validateIso2Array(key, value);
2077
- if (filtered !== false) {
2078
- validatedOptions[key] = filtered;
2069
+ if (value === null) {
2070
+ validatedOptions[key] = value;
2071
+ } else {
2072
+ const filtered = validateIso2Array(key, value);
2073
+ if (filtered !== false) {
2074
+ validatedOptions[key] = filtered;
2075
+ }
2079
2076
  }
2080
2077
  break;
2081
2078
  }
@@ -2159,7 +2156,7 @@ var factoryOutput = (() => {
2159
2156
  o.fixDropdownWidth = true;
2160
2157
  }
2161
2158
  }
2162
- if (o.onlyCountries.length === 1) {
2159
+ if (o.onlyCountries?.length === 1) {
2163
2160
  o.initialCountry = o.onlyCountries[0];
2164
2161
  }
2165
2162
  if (o.separateDialCode) {
@@ -2174,14 +2171,14 @@ var factoryOutput = (() => {
2174
2171
  o.i18n = { ...en_default, ...o.i18n };
2175
2172
  };
2176
2173
 
2177
- // src/js/modules/utils/string.ts
2174
+ // src/js/helpers/string.ts
2178
2175
  var getNumeric = (s) => s.replace(/\D/g, "");
2179
2176
  var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2180
2177
 
2181
- // src/js/modules/utils/isAndroid.ts
2178
+ // src/js/helpers/isAndroid.ts
2182
2179
  var getIsAndroid = () => typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
2183
2180
 
2184
- // src/js/modules/core/countrySearch.ts
2181
+ // src/js/core/countrySearch.ts
2185
2182
  var getMatchedCountries = (countries, query) => {
2186
2183
  const normalisedQuery = normaliseString(query);
2187
2184
  const iso2Matches = [];
@@ -2226,7 +2223,7 @@ var factoryOutput = (() => {
2226
2223
  return null;
2227
2224
  };
2228
2225
 
2229
- // src/js/modules/utils/dom.ts
2226
+ // src/js/helpers/dom.ts
2230
2227
  var buildClassNames = (flags) => Object.keys(flags).filter((k) => Boolean(flags[k])).join(" ");
2231
2228
  var createEl = (tagName, attrs, container) => {
2232
2229
  const el = document.createElement(tagName);
@@ -2241,7 +2238,7 @@ var factoryOutput = (() => {
2241
2238
  return el;
2242
2239
  };
2243
2240
 
2244
- // src/js/modules/core/icons.ts
2241
+ // src/js/core/icons.ts
2245
2242
  var buildSearchIcon = () => `
2246
2243
  <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${ARIA.HIDDEN}="true">
2247
2244
  <circle cx="11" cy="11" r="7" />
@@ -2268,31 +2265,15 @@ var factoryOutput = (() => {
2268
2265
  <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"/>
2269
2266
  </svg>`;
2270
2267
 
2271
- // src/js/modules/core/ui.ts
2268
+ // src/js/core/ui.ts
2272
2269
  var UI = class _UI {
2273
- constructor(input, options, id2) {
2274
- this.#searchKeyupTimer = null;
2275
- this.#inlineDropdownHeight = null;
2276
- this.#dropdownForContainer = null;
2277
- this.#selectedItem = null;
2278
- this.highlightedItem = null;
2279
- input.dataset.intlTelInputId = id2.toString();
2280
- this.telInput = input;
2281
- this.#options = options;
2282
- this.#id = id2;
2283
- this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
2284
- this.#isRTL = !!this.telInput.closest("[dir=rtl]");
2285
- if (this.#options.separateDialCode) {
2286
- this.#originalPaddingLeft = this.telInput.style.paddingLeft;
2287
- }
2288
- }
2289
2270
  // private
2290
2271
  #options;
2291
2272
  #id;
2292
2273
  #isRTL;
2293
- #originalPaddingLeft;
2274
+ #originalPaddingLeft = "";
2294
2275
  #countries;
2295
- #searchKeyupTimer;
2276
+ #searchKeyupTimer = null;
2296
2277
  #inlineDropdownHeight;
2297
2278
  #selectedDialCode;
2298
2279
  #dropdownArrow;
@@ -2301,7 +2282,30 @@ var factoryOutput = (() => {
2301
2282
  #searchNoResults;
2302
2283
  #searchResultsA11yText;
2303
2284
  #dropdownForContainer;
2304
- #selectedItem;
2285
+ #selectedItem = null;
2286
+ // public
2287
+ telInput;
2288
+ countryContainer;
2289
+ selectedCountry;
2290
+ selectedCountryInner;
2291
+ searchInput;
2292
+ searchClearButton;
2293
+ countryList;
2294
+ hiddenInputPhone;
2295
+ hiddenInputCountry;
2296
+ highlightedItem = null;
2297
+ hadInitialPlaceholder;
2298
+ constructor(input, options, id2) {
2299
+ input.dataset.intlTelInputId = id2.toString();
2300
+ this.telInput = input;
2301
+ this.#options = options;
2302
+ this.#id = id2;
2303
+ this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
2304
+ this.#isRTL = !!this.telInput.closest("[dir=rtl]");
2305
+ if (this.#options.separateDialCode) {
2306
+ this.#originalPaddingLeft = this.telInput.style.paddingLeft;
2307
+ }
2308
+ }
2305
2309
  // Validate that the provided element is an HTMLInputElement.
2306
2310
  static validateInput(input) {
2307
2311
  const tagName = input?.tagName;
@@ -2317,6 +2321,9 @@ var factoryOutput = (() => {
2317
2321
  generateMarkup(countries) {
2318
2322
  this.#countries = countries;
2319
2323
  this.telInput.classList.add("iti__tel-input");
2324
+ if (!this.telInput.hasAttribute("type")) {
2325
+ this.telInput.setAttribute("type", "tel");
2326
+ }
2320
2327
  if (!this.telInput.hasAttribute("autocomplete")) {
2321
2328
  this.telInput.setAttribute("autocomplete", "tel");
2322
2329
  }
@@ -2536,7 +2543,7 @@ var factoryOutput = (() => {
2536
2543
  },
2537
2544
  this.#dropdownContent
2538
2545
  );
2539
- this.#searchNoResults.textContent = i18n.searchEmptyState;
2546
+ this.#searchNoResults.textContent = i18n.searchEmptyState ?? null;
2540
2547
  }
2541
2548
  #maybeUpdateInputPaddingAndReveal() {
2542
2549
  if (this.countryContainer) {
@@ -2554,13 +2561,13 @@ var factoryOutput = (() => {
2554
2561
  `input[name="${names.phone}"]`
2555
2562
  );
2556
2563
  if (existingInput) {
2557
- this.hiddenInput = existingInput;
2564
+ this.hiddenInputPhone = existingInput;
2558
2565
  } else {
2559
- this.hiddenInput = createEl("input", {
2566
+ this.hiddenInputPhone = createEl("input", {
2560
2567
  type: "hidden",
2561
2568
  name: names.phone
2562
2569
  });
2563
- wrapper.appendChild(this.hiddenInput);
2570
+ wrapper.appendChild(this.hiddenInputPhone);
2564
2571
  }
2565
2572
  }
2566
2573
  if (names.country) {
@@ -2805,28 +2812,9 @@ var factoryOutput = (() => {
2805
2812
  const wrapper = this.telInput.parentNode;
2806
2813
  wrapper.before(this.telInput);
2807
2814
  wrapper.remove();
2808
- this.telInput = null;
2809
- this.countryContainer = null;
2810
- this.selectedCountry = null;
2811
- this.selectedCountryInner = null;
2812
- this.searchInput = null;
2813
- this.searchClearButton = null;
2814
- this.countryList = null;
2815
- this.hiddenInput = null;
2816
- this.hiddenInputCountry = null;
2817
- this.highlightedItem = null;
2818
- this.#selectedDialCode = null;
2819
- this.#dropdownArrow = null;
2820
- this.#dropdownContent = null;
2821
- this.#searchIcon = null;
2822
- this.#searchNoResults = null;
2823
- this.#searchResultsA11yText = null;
2824
- this.#dropdownForContainer = null;
2825
- this.#selectedItem = null;
2826
2815
  for (const c of this.#countries) {
2827
2816
  delete c.nodeById[this.#id];
2828
2817
  }
2829
- this.#countries = null;
2830
2818
  }
2831
2819
  // UI: Open the dropdown (DOM only).
2832
2820
  openDropdown() {
@@ -2850,10 +2838,10 @@ var factoryOutput = (() => {
2850
2838
  this.#dropdownContent.classList.remove(CLASSES.HIDE);
2851
2839
  this.selectedCountry.setAttribute(ARIA.EXPANDED, "true");
2852
2840
  if (countrySearch) {
2853
- const firstCountryItem = this.countryList.firstElementChild;
2854
- if (firstCountryItem) {
2855
- this.highlightListItem(firstCountryItem, false);
2856
- this.countryList.scrollTop = 0;
2841
+ const itemToHighlight = this.#selectedItem ?? this.countryList.firstElementChild;
2842
+ if (itemToHighlight) {
2843
+ this.highlightListItem(itemToHighlight, false);
2844
+ this.scrollCountryListToItem(itemToHighlight);
2857
2845
  }
2858
2846
  if (!dropdownAlwaysOpen) {
2859
2847
  this.searchInput.focus();
@@ -2868,6 +2856,8 @@ var factoryOutput = (() => {
2868
2856
  this.selectedCountry.setAttribute(ARIA.EXPANDED, "false");
2869
2857
  if (countrySearch) {
2870
2858
  this.searchInput.removeAttribute(ARIA.ACTIVE_DESCENDANT);
2859
+ this.searchInput.value = "";
2860
+ this.#doFilter();
2871
2861
  if (this.highlightedItem) {
2872
2862
  this.highlightedItem.classList.remove(CLASSES.HIGHLIGHT);
2873
2863
  this.highlightedItem = null;
@@ -2922,7 +2912,9 @@ var factoryOutput = (() => {
2922
2912
  }
2923
2913
  setCountry(selectedCountryData) {
2924
2914
  const { allowDropdown, showFlags, separateDialCode, i18n } = this.#options;
2925
- const { name, dialCode, iso2 = "" } = selectedCountryData;
2915
+ const name = selectedCountryData?.name;
2916
+ const dialCode = selectedCountryData?.dialCode;
2917
+ const iso2 = selectedCountryData?.iso2 ?? "";
2926
2918
  if (allowDropdown) {
2927
2919
  this.#updateSelectedItem(iso2);
2928
2920
  }
@@ -2951,7 +2943,7 @@ var factoryOutput = (() => {
2951
2943
  }
2952
2944
  };
2953
2945
 
2954
- // src/js/modules/data/country-data.ts
2946
+ // src/js/data/country-data.ts
2955
2947
  var processAllCountries = (options) => {
2956
2948
  const { onlyCountries, excludeCountries } = options;
2957
2949
  if (onlyCountries?.length) {
@@ -3056,7 +3048,7 @@ var factoryOutput = (() => {
3056
3048
  }
3057
3049
  };
3058
3050
 
3059
- // src/js/modules/data/intl-regionless.ts
3051
+ // src/js/data/intl-regionless.ts
3060
3052
  var REGIONLESS_DIAL_CODES = /* @__PURE__ */ new Set([
3061
3053
  "800",
3062
3054
  "808",
@@ -3072,7 +3064,7 @@ var factoryOutput = (() => {
3072
3064
  return number.startsWith("+") && REGIONLESS_DIAL_CODES.has(dialCode);
3073
3065
  };
3074
3066
 
3075
- // src/js/modules/format/formatting.ts
3067
+ // src/js/format/formatting.ts
3076
3068
  var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedCountryData) => {
3077
3069
  let number = fullNumber;
3078
3070
  if (separateDialCode) {
@@ -3085,8 +3077,8 @@ var factoryOutput = (() => {
3085
3077
  return number;
3086
3078
  };
3087
3079
  var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountryData, separateDialCode) => {
3088
- const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData.iso2) : fullNumber;
3089
- const { dialCode } = selectedCountryData;
3080
+ const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData?.iso2) : fullNumber;
3081
+ const dialCode = selectedCountryData?.dialCode;
3090
3082
  if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
3091
3083
  const afterDialCode = result.split(`+${dialCode}`)[1] || "";
3092
3084
  return afterDialCode.trim();
@@ -3094,7 +3086,7 @@ var factoryOutput = (() => {
3094
3086
  return result;
3095
3087
  };
3096
3088
 
3097
- // src/js/modules/format/caret.ts
3089
+ // src/js/format/caret.ts
3098
3090
  var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
3099
3091
  if (prevCaretPos === 0 && !isDeleteForwards) {
3100
3092
  return 0;
@@ -3114,7 +3106,7 @@ var factoryOutput = (() => {
3114
3106
  return formattedValue.length;
3115
3107
  };
3116
3108
 
3117
- // src/js/modules/data/nanp-regionless.ts
3109
+ // src/js/data/nanp-regionless.ts
3118
3110
  var regionlessNanpNumbers = /* @__PURE__ */ new Set([
3119
3111
  "800",
3120
3112
  "822",
@@ -3143,7 +3135,7 @@ var factoryOutput = (() => {
3143
3135
  return false;
3144
3136
  };
3145
3137
 
3146
- // src/js/modules/core/numerals.ts
3138
+ // src/js/core/numerals.ts
3147
3139
  var Numerals = class {
3148
3140
  #userNumeralSet;
3149
3141
  constructor(initialValue) {
@@ -3190,7 +3182,26 @@ var factoryOutput = (() => {
3190
3182
 
3191
3183
  // src/js/intl-tel-input.ts
3192
3184
  var id = 0;
3185
+ var ensureUtils = (methodName) => {
3186
+ if (!intlTelInput.utils) {
3187
+ throw new Error(`intlTelInput.utils is required for ${methodName}(). See: https://intl-tel-input.com/docs/utils`);
3188
+ }
3189
+ };
3190
+ var createDeferred = () => {
3191
+ let resolve;
3192
+ let reject;
3193
+ const promise = new Promise((res, rej) => {
3194
+ resolve = res;
3195
+ reject = rej;
3196
+ });
3197
+ return { promise, resolve, reject };
3198
+ };
3193
3199
  var Iti = class _Iti {
3200
+ //* PUBLIC FIELDS - READONLY
3201
+ //* Can't be private as it's called from intlTelInput convenience wrapper.
3202
+ id;
3203
+ // accessed externally via iti.promise.then(...)
3204
+ promise;
3194
3205
  //* PRIVATE FIELDS
3195
3206
  #ui;
3196
3207
  #options;
@@ -3201,16 +3212,15 @@ var factoryOutput = (() => {
3201
3212
  #dialCodeToIso2Map;
3202
3213
  #dialCodes;
3203
3214
  #countryByIso2;
3204
- #selectedCountryData;
3205
- #maxCoreNumberLength;
3215
+ #selectedCountryData = null;
3216
+ #maxCoreNumberLength = null;
3206
3217
  #defaultCountry;
3218
+ #destroyed = false;
3207
3219
  #abortController;
3208
- #dropdownAbortController;
3220
+ #dropdownAbortController = null;
3209
3221
  #numerals;
3210
- #resolveAutoCountryPromise;
3211
- #rejectAutoCountryPromise;
3212
- #resolveUtilsScriptPromise;
3213
- #rejectUtilsScriptPromise;
3222
+ #autoCountryDeferred;
3223
+ #utilsScriptDeferred;
3214
3224
  constructor(input, customOptions = {}) {
3215
3225
  this.id = id++;
3216
3226
  UI.validateInput(input);
@@ -3243,37 +3253,19 @@ var factoryOutput = (() => {
3243
3253
  const { initialCountry, geoIpLookup, loadUtils } = options;
3244
3254
  const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
3245
3255
  const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
3246
- let autoCountryPromise;
3247
3256
  if (needsAutoCountryPromise) {
3248
- autoCountryPromise = new Promise((resolve, reject) => {
3249
- this.#resolveAutoCountryPromise = resolve;
3250
- this.#rejectAutoCountryPromise = reject;
3251
- });
3252
- } else {
3253
- autoCountryPromise = Promise.resolve(void 0);
3254
- this.#resolveAutoCountryPromise = () => {
3255
- };
3256
- this.#rejectAutoCountryPromise = () => {
3257
- };
3257
+ this.#autoCountryDeferred = createDeferred();
3258
3258
  }
3259
- let utilsScriptPromise;
3260
3259
  if (needsUtilsScriptPromise) {
3261
- utilsScriptPromise = new Promise((resolve, reject) => {
3262
- this.#resolveUtilsScriptPromise = resolve;
3263
- this.#rejectUtilsScriptPromise = reject;
3264
- });
3265
- } else {
3266
- utilsScriptPromise = Promise.resolve(void 0);
3267
- this.#resolveUtilsScriptPromise = () => {
3268
- };
3269
- this.#rejectUtilsScriptPromise = () => {
3270
- };
3260
+ this.#utilsScriptDeferred = createDeferred();
3271
3261
  }
3272
- return Promise.all([autoCountryPromise, utilsScriptPromise]).then(() => {
3262
+ return Promise.all([
3263
+ this.#autoCountryDeferred?.promise,
3264
+ this.#utilsScriptDeferred?.promise
3265
+ ]).then(() => {
3273
3266
  });
3274
3267
  }
3275
3268
  #init() {
3276
- this.#selectedCountryData = null;
3277
3269
  this.#abortController = new AbortController();
3278
3270
  this.#processCountryData();
3279
3271
  this.#ui.generateMarkup(this.#countries);
@@ -3298,7 +3290,7 @@ var factoryOutput = (() => {
3298
3290
  //* 2. Using explicit initialCountry
3299
3291
  #setInitialState(overrideAutoCountry = false) {
3300
3292
  const attributeValueRaw = this.#ui.telInput.getAttribute("value");
3301
- const attributeValue = this.#numerals.normalise(attributeValueRaw);
3293
+ const attributeValue = this.#numerals.normalise(attributeValueRaw ?? "");
3302
3294
  const inputValue = this.#getTelInputValue();
3303
3295
  const useAttribute = attributeValue && attributeValue.startsWith("+") && (!inputValue || !inputValue.startsWith("+"));
3304
3296
  const val = useAttribute ? attributeValue : inputValue;
@@ -3333,15 +3325,15 @@ var factoryOutput = (() => {
3333
3325
  if (this.#options.allowDropdown) {
3334
3326
  this.#initDropdownListeners();
3335
3327
  }
3336
- if ((this.#ui.hiddenInput || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
3328
+ if ((this.#ui.hiddenInputPhone || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
3337
3329
  this.#initHiddenInputListener();
3338
3330
  }
3339
3331
  }
3340
3332
  //* Update hidden input on form submit.
3341
3333
  #initHiddenInputListener() {
3342
3334
  const handleHiddenInputSubmit = () => {
3343
- if (this.#ui.hiddenInput) {
3344
- this.#ui.hiddenInput.value = this.getNumber();
3335
+ if (this.#ui.hiddenInputPhone) {
3336
+ this.#ui.hiddenInputPhone.value = this.getNumber();
3345
3337
  }
3346
3338
  if (this.#ui.hiddenInputCountry) {
3347
3339
  this.#ui.hiddenInputCountry.value = this.#selectedCountryData?.iso2 || "";
@@ -3410,12 +3402,12 @@ var factoryOutput = (() => {
3410
3402
  });
3411
3403
  }
3412
3404
  } else {
3413
- this.#resolveUtilsScriptPromise();
3405
+ this.#utilsScriptDeferred?.resolve();
3414
3406
  }
3415
3407
  const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
3416
3408
  if (isAutoCountry) {
3417
- if (this.#selectedCountryData?.iso2) {
3418
- this.#resolveAutoCountryPromise();
3409
+ if (this.#selectedCountryData) {
3410
+ this.#autoCountryDeferred?.resolve();
3419
3411
  } else {
3420
3412
  this.#loadAutoCountry();
3421
3413
  }
@@ -3510,7 +3502,7 @@ var factoryOutput = (() => {
3510
3502
  fullNumber,
3511
3503
  inputValue,
3512
3504
  intlTelInput.utils,
3513
- this.#selectedCountryData ?? {},
3505
+ this.#selectedCountryData,
3514
3506
  separateDialCode
3515
3507
  );
3516
3508
  const newCaretPos = translateCursorPosition(
@@ -3527,7 +3519,7 @@ var factoryOutput = (() => {
3527
3519
  inputValue,
3528
3520
  true,
3529
3521
  separateDialCode,
3530
- this.#selectedCountryData ?? {}
3522
+ this.#selectedCountryData
3531
3523
  );
3532
3524
  this.#setTelInputValue(cleanNumber);
3533
3525
  }
@@ -3560,8 +3552,8 @@ var factoryOutput = (() => {
3560
3552
  const input = this.#ui.telInput;
3561
3553
  const selStart = input.selectionStart;
3562
3554
  const selEnd = input.selectionEnd;
3563
- const before = inputValue.slice(0, selStart);
3564
- const after = inputValue.slice(selEnd);
3555
+ const before = inputValue.slice(0, selStart ?? void 0);
3556
+ const after = inputValue.slice(selEnd ?? void 0);
3565
3557
  const newValue = before + e.key + after;
3566
3558
  const newFullNumber = this.#getFullNumber(newValue);
3567
3559
  let hasExceededMaxLength = false;
@@ -3593,8 +3585,8 @@ var factoryOutput = (() => {
3593
3585
  const selStart = input.selectionStart;
3594
3586
  const selEnd = input.selectionEnd;
3595
3587
  const inputValue = this.#getTelInputValue();
3596
- const before = inputValue.slice(0, selStart);
3597
- const after = inputValue.slice(selEnd);
3588
+ const before = inputValue.slice(0, selStart ?? void 0);
3589
+ const after = inputValue.slice(selEnd ?? void 0);
3598
3590
  const iso2 = this.#selectedCountryData?.iso2;
3599
3591
  const pastedRaw = e.clipboardData.getData("text");
3600
3592
  const pasted = this.#numerals.normalise(pastedRaw);
@@ -3605,7 +3597,7 @@ var factoryOutput = (() => {
3605
3597
  const numerics = allowedChars.replace(/\+/g, "");
3606
3598
  const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
3607
3599
  let newVal = before + sanitised + after;
3608
- if (newVal.length > 5) {
3600
+ if (newVal.length > 5 && intlTelInput.utils) {
3609
3601
  let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
3610
3602
  while (coreNumber.length === 0 && newVal.length > 0) {
3611
3603
  newVal = newVal.slice(0, -1);
@@ -3895,10 +3887,10 @@ var factoryOutput = (() => {
3895
3887
  #setCountry(iso2) {
3896
3888
  const prevIso2 = this.#selectedCountryData?.iso2 || "";
3897
3889
  this.#selectedCountryData = iso2 ? this.#countryByIso2.get(iso2) : null;
3898
- if (this.#selectedCountryData?.iso2) {
3890
+ if (this.#selectedCountryData) {
3899
3891
  this.#defaultCountry = this.#selectedCountryData.iso2;
3900
3892
  }
3901
- this.#ui.setCountry(this.#selectedCountryData ?? {});
3893
+ this.#ui.setCountry(this.#selectedCountryData);
3902
3894
  this.#updatePlaceholder();
3903
3895
  this.#updateMaxLength();
3904
3896
  return prevIso2 !== iso2;
@@ -3946,14 +3938,14 @@ var factoryOutput = (() => {
3946
3938
  const shouldSetPlaceholder = autoPlaceholder === PLACEHOLDER_MODES.AGGRESSIVE || !this.#ui.hadInitialPlaceholder && autoPlaceholder === PLACEHOLDER_MODES.POLITE;
3947
3939
  if (intlTelInput.utils && shouldSetPlaceholder) {
3948
3940
  const numberType = intlTelInput.utils.numberType[placeholderNumberType];
3949
- let placeholder = this.#selectedCountryData?.iso2 ? intlTelInput.utils.getExampleNumber(
3941
+ let placeholder = this.#selectedCountryData ? intlTelInput.utils.getExampleNumber(
3950
3942
  this.#selectedCountryData.iso2,
3951
3943
  nationalMode,
3952
3944
  numberType
3953
3945
  ) : "";
3954
3946
  placeholder = this.#beforeSetNumber(placeholder);
3955
3947
  if (typeof customPlaceholder === "function") {
3956
- placeholder = customPlaceholder(placeholder, this.#selectedCountryData ?? {});
3948
+ placeholder = customPlaceholder(placeholder, this.#selectedCountryData);
3957
3949
  }
3958
3950
  this.#ui.telInput.setAttribute("placeholder", placeholder);
3959
3951
  }
@@ -4052,14 +4044,16 @@ var factoryOutput = (() => {
4052
4044
  fullNumber,
4053
4045
  hasValidDialCode,
4054
4046
  this.#options.separateDialCode,
4055
- this.#selectedCountryData ?? {}
4047
+ this.#selectedCountryData
4056
4048
  );
4057
4049
  return this.#cap(number);
4058
4050
  }
4059
4051
  //* Return only the public-facing subset of the selected country data.
4060
4052
  #getPublicCountryData() {
4061
4053
  const d = this.#selectedCountryData;
4062
- if (!d) return {};
4054
+ if (!d) {
4055
+ return null;
4056
+ }
4063
4057
  const { iso2, dialCode, name } = d;
4064
4058
  return { iso2, dialCode, name };
4065
4059
  }
@@ -4073,32 +4067,32 @@ var factoryOutput = (() => {
4073
4067
  //**************************
4074
4068
  //* Called when the geoip call returns.
4075
4069
  #handleAutoCountry() {
4076
- if (!this.#ui.telInput) {
4077
- this.#resolveAutoCountryPromise?.();
4070
+ if (this.#destroyed) {
4071
+ this.#autoCountryDeferred?.resolve();
4078
4072
  return;
4079
4073
  }
4080
4074
  if (this.#options.initialCountry === INITIAL_COUNTRY.AUTO && intlTelInput.autoCountry) {
4081
4075
  this.#defaultCountry = intlTelInput.autoCountry;
4082
- const hasSelectedCountryOrGlobe = this.#selectedCountryData?.iso2 || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
4076
+ const hasSelectedCountryOrGlobe = this.#selectedCountryData || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
4083
4077
  if (!hasSelectedCountryOrGlobe) {
4084
4078
  this.setCountry(this.#defaultCountry);
4085
4079
  }
4086
- this.#resolveAutoCountryPromise();
4080
+ this.#autoCountryDeferred?.resolve();
4087
4081
  }
4088
4082
  }
4089
4083
  //* Called when the geoip call fails or times out.
4090
4084
  #handleAutoCountryFailure() {
4091
- if (!this.#ui.telInput) {
4092
- this.#rejectAutoCountryPromise?.();
4085
+ if (this.#destroyed) {
4086
+ this.#autoCountryDeferred?.reject();
4093
4087
  return;
4094
4088
  }
4095
4089
  this.#setInitialState(true);
4096
- this.#rejectAutoCountryPromise();
4090
+ this.#autoCountryDeferred?.reject();
4097
4091
  }
4098
4092
  //* Called when the utils request completes.
4099
4093
  #handleUtils() {
4100
- if (!this.#ui.telInput) {
4101
- this.#resolveUtilsScriptPromise?.();
4094
+ if (this.#destroyed) {
4095
+ this.#utilsScriptDeferred?.resolve();
4102
4096
  return;
4103
4097
  }
4104
4098
  if (intlTelInput.utils) {
@@ -4106,74 +4100,77 @@ var factoryOutput = (() => {
4106
4100
  if (inputValue) {
4107
4101
  this.#updateValFromNumber(inputValue);
4108
4102
  }
4109
- if (this.#selectedCountryData?.iso2) {
4103
+ if (this.#selectedCountryData) {
4110
4104
  this.#updatePlaceholder();
4111
4105
  this.#updateMaxLength();
4112
4106
  }
4113
4107
  }
4114
- this.#resolveUtilsScriptPromise();
4108
+ this.#utilsScriptDeferred?.resolve();
4115
4109
  }
4116
4110
  //* Called when the utils request fails or times out.
4117
4111
  #handleUtilsFailure(error) {
4118
- if (!this.#ui.telInput) {
4119
- this.#rejectUtilsScriptPromise?.(error);
4112
+ if (this.#destroyed) {
4113
+ this.#utilsScriptDeferred?.reject(error);
4120
4114
  return;
4121
4115
  }
4122
- this.#rejectUtilsScriptPromise(error);
4116
+ this.#utilsScriptDeferred?.reject(error);
4123
4117
  }
4124
4118
  //********************
4125
4119
  //* PUBLIC METHODS
4126
4120
  //********************
4127
4121
  //* Remove plugin.
4128
4122
  destroy() {
4129
- if (!this.#ui.telInput) {
4123
+ if (this.#destroyed) {
4130
4124
  return;
4131
4125
  }
4126
+ this.#destroyed = true;
4132
4127
  if (this.#options.allowDropdown) {
4133
4128
  this.#closeDropdown(true);
4134
4129
  }
4135
4130
  this.#abortController.abort();
4136
- this.#abortController = null;
4137
4131
  this.#ui.destroy();
4138
- delete intlTelInput.instances[this.id];
4132
+ intlTelInput.instances.delete(String(this.id));
4139
4133
  }
4140
- // check if the instance is still valid (not destroyed/unmounted)
4134
+ // check if the instance is still valid (not destroyed)
4141
4135
  isActive() {
4142
- return !!this.#ui?.telInput;
4136
+ return !this.#destroyed;
4143
4137
  }
4144
4138
  //* Get the extension from the current number.
4145
4139
  getExtension() {
4146
- if (intlTelInput.utils && this.#ui.telInput) {
4147
- return intlTelInput.utils.getExtension(
4148
- this.#getFullNumber(),
4149
- this.#selectedCountryData?.iso2
4150
- );
4140
+ if (this.#destroyed) {
4141
+ return "";
4151
4142
  }
4152
- return "";
4143
+ ensureUtils("getExtension");
4144
+ return intlTelInput.utils.getExtension(
4145
+ this.#getFullNumber(),
4146
+ this.#selectedCountryData?.iso2
4147
+ );
4153
4148
  }
4154
4149
  //* Format the number to the given format.
4155
4150
  getNumber(format) {
4156
- if (intlTelInput.utils && this.#ui.telInput) {
4157
- const iso2 = this.#selectedCountryData?.iso2;
4158
- const fullNumber = this.#getFullNumber();
4159
- const formattedNumber = intlTelInput.utils.formatNumber(
4160
- fullNumber,
4161
- iso2,
4162
- format
4163
- );
4164
- return this.#numerals.denormalise(formattedNumber);
4151
+ if (this.#destroyed) {
4152
+ return "";
4165
4153
  }
4166
- return "";
4154
+ ensureUtils("getNumber");
4155
+ const iso2 = this.#selectedCountryData?.iso2;
4156
+ const fullNumber = this.#getFullNumber();
4157
+ const formattedNumber = intlTelInput.utils.formatNumber(
4158
+ fullNumber,
4159
+ iso2,
4160
+ format
4161
+ );
4162
+ return this.#numerals.denormalise(formattedNumber);
4167
4163
  }
4168
4164
  //* Get the type of the entered number e.g. landline/mobile.
4169
4165
  getNumberType() {
4170
- if (intlTelInput.utils && this.#ui.telInput) {
4171
- return intlTelInput.utils.getNumberType(
4172
- this.#getFullNumber(),
4173
- this.#selectedCountryData?.iso2
4174
- );
4166
+ if (this.#destroyed) {
4167
+ return SENTINELS.UNKNOWN_NUMBER_TYPE;
4175
4168
  }
4176
- return SENTINELS.UNKNOWN_NUMBER_TYPE;
4169
+ ensureUtils("getNumberType");
4170
+ return intlTelInput.utils.getNumberType(
4171
+ this.#getFullNumber(),
4172
+ this.#selectedCountryData?.iso2
4173
+ );
4177
4174
  }
4178
4175
  //* Get the country data for the currently selected country.
4179
4176
  getSelectedCountryData() {
@@ -4181,32 +4178,35 @@ var factoryOutput = (() => {
4181
4178
  }
4182
4179
  //* Get the validation error.
4183
4180
  getValidationError() {
4184
- if (intlTelInput.utils && this.#ui.telInput) {
4185
- const iso2 = this.#selectedCountryData?.iso2;
4186
- return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
4181
+ if (this.#destroyed) {
4182
+ return SENTINELS.UNKNOWN_VALIDATION_ERROR;
4187
4183
  }
4188
- return SENTINELS.UNKNOWN_VALIDATION_ERROR;
4184
+ ensureUtils("getValidationError");
4185
+ const iso2 = this.#selectedCountryData?.iso2;
4186
+ return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
4189
4187
  }
4190
4188
  //* Validate the input val using number length only
4191
4189
  isValidNumber() {
4190
+ if (this.#destroyed) {
4191
+ return null;
4192
+ }
4193
+ ensureUtils("isValidNumber");
4192
4194
  const dialCode = this.#selectedCountryData?.dialCode;
4193
4195
  const iso2 = this.#selectedCountryData?.iso2;
4194
- if (intlTelInput.utils && this.#ui.telInput) {
4195
- const number = this.#getFullNumber();
4196
- const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4197
- if (coreNumber) {
4198
- if (dialCode === UK.DIAL_CODE) {
4199
- if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
4200
- return false;
4201
- }
4196
+ const number = this.#getFullNumber();
4197
+ const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4198
+ if (coreNumber) {
4199
+ if (dialCode === UK.DIAL_CODE) {
4200
+ if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
4201
+ return false;
4202
4202
  }
4203
- const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
4204
- if (!hasAlphaChar && dialCode) {
4205
- const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
4206
- const nationalDigitCount = getNumeric(nationalPortion).length;
4207
- if (coreNumber.length > nationalDigitCount) {
4208
- return false;
4209
- }
4203
+ }
4204
+ const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
4205
+ if (!hasAlphaChar && dialCode) {
4206
+ const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
4207
+ const nationalDigitCount = getNumeric(nationalPortion).length;
4208
+ if (coreNumber.length > nationalDigitCount) {
4209
+ return false;
4210
4210
  }
4211
4211
  }
4212
4212
  }
@@ -4214,6 +4214,10 @@ var factoryOutput = (() => {
4214
4214
  }
4215
4215
  //* Validate the input val with precise validation
4216
4216
  isValidNumberPrecise() {
4217
+ if (this.#destroyed) {
4218
+ return null;
4219
+ }
4220
+ ensureUtils("isValidNumberPrecise");
4217
4221
  return this.#validateNumber(true);
4218
4222
  }
4219
4223
  #utilsIsPossibleNumber(val) {
@@ -4225,13 +4229,10 @@ var factoryOutput = (() => {
4225
4229
  }
4226
4230
  //* Shared internal validation logic to handle alpha character extension rules.
4227
4231
  #validateNumber(precise) {
4228
- if (!intlTelInput.utils || !this.#ui.telInput) {
4229
- return null;
4230
- }
4231
4232
  const { allowNumberExtensions, allowPhonewords } = this.#options;
4232
4233
  const testValidity = (s) => precise ? this.#utilsIsValidNumber(s) : this.#utilsIsPossibleNumber(s);
4233
4234
  const val = this.#getFullNumber();
4234
- if (!this.#selectedCountryData?.iso2) {
4235
+ if (!this.#selectedCountryData) {
4235
4236
  const isRegionlessDialCode = hasRegionlessDialCode(val);
4236
4237
  if (!isRegionlessDialCode) {
4237
4238
  return false;
@@ -4261,7 +4262,7 @@ var factoryOutput = (() => {
4261
4262
  }
4262
4263
  //* Update the selected country, and update the input val accordingly.
4263
4264
  setCountry(iso2) {
4264
- if (!this.#ui.telInput) {
4265
+ if (this.#destroyed) {
4265
4266
  return;
4266
4267
  }
4267
4268
  const iso2Lower = iso2?.toLowerCase();
@@ -4282,7 +4283,7 @@ var factoryOutput = (() => {
4282
4283
  }
4283
4284
  //* Set the input value and update the country.
4284
4285
  setNumber(number) {
4285
- if (!this.#ui.telInput) {
4286
+ if (this.#destroyed) {
4286
4287
  return;
4287
4288
  }
4288
4289
  const normalisedNumber = this.#numerals.normalise(number);
@@ -4293,16 +4294,17 @@ var factoryOutput = (() => {
4293
4294
  }
4294
4295
  this.#trigger(EVENTS.INPUT, { isSetNumber: true });
4295
4296
  }
4296
- //* Set the placeholder number typ
4297
+ //* Set the placeholder number type
4297
4298
  setPlaceholderNumberType(type) {
4298
- if (!this.#ui.telInput) {
4299
+ if (this.#destroyed) {
4299
4300
  return;
4300
4301
  }
4301
4302
  this.#options.placeholderNumberType = type;
4302
4303
  this.#updatePlaceholder();
4303
4304
  }
4305
+ // Set the disabled state of the input and dropdown.
4304
4306
  setDisabled(disabled) {
4305
- if (!this.#ui.telInput) {
4307
+ if (this.#destroyed) {
4306
4308
  return;
4307
4309
  }
4308
4310
  this.#ui.telInput.disabled = disabled;
@@ -4314,6 +4316,20 @@ var factoryOutput = (() => {
4314
4316
  }
4315
4317
  }
4316
4318
  }
4319
+ // Set the readonly state of the input and dropdown.
4320
+ setReadonly(readonly) {
4321
+ if (!this.#ui.telInput) {
4322
+ return;
4323
+ }
4324
+ this.#ui.telInput.readOnly = readonly;
4325
+ if (this.#ui.selectedCountry) {
4326
+ if (readonly) {
4327
+ this.#ui.selectedCountry.setAttribute("disabled", "true");
4328
+ } else {
4329
+ this.#ui.selectedCountry.removeAttribute("disabled");
4330
+ }
4331
+ }
4332
+ }
4317
4333
  //********************
4318
4334
  //* STATIC METHODS
4319
4335
  //********************
@@ -4321,7 +4337,7 @@ var factoryOutput = (() => {
4321
4337
  // Kept public so module-level helpers (e.g. attachUtils) can call it, while still allowing
4322
4338
  // access to private instance methods.
4323
4339
  static forEachInstance(method, ...args) {
4324
- const values = Object.values(intlTelInput.instances);
4340
+ const values = [...intlTelInput.instances.values()];
4325
4341
  const arg = args[0];
4326
4342
  values.forEach((instance) => {
4327
4343
  if (!(instance instanceof _Iti)) {
@@ -4381,7 +4397,7 @@ var factoryOutput = (() => {
4381
4397
  var intlTelInput = Object.assign(
4382
4398
  (input, options) => {
4383
4399
  const iti = new Iti(input, options);
4384
- intlTelInput.instances[iti.id] = iti;
4400
+ intlTelInput.instances.set(String(iti.id), iti);
4385
4401
  input.iti = iti;
4386
4402
  return iti;
4387
4403
  },
@@ -4394,20 +4410,17 @@ var factoryOutput = (() => {
4394
4410
  //* A getter for the plugin instance.
4395
4411
  getInstance: (input) => {
4396
4412
  const id2 = input.dataset.intlTelInputId;
4397
- return id2 ? intlTelInput.instances[id2] : null;
4413
+ return id2 ? intlTelInput.instances.get(id2) ?? null : null;
4398
4414
  },
4399
4415
  //* A map from instance ID to instance object.
4400
- instances: {},
4416
+ instances: /* @__PURE__ */ new Map(),
4401
4417
  attachUtils,
4402
4418
  startedLoadingUtilsScript: false,
4403
4419
  startedLoadingAutoCountry: false,
4404
- version: "26.9.2"
4420
+ version: "27.0.0"
4405
4421
  }
4406
4422
  );
4407
4423
  var intl_tel_input_default = intlTelInput;
4408
4424
  return __toCommonJS(intl_tel_input_exports);
4409
4425
  })();
4410
-
4411
- // UMD
4412
- return factoryOutput.default;
4413
- }));
4426
+ var intlTelInput = _factory.default;