@salla.sa/twilight-components 2.14.525 → 2.14.526

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 (355) hide show
  1. package/dist/cjs/{filepond-ByG3dm7V.js → filepond-dCwl_WGS.js} +1 -1
  2. package/dist/cjs/{filepond-plugin-file-poster-HrlEnAMv.js → filepond-plugin-file-poster-JE47euyP.js} +1 -1
  3. package/dist/cjs/{filepond-plugin-file-validate-size-CQ3A10EP.js → filepond-plugin-file-validate-size-CFbzBG_a.js} +1 -1
  4. package/dist/cjs/{filepond-plugin-file-validate-type-Dc9po32n.js → filepond-plugin-file-validate-type-B95BRuZd.js} +1 -1
  5. package/dist/cjs/{filepond-plugin-image-edit-CxnbovZA.js → filepond-plugin-image-edit-QbQgAOte.js} +1 -1
  6. package/dist/cjs/{filepond-plugin-image-exif-orientation-BiZSj8QH.js → filepond-plugin-image-exif-orientation-C3KRxOCO.js} +1 -1
  7. package/dist/cjs/{filepond-plugin-image-preview-Ca4Gfes-.js → filepond-plugin-image-preview-Bg5kON16.js} +1 -1
  8. package/dist/cjs/{functions-Eg2GfamO.js → functions-DI3Yp4Of.js} +1 -1
  9. package/dist/cjs/{index-_SuY2Qj7.js → index-CL2v3rWe.js} +2 -2
  10. package/dist/cjs/intlTelInput-BhGMuXpz.js +4449 -0
  11. package/dist/cjs/loader.cjs.js +2 -2
  12. package/dist/cjs/salla-accordion-body_2.cjs.entry.js +1 -1
  13. package/dist/cjs/salla-accordion_6.cjs.entry.js +1 -1
  14. package/dist/cjs/salla-add-product-button_5.cjs.entry.js +24 -6
  15. package/dist/cjs/salla-advertisement.cjs.entry.js +1 -1
  16. package/dist/cjs/salla-alert_2.cjs.entry.js +1 -1
  17. package/dist/cjs/salla-app-install-alert.cjs.entry.js +1 -1
  18. package/dist/cjs/salla-apps-icons.cjs.entry.js +1 -1
  19. package/dist/cjs/salla-badge.cjs.entry.js +1 -1
  20. package/dist/cjs/salla-basket-gap.cjs.entry.js +1 -1
  21. package/dist/cjs/salla-booking-field_7.cjs.entry.js +32 -16
  22. package/dist/cjs/salla-bullet-delivery_2.cjs.entry.js +82 -7
  23. package/dist/cjs/salla-cart-coupons.cjs.entry.js +1 -1
  24. package/dist/cjs/salla-cart-item-offers_2.cjs.entry.js +1 -1
  25. package/dist/cjs/salla-cart-summary-card.cjs.entry.js +1 -1
  26. package/dist/cjs/salla-cashback-banner.cjs.entry.js +1 -1
  27. package/dist/cjs/salla-comment-factors.cjs.entry.js +1 -1
  28. package/dist/cjs/salla-comment-form_8.cjs.entry.js +1 -1
  29. package/dist/cjs/salla-conditional-offer.cjs.entry.js +1 -1
  30. package/dist/cjs/salla-contacts.cjs.entry.js +1 -1
  31. package/dist/cjs/salla-cookies-bar.cjs.entry.js +1 -1
  32. package/dist/cjs/salla-count-down_2.cjs.entry.js +1 -1
  33. package/dist/cjs/salla-custom-fields.cjs.entry.js +1 -1
  34. package/dist/cjs/salla-delivery-promise.cjs.entry.js +1 -1
  35. package/dist/cjs/salla-edit-order-button.cjs.entry.js +1 -1
  36. package/dist/cjs/salla-filters-widget.cjs.entry.js +1 -1
  37. package/dist/cjs/salla-filters.cjs.entry.js +1 -1
  38. package/dist/cjs/salla-fulfillment-methods.cjs.entry.js +1 -1
  39. package/dist/cjs/salla-gifting.cjs.entry.js +1 -1
  40. package/dist/cjs/salla-hook.cjs.entry.js +1 -1
  41. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +1 -1
  42. package/dist/cjs/salla-installment.cjs.entry.js +1 -1
  43. package/dist/cjs/salla-list-tile.cjs.entry.js +1 -1
  44. package/dist/cjs/salla-localization-modal.cjs.entry.js +1 -1
  45. package/dist/cjs/salla-login-modal.cjs.entry.js +1 -1
  46. package/dist/cjs/salla-loyalty-banner.cjs.entry.js +2 -2
  47. package/dist/cjs/salla-loyalty-exchange-product-card_5.cjs.entry.js +3 -3
  48. package/dist/cjs/salla-loyalty-hero_2.cjs.entry.js +2 -2
  49. package/dist/cjs/salla-loyalty-panel.cjs.entry.js +3 -3
  50. package/dist/cjs/salla-loyalty-points-banner.cjs.entry.js +1 -1
  51. package/dist/cjs/salla-loyalty-points-history.cjs.entry.js +1 -1
  52. package/dist/cjs/salla-loyalty-prize-item.cjs.entry.js +1 -1
  53. package/dist/cjs/salla-loyalty-program.cjs.entry.js +3 -3
  54. package/dist/cjs/salla-loyalty-reward.cjs.entry.js +2 -2
  55. package/dist/cjs/salla-loyalty.cjs.entry.js +1 -1
  56. package/dist/cjs/salla-maintenance-alert.cjs.entry.js +1 -1
  57. package/dist/cjs/salla-map_2.cjs.entry.js +71 -15
  58. package/dist/cjs/salla-menu.cjs.entry.js +1 -1
  59. package/dist/cjs/salla-metadata.cjs.entry.js +1 -1
  60. package/dist/cjs/salla-multiple-bundle-product-cart_2.cjs.entry.js +1 -1
  61. package/dist/cjs/salla-multiple-bundle-product-options-modal_2.cjs.entry.js +1 -1
  62. package/dist/cjs/salla-multiple-bundle-product.cjs.entry.js +1 -1
  63. package/dist/cjs/salla-next-order-coupon.cjs.entry.js +1 -1
  64. package/dist/cjs/salla-notification-item.cjs.entry.js +1 -1
  65. package/dist/cjs/salla-notifications.cjs.entry.js +1 -1
  66. package/dist/cjs/salla-offer-modal.cjs.entry.js +1 -1
  67. package/dist/cjs/salla-offer.cjs.entry.js +1 -1
  68. package/dist/cjs/salla-order-branch.cjs.entry.js +1 -1
  69. package/dist/cjs/salla-order-cancel.cjs.entry.js +1 -1
  70. package/dist/cjs/salla-order-details-multiple-bundle-product.cjs.entry.js +1 -1
  71. package/dist/cjs/salla-order-details-options.cjs.entry.js +1 -1
  72. package/dist/cjs/salla-order-details.cjs.entry.js +1 -1
  73. package/dist/cjs/salla-order-edit-item.cjs.entry.js +1 -1
  74. package/dist/cjs/salla-order-edit-product-card.cjs.entry.js +1 -1
  75. package/dist/cjs/salla-order-edit.cjs.entry.js +1 -1
  76. package/dist/cjs/salla-order-shipments.cjs.entry.js +1 -1
  77. package/dist/cjs/salla-order-summary.cjs.entry.js +1 -1
  78. package/dist/cjs/salla-order-totals-card.cjs.entry.js +1 -1
  79. package/dist/cjs/salla-orders.cjs.entry.js +1 -1
  80. package/dist/cjs/salla-payments.cjs.entry.js +1 -1
  81. package/dist/cjs/salla-placeholder.cjs.entry.js +1 -1
  82. package/dist/cjs/salla-price-range.cjs.entry.js +1 -1
  83. package/dist/cjs/salla-product-card-embed.cjs.entry.js +1 -1
  84. package/dist/cjs/salla-product-card_2.cjs.entry.js +1 -1
  85. package/dist/cjs/salla-product-size-guide.cjs.entry.js +1 -1
  86. package/dist/cjs/salla-products-list.cjs.entry.js +1 -1
  87. package/dist/cjs/salla-quick-order.cjs.entry.js +1 -1
  88. package/dist/cjs/salla-rating-modal-v2.cjs.entry.js +1 -1
  89. package/dist/cjs/salla-rating-modal.cjs.entry.js +1 -1
  90. package/dist/cjs/salla-review-factors-tags.cjs.entry.js +1 -1
  91. package/dist/cjs/salla-scopes.cjs.entry.js +1 -1
  92. package/dist/cjs/salla-search.cjs.entry.js +1 -1
  93. package/dist/cjs/salla-skeleton.cjs.entry.js +1 -1
  94. package/dist/cjs/salla-slider.cjs.entry.js +1 -1
  95. package/dist/cjs/salla-social-share.cjs.entry.js +1 -1
  96. package/dist/cjs/salla-social.cjs.entry.js +1 -1
  97. package/dist/cjs/salla-tab-content_3.cjs.entry.js +1 -1
  98. package/dist/cjs/salla-tiered-offer.cjs.entry.js +1 -1
  99. package/dist/cjs/salla-tooltip.cjs.entry.js +1 -1
  100. package/dist/cjs/salla-trust-badges.cjs.entry.js +1 -1
  101. package/dist/cjs/salla-user-menu.cjs.entry.js +1 -1
  102. package/dist/cjs/salla-user-profile.cjs.entry.js +1 -1
  103. package/dist/cjs/salla-user-settings.cjs.entry.js +1 -1
  104. package/dist/cjs/salla-verify.cjs.entry.js +1 -1
  105. package/dist/cjs/salla-wallet.cjs.entry.js +1 -1
  106. package/dist/cjs/salla-wishlist-actions.cjs.entry.js +1 -1
  107. package/dist/cjs/{tracked-promise-CykF7i94.js → tracked-promise-BE9q9nKy.js} +1 -1
  108. package/dist/cjs/twilight.cjs.js +2 -2
  109. package/dist/cjs/utils-BD1un9WN.js +544 -0
  110. package/dist/cjs/{vanilla-picker-CHauTUo6.js → vanilla-picker-DOFw7Ga1.js} +1 -1
  111. package/dist/collection/components/salla-bullet-delivery/salla-bullet-delivery.js +82 -6
  112. package/dist/collection/components/salla-map/salla-map.css +20 -1
  113. package/dist/collection/components/salla-map/salla-map.js +86 -13
  114. package/dist/collection/components/salla-product-options/salla-product-options.js +27 -5
  115. package/dist/collection/components/salla-tel-input/salla-tel-input.css +25 -17
  116. package/dist/collection/components/salla-tel-input/salla-tel-input.js +21 -5
  117. package/dist/components/index.js +2 -2
  118. package/dist/components/intlTelInput.js +4447 -0
  119. package/dist/components/salla-bullet-delivery.js +82 -6
  120. package/dist/components/salla-map2.js +71 -14
  121. package/dist/components/salla-product-options2.js +23 -5
  122. package/dist/components/salla-tel-input2.js +23 -7
  123. package/dist/components/utils.js +542 -0
  124. package/dist/esm/{filepond-Bq2A216a.js → filepond-CTe79mlR.js} +1 -1
  125. package/dist/esm/{filepond-plugin-file-poster-D8LMLVE0.js → filepond-plugin-file-poster-FpMbRCuf.js} +1 -1
  126. package/dist/esm/{filepond-plugin-file-validate-size-O5io_aCk.js → filepond-plugin-file-validate-size-B_GPzKYu.js} +1 -1
  127. package/dist/esm/{filepond-plugin-file-validate-type-HotESPQF.js → filepond-plugin-file-validate-type-CgBrFV7x.js} +1 -1
  128. package/dist/esm/{filepond-plugin-image-edit-Cognw-Ke.js → filepond-plugin-image-edit-DElBchkY.js} +1 -1
  129. package/dist/esm/{filepond-plugin-image-exif-orientation-1R6UZIzg.js → filepond-plugin-image-exif-orientation-BhZHvn_5.js} +1 -1
  130. package/dist/esm/{filepond-plugin-image-preview-BnYXfYUb.js → filepond-plugin-image-preview-D2oaWqOt.js} +1 -1
  131. package/dist/esm/{functions-lIfge5kK.js → functions-DzuTSHQl.js} +1 -1
  132. package/dist/esm/{index-jaN78U7Z.js → index-LKlIr4DH.js} +2 -2
  133. package/dist/esm/intlTelInput-Dv1YqwOl.js +4447 -0
  134. package/dist/esm/loader.js +3 -3
  135. package/dist/esm/salla-accordion-body_2.entry.js +1 -1
  136. package/dist/esm/salla-accordion_6.entry.js +1 -1
  137. package/dist/esm/salla-add-product-button_5.entry.js +24 -6
  138. package/dist/esm/salla-advertisement.entry.js +1 -1
  139. package/dist/esm/salla-alert_2.entry.js +1 -1
  140. package/dist/esm/salla-app-install-alert.entry.js +1 -1
  141. package/dist/esm/salla-apps-icons.entry.js +1 -1
  142. package/dist/esm/salla-badge.entry.js +1 -1
  143. package/dist/esm/salla-basket-gap.entry.js +1 -1
  144. package/dist/esm/salla-booking-field_7.entry.js +32 -16
  145. package/dist/esm/salla-bullet-delivery_2.entry.js +82 -7
  146. package/dist/esm/salla-cart-coupons.entry.js +1 -1
  147. package/dist/esm/salla-cart-item-offers_2.entry.js +1 -1
  148. package/dist/esm/salla-cart-summary-card.entry.js +1 -1
  149. package/dist/esm/salla-cashback-banner.entry.js +1 -1
  150. package/dist/esm/salla-comment-factors.entry.js +1 -1
  151. package/dist/esm/salla-comment-form_8.entry.js +1 -1
  152. package/dist/esm/salla-conditional-offer.entry.js +1 -1
  153. package/dist/esm/salla-contacts.entry.js +1 -1
  154. package/dist/esm/salla-cookies-bar.entry.js +1 -1
  155. package/dist/esm/salla-count-down_2.entry.js +1 -1
  156. package/dist/esm/salla-custom-fields.entry.js +1 -1
  157. package/dist/esm/salla-delivery-promise.entry.js +1 -1
  158. package/dist/esm/salla-edit-order-button.entry.js +1 -1
  159. package/dist/esm/salla-filters-widget.entry.js +1 -1
  160. package/dist/esm/salla-filters.entry.js +1 -1
  161. package/dist/esm/salla-fulfillment-methods.entry.js +1 -1
  162. package/dist/esm/salla-gifting.entry.js +1 -1
  163. package/dist/esm/salla-hook.entry.js +1 -1
  164. package/dist/esm/salla-infinite-scroll.entry.js +1 -1
  165. package/dist/esm/salla-installment.entry.js +1 -1
  166. package/dist/esm/salla-list-tile.entry.js +1 -1
  167. package/dist/esm/salla-localization-modal.entry.js +1 -1
  168. package/dist/esm/salla-login-modal.entry.js +1 -1
  169. package/dist/esm/salla-loyalty-banner.entry.js +2 -2
  170. package/dist/esm/salla-loyalty-exchange-product-card_5.entry.js +3 -3
  171. package/dist/esm/salla-loyalty-hero_2.entry.js +2 -2
  172. package/dist/esm/salla-loyalty-panel.entry.js +3 -3
  173. package/dist/esm/salla-loyalty-points-banner.entry.js +1 -1
  174. package/dist/esm/salla-loyalty-points-history.entry.js +1 -1
  175. package/dist/esm/salla-loyalty-prize-item.entry.js +1 -1
  176. package/dist/esm/salla-loyalty-program.entry.js +3 -3
  177. package/dist/esm/salla-loyalty-reward.entry.js +2 -2
  178. package/dist/esm/salla-loyalty.entry.js +1 -1
  179. package/dist/esm/salla-maintenance-alert.entry.js +1 -1
  180. package/dist/esm/salla-map_2.entry.js +71 -15
  181. package/dist/esm/salla-menu.entry.js +1 -1
  182. package/dist/esm/salla-metadata.entry.js +1 -1
  183. package/dist/esm/salla-multiple-bundle-product-cart_2.entry.js +1 -1
  184. package/dist/esm/salla-multiple-bundle-product-options-modal_2.entry.js +1 -1
  185. package/dist/esm/salla-multiple-bundle-product.entry.js +1 -1
  186. package/dist/esm/salla-next-order-coupon.entry.js +1 -1
  187. package/dist/esm/salla-notification-item.entry.js +1 -1
  188. package/dist/esm/salla-notifications.entry.js +1 -1
  189. package/dist/esm/salla-offer-modal.entry.js +1 -1
  190. package/dist/esm/salla-offer.entry.js +1 -1
  191. package/dist/esm/salla-order-branch.entry.js +1 -1
  192. package/dist/esm/salla-order-cancel.entry.js +1 -1
  193. package/dist/esm/salla-order-details-multiple-bundle-product.entry.js +1 -1
  194. package/dist/esm/salla-order-details-options.entry.js +1 -1
  195. package/dist/esm/salla-order-details.entry.js +1 -1
  196. package/dist/esm/salla-order-edit-item.entry.js +1 -1
  197. package/dist/esm/salla-order-edit-product-card.entry.js +1 -1
  198. package/dist/esm/salla-order-edit.entry.js +1 -1
  199. package/dist/esm/salla-order-shipments.entry.js +1 -1
  200. package/dist/esm/salla-order-summary.entry.js +1 -1
  201. package/dist/esm/salla-order-totals-card.entry.js +1 -1
  202. package/dist/esm/salla-orders.entry.js +1 -1
  203. package/dist/esm/salla-payments.entry.js +1 -1
  204. package/dist/esm/salla-placeholder.entry.js +1 -1
  205. package/dist/esm/salla-price-range.entry.js +1 -1
  206. package/dist/esm/salla-product-card-embed.entry.js +1 -1
  207. package/dist/esm/salla-product-card_2.entry.js +1 -1
  208. package/dist/esm/salla-product-size-guide.entry.js +1 -1
  209. package/dist/esm/salla-products-list.entry.js +1 -1
  210. package/dist/esm/salla-quick-order.entry.js +1 -1
  211. package/dist/esm/salla-rating-modal-v2.entry.js +1 -1
  212. package/dist/esm/salla-rating-modal.entry.js +1 -1
  213. package/dist/esm/salla-review-factors-tags.entry.js +1 -1
  214. package/dist/esm/salla-scopes.entry.js +1 -1
  215. package/dist/esm/salla-search.entry.js +1 -1
  216. package/dist/esm/salla-skeleton.entry.js +1 -1
  217. package/dist/esm/salla-slider.entry.js +1 -1
  218. package/dist/esm/salla-social-share.entry.js +1 -1
  219. package/dist/esm/salla-social.entry.js +1 -1
  220. package/dist/esm/salla-tab-content_3.entry.js +1 -1
  221. package/dist/esm/salla-tiered-offer.entry.js +1 -1
  222. package/dist/esm/salla-tooltip.entry.js +1 -1
  223. package/dist/esm/salla-trust-badges.entry.js +1 -1
  224. package/dist/esm/salla-user-menu.entry.js +1 -1
  225. package/dist/esm/salla-user-profile.entry.js +1 -1
  226. package/dist/esm/salla-user-settings.entry.js +1 -1
  227. package/dist/esm/salla-verify.entry.js +1 -1
  228. package/dist/esm/salla-wallet.entry.js +1 -1
  229. package/dist/esm/salla-wishlist-actions.entry.js +1 -1
  230. package/dist/esm/{tracked-promise-BLCQ8tjn.js → tracked-promise-yYcxeJzZ.js} +1 -1
  231. package/dist/esm/twilight.js +3 -3
  232. package/dist/esm/utils-DxnArMXe.js +542 -0
  233. package/dist/esm/{vanilla-picker-bYqL5aAx.js → vanilla-picker-BAPOtEmC.js} +1 -1
  234. package/dist/twilight/{p-1fbf590d.entry.js → p-0559d448.entry.js} +1 -1
  235. package/dist/twilight/{p-17bc9975.entry.js → p-067f052b.entry.js} +1 -1
  236. package/dist/twilight/{p-abc2e86d.entry.js → p-06c4a0cd.entry.js} +1 -1
  237. package/dist/twilight/{p-1f2aca4d.entry.js → p-10c3a012.entry.js} +1 -1
  238. package/dist/twilight/{p-9a59e00a.entry.js → p-1227aa55.entry.js} +1 -1
  239. package/dist/twilight/{p-99224703.entry.js → p-146706fc.entry.js} +1 -1
  240. package/dist/twilight/{p-7d585e3f.entry.js → p-166343b3.entry.js} +1 -1
  241. package/dist/twilight/{p-c08b91d6.entry.js → p-172a034d.entry.js} +1 -1
  242. package/dist/twilight/{p-7fae6196.entry.js → p-1b5189f0.entry.js} +1 -1
  243. package/dist/twilight/{p-362875df.entry.js → p-1e799c60.entry.js} +1 -1
  244. package/dist/twilight/{p-97298e68.entry.js → p-233039ec.entry.js} +1 -1
  245. package/dist/twilight/{p-0e52a675.entry.js → p-253afd49.entry.js} +1 -1
  246. package/dist/twilight/{p-00cc5421.entry.js → p-2766a17f.entry.js} +1 -1
  247. package/dist/twilight/{p-182fe65a.entry.js → p-288e4fd6.entry.js} +1 -1
  248. package/dist/twilight/p-2c14546d.entry.js +4 -0
  249. package/dist/twilight/{p-c3b02957.entry.js → p-2e9fcab1.entry.js} +1 -1
  250. package/dist/twilight/{p-71c122ee.entry.js → p-2ea5c336.entry.js} +1 -1
  251. package/dist/twilight/{p-e1732ee5.entry.js → p-2f6e46b0.entry.js} +1 -1
  252. package/dist/twilight/{p-0e39350d.entry.js → p-31a1bd9c.entry.js} +1 -1
  253. package/dist/twilight/{p-ea5068ed.entry.js → p-326a584d.entry.js} +1 -1
  254. package/dist/twilight/{p-d7dc876f.entry.js → p-385e1853.entry.js} +1 -1
  255. package/dist/twilight/{p-49538e37.entry.js → p-3a46d113.entry.js} +1 -1
  256. package/dist/twilight/{p-42057f68.entry.js → p-3a9c2e9d.entry.js} +1 -1
  257. package/dist/twilight/{p-18ebde40.entry.js → p-3f6fac09.entry.js} +1 -1
  258. package/dist/twilight/{p-b1875b29.entry.js → p-44bf6cdf.entry.js} +1 -1
  259. package/dist/twilight/{p-4fc66f6c.entry.js → p-466fa362.entry.js} +1 -1
  260. package/dist/twilight/{p-9b2a7211.entry.js → p-4c36ba4c.entry.js} +1 -1
  261. package/dist/twilight/{p-630eb394.entry.js → p-4cc9583f.entry.js} +1 -1
  262. package/dist/twilight/{p-3eccf464.entry.js → p-4d46bd3d.entry.js} +1 -1
  263. package/dist/twilight/{p-f5e142d7.entry.js → p-4e213aab.entry.js} +1 -1
  264. package/dist/twilight/{p-e467f5b0.entry.js → p-500f0db8.entry.js} +1 -1
  265. package/dist/twilight/{p-c619267d.entry.js → p-50365a49.entry.js} +1 -1
  266. package/dist/twilight/{p-99a2141a.entry.js → p-5555817c.entry.js} +1 -1
  267. package/dist/twilight/{p-fd847a8f.entry.js → p-584817e5.entry.js} +1 -1
  268. package/dist/twilight/{p-602fc32b.entry.js → p-59dbe5f1.entry.js} +1 -1
  269. package/dist/twilight/{p-6435138d.entry.js → p-5c5f4f73.entry.js} +1 -1
  270. package/dist/twilight/{p-aa8cb72c.entry.js → p-60a7b50b.entry.js} +1 -1
  271. package/dist/twilight/{p-2c9b90ce.entry.js → p-61cd30d3.entry.js} +1 -1
  272. package/dist/twilight/{p-69b14e60.entry.js → p-6204462a.entry.js} +1 -1
  273. package/dist/twilight/{p-505874e8.entry.js → p-630e769f.entry.js} +1 -1
  274. package/dist/twilight/{p-e38c275d.entry.js → p-65d86157.entry.js} +1 -1
  275. package/dist/twilight/{p-9a0c466f.entry.js → p-6bbc3c94.entry.js} +1 -1
  276. package/dist/twilight/{p-e02846cf.entry.js → p-71344ddc.entry.js} +1 -1
  277. package/dist/twilight/{p-74116ebe.entry.js → p-72e4ef6a.entry.js} +1 -1
  278. package/dist/twilight/{p-59273278.entry.js → p-761165fd.entry.js} +1 -1
  279. package/dist/twilight/{p-3f644db4.entry.js → p-797a7c1e.entry.js} +1 -1
  280. package/dist/twilight/{p-5d2ebd77.entry.js → p-7edb518f.entry.js} +1 -1
  281. package/dist/twilight/{p-a0cbccd9.entry.js → p-85819cea.entry.js} +1 -1
  282. package/dist/twilight/{p-8c10db42.entry.js → p-879de784.entry.js} +1 -1
  283. package/dist/twilight/{p-f7ab861f.entry.js → p-882128d2.entry.js} +1 -1
  284. package/dist/twilight/{p-c81d2dc8.entry.js → p-8993c586.entry.js} +1 -1
  285. package/dist/twilight/{p-f68bc653.entry.js → p-89ff463e.entry.js} +1 -1
  286. package/dist/twilight/{p-aa48682d.entry.js → p-8a3cb52e.entry.js} +1 -1
  287. package/dist/twilight/{p-1104a7a2.entry.js → p-8bb53ed2.entry.js} +2 -2
  288. package/dist/twilight/{p-6c8274a2.entry.js → p-8f7579e4.entry.js} +1 -1
  289. package/dist/twilight/{p-6a9a4bd8.entry.js → p-9445f844.entry.js} +1 -1
  290. package/dist/twilight/{p-63518f52.entry.js → p-961941f2.entry.js} +1 -1
  291. package/dist/twilight/{p-b17be3dc.entry.js → p-96fff354.entry.js} +1 -1
  292. package/dist/twilight/{p-0609a7bd.entry.js → p-97f12f7b.entry.js} +1 -1
  293. package/dist/twilight/{p-75e0cd1f.entry.js → p-99228024.entry.js} +1 -1
  294. package/dist/twilight/{p-33c856af.entry.js → p-9a9d4676.entry.js} +1 -1
  295. package/dist/twilight/{p-c9e3cb79.entry.js → p-9bd015e5.entry.js} +1 -1
  296. package/dist/twilight/{p-rkyvWRN4.js → p-BGqFcZFD.js} +1 -1
  297. package/dist/twilight/{p-Dqih45q3.js → p-BJ2QKyWM.js} +1 -1
  298. package/dist/twilight/{p-nDdDwFvo.js → p-BOmRCp86.js} +1 -1
  299. package/dist/twilight/{p-LTkkjsSH.js → p-BVtJp-gU.js} +1 -1
  300. package/dist/twilight/p-Bdz016Fy.js +4 -0
  301. package/dist/twilight/{p-8-u5GuKq.js → p-By36wPtc.js} +1 -1
  302. package/dist/twilight/p-CnIis-ob.js +4 -0
  303. package/dist/twilight/{p-BcYGWl9T.js → p-DkALFehO.js} +1 -1
  304. package/dist/twilight/{p-DOua19fU.js → p-DmcP-9uS.js} +1 -1
  305. package/dist/twilight/p-DxnArMXe.js +4 -0
  306. package/dist/twilight/{p-CYTQC0eE.js → p-HiDU1qAC.js} +1 -1
  307. package/dist/twilight/{p-jaN78U7Z.js → p-LKlIr4DH.js} +1 -1
  308. package/dist/twilight/{p-44e6a827.entry.js → p-a435c54c.entry.js} +1 -1
  309. package/dist/twilight/{p-ae9c2d84.entry.js → p-b063d0f3.entry.js} +1 -1
  310. package/dist/twilight/{p-977780ec.entry.js → p-b1b11ebb.entry.js} +1 -1
  311. package/dist/twilight/{p-323402b3.entry.js → p-b46bd39f.entry.js} +1 -1
  312. package/dist/twilight/{p-525223a4.entry.js → p-b5c106ac.entry.js} +1 -1
  313. package/dist/twilight/{p-d58a1f61.entry.js → p-b6ce3117.entry.js} +1 -1
  314. package/dist/twilight/{p-97e232e5.entry.js → p-b76720e1.entry.js} +1 -1
  315. package/dist/twilight/{p-4f2994dd.entry.js → p-bb242f20.entry.js} +1 -1
  316. package/dist/twilight/{p-2945aeb2.entry.js → p-beaf3f78.entry.js} +1 -1
  317. package/dist/twilight/{p-373fcfb8.entry.js → p-c06229a1.entry.js} +1 -1
  318. package/dist/twilight/{p-3c832f6f.entry.js → p-c06ab3be.entry.js} +1 -1
  319. package/dist/twilight/{p-050f9310.entry.js → p-c1036ebd.entry.js} +1 -1
  320. package/dist/twilight/{p-c8c5daa1.entry.js → p-c19412a4.entry.js} +1 -1
  321. package/dist/twilight/{p-80928bbd.entry.js → p-c7c2dad0.entry.js} +1 -1
  322. package/dist/twilight/{p-24805db6.entry.js → p-cf3b863c.entry.js} +1 -1
  323. package/dist/twilight/{p-1eb75e5f.entry.js → p-cf95b06d.entry.js} +1 -1
  324. package/dist/twilight/{p-fe4fff6c.entry.js → p-cffe12a3.entry.js} +1 -1
  325. package/dist/twilight/{p-e51caf6a.entry.js → p-d477d0ab.entry.js} +1 -1
  326. package/dist/twilight/p-d81ee10d.entry.js +4 -0
  327. package/dist/twilight/{p-8f2d30ee.entry.js → p-de14bb3d.entry.js} +1 -1
  328. package/dist/twilight/p-dfea079f.entry.js +4 -0
  329. package/dist/twilight/{p-99141839.entry.js → p-e407d576.entry.js} +1 -1
  330. package/dist/twilight/{p-d336cca5.entry.js → p-e6ae56e1.entry.js} +1 -1
  331. package/dist/twilight/{p-8678f934.entry.js → p-ebaa623e.entry.js} +1 -1
  332. package/dist/twilight/{p-448c0d05.entry.js → p-ec1730a3.entry.js} +1 -1
  333. package/dist/twilight/{p-3d9e2493.entry.js → p-eea93ac7.entry.js} +1 -1
  334. package/dist/twilight/{p-0d2fe58f.entry.js → p-eed700e7.entry.js} +1 -1
  335. package/dist/twilight/{p-25f2f9b9.entry.js → p-ef4a0ae4.entry.js} +1 -1
  336. package/dist/twilight/{p-702bbad3.entry.js → p-f418df90.entry.js} +1 -1
  337. package/dist/twilight/{p-95a6174b.entry.js → p-f4733e21.entry.js} +1 -1
  338. package/dist/twilight/{p-96ac5048.entry.js → p-f5154b22.entry.js} +1 -1
  339. package/dist/twilight/{p-e9181449.entry.js → p-fd33515c.entry.js} +1 -1
  340. package/dist/twilight/{p-b31b5264.entry.js → p-fe40bb32.entry.js} +1 -1
  341. package/dist/twilight/{p-BRZnimZv.js → p-j2CozAo8.js} +1 -1
  342. package/dist/twilight/twilight.esm.js +1 -1
  343. package/dist/types/components/salla-bullet-delivery/salla-bullet-delivery.d.ts +16 -0
  344. package/dist/types/components/salla-map/salla-map.d.ts +15 -0
  345. package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +3 -0
  346. package/dist/types/components.d.ts +4 -0
  347. package/package.json +6 -6
  348. package/dist/cjs/index-CE6R05qu.js +0 -1714
  349. package/dist/components/index3.js +0 -1712
  350. package/dist/esm/index-D_H00WFp.js +0 -1712
  351. package/dist/twilight/p-4a8d866d.entry.js +0 -4
  352. package/dist/twilight/p-5d036c83.entry.js +0 -4
  353. package/dist/twilight/p-Cp2FlnRu.js +0 -4
  354. package/dist/twilight/p-EpPIlSaQ.js +0 -4
  355. package/dist/twilight/p-f1977d52.entry.js +0 -4
