intl-tel-input 25.15.0 → 26.0.0-beta.1

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 (261) hide show
  1. package/README.md +26 -38
  2. package/angular/build/IntlTelInput.js +78 -324
  3. package/angular/build/IntlTelInputWithUtils.js +78 -324
  4. package/angular/build/types/intl-tel-input/i18n/ar/index.d.ts +3 -6
  5. package/angular/build/types/intl-tel-input/i18n/bg/index.d.ts +3 -6
  6. package/angular/build/types/intl-tel-input/i18n/bn/index.d.ts +3 -6
  7. package/angular/build/types/intl-tel-input/i18n/bs/index.d.ts +3 -6
  8. package/angular/build/types/intl-tel-input/i18n/ca/index.d.ts +3 -6
  9. package/angular/build/types/intl-tel-input/i18n/cs/index.d.ts +3 -6
  10. package/angular/build/types/intl-tel-input/i18n/da/index.d.ts +3 -6
  11. package/angular/build/types/intl-tel-input/i18n/de/index.d.ts +3 -6
  12. package/angular/build/types/intl-tel-input/i18n/ee/index.d.ts +3 -6
  13. package/angular/build/types/intl-tel-input/i18n/el/index.d.ts +3 -6
  14. package/angular/build/types/intl-tel-input/i18n/en/index.d.ts +3 -6
  15. package/angular/build/types/intl-tel-input/i18n/es/index.d.ts +3 -6
  16. package/angular/build/types/intl-tel-input/i18n/fa/index.d.ts +3 -6
  17. package/angular/build/types/intl-tel-input/i18n/fi/index.d.ts +3 -6
  18. package/angular/build/types/intl-tel-input/i18n/fr/index.d.ts +3 -6
  19. package/angular/build/types/intl-tel-input/i18n/hi/index.d.ts +3 -6
  20. package/angular/build/types/intl-tel-input/i18n/hr/index.d.ts +3 -6
  21. package/angular/build/types/intl-tel-input/i18n/hu/index.d.ts +3 -6
  22. package/angular/build/types/intl-tel-input/i18n/id/index.d.ts +3 -6
  23. package/angular/build/types/intl-tel-input/i18n/index.d.ts +43 -43
  24. package/angular/build/types/intl-tel-input/i18n/it/index.d.ts +3 -6
  25. package/angular/build/types/intl-tel-input/i18n/ja/index.d.ts +3 -6
  26. package/angular/build/types/intl-tel-input/i18n/ko/index.d.ts +3 -6
  27. package/angular/build/types/intl-tel-input/i18n/lt/index.d.ts +3 -6
  28. package/angular/build/types/intl-tel-input/i18n/mr/index.d.ts +3 -6
  29. package/angular/build/types/intl-tel-input/i18n/nl/index.d.ts +3 -6
  30. package/angular/build/types/intl-tel-input/i18n/no/index.d.ts +3 -6
  31. package/angular/build/types/intl-tel-input/i18n/pl/index.d.ts +3 -6
  32. package/angular/build/types/intl-tel-input/i18n/pt/index.d.ts +3 -6
  33. package/angular/build/types/intl-tel-input/i18n/ro/index.d.ts +3 -6
  34. package/angular/build/types/intl-tel-input/i18n/ru/index.d.ts +3 -6
  35. package/angular/build/types/intl-tel-input/i18n/sk/index.d.ts +3 -6
  36. package/angular/build/types/intl-tel-input/i18n/sl/index.d.ts +3 -6
  37. package/angular/build/types/intl-tel-input/i18n/sq/index.d.ts +3 -6
  38. package/angular/build/types/intl-tel-input/i18n/sr/index.d.ts +3 -6
  39. package/angular/build/types/intl-tel-input/i18n/sv/index.d.ts +3 -6
  40. package/angular/build/types/intl-tel-input/i18n/te/index.d.ts +3 -6
  41. package/angular/build/types/intl-tel-input/i18n/th/index.d.ts +3 -6
  42. package/angular/build/types/intl-tel-input/i18n/tr/index.d.ts +3 -6
  43. package/angular/build/types/intl-tel-input/i18n/types.d.ts +2 -4
  44. package/angular/build/types/intl-tel-input/i18n/uk/index.d.ts +3 -6
  45. package/angular/build/types/intl-tel-input/i18n/ur/index.d.ts +3 -6
  46. package/angular/build/types/intl-tel-input/i18n/uz/index.d.ts +3 -6
  47. package/angular/build/types/intl-tel-input/i18n/vi/index.d.ts +3 -6
  48. package/angular/build/types/intl-tel-input/i18n/zh/index.d.ts +3 -6
  49. package/angular/build/types/intl-tel-input.d.ts +1 -1
  50. package/angular/build/types/modules/constants.d.ts +1 -1
  51. package/angular/build/types/modules/core/icons.d.ts +2 -0
  52. package/angular/build/types/modules/core/options.d.ts +1 -2
  53. package/angular/build/types/modules/core/ui.d.ts +2 -3
  54. package/angular/build/types/modules/data/country-data.d.ts +2 -2
  55. package/angular/build/types/modules/format/formatting.d.ts +2 -2
  56. package/angular/build/types/modules/types/public-api.d.ts +3 -1
  57. package/build/css/demo.css +1 -3
  58. package/build/css/intlTelInput-no-assets.css +17 -19
  59. package/build/css/intlTelInput-no-assets.min.css +1 -1
  60. package/build/css/intlTelInput.css +18 -21
  61. package/build/css/intlTelInput.min.css +1 -1
  62. package/build/js/data.js +1 -1
  63. package/build/js/data.min.js +1 -1
  64. package/build/js/i18n/ar/index.js +23 -5
  65. package/build/js/i18n/bg/index.js +17 -5
  66. package/build/js/i18n/bn/index.js +17 -5
  67. package/build/js/i18n/bs/index.js +23 -5
  68. package/build/js/i18n/ca/index.js +17 -5
  69. package/build/js/i18n/cs/index.js +20 -5
  70. package/build/js/i18n/da/index.js +17 -5
  71. package/build/js/i18n/de/index.js +17 -5
  72. package/build/js/i18n/ee/index.js +17 -5
  73. package/build/js/i18n/el/index.js +17 -5
  74. package/build/js/i18n/en/index.js +18 -5
  75. package/build/js/i18n/es/index.js +17 -5
  76. package/build/js/i18n/fa/index.js +17 -5
  77. package/build/js/i18n/fi/index.js +17 -5
  78. package/build/js/i18n/fr/index.js +17 -5
  79. package/build/js/i18n/hi/index.js +17 -5
  80. package/build/js/i18n/hr/index.js +23 -5
  81. package/build/js/i18n/hu/index.js +17 -5
  82. package/build/js/i18n/id/index.js +17 -5
  83. package/build/js/i18n/index.js +43 -43
  84. package/build/js/i18n/it/index.js +17 -5
  85. package/build/js/i18n/ja/index.js +17 -5
  86. package/build/js/i18n/ko/index.js +17 -5
  87. package/build/js/i18n/lt/index.js +26 -5
  88. package/build/js/i18n/mr/index.js +17 -5
  89. package/build/js/i18n/nl/index.js +17 -5
  90. package/build/js/i18n/no/index.js +17 -5
  91. package/build/js/i18n/pl/index.js +21 -5
  92. package/build/js/i18n/pt/index.js +17 -5
  93. package/build/js/i18n/ro/index.js +21 -5
  94. package/build/js/i18n/ru/index.js +23 -5
  95. package/build/js/i18n/sk/index.js +23 -5
  96. package/build/js/i18n/sl/index.js +25 -5
  97. package/build/js/i18n/sq/index.js +18 -5
  98. package/build/js/i18n/sr/index.js +24 -5
  99. package/build/js/i18n/sv/index.js +17 -5
  100. package/build/js/i18n/te/index.js +17 -5
  101. package/build/js/i18n/th/index.js +17 -5
  102. package/build/js/i18n/tr/index.js +17 -5
  103. package/build/js/i18n/uk/index.js +23 -5
  104. package/build/js/i18n/ur/index.js +17 -5
  105. package/build/js/i18n/uz/index.js +17 -5
  106. package/build/js/i18n/vi/index.js +17 -5
  107. package/build/js/i18n/zh/index.js +17 -5
  108. package/build/js/intlTelInput.d.ts +118 -677
  109. package/build/js/intlTelInput.js +79 -329
  110. package/build/js/intlTelInput.min.js +8 -4
  111. package/build/js/intlTelInputWithUtils.js +79 -329
  112. package/build/js/intlTelInputWithUtils.min.js +7 -3
  113. package/package.json +10 -4
  114. package/react/build/IntlTelInput.cjs +78 -328
  115. package/react/build/IntlTelInput.d.ts +118 -677
  116. package/react/build/IntlTelInput.js +78 -328
  117. package/react/build/IntlTelInputWithUtils.cjs +78 -328
  118. package/react/build/IntlTelInputWithUtils.js +78 -328
  119. package/svelte/build/IntlTelInput.mjs +1170 -1413
  120. package/svelte/build/IntlTelInputWithUtils.mjs +935 -1178
  121. package/vue/build/exports/IntlTelInput.mjs +1 -1
  122. package/vue/build/exports/IntlTelInputWithUtils.mjs +1 -1
  123. package/vue/build/intl-tel-input/data.d.ts +18 -0
  124. package/vue/build/intl-tel-input/i18n/ar/index.d.ts +3 -0
  125. package/vue/build/intl-tel-input/i18n/bg/index.d.ts +3 -0
  126. package/vue/build/intl-tel-input/i18n/bn/index.d.ts +3 -0
  127. package/vue/build/intl-tel-input/i18n/bs/index.d.ts +3 -0
  128. package/vue/build/intl-tel-input/i18n/ca/index.d.ts +3 -0
  129. package/vue/build/intl-tel-input/i18n/cs/index.d.ts +3 -0
  130. package/vue/build/intl-tel-input/i18n/da/index.d.ts +3 -0
  131. package/vue/build/intl-tel-input/i18n/de/index.d.ts +3 -0
  132. package/vue/build/intl-tel-input/i18n/ee/index.d.ts +3 -0
  133. package/vue/build/intl-tel-input/i18n/el/index.d.ts +3 -0
  134. package/vue/build/intl-tel-input/i18n/en/index.d.ts +3 -0
  135. package/vue/build/intl-tel-input/i18n/es/index.d.ts +3 -0
  136. package/vue/build/intl-tel-input/i18n/fa/index.d.ts +3 -0
  137. package/vue/build/intl-tel-input/i18n/fi/index.d.ts +3 -0
  138. package/vue/build/intl-tel-input/i18n/fr/index.d.ts +3 -0
  139. package/vue/build/intl-tel-input/i18n/hi/index.d.ts +3 -0
  140. package/vue/build/intl-tel-input/i18n/hr/index.d.ts +3 -0
  141. package/vue/build/intl-tel-input/i18n/hu/index.d.ts +3 -0
  142. package/vue/build/intl-tel-input/i18n/id/index.d.ts +3 -0
  143. package/vue/build/intl-tel-input/i18n/index.d.ts +43 -0
  144. package/vue/build/intl-tel-input/i18n/it/index.d.ts +3 -0
  145. package/vue/build/intl-tel-input/i18n/ja/index.d.ts +3 -0
  146. package/vue/build/intl-tel-input/i18n/ko/index.d.ts +3 -0
  147. package/vue/build/intl-tel-input/i18n/lt/index.d.ts +3 -0
  148. package/vue/build/intl-tel-input/i18n/mr/index.d.ts +3 -0
  149. package/vue/build/intl-tel-input/i18n/nl/index.d.ts +3 -0
  150. package/vue/build/intl-tel-input/i18n/no/index.d.ts +3 -0
  151. package/vue/build/intl-tel-input/i18n/pl/index.d.ts +3 -0
  152. package/vue/build/intl-tel-input/i18n/pt/index.d.ts +3 -0
  153. package/vue/build/intl-tel-input/i18n/ro/index.d.ts +3 -0
  154. package/vue/build/intl-tel-input/i18n/ru/index.d.ts +3 -0
  155. package/vue/build/intl-tel-input/i18n/sk/index.d.ts +3 -0
  156. package/vue/build/intl-tel-input/i18n/sl/index.d.ts +3 -0
  157. package/vue/build/intl-tel-input/i18n/sq/index.d.ts +3 -0
  158. package/vue/build/intl-tel-input/i18n/sr/index.d.ts +3 -0
  159. package/vue/build/intl-tel-input/i18n/sv/index.d.ts +3 -0
  160. package/vue/build/intl-tel-input/i18n/te/index.d.ts +3 -0
  161. package/vue/build/intl-tel-input/i18n/th/index.d.ts +3 -0
  162. package/vue/build/intl-tel-input/i18n/tr/index.d.ts +3 -0
  163. package/vue/build/intl-tel-input/i18n/types.d.ts +10 -0
  164. package/vue/build/intl-tel-input/i18n/uk/index.d.ts +3 -0
  165. package/vue/build/intl-tel-input/i18n/ur/index.d.ts +3 -0
  166. package/vue/build/intl-tel-input/i18n/uz/index.d.ts +3 -0
  167. package/vue/build/intl-tel-input/i18n/vi/index.d.ts +3 -0
  168. package/vue/build/intl-tel-input/i18n/zh/index.d.ts +3 -0
  169. package/vue/build/intl-tel-input/intlTelInputWithUtils.d.ts +2 -0
  170. package/vue/build/{intl-tel-input-Db39yQmC.mjs → intl-tel-input-f0-6rrpA.mjs} +136 -138
  171. package/vue/build/modules/core/ui.d.ts +0 -1
  172. package/vue/build/modules/format/formatting.d.ts +1 -1
  173. package/vue/build/modules/types/public-api.d.ts +2 -1
  174. package/build/js/i18n/ar/countries.js +0 -245
  175. package/build/js/i18n/ar/interface.js +0 -23
  176. package/build/js/i18n/bg/countries.js +0 -245
  177. package/build/js/i18n/bg/interface.js +0 -13
  178. package/build/js/i18n/bn/countries.js +0 -245
  179. package/build/js/i18n/bn/interface.js +0 -13
  180. package/build/js/i18n/bs/countries.js +0 -245
  181. package/build/js/i18n/bs/interface.js +0 -20
  182. package/build/js/i18n/ca/countries.js +0 -245
  183. package/build/js/i18n/ca/interface.js +0 -13
  184. package/build/js/i18n/cs/countries.js +0 -245
  185. package/build/js/i18n/cs/interface.js +0 -20
  186. package/build/js/i18n/da/countries.js +0 -245
  187. package/build/js/i18n/da/interface.js +0 -13
  188. package/build/js/i18n/de/countries.js +0 -245
  189. package/build/js/i18n/de/interface.js +0 -13
  190. package/build/js/i18n/ee/countries.js +0 -245
  191. package/build/js/i18n/ee/interface.js +0 -13
  192. package/build/js/i18n/el/countries.js +0 -245
  193. package/build/js/i18n/el/interface.js +0 -13
  194. package/build/js/i18n/en/countries.js +0 -245
  195. package/build/js/i18n/en/interface.js +0 -14
  196. package/build/js/i18n/es/countries.js +0 -245
  197. package/build/js/i18n/es/interface.js +0 -13
  198. package/build/js/i18n/fa/countries.js +0 -245
  199. package/build/js/i18n/fa/interface.js +0 -13
  200. package/build/js/i18n/fi/countries.js +0 -245
  201. package/build/js/i18n/fi/interface.js +0 -13
  202. package/build/js/i18n/fr/countries.js +0 -245
  203. package/build/js/i18n/fr/interface.js +0 -13
  204. package/build/js/i18n/hi/countries.js +0 -245
  205. package/build/js/i18n/hi/interface.js +0 -13
  206. package/build/js/i18n/hr/countries.js +0 -245
  207. package/build/js/i18n/hr/interface.js +0 -20
  208. package/build/js/i18n/hu/countries.js +0 -245
  209. package/build/js/i18n/hu/interface.js +0 -13
  210. package/build/js/i18n/id/countries.js +0 -245
  211. package/build/js/i18n/id/interface.js +0 -13
  212. package/build/js/i18n/it/countries.js +0 -245
  213. package/build/js/i18n/it/interface.js +0 -13
  214. package/build/js/i18n/ja/countries.js +0 -245
  215. package/build/js/i18n/ja/interface.js +0 -13
  216. package/build/js/i18n/ko/countries.js +0 -245
  217. package/build/js/i18n/ko/interface.js +0 -13
  218. package/build/js/i18n/lt/countries.js +0 -245
  219. package/build/js/i18n/lt/interface.js +0 -26
  220. package/build/js/i18n/mr/countries.js +0 -245
  221. package/build/js/i18n/mr/interface.js +0 -13
  222. package/build/js/i18n/nl/countries.js +0 -245
  223. package/build/js/i18n/nl/interface.js +0 -13
  224. package/build/js/i18n/no/countries.js +0 -245
  225. package/build/js/i18n/no/interface.js +0 -13
  226. package/build/js/i18n/pl/countries.js +0 -245
  227. package/build/js/i18n/pl/interface.js +0 -19
  228. package/build/js/i18n/pt/countries.js +0 -245
  229. package/build/js/i18n/pt/interface.js +0 -13
  230. package/build/js/i18n/ro/countries.js +0 -245
  231. package/build/js/i18n/ro/interface.js +0 -18
  232. package/build/js/i18n/ru/countries.js +0 -245
  233. package/build/js/i18n/ru/interface.js +0 -20
  234. package/build/js/i18n/sk/countries.js +0 -245
  235. package/build/js/i18n/sk/interface.js +0 -20
  236. package/build/js/i18n/sl/countries.js +0 -245
  237. package/build/js/i18n/sl/interface.js +0 -25
  238. package/build/js/i18n/sq/countries.js +0 -245
  239. package/build/js/i18n/sq/interface.js +0 -14
  240. package/build/js/i18n/sr/countries.js +0 -245
  241. package/build/js/i18n/sr/interface.js +0 -21
  242. package/build/js/i18n/sv/countries.js +0 -245
  243. package/build/js/i18n/sv/interface.js +0 -13
  244. package/build/js/i18n/te/countries.js +0 -245
  245. package/build/js/i18n/te/interface.js +0 -13
  246. package/build/js/i18n/th/countries.js +0 -245
  247. package/build/js/i18n/th/interface.js +0 -13
  248. package/build/js/i18n/tr/countries.js +0 -245
  249. package/build/js/i18n/tr/interface.js +0 -13
  250. package/build/js/i18n/uk/countries.js +0 -245
  251. package/build/js/i18n/uk/interface.js +0 -20
  252. package/build/js/i18n/ur/countries.js +0 -245
  253. package/build/js/i18n/ur/interface.js +0 -13
  254. package/build/js/i18n/uz/countries.js +0 -245
  255. package/build/js/i18n/uz/interface.js +0 -13
  256. package/build/js/i18n/vi/countries.js +0 -245
  257. package/build/js/i18n/vi/interface.js +0 -13
  258. package/build/js/i18n/zh/countries.js +0 -245
  259. package/build/js/i18n/zh/interface.js +0 -13
  260. package/vue/build/IntlTelInput.mjs +0 -3398
  261. package/vue/build/IntlTelInputWithUtils.mjs +0 -9540
