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,4 +1,4 @@
1
- // src/js/intl-tel-input/data.ts
1
+ // dist/js/intlTelInput.mjs
2
2
  var rawCountryData = [
3
3
  [
4
4
  "af",
@@ -1700,8 +1700,6 @@ for (const c of rawCountryData) {
1700
1700
  var iso2Set = new Set(allCountries.map((c) => c.iso2));
1701
1701
  var isIso2 = (val) => iso2Set.has(val);
1702
1702
  var data_default = allCountries;
1703
-
1704
- // src/js/modules/constants.ts
1705
1703
  var EVENTS = {
1706
1704
  OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1707
1705
  CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
@@ -1821,11 +1819,9 @@ var ARIA = {
1821
1819
  AUTOCOMPLETE: "aria-autocomplete",
1822
1820
  MODAL: "aria-modal"
1823
1821
  };
1824
-
1825
- // src/js/intl-tel-input/i18n/en/index.ts
1826
1822
  var interfaceTranslations = {
1827
- selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1828
- noCountrySelected: "Select country",
1823
+ selectedCountryAriaLabel: "Change country for phone number, currently selected ${countryName} (${dialCode})",
1824
+ noCountrySelected: "Select country for phone number",
1829
1825
  countryListAriaLabel: "List of countries",
1830
1826
  searchPlaceholder: "Search",
1831
1827
  clearSearchAriaLabel: "Clear search",
@@ -1841,8 +1837,6 @@ var interfaceTranslations = {
1841
1837
  }
1842
1838
  };
1843
1839
  var en_default = interfaceTranslations;
1844
-
1845
- // src/js/modules/core/options.ts
1846
1840
  var mq = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
1847
1841
  var isNarrowViewport = () => mq(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
1848
1842
  var computeDefaultUseFullscreenPopup = () => {
@@ -1879,7 +1873,7 @@ var defaults = {
1879
1873
  //* Append menu to specified element.
1880
1874
  dropdownContainer: null,
1881
1875
  //* Don't display these countries.
1882
- excludeCountries: [],
1876
+ excludeCountries: null,
1883
1877
  //* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
1884
1878
  fixDropdownWidth: true,
1885
1879
  //* Format the number as the user types
@@ -1899,7 +1893,7 @@ var defaults = {
1899
1893
  //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
1900
1894
  nationalMode: true,
1901
1895
  //* Display only these countries.
1902
- onlyCountries: [],
1896
+ onlyCountries: null,
1903
1897
  //* Number type to use for placeholders.
1904
1898
  placeholderNumberType: "MOBILE",
1905
1899
  //* Add custom classes to the search input element.
@@ -1917,7 +1911,9 @@ var toString = (val) => JSON.stringify(val);
1917
1911
  var isPlainObject = (val) => Boolean(val) && typeof val === "object" && !Array.isArray(val);
1918
1912
  var isFn = (val) => typeof val === "function";
1919
1913
  var isElLike = (val) => {
1920
- if (!val || typeof val !== "object") return false;
1914
+ if (!val || typeof val !== "object") {
1915
+ return false;
1916
+ }
1921
1917
  const v = val;
1922
1918
  return v.nodeType === 1 && typeof v.tagName === "string" && typeof v.appendChild === "function";
1923
1919
  };
@@ -2032,9 +2028,13 @@ var validateOptions = (customOptions) => {
2032
2028
  break;
2033
2029
  case "excludeCountries":
2034
2030
  case "onlyCountries": {
2035
- const filtered = validateIso2Array(key, value);
2036
- if (filtered !== false) {
2037
- validatedOptions[key] = filtered;
2031
+ if (value === null) {
2032
+ validatedOptions[key] = value;
2033
+ } else {
2034
+ const filtered = validateIso2Array(key, value);
2035
+ if (filtered !== false) {
2036
+ validatedOptions[key] = filtered;
2037
+ }
2038
2038
  }
2039
2039
  break;
2040
2040
  }
@@ -2118,7 +2118,7 @@ var applyOptionSideEffects = (o) => {
2118
2118
  o.fixDropdownWidth = true;
2119
2119
  }
2120
2120
  }
2121
- if (o.onlyCountries.length === 1) {
2121
+ if (o.onlyCountries?.length === 1) {
2122
2122
  o.initialCountry = o.onlyCountries[0];
2123
2123
  }
2124
2124
  if (o.separateDialCode) {
@@ -2132,15 +2132,9 @@ var applyOptionSideEffects = (o) => {
2132
2132
  }
2133
2133
  o.i18n = { ...en_default, ...o.i18n };
2134
2134
  };
2135
-
2136
- // src/js/modules/utils/string.ts
2137
2135
  var getNumeric = (s) => s.replace(/\D/g, "");
2138
2136
  var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2139
-
2140
- // src/js/modules/utils/isAndroid.ts
2141
2137
  var getIsAndroid = () => typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
2142
-
2143
- // src/js/modules/core/countrySearch.ts
2144
2138
  var getMatchedCountries = (countries, query) => {
2145
2139
  const normalisedQuery = normaliseString(query);
2146
2140
  const iso2Matches = [];
@@ -2184,8 +2178,6 @@ var findFirstCountryStartingWith = (countries, query) => {
2184
2178
  }
2185
2179
  return null;
2186
2180
  };
2187
-
2188
- // src/js/modules/utils/dom.ts
2189
2181
  var buildClassNames = (flags) => Object.keys(flags).filter((k) => Boolean(flags[k])).join(" ");
2190
2182
  var createEl = (tagName, attrs, container) => {
2191
2183
  const el = document.createElement(tagName);
@@ -2199,8 +2191,6 @@ var createEl = (tagName, attrs, container) => {
2199
2191
  }
2200
2192
  return el;
2201
2193
  };
2202
-
2203
- // src/js/modules/core/icons.ts
2204
2194
  var buildSearchIcon = () => `
2205
2195
  <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${ARIA.HIDDEN}="true">
2206
2196
  <circle cx="11" cy="11" r="7" />
@@ -2226,32 +2216,14 @@ var buildGlobeIcon = () => `
2226
2216
  <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"/>
2227
2217
  <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"/>
2228
2218
  </svg>`;
2229
-
2230
- // src/js/modules/core/ui.ts
2231
2219
  var UI = class _UI {
2232
- constructor(input, options, id2) {
2233
- this.#searchKeyupTimer = null;
2234
- this.#inlineDropdownHeight = null;
2235
- this.#dropdownForContainer = null;
2236
- this.#selectedItem = null;
2237
- this.highlightedItem = null;
2238
- input.dataset.intlTelInputId = id2.toString();
2239
- this.telInput = input;
2240
- this.#options = options;
2241
- this.#id = id2;
2242
- this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
2243
- this.#isRTL = !!this.telInput.closest("[dir=rtl]");
2244
- if (this.#options.separateDialCode) {
2245
- this.#originalPaddingLeft = this.telInput.style.paddingLeft;
2246
- }
2247
- }
2248
2220
  // private
2249
2221
  #options;
2250
2222
  #id;
2251
2223
  #isRTL;
2252
- #originalPaddingLeft;
2224
+ #originalPaddingLeft = "";
2253
2225
  #countries;
2254
- #searchKeyupTimer;
2226
+ #searchKeyupTimer = null;
2255
2227
  #inlineDropdownHeight;
2256
2228
  #selectedDialCode;
2257
2229
  #dropdownArrow;
@@ -2260,7 +2232,30 @@ var UI = class _UI {
2260
2232
  #searchNoResults;
2261
2233
  #searchResultsA11yText;
2262
2234
  #dropdownForContainer;
2263
- #selectedItem;
2235
+ #selectedItem = null;
2236
+ // public
2237
+ telInput;
2238
+ countryContainer;
2239
+ selectedCountry;
2240
+ selectedCountryInner;
2241
+ searchInput;
2242
+ searchClearButton;
2243
+ countryList;
2244
+ hiddenInputPhone;
2245
+ hiddenInputCountry;
2246
+ highlightedItem = null;
2247
+ hadInitialPlaceholder;
2248
+ constructor(input, options, id2) {
2249
+ input.dataset.intlTelInputId = id2.toString();
2250
+ this.telInput = input;
2251
+ this.#options = options;
2252
+ this.#id = id2;
2253
+ this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
2254
+ this.#isRTL = !!this.telInput.closest("[dir=rtl]");
2255
+ if (this.#options.separateDialCode) {
2256
+ this.#originalPaddingLeft = this.telInput.style.paddingLeft;
2257
+ }
2258
+ }
2264
2259
  // Validate that the provided element is an HTMLInputElement.
2265
2260
  static validateInput(input) {
2266
2261
  const tagName = input?.tagName;
@@ -2276,6 +2271,9 @@ var UI = class _UI {
2276
2271
  generateMarkup(countries) {
2277
2272
  this.#countries = countries;
2278
2273
  this.telInput.classList.add("iti__tel-input");
2274
+ if (!this.telInput.hasAttribute("type")) {
2275
+ this.telInput.setAttribute("type", "tel");
2276
+ }
2279
2277
  if (!this.telInput.hasAttribute("autocomplete")) {
2280
2278
  this.telInput.setAttribute("autocomplete", "tel");
2281
2279
  }
@@ -2495,7 +2493,7 @@ var UI = class _UI {
2495
2493
  },
2496
2494
  this.#dropdownContent
2497
2495
  );
2498
- this.#searchNoResults.textContent = i18n.searchEmptyState;
2496
+ this.#searchNoResults.textContent = i18n.searchEmptyState ?? null;
2499
2497
  }
2500
2498
  #maybeUpdateInputPaddingAndReveal() {
2501
2499
  if (this.countryContainer) {
@@ -2513,13 +2511,13 @@ var UI = class _UI {
2513
2511
  `input[name="${names.phone}"]`
2514
2512
  );
2515
2513
  if (existingInput) {
2516
- this.hiddenInput = existingInput;
2514
+ this.hiddenInputPhone = existingInput;
2517
2515
  } else {
2518
- this.hiddenInput = createEl("input", {
2516
+ this.hiddenInputPhone = createEl("input", {
2519
2517
  type: "hidden",
2520
2518
  name: names.phone
2521
2519
  });
2522
- wrapper.appendChild(this.hiddenInput);
2520
+ wrapper.appendChild(this.hiddenInputPhone);
2523
2521
  }
2524
2522
  }
2525
2523
  if (names.country) {
@@ -2764,28 +2762,9 @@ var UI = class _UI {
2764
2762
  const wrapper = this.telInput.parentNode;
2765
2763
  wrapper.before(this.telInput);
2766
2764
  wrapper.remove();
2767
- this.telInput = null;
2768
- this.countryContainer = null;
2769
- this.selectedCountry = null;
2770
- this.selectedCountryInner = null;
2771
- this.searchInput = null;
2772
- this.searchClearButton = null;
2773
- this.countryList = null;
2774
- this.hiddenInput = null;
2775
- this.hiddenInputCountry = null;
2776
- this.highlightedItem = null;
2777
- this.#selectedDialCode = null;
2778
- this.#dropdownArrow = null;
2779
- this.#dropdownContent = null;
2780
- this.#searchIcon = null;
2781
- this.#searchNoResults = null;
2782
- this.#searchResultsA11yText = null;
2783
- this.#dropdownForContainer = null;
2784
- this.#selectedItem = null;
2785
2765
  for (const c of this.#countries) {
2786
2766
  delete c.nodeById[this.#id];
2787
2767
  }
2788
- this.#countries = null;
2789
2768
  }
2790
2769
  // UI: Open the dropdown (DOM only).
2791
2770
  openDropdown() {
@@ -2809,10 +2788,10 @@ var UI = class _UI {
2809
2788
  this.#dropdownContent.classList.remove(CLASSES.HIDE);
2810
2789
  this.selectedCountry.setAttribute(ARIA.EXPANDED, "true");
2811
2790
  if (countrySearch) {
2812
- const firstCountryItem = this.countryList.firstElementChild;
2813
- if (firstCountryItem) {
2814
- this.highlightListItem(firstCountryItem, false);
2815
- this.countryList.scrollTop = 0;
2791
+ const itemToHighlight = this.#selectedItem ?? this.countryList.firstElementChild;
2792
+ if (itemToHighlight) {
2793
+ this.highlightListItem(itemToHighlight, false);
2794
+ this.scrollCountryListToItem(itemToHighlight);
2816
2795
  }
2817
2796
  if (!dropdownAlwaysOpen) {
2818
2797
  this.searchInput.focus();
@@ -2827,6 +2806,8 @@ var UI = class _UI {
2827
2806
  this.selectedCountry.setAttribute(ARIA.EXPANDED, "false");
2828
2807
  if (countrySearch) {
2829
2808
  this.searchInput.removeAttribute(ARIA.ACTIVE_DESCENDANT);
2809
+ this.searchInput.value = "";
2810
+ this.#doFilter();
2830
2811
  if (this.highlightedItem) {
2831
2812
  this.highlightedItem.classList.remove(CLASSES.HIGHLIGHT);
2832
2813
  this.highlightedItem = null;
@@ -2881,7 +2862,9 @@ var UI = class _UI {
2881
2862
  }
2882
2863
  setCountry(selectedCountryData) {
2883
2864
  const { allowDropdown, showFlags, separateDialCode, i18n } = this.#options;
2884
- const { name, dialCode, iso2 = "" } = selectedCountryData;
2865
+ const name = selectedCountryData?.name;
2866
+ const dialCode = selectedCountryData?.dialCode;
2867
+ const iso2 = selectedCountryData?.iso2 ?? "";
2885
2868
  if (allowDropdown) {
2886
2869
  this.#updateSelectedItem(iso2);
2887
2870
  }
@@ -2909,8 +2892,6 @@ var UI = class _UI {
2909
2892
  }
2910
2893
  }
2911
2894
  };
2912
-
2913
- // src/js/modules/data/country-data.ts
2914
2895
  var processAllCountries = (options) => {
2915
2896
  const { onlyCountries, excludeCountries } = options;
2916
2897
  if (onlyCountries?.length) {
@@ -3014,8 +2995,6 @@ var cacheSearchTokens = (countries) => {
3014
2995
  c.dialCodePlus = `+${c.dialCode}`;
3015
2996
  }
3016
2997
  };
3017
-
3018
- // src/js/modules/data/intl-regionless.ts
3019
2998
  var REGIONLESS_DIAL_CODES = /* @__PURE__ */ new Set([
3020
2999
  "800",
3021
3000
  "808",
@@ -3030,8 +3009,6 @@ var hasRegionlessDialCode = (number) => {
3030
3009
  const dialCode = getNumeric(number).slice(0, 3);
3031
3010
  return number.startsWith("+") && REGIONLESS_DIAL_CODES.has(dialCode);
3032
3011
  };
3033
-
3034
- // src/js/modules/format/formatting.ts
3035
3012
  var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedCountryData) => {
3036
3013
  let number = fullNumber;
3037
3014
  if (separateDialCode) {
@@ -3044,16 +3021,14 @@ var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedC
3044
3021
  return number;
3045
3022
  };
3046
3023
  var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountryData, separateDialCode) => {
3047
- const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData.iso2) : fullNumber;
3048
- const { dialCode } = selectedCountryData;
3024
+ const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData?.iso2) : fullNumber;
3025
+ const dialCode = selectedCountryData?.dialCode;
3049
3026
  if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
3050
3027
  const afterDialCode = result.split(`+${dialCode}`)[1] || "";
3051
3028
  return afterDialCode.trim();
3052
3029
  }
3053
3030
  return result;
3054
3031
  };
3055
-
3056
- // src/js/modules/format/caret.ts
3057
3032
  var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
3058
3033
  if (prevCaretPos === 0 && !isDeleteForwards) {
3059
3034
  return 0;
@@ -3072,8 +3047,6 @@ var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDe
3072
3047
  }
3073
3048
  return formattedValue.length;
3074
3049
  };
3075
-
3076
- // src/js/modules/data/nanp-regionless.ts
3077
3050
  var regionlessNanpNumbers = /* @__PURE__ */ new Set([
3078
3051
  "800",
3079
3052
  "822",
@@ -3101,8 +3074,6 @@ var isRegionlessNanp = (number) => {
3101
3074
  }
3102
3075
  return false;
3103
3076
  };
3104
-
3105
- // src/js/modules/core/numerals.ts
3106
3077
  var Numerals = class {
3107
3078
  #userNumeralSet;
3108
3079
  constructor(initialValue) {
@@ -3146,10 +3117,27 @@ var Numerals = class {
3146
3117
  return !this.#userNumeralSet || this.#userNumeralSet === "ascii";
3147
3118
  }
3148
3119
  };
3149
-
3150
- // src/js/intl-tel-input.ts
3151
3120
  var id = 0;
3121
+ var ensureUtils = (methodName) => {
3122
+ if (!intlTelInput.utils) {
3123
+ throw new Error(`intlTelInput.utils is required for ${methodName}(). See: https://intl-tel-input.com/docs/utils`);
3124
+ }
3125
+ };
3126
+ var createDeferred = () => {
3127
+ let resolve;
3128
+ let reject;
3129
+ const promise = new Promise((res, rej) => {
3130
+ resolve = res;
3131
+ reject = rej;
3132
+ });
3133
+ return { promise, resolve, reject };
3134
+ };
3152
3135
  var Iti = class _Iti {
3136
+ //* PUBLIC FIELDS - READONLY
3137
+ //* Can't be private as it's called from intlTelInput convenience wrapper.
3138
+ id;
3139
+ // accessed externally via iti.promise.then(...)
3140
+ promise;
3153
3141
  //* PRIVATE FIELDS
3154
3142
  #ui;
3155
3143
  #options;
@@ -3160,16 +3148,15 @@ var Iti = class _Iti {
3160
3148
  #dialCodeToIso2Map;
3161
3149
  #dialCodes;
3162
3150
  #countryByIso2;
3163
- #selectedCountryData;
3164
- #maxCoreNumberLength;
3151
+ #selectedCountryData = null;
3152
+ #maxCoreNumberLength = null;
3165
3153
  #defaultCountry;
3154
+ #destroyed = false;
3166
3155
  #abortController;
3167
- #dropdownAbortController;
3156
+ #dropdownAbortController = null;
3168
3157
  #numerals;
3169
- #resolveAutoCountryPromise;
3170
- #rejectAutoCountryPromise;
3171
- #resolveUtilsScriptPromise;
3172
- #rejectUtilsScriptPromise;
3158
+ #autoCountryDeferred;
3159
+ #utilsScriptDeferred;
3173
3160
  constructor(input, customOptions = {}) {
3174
3161
  this.id = id++;
3175
3162
  UI.validateInput(input);
@@ -3202,37 +3189,19 @@ var Iti = class _Iti {
3202
3189
  const { initialCountry, geoIpLookup, loadUtils } = options;
3203
3190
  const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
3204
3191
  const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
3205
- let autoCountryPromise;
3206
3192
  if (needsAutoCountryPromise) {
3207
- autoCountryPromise = new Promise((resolve, reject) => {
3208
- this.#resolveAutoCountryPromise = resolve;
3209
- this.#rejectAutoCountryPromise = reject;
3210
- });
3211
- } else {
3212
- autoCountryPromise = Promise.resolve(void 0);
3213
- this.#resolveAutoCountryPromise = () => {
3214
- };
3215
- this.#rejectAutoCountryPromise = () => {
3216
- };
3193
+ this.#autoCountryDeferred = createDeferred();
3217
3194
  }
3218
- let utilsScriptPromise;
3219
3195
  if (needsUtilsScriptPromise) {
3220
- utilsScriptPromise = new Promise((resolve, reject) => {
3221
- this.#resolveUtilsScriptPromise = resolve;
3222
- this.#rejectUtilsScriptPromise = reject;
3223
- });
3224
- } else {
3225
- utilsScriptPromise = Promise.resolve(void 0);
3226
- this.#resolveUtilsScriptPromise = () => {
3227
- };
3228
- this.#rejectUtilsScriptPromise = () => {
3229
- };
3196
+ this.#utilsScriptDeferred = createDeferred();
3230
3197
  }
3231
- return Promise.all([autoCountryPromise, utilsScriptPromise]).then(() => {
3198
+ return Promise.all([
3199
+ this.#autoCountryDeferred?.promise,
3200
+ this.#utilsScriptDeferred?.promise
3201
+ ]).then(() => {
3232
3202
  });
3233
3203
  }
3234
3204
  #init() {
3235
- this.#selectedCountryData = null;
3236
3205
  this.#abortController = new AbortController();
3237
3206
  this.#processCountryData();
3238
3207
  this.#ui.generateMarkup(this.#countries);
@@ -3257,7 +3226,7 @@ var Iti = class _Iti {
3257
3226
  //* 2. Using explicit initialCountry
3258
3227
  #setInitialState(overrideAutoCountry = false) {
3259
3228
  const attributeValueRaw = this.#ui.telInput.getAttribute("value");
3260
- const attributeValue = this.#numerals.normalise(attributeValueRaw);
3229
+ const attributeValue = this.#numerals.normalise(attributeValueRaw ?? "");
3261
3230
  const inputValue = this.#getTelInputValue();
3262
3231
  const useAttribute = attributeValue && attributeValue.startsWith("+") && (!inputValue || !inputValue.startsWith("+"));
3263
3232
  const val = useAttribute ? attributeValue : inputValue;
@@ -3292,15 +3261,15 @@ var Iti = class _Iti {
3292
3261
  if (this.#options.allowDropdown) {
3293
3262
  this.#initDropdownListeners();
3294
3263
  }
3295
- if ((this.#ui.hiddenInput || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
3264
+ if ((this.#ui.hiddenInputPhone || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
3296
3265
  this.#initHiddenInputListener();
3297
3266
  }
3298
3267
  }
3299
3268
  //* Update hidden input on form submit.
3300
3269
  #initHiddenInputListener() {
3301
3270
  const handleHiddenInputSubmit = () => {
3302
- if (this.#ui.hiddenInput) {
3303
- this.#ui.hiddenInput.value = this.getNumber();
3271
+ if (this.#ui.hiddenInputPhone) {
3272
+ this.#ui.hiddenInputPhone.value = this.getNumber();
3304
3273
  }
3305
3274
  if (this.#ui.hiddenInputCountry) {
3306
3275
  this.#ui.hiddenInputCountry.value = this.#selectedCountryData?.iso2 || "";
@@ -3369,12 +3338,12 @@ var Iti = class _Iti {
3369
3338
  });
3370
3339
  }
3371
3340
  } else {
3372
- this.#resolveUtilsScriptPromise();
3341
+ this.#utilsScriptDeferred?.resolve();
3373
3342
  }
3374
3343
  const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
3375
3344
  if (isAutoCountry) {
3376
- if (this.#selectedCountryData?.iso2) {
3377
- this.#resolveAutoCountryPromise();
3345
+ if (this.#selectedCountryData) {
3346
+ this.#autoCountryDeferred?.resolve();
3378
3347
  } else {
3379
3348
  this.#loadAutoCountry();
3380
3349
  }
@@ -3469,7 +3438,7 @@ var Iti = class _Iti {
3469
3438
  fullNumber,
3470
3439
  inputValue,
3471
3440
  intlTelInput.utils,
3472
- this.#selectedCountryData ?? {},
3441
+ this.#selectedCountryData,
3473
3442
  separateDialCode
3474
3443
  );
3475
3444
  const newCaretPos = translateCursorPosition(
@@ -3486,7 +3455,7 @@ var Iti = class _Iti {
3486
3455
  inputValue,
3487
3456
  true,
3488
3457
  separateDialCode,
3489
- this.#selectedCountryData ?? {}
3458
+ this.#selectedCountryData
3490
3459
  );
3491
3460
  this.#setTelInputValue(cleanNumber);
3492
3461
  }
@@ -3519,8 +3488,8 @@ var Iti = class _Iti {
3519
3488
  const input = this.#ui.telInput;
3520
3489
  const selStart = input.selectionStart;
3521
3490
  const selEnd = input.selectionEnd;
3522
- const before = inputValue.slice(0, selStart);
3523
- const after = inputValue.slice(selEnd);
3491
+ const before = inputValue.slice(0, selStart ?? void 0);
3492
+ const after = inputValue.slice(selEnd ?? void 0);
3524
3493
  const newValue = before + e.key + after;
3525
3494
  const newFullNumber = this.#getFullNumber(newValue);
3526
3495
  let hasExceededMaxLength = false;
@@ -3552,8 +3521,8 @@ var Iti = class _Iti {
3552
3521
  const selStart = input.selectionStart;
3553
3522
  const selEnd = input.selectionEnd;
3554
3523
  const inputValue = this.#getTelInputValue();
3555
- const before = inputValue.slice(0, selStart);
3556
- const after = inputValue.slice(selEnd);
3524
+ const before = inputValue.slice(0, selStart ?? void 0);
3525
+ const after = inputValue.slice(selEnd ?? void 0);
3557
3526
  const iso2 = this.#selectedCountryData?.iso2;
3558
3527
  const pastedRaw = e.clipboardData.getData("text");
3559
3528
  const pasted = this.#numerals.normalise(pastedRaw);
@@ -3564,7 +3533,7 @@ var Iti = class _Iti {
3564
3533
  const numerics = allowedChars.replace(/\+/g, "");
3565
3534
  const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
3566
3535
  let newVal = before + sanitised + after;
3567
- if (newVal.length > 5) {
3536
+ if (newVal.length > 5 && intlTelInput.utils) {
3568
3537
  let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
3569
3538
  while (coreNumber.length === 0 && newVal.length > 0) {
3570
3539
  newVal = newVal.slice(0, -1);
@@ -3854,10 +3823,10 @@ var Iti = class _Iti {
3854
3823
  #setCountry(iso2) {
3855
3824
  const prevIso2 = this.#selectedCountryData?.iso2 || "";
3856
3825
  this.#selectedCountryData = iso2 ? this.#countryByIso2.get(iso2) : null;
3857
- if (this.#selectedCountryData?.iso2) {
3826
+ if (this.#selectedCountryData) {
3858
3827
  this.#defaultCountry = this.#selectedCountryData.iso2;
3859
3828
  }
3860
- this.#ui.setCountry(this.#selectedCountryData ?? {});
3829
+ this.#ui.setCountry(this.#selectedCountryData);
3861
3830
  this.#updatePlaceholder();
3862
3831
  this.#updateMaxLength();
3863
3832
  return prevIso2 !== iso2;
@@ -3905,14 +3874,14 @@ var Iti = class _Iti {
3905
3874
  const shouldSetPlaceholder = autoPlaceholder === PLACEHOLDER_MODES.AGGRESSIVE || !this.#ui.hadInitialPlaceholder && autoPlaceholder === PLACEHOLDER_MODES.POLITE;
3906
3875
  if (intlTelInput.utils && shouldSetPlaceholder) {
3907
3876
  const numberType = intlTelInput.utils.numberType[placeholderNumberType];
3908
- let placeholder = this.#selectedCountryData?.iso2 ? intlTelInput.utils.getExampleNumber(
3877
+ let placeholder = this.#selectedCountryData ? intlTelInput.utils.getExampleNumber(
3909
3878
  this.#selectedCountryData.iso2,
3910
3879
  nationalMode,
3911
3880
  numberType
3912
3881
  ) : "";
3913
3882
  placeholder = this.#beforeSetNumber(placeholder);
3914
3883
  if (typeof customPlaceholder === "function") {
3915
- placeholder = customPlaceholder(placeholder, this.#selectedCountryData ?? {});
3884
+ placeholder = customPlaceholder(placeholder, this.#selectedCountryData);
3916
3885
  }
3917
3886
  this.#ui.telInput.setAttribute("placeholder", placeholder);
3918
3887
  }
@@ -4011,14 +3980,16 @@ var Iti = class _Iti {
4011
3980
  fullNumber,
4012
3981
  hasValidDialCode,
4013
3982
  this.#options.separateDialCode,
4014
- this.#selectedCountryData ?? {}
3983
+ this.#selectedCountryData
4015
3984
  );
4016
3985
  return this.#cap(number);
4017
3986
  }
4018
3987
  //* Return only the public-facing subset of the selected country data.
4019
3988
  #getPublicCountryData() {
4020
3989
  const d = this.#selectedCountryData;
4021
- if (!d) return {};
3990
+ if (!d) {
3991
+ return null;
3992
+ }
4022
3993
  const { iso2, dialCode, name } = d;
4023
3994
  return { iso2, dialCode, name };
4024
3995
  }
@@ -4032,32 +4003,32 @@ var Iti = class _Iti {
4032
4003
  //**************************
4033
4004
  //* Called when the geoip call returns.
4034
4005
  #handleAutoCountry() {
4035
- if (!this.#ui.telInput) {
4036
- this.#resolveAutoCountryPromise?.();
4006
+ if (this.#destroyed) {
4007
+ this.#autoCountryDeferred?.resolve();
4037
4008
  return;
4038
4009
  }
4039
4010
  if (this.#options.initialCountry === INITIAL_COUNTRY.AUTO && intlTelInput.autoCountry) {
4040
4011
  this.#defaultCountry = intlTelInput.autoCountry;
4041
- const hasSelectedCountryOrGlobe = this.#selectedCountryData?.iso2 || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
4012
+ const hasSelectedCountryOrGlobe = this.#selectedCountryData || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
4042
4013
  if (!hasSelectedCountryOrGlobe) {
4043
4014
  this.setCountry(this.#defaultCountry);
4044
4015
  }
4045
- this.#resolveAutoCountryPromise();
4016
+ this.#autoCountryDeferred?.resolve();
4046
4017
  }
4047
4018
  }
4048
4019
  //* Called when the geoip call fails or times out.
4049
4020
  #handleAutoCountryFailure() {
4050
- if (!this.#ui.telInput) {
4051
- this.#rejectAutoCountryPromise?.();
4021
+ if (this.#destroyed) {
4022
+ this.#autoCountryDeferred?.reject();
4052
4023
  return;
4053
4024
  }
4054
4025
  this.#setInitialState(true);
4055
- this.#rejectAutoCountryPromise();
4026
+ this.#autoCountryDeferred?.reject();
4056
4027
  }
4057
4028
  //* Called when the utils request completes.
4058
4029
  #handleUtils() {
4059
- if (!this.#ui.telInput) {
4060
- this.#resolveUtilsScriptPromise?.();
4030
+ if (this.#destroyed) {
4031
+ this.#utilsScriptDeferred?.resolve();
4061
4032
  return;
4062
4033
  }
4063
4034
  if (intlTelInput.utils) {
@@ -4065,74 +4036,77 @@ var Iti = class _Iti {
4065
4036
  if (inputValue) {
4066
4037
  this.#updateValFromNumber(inputValue);
4067
4038
  }
4068
- if (this.#selectedCountryData?.iso2) {
4039
+ if (this.#selectedCountryData) {
4069
4040
  this.#updatePlaceholder();
4070
4041
  this.#updateMaxLength();
4071
4042
  }
4072
4043
  }
4073
- this.#resolveUtilsScriptPromise();
4044
+ this.#utilsScriptDeferred?.resolve();
4074
4045
  }
4075
4046
  //* Called when the utils request fails or times out.
4076
4047
  #handleUtilsFailure(error) {
4077
- if (!this.#ui.telInput) {
4078
- this.#rejectUtilsScriptPromise?.(error);
4048
+ if (this.#destroyed) {
4049
+ this.#utilsScriptDeferred?.reject(error);
4079
4050
  return;
4080
4051
  }
4081
- this.#rejectUtilsScriptPromise(error);
4052
+ this.#utilsScriptDeferred?.reject(error);
4082
4053
  }
4083
4054
  //********************
4084
4055
  //* PUBLIC METHODS
4085
4056
  //********************
4086
4057
  //* Remove plugin.
4087
4058
  destroy() {
4088
- if (!this.#ui.telInput) {
4059
+ if (this.#destroyed) {
4089
4060
  return;
4090
4061
  }
4062
+ this.#destroyed = true;
4091
4063
  if (this.#options.allowDropdown) {
4092
4064
  this.#closeDropdown(true);
4093
4065
  }
4094
4066
  this.#abortController.abort();
4095
- this.#abortController = null;
4096
4067
  this.#ui.destroy();
4097
- delete intlTelInput.instances[this.id];
4068
+ intlTelInput.instances.delete(String(this.id));
4098
4069
  }
4099
- // check if the instance is still valid (not destroyed/unmounted)
4070
+ // check if the instance is still valid (not destroyed)
4100
4071
  isActive() {
4101
- return !!this.#ui?.telInput;
4072
+ return !this.#destroyed;
4102
4073
  }
4103
4074
  //* Get the extension from the current number.
4104
4075
  getExtension() {
4105
- if (intlTelInput.utils && this.#ui.telInput) {
4106
- return intlTelInput.utils.getExtension(
4107
- this.#getFullNumber(),
4108
- this.#selectedCountryData?.iso2
4109
- );
4076
+ if (this.#destroyed) {
4077
+ return "";
4110
4078
  }
4111
- return "";
4079
+ ensureUtils("getExtension");
4080
+ return intlTelInput.utils.getExtension(
4081
+ this.#getFullNumber(),
4082
+ this.#selectedCountryData?.iso2
4083
+ );
4112
4084
  }
4113
4085
  //* Format the number to the given format.
4114
4086
  getNumber(format) {
4115
- if (intlTelInput.utils && this.#ui.telInput) {
4116
- const iso2 = this.#selectedCountryData?.iso2;
4117
- const fullNumber = this.#getFullNumber();
4118
- const formattedNumber = intlTelInput.utils.formatNumber(
4119
- fullNumber,
4120
- iso2,
4121
- format
4122
- );
4123
- return this.#numerals.denormalise(formattedNumber);
4087
+ if (this.#destroyed) {
4088
+ return "";
4124
4089
  }
4125
- return "";
4090
+ ensureUtils("getNumber");
4091
+ const iso2 = this.#selectedCountryData?.iso2;
4092
+ const fullNumber = this.#getFullNumber();
4093
+ const formattedNumber = intlTelInput.utils.formatNumber(
4094
+ fullNumber,
4095
+ iso2,
4096
+ format
4097
+ );
4098
+ return this.#numerals.denormalise(formattedNumber);
4126
4099
  }
4127
4100
  //* Get the type of the entered number e.g. landline/mobile.
4128
4101
  getNumberType() {
4129
- if (intlTelInput.utils && this.#ui.telInput) {
4130
- return intlTelInput.utils.getNumberType(
4131
- this.#getFullNumber(),
4132
- this.#selectedCountryData?.iso2
4133
- );
4102
+ if (this.#destroyed) {
4103
+ return SENTINELS.UNKNOWN_NUMBER_TYPE;
4134
4104
  }
4135
- return SENTINELS.UNKNOWN_NUMBER_TYPE;
4105
+ ensureUtils("getNumberType");
4106
+ return intlTelInput.utils.getNumberType(
4107
+ this.#getFullNumber(),
4108
+ this.#selectedCountryData?.iso2
4109
+ );
4136
4110
  }
4137
4111
  //* Get the country data for the currently selected country.
4138
4112
  getSelectedCountryData() {
@@ -4140,32 +4114,35 @@ var Iti = class _Iti {
4140
4114
  }
4141
4115
  //* Get the validation error.
4142
4116
  getValidationError() {
4143
- if (intlTelInput.utils && this.#ui.telInput) {
4144
- const iso2 = this.#selectedCountryData?.iso2;
4145
- return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
4117
+ if (this.#destroyed) {
4118
+ return SENTINELS.UNKNOWN_VALIDATION_ERROR;
4146
4119
  }
4147
- return SENTINELS.UNKNOWN_VALIDATION_ERROR;
4120
+ ensureUtils("getValidationError");
4121
+ const iso2 = this.#selectedCountryData?.iso2;
4122
+ return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
4148
4123
  }
4149
4124
  //* Validate the input val using number length only
4150
4125
  isValidNumber() {
4126
+ if (this.#destroyed) {
4127
+ return null;
4128
+ }
4129
+ ensureUtils("isValidNumber");
4151
4130
  const dialCode = this.#selectedCountryData?.dialCode;
4152
4131
  const iso2 = this.#selectedCountryData?.iso2;
4153
- if (intlTelInput.utils && this.#ui.telInput) {
4154
- const number = this.#getFullNumber();
4155
- const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4156
- if (coreNumber) {
4157
- if (dialCode === UK.DIAL_CODE) {
4158
- if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
4159
- return false;
4160
- }
4132
+ const number = this.#getFullNumber();
4133
+ const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4134
+ if (coreNumber) {
4135
+ if (dialCode === UK.DIAL_CODE) {
4136
+ if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
4137
+ return false;
4161
4138
  }
4162
- const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
4163
- if (!hasAlphaChar && dialCode) {
4164
- const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
4165
- const nationalDigitCount = getNumeric(nationalPortion).length;
4166
- if (coreNumber.length > nationalDigitCount) {
4167
- return false;
4168
- }
4139
+ }
4140
+ const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
4141
+ if (!hasAlphaChar && dialCode) {
4142
+ const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
4143
+ const nationalDigitCount = getNumeric(nationalPortion).length;
4144
+ if (coreNumber.length > nationalDigitCount) {
4145
+ return false;
4169
4146
  }
4170
4147
  }
4171
4148
  }
@@ -4173,6 +4150,10 @@ var Iti = class _Iti {
4173
4150
  }
4174
4151
  //* Validate the input val with precise validation
4175
4152
  isValidNumberPrecise() {
4153
+ if (this.#destroyed) {
4154
+ return null;
4155
+ }
4156
+ ensureUtils("isValidNumberPrecise");
4176
4157
  return this.#validateNumber(true);
4177
4158
  }
4178
4159
  #utilsIsPossibleNumber(val) {
@@ -4184,13 +4165,10 @@ var Iti = class _Iti {
4184
4165
  }
4185
4166
  //* Shared internal validation logic to handle alpha character extension rules.
4186
4167
  #validateNumber(precise) {
4187
- if (!intlTelInput.utils || !this.#ui.telInput) {
4188
- return null;
4189
- }
4190
4168
  const { allowNumberExtensions, allowPhonewords } = this.#options;
4191
4169
  const testValidity = (s) => precise ? this.#utilsIsValidNumber(s) : this.#utilsIsPossibleNumber(s);
4192
4170
  const val = this.#getFullNumber();
4193
- if (!this.#selectedCountryData?.iso2) {
4171
+ if (!this.#selectedCountryData) {
4194
4172
  const isRegionlessDialCode = hasRegionlessDialCode(val);
4195
4173
  if (!isRegionlessDialCode) {
4196
4174
  return false;
@@ -4220,7 +4198,7 @@ var Iti = class _Iti {
4220
4198
  }
4221
4199
  //* Update the selected country, and update the input val accordingly.
4222
4200
  setCountry(iso2) {
4223
- if (!this.#ui.telInput) {
4201
+ if (this.#destroyed) {
4224
4202
  return;
4225
4203
  }
4226
4204
  const iso2Lower = iso2?.toLowerCase();
@@ -4241,7 +4219,7 @@ var Iti = class _Iti {
4241
4219
  }
4242
4220
  //* Set the input value and update the country.
4243
4221
  setNumber(number) {
4244
- if (!this.#ui.telInput) {
4222
+ if (this.#destroyed) {
4245
4223
  return;
4246
4224
  }
4247
4225
  const normalisedNumber = this.#numerals.normalise(number);
@@ -4252,16 +4230,17 @@ var Iti = class _Iti {
4252
4230
  }
4253
4231
  this.#trigger(EVENTS.INPUT, { isSetNumber: true });
4254
4232
  }
4255
- //* Set the placeholder number typ
4233
+ //* Set the placeholder number type
4256
4234
  setPlaceholderNumberType(type) {
4257
- if (!this.#ui.telInput) {
4235
+ if (this.#destroyed) {
4258
4236
  return;
4259
4237
  }
4260
4238
  this.#options.placeholderNumberType = type;
4261
4239
  this.#updatePlaceholder();
4262
4240
  }
4241
+ // Set the disabled state of the input and dropdown.
4263
4242
  setDisabled(disabled) {
4264
- if (!this.#ui.telInput) {
4243
+ if (this.#destroyed) {
4265
4244
  return;
4266
4245
  }
4267
4246
  this.#ui.telInput.disabled = disabled;
@@ -4273,6 +4252,20 @@ var Iti = class _Iti {
4273
4252
  }
4274
4253
  }
4275
4254
  }
4255
+ // Set the readonly state of the input and dropdown.
4256
+ setReadonly(readonly) {
4257
+ if (!this.#ui.telInput) {
4258
+ return;
4259
+ }
4260
+ this.#ui.telInput.readOnly = readonly;
4261
+ if (this.#ui.selectedCountry) {
4262
+ if (readonly) {
4263
+ this.#ui.selectedCountry.setAttribute("disabled", "true");
4264
+ } else {
4265
+ this.#ui.selectedCountry.removeAttribute("disabled");
4266
+ }
4267
+ }
4268
+ }
4276
4269
  //********************
4277
4270
  //* STATIC METHODS
4278
4271
  //********************
@@ -4280,7 +4273,7 @@ var Iti = class _Iti {
4280
4273
  // Kept public so module-level helpers (e.g. attachUtils) can call it, while still allowing
4281
4274
  // access to private instance methods.
4282
4275
  static forEachInstance(method, ...args) {
4283
- const values = Object.values(intlTelInput.instances);
4276
+ const values = [...intlTelInput.instances.values()];
4284
4277
  const arg = args[0];
4285
4278
  values.forEach((instance) => {
4286
4279
  if (!(instance instanceof _Iti)) {
@@ -4340,7 +4333,7 @@ var attachUtils = (source) => {
4340
4333
  var intlTelInput = Object.assign(
4341
4334
  (input, options) => {
4342
4335
  const iti = new Iti(input, options);
4343
- intlTelInput.instances[iti.id] = iti;
4336
+ intlTelInput.instances.set(String(iti.id), iti);
4344
4337
  input.iti = iti;
4345
4338
  return iti;
4346
4339
  },
@@ -4353,19 +4346,19 @@ var intlTelInput = Object.assign(
4353
4346
  //* A getter for the plugin instance.
4354
4347
  getInstance: (input) => {
4355
4348
  const id2 = input.dataset.intlTelInputId;
4356
- return id2 ? intlTelInput.instances[id2] : null;
4349
+ return id2 ? intlTelInput.instances.get(id2) ?? null : null;
4357
4350
  },
4358
4351
  //* A map from instance ID to instance object.
4359
- instances: {},
4352
+ instances: /* @__PURE__ */ new Map(),
4360
4353
  attachUtils,
4361
4354
  startedLoadingUtilsScript: false,
4362
4355
  startedLoadingAutoCountry: false,
4363
- version: "26.9.2"
4356
+ version: "27.0.0"
4364
4357
  }
4365
4358
  );
4366
4359
  var intl_tel_input_default = intlTelInput;
4367
4360
 
4368
- // react/src/intl-tel-input/react.tsx
4361
+ // react/src/IntlTelInput.tsx
4369
4362
  import React, {
4370
4363
  useRef,
4371
4364
  useEffect,
@@ -4373,27 +4366,29 @@ import React, {
4373
4366
  useImperativeHandle,
4374
4367
  useCallback
4375
4368
  } from "react";
4369
+ var warnInputProp = (prop) => {
4370
+ console.warn(`intl-tel-input: ignoring inputProps.${prop} - see docs for more info.`);
4371
+ };
4372
+ var noop = () => {
4373
+ };
4376
4374
  var IntlTelInput = forwardRef(function IntlTelInput2({
4377
- initialValue = "",
4378
- onChangeNumber = () => {
4379
- },
4380
- onChangeCountry = () => {
4381
- },
4382
- onChangeValidity = () => {
4383
- },
4384
- onChangeErrorCode = () => {
4385
- },
4375
+ onChangeNumber = noop,
4376
+ onChangeCountry = noop,
4377
+ onChangeValidity = noop,
4378
+ onChangeErrorCode = noop,
4386
4379
  usePreciseValidation = false,
4387
- initOptions = {},
4388
4380
  inputProps = {},
4389
- disabled = void 0
4381
+ disabled = void 0,
4382
+ readOnly = void 0,
4383
+ value = void 0,
4384
+ ...initOptions
4390
4385
  }, ref) {
4391
4386
  const inputRef = useRef(null);
4392
4387
  const itiRef = useRef(null);
4393
- const lastEmittedNumberRef = useRef();
4394
- const lastEmittedCountryRef = useRef();
4395
- const lastEmittedValidityRef = useRef();
4396
- const lastEmittedErrorCodeRef = useRef();
4388
+ const lastEmittedNumberRef = useRef(void 0);
4389
+ const lastEmittedCountryRef = useRef(void 0);
4390
+ const lastEmittedValidityRef = useRef(void 0);
4391
+ const lastEmittedErrorCodeRef = useRef(void 0);
4397
4392
  useImperativeHandle(ref, () => ({
4398
4393
  getInstance: () => itiRef.current,
4399
4394
  getInput: () => inputRef.current
@@ -4402,8 +4397,8 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
4402
4397
  if (!itiRef.current?.isActive()) {
4403
4398
  return;
4404
4399
  }
4405
- const num = itiRef.current?.getNumber() || "";
4406
- const countryIso = itiRef.current?.getSelectedCountryData().iso2 || "";
4400
+ const num = itiRef.current.getNumber() ?? "";
4401
+ const countryIso = itiRef.current.getSelectedCountryData()?.iso2 ?? "";
4407
4402
  if (num !== lastEmittedNumberRef.current) {
4408
4403
  lastEmittedNumberRef.current = num;
4409
4404
  onChangeNumber(num);
@@ -4412,17 +4407,15 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
4412
4407
  lastEmittedCountryRef.current = countryIso;
4413
4408
  onChangeCountry(countryIso);
4414
4409
  }
4415
- if (itiRef.current) {
4416
- const isValid = usePreciseValidation ? itiRef.current.isValidNumberPrecise() : itiRef.current.isValidNumber();
4417
- const errorCode = isValid ? null : itiRef.current.getValidationError();
4418
- if (isValid !== lastEmittedValidityRef.current) {
4419
- lastEmittedValidityRef.current = isValid;
4420
- onChangeValidity(isValid);
4421
- }
4422
- if (errorCode !== lastEmittedErrorCodeRef.current) {
4423
- lastEmittedErrorCodeRef.current = errorCode;
4424
- onChangeErrorCode(errorCode);
4425
- }
4410
+ const isValid = (usePreciseValidation ? itiRef.current.isValidNumberPrecise() : itiRef.current.isValidNumber()) ?? false;
4411
+ const errorCode = isValid ? null : itiRef.current.getValidationError();
4412
+ if (isValid !== lastEmittedValidityRef.current) {
4413
+ lastEmittedValidityRef.current = isValid;
4414
+ onChangeValidity(isValid);
4415
+ }
4416
+ if (errorCode !== lastEmittedErrorCodeRef.current) {
4417
+ lastEmittedErrorCodeRef.current = errorCode;
4418
+ onChangeErrorCode(errorCode);
4426
4419
  }
4427
4420
  }, [
4428
4421
  onChangeCountry,
@@ -4443,7 +4436,7 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
4443
4436
  const inputRefCurrent = inputRef.current;
4444
4437
  if (inputRefCurrent) {
4445
4438
  inputRefCurrent.addEventListener("countrychange", update);
4446
- itiRef.current.promise.then(update);
4439
+ itiRef.current?.promise.then(update);
4447
4440
  }
4448
4441
  return () => {
4449
4442
  if (inputRefCurrent) {
@@ -4456,24 +4449,50 @@ var IntlTelInput = forwardRef(function IntlTelInput2({
4456
4449
  itiRef.current.setDisabled(disabled);
4457
4450
  }
4458
4451
  }, [disabled]);
4459
- const {
4460
- value: _value,
4461
- // disabled: _disabled,
4462
- ...sanitizedInputProps
4463
- } = inputProps;
4452
+ useEffect(() => {
4453
+ if (itiRef.current && readOnly !== void 0) {
4454
+ itiRef.current.setReadonly(readOnly);
4455
+ }
4456
+ }, [readOnly]);
4457
+ useEffect(() => {
4458
+ if (!itiRef.current || value === void 0) {
4459
+ return;
4460
+ }
4461
+ itiRef.current.promise.then(() => {
4462
+ if (!itiRef.current?.isActive()) {
4463
+ return;
4464
+ }
4465
+ const next = value ?? "";
4466
+ const currentCanonical = itiRef.current.getNumber() ?? "";
4467
+ const isFocused = document.activeElement === inputRef.current;
4468
+ if (isFocused || currentCanonical === next) {
4469
+ return;
4470
+ }
4471
+ itiRef.current.setNumber(next);
4472
+ update();
4473
+ });
4474
+ }, [value, update]);
4475
+ const ignoredInputProps = /* @__PURE__ */ new Set(["type", "ref", "value", "disabled", "readOnly", "onInput"]);
4476
+ const sanitizedInputProps = {};
4477
+ for (const [key, val] of Object.entries(inputProps)) {
4478
+ if (ignoredInputProps.has(key)) {
4479
+ warnInputProp(key);
4480
+ } else {
4481
+ sanitizedInputProps[key] = val;
4482
+ }
4483
+ }
4464
4484
  return /* @__PURE__ */ React.createElement(
4465
4485
  "input",
4466
4486
  {
4467
4487
  ...sanitizedInputProps,
4468
4488
  type: "tel",
4469
4489
  ref: inputRef,
4470
- onInput: update,
4471
- defaultValue: initialValue
4490
+ onInput: update
4472
4491
  }
4473
4492
  );
4474
4493
  });
4475
- var react_default = IntlTelInput;
4494
+ var IntlTelInput_default = IntlTelInput;
4476
4495
  export {
4477
- react_default as default,
4496
+ IntlTelInput_default as default,
4478
4497
  intl_tel_input_default as intlTelInput
4479
4498
  };