@@ -0,0 +1,4449 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ 'use strict';
5
+
6
+ var index = require('./index-CL2v3rWe.js');
7
+
8
+ function _mergeNamespaces(n, m) {
9
+ m.forEach(function (e) {
10
+ e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default' && !(k in n)) {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ });
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ var intlTelInput$2 = {exports: {}};
24
+
25
+ /*
26
+ * International Telephone Input v26.9.2
27
+ * https://github.com/jackocnr/intl-tel-input.git
28
+ * Licensed under the MIT license
29
+ */
30
+
31
+ var hasRequiredIntlTelInput;
32
+
33
+ function requireIntlTelInput () {
34
+ if (hasRequiredIntlTelInput) return intlTelInput$2.exports;
35
+ hasRequiredIntlTelInput = 1;
36
+ (function (module) {
37
+ // UMD
38
+ (function(factory) {
39
+ if (module.exports) {
40
+ module.exports = factory();
41
+ } else {
42
+ window.intlTelInput = factory();
43
+ }
44
+ }(() => {
45
+
46
+ var factoryOutput = (() => {
47
+ var __defProp = Object.defineProperty;
48
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
49
+ var __getOwnPropNames = Object.getOwnPropertyNames;
50
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
51
+ var __export = (target, all) => {
52
+ for (var name in all)
53
+ __defProp(target, name, { get: all[name], enumerable: true });
54
+ };
55
+ var __copyProps = (to, from, except, desc) => {
56
+ if (from && typeof from === "object" || typeof from === "function") {
57
+ for (let key of __getOwnPropNames(from))
58
+ if (!__hasOwnProp.call(to, key) && key !== except)
59
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
60
+ }
61
+ return to;
62
+ };
63
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
64
+
65
+ // src/js/intl-tel-input.ts
66
+ var intl_tel_input_exports = {};
67
+ __export(intl_tel_input_exports, {
68
+ Iti: () => Iti,
69
+ default: () => intl_tel_input_default
70
+ });
71
+
72
+ // src/js/intl-tel-input/data.ts
73
+ var rawCountryData = [
74
+ [
75
+ "af",
76
+ // Afghanistan
77
+ "93",
78
+ 0,
79
+ null,
80
+ "0"
81
+ ],
82
+ [
83
+ "ax",
84
+ // Åland Islands
85
+ "358",
86
+ 1,
87
+ ["18", "4"],
88
+ // (4 is a mobile range shared with FI)
89
+ "0"
90
+ ],
91
+ [
92
+ "al",
93
+ // Albania
94
+ "355",
95
+ 0,
96
+ null,
97
+ "0"
98
+ ],
99
+ [
100
+ "dz",
101
+ // Algeria
102
+ "213",
103
+ 0,
104
+ null,
105
+ "0"
106
+ ],
107
+ [
108
+ "as",
109
+ // American Samoa
110
+ "1",
111
+ 5,
112
+ ["684"],
113
+ "1"
114
+ ],
115
+ [
116
+ "ad",
117
+ // Andorra
118
+ "376"
119
+ ],
120
+ [
121
+ "ao",
122
+ // Angola
123
+ "244"
124
+ ],
125
+ [
126
+ "ai",
127
+ // Anguilla
128
+ "1",
129
+ 6,
130
+ ["264"],
131
+ "1"
132
+ ],
133
+ [
134
+ "ag",
135
+ // Antigua and Barbuda
136
+ "1",
137
+ 7,
138
+ ["268"],
139
+ "1"
140
+ ],
141
+ [
142
+ "ar",
143
+ // Argentina
144
+ "54",
145
+ 0,
146
+ null,
147
+ "0"
148
+ ],
149
+ [
150
+ "am",
151
+ // Armenia
152
+ "374",
153
+ 0,
154
+ null,
155
+ "0"
156
+ ],
157
+ [
158
+ "aw",
159
+ // Aruba
160
+ "297"
161
+ ],
162
+ [
163
+ "ac",
164
+ // Ascension Island
165
+ "247"
166
+ ],
167
+ [
168
+ "au",
169
+ // Australia
170
+ "61",
171
+ 0,
172
+ ["4"],
173
+ // (mobile range shared with CX and CC)
174
+ "0"
175
+ ],
176
+ [
177
+ "at",
178
+ // Austria
179
+ "43",
180
+ 0,
181
+ null,
182
+ "0"
183
+ ],
184
+ [
185
+ "az",
186
+ // Azerbaijan
187
+ "994",
188
+ 0,
189
+ null,
190
+ "0"
191
+ ],
192
+ [
193
+ "bs",
194
+ // Bahamas
195
+ "1",
196
+ 8,
197
+ ["242"],
198
+ "1"
199
+ ],
200
+ [
201
+ "bh",
202
+ // Bahrain
203
+ "973"
204
+ ],
205
+ [
206
+ "bd",
207
+ // Bangladesh
208
+ "880",
209
+ 0,
210
+ null,
211
+ "0"
212
+ ],
213
+ [
214
+ "bb",
215
+ // Barbados
216
+ "1",
217
+ 9,
218
+ ["246"],
219
+ "1"
220
+ ],
221
+ [
222
+ "by",
223
+ // Belarus
224
+ "375",
225
+ 0,
226
+ null,
227
+ "8"
228
+ ],
229
+ [
230
+ "be",
231
+ // Belgium
232
+ "32",
233
+ 0,
234
+ null,
235
+ "0"
236
+ ],
237
+ [
238
+ "bz",
239
+ // Belize
240
+ "501"
241
+ ],
242
+ [
243
+ "bj",
244
+ // Benin
245
+ "229"
246
+ ],
247
+ [
248
+ "bm",
249
+ // Bermuda
250
+ "1",
251
+ 10,
252
+ ["441"],
253
+ "1"
254
+ ],
255
+ [
256
+ "bt",
257
+ // Bhutan
258
+ "975"
259
+ ],
260
+ [
261
+ "bo",
262
+ // Bolivia
263
+ "591",
264
+ 0,
265
+ null,
266
+ "0"
267
+ ],
268
+ [
269
+ "ba",
270
+ // Bosnia and Herzegovina
271
+ "387",
272
+ 0,
273
+ null,
274
+ "0"
275
+ ],
276
+ [
277
+ "bw",
278
+ // Botswana
279
+ "267"
280
+ ],
281
+ [
282
+ "br",
283
+ // Brazil
284
+ "55",
285
+ 0,
286
+ null,
287
+ "0"
288
+ ],
289
+ [
290
+ "io",
291
+ // British Indian Ocean Territory
292
+ "246"
293
+ ],
294
+ [
295
+ "vg",
296
+ // British Virgin Islands
297
+ "1",
298
+ 11,
299
+ ["284"],
300
+ "1"
301
+ ],
302
+ [
303
+ "bn",
304
+ // Brunei
305
+ "673"
306
+ ],
307
+ [
308
+ "bg",
309
+ // Bulgaria
310
+ "359",
311
+ 0,
312
+ null,
313
+ "0"
314
+ ],
315
+ [
316
+ "bf",
317
+ // Burkina Faso
318
+ "226"
319
+ ],
320
+ [
321
+ "bi",
322
+ // Burundi
323
+ "257"
324
+ ],
325
+ [
326
+ "kh",
327
+ // Cambodia
328
+ "855",
329
+ 0,
330
+ null,
331
+ "0"
332
+ ],
333
+ [
334
+ "cm",
335
+ // Cameroon
336
+ "237"
337
+ ],
338
+ [
339
+ "ca",
340
+ // Canada
341
+ "1",
342
+ 1,
343
+ ["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"],
344
+ "1"
345
+ ],
346
+ [
347
+ "cv",
348
+ // Cape Verde
349
+ "238"
350
+ ],
351
+ [
352
+ "bq",
353
+ // Caribbean Netherlands
354
+ "599",
355
+ 1,
356
+ ["3", "4", "7"]
357
+ ],
358
+ [
359
+ "ky",
360
+ // Cayman Islands
361
+ "1",
362
+ 12,
363
+ ["345"],
364
+ "1"
365
+ ],
366
+ [
367
+ "cf",
368
+ // Central African Republic
369
+ "236"
370
+ ],
371
+ [
372
+ "td",
373
+ // Chad
374
+ "235"
375
+ ],
376
+ [
377
+ "cl",
378
+ // Chile
379
+ "56"
380
+ ],
381
+ [
382
+ "cn",
383
+ // China
384
+ "86",
385
+ 0,
386
+ null,
387
+ "0"
388
+ ],
389
+ [
390
+ "cx",
391
+ // Christmas Island
392
+ "61",
393
+ 2,
394
+ ["4", "89164"],
395
+ // (4 is a mobile range shared with AU and CC)
396
+ "0"
397
+ ],
398
+ [
399
+ "cc",
400
+ // Cocos (Keeling) Islands
401
+ "61",
402
+ 1,
403
+ ["4", "89162"],
404
+ // (4 is a mobile range shared with AU and CX)
405
+ "0"
406
+ ],
407
+ [
408
+ "co",
409
+ // Colombia
410
+ "57",
411
+ 0,
412
+ null,
413
+ "0"
414
+ ],
415
+ [
416
+ "km",
417
+ // Comoros
418
+ "269"
419
+ ],
420
+ [
421
+ "cg",
422
+ // Congo (Brazzaville)
423
+ "242"
424
+ ],
425
+ [
426
+ "cd",
427
+ // Congo (Kinshasa)
428
+ "243",
429
+ 0,
430
+ null,
431
+ "0"
432
+ ],
433
+ [
434
+ "ck",
435
+ // Cook Islands
436
+ "682"
437
+ ],
438
+ [
439
+ "cr",
440
+ // Costa Rica
441
+ "506"
442
+ ],
443
+ [
444
+ "ci",
445
+ // Côte d'Ivoire
446
+ "225"
447
+ ],
448
+ [
449
+ "hr",
450
+ // Croatia
451
+ "385",
452
+ 0,
453
+ null,
454
+ "0"
455
+ ],
456
+ [
457
+ "cu",
458
+ // Cuba
459
+ "53",
460
+ 0,
461
+ null,
462
+ "0"
463
+ ],
464
+ [
465
+ "cw",
466
+ // Curaçao
467
+ "599",
468
+ 0
469
+ ],
470
+ [
471
+ "cy",
472
+ // Cyprus
473
+ "357"
474
+ ],
475
+ [
476
+ "cz",
477
+ // Czech Republic
478
+ "420"
479
+ ],
480
+ [
481
+ "dk",
482
+ // Denmark
483
+ "45"
484
+ ],
485
+ [
486
+ "dj",
487
+ // Djibouti
488
+ "253"
489
+ ],
490
+ [
491
+ "dm",
492
+ // Dominica
493
+ "1",
494
+ 13,
495
+ ["767"],
496
+ "1"
497
+ ],
498
+ [
499
+ "do",
500
+ // Dominican Republic
501
+ "1",
502
+ 2,
503
+ ["809", "829", "849"],
504
+ "1"
505
+ ],
506
+ [
507
+ "ec",
508
+ // Ecuador
509
+ "593",
510
+ 0,
511
+ null,
512
+ "0"
513
+ ],
514
+ [
515
+ "eg",
516
+ // Egypt
517
+ "20",
518
+ 0,
519
+ null,
520
+ "0"
521
+ ],
522
+ [
523
+ "sv",
524
+ // El Salvador
525
+ "503"
526
+ ],
527
+ [
528
+ "gq",
529
+ // Equatorial Guinea
530
+ "240"
531
+ ],
532
+ [
533
+ "er",
534
+ // Eritrea
535
+ "291",
536
+ 0,
537
+ null,
538
+ "0"
539
+ ],
540
+ [
541
+ "ee",
542
+ // Estonia
543
+ "372"
544
+ ],
545
+ [
546
+ "sz",
547
+ // Eswatini
548
+ "268"
549
+ ],
550
+ [
551
+ "et",
552
+ // Ethiopia
553
+ "251",
554
+ 0,
555
+ null,
556
+ "0"
557
+ ],
558
+ [
559
+ "fk",
560
+ // Falkland Islands (Malvinas)
561
+ "500"
562
+ ],
563
+ [
564
+ "fo",
565
+ // Faroe Islands
566
+ "298"
567
+ ],
568
+ [
569
+ "fj",
570
+ // Fiji
571
+ "679"
572
+ ],
573
+ [
574
+ "fi",
575
+ // Finland
576
+ "358",
577
+ 0,
578
+ ["4"],
579
+ // (mobile range shared with AX)
580
+ "0"
581
+ ],
582
+ [
583
+ "fr",
584
+ // France
585
+ "33",
586
+ 0,
587
+ null,
588
+ "0"
589
+ ],
590
+ [
591
+ "gf",
592
+ // French Guiana
593
+ "594",
594
+ 0,
595
+ null,
596
+ "0"
597
+ ],
598
+ [
599
+ "pf",
600
+ // French Polynesia
601
+ "689"
602
+ ],
603
+ [
604
+ "ga",
605
+ // Gabon
606
+ "241"
607
+ ],
608
+ [
609
+ "gm",
610
+ // Gambia
611
+ "220"
612
+ ],
613
+ [
614
+ "ge",
615
+ // Georgia
616
+ "995",
617
+ 0,
618
+ null,
619
+ "0"
620
+ ],
621
+ [
622
+ "de",
623
+ // Germany
624
+ "49",
625
+ 0,
626
+ null,
627
+ "0"
628
+ ],
629
+ [
630
+ "gh",
631
+ // Ghana
632
+ "233",
633
+ 0,
634
+ null,
635
+ "0"
636
+ ],
637
+ [
638
+ "gi",
639
+ // Gibraltar
640
+ "350"
641
+ ],
642
+ [
643
+ "gr",
644
+ // Greece
645
+ "30"
646
+ ],
647
+ [
648
+ "gl",
649
+ // Greenland
650
+ "299"
651
+ ],
652
+ [
653
+ "gd",
654
+ // Grenada
655
+ "1",
656
+ 14,
657
+ ["473"],
658
+ "1"
659
+ ],
660
+ [
661
+ "gp",
662
+ // Guadeloupe
663
+ "590",
664
+ 0,
665
+ null,
666
+ "0"
667
+ ],
668
+ [
669
+ "gu",
670
+ // Guam
671
+ "1",
672
+ 15,
673
+ ["671"],
674
+ "1"
675
+ ],
676
+ [
677
+ "gt",
678
+ // Guatemala
679
+ "502"
680
+ ],
681
+ [
682
+ "gg",
683
+ // Guernsey
684
+ "44",
685
+ 1,
686
+ ["1481", "7781", "7839", "7911"],
687
+ "0"
688
+ ],
689
+ [
690
+ "gn",
691
+ // Guinea
692
+ "224"
693
+ ],
694
+ [
695
+ "gw",
696
+ // Guinea-Bissau
697
+ "245"
698
+ ],
699
+ [
700
+ "gy",
701
+ // Guyana
702
+ "592"
703
+ ],
704
+ [
705
+ "ht",
706
+ // Haiti
707
+ "509"
708
+ ],
709
+ [
710
+ "hn",
711
+ // Honduras
712
+ "504"
713
+ ],
714
+ [
715
+ "hk",
716
+ // Hong Kong SAR China
717
+ "852"
718
+ ],
719
+ [
720
+ "hu",
721
+ // Hungary
722
+ "36",
723
+ 0,
724
+ null,
725
+ "06"
726
+ ],
727
+ [
728
+ "is",
729
+ // Iceland
730
+ "354"
731
+ ],
732
+ [
733
+ "in",
734
+ // India
735
+ "91",
736
+ 0,
737
+ null,
738
+ "0"
739
+ ],
740
+ [
741
+ "id",
742
+ // Indonesia
743
+ "62",
744
+ 0,
745
+ null,
746
+ "0"
747
+ ],
748
+ [
749
+ "ir",
750
+ // Iran
751
+ "98",
752
+ 0,
753
+ null,
754
+ "0"
755
+ ],
756
+ [
757
+ "iq",
758
+ // Iraq
759
+ "964",
760
+ 0,
761
+ null,
762
+ "0"
763
+ ],
764
+ [
765
+ "ie",
766
+ // Ireland
767
+ "353",
768
+ 0,
769
+ null,
770
+ "0"
771
+ ],
772
+ [
773
+ "im",
774
+ // Isle of Man
775
+ "44",
776
+ 2,
777
+ ["1624", "74576", "7524", "7624", "7924"],
778
+ "0"
779
+ ],
780
+ [
781
+ "il",
782
+ // Israel
783
+ "972",
784
+ 0,
785
+ null,
786
+ "0"
787
+ ],
788
+ [
789
+ "it",
790
+ // Italy
791
+ "39",
792
+ 0,
793
+ ["3"]
794
+ // (mobile range shared with VA)
795
+ ],
796
+ [
797
+ "jm",
798
+ // Jamaica
799
+ "1",
800
+ 4,
801
+ ["658", "876"],
802
+ "1"
803
+ ],
804
+ [
805
+ "jp",
806
+ // Japan
807
+ "81",
808
+ 0,
809
+ null,
810
+ "0"
811
+ ],
812
+ [
813
+ "je",
814
+ // Jersey
815
+ "44",
816
+ 3,
817
+ ["1534", "7509", "7700", "7797", "7829", "7937"],
818
+ "0"
819
+ ],
820
+ [
821
+ "jo",
822
+ // Jordan
823
+ "962",
824
+ 0,
825
+ null,
826
+ "0"
827
+ ],
828
+ [
829
+ "kz",
830
+ // Kazakhstan
831
+ "7",
832
+ 1,
833
+ ["33", "7"],
834
+ // (33 is shared with RU)
835
+ "8"
836
+ ],
837
+ [
838
+ "ke",
839
+ // Kenya
840
+ "254",
841
+ 0,
842
+ null,
843
+ "0"
844
+ ],
845
+ [
846
+ "ki",
847
+ // Kiribati
848
+ "686",
849
+ 0,
850
+ null,
851
+ "0"
852
+ ],
853
+ [
854
+ "xk",
855
+ // Kosovo
856
+ "383",
857
+ 0,
858
+ null,
859
+ "0"
860
+ ],
861
+ [
862
+ "kw",
863
+ // Kuwait
864
+ "965"
865
+ ],
866
+ [
867
+ "kg",
868
+ // Kyrgyzstan
869
+ "996",
870
+ 0,
871
+ null,
872
+ "0"
873
+ ],
874
+ [
875
+ "la",
876
+ // Laos
877
+ "856",
878
+ 0,
879
+ null,
880
+ "0"
881
+ ],
882
+ [
883
+ "lv",
884
+ // Latvia
885
+ "371"
886
+ ],
887
+ [
888
+ "lb",
889
+ // Lebanon
890
+ "961",
891
+ 0,
892
+ null,
893
+ "0"
894
+ ],
895
+ [
896
+ "ls",
897
+ // Lesotho
898
+ "266"
899
+ ],
900
+ [
901
+ "lr",
902
+ // Liberia
903
+ "231",
904
+ 0,
905
+ null,
906
+ "0"
907
+ ],
908
+ [
909
+ "ly",
910
+ // Libya
911
+ "218",
912
+ 0,
913
+ null,
914
+ "0"
915
+ ],
916
+ [
917
+ "li",
918
+ // Liechtenstein
919
+ "423",
920
+ 0,
921
+ null,
922
+ "0"
923
+ ],
924
+ [
925
+ "lt",
926
+ // Lithuania
927
+ "370",
928
+ 0,
929
+ null,
930
+ "0"
931
+ ],
932
+ [
933
+ "lu",
934
+ // Luxembourg
935
+ "352"
936
+ ],
937
+ [
938
+ "mo",
939
+ // Macao SAR China
940
+ "853"
941
+ ],
942
+ [
943
+ "mg",
944
+ // Madagascar
945
+ "261",
946
+ 0,
947
+ null,
948
+ "0"
949
+ ],
950
+ [
951
+ "mw",
952
+ // Malawi
953
+ "265",
954
+ 0,
955
+ null,
956
+ "0"
957
+ ],
958
+ [
959
+ "my",
960
+ // Malaysia
961
+ "60",
962
+ 0,
963
+ null,
964
+ "0"
965
+ ],
966
+ [
967
+ "mv",
968
+ // Maldives
969
+ "960"
970
+ ],
971
+ [
972
+ "ml",
973
+ // Mali
974
+ "223"
975
+ ],
976
+ [
977
+ "mt",
978
+ // Malta
979
+ "356"
980
+ ],
981
+ [
982
+ "mh",
983
+ // Marshall Islands
984
+ "692",
985
+ 0,
986
+ null,
987
+ "1"
988
+ ],
989
+ [
990
+ "mq",
991
+ // Martinique
992
+ "596",
993
+ 0,
994
+ null,
995
+ "0"
996
+ ],
997
+ [
998
+ "mr",
999
+ // Mauritania
1000
+ "222"
1001
+ ],
1002
+ [
1003
+ "mu",
1004
+ // Mauritius
1005
+ "230"
1006
+ ],
1007
+ [
1008
+ "yt",
1009
+ // Mayotte
1010
+ "262",
1011
+ 1,
1012
+ ["269", "639"],
1013
+ "0"
1014
+ ],
1015
+ [
1016
+ "mx",
1017
+ // Mexico
1018
+ "52"
1019
+ ],
1020
+ [
1021
+ "fm",
1022
+ // Micronesia
1023
+ "691"
1024
+ ],
1025
+ [
1026
+ "md",
1027
+ // Moldova
1028
+ "373",
1029
+ 0,
1030
+ null,
1031
+ "0"
1032
+ ],
1033
+ [
1034
+ "mc",
1035
+ // Monaco
1036
+ "377",
1037
+ 0,
1038
+ null,
1039
+ "0"
1040
+ ],
1041
+ [
1042
+ "mn",
1043
+ // Mongolia
1044
+ "976",
1045
+ 0,
1046
+ null,
1047
+ "0"
1048
+ ],
1049
+ [
1050
+ "me",
1051
+ // Montenegro
1052
+ "382",
1053
+ 0,
1054
+ null,
1055
+ "0"
1056
+ ],
1057
+ [
1058
+ "ms",
1059
+ // Montserrat
1060
+ "1",
1061
+ 16,
1062
+ ["664"],
1063
+ "1"
1064
+ ],
1065
+ [
1066
+ "ma",
1067
+ // Morocco
1068
+ "212",
1069
+ 0,
1070
+ ["6", "7"],
1071
+ // (mobile ranges shared with EH)
1072
+ "0"
1073
+ ],
1074
+ [
1075
+ "mz",
1076
+ // Mozambique
1077
+ "258"
1078
+ ],
1079
+ [
1080
+ "mm",
1081
+ // Myanmar (Burma)
1082
+ "95",
1083
+ 0,
1084
+ null,
1085
+ "0"
1086
+ ],
1087
+ [
1088
+ "na",
1089
+ // Namibia
1090
+ "264",
1091
+ 0,
1092
+ null,
1093
+ "0"
1094
+ ],
1095
+ [
1096
+ "nr",
1097
+ // Nauru
1098
+ "674"
1099
+ ],
1100
+ [
1101
+ "np",
1102
+ // Nepal
1103
+ "977",
1104
+ 0,
1105
+ null,
1106
+ "0"
1107
+ ],
1108
+ [
1109
+ "nl",
1110
+ // Netherlands
1111
+ "31",
1112
+ 0,
1113
+ null,
1114
+ "0"
1115
+ ],
1116
+ [
1117
+ "nc",
1118
+ // New Caledonia
1119
+ "687"
1120
+ ],
1121
+ [
1122
+ "nz",
1123
+ // New Zealand
1124
+ "64",
1125
+ 0,
1126
+ null,
1127
+ "0"
1128
+ ],
1129
+ [
1130
+ "ni",
1131
+ // Nicaragua
1132
+ "505"
1133
+ ],
1134
+ [
1135
+ "ne",
1136
+ // Niger
1137
+ "227"
1138
+ ],
1139
+ [
1140
+ "ng",
1141
+ // Nigeria
1142
+ "234",
1143
+ 0,
1144
+ null,
1145
+ "0"
1146
+ ],
1147
+ [
1148
+ "nu",
1149
+ // Niue
1150
+ "683"
1151
+ ],
1152
+ [
1153
+ "nf",
1154
+ // Norfolk Island
1155
+ "672"
1156
+ ],
1157
+ [
1158
+ "kp",
1159
+ // North Korea
1160
+ "850",
1161
+ 0,
1162
+ null,
1163
+ "0"
1164
+ ],
1165
+ [
1166
+ "mk",
1167
+ // North Macedonia
1168
+ "389",
1169
+ 0,
1170
+ null,
1171
+ "0"
1172
+ ],
1173
+ [
1174
+ "mp",
1175
+ // Northern Mariana Islands
1176
+ "1",
1177
+ 17,
1178
+ ["670"],
1179
+ "1"
1180
+ ],
1181
+ [
1182
+ "no",
1183
+ // Norway
1184
+ "47",
1185
+ 0,
1186
+ ["4", "9"]
1187
+ // (mobile ranges shared with SJ)
1188
+ ],
1189
+ [
1190
+ "om",
1191
+ // Oman
1192
+ "968"
1193
+ ],
1194
+ [
1195
+ "pk",
1196
+ // Pakistan
1197
+ "92",
1198
+ 0,
1199
+ null,
1200
+ "0"
1201
+ ],
1202
+ [
1203
+ "pw",
1204
+ // Palau
1205
+ "680"
1206
+ ],
1207
+ [
1208
+ "ps",
1209
+ // Palestinian Territories
1210
+ "970",
1211
+ 0,
1212
+ null,
1213
+ "0"
1214
+ ],
1215
+ [
1216
+ "pa",
1217
+ // Panama
1218
+ "507"
1219
+ ],
1220
+ [
1221
+ "pg",
1222
+ // Papua New Guinea
1223
+ "675"
1224
+ ],
1225
+ [
1226
+ "py",
1227
+ // Paraguay
1228
+ "595",
1229
+ 0,
1230
+ null,
1231
+ "0"
1232
+ ],
1233
+ [
1234
+ "pe",
1235
+ // Peru
1236
+ "51",
1237
+ 0,
1238
+ null,
1239
+ "0"
1240
+ ],
1241
+ [
1242
+ "ph",
1243
+ // Philippines
1244
+ "63",
1245
+ 0,
1246
+ null,
1247
+ "0"
1248
+ ],
1249
+ [
1250
+ "pl",
1251
+ // Poland
1252
+ "48"
1253
+ ],
1254
+ [
1255
+ "pt",
1256
+ // Portugal
1257
+ "351"
1258
+ ],
1259
+ [
1260
+ "pr",
1261
+ // Puerto Rico
1262
+ "1",
1263
+ 3,
1264
+ ["787", "939"],
1265
+ "1"
1266
+ ],
1267
+ [
1268
+ "qa",
1269
+ // Qatar
1270
+ "974"
1271
+ ],
1272
+ [
1273
+ "re",
1274
+ // Réunion
1275
+ "262",
1276
+ 0,
1277
+ null,
1278
+ "0"
1279
+ ],
1280
+ [
1281
+ "ro",
1282
+ // Romania
1283
+ "40",
1284
+ 0,
1285
+ null,
1286
+ "0"
1287
+ ],
1288
+ [
1289
+ "ru",
1290
+ // Russia
1291
+ "7",
1292
+ 0,
1293
+ ["33"],
1294
+ // (shared with KZ)
1295
+ "8"
1296
+ ],
1297
+ [
1298
+ "rw",
1299
+ // Rwanda
1300
+ "250",
1301
+ 0,
1302
+ null,
1303
+ "0"
1304
+ ],
1305
+ [
1306
+ "ws",
1307
+ // Samoa
1308
+ "685"
1309
+ ],
1310
+ [
1311
+ "sm",
1312
+ // San Marino
1313
+ "378"
1314
+ ],
1315
+ [
1316
+ "st",
1317
+ // São Tomé & Príncipe
1318
+ "239"
1319
+ ],
1320
+ [
1321
+ "sa",
1322
+ // Saudi Arabia
1323
+ "966",
1324
+ 0,
1325
+ null,
1326
+ "0"
1327
+ ],
1328
+ [
1329
+ "sn",
1330
+ // Senegal
1331
+ "221"
1332
+ ],
1333
+ [
1334
+ "rs",
1335
+ // Serbia
1336
+ "381",
1337
+ 0,
1338
+ null,
1339
+ "0"
1340
+ ],
1341
+ [
1342
+ "sc",
1343
+ // Seychelles
1344
+ "248"
1345
+ ],
1346
+ [
1347
+ "sl",
1348
+ // Sierra Leone
1349
+ "232",
1350
+ 0,
1351
+ null,
1352
+ "0"
1353
+ ],
1354
+ [
1355
+ "sg",
1356
+ // Singapore
1357
+ "65"
1358
+ ],
1359
+ [
1360
+ "sx",
1361
+ // Sint Maarten
1362
+ "1",
1363
+ 21,
1364
+ ["721"],
1365
+ "1"
1366
+ ],
1367
+ [
1368
+ "sk",
1369
+ // Slovakia
1370
+ "421",
1371
+ 0,
1372
+ null,
1373
+ "0"
1374
+ ],
1375
+ [
1376
+ "si",
1377
+ // Slovenia
1378
+ "386",
1379
+ 0,
1380
+ null,
1381
+ "0"
1382
+ ],
1383
+ [
1384
+ "sb",
1385
+ // Solomon Islands
1386
+ "677"
1387
+ ],
1388
+ [
1389
+ "so",
1390
+ // Somalia
1391
+ "252",
1392
+ 0,
1393
+ null,
1394
+ "0"
1395
+ ],
1396
+ [
1397
+ "za",
1398
+ // South Africa
1399
+ "27",
1400
+ 0,
1401
+ null,
1402
+ "0"
1403
+ ],
1404
+ [
1405
+ "kr",
1406
+ // South Korea
1407
+ "82",
1408
+ 0,
1409
+ null,
1410
+ "0"
1411
+ ],
1412
+ [
1413
+ "ss",
1414
+ // South Sudan
1415
+ "211",
1416
+ 0,
1417
+ null,
1418
+ "0"
1419
+ ],
1420
+ [
1421
+ "es",
1422
+ // Spain
1423
+ "34"
1424
+ ],
1425
+ [
1426
+ "lk",
1427
+ // Sri Lanka
1428
+ "94",
1429
+ 0,
1430
+ null,
1431
+ "0"
1432
+ ],
1433
+ [
1434
+ "bl",
1435
+ // St. Barthélemy
1436
+ "590",
1437
+ 1,
1438
+ null,
1439
+ "0"
1440
+ ],
1441
+ [
1442
+ "sh",
1443
+ // St. Helena
1444
+ "290"
1445
+ ],
1446
+ [
1447
+ "kn",
1448
+ // St. Kitts & Nevis
1449
+ "1",
1450
+ 18,
1451
+ ["869"],
1452
+ "1"
1453
+ ],
1454
+ [
1455
+ "lc",
1456
+ // St. Lucia
1457
+ "1",
1458
+ 19,
1459
+ ["758"],
1460
+ "1"
1461
+ ],
1462
+ [
1463
+ "mf",
1464
+ // St. Martin
1465
+ "590",
1466
+ 2,
1467
+ null,
1468
+ "0"
1469
+ ],
1470
+ [
1471
+ "pm",
1472
+ // St. Pierre & Miquelon
1473
+ "508",
1474
+ 0,
1475
+ null,
1476
+ "0"
1477
+ ],
1478
+ [
1479
+ "vc",
1480
+ // St. Vincent & Grenadines
1481
+ "1",
1482
+ 20,
1483
+ ["784"],
1484
+ "1"
1485
+ ],
1486
+ [
1487
+ "sd",
1488
+ // Sudan
1489
+ "249",
1490
+ 0,
1491
+ null,
1492
+ "0"
1493
+ ],
1494
+ [
1495
+ "sr",
1496
+ // Suriname
1497
+ "597"
1498
+ ],
1499
+ [
1500
+ "sj",
1501
+ // Svalbard & Jan Mayen
1502
+ "47",
1503
+ 1,
1504
+ ["4", "79", "9"]
1505
+ // (4 and 9 are mobile ranges shared with NO)
1506
+ ],
1507
+ [
1508
+ "se",
1509
+ // Sweden
1510
+ "46",
1511
+ 0,
1512
+ null,
1513
+ "0"
1514
+ ],
1515
+ [
1516
+ "ch",
1517
+ // Switzerland
1518
+ "41",
1519
+ 0,
1520
+ null,
1521
+ "0"
1522
+ ],
1523
+ [
1524
+ "sy",
1525
+ // Syria
1526
+ "963",
1527
+ 0,
1528
+ null,
1529
+ "0"
1530
+ ],
1531
+ [
1532
+ "tw",
1533
+ // Taiwan
1534
+ "886",
1535
+ 0,
1536
+ null,
1537
+ "0"
1538
+ ],
1539
+ [
1540
+ "tj",
1541
+ // Tajikistan
1542
+ "992"
1543
+ ],
1544
+ [
1545
+ "tz",
1546
+ // Tanzania
1547
+ "255",
1548
+ 0,
1549
+ null,
1550
+ "0"
1551
+ ],
1552
+ [
1553
+ "th",
1554
+ // Thailand
1555
+ "66",
1556
+ 0,
1557
+ null,
1558
+ "0"
1559
+ ],
1560
+ [
1561
+ "tl",
1562
+ // Timor-Leste
1563
+ "670"
1564
+ ],
1565
+ [
1566
+ "tg",
1567
+ // Togo
1568
+ "228"
1569
+ ],
1570
+ [
1571
+ "tk",
1572
+ // Tokelau
1573
+ "690"
1574
+ ],
1575
+ [
1576
+ "to",
1577
+ // Tonga
1578
+ "676"
1579
+ ],
1580
+ [
1581
+ "tt",
1582
+ // Trinidad & Tobago
1583
+ "1",
1584
+ 22,
1585
+ ["868"],
1586
+ "1"
1587
+ ],
1588
+ [
1589
+ "tn",
1590
+ // Tunisia
1591
+ "216"
1592
+ ],
1593
+ [
1594
+ "tr",
1595
+ // Turkey
1596
+ "90",
1597
+ 0,
1598
+ null,
1599
+ "0"
1600
+ ],
1601
+ [
1602
+ "tm",
1603
+ // Turkmenistan
1604
+ "993",
1605
+ 0,
1606
+ null,
1607
+ "8"
1608
+ ],
1609
+ [
1610
+ "tc",
1611
+ // Turks & Caicos Islands
1612
+ "1",
1613
+ 23,
1614
+ ["649"],
1615
+ "1"
1616
+ ],
1617
+ [
1618
+ "tv",
1619
+ // Tuvalu
1620
+ "688"
1621
+ ],
1622
+ [
1623
+ "vi",
1624
+ // U.S. Virgin Islands
1625
+ "1",
1626
+ 24,
1627
+ ["340"],
1628
+ "1"
1629
+ ],
1630
+ [
1631
+ "ug",
1632
+ // Uganda
1633
+ "256",
1634
+ 0,
1635
+ null,
1636
+ "0"
1637
+ ],
1638
+ [
1639
+ "ua",
1640
+ // Ukraine
1641
+ "380",
1642
+ 0,
1643
+ null,
1644
+ "0"
1645
+ ],
1646
+ [
1647
+ "ae",
1648
+ // United Arab Emirates
1649
+ "971",
1650
+ 0,
1651
+ null,
1652
+ "0"
1653
+ ],
1654
+ [
1655
+ "gb",
1656
+ // United Kingdom
1657
+ "44",
1658
+ 0,
1659
+ null,
1660
+ "0"
1661
+ ],
1662
+ [
1663
+ "us",
1664
+ // United States
1665
+ "1",
1666
+ 0,
1667
+ null,
1668
+ "1"
1669
+ ],
1670
+ [
1671
+ "uy",
1672
+ // Uruguay
1673
+ "598",
1674
+ 0,
1675
+ null,
1676
+ "0"
1677
+ ],
1678
+ [
1679
+ "uz",
1680
+ // Uzbekistan
1681
+ "998"
1682
+ ],
1683
+ [
1684
+ "vu",
1685
+ // Vanuatu
1686
+ "678"
1687
+ ],
1688
+ [
1689
+ "va",
1690
+ // Vatican City
1691
+ "39",
1692
+ 1,
1693
+ ["06698", "3"]
1694
+ // (3 is a mobile range shared with IT)
1695
+ ],
1696
+ [
1697
+ "ve",
1698
+ // Venezuela
1699
+ "58",
1700
+ 0,
1701
+ null,
1702
+ "0"
1703
+ ],
1704
+ [
1705
+ "vn",
1706
+ // Vietnam
1707
+ "84",
1708
+ 0,
1709
+ null,
1710
+ "0"
1711
+ ],
1712
+ [
1713
+ "wf",
1714
+ // Wallis & Futuna
1715
+ "681"
1716
+ ],
1717
+ [
1718
+ "eh",
1719
+ // Western Sahara
1720
+ "212",
1721
+ 1,
1722
+ ["5288", "5289", "6", "7"],
1723
+ // (6 and 7 are mobile ranges shared with MA)
1724
+ "0"
1725
+ ],
1726
+ [
1727
+ "ye",
1728
+ // Yemen
1729
+ "967",
1730
+ 0,
1731
+ null,
1732
+ "0"
1733
+ ],
1734
+ [
1735
+ "zm",
1736
+ // Zambia
1737
+ "260",
1738
+ 0,
1739
+ null,
1740
+ "0"
1741
+ ],
1742
+ [
1743
+ "zw",
1744
+ // Zimbabwe
1745
+ "263",
1746
+ 0,
1747
+ null,
1748
+ "0"
1749
+ ]
1750
+ ];
1751
+ var allCountries = [];
1752
+ for (const c of rawCountryData) {
1753
+ allCountries.push({
1754
+ name: "",
1755
+ // populated in the plugin
1756
+ iso2: c[0],
1757
+ dialCode: c[1],
1758
+ priority: c[2] || 0,
1759
+ areaCodes: c[3] || null,
1760
+ nodeById: {},
1761
+ // populated by the plugin
1762
+ nationalPrefix: c[4] || null,
1763
+ normalisedName: "",
1764
+ // populated in the plugin
1765
+ initials: "",
1766
+ // populated in the plugin
1767
+ dialCodePlus: ""
1768
+ // populated in the plugin
1769
+ });
1770
+ }
1771
+ var iso2Set = new Set(allCountries.map((c) => c.iso2));
1772
+ var isIso2 = (val) => iso2Set.has(val);
1773
+ var data_default = allCountries;
1774
+
1775
+ // src/js/modules/constants.ts
1776
+ var EVENTS = {
1777
+ OPEN_COUNTRY_DROPDOWN: "open:countrydropdown",
1778
+ CLOSE_COUNTRY_DROPDOWN: "close:countrydropdown",
1779
+ COUNTRY_CHANGE: "countrychange",
1780
+ INPUT: "input"
1781
+ // used for synthetic input trigger
1782
+ };
1783
+ var CLASSES = {
1784
+ HIDE: "iti__hide",
1785
+ V_HIDE: "iti__v-hide",
1786
+ ARROW_UP: "iti__arrow--up",
1787
+ GLOBE: "iti__globe",
1788
+ FLAG: "iti__flag",
1789
+ LOADING: "iti__loading",
1790
+ COUNTRY_ITEM: "iti__country",
1791
+ HIGHLIGHT: "iti__highlight"
1792
+ };
1793
+ var KEYS = {
1794
+ ARROW_UP: "ArrowUp",
1795
+ ARROW_DOWN: "ArrowDown",
1796
+ SPACE: " ",
1797
+ ENTER: "Enter",
1798
+ ESC: "Escape",
1799
+ TAB: "Tab"
1800
+ };
1801
+ var INPUT_TYPES = {
1802
+ PASTE: "insertFromPaste",
1803
+ DELETE_FWD: "deleteContentForward"
1804
+ };
1805
+ var REGEX = {
1806
+ ALPHA_UNICODE: /\p{L}/u,
1807
+ // any kind of letter from any language
1808
+ NON_PLUS_NUMERIC: /[^+0-9]/,
1809
+ // chars that are NOT + or digit
1810
+ NON_PLUS_NUMERIC_GLOBAL: /[^+0-9]/g,
1811
+ // chars that are NOT + or digit (global)
1812
+ HIDDEN_SEARCH_CHAR: /^[a-zA-ZÀ-ÿа-яА-Я ]$/
1813
+ // single acceptable hidden-search char
1814
+ };
1815
+ var TIMINGS = {
1816
+ SEARCH_DEBOUNCE_MS: 100,
1817
+ HIDDEN_SEARCH_RESET_MS: 1e3};
1818
+ var SENTINELS = {
1819
+ UNKNOWN_NUMBER_TYPE: -99,
1820
+ UNKNOWN_VALIDATION_ERROR: -99
1821
+ };
1822
+ var LAYOUT = {
1823
+ NARROW_VIEWPORT_WIDTH: 500,
1824
+ // keep in sync with .iti__country-list CSS media query
1825
+ SANE_SELECTED_WITH_DIAL_WIDTH: 78,
1826
+ // px width fallback when separateDialCode enabled
1827
+ SANE_SELECTED_NO_DIAL_WIDTH: 42,
1828
+ // px width fallback when no separate dial code
1829
+ INPUT_PADDING_EXTRA_LEFT: 6,
1830
+ // px gap between selected country container and input text
1831
+ DROPDOWN_MARGIN: 3,
1832
+ // px margin between dropdown and tel input
1833
+ SANE_DROPDOWN_HEIGHT: 200
1834
+ // px height fallback for dropdown
1835
+ };
1836
+ var DIAL = {
1837
+ NANP: "1"
1838
+ // North American Numbering Plan
1839
+ };
1840
+ var UK = {
1841
+ DIAL_CODE: "44",
1842
+ // +44 United Kingdom
1843
+ MOBILE_PREFIX: "7",
1844
+ // UK mobile numbers start with 7 after national trunk (0) or core section
1845
+ MOBILE_CORE_LENGTH: 10
1846
+ // core number length (excluding dial code / national prefix) for mobiles
1847
+ };
1848
+ var US = {
1849
+ ISO2: "us"};
1850
+ var PLACEHOLDER_MODES = {
1851
+ AGGRESSIVE: "aggressive",
1852
+ POLITE: "polite",
1853
+ OFF: "off"
1854
+ };
1855
+ var INITIAL_COUNTRY = {
1856
+ AUTO: "auto"
1857
+ };
1858
+ var NUMBER_TYPES = [
1859
+ "FIXED_LINE",
1860
+ "MOBILE",
1861
+ "FIXED_LINE_OR_MOBILE",
1862
+ "TOLL_FREE",
1863
+ "PREMIUM_RATE",
1864
+ "SHARED_COST",
1865
+ "VOIP",
1866
+ "PERSONAL_NUMBER",
1867
+ "PAGER",
1868
+ "UAN",
1869
+ "VOICEMAIL",
1870
+ "UNKNOWN"
1871
+ ];
1872
+ var NUMBER_TYPE_SET = new Set(NUMBER_TYPES);
1873
+ var DATA_KEYS = {
1874
+ COUNTRY_CODE: "countryCode",
1875
+ DIAL_CODE: "dialCode"
1876
+ };
1877
+ var ARIA = {
1878
+ EXPANDED: "aria-expanded",
1879
+ LABEL: "aria-label",
1880
+ SELECTED: "aria-selected",
1881
+ ACTIVE_DESCENDANT: "aria-activedescendant",
1882
+ HASPOPUP: "aria-haspopup",
1883
+ CONTROLS: "aria-controls",
1884
+ HIDDEN: "aria-hidden",
1885
+ AUTOCOMPLETE: "aria-autocomplete",
1886
+ MODAL: "aria-modal"
1887
+ };
1888
+
1889
+ // src/js/intl-tel-input/i18n/en/index.ts
1890
+ var interfaceTranslations = {
1891
+ selectedCountryAriaLabel: "Change country, selected ${countryName} (${dialCode})",
1892
+ noCountrySelected: "Select country",
1893
+ countryListAriaLabel: "List of countries",
1894
+ searchPlaceholder: "Search",
1895
+ clearSearchAriaLabel: "Clear search",
1896
+ searchEmptyState: "No results found",
1897
+ searchSummaryAria(count) {
1898
+ if (count === 0) {
1899
+ return "No results found";
1900
+ }
1901
+ if (count === 1) {
1902
+ return "1 result found";
1903
+ }
1904
+ return `${count} results found`;
1905
+ }
1906
+ };
1907
+ var en_default = interfaceTranslations;
1908
+
1909
+ // src/js/modules/core/options.ts
1910
+ var mq = (q) => typeof window !== "undefined" && typeof window.matchMedia === "function" && window.matchMedia(q).matches;
1911
+ var isNarrowViewport = () => mq(`(max-width: ${LAYOUT.NARROW_VIEWPORT_WIDTH}px)`);
1912
+ var computeDefaultUseFullscreenPopup = () => {
1913
+ if (typeof navigator !== "undefined" && typeof window !== "undefined") {
1914
+ const isShortViewport = mq("(max-height: 600px)");
1915
+ const isCoarsePointer = mq("(pointer: coarse)");
1916
+ return isNarrowViewport() || isCoarsePointer && isShortViewport;
1917
+ }
1918
+ return false;
1919
+ };
1920
+ var defaults = {
1921
+ //* Whether or not to allow the dropdown.
1922
+ allowDropdown: true,
1923
+ //* The number type to enforce during validation.
1924
+ allowedNumberTypes: ["MOBILE", "FIXED_LINE"],
1925
+ //* Whether or not to allow extensions after the main number.
1926
+ allowNumberExtensions: false,
1927
+ // Allow alphanumeric "phonewords" (e.g. +1 800 FLOWERS) as valid numbers
1928
+ allowPhonewords: false,
1929
+ //* Add a placeholder in the input with an example number for the selected country.
1930
+ autoPlaceholder: PLACEHOLDER_MODES.POLITE,
1931
+ //* Add a custom class to the (injected) container element.
1932
+ containerClass: "",
1933
+ //* Locale for localising country names via Intl.DisplayNames.
1934
+ countryNameLocale: "en",
1935
+ //* The order of the countries in the dropdown. Defaults to alphabetical.
1936
+ countryOrder: null,
1937
+ //* Add a country search input at the top of the dropdown.
1938
+ countrySearch: true,
1939
+ //* Modify the auto placeholder.
1940
+ customPlaceholder: null,
1941
+ //* Always show the dropdown
1942
+ dropdownAlwaysOpen: false,
1943
+ //* Append menu to specified element.
1944
+ dropdownContainer: null,
1945
+ //* Don't display these countries.
1946
+ excludeCountries: [],
1947
+ //* Fix the dropdown width to the input width (rather than being as wide as the longest country name).
1948
+ fixDropdownWidth: true,
1949
+ //* Format the number as the user types
1950
+ formatAsYouType: true,
1951
+ //* Format the input value during initialisation and on setNumber.
1952
+ formatOnDisplay: true,
1953
+ //* geoIp lookup function.
1954
+ geoIpLookup: null,
1955
+ //* Inject a hidden input with the name returned from this function, and on submit, populate it with the result of getNumber.
1956
+ hiddenInput: null,
1957
+ //* Internationalise the plugin text e.g. search input placeholder, country names.
1958
+ i18n: {},
1959
+ //* Initial country.
1960
+ initialCountry: "",
1961
+ //* A function to load the utils script.
1962
+ loadUtils: null,
1963
+ //* National vs international formatting for numbers e.g. placeholders and displaying existing numbers.
1964
+ nationalMode: true,
1965
+ //* Display only these countries.
1966
+ onlyCountries: [],
1967
+ //* Number type to use for placeholders.
1968
+ placeholderNumberType: "MOBILE",
1969
+ //* Add custom classes to the search input element.
1970
+ searchInputClass: "",
1971
+ //* Display the international dial code next to the selected flag.
1972
+ separateDialCode: false,
1973
+ //* Show flags - for both the selected country, and in the country dropdown
1974
+ showFlags: true,
1975
+ //* Only allow certain chars e.g. a plus followed by numeric digits, and cap at max valid length.
1976
+ strictMode: false,
1977
+ //* Use full screen popup instead of dropdown for country list.
1978
+ useFullscreenPopup: computeDefaultUseFullscreenPopup()
1979
+ };
1980
+ var toString = (val) => JSON.stringify(val);
1981
+ var isPlainObject = (val) => Boolean(val) && typeof val === "object" && !Array.isArray(val);
1982
+ var isFn = (val) => typeof val === "function";
1983
+ var isElLike = (val) => {
1984
+ if (!val || typeof val !== "object") return false;
1985
+ const v = val;
1986
+ return v.nodeType === 1 && typeof v.tagName === "string" && typeof v.appendChild === "function";
1987
+ };
1988
+ var placeholderModeSet = new Set(Object.values(PLACEHOLDER_MODES));
1989
+ var warn = (message) => {
1990
+ console.warn(`[intl-tel-input] ${message}`);
1991
+ };
1992
+ var warnOption = (optionName, expectedType, actualValue) => {
1993
+ warn(`Option '${optionName}' must be ${expectedType}; got ${toString(actualValue)}. Ignoring.`);
1994
+ };
1995
+ var hasOwn = (obj, key) => Object.prototype.hasOwnProperty.call(obj, key);
1996
+ var validateIso2Array = (key, value) => {
1997
+ const expectedType = "an array of ISO2 country code strings";
1998
+ if (!Array.isArray(value)) {
1999
+ warnOption(key, expectedType, value);
2000
+ return false;
2001
+ }
2002
+ const valid = [];
2003
+ for (const v of value) {
2004
+ if (typeof v !== "string") {
2005
+ warnOption(key, expectedType, value);
2006
+ return false;
2007
+ }
2008
+ const lower = v.toLowerCase();
2009
+ if (!isIso2(lower)) {
2010
+ warn(`Invalid country code in '${key}': '${v}'. Skipping.`);
2011
+ } else {
2012
+ valid.push(v);
2013
+ }
2014
+ }
2015
+ return valid;
2016
+ };
2017
+ var validateOptions = (customOptions) => {
2018
+ if (customOptions === void 0) {
2019
+ return {};
2020
+ }
2021
+ if (!isPlainObject(customOptions)) {
2022
+ const error = `The second argument must be an options object; got ${toString(customOptions)}. Using defaults.`;
2023
+ warn(error);
2024
+ return {};
2025
+ }
2026
+ const validatedOptions = {};
2027
+ for (const [key, value] of Object.entries(customOptions)) {
2028
+ if (!hasOwn(defaults, key)) {
2029
+ warn(`Unknown option '${key}'. Ignoring.`);
2030
+ continue;
2031
+ }
2032
+ switch (key) {
2033
+ case "allowDropdown":
2034
+ case "allowNumberExtensions":
2035
+ case "allowPhonewords":
2036
+ case "countrySearch":
2037
+ case "dropdownAlwaysOpen":
2038
+ case "fixDropdownWidth":
2039
+ case "formatAsYouType":
2040
+ case "formatOnDisplay":
2041
+ case "nationalMode":
2042
+ case "showFlags":
2043
+ case "separateDialCode":
2044
+ case "strictMode":
2045
+ case "useFullscreenPopup":
2046
+ if (typeof value !== "boolean") {
2047
+ warnOption(key, "a boolean", value);
2048
+ break;
2049
+ }
2050
+ validatedOptions[key] = value;
2051
+ break;
2052
+ case "autoPlaceholder":
2053
+ if (typeof value !== "string" || !placeholderModeSet.has(value)) {
2054
+ const validModes = Array.from(placeholderModeSet).join(", ");
2055
+ warnOption("autoPlaceholder", `one of ${validModes}`, value);
2056
+ break;
2057
+ }
2058
+ validatedOptions[key] = value;
2059
+ break;
2060
+ case "containerClass":
2061
+ case "searchInputClass":
2062
+ case "countryNameLocale":
2063
+ if (typeof value !== "string") {
2064
+ warnOption(key, "a string", value);
2065
+ break;
2066
+ }
2067
+ validatedOptions[key] = value;
2068
+ break;
2069
+ case "countryOrder": {
2070
+ if (value === null) {
2071
+ validatedOptions[key] = value;
2072
+ } else {
2073
+ const filtered = validateIso2Array(key, value);
2074
+ if (filtered !== false) {
2075
+ validatedOptions[key] = filtered;
2076
+ }
2077
+ }
2078
+ break;
2079
+ }
2080
+ case "customPlaceholder":
2081
+ case "geoIpLookup":
2082
+ case "hiddenInput":
2083
+ case "loadUtils":
2084
+ if (value !== null && !isFn(value)) {
2085
+ warnOption(key, "a function or null", value);
2086
+ break;
2087
+ }
2088
+ validatedOptions[key] = value;
2089
+ break;
2090
+ case "dropdownContainer":
2091
+ if (value !== null && !isElLike(value)) {
2092
+ warnOption("dropdownContainer", "an HTMLElement or null", value);
2093
+ break;
2094
+ }
2095
+ validatedOptions[key] = value;
2096
+ break;
2097
+ case "excludeCountries":
2098
+ case "onlyCountries": {
2099
+ const filtered = validateIso2Array(key, value);
2100
+ if (filtered !== false) {
2101
+ validatedOptions[key] = filtered;
2102
+ }
2103
+ break;
2104
+ }
2105
+ case "i18n":
2106
+ if (value && !isPlainObject(value)) {
2107
+ warnOption("i18n", "an object", value);
2108
+ break;
2109
+ }
2110
+ validatedOptions[key] = value;
2111
+ break;
2112
+ case "initialCountry": {
2113
+ if (typeof value !== "string") {
2114
+ warnOption("initialCountry", "a string", value);
2115
+ break;
2116
+ }
2117
+ const lower = value.toLowerCase();
2118
+ if (lower && (lower !== INITIAL_COUNTRY.AUTO && !isIso2(lower))) {
2119
+ warnOption("initialCountry", "a valid ISO2 country code or 'auto'", value);
2120
+ break;
2121
+ }
2122
+ validatedOptions[key] = value;
2123
+ break;
2124
+ }
2125
+ case "placeholderNumberType":
2126
+ if (typeof value !== "string" || !NUMBER_TYPE_SET.has(value)) {
2127
+ const validTypes = Array.from(NUMBER_TYPE_SET).join(", ");
2128
+ warnOption("placeholderNumberType", `one of ${validTypes}`, value);
2129
+ break;
2130
+ }
2131
+ validatedOptions[key] = value;
2132
+ break;
2133
+ case "allowedNumberTypes":
2134
+ if (value !== null) {
2135
+ if (!Array.isArray(value)) {
2136
+ warnOption("allowedNumberTypes", "an array of number types or null", value);
2137
+ break;
2138
+ }
2139
+ let allValid = true;
2140
+ for (const v of value) {
2141
+ if (typeof v !== "string" || !NUMBER_TYPE_SET.has(v)) {
2142
+ const validTypes = Array.from(NUMBER_TYPE_SET).join(", ");
2143
+ warnOption("allowedNumberTypes", `an array of valid number types (${validTypes})`, v);
2144
+ allValid = false;
2145
+ break;
2146
+ }
2147
+ }
2148
+ if (allValid) {
2149
+ validatedOptions[key] = value;
2150
+ }
2151
+ } else {
2152
+ validatedOptions[key] = null;
2153
+ }
2154
+ break;
2155
+ }
2156
+ }
2157
+ return validatedOptions;
2158
+ };
2159
+ var normaliseOptions = (o) => {
2160
+ if (o.initialCountry) {
2161
+ o.initialCountry = o.initialCountry.toLowerCase();
2162
+ }
2163
+ if (o.onlyCountries?.length) {
2164
+ o.onlyCountries = o.onlyCountries.map((c) => c.toLowerCase());
2165
+ }
2166
+ if (o.excludeCountries?.length) {
2167
+ o.excludeCountries = o.excludeCountries.map((c) => c.toLowerCase());
2168
+ }
2169
+ if (o.countryOrder) {
2170
+ o.countryOrder = o.countryOrder.map((c) => c.toLowerCase());
2171
+ }
2172
+ };
2173
+ var applyOptionSideEffects = (o) => {
2174
+ if (o.dropdownAlwaysOpen) {
2175
+ o.useFullscreenPopup = false;
2176
+ o.allowDropdown = true;
2177
+ }
2178
+ if (o.useFullscreenPopup) {
2179
+ o.fixDropdownWidth = false;
2180
+ } else {
2181
+ if (isNarrowViewport()) {
2182
+ o.fixDropdownWidth = true;
2183
+ }
2184
+ }
2185
+ if (o.onlyCountries.length === 1) {
2186
+ o.initialCountry = o.onlyCountries[0];
2187
+ }
2188
+ if (o.separateDialCode) {
2189
+ o.nationalMode = false;
2190
+ }
2191
+ if (o.allowDropdown && !o.showFlags && !o.separateDialCode) {
2192
+ o.nationalMode = false;
2193
+ }
2194
+ if (o.useFullscreenPopup && !o.dropdownContainer) {
2195
+ o.dropdownContainer = document.body;
2196
+ }
2197
+ o.i18n = { ...en_default, ...o.i18n };
2198
+ };
2199
+
2200
+ // src/js/modules/utils/string.ts
2201
+ var getNumeric = (s) => s.replace(/\D/g, "");
2202
+ var normaliseString = (s = "") => s.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
2203
+
2204
+ // src/js/modules/utils/isAndroid.ts
2205
+ var getIsAndroid = () => typeof navigator !== "undefined" ? /Android/i.test(navigator.userAgent) : false;
2206
+
2207
+ // src/js/modules/core/countrySearch.ts
2208
+ var getMatchedCountries = (countries, query) => {
2209
+ const normalisedQuery = normaliseString(query);
2210
+ const iso2Matches = [];
2211
+ const nameStartWith = [];
2212
+ const nameContains = [];
2213
+ const dialCodeMatches = [];
2214
+ const dialCodeContains = [];
2215
+ const initialsMatches = [];
2216
+ for (const c of countries) {
2217
+ if (c.iso2 === normalisedQuery) {
2218
+ iso2Matches.push(c);
2219
+ } else if (c.normalisedName.startsWith(normalisedQuery)) {
2220
+ nameStartWith.push(c);
2221
+ } else if (c.normalisedName.includes(normalisedQuery)) {
2222
+ nameContains.push(c);
2223
+ } else if (normalisedQuery === c.dialCode || normalisedQuery === c.dialCodePlus) {
2224
+ dialCodeMatches.push(c);
2225
+ } else if (c.dialCodePlus.includes(normalisedQuery)) {
2226
+ dialCodeContains.push(c);
2227
+ } else if (c.initials.includes(normalisedQuery)) {
2228
+ initialsMatches.push(c);
2229
+ }
2230
+ }
2231
+ const sortByPriority = (a, b) => a.priority - b.priority;
2232
+ return [
2233
+ ...iso2Matches,
2234
+ ...nameStartWith,
2235
+ ...nameContains,
2236
+ // priority sort is only relevant when showing multiple countries with the same dial code (that's what the priority field is used to distinguish between)
2237
+ ...dialCodeMatches.sort(sortByPriority),
2238
+ ...dialCodeContains.sort(sortByPriority),
2239
+ ...initialsMatches
2240
+ ];
2241
+ };
2242
+ var findFirstCountryStartingWith = (countries, query) => {
2243
+ const normalisedQuery = normaliseString(query);
2244
+ for (const c of countries) {
2245
+ if (c.normalisedName.startsWith(normalisedQuery)) {
2246
+ return c;
2247
+ }
2248
+ }
2249
+ return null;
2250
+ };
2251
+
2252
+ // src/js/modules/utils/dom.ts
2253
+ var buildClassNames = (flags) => Object.keys(flags).filter((k) => Boolean(flags[k])).join(" ");
2254
+ var createEl = (tagName, attrs, container) => {
2255
+ const el = document.createElement(tagName);
2256
+ if (attrs) {
2257
+ Object.entries(attrs).forEach(
2258
+ ([key, value]) => el.setAttribute(key, value)
2259
+ );
2260
+ }
2261
+ if (container) {
2262
+ container.appendChild(el);
2263
+ }
2264
+ return el;
2265
+ };
2266
+
2267
+ // src/js/modules/core/icons.ts
2268
+ var buildSearchIcon = () => `
2269
+ <svg class="iti__search-icon-svg" width="14" height="14" viewBox="0 0 24 24" focusable="false" ${ARIA.HIDDEN}="true">
2270
+ <circle cx="11" cy="11" r="7" />
2271
+ <line x1="21" y1="21" x2="16.65" y2="16.65" />
2272
+ </svg>`;
2273
+ var buildClearIcon = (id2) => {
2274
+ const maskId = `iti-${id2}-clear-mask`;
2275
+ return `
2276
+ <svg class="iti__search-clear-svg" width="12" height="12" viewBox="0 0 16 16" ${ARIA.HIDDEN}="true" focusable="false">
2277
+ <mask id="${maskId}" maskUnits="userSpaceOnUse">
2278
+ <rect width="16" height="16" fill="white" />
2279
+ <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" />
2280
+ </mask>
2281
+ <circle cx="8" cy="8" r="8" class="iti__search-clear-bg" mask="url(#${maskId})" />
2282
+ </svg>`;
2283
+ };
2284
+ var buildCheckIcon = () => `
2285
+ <svg class="iti__country-check-svg" width="14" height="14" viewBox="0 0 16 16" fill="currentColor" focusable="false" ${ARIA.HIDDEN}="true">
2286
+ <path d="M16 8A8 8 0 1 1 0 8a8 8 0 0 1 16 0m-3.97-3.03a.75.75 0 0 0-1.08.022L7.477 9.417 5.384 7.323a.75.75 0 0 0-1.06 1.06L6.97 11.03a.75.75 0 0 0 1.079-.02l3.992-4.99a.75.75 0 0 0-.01-1.05z"/>
2287
+ </svg>`;
2288
+ var buildGlobeIcon = () => `
2289
+ <svg width="256" height="256" viewBox="0 0 512 512" class="iti__globe-svg">
2290
+ <path d="M508 213a240 240 0 0 0-449-87l-2 5-2 5c-8 14-13 30-17 46a65 65 0 0 1 56 4c16-10 35-19 56-27l9-3c-6 23-10 48-10 74h-16l4 6c3 4 5 8 6 13h6c0 22 3 44 8 65l2 10-25-10-4 5 12 18 9 3 6 2 8 3 9 26 1 2 16-7h1l-5-13-1-2c24 6 49 9 75 10v26l11 10 7 7v-30l1-13c22 0 44-3 65-8l10-2-21 48-1 1a317 317 0 0 1-14 23l-21 5h-2c6 16 7 33 1 50a240 240 0 0 0 211-265m-401-56-11 6c19-44 54-79 98-98-11 20-21 44-29 69-21 6-40 15-58 23m154 182v4c-29-1-57-6-81-13-7-25-12-52-13-81h94zm0-109h-94c1-29 6-56 13-81 24-7 52-12 81-13zm0-112c-22 1-44 4-65 8l-10 2 12-30 9-17 1-2a332 332 0 0 1 13-23c13-4 26-6 40-7zm187 69 6 4c4 12 6 25 6 38v1h-68c-1-26-4-51-10-74l48 20 1 1 14 8zm-14-44 10 20c-20-11-43-21-68-29-8-25-18-49-29-69 37 16 67 44 87 78M279 49h1c13 1 27 3 39 7l14 23 1 2a343 343 0 0 1 12 26l2 5 6 16c-23-6-48-9-74-10h-1zm0 87h1c29 1 56 6 81 13 7 24 12 51 12 80v1h-94zm2 207h-2v-94h95c-1 29-6 56-13 81-24 7-51 12-80 13m86 60-20 10c11-20 21-43 29-68 25-8 48-18 68-29-16 37-43 67-77 87m87-115-7 5-16 9-2 1a337 337 0 0 1-47 21c6-24 9-49 10-75h68c0 13-2 27-6 39"/>
2291
+ <path d="m261 428-2-2-22-21a40 40 0 0 0-32-11h-1a37 37 0 0 0-18 8l-1 1-4 2-2 2-5 4c-9-3-36-31-47-44s-32-45-34-55l3-2a151 151 0 0 0 11-9v-1a39 39 0 0 0 5-48l-3-3-11-19-3-4-5-7h-1l-3-3-4-3-5-2a35 35 0 0 0-16-3h-5c-4 1-14 5-24 11l-4 2-4 3-4 2c-9 8-17 17-18 27a380 380 0 0 0 212 259h3c12 0 25-10 36-21l10-12 6-11a39 39 0 0 0-8-40"/>
2292
+ </svg>`;
2293
+
2294
+ // src/js/modules/core/ui.ts
2295
+ var UI = class _UI {
2296
+ constructor(input, options, id2) {
2297
+ this.#searchKeyupTimer = null;
2298
+ this.#inlineDropdownHeight = null;
2299
+ this.#dropdownForContainer = null;
2300
+ this.#selectedItem = null;
2301
+ this.highlightedItem = null;
2302
+ input.dataset.intlTelInputId = id2.toString();
2303
+ this.telInput = input;
2304
+ this.#options = options;
2305
+ this.#id = id2;
2306
+ this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
2307
+ this.#isRTL = !!this.telInput.closest("[dir=rtl]");
2308
+ if (this.#options.separateDialCode) {
2309
+ this.#originalPaddingLeft = this.telInput.style.paddingLeft;
2310
+ }
2311
+ }
2312
+ // private
2313
+ #options;
2314
+ #id;
2315
+ #isRTL;
2316
+ #originalPaddingLeft;
2317
+ #countries;
2318
+ #searchKeyupTimer;
2319
+ #inlineDropdownHeight;
2320
+ #selectedDialCode;
2321
+ #dropdownArrow;
2322
+ #dropdownContent;
2323
+ #searchIcon;
2324
+ #searchNoResults;
2325
+ #searchResultsA11yText;
2326
+ #dropdownForContainer;
2327
+ #selectedItem;
2328
+ // Validate that the provided element is an HTMLInputElement.
2329
+ static validateInput(input) {
2330
+ const tagName = input?.tagName;
2331
+ const isInputEl = Boolean(input) && typeof input === "object" && tagName === "INPUT" && typeof input.setAttribute === "function";
2332
+ if (!isInputEl) {
2333
+ const type = Object.prototype.toString.call(input);
2334
+ throw new TypeError(
2335
+ `The first argument must be an HTMLInputElement, not ${type}`
2336
+ );
2337
+ }
2338
+ }
2339
+ //* Generate all of the markup for the plugin: the selected country overlay, and the dropdown.
2340
+ generateMarkup(countries) {
2341
+ this.#countries = countries;
2342
+ this.telInput.classList.add("iti__tel-input");
2343
+ if (!this.telInput.hasAttribute("autocomplete")) {
2344
+ this.telInput.setAttribute("autocomplete", "tel");
2345
+ }
2346
+ if (!this.telInput.hasAttribute("inputmode")) {
2347
+ this.telInput.setAttribute("inputmode", "tel");
2348
+ }
2349
+ const wrapper = this.#createWrapperAndInsert();
2350
+ this.#maybeBuildCountryContainer(wrapper);
2351
+ wrapper.appendChild(this.telInput);
2352
+ this.#maybeUpdateInputPaddingAndReveal();
2353
+ this.#maybeBuildHiddenInputs(wrapper);
2354
+ }
2355
+ #createWrapperAndInsert() {
2356
+ const {
2357
+ allowDropdown,
2358
+ showFlags,
2359
+ containerClass,
2360
+ useFullscreenPopup
2361
+ } = this.#options;
2362
+ const parentClasses = buildClassNames({
2363
+ iti: true,
2364
+ "iti--allow-dropdown": allowDropdown,
2365
+ "iti--show-flags": showFlags,
2366
+ "iti--inline-dropdown": !useFullscreenPopup,
2367
+ [containerClass]: Boolean(containerClass)
2368
+ });
2369
+ const wrapper = createEl("div", { class: parentClasses });
2370
+ if (this.#isRTL) {
2371
+ wrapper.setAttribute("dir", "ltr");
2372
+ }
2373
+ this.telInput.before(wrapper);
2374
+ return wrapper;
2375
+ }
2376
+ #maybeBuildCountryContainer(wrapper) {
2377
+ const { allowDropdown, separateDialCode, showFlags } = this.#options;
2378
+ if (allowDropdown || showFlags || separateDialCode) {
2379
+ this.countryContainer = createEl(
2380
+ "div",
2381
+ // visibly hidden until we measure it's width to set the input padding correctly
2382
+ { class: `iti__country-container ${CLASSES.V_HIDE}` },
2383
+ wrapper
2384
+ );
2385
+ if (allowDropdown) {
2386
+ this.selectedCountry = createEl(
2387
+ "button",
2388
+ {
2389
+ type: "button",
2390
+ class: "iti__selected-country",
2391
+ [ARIA.EXPANDED]: "false",
2392
+ [ARIA.LABEL]: this.#options.i18n.noCountrySelected,
2393
+ [ARIA.HASPOPUP]: "dialog",
2394
+ [ARIA.CONTROLS]: `iti-${this.#id}__dropdown-content`
2395
+ },
2396
+ this.countryContainer
2397
+ );
2398
+ if (this.telInput.disabled) {
2399
+ this.selectedCountry.setAttribute("disabled", "true");
2400
+ }
2401
+ } else {
2402
+ this.selectedCountry = createEl(
2403
+ "div",
2404
+ { class: "iti__selected-country" },
2405
+ this.countryContainer
2406
+ );
2407
+ }
2408
+ const selectedCountryPrimary = createEl(
2409
+ "div",
2410
+ { class: "iti__selected-country-primary" },
2411
+ this.selectedCountry
2412
+ );
2413
+ this.selectedCountryInner = createEl(
2414
+ "div",
2415
+ { class: CLASSES.FLAG },
2416
+ selectedCountryPrimary
2417
+ );
2418
+ if (allowDropdown) {
2419
+ this.#dropdownArrow = createEl(
2420
+ "div",
2421
+ { class: "iti__arrow", [ARIA.HIDDEN]: "true" },
2422
+ selectedCountryPrimary
2423
+ );
2424
+ }
2425
+ if (separateDialCode) {
2426
+ this.#selectedDialCode = createEl(
2427
+ "div",
2428
+ { class: "iti__selected-dial-code" },
2429
+ this.selectedCountry
2430
+ );
2431
+ }
2432
+ if (allowDropdown) {
2433
+ this.#buildDropdownContent();
2434
+ }
2435
+ }
2436
+ }
2437
+ #maybeEnsureDropdownWidthSet() {
2438
+ const { fixDropdownWidth } = this.#options;
2439
+ if (fixDropdownWidth && !this.#dropdownContent.style.width) {
2440
+ const inputWidth = this.telInput.offsetWidth;
2441
+ if (inputWidth > 0) {
2442
+ this.#dropdownContent.style.width = `${inputWidth}px`;
2443
+ }
2444
+ }
2445
+ }
2446
+ #buildDropdownContent() {
2447
+ const {
2448
+ fixDropdownWidth,
2449
+ useFullscreenPopup,
2450
+ countrySearch,
2451
+ i18n,
2452
+ dropdownContainer,
2453
+ containerClass
2454
+ } = this.#options;
2455
+ const extraClasses = fixDropdownWidth ? "" : "iti--flexible-dropdown-width";
2456
+ this.#dropdownContent = createEl("div", {
2457
+ id: `iti-${this.#id}__dropdown-content`,
2458
+ class: `iti__dropdown-content ${CLASSES.HIDE} ${extraClasses}`,
2459
+ role: "dialog",
2460
+ [ARIA.MODAL]: "true"
2461
+ });
2462
+ if (this.#isRTL) {
2463
+ this.#dropdownContent.setAttribute("dir", "rtl");
2464
+ }
2465
+ if (countrySearch) {
2466
+ this.#buildSearchUI();
2467
+ }
2468
+ this.countryList = createEl(
2469
+ "ul",
2470
+ {
2471
+ class: "iti__country-list",
2472
+ id: `iti-${this.#id}__country-listbox`,
2473
+ role: "listbox",
2474
+ [ARIA.LABEL]: i18n.countryListAriaLabel
2475
+ },
2476
+ this.#dropdownContent
2477
+ );
2478
+ this.#appendListItems();
2479
+ if (countrySearch) {
2480
+ this.#updateSearchResultsA11yText();
2481
+ }
2482
+ if (!useFullscreenPopup) {
2483
+ this.#maybeEnsureDropdownWidthSet();
2484
+ this.#inlineDropdownHeight = this.#getHiddenInlineDropdownHeight();
2485
+ if (countrySearch) {
2486
+ this.#dropdownContent.style.height = `${this.#inlineDropdownHeight}px`;
2487
+ }
2488
+ }
2489
+ if (dropdownContainer) {
2490
+ const dropdownClasses = buildClassNames({
2491
+ iti: true,
2492
+ "iti--container": true,
2493
+ "iti--fullscreen-popup": useFullscreenPopup,
2494
+ "iti--inline-dropdown": !useFullscreenPopup,
2495
+ [containerClass]: Boolean(containerClass)
2496
+ });
2497
+ this.#dropdownForContainer = createEl("div", { class: dropdownClasses });
2498
+ this.#dropdownForContainer.appendChild(this.#dropdownContent);
2499
+ } else {
2500
+ this.countryContainer.appendChild(this.#dropdownContent);
2501
+ }
2502
+ }
2503
+ #buildSearchUI() {
2504
+ const { i18n, searchInputClass } = this.#options;
2505
+ const searchWrapper = createEl(
2506
+ "div",
2507
+ { class: "iti__search-input-wrapper" },
2508
+ this.#dropdownContent
2509
+ );
2510
+ this.#searchIcon = createEl(
2511
+ "span",
2512
+ {
2513
+ class: "iti__search-icon",
2514
+ [ARIA.HIDDEN]: "true"
2515
+ },
2516
+ searchWrapper
2517
+ );
2518
+ this.#searchIcon.innerHTML = buildSearchIcon();
2519
+ this.searchInput = createEl(
2520
+ "input",
2521
+ {
2522
+ id: `iti-${this.#id}__search-input`,
2523
+ // Chrome says inputs need either a name or an id
2524
+ type: "search",
2525
+ class: `iti__search-input ${searchInputClass}`,
2526
+ placeholder: i18n.searchPlaceholder,
2527
+ // 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
2528
+ role: "combobox",
2529
+ [ARIA.EXPANDED]: "true",
2530
+ [ARIA.LABEL]: i18n.searchPlaceholder,
2531
+ [ARIA.CONTROLS]: `iti-${this.#id}__country-listbox`,
2532
+ [ARIA.AUTOCOMPLETE]: "list",
2533
+ autocomplete: "off"
2534
+ },
2535
+ searchWrapper
2536
+ );
2537
+ this.searchClearButton = createEl(
2538
+ "button",
2539
+ {
2540
+ type: "button",
2541
+ class: `iti__search-clear ${CLASSES.HIDE}`,
2542
+ [ARIA.LABEL]: i18n.clearSearchAriaLabel,
2543
+ tabindex: "-1"
2544
+ },
2545
+ searchWrapper
2546
+ );
2547
+ this.searchClearButton.innerHTML = buildClearIcon(this.#id);
2548
+ this.#searchResultsA11yText = createEl(
2549
+ "span",
2550
+ { class: "iti__a11y-text" },
2551
+ this.#dropdownContent
2552
+ );
2553
+ this.#searchNoResults = createEl(
2554
+ "div",
2555
+ {
2556
+ class: `iti__no-results ${CLASSES.HIDE}`,
2557
+ [ARIA.HIDDEN]: "true"
2558
+ // all a11y messaging happens in this.#searchResultsA11yText
2559
+ },
2560
+ this.#dropdownContent
2561
+ );
2562
+ this.#searchNoResults.textContent = i18n.searchEmptyState;
2563
+ }
2564
+ #maybeUpdateInputPaddingAndReveal() {
2565
+ if (this.countryContainer) {
2566
+ this.#updateInputPadding();
2567
+ this.countryContainer.classList.remove(CLASSES.V_HIDE);
2568
+ }
2569
+ }
2570
+ #maybeBuildHiddenInputs(wrapper) {
2571
+ const { hiddenInput } = this.#options;
2572
+ if (hiddenInput) {
2573
+ const telInputName = this.telInput.getAttribute("name") || "";
2574
+ const names = hiddenInput(telInputName);
2575
+ if (names.phone) {
2576
+ const existingInput = this.telInput.form?.querySelector(
2577
+ `input[name="${names.phone}"]`
2578
+ );
2579
+ if (existingInput) {
2580
+ this.hiddenInput = existingInput;
2581
+ } else {
2582
+ this.hiddenInput = createEl("input", {
2583
+ type: "hidden",
2584
+ name: names.phone
2585
+ });
2586
+ wrapper.appendChild(this.hiddenInput);
2587
+ }
2588
+ }
2589
+ if (names.country) {
2590
+ const existingInput = this.telInput.form?.querySelector(
2591
+ `input[name="${names.country}"]`
2592
+ );
2593
+ if (existingInput) {
2594
+ this.hiddenInputCountry = existingInput;
2595
+ } else {
2596
+ this.hiddenInputCountry = createEl("input", {
2597
+ type: "hidden",
2598
+ name: names.country
2599
+ });
2600
+ wrapper.appendChild(this.hiddenInputCountry);
2601
+ }
2602
+ }
2603
+ }
2604
+ }
2605
+ //* For each country: add a country list item <li> to the countryList <ul> container.
2606
+ #appendListItems() {
2607
+ const frag = document.createDocumentFragment();
2608
+ for (let i = 0; i < this.#countries.length; i++) {
2609
+ const c = this.#countries[i];
2610
+ const liClass = buildClassNames({
2611
+ [CLASSES.COUNTRY_ITEM]: true
2612
+ });
2613
+ const listItem = createEl("li", {
2614
+ id: `iti-${this.#id}__item-${c.iso2}`,
2615
+ class: liClass,
2616
+ tabindex: "-1",
2617
+ role: "option",
2618
+ [ARIA.SELECTED]: "false"
2619
+ });
2620
+ listItem.dataset.dialCode = c.dialCode;
2621
+ listItem.dataset.countryCode = c.iso2;
2622
+ c.nodeById[this.#id] = listItem;
2623
+ if (this.#options.showFlags) {
2624
+ createEl("div", { class: `${CLASSES.FLAG} iti__${c.iso2}` }, listItem);
2625
+ }
2626
+ const nameEl = createEl("span", { class: "iti__country-name" }, listItem);
2627
+ nameEl.textContent = `${c.name} `;
2628
+ const dialEl = createEl("span", { class: "iti__dial-code" }, nameEl);
2629
+ if (this.#isRTL) {
2630
+ dialEl.setAttribute("dir", "ltr");
2631
+ }
2632
+ dialEl.textContent = `(+${c.dialCode})`;
2633
+ frag.appendChild(listItem);
2634
+ }
2635
+ this.countryList.appendChild(frag);
2636
+ }
2637
+ //* Update the input padding to make space for the selected country/dial code.
2638
+ #updateInputPadding() {
2639
+ if (this.selectedCountry) {
2640
+ const fallbackWidth = this.#options.separateDialCode ? LAYOUT.SANE_SELECTED_WITH_DIAL_WIDTH : LAYOUT.SANE_SELECTED_NO_DIAL_WIDTH;
2641
+ const selectedCountryWidth = this.selectedCountry.offsetWidth || this.#getHiddenSelectedCountryWidth() || fallbackWidth;
2642
+ const inputPadding = selectedCountryWidth + LAYOUT.INPUT_PADDING_EXTRA_LEFT;
2643
+ this.telInput.style.paddingLeft = `${inputPadding}px`;
2644
+ }
2645
+ }
2646
+ static #getBody() {
2647
+ let body;
2648
+ try {
2649
+ body = window.top.document.body;
2650
+ } catch (e) {
2651
+ body = document.body;
2652
+ }
2653
+ return body;
2654
+ }
2655
+ //* When input is in a hidden container during init, we cannot calculate the selected country width.
2656
+ //* Fix: clone the markup, make it invisible, add it to the end of the DOM, and then measure it's width.
2657
+ //* To get the right styling to apply, all we need is a shallow clone of the container,
2658
+ //* and then to inject a deep clone of the selectedCountry element.
2659
+ #getHiddenSelectedCountryWidth() {
2660
+ if (this.telInput.parentNode) {
2661
+ const body = _UI.#getBody();
2662
+ const containerClone = this.telInput.parentNode.cloneNode(
2663
+ false
2664
+ );
2665
+ containerClone.style.visibility = "hidden";
2666
+ body.appendChild(containerClone);
2667
+ const countryContainerClone = this.countryContainer.cloneNode();
2668
+ containerClone.appendChild(countryContainerClone);
2669
+ const selectedCountryClone = this.selectedCountry.cloneNode(
2670
+ true
2671
+ );
2672
+ countryContainerClone.appendChild(selectedCountryClone);
2673
+ const width = selectedCountryClone.offsetWidth;
2674
+ body.removeChild(containerClone);
2675
+ return width;
2676
+ }
2677
+ return 0;
2678
+ }
2679
+ // this is run before we add the dropdown to the DOM
2680
+ #getHiddenInlineDropdownHeight() {
2681
+ const body = _UI.#getBody();
2682
+ this.#dropdownContent.classList.remove(CLASSES.HIDE);
2683
+ const tempContainer = createEl("div", { class: "iti iti--inline-dropdown" });
2684
+ tempContainer.appendChild(this.#dropdownContent);
2685
+ tempContainer.style.visibility = "hidden";
2686
+ body.appendChild(tempContainer);
2687
+ const height = this.#dropdownContent.offsetHeight;
2688
+ body.removeChild(tempContainer);
2689
+ tempContainer.style.visibility = "";
2690
+ this.#dropdownContent.classList.add(CLASSES.HIDE);
2691
+ return height > 0 ? height : LAYOUT.SANE_DROPDOWN_HEIGHT;
2692
+ }
2693
+ //* Update search results text (for a11y).
2694
+ #updateSearchResultsA11yText() {
2695
+ const { i18n } = this.#options;
2696
+ const count = this.countryList.childElementCount;
2697
+ this.#searchResultsA11yText.textContent = i18n.searchSummaryAria(count);
2698
+ }
2699
+ //* Country search: Filter the countries according to the search query.
2700
+ filterCountriesByQuery(query) {
2701
+ let matchedCountries;
2702
+ if (query === "") {
2703
+ matchedCountries = this.#countries;
2704
+ } else {
2705
+ matchedCountries = getMatchedCountries(this.#countries, query);
2706
+ }
2707
+ this.#filterCountries(matchedCountries);
2708
+ }
2709
+ // Search input handlers
2710
+ #doFilter() {
2711
+ const inputQuery = this.searchInput.value.trim();
2712
+ this.filterCountriesByQuery(inputQuery);
2713
+ if (this.searchInput.value) {
2714
+ this.searchClearButton.classList.remove(CLASSES.HIDE);
2715
+ } else {
2716
+ this.searchClearButton.classList.add(CLASSES.HIDE);
2717
+ }
2718
+ }
2719
+ handleSearchChange() {
2720
+ if (this.#searchKeyupTimer) {
2721
+ clearTimeout(this.#searchKeyupTimer);
2722
+ }
2723
+ this.#searchKeyupTimer = setTimeout(() => {
2724
+ this.#doFilter();
2725
+ this.#searchKeyupTimer = null;
2726
+ }, TIMINGS.SEARCH_DEBOUNCE_MS);
2727
+ }
2728
+ handleSearchClear() {
2729
+ this.searchInput.value = "";
2730
+ this.searchInput.focus();
2731
+ this.#doFilter();
2732
+ }
2733
+ //* Check if a country list item element is visible within it's container (the country list), else scroll until it is.
2734
+ scrollCountryListToItem(element) {
2735
+ const container = this.countryList;
2736
+ const containerRect = container.getBoundingClientRect();
2737
+ const elementRect = element.getBoundingClientRect();
2738
+ const offsetTop = elementRect.top - containerRect.top + container.scrollTop;
2739
+ if (elementRect.top < containerRect.top) {
2740
+ container.scrollTop = offsetTop;
2741
+ } else if (elementRect.bottom > containerRect.bottom) {
2742
+ container.scrollTop = offsetTop - containerRect.height + elementRect.height;
2743
+ }
2744
+ }
2745
+ //* Remove highlighting from the previous list item and highlight the new one.
2746
+ highlightListItem(listItem, shouldFocus) {
2747
+ const prevItem = this.highlightedItem;
2748
+ if (prevItem) {
2749
+ prevItem.classList.remove(CLASSES.HIGHLIGHT);
2750
+ }
2751
+ this.highlightedItem = listItem;
2752
+ if (this.highlightedItem) {
2753
+ this.highlightedItem.classList.add(CLASSES.HIGHLIGHT);
2754
+ if (this.#options.countrySearch) {
2755
+ const activeDescendant = this.highlightedItem.getAttribute("id") || "";
2756
+ this.searchInput.setAttribute(ARIA.ACTIVE_DESCENDANT, activeDescendant);
2757
+ }
2758
+ if (shouldFocus) {
2759
+ this.highlightedItem.focus();
2760
+ }
2761
+ }
2762
+ }
2763
+ //* Highlight the next/prev item in the list (and ensure it is visible).
2764
+ handleUpDownKey(key) {
2765
+ let next = key === KEYS.ARROW_UP ? this.highlightedItem?.previousElementSibling : this.highlightedItem?.nextElementSibling;
2766
+ if (!next && this.countryList.childElementCount > 1) {
2767
+ next = key === KEYS.ARROW_UP ? this.countryList.lastElementChild : this.countryList.firstElementChild;
2768
+ }
2769
+ if (next) {
2770
+ this.scrollCountryListToItem(next);
2771
+ this.highlightListItem(next, false);
2772
+ }
2773
+ }
2774
+ // Update the selected list item in the dropdown
2775
+ #updateSelectedItem(iso2) {
2776
+ if (this.#selectedItem && this.#selectedItem.dataset.countryCode !== iso2) {
2777
+ this.#selectedItem.setAttribute(ARIA.SELECTED, "false");
2778
+ this.#selectedItem.querySelector(".iti__country-check")?.remove();
2779
+ this.#selectedItem = null;
2780
+ }
2781
+ if (iso2 && !this.#selectedItem) {
2782
+ const newListItem = this.countryList.querySelector(
2783
+ `[data-country-code="${iso2}"]`
2784
+ );
2785
+ if (newListItem) {
2786
+ newListItem.setAttribute(ARIA.SELECTED, "true");
2787
+ const checkIcon = createEl(
2788
+ "span",
2789
+ { class: "iti__country-check", [ARIA.HIDDEN]: "true" },
2790
+ newListItem
2791
+ );
2792
+ checkIcon.innerHTML = buildCheckIcon();
2793
+ this.#selectedItem = newListItem;
2794
+ }
2795
+ }
2796
+ }
2797
+ //* Country search: Filter the country list to the given array of countries.
2798
+ #filterCountries(matchedCountries) {
2799
+ this.countryList.replaceChildren();
2800
+ let noCountriesAddedYet = true;
2801
+ for (const c of matchedCountries) {
2802
+ const listItem = c.nodeById[this.#id];
2803
+ if (listItem) {
2804
+ this.countryList.appendChild(listItem);
2805
+ if (noCountriesAddedYet) {
2806
+ this.highlightListItem(listItem, false);
2807
+ noCountriesAddedYet = false;
2808
+ }
2809
+ }
2810
+ }
2811
+ if (noCountriesAddedYet) {
2812
+ this.highlightListItem(null, false);
2813
+ if (this.#searchNoResults) {
2814
+ this.#searchNoResults.classList.remove(CLASSES.HIDE);
2815
+ }
2816
+ } else if (this.#searchNoResults) {
2817
+ this.#searchNoResults.classList.add(CLASSES.HIDE);
2818
+ }
2819
+ this.countryList.scrollTop = 0;
2820
+ this.#updateSearchResultsA11yText();
2821
+ }
2822
+ destroy() {
2823
+ this.telInput.iti = void 0;
2824
+ delete this.telInput.dataset.intlTelInputId;
2825
+ if (this.#options.separateDialCode) {
2826
+ this.telInput.style.paddingLeft = this.#originalPaddingLeft;
2827
+ }
2828
+ const wrapper = this.telInput.parentNode;
2829
+ wrapper.before(this.telInput);
2830
+ wrapper.remove();
2831
+ this.telInput = null;
2832
+ this.countryContainer = null;
2833
+ this.selectedCountry = null;
2834
+ this.selectedCountryInner = null;
2835
+ this.searchInput = null;
2836
+ this.searchClearButton = null;
2837
+ this.countryList = null;
2838
+ this.hiddenInput = null;
2839
+ this.hiddenInputCountry = null;
2840
+ this.highlightedItem = null;
2841
+ this.#selectedDialCode = null;
2842
+ this.#dropdownArrow = null;
2843
+ this.#dropdownContent = null;
2844
+ this.#searchIcon = null;
2845
+ this.#searchNoResults = null;
2846
+ this.#searchResultsA11yText = null;
2847
+ this.#dropdownForContainer = null;
2848
+ this.#selectedItem = null;
2849
+ for (const c of this.#countries) {
2850
+ delete c.nodeById[this.#id];
2851
+ }
2852
+ this.#countries = null;
2853
+ }
2854
+ // UI: Open the dropdown (DOM only).
2855
+ openDropdown() {
2856
+ const {
2857
+ countrySearch,
2858
+ dropdownAlwaysOpen,
2859
+ dropdownContainer
2860
+ } = this.#options;
2861
+ this.#maybeEnsureDropdownWidthSet();
2862
+ if (dropdownContainer) {
2863
+ this.#handleDropdownContainer();
2864
+ } else {
2865
+ const positionBelow = this.#shouldPositionInlineDropdownBelowInput();
2866
+ const distance = this.telInput.offsetHeight + LAYOUT.DROPDOWN_MARGIN;
2867
+ if (positionBelow) {
2868
+ this.#dropdownContent.style.top = `${distance}px`;
2869
+ } else {
2870
+ this.#dropdownContent.style.bottom = `${distance}px`;
2871
+ }
2872
+ }
2873
+ this.#dropdownContent.classList.remove(CLASSES.HIDE);
2874
+ this.selectedCountry.setAttribute(ARIA.EXPANDED, "true");
2875
+ if (countrySearch) {
2876
+ const firstCountryItem = this.countryList.firstElementChild;
2877
+ if (firstCountryItem) {
2878
+ this.highlightListItem(firstCountryItem, false);
2879
+ this.countryList.scrollTop = 0;
2880
+ }
2881
+ if (!dropdownAlwaysOpen) {
2882
+ this.searchInput.focus();
2883
+ }
2884
+ }
2885
+ this.#dropdownArrow.classList.add(CLASSES.ARROW_UP);
2886
+ }
2887
+ // UI: Close the dropdown (DOM only).
2888
+ closeDropdown() {
2889
+ const { countrySearch, dropdownContainer } = this.#options;
2890
+ this.#dropdownContent.classList.add(CLASSES.HIDE);
2891
+ this.selectedCountry.setAttribute(ARIA.EXPANDED, "false");
2892
+ if (countrySearch) {
2893
+ this.searchInput.removeAttribute(ARIA.ACTIVE_DESCENDANT);
2894
+ if (this.highlightedItem) {
2895
+ this.highlightedItem.classList.remove(CLASSES.HIGHLIGHT);
2896
+ this.highlightedItem = null;
2897
+ }
2898
+ }
2899
+ this.#dropdownArrow.classList.remove(CLASSES.ARROW_UP);
2900
+ if (dropdownContainer) {
2901
+ this.#dropdownForContainer.remove();
2902
+ this.#dropdownForContainer.style.top = "";
2903
+ this.#dropdownForContainer.style.bottom = "";
2904
+ this.#dropdownForContainer.style.paddingLeft = "";
2905
+ this.#dropdownForContainer.style.paddingRight = "";
2906
+ } else {
2907
+ this.#dropdownContent.style.top = "";
2908
+ this.#dropdownContent.style.bottom = "";
2909
+ }
2910
+ }
2911
+ #shouldPositionInlineDropdownBelowInput() {
2912
+ if (this.#options.dropdownAlwaysOpen) {
2913
+ return true;
2914
+ }
2915
+ const inputPos = this.telInput.getBoundingClientRect();
2916
+ const spaceAbove = inputPos.top;
2917
+ const spaceBelow = window.innerHeight - inputPos.bottom;
2918
+ return spaceBelow >= this.#inlineDropdownHeight || spaceBelow >= spaceAbove;
2919
+ }
2920
+ // inject dropdown into container and apply positioning styles
2921
+ #handleDropdownContainer() {
2922
+ const { dropdownContainer, useFullscreenPopup } = this.#options;
2923
+ if (useFullscreenPopup) {
2924
+ if (window.innerWidth >= LAYOUT.NARROW_VIEWPORT_WIDTH) {
2925
+ const inputPos = this.telInput.getBoundingClientRect();
2926
+ this.#dropdownForContainer.style.paddingLeft = `${inputPos.left}px`;
2927
+ this.#dropdownForContainer.style.paddingRight = `${window.innerWidth - inputPos.right}px`;
2928
+ }
2929
+ } else {
2930
+ const inputPos = this.telInput.getBoundingClientRect();
2931
+ this.#dropdownForContainer.style.left = `${inputPos.left}px`;
2932
+ const positionBelow = this.#shouldPositionInlineDropdownBelowInput();
2933
+ if (positionBelow) {
2934
+ this.#dropdownForContainer.style.top = `${inputPos.bottom + LAYOUT.DROPDOWN_MARGIN}px`;
2935
+ } else {
2936
+ this.#dropdownForContainer.style.top = "unset";
2937
+ this.#dropdownForContainer.style.bottom = `${window.innerHeight - inputPos.top + LAYOUT.DROPDOWN_MARGIN}px`;
2938
+ }
2939
+ }
2940
+ dropdownContainer.appendChild(this.#dropdownForContainer);
2941
+ }
2942
+ // UI: Whether the dropdown is currently closed (hidden).
2943
+ isDropdownClosed() {
2944
+ return this.#dropdownContent.classList.contains(CLASSES.HIDE);
2945
+ }
2946
+ setCountry(selectedCountryData) {
2947
+ const { allowDropdown, showFlags, separateDialCode, i18n } = this.#options;
2948
+ const { name, dialCode, iso2 = "" } = selectedCountryData;
2949
+ if (allowDropdown) {
2950
+ this.#updateSelectedItem(iso2);
2951
+ }
2952
+ if (this.selectedCountry) {
2953
+ const flagClass = iso2 && showFlags ? `${CLASSES.FLAG} iti__${iso2}` : `${CLASSES.FLAG} ${CLASSES.GLOBE}`;
2954
+ let ariaLabel, title, selectedCountryInner;
2955
+ if (iso2) {
2956
+ title = name;
2957
+ ariaLabel = i18n.selectedCountryAriaLabel.replace("${countryName}", name).replace("${dialCode}", `+${dialCode}`);
2958
+ selectedCountryInner = showFlags ? "" : buildGlobeIcon();
2959
+ } else {
2960
+ title = i18n.noCountrySelected;
2961
+ ariaLabel = i18n.noCountrySelected;
2962
+ selectedCountryInner = buildGlobeIcon();
2963
+ }
2964
+ this.selectedCountryInner.className = flagClass;
2965
+ this.selectedCountry.setAttribute("title", title);
2966
+ this.selectedCountry.setAttribute(ARIA.LABEL, ariaLabel);
2967
+ this.selectedCountryInner.innerHTML = selectedCountryInner;
2968
+ }
2969
+ if (separateDialCode) {
2970
+ const fullDialCode = dialCode ? `+${dialCode}` : "";
2971
+ this.#selectedDialCode.textContent = fullDialCode;
2972
+ this.#updateInputPadding();
2973
+ }
2974
+ }
2975
+ };
2976
+
2977
+ // src/js/modules/data/country-data.ts
2978
+ var processAllCountries = (options) => {
2979
+ const { onlyCountries, excludeCountries } = options;
2980
+ if (onlyCountries?.length) {
2981
+ return data_default.filter(
2982
+ (country) => onlyCountries.includes(country.iso2)
2983
+ );
2984
+ } else if (excludeCountries?.length) {
2985
+ return data_default.filter(
2986
+ (country) => !excludeCountries.includes(country.iso2)
2987
+ );
2988
+ }
2989
+ return data_default;
2990
+ };
2991
+ var generateCountryNames = (countries, options) => {
2992
+ const { countryNameLocale, i18n } = options;
2993
+ let displayNames;
2994
+ try {
2995
+ const hasDisplayNames = typeof Intl !== "undefined" && typeof Intl.DisplayNames === "function";
2996
+ if (hasDisplayNames) {
2997
+ displayNames = new Intl.DisplayNames(countryNameLocale, {
2998
+ type: "region"
2999
+ });
3000
+ } else {
3001
+ displayNames = null;
3002
+ }
3003
+ } catch (e) {
3004
+ console.error(e);
3005
+ displayNames = null;
3006
+ }
3007
+ for (const c of countries) {
3008
+ c.name = i18n[c.iso2] || displayNames?.of(c.iso2.toUpperCase()) || "";
3009
+ }
3010
+ };
3011
+ var processDialCodes = (countries) => {
3012
+ const dialCodes = /* @__PURE__ */ new Set();
3013
+ let dialCodeMaxLen = 0;
3014
+ const dialCodeToIso2Map = {};
3015
+ const addToDialCodeMap = (iso2, dialCode) => {
3016
+ if (!iso2 || !dialCode) {
3017
+ return;
3018
+ }
3019
+ if (dialCode.length > dialCodeMaxLen) {
3020
+ dialCodeMaxLen = dialCode.length;
3021
+ }
3022
+ if (!dialCodeToIso2Map.hasOwnProperty(dialCode)) {
3023
+ dialCodeToIso2Map[dialCode] = [];
3024
+ }
3025
+ const iso2List = dialCodeToIso2Map[dialCode];
3026
+ if (iso2List.includes(iso2)) {
3027
+ return;
3028
+ }
3029
+ iso2List.push(iso2);
3030
+ };
3031
+ const countriesSortedByPriority = [...countries].sort((a, b) => a.priority - b.priority);
3032
+ for (const c of countriesSortedByPriority) {
3033
+ if (!dialCodes.has(c.dialCode)) {
3034
+ dialCodes.add(c.dialCode);
3035
+ }
3036
+ for (let k = 1; k < c.dialCode.length; k++) {
3037
+ const partialDialCode = c.dialCode.substring(0, k);
3038
+ addToDialCodeMap(c.iso2, partialDialCode);
3039
+ }
3040
+ addToDialCodeMap(c.iso2, c.dialCode);
3041
+ if (c.areaCodes) {
3042
+ const rootIso2Code = dialCodeToIso2Map[c.dialCode][0];
3043
+ for (const areaCode of c.areaCodes) {
3044
+ for (let k = 1; k < areaCode.length; k++) {
3045
+ const partialAreaCode = areaCode.substring(0, k);
3046
+ const partialDialCode = c.dialCode + partialAreaCode;
3047
+ addToDialCodeMap(rootIso2Code, partialDialCode);
3048
+ addToDialCodeMap(c.iso2, partialDialCode);
3049
+ }
3050
+ addToDialCodeMap(c.iso2, c.dialCode + areaCode);
3051
+ }
3052
+ }
3053
+ }
3054
+ return { dialCodes, dialCodeMaxLen, dialCodeToIso2Map };
3055
+ };
3056
+ var sortCountries = (countries, options) => {
3057
+ const { countryOrder } = options;
3058
+ countries.sort((a, b) => {
3059
+ if (countryOrder) {
3060
+ const aIndex = countryOrder.indexOf(a.iso2);
3061
+ const bIndex = countryOrder.indexOf(b.iso2);
3062
+ const aIndexExists = aIndex > -1;
3063
+ const bIndexExists = bIndex > -1;
3064
+ if (aIndexExists || bIndexExists) {
3065
+ if (aIndexExists && bIndexExists) {
3066
+ return aIndex - bIndex;
3067
+ }
3068
+ return aIndexExists ? -1 : 1;
3069
+ }
3070
+ }
3071
+ return a.name.localeCompare(b.name);
3072
+ });
3073
+ };
3074
+ var cacheSearchTokens = (countries) => {
3075
+ for (const c of countries) {
3076
+ c.normalisedName = normaliseString(c.name);
3077
+ c.initials = c.normalisedName.split(/[^a-z]/).map((word) => word[0]).join("");
3078
+ c.dialCodePlus = `+${c.dialCode}`;
3079
+ }
3080
+ };
3081
+
3082
+ // src/js/modules/data/intl-regionless.ts
3083
+ var REGIONLESS_DIAL_CODES = /* @__PURE__ */ new Set([
3084
+ "800",
3085
+ "808",
3086
+ "870",
3087
+ "881",
3088
+ "882",
3089
+ "883",
3090
+ "888",
3091
+ "979"
3092
+ ]);
3093
+ var hasRegionlessDialCode = (number) => {
3094
+ const dialCode = getNumeric(number).slice(0, 3);
3095
+ return number.startsWith("+") && REGIONLESS_DIAL_CODES.has(dialCode);
3096
+ };
3097
+
3098
+ // src/js/modules/format/formatting.ts
3099
+ var beforeSetNumber = (fullNumber, hasValidDialCode, separateDialCode, selectedCountryData) => {
3100
+ let number = fullNumber;
3101
+ if (separateDialCode) {
3102
+ if (hasValidDialCode) {
3103
+ const dialCode = `+${selectedCountryData.dialCode}`;
3104
+ const start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
3105
+ number = number.substring(start);
3106
+ }
3107
+ }
3108
+ return number;
3109
+ };
3110
+ var formatNumberAsYouType = (fullNumber, telInputValue, utils, selectedCountryData, separateDialCode) => {
3111
+ const result = utils ? utils.formatNumberAsYouType(fullNumber, selectedCountryData.iso2) : fullNumber;
3112
+ const { dialCode } = selectedCountryData;
3113
+ if (separateDialCode && telInputValue.charAt(0) !== "+" && result.includes(`+${dialCode}`)) {
3114
+ const afterDialCode = result.split(`+${dialCode}`)[1] || "";
3115
+ return afterDialCode.trim();
3116
+ }
3117
+ return result;
3118
+ };
3119
+
3120
+ // src/js/modules/format/caret.ts
3121
+ var translateCursorPosition = (relevantChars, formattedValue, prevCaretPos, isDeleteForwards) => {
3122
+ if (prevCaretPos === 0 && !isDeleteForwards) {
3123
+ return 0;
3124
+ }
3125
+ let relevantCharCount = 0;
3126
+ for (let i = 0; i < formattedValue.length; i++) {
3127
+ if (/[+0-9]/.test(formattedValue[i])) {
3128
+ relevantCharCount++;
3129
+ }
3130
+ if (relevantCharCount === relevantChars && !isDeleteForwards) {
3131
+ return i + 1;
3132
+ }
3133
+ if (isDeleteForwards && relevantCharCount === relevantChars + 1) {
3134
+ return i;
3135
+ }
3136
+ }
3137
+ return formattedValue.length;
3138
+ };
3139
+
3140
+ // src/js/modules/data/nanp-regionless.ts
3141
+ var regionlessNanpNumbers = /* @__PURE__ */ new Set([
3142
+ "800",
3143
+ "822",
3144
+ "833",
3145
+ "844",
3146
+ "855",
3147
+ "866",
3148
+ "877",
3149
+ "880",
3150
+ "881",
3151
+ "882",
3152
+ "883",
3153
+ "884",
3154
+ "885",
3155
+ "886",
3156
+ "887",
3157
+ "888",
3158
+ "889"
3159
+ ]);
3160
+ var isRegionlessNanp = (number) => {
3161
+ const numeric = getNumeric(number);
3162
+ if (numeric.startsWith(DIAL.NANP) && numeric.length >= 4) {
3163
+ const areaCode = numeric.substring(1, 4);
3164
+ return regionlessNanpNumbers.has(areaCode);
3165
+ }
3166
+ return false;
3167
+ };
3168
+
3169
+ // src/js/modules/core/numerals.ts
3170
+ var Numerals = class {
3171
+ #userNumeralSet;
3172
+ constructor(initialValue) {
3173
+ if (initialValue) {
3174
+ this.#updateNumeralSet(initialValue);
3175
+ }
3176
+ }
3177
+ // If any Arabic-Indic digits, then label it as that set. Same for Persian. Otherwise assume ASCII.
3178
+ #updateNumeralSet(str) {
3179
+ if (/[\u0660-\u0669]/.test(str)) {
3180
+ this.#userNumeralSet = "arabic-indic";
3181
+ } else if (/[\u06F0-\u06F9]/.test(str)) {
3182
+ this.#userNumeralSet = "persian";
3183
+ } else {
3184
+ this.#userNumeralSet = "ascii";
3185
+ }
3186
+ }
3187
+ // Denormalise ASCII 0-9 to the user's numeral set. If not yet known, return as-is.
3188
+ // NOTE: normalise is always called before this, so it should be impossible for the numeral set to be unknown at this point.
3189
+ denormalise(str) {
3190
+ if (!this.#userNumeralSet || this.#userNumeralSet === "ascii") {
3191
+ return str;
3192
+ }
3193
+ const base = this.#userNumeralSet === "arabic-indic" ? 1632 : 1776;
3194
+ return str.replace(/[0-9]/g, (d) => String.fromCharCode(base + Number(d)));
3195
+ }
3196
+ // Normalize Eastern Arabic (U+0660-0669) and Persian/Extended Arabic-Indic (U+06F0-06F9) numerals to ASCII 0-9
3197
+ normalise(str) {
3198
+ if (!str) {
3199
+ return "";
3200
+ }
3201
+ this.#updateNumeralSet(str);
3202
+ if (this.#userNumeralSet === "ascii") {
3203
+ return str;
3204
+ }
3205
+ const base = this.#userNumeralSet === "arabic-indic" ? 1632 : 1776;
3206
+ const regex = this.#userNumeralSet === "arabic-indic" ? /[\u0660-\u0669]/g : /[\u06F0-\u06F9]/g;
3207
+ return str.replace(regex, (ch) => String.fromCharCode(48 + (ch.charCodeAt(0) - base)));
3208
+ }
3209
+ isAscii() {
3210
+ return !this.#userNumeralSet || this.#userNumeralSet === "ascii";
3211
+ }
3212
+ };
3213
+
3214
+ // src/js/intl-tel-input.ts
3215
+ var id = 0;
3216
+ var Iti = class _Iti {
3217
+ //* PRIVATE FIELDS
3218
+ #ui;
3219
+ #options;
3220
+ #isAndroid;
3221
+ // country data
3222
+ #countries;
3223
+ #dialCodeMaxLen;
3224
+ #dialCodeToIso2Map;
3225
+ #dialCodes;
3226
+ #countryByIso2;
3227
+ #selectedCountryData;
3228
+ #maxCoreNumberLength;
3229
+ #defaultCountry;
3230
+ #abortController;
3231
+ #dropdownAbortController;
3232
+ #numerals;
3233
+ #resolveAutoCountryPromise;
3234
+ #rejectAutoCountryPromise;
3235
+ #resolveUtilsScriptPromise;
3236
+ #rejectUtilsScriptPromise;
3237
+ constructor(input, customOptions = {}) {
3238
+ this.id = id++;
3239
+ UI.validateInput(input);
3240
+ const validatedOptions = validateOptions(customOptions);
3241
+ this.#options = { ...defaults, ...validatedOptions };
3242
+ normaliseOptions(this.#options);
3243
+ applyOptionSideEffects(this.#options);
3244
+ this.#ui = new UI(input, this.#options, this.id);
3245
+ this.#isAndroid = getIsAndroid();
3246
+ this.#numerals = new Numerals(input.value);
3247
+ this.promise = this.#createInitPromises(this.#options);
3248
+ this.#countries = processAllCountries(this.#options);
3249
+ const { dialCodes, dialCodeMaxLen, dialCodeToIso2Map } = processDialCodes(
3250
+ this.#countries
3251
+ );
3252
+ this.#dialCodes = dialCodes;
3253
+ this.#dialCodeMaxLen = dialCodeMaxLen;
3254
+ this.#dialCodeToIso2Map = dialCodeToIso2Map;
3255
+ this.#countryByIso2 = new Map(this.#countries.map((c) => [c.iso2, c]));
3256
+ this.#init();
3257
+ }
3258
+ #getTelInputValue() {
3259
+ const inputValue = this.#ui.telInput.value.trim();
3260
+ return this.#numerals.normalise(inputValue);
3261
+ }
3262
+ #setTelInputValue(asciiValue) {
3263
+ this.#ui.telInput.value = this.#numerals.denormalise(asciiValue);
3264
+ }
3265
+ #createInitPromises(options) {
3266
+ const { initialCountry, geoIpLookup, loadUtils } = options;
3267
+ const needsAutoCountryPromise = initialCountry === INITIAL_COUNTRY.AUTO && Boolean(geoIpLookup);
3268
+ const needsUtilsScriptPromise = Boolean(loadUtils) && !intlTelInput.utils;
3269
+ let autoCountryPromise;
3270
+ if (needsAutoCountryPromise) {
3271
+ autoCountryPromise = new Promise((resolve, reject) => {
3272
+ this.#resolveAutoCountryPromise = resolve;
3273
+ this.#rejectAutoCountryPromise = reject;
3274
+ });
3275
+ } else {
3276
+ autoCountryPromise = Promise.resolve(void 0);
3277
+ this.#resolveAutoCountryPromise = () => {
3278
+ };
3279
+ this.#rejectAutoCountryPromise = () => {
3280
+ };
3281
+ }
3282
+ let utilsScriptPromise;
3283
+ if (needsUtilsScriptPromise) {
3284
+ utilsScriptPromise = new Promise((resolve, reject) => {
3285
+ this.#resolveUtilsScriptPromise = resolve;
3286
+ this.#rejectUtilsScriptPromise = reject;
3287
+ });
3288
+ } else {
3289
+ utilsScriptPromise = Promise.resolve(void 0);
3290
+ this.#resolveUtilsScriptPromise = () => {
3291
+ };
3292
+ this.#rejectUtilsScriptPromise = () => {
3293
+ };
3294
+ }
3295
+ return Promise.all([autoCountryPromise, utilsScriptPromise]).then(() => {
3296
+ });
3297
+ }
3298
+ #init() {
3299
+ this.#selectedCountryData = null;
3300
+ this.#abortController = new AbortController();
3301
+ this.#processCountryData();
3302
+ this.#ui.generateMarkup(this.#countries);
3303
+ this.#setInitialState();
3304
+ this.#initListeners();
3305
+ this.#initRequests();
3306
+ if (this.#options.dropdownAlwaysOpen) {
3307
+ this.#openDropdown();
3308
+ }
3309
+ }
3310
+ //********************
3311
+ //* PRIVATE METHODS
3312
+ //********************
3313
+ //* Prepare all of the country data, including onlyCountries, excludeCountries, countryOrder options.
3314
+ #processCountryData() {
3315
+ generateCountryNames(this.#countries, this.#options);
3316
+ sortCountries(this.#countries, this.#options);
3317
+ cacheSearchTokens(this.#countries);
3318
+ }
3319
+ //* Set the initial state of the input value and the selected country by:
3320
+ //* 1. Extracting a dial code from the given number
3321
+ //* 2. Using explicit initialCountry
3322
+ #setInitialState(overrideAutoCountry = false) {
3323
+ const attributeValueRaw = this.#ui.telInput.getAttribute("value");
3324
+ const attributeValue = this.#numerals.normalise(attributeValueRaw);
3325
+ const inputValue = this.#getTelInputValue();
3326
+ const useAttribute = attributeValue && attributeValue.startsWith("+") && (!inputValue || !inputValue.startsWith("+"));
3327
+ const val = useAttribute ? attributeValue : inputValue;
3328
+ const dialCode = this.#getDialCode(val);
3329
+ const isRegionlessNanpNumber = isRegionlessNanp(val);
3330
+ const { initialCountry, geoIpLookup } = this.#options;
3331
+ const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
3332
+ const doingAutoCountryLookup = isAutoCountry && !overrideAutoCountry;
3333
+ const isValidInitialCountry = isIso2(initialCountry);
3334
+ if (dialCode) {
3335
+ if (isRegionlessNanpNumber) {
3336
+ if (isValidInitialCountry) {
3337
+ this.#setCountry(initialCountry);
3338
+ } else if (!doingAutoCountryLookup) {
3339
+ this.#setCountry(US.ISO2);
3340
+ }
3341
+ } else {
3342
+ this.#updateCountryFromNumber(val);
3343
+ }
3344
+ } else if (isValidInitialCountry) {
3345
+ this.#setCountry(initialCountry);
3346
+ } else if (!doingAutoCountryLookup) {
3347
+ this.#setCountry("");
3348
+ }
3349
+ if (val) {
3350
+ this.#updateValFromNumber(val);
3351
+ }
3352
+ }
3353
+ //* Initialise the main event listeners: input keyup, and click selected country.
3354
+ #initListeners() {
3355
+ this.#initTelInputListeners();
3356
+ if (this.#options.allowDropdown) {
3357
+ this.#initDropdownListeners();
3358
+ }
3359
+ if ((this.#ui.hiddenInput || this.#ui.hiddenInputCountry) && this.#ui.telInput.form) {
3360
+ this.#initHiddenInputListener();
3361
+ }
3362
+ }
3363
+ //* Update hidden input on form submit.
3364
+ #initHiddenInputListener() {
3365
+ const handleHiddenInputSubmit = () => {
3366
+ if (this.#ui.hiddenInput) {
3367
+ this.#ui.hiddenInput.value = this.getNumber();
3368
+ }
3369
+ if (this.#ui.hiddenInputCountry) {
3370
+ this.#ui.hiddenInputCountry.value = this.#selectedCountryData?.iso2 || "";
3371
+ }
3372
+ };
3373
+ this.#ui.telInput.form?.addEventListener("submit", handleHiddenInputSubmit, {
3374
+ signal: this.#abortController.signal
3375
+ });
3376
+ }
3377
+ //* initialise the dropdown listeners.
3378
+ #initDropdownListeners() {
3379
+ const signal = this.#abortController.signal;
3380
+ const handleLabelClick = (e) => {
3381
+ if (this.#ui.isDropdownClosed()) {
3382
+ this.#ui.telInput.focus();
3383
+ } else {
3384
+ e.preventDefault();
3385
+ }
3386
+ };
3387
+ const label = this.#ui.telInput.closest("label");
3388
+ if (label) {
3389
+ label.addEventListener("click", handleLabelClick, { signal });
3390
+ }
3391
+ const handleClickSelectedCountry = () => {
3392
+ if (this.#ui.isDropdownClosed() && !this.#ui.telInput.disabled && !this.#ui.telInput.readOnly) {
3393
+ this.#openDropdown();
3394
+ }
3395
+ };
3396
+ this.#ui.selectedCountry.addEventListener(
3397
+ "click",
3398
+ handleClickSelectedCountry,
3399
+ {
3400
+ signal
3401
+ }
3402
+ );
3403
+ const handleCountryContainerKeydown = (e) => {
3404
+ const allowedKeys = [KEYS.ARROW_UP, KEYS.ARROW_DOWN, KEYS.SPACE, KEYS.ENTER];
3405
+ if (this.#ui.isDropdownClosed() && allowedKeys.includes(e.key)) {
3406
+ e.preventDefault();
3407
+ e.stopPropagation();
3408
+ this.#openDropdown();
3409
+ }
3410
+ if (e.key === KEYS.TAB) {
3411
+ this.#closeDropdown();
3412
+ }
3413
+ };
3414
+ this.#ui.countryContainer.addEventListener(
3415
+ "keydown",
3416
+ handleCountryContainerKeydown,
3417
+ { signal }
3418
+ );
3419
+ }
3420
+ //* Init requests: utils script / geo ip lookup.
3421
+ #initRequests() {
3422
+ const { loadUtils, initialCountry, geoIpLookup } = this.#options;
3423
+ if (loadUtils && !intlTelInput.utils) {
3424
+ const doAttachUtils = () => {
3425
+ intlTelInput.attachUtils(loadUtils)?.catch(() => {
3426
+ });
3427
+ };
3428
+ if (intlTelInput.documentReady()) {
3429
+ doAttachUtils();
3430
+ } else {
3431
+ window.addEventListener("load", doAttachUtils, {
3432
+ signal: this.#abortController.signal
3433
+ });
3434
+ }
3435
+ } else {
3436
+ this.#resolveUtilsScriptPromise();
3437
+ }
3438
+ const isAutoCountry = initialCountry === INITIAL_COUNTRY.AUTO && geoIpLookup;
3439
+ if (isAutoCountry) {
3440
+ if (this.#selectedCountryData?.iso2) {
3441
+ this.#resolveAutoCountryPromise();
3442
+ } else {
3443
+ this.#loadAutoCountry();
3444
+ }
3445
+ }
3446
+ }
3447
+ //* Perform the geo ip lookup.
3448
+ #loadAutoCountry() {
3449
+ if (intlTelInput.autoCountry) {
3450
+ this.#handleAutoCountry();
3451
+ } else {
3452
+ this.#ui.selectedCountryInner.classList.add(CLASSES.LOADING);
3453
+ if (!intlTelInput.startedLoadingAutoCountry) {
3454
+ intlTelInput.startedLoadingAutoCountry = true;
3455
+ if (typeof this.#options.geoIpLookup === "function") {
3456
+ const successCallback = (iso2 = "") => {
3457
+ this.#ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
3458
+ const iso2Lower = iso2.toLowerCase();
3459
+ if (isIso2(iso2Lower)) {
3460
+ intlTelInput.autoCountry = iso2Lower;
3461
+ setTimeout(() => _Iti.forEachInstance("handleAutoCountry"));
3462
+ } else {
3463
+ _Iti.forEachInstance("handleAutoCountryFailure");
3464
+ }
3465
+ };
3466
+ const failureCallback = () => {
3467
+ this.#ui.selectedCountryInner.classList.remove(CLASSES.LOADING);
3468
+ _Iti.forEachInstance("handleAutoCountryFailure");
3469
+ };
3470
+ this.#options.geoIpLookup(successCallback, failureCallback);
3471
+ }
3472
+ }
3473
+ }
3474
+ }
3475
+ #openDropdownWithPlus() {
3476
+ this.#openDropdown();
3477
+ this.#ui.searchInput.value = "+";
3478
+ this.#ui.filterCountriesByQuery("");
3479
+ }
3480
+ //* Initialize the tel input listeners.
3481
+ #initTelInputListeners() {
3482
+ this.#bindInputListener();
3483
+ this.#maybeBindKeydownListener();
3484
+ this.#maybeBindPasteListener();
3485
+ }
3486
+ #bindInputListener() {
3487
+ const {
3488
+ strictMode,
3489
+ formatAsYouType,
3490
+ separateDialCode,
3491
+ allowDropdown,
3492
+ countrySearch
3493
+ } = this.#options;
3494
+ let userOverrideFormatting = false;
3495
+ if (REGEX.ALPHA_UNICODE.test(this.#getTelInputValue())) {
3496
+ userOverrideFormatting = true;
3497
+ }
3498
+ const handleInputEvent = (e) => {
3499
+ const inputValue = this.#getTelInputValue();
3500
+ if (this.#isAndroid && e?.data === "+" && separateDialCode && allowDropdown && countrySearch) {
3501
+ const currentCaretPos = this.#ui.telInput.selectionStart || 0;
3502
+ const valueBeforeCaret = inputValue.substring(0, currentCaretPos - 1);
3503
+ const valueAfterCaret = inputValue.substring(currentCaretPos);
3504
+ this.#setTelInputValue(valueBeforeCaret + valueAfterCaret);
3505
+ this.#openDropdownWithPlus();
3506
+ return;
3507
+ }
3508
+ if (this.#updateCountryFromNumber(inputValue)) {
3509
+ this.#triggerCountryChange();
3510
+ }
3511
+ const isFormattingChar = e?.data && REGEX.NON_PLUS_NUMERIC.test(e.data);
3512
+ const isPaste = e?.inputType === INPUT_TYPES.PASTE && inputValue;
3513
+ if (isFormattingChar || isPaste && !strictMode) {
3514
+ userOverrideFormatting = true;
3515
+ } else if (!REGEX.NON_PLUS_NUMERIC.test(inputValue)) {
3516
+ userOverrideFormatting = false;
3517
+ }
3518
+ const isSetNumber = e?.detail && e.detail["isSetNumber"];
3519
+ const isAscii = this.#numerals.isAscii();
3520
+ if (formatAsYouType && !userOverrideFormatting && !isSetNumber && isAscii) {
3521
+ const currentCaretPos = this.#ui.telInput.selectionStart || 0;
3522
+ const valueBeforeCaret = inputValue.substring(
3523
+ 0,
3524
+ currentCaretPos
3525
+ );
3526
+ const relevantCharsBeforeCaret = valueBeforeCaret.replace(
3527
+ REGEX.NON_PLUS_NUMERIC_GLOBAL,
3528
+ ""
3529
+ ).length;
3530
+ const isDeleteForwards = e?.inputType === INPUT_TYPES.DELETE_FWD;
3531
+ const fullNumber = this.#getFullNumber();
3532
+ const formattedValue = formatNumberAsYouType(
3533
+ fullNumber,
3534
+ inputValue,
3535
+ intlTelInput.utils,
3536
+ this.#selectedCountryData ?? {},
3537
+ separateDialCode
3538
+ );
3539
+ const newCaretPos = translateCursorPosition(
3540
+ relevantCharsBeforeCaret,
3541
+ formattedValue,
3542
+ currentCaretPos,
3543
+ isDeleteForwards
3544
+ );
3545
+ this.#setTelInputValue(formattedValue);
3546
+ this.#ui.telInput.setSelectionRange(newCaretPos, newCaretPos);
3547
+ }
3548
+ if (separateDialCode && inputValue.startsWith("+") && this.#selectedCountryData?.dialCode) {
3549
+ const cleanNumber = beforeSetNumber(
3550
+ inputValue,
3551
+ true,
3552
+ separateDialCode,
3553
+ this.#selectedCountryData ?? {}
3554
+ );
3555
+ this.#setTelInputValue(cleanNumber);
3556
+ }
3557
+ };
3558
+ this.#ui.telInput.addEventListener(
3559
+ "input",
3560
+ handleInputEvent,
3561
+ {
3562
+ signal: this.#abortController.signal
3563
+ }
3564
+ );
3565
+ }
3566
+ #maybeBindKeydownListener() {
3567
+ const { strictMode, separateDialCode, allowDropdown, countrySearch } = this.#options;
3568
+ if (strictMode || separateDialCode) {
3569
+ const handleKeydownEvent = (e) => {
3570
+ if (e.key && e.key.length === 1 && !e.altKey && !e.ctrlKey && !e.metaKey) {
3571
+ if (separateDialCode && allowDropdown && countrySearch && e.key === "+") {
3572
+ e.preventDefault();
3573
+ this.#openDropdownWithPlus();
3574
+ return;
3575
+ }
3576
+ if (strictMode) {
3577
+ const inputValue = this.#getTelInputValue();
3578
+ const alreadyHasPlus = inputValue.startsWith("+");
3579
+ const isInitialPlus = !alreadyHasPlus && this.#ui.telInput.selectionStart === 0 && e.key === "+";
3580
+ const normalisedKey = this.#numerals.normalise(e.key);
3581
+ const isNumeric = /^[0-9]$/.test(normalisedKey);
3582
+ const isAllowedChar = separateDialCode ? isNumeric : isInitialPlus || isNumeric;
3583
+ const input = this.#ui.telInput;
3584
+ const selStart = input.selectionStart;
3585
+ const selEnd = input.selectionEnd;
3586
+ const before = inputValue.slice(0, selStart);
3587
+ const after = inputValue.slice(selEnd);
3588
+ const newValue = before + e.key + after;
3589
+ const newFullNumber = this.#getFullNumber(newValue);
3590
+ let hasExceededMaxLength = false;
3591
+ if (intlTelInput.utils && this.#maxCoreNumberLength) {
3592
+ const coreNumber = intlTelInput.utils.getCoreNumber(
3593
+ newFullNumber,
3594
+ this.#selectedCountryData?.iso2
3595
+ );
3596
+ hasExceededMaxLength = coreNumber.length > this.#maxCoreNumberLength;
3597
+ }
3598
+ const newCountry = this.#getNewCountryFromNumber(newFullNumber);
3599
+ const isChangingDialCode = newCountry !== null;
3600
+ if (!isAllowedChar || hasExceededMaxLength && !isChangingDialCode && !isInitialPlus) {
3601
+ e.preventDefault();
3602
+ }
3603
+ }
3604
+ }
3605
+ };
3606
+ this.#ui.telInput.addEventListener("keydown", handleKeydownEvent, {
3607
+ signal: this.#abortController.signal
3608
+ });
3609
+ }
3610
+ }
3611
+ #maybeBindPasteListener() {
3612
+ if (this.#options.strictMode) {
3613
+ const handlePasteEvent = (e) => {
3614
+ e.preventDefault();
3615
+ const input = this.#ui.telInput;
3616
+ const selStart = input.selectionStart;
3617
+ const selEnd = input.selectionEnd;
3618
+ const inputValue = this.#getTelInputValue();
3619
+ const before = inputValue.slice(0, selStart);
3620
+ const after = inputValue.slice(selEnd);
3621
+ const iso2 = this.#selectedCountryData?.iso2;
3622
+ const pastedRaw = e.clipboardData.getData("text");
3623
+ const pasted = this.#numerals.normalise(pastedRaw);
3624
+ const initialCharSelected = selStart === 0 && selEnd > 0;
3625
+ const allowLeadingPlus = !inputValue.startsWith("+") || initialCharSelected;
3626
+ const allowedChars = pasted.replace(REGEX.NON_PLUS_NUMERIC_GLOBAL, "");
3627
+ const hasLeadingPlus = allowedChars.startsWith("+");
3628
+ const numerics = allowedChars.replace(/\+/g, "");
3629
+ const sanitised = hasLeadingPlus && allowLeadingPlus ? `+${numerics}` : numerics;
3630
+ let newVal = before + sanitised + after;
3631
+ if (newVal.length > 5) {
3632
+ let coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
3633
+ while (coreNumber.length === 0 && newVal.length > 0) {
3634
+ newVal = newVal.slice(0, -1);
3635
+ coreNumber = intlTelInput.utils.getCoreNumber(newVal, iso2);
3636
+ }
3637
+ if (!coreNumber) {
3638
+ return;
3639
+ }
3640
+ if (this.#maxCoreNumberLength && coreNumber.length > this.#maxCoreNumberLength) {
3641
+ if (input.selectionEnd === inputValue.length) {
3642
+ const trimLength = coreNumber.length - this.#maxCoreNumberLength;
3643
+ newVal = newVal.slice(0, newVal.length - trimLength);
3644
+ } else {
3645
+ return;
3646
+ }
3647
+ }
3648
+ }
3649
+ this.#setTelInputValue(newVal);
3650
+ const caretPos = selStart + sanitised.length;
3651
+ input.setSelectionRange(caretPos, caretPos);
3652
+ input.dispatchEvent(new InputEvent("input", { bubbles: true }));
3653
+ };
3654
+ this.#ui.telInput.addEventListener("paste", handlePasteEvent, {
3655
+ signal: this.#abortController.signal
3656
+ });
3657
+ }
3658
+ }
3659
+ //* Adhere to the input's maxlength attr.
3660
+ #cap(number) {
3661
+ const max = Number(this.#ui.telInput.getAttribute("maxlength"));
3662
+ return max && number.length > max ? number.substring(0, max) : number;
3663
+ }
3664
+ //* Trigger a custom event on the input (typed via ItiEventMap).
3665
+ #trigger(name, detailProps = {}) {
3666
+ const e = new CustomEvent(name, {
3667
+ bubbles: true,
3668
+ cancelable: true,
3669
+ detail: detailProps
3670
+ });
3671
+ this.#ui.telInput.dispatchEvent(e);
3672
+ }
3673
+ //* Open the dropdown.
3674
+ #openDropdown() {
3675
+ const { dropdownContainer, useFullscreenPopup } = this.#options;
3676
+ this.#dropdownAbortController = new AbortController();
3677
+ this.#ui.openDropdown();
3678
+ if (!useFullscreenPopup && dropdownContainer) {
3679
+ const handleWindowScroll = () => this.#closeDropdown();
3680
+ window.addEventListener("scroll", handleWindowScroll, {
3681
+ signal: this.#dropdownAbortController.signal
3682
+ });
3683
+ }
3684
+ this.#bindDropdownListeners();
3685
+ this.#trigger(EVENTS.OPEN_COUNTRY_DROPDOWN);
3686
+ }
3687
+ //* We only bind dropdown listeners when the dropdown is open.
3688
+ #bindDropdownListeners() {
3689
+ const signal = this.#dropdownAbortController.signal;
3690
+ this.#bindDropdownMouseoverListener(signal);
3691
+ this.#bindDropdownCountryClickListener(signal);
3692
+ if (!this.#options.dropdownAlwaysOpen) {
3693
+ this.#bindDropdownClickOffListener(signal);
3694
+ }
3695
+ this.#bindDropdownKeydownListener(signal);
3696
+ if (this.#options.countrySearch) {
3697
+ this.#bindDropdownSearchListeners(signal);
3698
+ }
3699
+ }
3700
+ //* When mouse over a list item, just highlight that one
3701
+ //* we add the class "highlight", so if they hit "enter" we know which one to select.
3702
+ #bindDropdownMouseoverListener(signal) {
3703
+ const handleMouseoverCountryList = (e) => {
3704
+ const listItem = e.target?.closest(
3705
+ `.${CLASSES.COUNTRY_ITEM}`
3706
+ );
3707
+ if (listItem) {
3708
+ this.#ui.highlightListItem(listItem, false);
3709
+ }
3710
+ };
3711
+ this.#ui.countryList.addEventListener(
3712
+ "mouseover",
3713
+ handleMouseoverCountryList,
3714
+ {
3715
+ signal
3716
+ }
3717
+ );
3718
+ }
3719
+ //* Listen for country selection.
3720
+ #bindDropdownCountryClickListener(signal) {
3721
+ const handleClickCountryList = (e) => {
3722
+ const listItem = e.target?.closest(
3723
+ `.${CLASSES.COUNTRY_ITEM}`
3724
+ );
3725
+ if (listItem) {
3726
+ this.#selectListItem(listItem);
3727
+ }
3728
+ };
3729
+ this.#ui.countryList.addEventListener("click", handleClickCountryList, {
3730
+ signal
3731
+ });
3732
+ }
3733
+ //* Click off to close (except when this initial opening click is bubbling up).
3734
+ //* We cannot just stopPropagation as it may be needed to close another instance.
3735
+ #bindDropdownClickOffListener(signal) {
3736
+ const handleClickOffToClose = (e) => {
3737
+ const target = e.target;
3738
+ const clickedInsideDropdown = !!target.closest(
3739
+ `#iti-${this.id}__dropdown-content`
3740
+ );
3741
+ if (!clickedInsideDropdown) {
3742
+ this.#closeDropdown();
3743
+ }
3744
+ };
3745
+ setTimeout(() => {
3746
+ document.documentElement.addEventListener(
3747
+ "click",
3748
+ handleClickOffToClose,
3749
+ { signal }
3750
+ );
3751
+ }, 0);
3752
+ }
3753
+ //* Listen for up/down scrolling, enter to select, or escape to close.
3754
+ //* Use keydown as keypress doesn't fire for non-char keys and we want to catch if they
3755
+ //* just hit down and hold it to scroll down (no keyup event).
3756
+ //* Listen on the document because that's where key events are triggered if no input has focus.
3757
+ #bindDropdownKeydownListener(signal) {
3758
+ let query = "";
3759
+ let queryTimer = null;
3760
+ const handleKeydownOnDropdown = (e) => {
3761
+ const allowedKeys = [
3762
+ KEYS.ARROW_UP,
3763
+ KEYS.ARROW_DOWN,
3764
+ KEYS.ENTER,
3765
+ KEYS.ESC
3766
+ ];
3767
+ if (allowedKeys.includes(e.key)) {
3768
+ e.preventDefault();
3769
+ e.stopPropagation();
3770
+ if (e.key === KEYS.ARROW_UP || e.key === KEYS.ARROW_DOWN) {
3771
+ this.#ui.handleUpDownKey(e.key);
3772
+ } else if (e.key === KEYS.ENTER && !e.isComposing) {
3773
+ this.#handleEnterKey();
3774
+ } else if (e.key === KEYS.ESC) {
3775
+ this.#closeDropdown();
3776
+ this.#ui.selectedCountry.focus();
3777
+ }
3778
+ }
3779
+ if (!this.#options.countrySearch && REGEX.HIDDEN_SEARCH_CHAR.test(e.key)) {
3780
+ e.stopPropagation();
3781
+ if (queryTimer) {
3782
+ clearTimeout(queryTimer);
3783
+ }
3784
+ query += e.key.toLowerCase();
3785
+ this.#searchForCountry(query);
3786
+ queryTimer = setTimeout(() => {
3787
+ query = "";
3788
+ }, TIMINGS.HIDDEN_SEARCH_RESET_MS);
3789
+ }
3790
+ };
3791
+ document.addEventListener("keydown", handleKeydownOnDropdown, { signal });
3792
+ }
3793
+ //* Search input listeners when countrySearch enabled.
3794
+ #bindDropdownSearchListeners(signal) {
3795
+ this.#ui.searchInput.addEventListener(
3796
+ "input",
3797
+ () => this.#ui.handleSearchChange(),
3798
+ { signal }
3799
+ );
3800
+ this.#ui.searchClearButton.addEventListener(
3801
+ "click",
3802
+ () => this.#ui.handleSearchClear(),
3803
+ { signal }
3804
+ );
3805
+ }
3806
+ //* Hidden search (countrySearch disabled): Find the first list item whose name starts with the query string.
3807
+ #searchForCountry(query) {
3808
+ const match = findFirstCountryStartingWith(this.#countries, query);
3809
+ if (match) {
3810
+ const listItem = match.nodeById[this.id];
3811
+ this.#ui.highlightListItem(listItem, false);
3812
+ this.#ui.scrollCountryListToItem(listItem);
3813
+ }
3814
+ }
3815
+ //* Select the currently highlighted item.
3816
+ #handleEnterKey() {
3817
+ if (this.#ui.highlightedItem) {
3818
+ this.#selectListItem(this.#ui.highlightedItem);
3819
+ }
3820
+ }
3821
+ //* Update the input's value to the given val (format first if possible)
3822
+ //* NOTE: this is called from _setInitialState, handleUtils and setNumber.
3823
+ #updateValFromNumber(fullNumber) {
3824
+ const { formatOnDisplay, nationalMode, separateDialCode } = this.#options;
3825
+ let number = fullNumber;
3826
+ if (formatOnDisplay && intlTelInput.utils && this.#selectedCountryData) {
3827
+ const isRegionless = hasRegionlessDialCode(fullNumber);
3828
+ const useNational = nationalMode && !isRegionless || !number.startsWith("+") && !separateDialCode;
3829
+ const { NATIONAL, INTERNATIONAL } = intlTelInput.utils.numberFormat;
3830
+ const format = useNational ? NATIONAL : INTERNATIONAL;
3831
+ number = intlTelInput.utils.formatNumber(
3832
+ number,
3833
+ this.#selectedCountryData?.iso2,
3834
+ format
3835
+ );
3836
+ }
3837
+ number = this.#beforeSetNumber(number);
3838
+ this.#setTelInputValue(number);
3839
+ }
3840
+ //* Check if need to select a new country based on the given number
3841
+ //* Note: called from _setInitialState, keyup handler, setNumber.
3842
+ #updateCountryFromNumber(fullNumber) {
3843
+ const iso2 = this.#getNewCountryFromNumber(fullNumber);
3844
+ if (iso2 !== null) {
3845
+ return this.#setCountry(iso2);
3846
+ }
3847
+ return false;
3848
+ }
3849
+ // if there is a selected country, and the number doesn't start with a dial code, then add it
3850
+ #ensureHasDialCode(number) {
3851
+ const dialCode = this.#selectedCountryData?.dialCode;
3852
+ const nationalPrefix = this.#selectedCountryData?.nationalPrefix;
3853
+ const alreadyHasPlus = number.startsWith("+");
3854
+ if (alreadyHasPlus || !dialCode) {
3855
+ return number;
3856
+ }
3857
+ const hasPrefix = nationalPrefix && number.startsWith(nationalPrefix) && !this.#options.separateDialCode;
3858
+ const cleanNumber = hasPrefix ? number.substring(1) : number;
3859
+ return `+${dialCode}${cleanNumber}`;
3860
+ }
3861
+ //* Get the new country based on the input number, or return null if no change, or empty string if should be empty (e.g. if they type an invalid dial code).
3862
+ #getNewCountryFromNumber(fullNumber) {
3863
+ const plusIndex = fullNumber.indexOf("+");
3864
+ let number = plusIndex ? fullNumber.substring(plusIndex) : fullNumber;
3865
+ const selectedIso2 = this.#selectedCountryData?.iso2;
3866
+ const selectedDialCode = this.#selectedCountryData?.dialCode;
3867
+ number = this.#ensureHasDialCode(number);
3868
+ const dialCodeMatch = this.#getDialCode(number, true);
3869
+ const numeric = getNumeric(number);
3870
+ if (dialCodeMatch) {
3871
+ const dialCodeMatchNumeric = getNumeric(dialCodeMatch);
3872
+ const iso2Codes = this.#dialCodeToIso2Map[dialCodeMatchNumeric];
3873
+ if (iso2Codes.length === 1) {
3874
+ if (iso2Codes[0] === selectedIso2) {
3875
+ return null;
3876
+ }
3877
+ return iso2Codes[0];
3878
+ }
3879
+ if (!selectedIso2 && this.#defaultCountry && iso2Codes.includes(this.#defaultCountry)) {
3880
+ return this.#defaultCountry;
3881
+ }
3882
+ const isRegionlessNanpNumber = selectedDialCode === DIAL.NANP && isRegionlessNanp(numeric);
3883
+ if (isRegionlessNanpNumber) {
3884
+ return null;
3885
+ }
3886
+ const areaCodes = this.#selectedCountryData?.areaCodes;
3887
+ const priority = this.#selectedCountryData?.priority;
3888
+ if (areaCodes) {
3889
+ const dialCodeAreaCodes = areaCodes.map(
3890
+ (areaCode) => `${selectedDialCode}${areaCode}`
3891
+ );
3892
+ for (const dialCodeAreaCode of dialCodeAreaCodes) {
3893
+ if (numeric.startsWith(dialCodeAreaCode)) {
3894
+ return null;
3895
+ }
3896
+ }
3897
+ }
3898
+ const isMainCountry = priority === 0;
3899
+ const hasAreaCodesButNoneMatched = areaCodes && !isMainCountry && numeric.length > dialCodeMatchNumeric.length;
3900
+ const isValidSelection = selectedIso2 && iso2Codes.includes(selectedIso2) && !hasAreaCodesButNoneMatched;
3901
+ const alreadySelected = selectedIso2 === iso2Codes[0];
3902
+ if (!isValidSelection && !alreadySelected) {
3903
+ return iso2Codes[0];
3904
+ }
3905
+ } else if (number.startsWith("+") && numeric.length) {
3906
+ const currentDial = this.#selectedCountryData?.dialCode || "";
3907
+ if (currentDial && currentDial.startsWith(numeric)) {
3908
+ return null;
3909
+ }
3910
+ return "";
3911
+ } else if ((!number || number === "+") && !selectedIso2 && this.#defaultCountry) {
3912
+ return this.#defaultCountry;
3913
+ }
3914
+ return null;
3915
+ }
3916
+ //* Update the selected country, dial code (if separateDialCode), placeholder, title, and selected list item.
3917
+ //* Note: called from _setInitialState, _updateCountryFromNumber, _selectListItem, setCountry.
3918
+ #setCountry(iso2) {
3919
+ const prevIso2 = this.#selectedCountryData?.iso2 || "";
3920
+ this.#selectedCountryData = iso2 ? this.#countryByIso2.get(iso2) : null;
3921
+ if (this.#selectedCountryData?.iso2) {
3922
+ this.#defaultCountry = this.#selectedCountryData.iso2;
3923
+ }
3924
+ this.#ui.setCountry(this.#selectedCountryData ?? {});
3925
+ this.#updatePlaceholder();
3926
+ this.#updateMaxLength();
3927
+ return prevIso2 !== iso2;
3928
+ }
3929
+ //* Update the maximum valid number length for the currently selected country.
3930
+ #updateMaxLength() {
3931
+ const { strictMode, placeholderNumberType, allowedNumberTypes } = this.#options;
3932
+ const iso2 = this.#selectedCountryData?.iso2;
3933
+ if (strictMode && intlTelInput.utils) {
3934
+ if (iso2) {
3935
+ const numberType = intlTelInput.utils.numberType[placeholderNumberType];
3936
+ let exampleNumber = intlTelInput.utils.getExampleNumber(
3937
+ iso2,
3938
+ false,
3939
+ numberType,
3940
+ true
3941
+ );
3942
+ let validNumber = exampleNumber;
3943
+ while (intlTelInput.utils.isPossibleNumber(
3944
+ exampleNumber,
3945
+ iso2,
3946
+ allowedNumberTypes
3947
+ )) {
3948
+ validNumber = exampleNumber;
3949
+ exampleNumber += "0";
3950
+ }
3951
+ const coreNumber = intlTelInput.utils.getCoreNumber(validNumber, iso2);
3952
+ this.#maxCoreNumberLength = coreNumber.length;
3953
+ if (iso2 === "by") {
3954
+ this.#maxCoreNumberLength = coreNumber.length + 1;
3955
+ }
3956
+ } else {
3957
+ this.#maxCoreNumberLength = null;
3958
+ }
3959
+ }
3960
+ }
3961
+ //* Update the input placeholder to an example number from the currently selected country.
3962
+ #updatePlaceholder() {
3963
+ const {
3964
+ autoPlaceholder,
3965
+ placeholderNumberType,
3966
+ nationalMode,
3967
+ customPlaceholder
3968
+ } = this.#options;
3969
+ const shouldSetPlaceholder = autoPlaceholder === PLACEHOLDER_MODES.AGGRESSIVE || !this.#ui.hadInitialPlaceholder && autoPlaceholder === PLACEHOLDER_MODES.POLITE;
3970
+ if (intlTelInput.utils && shouldSetPlaceholder) {
3971
+ const numberType = intlTelInput.utils.numberType[placeholderNumberType];
3972
+ let placeholder = this.#selectedCountryData?.iso2 ? intlTelInput.utils.getExampleNumber(
3973
+ this.#selectedCountryData.iso2,
3974
+ nationalMode,
3975
+ numberType
3976
+ ) : "";
3977
+ placeholder = this.#beforeSetNumber(placeholder);
3978
+ if (typeof customPlaceholder === "function") {
3979
+ placeholder = customPlaceholder(placeholder, this.#selectedCountryData ?? {});
3980
+ }
3981
+ this.#ui.telInput.setAttribute("placeholder", placeholder);
3982
+ }
3983
+ }
3984
+ //* Called when the user selects a list item from the dropdown.
3985
+ #selectListItem(listItem) {
3986
+ const iso2 = listItem.dataset[DATA_KEYS.COUNTRY_CODE];
3987
+ const countryChanged = this.#setCountry(iso2);
3988
+ this.#closeDropdown();
3989
+ const dialCode = listItem.dataset[DATA_KEYS.DIAL_CODE];
3990
+ this.#updateDialCode(dialCode);
3991
+ if (this.#options.formatOnDisplay) {
3992
+ const inputValue = this.#getTelInputValue();
3993
+ this.#updateValFromNumber(inputValue);
3994
+ }
3995
+ this.#ui.telInput.focus();
3996
+ if (countryChanged) {
3997
+ this.#triggerCountryChange();
3998
+ }
3999
+ }
4000
+ //* Close the dropdown and unbind any listeners.
4001
+ #closeDropdown(isDestroy) {
4002
+ if (this.#ui.isDropdownClosed() || this.#options.dropdownAlwaysOpen && !isDestroy) {
4003
+ return;
4004
+ }
4005
+ this.#ui.closeDropdown();
4006
+ this.#dropdownAbortController.abort();
4007
+ this.#dropdownAbortController = null;
4008
+ this.#trigger(EVENTS.CLOSE_COUNTRY_DROPDOWN);
4009
+ }
4010
+ //* Replace any existing dial code with the new one
4011
+ //* Note: called from _selectListItem and setCountry
4012
+ #updateDialCode(newDialCodeBare) {
4013
+ const inputVal = this.#getTelInputValue();
4014
+ const newDialCode = `+${newDialCodeBare}`;
4015
+ let newNumber;
4016
+ if (inputVal.startsWith("+")) {
4017
+ const prevDialCode = this.#getDialCode(inputVal);
4018
+ if (prevDialCode) {
4019
+ newNumber = inputVal.replace(prevDialCode, newDialCode);
4020
+ } else {
4021
+ newNumber = newDialCode;
4022
+ }
4023
+ this.#setTelInputValue(newNumber);
4024
+ }
4025
+ }
4026
+ //* Try and extract a valid international dial code from a full telephone number.
4027
+ //* Note: returns the raw string inc plus character and any whitespace/dots etc.
4028
+ #getDialCode(number, includeAreaCode) {
4029
+ let dialCode = "";
4030
+ if (number.startsWith("+")) {
4031
+ let numericChars = "";
4032
+ let foundBaseDialCode = false;
4033
+ for (let i = 0; i < number.length; i++) {
4034
+ const c = number.charAt(i);
4035
+ if (/[0-9]/.test(c)) {
4036
+ numericChars += c;
4037
+ const hasMapEntry = Boolean(this.#dialCodeToIso2Map[numericChars]);
4038
+ if (!hasMapEntry) {
4039
+ break;
4040
+ }
4041
+ if (this.#dialCodes.has(numericChars)) {
4042
+ dialCode = number.substring(0, i + 1);
4043
+ foundBaseDialCode = true;
4044
+ if (!includeAreaCode) {
4045
+ break;
4046
+ }
4047
+ } else if (includeAreaCode && foundBaseDialCode) {
4048
+ dialCode = number.substring(0, i + 1);
4049
+ }
4050
+ if (numericChars.length === this.#dialCodeMaxLen) {
4051
+ break;
4052
+ }
4053
+ }
4054
+ }
4055
+ }
4056
+ return dialCode;
4057
+ }
4058
+ //* Get the input val, adding the dial code if separateDialCode is enabled.
4059
+ #getFullNumber(overrideVal) {
4060
+ const val = overrideVal ? this.#numerals.normalise(overrideVal) : this.#getTelInputValue();
4061
+ const dialCode = this.#selectedCountryData?.dialCode;
4062
+ let prefix;
4063
+ const numericVal = getNumeric(val);
4064
+ if (this.#options.separateDialCode && !val.startsWith("+") && dialCode && numericVal) {
4065
+ prefix = `+${dialCode}`;
4066
+ } else {
4067
+ prefix = "";
4068
+ }
4069
+ return prefix + val;
4070
+ }
4071
+ //* Remove the dial code if separateDialCode is enabled also cap the length if the input has a maxlength attribute
4072
+ #beforeSetNumber(fullNumber) {
4073
+ const hasValidDialCode = Boolean(this.#getDialCode(fullNumber));
4074
+ const number = beforeSetNumber(
4075
+ fullNumber,
4076
+ hasValidDialCode,
4077
+ this.#options.separateDialCode,
4078
+ this.#selectedCountryData ?? {}
4079
+ );
4080
+ return this.#cap(number);
4081
+ }
4082
+ //* Return only the public-facing subset of the selected country data.
4083
+ #getPublicCountryData() {
4084
+ const d = this.#selectedCountryData;
4085
+ if (!d) return {};
4086
+ const { iso2, dialCode, name } = d;
4087
+ return { iso2, dialCode, name };
4088
+ }
4089
+ //* Trigger the 'countrychange' event.
4090
+ #triggerCountryChange() {
4091
+ const countryData = this.#getPublicCountryData();
4092
+ this.#trigger(EVENTS.COUNTRY_CHANGE, countryData);
4093
+ }
4094
+ //**************************
4095
+ //* INTERNAL METHODS
4096
+ //**************************
4097
+ //* Called when the geoip call returns.
4098
+ #handleAutoCountry() {
4099
+ if (!this.#ui.telInput) {
4100
+ this.#resolveAutoCountryPromise?.();
4101
+ return;
4102
+ }
4103
+ if (this.#options.initialCountry === INITIAL_COUNTRY.AUTO && intlTelInput.autoCountry) {
4104
+ this.#defaultCountry = intlTelInput.autoCountry;
4105
+ const hasSelectedCountryOrGlobe = this.#selectedCountryData?.iso2 || this.#ui.selectedCountryInner.classList.contains(CLASSES.GLOBE);
4106
+ if (!hasSelectedCountryOrGlobe) {
4107
+ this.setCountry(this.#defaultCountry);
4108
+ }
4109
+ this.#resolveAutoCountryPromise();
4110
+ }
4111
+ }
4112
+ //* Called when the geoip call fails or times out.
4113
+ #handleAutoCountryFailure() {
4114
+ if (!this.#ui.telInput) {
4115
+ this.#rejectAutoCountryPromise?.();
4116
+ return;
4117
+ }
4118
+ this.#setInitialState(true);
4119
+ this.#rejectAutoCountryPromise();
4120
+ }
4121
+ //* Called when the utils request completes.
4122
+ #handleUtils() {
4123
+ if (!this.#ui.telInput) {
4124
+ this.#resolveUtilsScriptPromise?.();
4125
+ return;
4126
+ }
4127
+ if (intlTelInput.utils) {
4128
+ const inputValue = this.#getTelInputValue();
4129
+ if (inputValue) {
4130
+ this.#updateValFromNumber(inputValue);
4131
+ }
4132
+ if (this.#selectedCountryData?.iso2) {
4133
+ this.#updatePlaceholder();
4134
+ this.#updateMaxLength();
4135
+ }
4136
+ }
4137
+ this.#resolveUtilsScriptPromise();
4138
+ }
4139
+ //* Called when the utils request fails or times out.
4140
+ #handleUtilsFailure(error) {
4141
+ if (!this.#ui.telInput) {
4142
+ this.#rejectUtilsScriptPromise?.(error);
4143
+ return;
4144
+ }
4145
+ this.#rejectUtilsScriptPromise(error);
4146
+ }
4147
+ //********************
4148
+ //* PUBLIC METHODS
4149
+ //********************
4150
+ //* Remove plugin.
4151
+ destroy() {
4152
+ if (!this.#ui.telInput) {
4153
+ return;
4154
+ }
4155
+ if (this.#options.allowDropdown) {
4156
+ this.#closeDropdown(true);
4157
+ }
4158
+ this.#abortController.abort();
4159
+ this.#abortController = null;
4160
+ this.#ui.destroy();
4161
+ delete intlTelInput.instances[this.id];
4162
+ }
4163
+ // check if the instance is still valid (not destroyed/unmounted)
4164
+ isActive() {
4165
+ return !!this.#ui?.telInput;
4166
+ }
4167
+ //* Get the extension from the current number.
4168
+ getExtension() {
4169
+ if (intlTelInput.utils && this.#ui.telInput) {
4170
+ return intlTelInput.utils.getExtension(
4171
+ this.#getFullNumber(),
4172
+ this.#selectedCountryData?.iso2
4173
+ );
4174
+ }
4175
+ return "";
4176
+ }
4177
+ //* Format the number to the given format.
4178
+ getNumber(format) {
4179
+ if (intlTelInput.utils && this.#ui.telInput) {
4180
+ const iso2 = this.#selectedCountryData?.iso2;
4181
+ const fullNumber = this.#getFullNumber();
4182
+ const formattedNumber = intlTelInput.utils.formatNumber(
4183
+ fullNumber,
4184
+ iso2,
4185
+ format
4186
+ );
4187
+ return this.#numerals.denormalise(formattedNumber);
4188
+ }
4189
+ return "";
4190
+ }
4191
+ //* Get the type of the entered number e.g. landline/mobile.
4192
+ getNumberType() {
4193
+ if (intlTelInput.utils && this.#ui.telInput) {
4194
+ return intlTelInput.utils.getNumberType(
4195
+ this.#getFullNumber(),
4196
+ this.#selectedCountryData?.iso2
4197
+ );
4198
+ }
4199
+ return SENTINELS.UNKNOWN_NUMBER_TYPE;
4200
+ }
4201
+ //* Get the country data for the currently selected country.
4202
+ getSelectedCountryData() {
4203
+ return this.#getPublicCountryData();
4204
+ }
4205
+ //* Get the validation error.
4206
+ getValidationError() {
4207
+ if (intlTelInput.utils && this.#ui.telInput) {
4208
+ const iso2 = this.#selectedCountryData?.iso2;
4209
+ return intlTelInput.utils.getValidationError(this.#getFullNumber(), iso2);
4210
+ }
4211
+ return SENTINELS.UNKNOWN_VALIDATION_ERROR;
4212
+ }
4213
+ //* Validate the input val using number length only
4214
+ isValidNumber() {
4215
+ const dialCode = this.#selectedCountryData?.dialCode;
4216
+ const iso2 = this.#selectedCountryData?.iso2;
4217
+ if (intlTelInput.utils && this.#ui.telInput) {
4218
+ const number = this.#getFullNumber();
4219
+ const coreNumber = intlTelInput.utils.getCoreNumber(number, iso2);
4220
+ if (coreNumber) {
4221
+ if (dialCode === UK.DIAL_CODE) {
4222
+ if (coreNumber[0] === UK.MOBILE_PREFIX && coreNumber.length !== UK.MOBILE_CORE_LENGTH) {
4223
+ return false;
4224
+ }
4225
+ }
4226
+ const hasAlphaChar = REGEX.ALPHA_UNICODE.test(number);
4227
+ if (!hasAlphaChar && dialCode) {
4228
+ const nationalPortion = number.startsWith("+") ? number.slice(1 + dialCode.length) : number;
4229
+ const nationalDigitCount = getNumeric(nationalPortion).length;
4230
+ if (coreNumber.length > nationalDigitCount) {
4231
+ return false;
4232
+ }
4233
+ }
4234
+ }
4235
+ }
4236
+ return this.#validateNumber(false);
4237
+ }
4238
+ //* Validate the input val with precise validation
4239
+ isValidNumberPrecise() {
4240
+ return this.#validateNumber(true);
4241
+ }
4242
+ #utilsIsPossibleNumber(val) {
4243
+ return intlTelInput.utils ? intlTelInput.utils.isPossibleNumber(
4244
+ val,
4245
+ this.#selectedCountryData?.iso2,
4246
+ this.#options.allowedNumberTypes
4247
+ ) : null;
4248
+ }
4249
+ //* Shared internal validation logic to handle alpha character extension rules.
4250
+ #validateNumber(precise) {
4251
+ if (!intlTelInput.utils || !this.#ui.telInput) {
4252
+ return null;
4253
+ }
4254
+ const { allowNumberExtensions, allowPhonewords } = this.#options;
4255
+ const testValidity = (s) => precise ? this.#utilsIsValidNumber(s) : this.#utilsIsPossibleNumber(s);
4256
+ const val = this.#getFullNumber();
4257
+ if (!this.#selectedCountryData?.iso2) {
4258
+ const isRegionlessDialCode = hasRegionlessDialCode(val);
4259
+ if (!isRegionlessDialCode) {
4260
+ return false;
4261
+ }
4262
+ }
4263
+ if (!testValidity(val)) {
4264
+ return false;
4265
+ }
4266
+ const alphaCharPosition = val.search(REGEX.ALPHA_UNICODE);
4267
+ const hasAlphaChar = alphaCharPosition > -1;
4268
+ if (hasAlphaChar) {
4269
+ const selectedIso2 = this.#selectedCountryData?.iso2;
4270
+ const hasExtension = Boolean(intlTelInput.utils.getExtension(val, selectedIso2));
4271
+ if (hasExtension) {
4272
+ return allowNumberExtensions;
4273
+ }
4274
+ return allowPhonewords;
4275
+ }
4276
+ return true;
4277
+ }
4278
+ #utilsIsValidNumber(val) {
4279
+ return intlTelInput.utils ? intlTelInput.utils.isValidNumber(
4280
+ val,
4281
+ this.#selectedCountryData?.iso2,
4282
+ this.#options.allowedNumberTypes
4283
+ ) : null;
4284
+ }
4285
+ //* Update the selected country, and update the input val accordingly.
4286
+ setCountry(iso2) {
4287
+ if (!this.#ui.telInput) {
4288
+ return;
4289
+ }
4290
+ const iso2Lower = iso2?.toLowerCase();
4291
+ if (!isIso2(iso2Lower)) {
4292
+ throw new Error(`Invalid country code: '${iso2Lower}'`);
4293
+ }
4294
+ const currentCountry = this.#selectedCountryData?.iso2;
4295
+ const isCountryChange = iso2 && iso2Lower !== currentCountry || !iso2 && currentCountry;
4296
+ if (isCountryChange) {
4297
+ this.#setCountry(iso2Lower);
4298
+ this.#updateDialCode(this.#selectedCountryData?.dialCode || "");
4299
+ if (this.#options.formatOnDisplay) {
4300
+ const inputValue = this.#getTelInputValue();
4301
+ this.#updateValFromNumber(inputValue);
4302
+ }
4303
+ this.#triggerCountryChange();
4304
+ }
4305
+ }
4306
+ //* Set the input value and update the country.
4307
+ setNumber(number) {
4308
+ if (!this.#ui.telInput) {
4309
+ return;
4310
+ }
4311
+ const normalisedNumber = this.#numerals.normalise(number);
4312
+ const countryChanged = this.#updateCountryFromNumber(normalisedNumber);
4313
+ this.#updateValFromNumber(normalisedNumber);
4314
+ if (countryChanged) {
4315
+ this.#triggerCountryChange();
4316
+ }
4317
+ this.#trigger(EVENTS.INPUT, { isSetNumber: true });
4318
+ }
4319
+ //* Set the placeholder number typ
4320
+ setPlaceholderNumberType(type) {
4321
+ if (!this.#ui.telInput) {
4322
+ return;
4323
+ }
4324
+ this.#options.placeholderNumberType = type;
4325
+ this.#updatePlaceholder();
4326
+ }
4327
+ setDisabled(disabled) {
4328
+ if (!this.#ui.telInput) {
4329
+ return;
4330
+ }
4331
+ this.#ui.telInput.disabled = disabled;
4332
+ if (this.#ui.selectedCountry) {
4333
+ if (disabled) {
4334
+ this.#ui.selectedCountry.setAttribute("disabled", "true");
4335
+ } else {
4336
+ this.#ui.selectedCountry.removeAttribute("disabled");
4337
+ }
4338
+ }
4339
+ }
4340
+ //********************
4341
+ //* STATIC METHODS
4342
+ //********************
4343
+ // Internal instance notification used by utils/geoip loaders.
4344
+ // Kept public so module-level helpers (e.g. attachUtils) can call it, while still allowing
4345
+ // access to private instance methods.
4346
+ static forEachInstance(method, ...args) {
4347
+ const values = Object.values(intlTelInput.instances);
4348
+ const arg = args[0];
4349
+ values.forEach((instance) => {
4350
+ if (!(instance instanceof _Iti)) {
4351
+ return;
4352
+ }
4353
+ switch (method) {
4354
+ case "handleUtils":
4355
+ instance.#handleUtils();
4356
+ break;
4357
+ case "handleUtilsFailure":
4358
+ instance.#handleUtilsFailure(arg);
4359
+ break;
4360
+ case "handleAutoCountry":
4361
+ instance.#handleAutoCountry();
4362
+ break;
4363
+ case "handleAutoCountryFailure":
4364
+ instance.#handleAutoCountryFailure();
4365
+ break;
4366
+ }
4367
+ });
4368
+ }
4369
+ };
4370
+ var attachUtils = (source) => {
4371
+ if (!intlTelInput.utils && !intlTelInput.startedLoadingUtilsScript) {
4372
+ let loadCall;
4373
+ if (typeof source === "function") {
4374
+ try {
4375
+ loadCall = Promise.resolve(source());
4376
+ } catch (error) {
4377
+ return Promise.reject(error);
4378
+ }
4379
+ } else {
4380
+ return Promise.reject(
4381
+ new TypeError(
4382
+ `The argument passed to attachUtils must be a function that returns a promise for the utilities module, not ${typeof source}`
4383
+ )
4384
+ );
4385
+ }
4386
+ intlTelInput.startedLoadingUtilsScript = true;
4387
+ return loadCall.then((module) => {
4388
+ const utils = module?.default;
4389
+ if (!utils || typeof utils !== "object") {
4390
+ throw new TypeError(
4391
+ "The loader function passed to attachUtils did not resolve to a module object with utils as its default export."
4392
+ );
4393
+ }
4394
+ intlTelInput.utils = utils;
4395
+ Iti.forEachInstance("handleUtils");
4396
+ return true;
4397
+ }).catch((error) => {
4398
+ Iti.forEachInstance("handleUtilsFailure", error);
4399
+ throw error;
4400
+ });
4401
+ }
4402
+ return null;
4403
+ };
4404
+ var intlTelInput = Object.assign(
4405
+ (input, options) => {
4406
+ const iti = new Iti(input, options);
4407
+ intlTelInput.instances[iti.id] = iti;
4408
+ input.iti = iti;
4409
+ return iti;
4410
+ },
4411
+ {
4412
+ defaults,
4413
+ //* Using a static var like this allows us to mock it in the tests.
4414
+ documentReady: () => document.readyState === "complete",
4415
+ //* Get the country data object.
4416
+ getCountryData: () => data_default,
4417
+ //* A getter for the plugin instance.
4418
+ getInstance: (input) => {
4419
+ const id2 = input.dataset.intlTelInputId;
4420
+ return id2 ? intlTelInput.instances[id2] : null;
4421
+ },
4422
+ //* A map from instance ID to instance object.
4423
+ instances: {},
4424
+ attachUtils,
4425
+ startedLoadingUtilsScript: false,
4426
+ startedLoadingAutoCountry: false,
4427
+ version: "26.9.2"
4428
+ }
4429
+ );
4430
+ var intl_tel_input_default = intlTelInput;
4431
+ return __toCommonJS(intl_tel_input_exports);
4432
+ })();
4433
+
4434
+ // UMD
4435
+ return factoryOutput.default;
4436
+ }));
4437
+ } (intlTelInput$2));
4438
+ return intlTelInput$2.exports;
4439
+ }
4440
+
4441
+ var intlTelInputExports = requireIntlTelInput();
4442
+ var intlTelInput = /*@__PURE__*/index.getDefaultExportFromCjs(intlTelInputExports);
4443
+
4444
+ var intlTelInput$1 = /*#__PURE__*/_mergeNamespaces({
4445
+ __proto__: null,
4446
+ default: intlTelInput
4447
+ }, [intlTelInputExports]);
4448
+
4449
+ exports.intlTelInput = intlTelInput$1;