@@ -1,3398 +0,0 @@
1
- import { mergeModels as W, useModel as Q, ref as O, onMounted as J, watch as Z, onUnmounted as tt, withDirectives as et, createElementBlock as it, openBlock as st, mergeProps as nt, vModelText as ot } from "vue";
2
- const rt = [
3
- [
4
- "af",
5
- // Afghanistan
6
- "93",
7
- 0,
8
- null,
9
- "0"
10
- ],
11
- [
12
- "ax",
13
- // Åland Islands
14
- "358",
15
- 1,
16
- ["18", "4"],
17
- // (4 is a mobile range shared with FI)
18
- "0"
19
- ],
20
- [
21
- "al",
22
- // Albania
23
- "355",
24
- 0,
25
- null,
26
- "0"
27
- ],
28
- [
29
- "dz",
30
- // Algeria
31
- "213",
32
- 0,
33
- null,
34
- "0"
35
- ],
36
- [
37
- "as",
38
- // American Samoa
39
- "1",
40
- 5,
41
- ["684"],
42
- "1"
43
- ],
44
- [
45
- "ad",
46
- // Andorra
47
- "376"
48
- ],
49
- [
50
- "ao",
51
- // Angola
52
- "244"
53
- ],
54
- [
55
- "ai",
56
- // Anguilla
57
- "1",
58
- 6,
59
- ["264"],
60
- "1"
61
- ],
62
- [
63
- "ag",
64
- // Antigua and Barbuda
65
- "1",
66
- 7,
67
- ["268"],
68
- "1"
69
- ],
70
- [
71
- "ar",
72
- // Argentina
73
- "54",
74
- 0,
75
- null,
76
- "0"
77
- ],
78
- [
79
- "am",
80
- // Armenia
81
- "374",
82
- 0,
83
- null,
84
- "0"
85
- ],
86
- [
87
- "aw",
88
- // Aruba
89
- "297"
90
- ],
91
- [
92
- "ac",
93
- // Ascension Island
94
- "247"
95
- ],
96
- [
97
- "au",
98
- // Australia
99
- "61",
100
- 0,
101
- ["4"],
102
- // (mobile range shared with CX and CC)
103
- "0"
104
- ],
105
- [
106
- "at",
107
- // Austria
108
- "43",
109
- 0,
110
- null,
111
- "0"
112
- ],
113
- [
114
- "az",
115
- // Azerbaijan
116
- "994",
117
- 0,
118
- null,
119
- "0"
120
- ],
121
- [
122
- "bs",
123
- // Bahamas
124
- "1",
125
- 8,
126
- ["242"],
127
- "1"
128
- ],
129
- [
130
- "bh",
131
- // Bahrain
132
- "973"
133
- ],
134
- [
135
- "bd",
136
- // Bangladesh
137
- "880",
138
- 0,
139
- null,
140
- "0"
141
- ],
142
- [
143
- "bb",
144
- // Barbados
145
- "1",
146
- 9,
147
- ["246"],
148
- "1"
149
- ],
150
- [
151
- "by",
152
- // Belarus
153
- "375",
154
- 0,
155
- null,
156
- "8"
157
- ],
158
- [
159
- "be",
160
- // Belgium
161
- "32",
162
- 0,
163
- null,
164
- "0"
165
- ],
166
- [
167
- "bz",
168
- // Belize
169
- "501"
170
- ],
171
- [
172
- "bj",
173
- // Benin
174
- "229"
175
- ],
176
- [
177
- "bm",
178
- // Bermuda
179
- "1",
180
- 10,
181
- ["441"],
182
- "1"
183
- ],
184
- [
185
- "bt",
186
- // Bhutan
187
- "975"
188
- ],
189
- [
190
- "bo",
191
- // Bolivia
192
- "591",
193
- 0,
194
- null,
195
- "0"
196
- ],
197
- [
198
- "ba",
199
- // Bosnia and Herzegovina
200
- "387",
201
- 0,
202
- null,
203
- "0"
204
- ],
205
- [
206
- "bw",
207
- // Botswana
208
- "267"
209
- ],
210
- [
211
- "br",
212
- // Brazil
213
- "55",
214
- 0,
215
- null,
216
- "0"
217
- ],
218
- [
219
- "io",
220
- // British Indian Ocean Territory
221
- "246"
222
- ],
223
- [
224
- "vg",
225
- // British Virgin Islands
226
- "1",
227
- 11,
228
- ["284"],
229
- "1"
230
- ],
231
- [
232
- "bn",
233
- // Brunei
234
- "673"
235
- ],
236
- [
237
- "bg",
238
- // Bulgaria
239
- "359",
240
- 0,
241
- null,
242
- "0"
243
- ],
244
- [
245
- "bf",
246
- // Burkina Faso
247
- "226"
248
- ],
249
- [
250
- "bi",
251
- // Burundi
252
- "257"
253
- ],
254
- [
255
- "kh",
256
- // Cambodia
257
- "855",
258
- 0,
259
- null,
260
- "0"
261
- ],
262
- [
263
- "cm",
264
- // Cameroon
265
- "237"
266
- ],
267
- [
268
- "ca",
269
- // Canada
270
- "1",
271
- 1,
272
- ["204", "226", "236", "249", "250", "257", "263", "289", "306", "343", "354", "365", "367", "368", "382", "403", "416", "418", "428", "431", "437", "438", "450", "468", "474", "506", "514", "519", "548", "579", "581", "584", "587", "604", "613", "639", "647", "672", "683", "705", "709", "742", "753", "778", "780", "782", "807", "819", "825", "867", "873", "879", "902", "905", "942"],
273
- "1"
274
- ],
275
- [
276
- "cv",
277
- // Cape Verde
278
- "238"
279
- ],
280
- [
281
- "bq",
282
- // Caribbean Netherlands
283
- "599",
284
- 1,
285
- ["3", "4", "7"]
286
- ],
287
- [
288
- "ky",
289
- // Cayman Islands
290
- "1",
291
- 12,
292
- ["345"],
293
- "1"
294
- ],
295
- [
296
- "cf",
297
- // Central African Republic
298
- "236"
299
- ],
300
- [
301
- "td",
302
- // Chad
303
- "235"
304
- ],
305
- [
306
- "cl",
307
- // Chile
308
- "56"
309
- ],
310
- [
311
- "cn",
312
- // China
313
- "86",
314
- 0,
315
- null,
316
- "0"
317
- ],
318
- [
319
- "cx",
320
- // Christmas Island
321
- "61",
322
- 2,
323
- ["4", "89164"],
324
- // (4 is a mobile range shared with AU and CC)
325
- "0"
326
- ],
327
- [
328
- "cc",
329
- // Cocos (Keeling) Islands
330
- "61",
331
- 1,
332
- ["4", "89162"],
333
- // (4 is a mobile range shared with AU and CX)
334
- "0"
335
- ],
336
- [
337
- "co",
338
- // Colombia
339
- "57",
340
- 0,
341
- null,
342
- "0"
343
- ],
344
- [
345
- "km",
346
- // Comoros
347
- "269"
348
- ],
349
- [
350
- "cg",
351
- // Congo (Brazzaville)
352
- "242"
353
- ],
354
- [
355
- "cd",
356
- // Congo (Kinshasa)
357
- "243",
358
- 0,
359
- null,
360
- "0"
361
- ],
362
- [
363
- "ck",
364
- // Cook Islands
365
- "682"
366
- ],
367
- [
368
- "cr",
369
- // Costa Rica
370
- "506"
371
- ],
372
- [
373
- "ci",
374
- // Côte d'Ivoire
375
- "225"
376
- ],
377
- [
378
- "hr",
379
- // Croatia
380
- "385",
381
- 0,
382
- null,
383
- "0"
384
- ],
385
- [
386
- "cu",
387
- // Cuba
388
- "53",
389
- 0,
390
- null,
391
- "0"
392
- ],
393
- [
394
- "cw",
395
- // Curaçao
396
- "599",
397
- 0
398
- ],
399
- [
400
- "cy",
401
- // Cyprus
402
- "357"
403
- ],
404
- [
405
- "cz",
406
- // Czech Republic
407
- "420"
408
- ],
409
- [
410
- "dk",
411
- // Denmark
412
- "45"
413
- ],
414
- [
415
- "dj",
416
- // Djibouti
417
- "253"
418
- ],
419
- [
420
- "dm",
421
- // Dominica
422
- "1",
423
- 13,
424
- ["767"],
425
- "1"
426
- ],
427
- [
428
- "do",
429
- // Dominican Republic
430
- "1",
431
- 2,
432
- ["809", "829", "849"],
433
- "1"
434
- ],
435
- [
436
- "ec",
437
- // Ecuador
438
- "593",
439
- 0,
440
- null,
441
- "0"
442
- ],
443
- [
444
- "eg",
445
- // Egypt
446
- "20",
447
- 0,
448
- null,
449
- "0"
450
- ],
451
- [
452
- "sv",
453
- // El Salvador
454
- "503"
455
- ],
456
- [
457
- "gq",
458
- // Equatorial Guinea
459
- "240"
460
- ],
461
- [
462
- "er",
463
- // Eritrea
464
- "291",
465
- 0,
466
- null,
467
- "0"
468
- ],
469
- [
470
- "ee",
471
- // Estonia
472
- "372"
473
- ],
474
- [
475
- "sz",
476
- // Eswatini
477
- "268"
478
- ],
479
- [
480
- "et",
481
- // Ethiopia
482
- "251",
483
- 0,
484
- null,
485
- "0"
486
- ],
487
- [
488
- "fk",
489
- // Falkland Islands (Malvinas)
490
- "500"
491
- ],
492
- [
493
- "fo",
494
- // Faroe Islands
495
- "298"
496
- ],
497
- [
498
- "fj",
499
- // Fiji
500
- "679"
501
- ],
502
- [
503
- "fi",
504
- // Finland
505
- "358",
506
- 0,
507
- ["4"],
508
- // (mobile range shared with AX)
509
- "0"
510
- ],
511
- [
512
- "fr",
513
- // France
514
- "33",
515
- 0,
516
- null,
517
- "0"
518
- ],
519
- [
520
- "gf",
521
- // French Guiana
522
- "594",
523
- 0,
524
- null,
525
- "0"
526
- ],
527
- [
528
- "pf",
529
- // French Polynesia
530
- "689"
531
- ],
532
- [
533
- "ga",
534
- // Gabon
535
- "241"
536
- ],
537
- [
538
- "gm",
539
- // Gambia
540
- "220"
541
- ],
542
- [
543
- "ge",
544
- // Georgia
545
- "995",
546
- 0,
547
- null,
548
- "0"
549
- ],
550
- [
551
- "de",
552
- // Germany
553
- "49",
554
- 0,
555
- null,
556
- "0"
557
- ],
558
- [
559
- "gh",
560
- // Ghana
561
- "233",
562
- 0,
563
- null,
564
- "0"
565
- ],
566
- [
567
- "gi",
568
- // Gibraltar
569
- "350"
570
- ],
571
- [
572
- "gr",
573
- // Greece
574
- "30"
575
- ],
576
- [
577
- "gl",
578
- // Greenland
579
- "299"
580
- ],
581
- [
582
- "gd",
583
- // Grenada
584
- "1",
585
- 14,
586
- ["473"],
587
- "1"
588
- ],
589
- [
590
- "gp",
591
- // Guadeloupe
592
- "590",
593
- 0,
594
- null,
595
- "0"
596
- ],
597
- [
598
- "gu",
599
- // Guam
600
- "1",
601
- 15,
602
- ["671"],
603
- "1"
604
- ],
605
- [
606
- "gt",
607
- // Guatemala
608
- "502"
609
- ],
610
- [
611
- "gg",
612
- // Guernsey
613
- "44",
614
- 1,
615
- ["1481", "7781", "7839", "7911"],
616
- "0"
617
- ],
618
- [
619
- "gn",
620
- // Guinea
621
- "224"
622
- ],
623
- [
624
- "gw",
625
- // Guinea-Bissau
626
- "245"
627
- ],
628
- [
629
- "gy",
630
- // Guyana
631
- "592"
632
- ],
633
- [
634
- "ht",
635
- // Haiti
636
- "509"
637
- ],
638
- [
639
- "hn",
640
- // Honduras
641
- "504"
642
- ],
643
- [
644
- "hk",
645
- // Hong Kong SAR China
646
- "852"
647
- ],
648
- [
649
- "hu",
650
- // Hungary
651
- "36",
652
- 0,
653
- null,
654
- "06"
655
- ],
656
- [
657
- "is",
658
- // Iceland
659
- "354"
660
- ],
661
- [
662
- "in",
663
- // India
664
- "91",
665
- 0,
666
- null,
667
- "0"
668
- ],
669
- [
670
- "id",
671
- // Indonesia
672
- "62",
673
- 0,
674
- null,
675
- "0"
676
- ],
677
- [
678
- "ir",
679
- // Iran
680
- "98",
681
- 0,
682
- null,
683
- "0"
684
- ],
685
- [
686
- "iq",
687
- // Iraq
688
- "964",
689
- 0,
690
- null,
691
- "0"
692
- ],
693
- [
694
- "ie",
695
- // Ireland
696
- "353",
697
- 0,
698
- null,
699
- "0"
700
- ],
701
- [
702
- "im",
703
- // Isle of Man
704
- "44",
705
- 2,
706
- ["1624", "74576", "7524", "7624", "7924"],
707
- "0"
708
- ],
709
- [
710
- "il",
711
- // Israel
712
- "972",
713
- 0,
714
- null,
715
- "0"
716
- ],
717
- [
718
- "it",
719
- // Italy
720
- "39",
721
- 0,
722
- ["3"]
723
- // (mobile range shared with VA)
724
- ],
725
- [
726
- "jm",
727
- // Jamaica
728
- "1",
729
- 4,
730
- ["658", "876"],
731
- "1"
732
- ],
733
- [
734
- "jp",
735
- // Japan
736
- "81",
737
- 0,
738
- null,
739
- "0"
740
- ],
741
- [
742
- "je",
743
- // Jersey
744
- "44",
745
- 3,
746
- ["1534", "7509", "7700", "7797", "7829", "7937"],
747
- "0"
748
- ],
749
- [
750
- "jo",
751
- // Jordan
752
- "962",
753
- 0,
754
- null,
755
- "0"
756
- ],
757
- [
758
- "kz",
759
- // Kazakhstan
760
- "7",
761
- 1,
762
- ["33", "7"],
763
- // (33 is shared with RU)
764
- "8"
765
- ],
766
- [
767
- "ke",
768
- // Kenya
769
- "254",
770
- 0,
771
- null,
772
- "0"
773
- ],
774
- [
775
- "ki",
776
- // Kiribati
777
- "686",
778
- 0,
779
- null,
780
- "0"
781
- ],
782
- [
783
- "xk",
784
- // Kosovo
785
- "383",
786
- 0,
787
- null,
788
- "0"
789
- ],
790
- [
791
- "kw",
792
- // Kuwait
793
- "965"
794
- ],
795
- [
796
- "kg",
797
- // Kyrgyzstan
798
- "996",
799
- 0,
800
- null,
801
- "0"
802
- ],
803
- [
804
- "la",
805
- // Laos
806
- "856",
807
- 0,
808
- null,
809
- "0"
810
- ],
811
- [
812
- "lv",
813
- // Latvia
814
- "371"
815
- ],
816
- [
817
- "lb",
818
- // Lebanon
819
- "961",
820
- 0,
821
- null,
822
- "0"
823
- ],
824
- [
825
- "ls",
826
- // Lesotho
827
- "266"
828
- ],
829
- [
830
- "lr",
831
- // Liberia
832
- "231",
833
- 0,
834
- null,
835
- "0"
836
- ],
837
- [
838
- "ly",
839
- // Libya
840
- "218",
841
- 0,
842
- null,
843
- "0"
844
- ],
845
- [
846
- "li",
847
- // Liechtenstein
848
- "423",
849
- 0,
850
- null,
851
- "0"
852
- ],
853
- [
854
- "lt",
855
- // Lithuania
856
- "370",
857
- 0,
858
- null,
859
- "0"
860
- ],
861
- [
862
- "lu",
863
- // Luxembourg
864
- "352"
865
- ],
866
- [
867
- "mo",
868
- // Macao SAR China
869
- "853"
870
- ],
871
- [
872
- "mg",
873
- // Madagascar
874
- "261",
875
- 0,
876
- null,
877
- "0"
878
- ],
879
- [
880
- "mw",
881
- // Malawi
882
- "265",
883
- 0,
884
- null,
885
- "0"
886
- ],
887
- [
888
- "my",
889
- // Malaysia
890
- "60",
891
- 0,
892
- null,
893
- "0"
894
- ],
895
- [
896
- "mv",
897
- // Maldives
898
- "960"
899
- ],
900
- [
901
- "ml",
902
- // Mali
903
- "223"
904
- ],
905
- [
906
- "mt",
907
- // Malta
908
- "356"
909
- ],
910
- [
911
- "mh",
912
- // Marshall Islands
913
- "692",
914
- 0,
915
- null,
916
- "1"
917
- ],
918
- [
919
- "mq",
920
- // Martinique
921
- "596",
922
- 0,
923
- null,
924
- "0"
925
- ],
926
- [
927
- "mr",
928
- // Mauritania
929
- "222"
930
- ],
931
- [
932
- "mu",
933
- // Mauritius
934
- "230"
935
- ],
936
- [
937
- "yt",
938
- // Mayotte
939
- "262",
940
- 1,
941
- ["269", "639"],
942
- "0"
943
- ],
944
- [
945
- "mx",
946
- // Mexico
947
- "52"
948
- ],
949
- [
950
- "fm",
951
- // Micronesia
952
- "691"
953
- ],
954
- [
955
- "md",
956
- // Moldova
957
- "373",
958
- 0,
959
- null,
960
- "0"
961
- ],
962
- [
963
- "mc",
964
- // Monaco
965
- "377",
966
- 0,
967
- null,
968
- "0"
969
- ],
970
- [
971
- "mn",
972
- // Mongolia
973
- "976",
974
- 0,
975
- null,
976
- "0"
977
- ],
978
- [
979
- "me",
980
- // Montenegro
981
- "382",
982
- 0,
983
- null,
984
- "0"
985
- ],
986
- [
987
- "ms",
988
- // Montserrat
989
- "1",
990
- 16,
991
- ["664"],
992
- "1"
993
- ],
994
- [
995
- "ma",
996
- // Morocco
997
- "212",
998
- 0,
999
- ["6", "7"],
1000
- // (mobile ranges shared with EH)
1001
- "0"
1002
- ],
1003
- [
1004
- "mz",
1005
- // Mozambique
1006
- "258"
1007
- ],
1008
- [
1009
- "mm",
1010
- // Myanmar (Burma)
1011
- "95",
1012
- 0,
1013
- null,
1014
- "0"
1015
- ],
1016
- [
1017
- "na",
1018
- // Namibia
1019
- "264",
1020
- 0,
1021
- null,
1022
- "0"
1023
- ],
1024
- [
1025
- "nr",
1026
- // Nauru
1027
- "674"
1028
- ],
1029
- [
1030
- "np",
1031
- // Nepal
1032
- "977",
1033
- 0,
1034
- null,
1035
- "0"
1036
- ],
1037
- [
1038
- "nl",
1039
- // Netherlands
1040
- "31",
1041
- 0,
1042
- null,
1043
- "0"
1044
- ],
1045
- [
1046
- "nc",
1047
- // New Caledonia
1048
- "687"
1049
- ],
1050
- [
1051
- "nz",
1052
- // New Zealand
1053
- "64",
1054
- 0,
1055
- null,
1056
- "0"
1057
- ],
1058
- [
1059
- "ni",
1060
- // Nicaragua
1061
- "505"
1062
- ],
1063
- [
1064
- "ne",
1065
- // Niger
1066
- "227"
1067
- ],
1068
- [
1069
- "ng",
1070
- // Nigeria
1071
- "234",
1072
- 0,
1073
- null,
1074
- "0"
1075
- ],
1076
- [
1077
- "nu",
1078
- // Niue
1079
- "683"
1080
- ],
1081
- [
1082
- "nf",
1083
- // Norfolk Island
1084
- "672"
1085
- ],
1086
- [
1087
- "kp",
1088
- // North Korea
1089
- "850",
1090
- 0,
1091
- null,
1092
- "0"
1093
- ],
1094
- [
1095
- "mk",
1096
- // North Macedonia
1097
- "389",
1098
- 0,
1099
- null,
1100
- "0"
1101
- ],
1102
- [
1103
- "mp",
1104
- // Northern Mariana Islands
1105
- "1",
1106
- 17,
1107
- ["670"],
1108
- "1"
1109
- ],
1110
- [
1111
- "no",
1112
- // Norway
1113
- "47",
1114
- 0,
1115
- ["4", "9"]
1116
- // (mobile ranges shared with SJ)
1117
- ],
1118
- [
1119
- "om",
1120
- // Oman
1121
- "968"
1122
- ],
1123
- [
1124
- "pk",
1125
- // Pakistan
1126
- "92",
1127
- 0,
1128
- null,
1129
- "0"
1130
- ],
1131
- [
1132
- "pw",
1133
- // Palau
1134
- "680"
1135
- ],
1136
- [
1137
- "ps",
1138
- // Palestinian Territories
1139
- "970",
1140
- 0,
1141
- null,
1142
- "0"
1143
- ],
1144
- [
1145
- "pa",
1146
- // Panama
1147
- "507"
1148
- ],
1149
- [
1150
- "pg",
1151
- // Papua New Guinea
1152
- "675"
1153
- ],
1154
- [
1155
- "py",
1156
- // Paraguay
1157
- "595",
1158
- 0,
1159
- null,
1160
- "0"
1161
- ],
1162
- [
1163
- "pe",
1164
- // Peru
1165
- "51",
1166
- 0,
1167
- null,
1168
- "0"
1169
- ],
1170
- [
1171
- "ph",
1172
- // Philippines
1173
- "63",
1174
- 0,
1175
- null,
1176
- "0"
1177
- ],
1178
- [
1179
- "pl",
1180
- // Poland
1181
- "48"
1182
- ],
1183
- [
1184
- "pt",
1185
- // Portugal
1186
- "351"
1187
- ],
1188
- [
1189
- "pr",
1190
- // Puerto Rico
1191
- "1",
1192
- 3,
1193
- ["787", "939"],
1194
- "1"
1195
- ],
1196
- [
1197
- "qa",
1198
- // Qatar
1199
- "974"
1200
- ],
1201
- [
1202
- "re",
1203
- // Réunion
1204
- "262",
1205
- 0,
1206
- null,
1207
- "0"
1208
- ],
1209
- [
1210
- "ro",
1211
- // Romania
1212
- "40",
1213
- 0,
1214
- null,
1215
- "0"
1216
- ],
1217
- [
1218
- "ru",
1219
- // Russia
1220
- "7",
1221
- 0,
1222
- ["33"],
1223
- // (shared with KZ)
1224
- "8"
1225
- ],
1226
- [
1227
- "rw",
1228
- // Rwanda
1229
- "250",
1230
- 0,
1231
- null,
1232
- "0"
1233
- ],
1234
- [
1235
- "ws",
1236
- // Samoa
1237
- "685"
1238
- ],
1239
- [
1240
- "sm",
1241
- // San Marino
1242
- "378"
1243
- ],
1244
- [
1245
- "st",
1246
- // São Tomé & Príncipe
1247
- "239"
1248
- ],
1249
- [
1250
- "sa",
1251
- // Saudi Arabia
1252
- "966",
1253
- 0,
1254
- null,
1255
- "0"
1256
- ],
1257
- [
1258
- "sn",
1259
- // Senegal
1260
- "221"
1261
- ],
1262
- [
1263
- "rs",
1264
- // Serbia
1265
- "381",
1266
- 0,
1267
- null,
1268
- "0"
1269
- ],
1270
- [
1271
- "sc",
1272
- // Seychelles
1273
- "248"
1274
- ],
1275
- [
1276
- "sl",
1277
- // Sierra Leone
1278
- "232",
1279
- 0,
1280
- null,
1281
- "0"
1282
- ],
1283
- [
1284
- "sg",
1285
- // Singapore
1286
- "65"
1287
- ],
1288
- [
1289
- "sx",
1290
- // Sint Maarten
1291
- "1",
1292
- 21,
1293
- ["721"],
1294
- "1"
1295
- ],
1296
- [
1297
- "sk",
1298
- // Slovakia
1299
- "421",
1300
- 0,
1301
- null,
1302
- "0"
1303
- ],
1304
- [
1305
- "si",
1306
- // Slovenia
1307
- "386",
1308
- 0,
1309
- null,
1310
- "0"
1311
- ],
1312
- [
1313
- "sb",
1314
- // Solomon Islands
1315
- "677"
1316
- ],
1317
- [
1318
- "so",
1319
- // Somalia
1320
- "252",
1321
- 0,
1322
- null,
1323
- "0"
1324
- ],
1325
- [
1326
- "za",
1327
- // South Africa
1328
- "27",
1329
- 0,
1330
- null,
1331
- "0"
1332
- ],
1333
- [
1334
- "kr",
1335
- // South Korea
1336
- "82",
1337
- 0,
1338
- null,
1339
- "0"
1340
- ],
1341
- [
1342
- "ss",
1343
- // South Sudan
1344
- "211",
1345
- 0,
1346
- null,
1347
- "0"
1348
- ],
1349
- [
1350
- "es",
1351
- // Spain
1352
- "34"
1353
- ],
1354
- [
1355
- "lk",
1356
- // Sri Lanka
1357
- "94",
1358
- 0,
1359
- null,
1360
- "0"
1361
- ],
1362
- [
1363
- "bl",
1364
- // St. Barthélemy
1365
- "590",
1366
- 1,
1367
- null,
1368
- "0"
1369
- ],
1370
- [
1371
- "sh",
1372
- // St. Helena
1373
- "290"
1374
- ],
1375
- [
1376
- "kn",
1377
- // St. Kitts & Nevis
1378
- "1",
1379
- 18,
1380
- ["869"],
1381
- "1"
1382
- ],
1383
- [
1384
- "lc",
1385
- // St. Lucia
1386
- "1",
1387
- 19,
1388
- ["758"],
1389
- "1"
1390
- ],
1391
- [
1392
- "mf",
1393
- // St. Martin
1394
- "590",
1395
- 2,
1396
- null,
1397
- "0"
1398
- ],
1399
- [
1400
- "pm",
1401
- // St. Pierre & Miquelon
1402
- "508",
1403
- 0,
1404
- null,
1405
- "0"
1406
- ],
1407
- [
1408
- "vc",
1409
- // St. Vincent & Grenadines
1410
- "1",
1411
- 20,
1412
- ["784"],
1413
- "1"
1414
- ],
1415
- [
1416
- "sd",
1417
- // Sudan
1418
- "249",
1419
- 0,
1420
- null,
1421
- "0"
1422
- ],
1423
- [
1424
- "sr",
1425
- // Suriname
1426
- "597"
1427
- ],
1428
- [
1429
- "sj",
1430
- // Svalbard & Jan Mayen
1431
- "47",
1432
- 1,
1433
- ["4", "79", "9"]
1434
- // (4 and 9 are mobile ranges shared with NO)
1435
- ],
1436
- [
1437
- "se",
1438
- // Sweden
1439
- "46",
1440
- 0,
1441
- null,
1442
- "0"
1443
- ],
1444
- [
1445
- "ch",
1446
- // Switzerland
1447
- "41",
1448
- 0,
1449
- null,
1450
- "0"
1451
- ],
1452
- [
1453
- "sy",
1454
- // Syria
1455
- "963",
1456
- 0,
1457
- null,
1458
- "0"
1459
- ],
1460
- [
1461
- "tw",
1462
- // Taiwan
1463
- "886",
1464
- 0,
1465
- null,
1466
- "0"
1467
- ],
1468
- [
1469
- "tj",
1470
- // Tajikistan
1471
- "992"
1472
- ],
1473
- [
1474
- "tz",
1475
- // Tanzania
1476
- "255",
1477
- 0,
1478
- null,
1479
- "0"
1480
- ],
1481
- [
1482
- "th",
1483
- // Thailand
1484
- "66",
1485
- 0,
1486
- null,
1487
- "0"
1488
- ],
1489
- [
1490
- "tl",
1491
- // Timor-Leste
1492
- "670"
1493
- ],
1494
- [
1495
- "tg",
1496
- // Togo
1497
- "228"
1498
- ],
1499
- [
1500
- "tk",
1501
- // Tokelau
1502
- "690"
1503
- ],
1504
- [
1505
- "to",
1506
- // Tonga
1507
- "676"
1508
- ],
1509
- [
1510
- "tt",
1511
- // Trinidad & Tobago
1512
- "1",
1513
- 22,
1514
- ["868"],
1515
- "1"
1516
- ],
1517
- [
1518
- "tn",
1519
- // Tunisia
1520
- "216"
1521
- ],
1522
- [
1523
- "tr",
1524
- // Turkey
1525
- "90",
1526
- 0,
1527
- null,
1528
- "0"
1529
- ],
1530
- [
1531
- "tm",
1532
- // Turkmenistan
1533
- "993",
1534
- 0,
1535
- null,
1536
- "8"
1537
- ],
1538
- [
1539
- "tc",
1540
- // Turks & Caicos Islands
1541
- "1",
1542
- 23,
1543
- ["649"],
1544
- "1"
1545
- ],
1546
- [
1547
- "tv",
1548
- // Tuvalu
1549
- "688"
1550
- ],
1551
- [
1552
- "vi",
1553
- // U.S. Virgin Islands
1554
- "1",
1555
- 24,
1556
- ["340"],
1557
- "1"
1558
- ],
1559
- [
1560
- "ug",
1561
- // Uganda
1562
- "256",
1563
- 0,
1564
- null,
1565
- "0"
1566
- ],
1567
- [
1568
- "ua",
1569
- // Ukraine
1570
- "380",
1571
- 0,
1572
- null,
1573
- "0"
1574
- ],
1575
- [
1576
- "ae",
1577
- // United Arab Emirates
1578
- "971",
1579
- 0,
1580
- null,
1581
- "0"
1582
- ],
1583
- [
1584
- "gb",
1585
- // United Kingdom
1586
- "44",
1587
- 0,
1588
- null,
1589
- "0"
1590
- ],
1591
- [
1592
- "us",
1593
- // United States
1594
- "1",
1595
- 0,
1596
- null,
1597
- "1"
1598
- ],
1599
- [
1600
- "uy",
1601
- // Uruguay
1602
- "598",
1603
- 0,
1604
- null,
1605
- "0"
1606
- ],
1607
- [
1608
- "uz",
1609
- // Uzbekistan
1610
- "998"
1611
- ],
1612
- [
1613
- "vu",
1614
- // Vanuatu
1615
- "678"
1616
- ],
1617
- [
1618
- "va",
1619
- // Vatican City
1620
- "39",
1621
- 1,
1622
- ["06698", "3"]
1623
- // (3 is a mobile range shared with IT)
1624
- ],
1625
- [
1626
- "ve",
1627
- // Venezuela
1628
- "58",
1629
- 0,
1630
- null,
1631
- "0"
1632
- ],
1633
- [
1634
- "vn",
1635
- // Vietnam
1636
- "84",
1637
- 0,
1638
- null,
1639
- "0"
1640
- ],
1641
- [
1642
- "wf",
1643
- // Wallis & Futuna
1644
- "681"
1645
- ],
1646
- [
1647
- "eh",
1648
- // Western Sahara
1649
- "212",
1650
- 1,
1651
- ["5288", "5289", "6", "7"],
1652
- // (6 and 7 are mobile ranges shared with MA)
1653
- "0"
1654
- ],
1655
- [
1656
- "ye",
1657
- // Yemen
1658
- "967",
1659
- 0,
1660
- null,
1661
- "0"
1662
- ],
1663
- [
1664
- "zm",
1665
- // Zambia
1666
- "260",
1667
- 0,
1668
- null,
1669
- "0"
1670
- ],
1671
- [
1672
- "zw",
1673
- // Zimbabwe
1674
- "263",
1675
- 0,
1676
- null,
1677
- "0"
1678
- ]
1679
- ], A = [];
1680
- for (const l of rt)
1681
- A.push({
1682
- name: "",
1683
- // populated in the plugin
1684
- iso2: l[0],
1685
- dialCode: l[1],
1686
- priority: l[2] || 0,
1687
- areaCodes: l[3] || null,
1688
- nodeById: {},
1689
- // populated by the plugin
1690
- nationalPrefix: l[4] || null,
1691
- normalisedName: "",
1692
- // populated in the plugin
1693
- initials: "",
1694
- // populated in the plugin
1695
- dialCodePlus: ""
1696
- // populated in the plugin
1697
- });
1698
- const lt = {
1699
- ad: "Andorra",
1700
- ae: "United Arab Emirates",
1701
- af: "Afghanistan",
1702
- ag: "Antigua & Barbuda",
1703
- ai: "Anguilla",
1704
- al: "Albania",
1705
- am: "Armenia",
1706
- ao: "Angola",
1707
- ar: "Argentina",
1708
- as: "American Samoa",
1709
- at: "Austria",
1710
- au: "Australia",
1711
- aw: "Aruba",
1712
- ax: "Åland Islands",
1713
- az: "Azerbaijan",
1714
- ba: "Bosnia & Herzegovina",
1715
- bb: "Barbados",
1716
- bd: "Bangladesh",
1717
- be: "Belgium",
1718
- bf: "Burkina Faso",
1719
- bg: "Bulgaria",
1720
- bh: "Bahrain",
1721
- bi: "Burundi",
1722
- bj: "Benin",
1723
- bl: "St. Barthélemy",
1724
- bm: "Bermuda",
1725
- bn: "Brunei",
1726
- bo: "Bolivia",
1727
- bq: "Caribbean Netherlands",
1728
- br: "Brazil",
1729
- bs: "Bahamas",
1730
- bt: "Bhutan",
1731
- bw: "Botswana",
1732
- by: "Belarus",
1733
- bz: "Belize",
1734
- ca: "Canada",
1735
- cc: "Cocos (Keeling) Islands",
1736
- cd: "Congo - Kinshasa",
1737
- cf: "Central African Republic",
1738
- cg: "Congo - Brazzaville",
1739
- ch: "Switzerland",
1740
- ci: "Côte d’Ivoire",
1741
- ck: "Cook Islands",
1742
- cl: "Chile",
1743
- cm: "Cameroon",
1744
- cn: "China",
1745
- co: "Colombia",
1746
- cr: "Costa Rica",
1747
- cu: "Cuba",
1748
- cv: "Cape Verde",
1749
- cw: "Curaçao",
1750
- cx: "Christmas Island",
1751
- cy: "Cyprus",
1752
- cz: "Czechia",
1753
- de: "Germany",
1754
- dj: "Djibouti",
1755
- dk: "Denmark",
1756
- dm: "Dominica",
1757
- do: "Dominican Republic",
1758
- dz: "Algeria",
1759
- ec: "Ecuador",
1760
- ee: "Estonia",
1761
- eg: "Egypt",
1762
- eh: "Western Sahara",
1763
- er: "Eritrea",
1764
- es: "Spain",
1765
- et: "Ethiopia",
1766
- fi: "Finland",
1767
- fj: "Fiji",
1768
- fk: "Falkland Islands",
1769
- fm: "Micronesia",
1770
- fo: "Faroe Islands",
1771
- fr: "France",
1772
- ga: "Gabon",
1773
- gb: "United Kingdom",
1774
- gd: "Grenada",
1775
- ge: "Georgia",
1776
- gf: "French Guiana",
1777
- gg: "Guernsey",
1778
- gh: "Ghana",
1779
- gi: "Gibraltar",
1780
- gl: "Greenland",
1781
- gm: "Gambia",
1782
- gn: "Guinea",
1783
- gp: "Guadeloupe",
1784
- gq: "Equatorial Guinea",
1785
- gr: "Greece",
1786
- gt: "Guatemala",
1787
- gu: "Guam",
1788
- gw: "Guinea-Bissau",
1789
- gy: "Guyana",
1790
- hk: "Hong Kong SAR China",
1791
- hn: "Honduras",
1792
- hr: "Croatia",
1793
- ht: "Haiti",
1794
- hu: "Hungary",
1795
- id: "Indonesia",
1796
- ie: "Ireland",
1797
- il: "Israel",
1798
- im: "Isle of Man",
1799
- in: "India",
1800
- io: "British Indian Ocean Territory",
1801
- iq: "Iraq",
1802
- ir: "Iran",
1803
- is: "Iceland",
1804
- it: "Italy",
1805
- je: "Jersey",
1806
- jm: "Jamaica",
1807
- jo: "Jordan",
1808
- jp: "Japan",
1809
- ke: "Kenya",
1810
- kg: "Kyrgyzstan",
1811
- kh: "Cambodia",
1812
- ki: "Kiribati",
1813
- km: "Comoros",
1814
- kn: "St. Kitts & Nevis",
1815
- kp: "North Korea",
1816
- kr: "South Korea",
1817
- kw: "Kuwait",
1818
- ky: "Cayman Islands",
1819
- kz: "Kazakhstan",
1820
- la: "Laos",
1821
- lb: "Lebanon",
1822
- lc: "St. Lucia",
1823
- li: "Liechtenstein",
1824
- lk: "Sri Lanka",
1825
- lr: "Liberia",
1826
- ls: "Lesotho",
1827
- lt: "Lithuania",
1828
- lu: "Luxembourg",
1829
- lv: "Latvia",
1830
- ly: "Libya",
1831
- ma: "Morocco",
1832
- mc: "Monaco",
1833
- md: "Moldova",
1834
- me: "Montenegro",
1835
- mf: "St. Martin",
1836
- mg: "Madagascar",
1837
- mh: "Marshall Islands",
1838
- mk: "North Macedonia",
1839
- ml: "Mali",
1840
- mm: "Myanmar (Burma)",
1841
- mn: "Mongolia",
1842
- mo: "Macao SAR China",
1843
- mp: "Northern Mariana Islands",
1844
- mq: "Martinique",
1845
- mr: "Mauritania",
1846
- ms: "Montserrat",
1847
- mt: "Malta",
1848
- mu: "Mauritius",
1849
- mv: "Maldives",
1850
- mw: "Malawi",
1851
- mx: "Mexico",
1852
- my: "Malaysia",
1853
- mz: "Mozambique",
1854
- na: "Namibia",
1855
- nc: "New Caledonia",
1856
- ne: "Niger",
1857
- nf: "Norfolk Island",
1858
- ng: "Nigeria",
1859
- ni: "Nicaragua",
1860
- nl: "Netherlands",
1861
- no: "Norway",
1862
- np: "Nepal",
1863
- nr: "Nauru",
1864
- nu: "Niue",
1865
- nz: "New Zealand",
1866
- om: "Oman",
1867
- pa: "Panama",
1868
- pe: "Peru",
1869
- pf: "French Polynesia",
1870
- pg: "Papua New Guinea",
1871
- ph: "Philippines",
1872
- pk: "Pakistan",
1873
- pl: "Poland",
1874
- pm: "St. Pierre & Miquelon",
1875
- pr: "Puerto Rico",
1876
- ps: "Palestinian Territories",
1877
- pt: "Portugal",
1878
- pw: "Palau",
1879
- py: "Paraguay",
1880
- qa: "Qatar",
1881
- re: "Réunion",
1882
- ro: "Romania",
1883
- rs: "Serbia",
1884
- ru: "Russia",
1885
- rw: "Rwanda",
1886
- sa: "Saudi Arabia",
1887
- sb: "Solomon Islands",
1888
- sc: "Seychelles",
1889
- sd: "Sudan",
1890
- se: "Sweden",
1891
- sg: "Singapore",
1892
- sh: "St. Helena",
1893
- si: "Slovenia",
1894
- sj: "Svalbard & Jan Mayen",
1895
- sk: "Slovakia",
1896
- sl: "Sierra Leone",
1897
- sm: "San Marino",
1898
- sn: "Senegal",
1899
- so: "Somalia",
1900
- sr: "Suriname",
1901
- ss: "South Sudan",
1902
- st: "São Tomé & Príncipe",
1903
- sv: "El Salvador",
1904
- sx: "Sint Maarten",
1905
- sy: "Syria",
1906
- sz: "Eswatini",
1907
- tc: "Turks & Caicos Islands",
1908
- td: "Chad",
1909
- tg: "Togo",
1910
- th: "Thailand",
1911
- tj: "Tajikistan",
1912
- tk: "Tokelau",
1913
- tl: "Timor-Leste",
1914
- tm: "Turkmenistan",
1915
- tn: "Tunisia",
1916
- to: "Tonga",
1917
- tr: "Turkey",
1918
- tt: "Trinidad & Tobago",
1919
- tv: "Tuvalu",
1920
- tw: "Taiwan",
1921
- tz: "Tanzania",
1922
- ua: "Ukraine",
1923
- ug: "Uganda",
1924
- us: "United States",
1925
- uy: "Uruguay",
1926
- uz: "Uzbekistan",
1927
- va: "Vatican City",
1928
- vc: "St. Vincent & Grenadines",
1929
- ve: "Venezuela",
1930
- vg: "British Virgin Islands",
1931
- vi: "U.S. Virgin Islands",
1932
- vn: "Vietnam",
1933
- vu: "Vanuatu",
1934
- wf: "Wallis & Futuna",
1935
- ws: "Samoa",
1936
- ye: "Yemen",
1937
- yt: "Mayotte",
1938
- za: "South Africa",
1939
- zm: "Zambia",
1940
- zw: "Zimbabwe"
1941
- }, at = {
1942
- selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1943
- noCountrySelected: "Select country",
1944
- countryListAriaLabel: "List of countries",
1945
- searchPlaceholder: "Search",
1946
- clearSearchAriaLabel: "Clear search",
1947
- zeroSearchResults: "No results found",
1948
- oneSearchResult: "1 result found",
1949
- multipleSearchResults: "${count} results found",
1950
- // additional countries (not supported by country-list library)
1951
- ac: "Ascension Island",
1952
- xk: "Kosovo"
1953
- }, j = { ...lt, ...at }, T = {
1954
- OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1955
- CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1956
- COUNTRY_CHANGE: "countrychange",
1957
- INPUT: "input"
1958
- // used for synthetic input trigger
1959
- }, h = {
1960
- HIDE: "iti__hide",
1961
- V_HIDE: "iti__v-hide",
1962
- ARROW_UP: "iti__arrow--up",
1963
- GLOBE: "iti__globe",
1964
- FLAG: "iti__flag",
1965
- COUNTRY_ITEM: "iti__country",
1966
- HIGHLIGHT: "iti__highlight"
1967
- }, _ = {
1968
- ARROW_UP: "ArrowUp",
1969
- ARROW_DOWN: "ArrowDown",
1970
- SPACE: " ",
1971
- ENTER: "Enter",
1972
- ESC: "Escape",
1973
- TAB: "Tab"
1974
- }, F = {
1975
- PASTE: "insertFromPaste",
1976
- DELETE_FWD: "deleteContentForward"
1977
- }, E = {
1978
- ALPHA_UNICODE: new RegExp("\\p{L}", "u"),
1979
- // any kind of letter from any language
1980
- NON_PLUS_NUMERIC: /[^+0-9]/,
1981
- // chars that are NOT + or digit
1982
- NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
1983
- // chars that are NOT + or digit (global)
1984
- HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
1985
- // single acceptable hidden-search char
1986
- }, ut = {
1987
- HIDDEN_SEARCH_RESET_MS: 1e3
1988
- }, $ = {
1989
- UNKNOWN_NUMBER_TYPE: -99,
1990
- UNKNOWN_VALIDATION_ERROR: -99
1991
- }, R = {
1992
- SANE_SELECTED_WITH_DIAL_WIDTH: 78,
1993
- // px width fallback when separateDialCode enabled
1994
- SANE_SELECTED_NO_DIAL_WIDTH: 42,
1995
- // px width fallback when no separate dial code
1996
- INPUT_PADDING_EXTRA_LEFT: 6
1997
- // px gap between selected country container and input text
1998
- }, K = {
1999
- NANP: "1"
2000
- // North American Numbering Plan
2001
- }, k = {
2002
- DIAL_CODE: "44",
2003
- // +44 United Kingdom
2004
- MOBILE_PREFIX: "7",
2005
- // UK mobile numbers start with 7 after national trunk (0) or core section
2006
- MOBILE_CORE_LENGTH: 10
2007
- // core number length (excluding dial code / national prefix) for mobiles
2008
- }, dt = {
2009
- ISO2: "us"
2010
- }, H = {
2011
- AGGRESSIVE: "aggressive",
2012
- POLITE: "polite"
2013
- }, M = {
2014
- AUTO: "auto"
2015
- }, G = {
2016
- COUNTRY_CODE: "countryCode",
2017
- DIAL_CODE: "dialCode"
2018
- }, m = {
2019
- EXPANDED: "aria-expanded",
2020
- LABEL: "aria-label",
2021
- SELECTED: "aria-selected",
2022
- ACTIVE_DESCENDANT: "aria-activedescendant",
2023
- HASPOPUP: "aria-haspopup",
2024
- CONTROLS: "aria-controls",
2025
- HIDDEN: "aria-hidden",
2026
- AUTOCOMPLETE: "aria-autocomplete",
2027
- MODAL: "aria-modal"
2028
- }, x = (l) => typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia(l).matches, ct = () => {
2029
- if (typeof navigator < "u" && typeof window < "u") {
2030
- const l = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
2031
- navigator.userAgent
2032
- ), t = x("(max-width: 500px)"), e = x("(max-height: 600px)"), i = x("(pointer: coarse)");
2033
- return l || t || i && e;
2034
- }
2035
- return !1;
2036
- }, Y = {
2037
- // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
2038
- allowPhonewords: !1,
2039
- //* Whether or not to allow the dropdown.
2040
- allowDropdown: !0,
2041
- //* Add a placeholder in the input with an example number for the selected country.
2042
- autoPlaceholder: H.POLITE,
2043
- //* Modify the parentClass.
2044
- containerClass: "",
2045
- //* The order of the countries in the dropdown. Defaults to alphabetical.
2046
- countryOrder: null,
2047
- //* Add a country search input at the top of the dropdown.
2048
- countrySearch: !0,
2049
- //* Modify the auto placeholder.
2050
- customPlaceholder: null,
2051
- //* Append menu to specified element.
2052
- dropdownContainer: null,
2053
- //* Don't display these countries.
2054
- excludeCountries: [],
2055
- //* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
2056
- fixDropdownWidth: !0,
2057
- //* Format the number as the user types
2058
- formatAsYouType: !0,
2059
- //* Format the input value during initialisation and on setNumber.
2060
- formatOnDisplay: !0,
2061
- //* geoIp lookup function.
2062
- geoIpLookup: null,
2063
- //* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
2064
- hiddenInput: null,
2065
- //* Internationalise the plugin text e.g. search input placeholder, country names.
2066
- i18n: {},
2067
- //* Initial country.
2068
- initialCountry: "",
2069
- //* A function to load the utils script.
2070
- loadUtils: null,
2071
- //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
2072
- nationalMode: !0,
2073
- //* Display only these countries.
2074
- onlyCountries: [],
2075
- //* Number type to use for placeholders.
2076
- placeholderNumberType: "MOBILE",
2077
- //* Show flags - for both the selected country, and in the country dropdown
2078
- showFlags: !0,
2079
- //* Display the international dial code next to the selected flag.
2080
- separateDialCode: !1,
2081
- //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
2082
- strictMode: !1,
2083
- //* Use full screen popup instead of dropdown for country list.
2084
- useFullscreenPopup: ct(),
2085
- //* The number type to enforce during validation.
2086
- validationNumberTypes: ["MOBILE"]
2087
- }, ht = (l, t) => {
2088
- l.useFullscreenPopup && (l.fixDropdownWidth = !1), l.onlyCountries.length === 1 && (l.initialCountry = l.onlyCountries[0]), l.separateDialCode && (l.nationalMode = !1), l.allowDropdown && !l.showFlags && !l.separateDialCode && (l.nationalMode = !1), l.useFullscreenPopup && !l.dropdownContainer && (l.dropdownContainer = document.body), l.i18n = { ...t, ...l.i18n };
2089
- }, v = (l) => l.replace(/\D/g, ""), q = (l = "") => l.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase(), pt = (l, t) => {
2090
- const e = q(t), i = [], s = [], o = [], n = [], r = [], a = [];
2091
- for (const c of l)
2092
- c.iso2 === e ? i.push(c) : c.normalisedName.startsWith(e) ? s.push(c) : c.normalisedName.includes(e) ? o.push(c) : e === c.dialCode || e === c.dialCodePlus ? n.push(c) : c.dialCodePlus.includes(e) ? r.push(c) : c.initials.includes(e) && a.push(c);
2093
- const d = (c, p) => c.priority - p.priority;
2094
- return [
2095
- ...i.sort(d),
2096
- ...s.sort(d),
2097
- ...o.sort(d),
2098
- ...n.sort(d),
2099
- ...r.sort(d),
2100
- ...a.sort(d)
2101
- ];
2102
- }, Ct = (l, t) => {
2103
- const e = t.toLowerCase();
2104
- for (const i of l)
2105
- if (i.name.toLowerCase().startsWith(e))
2106
- return i;
2107
- return null;
2108
- }, U = (l) => Object.keys(l).filter((t) => !!l[t]).join(" "), f = (l, t, e) => {
2109
- const i = document.createElement(l);
2110
- return t && Object.entries(t).forEach(
2111
- ([s, o]) => i.setAttribute(s, o)
2112
- ), e && e.appendChild(i), i;
2113
- }, mt = () => `
2114
- <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${m.HIDDEN}="true">
2115
- <circle cx="11" cy="11" r="7" />
2116
- <line x1="21" y1="21" x2="16.65" y2="16.65" />
2117
- </svg>`, ft = (l) => {
2118
- const t = `iti-${l}-clear-mask`;
2119
- return `
2120
- <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${m.HIDDEN}="true" focusable="false">
2121
- <mask id="${t}" maskUnits="userSpaceOnUse">
2122
- <rect width="16" height="16" fill="white" />
2123
- <path d="M5.2 5.2 L10.8 10.8 M10.8 5.2 L5.2 10.8" stroke="black" stroke-linecap="round" class="iti__search-clear-x" />
2124
- </mask>
2125
- <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${t})" />
2126
- </svg>`;
2127
- };
2128
- class yt {
2129
- constructor(t, e, i) {
2130
- this.highlightedItem = null, this.selectedItem = null, t.dataset.intlTelInputId = i.toString(), this.telInput = t, this.options = e, this.id = i, this.hadInitialPlaceholder = !!t.getAttribute("placeholder"), this.isRTL = !!this.telInput.closest("[dir=rtl]"), this.options.separateDialCode && (this.originalPaddingLeft = this.telInput.style.paddingLeft);
2131
- }
2132
- //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
2133
- generateMarkup(t) {
2134
- this.countries = t, this._prepareTelInput();
2135
- const e = this._createWrapperAndInsert();
2136
- this._maybeBuildCountryContainer(e), e.appendChild(this.telInput), this._maybeUpdateInputPaddingAndReveal(), this._maybeBuildHiddenInputs(e);
2137
- }
2138
- _prepareTelInput() {
2139
- var t;
2140
- this.telInput.classList.add("iti__tel-input"), !this.telInput.hasAttribute("autocomplete") && !((t = this.telInput.form) != null && t.hasAttribute("autocomplete")) && this.telInput.setAttribute("autocomplete", "off");
2141
- }
2142
- _createWrapperAndInsert() {
2143
- const { allowDropdown: t, showFlags: e, containerClass: i, useFullscreenPopup: s } = this.options, o = U({
2144
- iti: !0,
2145
- "iti--allow-dropdown": t,
2146
- "iti--show-flags": e,
2147
- "iti--inline-dropdown": !s,
2148
- [i]: !!i
2149
- }), n = f("div", { class: o });
2150
- return this.isRTL && n.setAttribute("dir", "ltr"), this.telInput.before(n), n;
2151
- }
2152
- _maybeBuildCountryContainer(t) {
2153
- const { allowDropdown: e, separateDialCode: i, showFlags: s } = this.options;
2154
- if (e || s || i) {
2155
- this.countryContainer = f(
2156
- "div",
2157
- // visibly hidden until we measure it's width to set the input padding correctly
2158
- { class: `iti__country-container ${h.V_HIDE}` },
2159
- t
2160
- ), e ? (this.selectedCountry = f(
2161
- "button",
2162
- {
2163
- type: "button",
2164
- class: "iti__selected-country",
2165
- [m.EXPANDED]: "false",
2166
- [m.LABEL]: this.options.i18n.noCountrySelected,
2167
- [m.HASPOPUP]: "dialog",
2168
- [m.CONTROLS]: `iti-${this.id}__dropdown-content`
2169
- },
2170
- this.countryContainer
2171
- ), this.telInput.disabled && this.selectedCountry.setAttribute("disabled", "true")) : this.selectedCountry = f(
2172
- "div",
2173
- { class: "iti__selected-country" },
2174
- this.countryContainer
2175
- );
2176
- const o = f(
2177
- "div",
2178
- { class: "iti__selected-country-primary" },
2179
- this.selectedCountry
2180
- );
2181
- this.selectedCountryInner = f(
2182
- "div",
2183
- { class: h.FLAG },
2184
- o
2185
- ), e && (this.dropdownArrow = f(
2186
- "div",
2187
- { class: "iti__arrow", [m.HIDDEN]: "true" },
2188
- o
2189
- )), i && (this.selectedDialCode = f(
2190
- "div",
2191
- { class: "iti__selected-dial-code" },
2192
- this.selectedCountry
2193
- )), e && this._buildDropdownContent();
2194
- }
2195
- }
2196
- _buildDropdownContent() {
2197
- const {
2198
- fixDropdownWidth: t,
2199
- useFullscreenPopup: e,
2200
- countrySearch: i,
2201
- i18n: s,
2202
- dropdownContainer: o,
2203
- containerClass: n
2204
- } = this.options, r = t ? "" : "iti--flexible-dropdown-width";
2205
- if (this.dropdownContent = f("div", {
2206
- id: `iti-${this.id}__dropdown-content`,
2207
- class: `iti__dropdown-content ${h.HIDE} ${r}`,
2208
- role: "dialog",
2209
- [m.MODAL]: "true"
2210
- }), this.isRTL && this.dropdownContent.setAttribute("dir", "rtl"), i && this._buildSearchUI(), this.countryList = f(
2211
- "ul",
2212
- {
2213
- class: "iti__country-list",
2214
- id: `iti-${this.id}__country-listbox`,
2215
- role: "listbox",
2216
- [m.LABEL]: s.countryListAriaLabel
2217
- },
2218
- this.dropdownContent
2219
- ), this._appendListItems(), i && this.updateSearchResultsA11yText(), o) {
2220
- const a = U({
2221
- iti: !0,
2222
- "iti--container": !0,
2223
- "iti--fullscreen-popup": e,
2224
- "iti--inline-dropdown": !e,
2225
- [n]: !!n
2226
- });
2227
- this.dropdown = f("div", { class: a }), this.dropdown.appendChild(this.dropdownContent);
2228
- } else
2229
- this.countryContainer.appendChild(this.dropdownContent);
2230
- }
2231
- _buildSearchUI() {
2232
- const { i18n: t } = this.options, e = f(
2233
- "div",
2234
- { class: "iti__search-input-wrapper" },
2235
- this.dropdownContent
2236
- );
2237
- this.searchIcon = f(
2238
- "span",
2239
- {
2240
- class: "iti__search-icon",
2241
- [m.HIDDEN]: "true"
2242
- },
2243
- e
2244
- ), this.searchIcon.innerHTML = mt(), this.searchInput = f(
2245
- "input",
2246
- {
2247
- id: `iti-${this.id}__search-input`,
2248
- // Chrome says inputs need either a name or an id
2249
- type: "search",
2250
- class: "iti__search-input",
2251
- placeholder: t.searchPlaceholder,
2252
- // role=combobox + aria-autocomplete=list + aria-activedescendant allows maintaining focus on the search input while allowing users to navigate search results with up/down keyboard keys
2253
- role: "combobox",
2254
- [m.EXPANDED]: "true",
2255
- [m.LABEL]: t.searchPlaceholder,
2256
- [m.CONTROLS]: `iti-${this.id}__country-listbox`,
2257
- [m.AUTOCOMPLETE]: "list",
2258
- autocomplete: "off"
2259
- },
2260
- e
2261
- ), this.searchClearButton = f(
2262
- "button",
2263
- {
2264
- type: "button",
2265
- class: `iti__search-clear ${h.HIDE}`,
2266
- [m.LABEL]: t.clearSearchAriaLabel,
2267
- tabindex: "-1"
2268
- },
2269
- e
2270
- ), this.searchClearButton.innerHTML = ft(this.id), this.searchResultsA11yText = f(
2271
- "span",
2272
- { class: "iti__a11y-text" },
2273
- this.dropdownContent
2274
- ), this.searchNoResults = f(
2275
- "div",
2276
- {
2277
- class: `iti__no-results ${h.HIDE}`,
2278
- [m.HIDDEN]: "true"
2279
- // all a11y messaging happens in this.searchResultsA11yText
2280
- },
2281
- this.dropdownContent
2282
- ), this.searchNoResults.textContent = t.zeroSearchResults;
2283
- }
2284
- _maybeUpdateInputPaddingAndReveal() {
2285
- this.countryContainer && (this.updateInputPadding(), this.countryContainer.classList.remove(h.V_HIDE));
2286
- }
2287
- _maybeBuildHiddenInputs(t) {
2288
- var i, s;
2289
- const { hiddenInput: e } = this.options;
2290
- if (e) {
2291
- const o = this.telInput.getAttribute("name") || "", n = e(o);
2292
- if (n.phone) {
2293
- const r = (i = this.telInput.form) == null ? void 0 : i.querySelector(
2294
- `input[name="${n.phone}"]`
2295
- );
2296
- r ? this.hiddenInput = r : (this.hiddenInput = f("input", {
2297
- type: "hidden",
2298
- name: n.phone
2299
- }), t.appendChild(this.hiddenInput));
2300
- }
2301
- if (n.country) {
2302
- const r = (s = this.telInput.form) == null ? void 0 : s.querySelector(
2303
- `input[name="${n.country}"]`
2304
- );
2305
- r ? this.hiddenInputCountry = r : (this.hiddenInputCountry = f("input", {
2306
- type: "hidden",
2307
- name: n.country
2308
- }), t.appendChild(this.hiddenInputCountry));
2309
- }
2310
- }
2311
- }
2312
- //* For each country: add a country list item <li> to the countryList <ul> container.
2313
- _appendListItems() {
2314
- const t = document.createDocumentFragment();
2315
- for (let e = 0; e < this.countries.length; e++) {
2316
- const i = this.countries[e], s = U({
2317
- [h.COUNTRY_ITEM]: !0
2318
- }), o = f("li", {
2319
- id: `iti-${this.id}__item-${i.iso2}`,
2320
- class: s,
2321
- tabindex: "-1",
2322
- role: "option",
2323
- [m.SELECTED]: "false"
2324
- });
2325
- o.dataset.dialCode = i.dialCode, o.dataset.countryCode = i.iso2, i.nodeById[this.id] = o, this.options.showFlags && f("div", { class: `${h.FLAG} iti__${i.iso2}` }, o);
2326
- const n = f("span", { class: "iti__country-name" }, o);
2327
- n.textContent = i.name;
2328
- const r = f("span", { class: "iti__dial-code" }, o);
2329
- this.isRTL && r.setAttribute("dir", "ltr"), r.textContent = `+${i.dialCode}`, t.appendChild(o);
2330
- }
2331
- this.countryList.appendChild(t);
2332
- }
2333
- //* Update the input padding to make space for the selected country/dial code.
2334
- updateInputPadding() {
2335
- if (this.selectedCountry) {
2336
- const t = this.options.separateDialCode ? R.SANE_SELECTED_WITH_DIAL_WIDTH : R.SANE_SELECTED_NO_DIAL_WIDTH, i = (this.selectedCountry.offsetWidth || this._getHiddenSelectedCountryWidth() || t) + R.INPUT_PADDING_EXTRA_LEFT;
2337
- this.telInput.style.paddingLeft = `${i}px`;
2338
- }
2339
- }
2340
- //* When input is in a hidden container during init, we cannot calculate the selected country width.
2341
- //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2342
- //* To get the right styling to apply, all we need is a shallow clone of the container,
2343
- //* and then to inject a deep clone of the selectedCountry element.
2344
- _getHiddenSelectedCountryWidth() {
2345
- if (this.telInput.parentNode) {
2346
- let t;
2347
- try {
2348
- t = window.top.document.body;
2349
- } catch {
2350
- t = document.body;
2351
- }
2352
- const e = this.telInput.parentNode.cloneNode(
2353
- !1
2354
- );
2355
- e.style.visibility = "hidden", t.appendChild(e);
2356
- const i = this.countryContainer.cloneNode();
2357
- e.appendChild(i);
2358
- const s = this.selectedCountry.cloneNode(
2359
- !0
2360
- );
2361
- i.appendChild(s);
2362
- const o = s.offsetWidth;
2363
- return t.removeChild(e), o;
2364
- }
2365
- return 0;
2366
- }
2367
- //* Update search results text (for a11y).
2368
- updateSearchResultsA11yText() {
2369
- const { i18n: t } = this.options, e = this.countryList.childElementCount;
2370
- let i;
2371
- e === 0 ? i = t.zeroSearchResults : t.searchResultsText ? i = t.searchResultsText(e) : e === 1 ? i = t.oneSearchResult : i = t.multipleSearchResults.replace(
2372
- "${count}",
2373
- e.toString()
2374
- ), this.searchResultsA11yText.textContent = i;
2375
- }
2376
- //* Check if an element is visible within it's container, else scroll until it is.
2377
- scrollTo(t) {
2378
- const e = this.countryList, i = document.documentElement.scrollTop, s = e.offsetHeight, o = e.getBoundingClientRect().top + i, n = o + s, r = t.offsetHeight, a = t.getBoundingClientRect().top + i, d = a + r, c = a - o + e.scrollTop;
2379
- if (a < o)
2380
- e.scrollTop = c;
2381
- else if (d > n) {
2382
- const p = s - r;
2383
- e.scrollTop = c - p;
2384
- }
2385
- }
2386
- //* Remove highlighting from the previous list item and highlight the new one.
2387
- highlightListItem(t, e) {
2388
- const i = this.highlightedItem;
2389
- if (i && i.classList.remove(h.HIGHLIGHT), this.highlightedItem = t, this.highlightedItem && (this.highlightedItem.classList.add(h.HIGHLIGHT), this.options.countrySearch)) {
2390
- const s = this.highlightedItem.getAttribute("id") || "";
2391
- this.searchInput.setAttribute(m.ACTIVE_DESCENDANT, s);
2392
- }
2393
- e && this.highlightedItem.focus();
2394
- }
2395
- updateSelectedItem(t) {
2396
- if (this.selectedItem && this.selectedItem.dataset.countryCode !== t && (this.selectedItem.setAttribute(m.SELECTED, "false"), this.selectedItem = null), t && !this.selectedItem) {
2397
- const e = this.countryList.querySelector(
2398
- `[data-country-code="${t}"]`
2399
- );
2400
- e && (e.setAttribute(m.SELECTED, "true"), this.selectedItem = e);
2401
- }
2402
- }
2403
- //* Country search: Filter the country list to the given array of countries.
2404
- filterCountries(t) {
2405
- this.countryList.innerHTML = "";
2406
- let e = !0;
2407
- for (const i of t) {
2408
- const s = i.nodeById[this.id];
2409
- s && (this.countryList.appendChild(s), e && (this.highlightListItem(s, !1), e = !1));
2410
- }
2411
- e ? (this.highlightListItem(null, !1), this.searchNoResults && this.searchNoResults.classList.remove(h.HIDE)) : this.searchNoResults && this.searchNoResults.classList.add(h.HIDE), this.countryList.scrollTop = 0, this.updateSearchResultsA11yText();
2412
- }
2413
- destroy() {
2414
- this.telInput.iti = void 0, delete this.telInput.dataset.intlTelInputId, this.options.separateDialCode && (this.telInput.style.paddingLeft = this.originalPaddingLeft);
2415
- const t = this.telInput.parentNode;
2416
- t.before(this.telInput), t.remove(), this.telInput = null, this.countryContainer = null, this.selectedCountry = null, this.selectedCountryInner = null, this.selectedDialCode = null, this.dropdownArrow = null, this.dropdownContent = null, this.searchInput = null, this.searchIcon = null, this.searchClearButton = null, this.searchNoResults = null, this.searchResultsA11yText = null, this.countryList = null, this.dropdown = null, this.hiddenInput = null, this.hiddenInputCountry = null, this.highlightedItem = null, this.selectedItem = null;
2417
- for (const e of this.countries)
2418
- delete e.nodeById[this.id];
2419
- this.countries = null;
2420
- }
2421
- }
2422
- const gt = (l) => {
2423
- const { onlyCountries: t, excludeCountries: e } = l;
2424
- if (t.length) {
2425
- const i = t.map(
2426
- (s) => s.toLowerCase()
2427
- );
2428
- return A.filter(
2429
- (s) => i.includes(s.iso2)
2430
- );
2431
- } else if (e.length) {
2432
- const i = e.map(
2433
- (s) => s.toLowerCase()
2434
- );
2435
- return A.filter(
2436
- (s) => !i.includes(s.iso2)
2437
- );
2438
- }
2439
- return A;
2440
- }, _t = (l, t) => {
2441
- for (const e of l) {
2442
- const i = e.iso2.toLowerCase();
2443
- t.i18n[i] && (e.name = t.i18n[i]);
2444
- }
2445
- }, bt = (l) => {
2446
- const t = /* @__PURE__ */ new Set();
2447
- let e = 0;
2448
- const i = {}, s = (n, r) => {
2449
- if (!n || !r)
2450
- return;
2451
- r.length > e && (e = r.length), i.hasOwnProperty(r) || (i[r] = []);
2452
- const a = i[r];
2453
- a.includes(n) || a.push(n);
2454
- }, o = [...l].sort((n, r) => n.priority - r.priority);
2455
- for (const n of o) {
2456
- t.has(n.dialCode) || t.add(n.dialCode);
2457
- for (let r = 1; r < n.dialCode.length; r++) {
2458
- const a = n.dialCode.substring(0, r);
2459
- s(n.iso2, a);
2460
- }
2461
- if (s(n.iso2, n.dialCode), n.areaCodes) {
2462
- const r = i[n.dialCode][0];
2463
- for (const a of n.areaCodes) {
2464
- for (let d = 1; d < a.length; d++) {
2465
- const c = a.substring(0, d), p = n.dialCode + c;
2466
- s(r, p), s(n.iso2, p);
2467
- }
2468
- s(n.iso2, n.dialCode + a);
2469
- }
2470
- }
2471
- }
2472
- return { dialCodes: t, dialCodeMaxLen: e, dialCodeToIso2Map: i };
2473
- }, It = (l, t) => {
2474
- t.countryOrder && (t.countryOrder = t.countryOrder.map(
2475
- (e) => e.toLowerCase()
2476
- )), l.sort((e, i) => {
2477
- const { countryOrder: s } = t;
2478
- if (s) {
2479
- const o = s.indexOf(e.iso2), n = s.indexOf(i.iso2), r = o > -1, a = n > -1;
2480
- if (r || a)
2481
- return r && a ? o - n : r ? -1 : 1;
2482
- }
2483
- return e.name.localeCompare(i.name);
2484
- });
2485
- }, Nt = (l) => {
2486
- for (const t of l)
2487
- t.normalisedName = q(t.name), t.initials = t.normalisedName.split(/[^a-z]/).map((e) => e[0]).join(""), t.dialCodePlus = `+${t.dialCode}`;
2488
- }, wt = (l, t, e, i) => {
2489
- let s = l;
2490
- if (e && t) {
2491
- t = `+${i.dialCode}`;
2492
- const o = s[t.length] === " " || s[t.length] === "-" ? t.length + 1 : t.length;
2493
- s = s.substring(o);
2494
- }
2495
- return s;
2496
- }, Dt = (l, t, e, i, s) => {
2497
- const o = e ? e.formatNumberAsYouType(l, i.iso2) : l, { dialCode: n } = i;
2498
- return s && t.charAt(0) !== "+" && o.includes(`+${n}`) ? (o.split(`+${n}`)[1] || "").trim() : o;
2499
- }, Lt = (l, t, e, i) => {
2500
- if (e === 0 && !i)
2501
- return 0;
2502
- let s = 0;
2503
- for (let o = 0; o < t.length; o++) {
2504
- if (/[+0-9]/.test(t[o]) && s++, s === l && !i)
2505
- return o + 1;
2506
- if (i && s === l + 1)
2507
- return o;
2508
- }
2509
- return t.length;
2510
- }, Et = [
2511
- "800",
2512
- "822",
2513
- "833",
2514
- "844",
2515
- "855",
2516
- "866",
2517
- "877",
2518
- "880",
2519
- "881",
2520
- "882",
2521
- "883",
2522
- "884",
2523
- "885",
2524
- "886",
2525
- "887",
2526
- "888",
2527
- "889"
2528
- ], z = (l) => {
2529
- const t = v(l);
2530
- if (t.startsWith(K.NANP) && t.length >= 4) {
2531
- const e = t.substring(1, 4);
2532
- return Et.includes(e);
2533
- }
2534
- return !1;
2535
- };
2536
- for (const l of A)
2537
- l.name = j[l.iso2];
2538
- let At = 0;
2539
- const St = new Set(A.map((l) => l.iso2)), B = (l) => St.has(l);
2540
- class V {
2541
- constructor(t, e = {}) {
2542
- this.id = At++, this.options = { ...Y, ...e }, ht(this.options, j), this.ui = new yt(t, this.options, this.id), this.isAndroid = V._getIsAndroid(), this.promise = this._createInitPromises(), this.countries = gt(this.options);
2543
- const { dialCodes: i, dialCodeMaxLen: s, dialCodeToIso2Map: o } = bt(
2544
- this.countries
2545
- );
2546
- this.dialCodes = i, this.dialCodeMaxLen = s, this.dialCodeToIso2Map = o, this.countryByIso2 = new Map(this.countries.map((n) => [n.iso2, n])), this._init();
2547
- }
2548
- static _getIsAndroid() {
2549
- return typeof navigator < "u" ? /Android/i.test(navigator.userAgent) : !1;
2550
- }
2551
- _updateNumeralSet(t) {
2552
- /[\u0660-\u0669]/.test(t) ? this.userNumeralSet = "arabic-indic" : /[\u06F0-\u06F9]/.test(t) ? this.userNumeralSet = "persian" : this.userNumeralSet = "ascii";
2553
- }
2554
- _mapAsciiToUserNumerals(t) {
2555
- if (this.userNumeralSet || this._updateNumeralSet(this.ui.telInput.value), this.userNumeralSet === "ascii")
2556
- return t;
2557
- const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776;
2558
- return t.replace(/[0-9]/g, (i) => String.fromCharCode(e + Number(i)));
2559
- }
2560
- // Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
2561
- _normaliseNumerals(t) {
2562
- if (!t)
2563
- return "";
2564
- if (this._updateNumeralSet(t), this.userNumeralSet === "ascii")
2565
- return t;
2566
- const e = this.userNumeralSet === "arabic-indic" ? 1632 : 1776, i = this.userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
2567
- return t.replace(i, (s) => String.fromCharCode(48 + (s.charCodeAt(0) - e)));
2568
- }
2569
- _getTelInputValue() {
2570
- const t = this.ui.telInput.value.trim();
2571
- return this._normaliseNumerals(t);
2572
- }
2573
- _setTelInputValue(t) {
2574
- this.ui.telInput.value = this._mapAsciiToUserNumerals(t);
2575
- }
2576
- _createInitPromises() {
2577
- const t = new Promise((i, s) => {
2578
- this.resolveAutoCountryPromise = i, this.rejectAutoCountryPromise = s;
2579
- }), e = new Promise((i, s) => {
2580
- this.resolveUtilsScriptPromise = i, this.rejectUtilsScriptPromise = s;
2581
- });
2582
- return Promise.all([t, e]);
2583
- }
2584
- //* Can't be private as it's called from intlTelInput convenience wrapper.
2585
- _init() {
2586
- this.selectedCountryData = {}, this.abortController = new AbortController(), this._processCountryData(), this.ui.generateMarkup(this.countries), this._setInitialState(), this._initListeners(), this._initRequests();
2587
- }
2588
- //********************
2589
- //* PRIVATE METHODS
2590
- //********************
2591
- //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
2592
- _processCountryData() {
2593
- _t(this.countries, this.options), It(this.countries, this.options), Nt(this.countries);
2594
- }
2595
- //* Set the initial state of the input value and the selected country by:
2596
- //* 1. Extracting a dial code from the given number
2597
- //* 2. Using explicit initialCountry
2598
- _setInitialState(t = !1) {
2599
- const e = this.ui.telInput.getAttribute("value"), i = this._normaliseNumerals(e), s = this._getTelInputValue(), n = i && i.startsWith("+") && (!s || !s.startsWith("+")) ? i : s, r = this._getDialCode(n), a = z(n), { initialCountry: d, geoIpLookup: c } = this.options, p = d === M.AUTO && c;
2600
- if (r && !a)
2601
- this._updateCountryFromNumber(n);
2602
- else if (!p || t) {
2603
- const b = d ? d.toLowerCase() : "";
2604
- B(b) ? this._setCountry(b) : r && a ? this._setCountry(dt.ISO2) : this._setCountry("");
2605
- }
2606
- n && this._updateValFromNumber(n);
2607
- }
2608
- //* Initialise the main event listeners: input keyup, and click selected country.
2609
- _initListeners() {
2610
- this._initTelInputListeners(), this.options.allowDropdown && this._initDropdownListeners(), (this.ui.hiddenInput || this.ui.hiddenInputCountry) && this.ui.telInput.form && this._initHiddenInputListener();
2611
- }
2612
- //* Update hidden input on form submit.
2613
- _initHiddenInputListener() {
2614
- var e;
2615
- const t = () => {
2616
- this.ui.hiddenInput && (this.ui.hiddenInput.value = this.getNumber()), this.ui.hiddenInputCountry && (this.ui.hiddenInputCountry.value = this.selectedCountryData.iso2 || "");
2617
- };
2618
- (e = this.ui.telInput.form) == null || e.addEventListener("submit", t, {
2619
- signal: this.abortController.signal
2620
- });
2621
- }
2622
- //* initialise the dropdown listeners.
2623
- _initDropdownListeners() {
2624
- const t = this.abortController.signal, e = (n) => {
2625
- this.ui.dropdownContent.classList.contains(h.HIDE) ? this.ui.telInput.focus() : n.preventDefault();
2626
- }, i = this.ui.telInput.closest("label");
2627
- i && i.addEventListener("click", e, { signal: t });
2628
- const s = () => {
2629
- this.ui.dropdownContent.classList.contains(
2630
- h.HIDE
2631
- ) && !this.ui.telInput.disabled && !this.ui.telInput.readOnly && this._openDropdown();
2632
- };
2633
- this.ui.selectedCountry.addEventListener(
2634
- "click",
2635
- s,
2636
- {
2637
- signal: t
2638
- }
2639
- );
2640
- const o = (n) => {
2641
- this.ui.dropdownContent.classList.contains(
2642
- h.HIDE
2643
- ) && [_.ARROW_UP, _.ARROW_DOWN, _.SPACE, _.ENTER].includes(n.key) && (n.preventDefault(), n.stopPropagation(), this._openDropdown()), n.key === _.TAB && this._closeDropdown();
2644
- };
2645
- this.ui.countryContainer.addEventListener(
2646
- "keydown",
2647
- o,
2648
- { signal: t }
2649
- );
2650
- }
2651
- //* Init many requests: utils script / geo ip lookup.
2652
- _initRequests() {
2653
- const { loadUtils: t, initialCountry: e, geoIpLookup: i } = this.options;
2654
- if (t && !u.utils) {
2655
- const o = () => {
2656
- var n;
2657
- (n = u.attachUtils(t)) == null || n.catch(() => {
2658
- });
2659
- };
2660
- if (u.documentReady())
2661
- o();
2662
- else {
2663
- const n = () => {
2664
- o();
2665
- };
2666
- window.addEventListener("load", n, {
2667
- signal: this.abortController.signal
2668
- });
2669
- }
2670
- } else
2671
- this.resolveUtilsScriptPromise();
2672
- e === M.AUTO && i && !this.selectedCountryData.iso2 ? this._loadAutoCountry() : this.resolveAutoCountryPromise();
2673
- }
2674
- //* Perform the geo ip lookup.
2675
- _loadAutoCountry() {
2676
- u.autoCountry ? this.handleAutoCountry() : u.startedLoadingAutoCountry || (u.startedLoadingAutoCountry = !0, typeof this.options.geoIpLookup == "function" && this.options.geoIpLookup(
2677
- (t = "") => {
2678
- const e = t.toLowerCase();
2679
- B(e) ? (u.autoCountry = e, setTimeout(() => S("handleAutoCountry"))) : (this._setInitialState(!0), S("rejectAutoCountryPromise"));
2680
- },
2681
- () => {
2682
- this._setInitialState(!0), S("rejectAutoCountryPromise");
2683
- }
2684
- ));
2685
- }
2686
- _openDropdownWithPlus() {
2687
- this._openDropdown(), this.ui.searchInput.value = "+", this._filterCountriesByQuery("");
2688
- }
2689
- //* Initialize the tel input listeners.
2690
- _initTelInputListeners() {
2691
- this._bindInputListener(), this._maybeBindKeydownListener(), this._maybeBindPasteListener();
2692
- }
2693
- _bindInputListener() {
2694
- const {
2695
- strictMode: t,
2696
- formatAsYouType: e,
2697
- separateDialCode: i,
2698
- allowDropdown: s,
2699
- countrySearch: o
2700
- } = this.options;
2701
- let n = !1;
2702
- E.ALPHA_UNICODE.test(this._getTelInputValue()) && (n = !0);
2703
- const r = (a) => {
2704
- const d = this._getTelInputValue();
2705
- if (this.isAndroid && (a == null ? void 0 : a.data) === "+" && i && s && o) {
2706
- const y = this.ui.telInput.selectionStart || 0, I = d.substring(0, y - 1), N = d.substring(y);
2707
- this._setTelInputValue(I + N), this._openDropdownWithPlus();
2708
- return;
2709
- }
2710
- this._updateCountryFromNumber(d) && this._triggerCountryChange();
2711
- const c = (a == null ? void 0 : a.data) && E.NON_PLUS_NUMERIC.test(a.data), p = (a == null ? void 0 : a.inputType) === F.PASTE && d;
2712
- c || p && !t ? n = !0 : E.NON_PLUS_NUMERIC.test(d) || (n = !1);
2713
- const b = (a == null ? void 0 : a.detail) && a.detail.isSetNumber, C = this.userNumeralSet === "ascii";
2714
- if (e && !n && !b && C) {
2715
- const y = this.ui.telInput.selectionStart || 0, N = d.substring(
2716
- 0,
2717
- y
2718
- ).replace(
2719
- E.NON_PLUS_NUMERIC_GLOBAL,
2720
- ""
2721
- ).length, D = (a == null ? void 0 : a.inputType) === F.DELETE_FWD, g = this._getFullNumber(), L = Dt(
2722
- g,
2723
- d,
2724
- u.utils,
2725
- this.selectedCountryData,
2726
- this.options.separateDialCode
2727
- ), w = Lt(
2728
- N,
2729
- L,
2730
- y,
2731
- D
2732
- );
2733
- this._setTelInputValue(L), this.ui.telInput.setSelectionRange(w, w);
2734
- }
2735
- };
2736
- this.ui.telInput.addEventListener(
2737
- "input",
2738
- r,
2739
- {
2740
- signal: this.abortController.signal
2741
- }
2742
- );
2743
- }
2744
- _maybeBindKeydownListener() {
2745
- const { strictMode: t, separateDialCode: e, allowDropdown: i, countrySearch: s } = this.options;
2746
- if (t || e) {
2747
- const o = (n) => {
2748
- if (n.key && n.key.length === 1 && !n.altKey && !n.ctrlKey && !n.metaKey) {
2749
- if (e && i && s && n.key === "+") {
2750
- n.preventDefault(), this._openDropdownWithPlus();
2751
- return;
2752
- }
2753
- if (t) {
2754
- const r = this._getTelInputValue(), d = !r.startsWith("+") && this.ui.telInput.selectionStart === 0 && n.key === "+", c = this._normaliseNumerals(n.key), p = /^[0-9]$/.test(c), b = e ? p : d || p, C = this.ui.telInput, y = C.selectionStart, I = C.selectionEnd, N = r.slice(0, y), D = r.slice(I), g = N + n.key + D, L = this._getFullNumber(g), w = u.utils.getCoreNumber(
2755
- L,
2756
- this.selectedCountryData.iso2
2757
- ), P = this.maxCoreNumberLength && w.length > this.maxCoreNumberLength, X = this._getNewCountryFromNumber(L) !== null;
2758
- (!b || P && !X && !d) && n.preventDefault();
2759
- }
2760
- }
2761
- };
2762
- this.ui.telInput.addEventListener("keydown", o, {
2763
- signal: this.abortController.signal
2764
- });
2765
- }
2766
- }
2767
- _maybeBindPasteListener() {
2768
- if (this.options.strictMode) {
2769
- const t = (e) => {
2770
- e.preventDefault();
2771
- const i = this.ui.telInput, s = i.selectionStart, o = i.selectionEnd, n = this._getTelInputValue(), r = n.slice(0, s), a = n.slice(o), d = this.selectedCountryData.iso2, c = e.clipboardData.getData("text"), p = this._normaliseNumerals(c), b = s === 0 && o > 0, C = !n.startsWith("+") || b, y = p.replace(E.NON_PLUS_NUMERIC_GLOBAL, ""), I = y.startsWith("+"), N = y.replace(/\+/g, ""), D = I && C ? `+${N}` : N;
2772
- let g = r + D + a;
2773
- if (g.length > 5) {
2774
- let w = u.utils.getCoreNumber(g, d);
2775
- for (; w.length === 0 && g.length > 0; )
2776
- g = g.slice(0, -1), w = u.utils.getCoreNumber(g, d);
2777
- if (!w)
2778
- return;
2779
- if (this.maxCoreNumberLength && w.length > this.maxCoreNumberLength)
2780
- if (i.selectionEnd === n.length) {
2781
- const P = w.length - this.maxCoreNumberLength;
2782
- g = g.slice(0, g.length - P);
2783
- } else
2784
- return;
2785
- }
2786
- this._setTelInputValue(g);
2787
- const L = s + D.length;
2788
- i.setSelectionRange(L, L), i.dispatchEvent(new InputEvent("input", { bubbles: !0 }));
2789
- };
2790
- this.ui.telInput.addEventListener("paste", t, {
2791
- signal: this.abortController.signal
2792
- });
2793
- }
2794
- }
2795
- //* Adhere to the input's maxlength attr.
2796
- _cap(t) {
2797
- const e = Number(this.ui.telInput.getAttribute("maxlength"));
2798
- return e && t.length > e ? t.substring(0, e) : t;
2799
- }
2800
- //* Trigger a custom event on the input (typed via ItiEventMap).
2801
- _trigger(t, e = {}) {
2802
- const i = new CustomEvent(t, {
2803
- bubbles: !0,
2804
- cancelable: !0,
2805
- detail: e
2806
- });
2807
- this.ui.telInput.dispatchEvent(i);
2808
- }
2809
- //* Open the dropdown.
2810
- _openDropdown() {
2811
- const { fixDropdownWidth: t, countrySearch: e } = this.options;
2812
- if (this.dropdownAbortController = new AbortController(), t && (this.ui.dropdownContent.style.width = `${this.ui.telInput.offsetWidth}px`), this.ui.dropdownContent.classList.remove(h.HIDE), this.ui.selectedCountry.setAttribute(m.EXPANDED, "true"), this._setDropdownPosition(), e) {
2813
- const i = this.ui.countryList.firstElementChild;
2814
- i && (this.ui.highlightListItem(i, !1), this.ui.countryList.scrollTop = 0), this.ui.searchInput.focus();
2815
- }
2816
- this._bindDropdownListeners(), this.ui.dropdownArrow.classList.add(h.ARROW_UP), this._trigger(T.OPEN_COUNTRY_DROPDOWN);
2817
- }
2818
- //* Set the dropdown position
2819
- _setDropdownPosition() {
2820
- if (this.options.dropdownContainer && this.options.dropdownContainer.appendChild(this.ui.dropdown), !this.options.useFullscreenPopup) {
2821
- const t = this.ui.telInput.getBoundingClientRect(), e = this.ui.telInput.offsetHeight;
2822
- if (this.options.dropdownContainer) {
2823
- this.ui.dropdown.style.top = `${t.top + e}px`, this.ui.dropdown.style.left = `${t.left}px`;
2824
- const i = () => this._closeDropdown();
2825
- window.addEventListener("scroll", i, {
2826
- signal: this.dropdownAbortController.signal
2827
- });
2828
- }
2829
- }
2830
- }
2831
- //* We only bind dropdown listeners when the dropdown is open.
2832
- _bindDropdownListeners() {
2833
- const t = this.dropdownAbortController.signal;
2834
- this._bindDropdownMouseoverListener(t), this._bindDropdownCountryClickListener(t), this._bindDropdownClickOffListener(t), this._bindDropdownKeydownListener(t), this.options.countrySearch && this._bindDropdownSearchListeners(t);
2835
- }
2836
- //* When mouse over a list item, just highlight that one
2837
- //* we add the class "highlight", so if they hit "enter" we know which one to select.
2838
- _bindDropdownMouseoverListener(t) {
2839
- const e = (i) => {
2840
- var o;
2841
- const s = (o = i.target) == null ? void 0 : o.closest(
2842
- `.${h.COUNTRY_ITEM}`
2843
- );
2844
- s && this.ui.highlightListItem(s, !1);
2845
- };
2846
- this.ui.countryList.addEventListener(
2847
- "mouseover",
2848
- e,
2849
- {
2850
- signal: t
2851
- }
2852
- );
2853
- }
2854
- //* Listen for country selection.
2855
- _bindDropdownCountryClickListener(t) {
2856
- const e = (i) => {
2857
- var o;
2858
- const s = (o = i.target) == null ? void 0 : o.closest(
2859
- `.${h.COUNTRY_ITEM}`
2860
- );
2861
- s && this._selectListItem(s);
2862
- };
2863
- this.ui.countryList.addEventListener("click", e, {
2864
- signal: t
2865
- });
2866
- }
2867
- //* Click off to close (except when this initial opening click is bubbling up).
2868
- //* We cannot just stopPropagation as it may be needed to close another instance.
2869
- _bindDropdownClickOffListener(t) {
2870
- const e = (i) => {
2871
- !!i.target.closest(
2872
- `#iti-${this.id}__dropdown-content`
2873
- ) || this._closeDropdown();
2874
- };
2875
- setTimeout(() => {
2876
- document.documentElement.addEventListener(
2877
- "click",
2878
- e,
2879
- { signal: t }
2880
- );
2881
- }, 0);
2882
- }
2883
- //* Listen for up/down scrolling, enter to select, or escape to close.
2884
- //* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
2885
- //* just hit down and hold it to scroll down (no keyup event).
2886
- //* Listen on the document because that's where key events are triggered if no input has focus.
2887
- _bindDropdownKeydownListener(t) {
2888
- let e = "", i = null;
2889
- const s = (o) => {
2890
- [
2891
- _.ARROW_UP,
2892
- _.ARROW_DOWN,
2893
- _.ENTER,
2894
- _.ESC
2895
- ].includes(o.key) && (o.preventDefault(), o.stopPropagation(), o.key === _.ARROW_UP || o.key === _.ARROW_DOWN ? this._handleUpDownKey(o.key) : o.key === _.ENTER ? this._handleEnterKey() : o.key === _.ESC && (this._closeDropdown(), this.ui.selectedCountry.focus())), !this.options.countrySearch && E.HIDDEN_SEARCH_CHAR.test(o.key) && (o.stopPropagation(), i && clearTimeout(i), e += o.key.toLowerCase(), this._searchForCountry(e), i = setTimeout(() => {
2896
- e = "";
2897
- }, ut.HIDDEN_SEARCH_RESET_MS));
2898
- };
2899
- document.addEventListener("keydown", s, { signal: t });
2900
- }
2901
- //* Search input listeners when countrySearch enabled.
2902
- _bindDropdownSearchListeners(t) {
2903
- const e = () => {
2904
- const n = this.ui.searchInput.value.trim();
2905
- this._filterCountriesByQuery(n), this.ui.searchInput.value ? this.ui.searchClearButton.classList.remove(h.HIDE) : this.ui.searchClearButton.classList.add(h.HIDE);
2906
- };
2907
- let i = null;
2908
- const s = () => {
2909
- i && clearTimeout(i), i = setTimeout(() => {
2910
- e(), i = null;
2911
- }, 100);
2912
- };
2913
- this.ui.searchInput.addEventListener("input", s, {
2914
- signal: t
2915
- });
2916
- const o = () => {
2917
- this.ui.searchInput.value = "", this.ui.searchInput.focus(), e();
2918
- };
2919
- this.ui.searchClearButton.addEventListener("click", o, {
2920
- signal: t
2921
- });
2922
- }
2923
- //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
2924
- _searchForCountry(t) {
2925
- const e = Ct(this.countries, t);
2926
- if (e) {
2927
- const i = e.nodeById[this.id];
2928
- this.ui.highlightListItem(i, !1), this.ui.scrollTo(i);
2929
- }
2930
- }
2931
- //* Country search: Filter the countries according to the search query.
2932
- _filterCountriesByQuery(t) {
2933
- let e;
2934
- t === "" ? e = this.countries : e = pt(this.countries, t), this.ui.filterCountries(e);
2935
- }
2936
- //* Highlight the next/prev item in the list (and ensure it is visible).
2937
- _handleUpDownKey(t) {
2938
- var i, s;
2939
- let e = t === _.ARROW_UP ? (i = this.ui.highlightedItem) == null ? void 0 : i.previousElementSibling : (s = this.ui.highlightedItem) == null ? void 0 : s.nextElementSibling;
2940
- !e && this.ui.countryList.childElementCount > 1 && (e = t === _.ARROW_UP ? this.ui.countryList.lastElementChild : this.ui.countryList.firstElementChild), e && (this.ui.scrollTo(e), this.ui.highlightListItem(e, !1));
2941
- }
2942
- //* Select the currently highlighted item.
2943
- _handleEnterKey() {
2944
- this.ui.highlightedItem && this._selectListItem(this.ui.highlightedItem);
2945
- }
2946
- //* Update the input's value to the given val (format first if possible)
2947
- //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
2948
- _updateValFromNumber(t) {
2949
- let e = t;
2950
- if (this.options.formatOnDisplay && u.utils && this.selectedCountryData) {
2951
- const i = this.options.nationalMode || !e.startsWith("+") && !this.options.separateDialCode, { NATIONAL: s, INTERNATIONAL: o } = u.utils.numberFormat, n = i ? s : o;
2952
- e = u.utils.formatNumber(
2953
- e,
2954
- this.selectedCountryData.iso2,
2955
- n
2956
- );
2957
- }
2958
- e = this._beforeSetNumber(e), this._setTelInputValue(e);
2959
- }
2960
- //* Check if need to select a new country based on the given number
2961
- //* Note: called from _setInitialState, keyup handler, setNumber.
2962
- _updateCountryFromNumber(t) {
2963
- const e = this._getNewCountryFromNumber(t);
2964
- return e !== null ? this._setCountry(e) : !1;
2965
- }
2966
- // if there is a selected country, and the number doesn't start with a dial code, then add it
2967
- _ensureHasDialCode(t) {
2968
- const { dialCode: e, nationalPrefix: i } = this.selectedCountryData;
2969
- if (t.startsWith("+") || !e)
2970
- return t;
2971
- const n = i && t.startsWith(i) && !this.options.separateDialCode ? t.substring(1) : t;
2972
- return `+${e}${n}`;
2973
- }
2974
- // Get the country ISO2 code from the given number
2975
- // BUT ONLY IF ITS CHANGED FROM THE CURRENTLY SELECTED COUNTRY
2976
- // NOTE: consider refactoring this to be more clear
2977
- _getNewCountryFromNumber(t) {
2978
- const e = t.indexOf("+");
2979
- let i = e ? t.substring(e) : t;
2980
- const s = this.selectedCountryData.iso2, o = this.selectedCountryData.dialCode;
2981
- i = this._ensureHasDialCode(i);
2982
- const n = this._getDialCode(i, !0), r = v(i);
2983
- if (n) {
2984
- const a = v(n), d = this.dialCodeToIso2Map[a];
2985
- if (d.length === 1)
2986
- return d[0] === s ? null : d[0];
2987
- if (!s && this.defaultCountry && d.includes(this.defaultCountry))
2988
- return this.defaultCountry;
2989
- if (o === K.NANP && z(r))
2990
- return null;
2991
- const { areaCodes: p, priority: b } = this.selectedCountryData;
2992
- if (p) {
2993
- const D = p.map(
2994
- (g) => `${o}${g}`
2995
- );
2996
- for (const g of D)
2997
- if (r.startsWith(g))
2998
- return null;
2999
- }
3000
- const y = p && !(b === 0) && r.length > a.length, I = s && d.includes(s) && !y, N = s === d[0];
3001
- if (!I && !N)
3002
- return d[0];
3003
- } else if (i.startsWith("+") && r.length) {
3004
- const a = this.selectedCountryData.dialCode || "";
3005
- return a && a.startsWith(r) ? null : "";
3006
- } else if ((!i || i === "+") && !s)
3007
- return this.defaultCountry;
3008
- return null;
3009
- }
3010
- //* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
3011
- //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
3012
- _setCountry(t) {
3013
- const { separateDialCode: e, showFlags: i, i18n: s, allowDropdown: o } = this.options, n = this.selectedCountryData.iso2 || "";
3014
- if (o && this.ui.updateSelectedItem(t), this.selectedCountryData = t ? this.countryByIso2.get(t) : {}, this.selectedCountryData.iso2 && (this.defaultCountry = this.selectedCountryData.iso2), this.ui.selectedCountry) {
3015
- const r = t && i ? `${h.FLAG} iti__${t}` : `${h.FLAG} ${h.GLOBE}`;
3016
- let a, d;
3017
- if (t) {
3018
- const { name: c, dialCode: p } = this.selectedCountryData;
3019
- d = c, a = s.selectedCountryAriaLabel.replace("${countryName}", c).replace("${dialCode}", `+${p}`);
3020
- } else
3021
- d = s.noCountrySelected, a = s.noCountrySelected;
3022
- this.ui.selectedCountryInner.className = r, this.ui.selectedCountry.setAttribute("title", d), this.ui.selectedCountry.setAttribute(m.LABEL, a);
3023
- }
3024
- if (e) {
3025
- const r = this.selectedCountryData.dialCode ? `+${this.selectedCountryData.dialCode}` : "";
3026
- this.ui.selectedDialCode.textContent = r, this.ui.updateInputPadding();
3027
- }
3028
- return this._updatePlaceholder(), this._updateMaxLength(), n !== t;
3029
- }
3030
- //* Update the maximum valid number length for the currently selected country.
3031
- _updateMaxLength() {
3032
- const { strictMode: t, placeholderNumberType: e, validationNumberTypes: i } = this.options, { iso2: s } = this.selectedCountryData;
3033
- if (t && u.utils)
3034
- if (s) {
3035
- const o = u.utils.numberType[e];
3036
- let n = u.utils.getExampleNumber(
3037
- s,
3038
- !1,
3039
- o,
3040
- !0
3041
- ), r = n;
3042
- for (; u.utils.isPossibleNumber(
3043
- n,
3044
- s,
3045
- i
3046
- ); )
3047
- r = n, n += "0";
3048
- const a = u.utils.getCoreNumber(r, s);
3049
- this.maxCoreNumberLength = a.length, s === "by" && (this.maxCoreNumberLength = a.length + 1);
3050
- } else
3051
- this.maxCoreNumberLength = null;
3052
- }
3053
- //* Update the input placeholder to an example number from the currently selected country.
3054
- _updatePlaceholder() {
3055
- const {
3056
- autoPlaceholder: t,
3057
- placeholderNumberType: e,
3058
- nationalMode: i,
3059
- customPlaceholder: s
3060
- } = this.options, o = t === H.AGGRESSIVE || !this.ui.hadInitialPlaceholder && t === H.POLITE;
3061
- if (u.utils && o) {
3062
- const n = u.utils.numberType[e];
3063
- let r = this.selectedCountryData.iso2 ? u.utils.getExampleNumber(
3064
- this.selectedCountryData.iso2,
3065
- i,
3066
- n
3067
- ) : "";
3068
- r = this._beforeSetNumber(r), typeof s == "function" && (r = s(r, this.selectedCountryData)), this.ui.telInput.setAttribute("placeholder", r);
3069
- }
3070
- }
3071
- //* Called when the user selects a list item from the dropdown.
3072
- _selectListItem(t) {
3073
- const e = t.dataset[G.COUNTRY_CODE], i = this._setCountry(e);
3074
- this._closeDropdown();
3075
- const s = t.dataset[G.DIAL_CODE];
3076
- if (this._updateDialCode(s), this.options.formatOnDisplay) {
3077
- const o = this._getTelInputValue();
3078
- this._updateValFromNumber(o);
3079
- }
3080
- this.ui.telInput.focus(), i && this._triggerCountryChange();
3081
- }
3082
- //* Close the dropdown and unbind any listeners.
3083
- _closeDropdown() {
3084
- this.ui.dropdownContent.classList.contains(h.HIDE) || (this.ui.dropdownContent.classList.add(h.HIDE), this.ui.selectedCountry.setAttribute(m.EXPANDED, "false"), this.options.countrySearch && (this.ui.searchInput.removeAttribute(m.ACTIVE_DESCENDANT), this.ui.highlightedItem && (this.ui.highlightedItem.classList.remove(h.HIGHLIGHT), this.ui.highlightedItem = null)), this.ui.dropdownArrow.classList.remove(h.ARROW_UP), this.dropdownAbortController.abort(), this.dropdownAbortController = null, this.options.dropdownContainer && this.ui.dropdown.remove(), this._trigger(T.CLOSE_COUNTRY_DROPDOWN));
3085
- }
3086
- //* Replace any existing dial code with the new one
3087
- //* Note: called from _selectListItem and setCountry
3088
- _updateDialCode(t) {
3089
- const e = this._getTelInputValue(), i = `+${t}`;
3090
- let s;
3091
- if (e.startsWith("+")) {
3092
- const o = this._getDialCode(e);
3093
- o ? s = e.replace(o, i) : s = i, this._setTelInputValue(s);
3094
- }
3095
- }
3096
- //* Try and extract a valid international dial code from a full telephone number.
3097
- //* Note: returns the raw string inc plus character and any whitespace/dots etc.
3098
- _getDialCode(t, e) {
3099
- let i = "";
3100
- if (t.startsWith("+")) {
3101
- let s = "", o = !1;
3102
- for (let n = 0; n < t.length; n++) {
3103
- const r = t.charAt(n);
3104
- if (/[0-9]/.test(r)) {
3105
- if (s += r, !!!this.dialCodeToIso2Map[s])
3106
- break;
3107
- if (this.dialCodes.has(s)) {
3108
- if (i = t.substring(0, n + 1), o = !0, !e)
3109
- break;
3110
- } else e && o && (i = t.substring(0, n + 1));
3111
- if (s.length === this.dialCodeMaxLen)
3112
- break;
3113
- }
3114
- }
3115
- }
3116
- return i;
3117
- }
3118
- //* Get the input val, adding the dial code if separateDialCode is enabled.
3119
- _getFullNumber(t) {
3120
- const e = t ? this._normaliseNumerals(t) : this._getTelInputValue(), { dialCode: i } = this.selectedCountryData;
3121
- let s;
3122
- const o = v(e);
3123
- return this.options.separateDialCode && !e.startsWith("+") && i && o ? s = `+${i}` : s = "", s + e;
3124
- }
3125
- //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
3126
- _beforeSetNumber(t) {
3127
- const e = this._getDialCode(t), i = wt(
3128
- t,
3129
- e,
3130
- this.options.separateDialCode,
3131
- this.selectedCountryData
3132
- );
3133
- return this._cap(i);
3134
- }
3135
- //* Trigger the 'countrychange' event.
3136
- _triggerCountryChange() {
3137
- this._trigger(T.COUNTRY_CHANGE);
3138
- }
3139
- //**************************
3140
- //* SECRET PUBLIC METHODS
3141
- //**************************
3142
- //* This is called when the geoip call returns.
3143
- handleAutoCountry() {
3144
- this.options.initialCountry === M.AUTO && u.autoCountry && (this.defaultCountry = u.autoCountry, this.selectedCountryData.iso2 || this.ui.selectedCountryInner.classList.contains(h.GLOBE) || this.setCountry(this.defaultCountry), this.resolveAutoCountryPromise());
3145
- }
3146
- //* This is called when the utils request completes.
3147
- handleUtils() {
3148
- if (u.utils) {
3149
- const t = this._getTelInputValue();
3150
- t && this._updateValFromNumber(t), this.selectedCountryData.iso2 && (this._updatePlaceholder(), this._updateMaxLength());
3151
- }
3152
- this.resolveUtilsScriptPromise();
3153
- }
3154
- //********************
3155
- //* PUBLIC METHODS
3156
- //********************
3157
- //* Remove plugin.
3158
- destroy() {
3159
- this.ui.telInput && (this.options.allowDropdown && this._closeDropdown(), this.abortController.abort(), this.abortController = null, this.ui.destroy(), u.instances instanceof Map ? u.instances.delete(this.id) : delete u.instances[this.id]);
3160
- }
3161
- //* Get the extension from the current number.
3162
- getExtension() {
3163
- return u.utils ? u.utils.getExtension(
3164
- this._getFullNumber(),
3165
- this.selectedCountryData.iso2
3166
- ) : "";
3167
- }
3168
- //* Format the number to the given format.
3169
- getNumber(t) {
3170
- if (u.utils) {
3171
- const { iso2: e } = this.selectedCountryData, i = this._getFullNumber(), s = u.utils.formatNumber(
3172
- i,
3173
- e,
3174
- t
3175
- );
3176
- return this._mapAsciiToUserNumerals(s);
3177
- }
3178
- return "";
3179
- }
3180
- //* Get the type of the entered number e.g. landline/mobile.
3181
- getNumberType() {
3182
- return u.utils ? u.utils.getNumberType(
3183
- this._getFullNumber(),
3184
- this.selectedCountryData.iso2
3185
- ) : $.UNKNOWN_NUMBER_TYPE;
3186
- }
3187
- //* Get the country data for the currently selected country.
3188
- getSelectedCountryData() {
3189
- return this.selectedCountryData;
3190
- }
3191
- //* Get the validation error.
3192
- getValidationError() {
3193
- if (u.utils) {
3194
- const { iso2: t } = this.selectedCountryData;
3195
- return u.utils.getValidationError(this._getFullNumber(), t);
3196
- }
3197
- return $.UNKNOWN_VALIDATION_ERROR;
3198
- }
3199
- //* Validate the input val using number length only
3200
- isValidNumber() {
3201
- const { dialCode: t, iso2: e } = this.selectedCountryData;
3202
- if (t === k.DIAL_CODE && u.utils) {
3203
- const i = this._getFullNumber(), s = u.utils.getCoreNumber(i, e);
3204
- if (s[0] === k.MOBILE_PREFIX && s.length !== k.MOBILE_CORE_LENGTH)
3205
- return !1;
3206
- }
3207
- return this._validateNumber(!1);
3208
- }
3209
- //* Validate the input val with precise validation
3210
- isValidNumberPrecise() {
3211
- return this._validateNumber(!0);
3212
- }
3213
- _utilsIsPossibleNumber(t) {
3214
- return u.utils ? u.utils.isPossibleNumber(
3215
- t,
3216
- this.selectedCountryData.iso2,
3217
- this.options.validationNumberTypes
3218
- ) : null;
3219
- }
3220
- //* Shared internal validation logic to handle alpha character extension rules.
3221
- _validateNumber(t) {
3222
- if (!u.utils)
3223
- return null;
3224
- if (!this.selectedCountryData.iso2)
3225
- return !1;
3226
- const e = (n) => t ? this._utilsIsValidNumber(n) : this._utilsIsPossibleNumber(n), i = this._getFullNumber(), s = i.search(E.ALPHA_UNICODE);
3227
- if (s > -1 && !this.options.allowPhonewords) {
3228
- const n = i.substring(0, s), r = e(n), a = e(i);
3229
- return r && a;
3230
- }
3231
- return e(i);
3232
- }
3233
- _utilsIsValidNumber(t) {
3234
- return u.utils ? u.utils.isValidNumber(
3235
- t,
3236
- this.selectedCountryData.iso2,
3237
- this.options.validationNumberTypes
3238
- ) : null;
3239
- }
3240
- //* Update the selected country, and update the input val accordingly.
3241
- setCountry(t) {
3242
- const e = t == null ? void 0 : t.toLowerCase();
3243
- if (!B(e))
3244
- throw new Error(`Invalid country code: '${e}'`);
3245
- const i = this.selectedCountryData.iso2;
3246
- if (t && e !== i || !t && i) {
3247
- if (this._setCountry(e), this._updateDialCode(this.selectedCountryData.dialCode), this.options.formatOnDisplay) {
3248
- const o = this._getTelInputValue();
3249
- this._updateValFromNumber(o);
3250
- }
3251
- this._triggerCountryChange();
3252
- }
3253
- }
3254
- //* Set the input value and update the country.
3255
- setNumber(t) {
3256
- const e = this._normaliseNumerals(t), i = this._updateCountryFromNumber(e);
3257
- this._updateValFromNumber(e), i && this._triggerCountryChange(), this._trigger(T.INPUT, { isSetNumber: !0 });
3258
- }
3259
- //* Set the placeholder number typ
3260
- setPlaceholderNumberType(t) {
3261
- this.options.placeholderNumberType = t, this._updatePlaceholder();
3262
- }
3263
- setDisabled(t) {
3264
- this.ui.telInput.disabled = t, t ? this.ui.selectedCountry.setAttribute("disabled", "true") : this.ui.selectedCountry.removeAttribute("disabled");
3265
- }
3266
- }
3267
- const Tt = (l) => {
3268
- if (!u.utils && !u.startedLoadingUtilsScript) {
3269
- let t;
3270
- if (typeof l == "function")
3271
- try {
3272
- t = Promise.resolve(l());
3273
- } catch (e) {
3274
- return Promise.reject(e);
3275
- }
3276
- else
3277
- return Promise.reject(
3278
- new TypeError(
3279
- `The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof l}`
3280
- )
3281
- );
3282
- return u.startedLoadingUtilsScript = !0, t.then((e) => {
3283
- const i = e == null ? void 0 : e.default;
3284
- if (!i || typeof i != "object")
3285
- throw new TypeError(
3286
- "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
3287
- );
3288
- return u.utils = i, S("handleUtils"), !0;
3289
- }).catch((e) => {
3290
- throw S("rejectUtilsScriptPromise", e), e;
3291
- });
3292
- }
3293
- return null;
3294
- }, S = (l, ...t) => {
3295
- Object.values(u.instances).forEach((e) => {
3296
- const i = e[l];
3297
- typeof i == "function" && i.apply(e, t);
3298
- });
3299
- }, u = Object.assign(
3300
- (l, t) => {
3301
- const e = new V(l, t);
3302
- return u.instances[e.id] = e, l.iti = e, e;
3303
- },
3304
- {
3305
- defaults: Y,
3306
- //* Using a static var like this allows us to mock it in the tests.
3307
- documentReady: () => document.readyState === "complete",
3308
- //* Get the country data object.
3309
- getCountryData: () => A,
3310
- //* A getter for the plugin instance.
3311
- getInstance: (l) => {
3312
- const t = l.dataset.intlTelInputId;
3313
- return t ? u.instances[t] : null;
3314
- },
3315
- //* A map from instance ID to instance object.
3316
- instances: {},
3317
- attachUtils: Tt,
3318
- startedLoadingUtilsScript: !1,
3319
- startedLoadingAutoCountry: !1,
3320
- version: "25.15.0"
3321
- }
3322
- ), Ot = {
3323
- __name: "IntlTelInput",
3324
- props: /* @__PURE__ */ W({
3325
- disabled: {
3326
- type: Boolean,
3327
- default: !1
3328
- },
3329
- inputProps: {
3330
- type: Object,
3331
- default: () => ({})
3332
- },
3333
- options: {
3334
- type: Object,
3335
- default: () => ({})
3336
- },
3337
- value: {
3338
- type: String,
3339
- default: ""
3340
- }
3341
- }, {
3342
- modelValue: {
3343
- type: String,
3344
- default: ""
3345
- },
3346
- modelModifiers: {}
3347
- }),
3348
- emits: /* @__PURE__ */ W([
3349
- "changeNumber",
3350
- "changeCountry",
3351
- "changeValidity",
3352
- "changeErrorCode"
3353
- ], ["update:modelValue"]),
3354
- setup(l, { expose: t, emit: e }) {
3355
- const i = Q(l, "modelValue"), s = l, o = e, n = O(), r = O(), a = O(!1), d = () => r.value ? s.options.strictMode ? r.value.isValidNumberPrecise() : r.value.isValidNumber() : null, c = () => {
3356
- let C = d();
3357
- a.value !== C && (a.value = C, o("changeValidity", !!C), o(
3358
- "changeErrorCode",
3359
- C ? null : r.value.getValidationError()
3360
- ));
3361
- }, p = () => {
3362
- var C;
3363
- o("changeNumber", ((C = r.value) == null ? void 0 : C.getNumber()) ?? ""), c();
3364
- }, b = () => {
3365
- var C;
3366
- o("changeCountry", ((C = r.value) == null ? void 0 : C.getSelectedCountryData().iso2) ?? ""), p(), c();
3367
- };
3368
- return J(() => {
3369
- n.value && (r.value = u(n.value, s.options), s.value && r.value.setNumber(s.value), s.disabled && r.value.setDisabled(s.disabled), a.value = d());
3370
- }), Z(
3371
- () => s.disabled,
3372
- (C) => {
3373
- var y;
3374
- return (y = r.value) == null ? void 0 : y.setDisabled(C);
3375
- }
3376
- ), tt(() => {
3377
- var C;
3378
- return (C = r.value) == null ? void 0 : C.destroy();
3379
- }), t({ instance: r, input: n }), (C, y) => et((st(), it("input", nt({
3380
- ref_key: "input",
3381
- ref: n,
3382
- "onUpdate:modelValue": y[0] || (y[0] = (I) => i.value = I),
3383
- type: "tel",
3384
- onCountrychange: b,
3385
- onInput: p
3386
- }, l.inputProps), null, 16)), [
3387
- [
3388
- ot,
3389
- i.value,
3390
- void 0,
3391
- { lazy: !0 }
3392
- ]
3393
- ]);
3394
- }
3395
- };
3396
- export {
3397
- Ot as default
3398
- };