@salla.sa/twilight-components 1.0.62 → 1.0.64

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 (180) hide show
  1. package/dist/cjs/{Helper-98cc9f18.js → Helper-8ae6a805.js} +3 -0
  2. package/dist/cjs/{index-543e387e.js → index-c0f5bb97.js} +103 -144
  3. package/dist/cjs/index.cjs.js +3 -0
  4. package/dist/cjs/loader.cjs.js +6 -3
  5. package/dist/cjs/salla-branches.cjs.entry.js +7 -4
  6. package/dist/cjs/salla-button.cjs.entry.js +5 -2
  7. package/dist/cjs/salla-conditional-fields.cjs.entry.js +4 -1
  8. package/dist/cjs/salla-infinite-scroll.cjs.entry.js +6 -3
  9. package/dist/cjs/salla-installment.cjs.entry.js +77 -0
  10. package/dist/cjs/salla-localization-modal.cjs.entry.js +6 -3
  11. package/dist/cjs/salla-login-modal.cjs.entry.js +9 -6
  12. package/dist/cjs/salla-modal_2.cjs.entry.js +20 -17
  13. package/dist/cjs/salla-offer-modal.cjs.entry.js +7 -5
  14. package/dist/cjs/salla-product-availability.cjs.entry.js +10 -6
  15. package/dist/cjs/salla-quantity-input.cjs.entry.js +4 -1
  16. package/dist/cjs/salla-rating-modal.cjs.entry.js +9 -7
  17. package/dist/cjs/salla-rating-stars.cjs.entry.js +26 -21
  18. package/dist/cjs/salla-tel-input.cjs.entry.js +6 -3
  19. package/dist/cjs/salla-verify-modal.cjs.entry.js +8 -5
  20. package/dist/cjs/twilight-components.cjs.js +6 -3
  21. package/dist/collection/Helpers/Helper.js +3 -0
  22. package/dist/collection/collection-manifest.json +3 -4
  23. package/dist/collection/components/salla-branches/salla-branches.css +3 -1086
  24. package/dist/collection/components/salla-branches/salla-branches.js +5 -2
  25. package/dist/collection/components/salla-button/salla-button.css +3 -1086
  26. package/dist/collection/components/salla-button/salla-button.js +5 -2
  27. package/dist/collection/components/salla-conditional-fields/salla-conditional-fields.js +3 -0
  28. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.css +3 -1086
  29. package/dist/collection/components/salla-infinite-scroll/salla-infinite-scroll.js +3 -0
  30. package/dist/collection/components/salla-installment/salla-installment.css +105 -0
  31. package/dist/collection/components/salla-installment/salla-installment.js +138 -0
  32. package/dist/collection/components/salla-localization-modal/salla-localization-modal.css +15 -18
  33. package/dist/collection/components/salla-localization-modal/salla-localization-modal.js +3 -0
  34. package/dist/collection/components/salla-login-modal/salla-login-modal.css +3 -1086
  35. package/dist/collection/components/salla-login-modal/salla-login-modal.js +6 -3
  36. package/dist/collection/components/salla-modal/salla-modal.css +3 -1086
  37. package/dist/collection/components/salla-modal/salla-modal.js +17 -14
  38. package/dist/collection/components/salla-offer-modal/offer-schema.js +3 -0
  39. package/dist/collection/components/salla-offer-modal/salla-offer-modal.css +6 -1086
  40. package/dist/collection/components/salla-offer-modal/salla-offer-modal.js +9 -7
  41. package/dist/collection/components/salla-product-availability/salla-product-availability.css +3 -1086
  42. package/dist/collection/components/salla-product-availability/salla-product-availability.js +8 -5
  43. package/dist/collection/components/salla-quantity-input/salla-quantity-input.js +3 -0
  44. package/dist/collection/components/salla-rating-modal/order-feedback-response.js +3 -0
  45. package/dist/collection/components/salla-rating-modal/salla-rating-modal.css +17 -1087
  46. package/dist/collection/components/salla-rating-modal/salla-rating-modal.js +7 -4
  47. package/dist/collection/components/salla-rating-stars/salla-rating-stars.css +3 -1086
  48. package/dist/collection/components/salla-rating-stars/salla-rating-stars.js +23 -18
  49. package/dist/collection/components/salla-search/salla-search.css +15 -1088
  50. package/dist/collection/components/salla-search/salla-search.js +8 -5
  51. package/dist/collection/components/salla-search/search-response.js +3 -0
  52. package/dist/collection/components/salla-tel-input/salla-tel-input.css +223 -227
  53. package/dist/collection/components/salla-tel-input/salla-tel-input.js +3 -0
  54. package/dist/collection/components/salla-verify-modal/salla-verify-modal.css +3 -1086
  55. package/dist/collection/components/salla-verify-modal/salla-verify-modal.js +7 -4
  56. package/dist/collection/index.js +3 -0
  57. package/dist/collection/interfaces/colors.js +3 -0
  58. package/dist/collection/interfaces/index.js +3 -0
  59. package/dist/collection/interfaces/ratio.js +3 -0
  60. package/dist/components/Helper.js +3 -0
  61. package/dist/components/index.d.ts +1 -1
  62. package/dist/components/index.js +3 -0
  63. package/dist/components/salla-branches.d.ts +4 -0
  64. package/dist/components/salla-branches.js +49 -8
  65. package/dist/components/salla-button.d.ts +4 -0
  66. package/dist/components/salla-button.js +7 -116
  67. package/dist/components/salla-button2.js +149 -0
  68. package/dist/components/salla-conditional-fields.d.ts +4 -0
  69. package/dist/components/salla-conditional-fields.js +23 -5
  70. package/dist/components/salla-infinite-scroll.d.ts +4 -0
  71. package/dist/components/salla-infinite-scroll.js +32 -6
  72. package/dist/components/salla-installment.d.ts +11 -0
  73. package/dist/components/salla-installment.js +98 -0
  74. package/dist/components/salla-localization-modal.d.ts +4 -0
  75. package/dist/components/salla-localization-modal.js +47 -6
  76. package/dist/components/salla-login-modal.d.ts +4 -0
  77. package/dist/components/salla-login-modal.js +70 -9
  78. package/dist/components/salla-modal.d.ts +4 -0
  79. package/dist/components/salla-modal.js +7 -150
  80. package/dist/components/salla-modal2.js +185 -0
  81. package/dist/components/salla-offer-modal.d.ts +4 -0
  82. package/dist/components/salla-offer-modal.js +47 -8
  83. package/dist/components/salla-product-availability.d.ts +4 -0
  84. package/dist/components/salla-product-availability.js +58 -9
  85. package/dist/components/salla-quantity-input.d.ts +4 -0
  86. package/dist/components/salla-quantity-input.js +25 -5
  87. package/dist/components/salla-rating-modal.d.ts +4 -0
  88. package/dist/components/salla-rating-modal.js +50 -10
  89. package/dist/components/salla-rating-stars.d.ts +4 -0
  90. package/dist/components/salla-rating-stars.js +7 -77
  91. package/dist/components/salla-rating-stars2.js +100 -0
  92. package/dist/components/salla-search.d.ts +4 -0
  93. package/dist/components/salla-search.js +42 -11
  94. package/dist/components/salla-tel-input.d.ts +4 -0
  95. package/dist/components/salla-tel-input.js +6 -1474
  96. package/dist/components/salla-tel-input2.js +1506 -0
  97. package/dist/components/salla-verify-modal.d.ts +4 -0
  98. package/dist/components/salla-verify-modal.js +7 -145
  99. package/dist/components/salla-verify-modal2.js +182 -0
  100. package/dist/esm/{Helper-7162a06c.js → Helper-e1d414a5.js} +3 -0
  101. package/dist/esm/{index-2423ebcb.js → index-a1271335.js} +103 -144
  102. package/dist/esm/index.js +3 -1
  103. package/dist/esm/loader.js +6 -3
  104. package/dist/esm/polyfills/css-shim.js +1 -1
  105. package/dist/esm/salla-branches.entry.js +7 -4
  106. package/dist/esm/salla-button.entry.js +5 -2
  107. package/dist/esm/salla-conditional-fields.entry.js +4 -1
  108. package/dist/esm/salla-infinite-scroll.entry.js +6 -3
  109. package/dist/esm/salla-installment.entry.js +73 -0
  110. package/dist/esm/salla-localization-modal.entry.js +6 -3
  111. package/dist/esm/salla-login-modal.entry.js +9 -6
  112. package/dist/esm/salla-modal_2.entry.js +20 -17
  113. package/dist/esm/salla-offer-modal.entry.js +7 -5
  114. package/dist/esm/salla-product-availability.entry.js +10 -6
  115. package/dist/esm/salla-quantity-input.entry.js +4 -1
  116. package/dist/esm/salla-rating-modal.entry.js +9 -7
  117. package/dist/esm/salla-rating-stars.entry.js +26 -21
  118. package/dist/esm/salla-tel-input.entry.js +6 -3
  119. package/dist/esm/salla-verify-modal.entry.js +8 -5
  120. package/dist/esm/twilight-components.js +6 -3
  121. package/dist/twilight-components/index.esm.js +3 -0
  122. package/dist/twilight-components/p-18b36fe0.entry.js +4 -0
  123. package/dist/twilight-components/p-191c7430.entry.js +4 -0
  124. package/dist/twilight-components/{p-e3cbda45.entry.js → p-2aaea044.entry.js} +4 -1
  125. package/dist/twilight-components/p-4679b0f7.entry.js +4 -0
  126. package/dist/twilight-components/p-51ef8f42.entry.js +4 -0
  127. package/dist/twilight-components/p-676beef2.entry.js +4 -0
  128. package/dist/twilight-components/p-69b8ebc1.entry.js +4 -0
  129. package/dist/twilight-components/{p-0e85664f.entry.js → p-81dedc75.entry.js} +4 -1
  130. package/dist/twilight-components/p-87e0df12.entry.js +4 -0
  131. package/dist/twilight-components/p-8ee2e4db.js +4 -0
  132. package/dist/twilight-components/p-976b7d27.entry.js +4 -0
  133. package/dist/twilight-components/{p-ed1c00c5.js → p-9d2ca9c8.js} +3 -0
  134. package/dist/twilight-components/{p-01accdcd.entry.js → p-9eaeceb7.entry.js} +4 -1
  135. package/dist/twilight-components/p-a6a4a2bd.entry.js +4 -0
  136. package/dist/twilight-components/p-ab83b063.entry.js +4 -0
  137. package/dist/twilight-components/p-c3b196f3.entry.js +4 -0
  138. package/dist/twilight-components/p-fa55e3ea.entry.js +4 -0
  139. package/dist/twilight-components/twilight-components.esm.js +4 -1
  140. package/dist/types/components/salla-installment/salla-installment.d.ts +11 -0
  141. package/dist/types/components/salla-modal/salla-modal.d.ts +4 -4
  142. package/dist/types/components/salla-search/salla-search.d.ts +2 -2
  143. package/dist/types/components/salla-search/search-response.d.ts +42 -16
  144. package/dist/types/components.d.ts +22 -29
  145. package/dist/types/stencil-public-runtime.d.ts +6 -4
  146. package/loader/cdn.js +3 -1
  147. package/loader/index.cjs.js +3 -1
  148. package/loader/index.d.ts +0 -1
  149. package/loader/index.es2017.js +3 -1
  150. package/loader/index.js +3 -1
  151. package/package.json +1 -1
  152. package/dist/cjs/salla-tabby.cjs.entry.js +0 -19
  153. package/dist/cjs/salla-tamara.cjs.entry.js +0 -19
  154. package/dist/collection/components/salla-tabby/salla-tabby.css +0 -1117
  155. package/dist/collection/components/salla-tabby/salla-tabby.js +0 -14
  156. package/dist/collection/components/salla-tamara/salla-tamara.css +0 -1135
  157. package/dist/collection/components/salla-tamara/salla-tamara.js +0 -15
  158. package/dist/components/salla-tabby.d.ts +0 -7
  159. package/dist/components/salla-tabby.js +0 -18
  160. package/dist/components/salla-tamara.d.ts +0 -7
  161. package/dist/components/salla-tamara.js +0 -19
  162. package/dist/esm/salla-tabby.entry.js +0 -15
  163. package/dist/esm/salla-tamara.entry.js +0 -15
  164. package/dist/twilight-components/p-0ee36dd8.entry.js +0 -1
  165. package/dist/twilight-components/p-1fb0ca8a.js +0 -1
  166. package/dist/twilight-components/p-1ffd27c4.entry.js +0 -1
  167. package/dist/twilight-components/p-2012882b.entry.js +0 -1
  168. package/dist/twilight-components/p-3d9fd3d3.entry.js +0 -1
  169. package/dist/twilight-components/p-5b2cdd7c.entry.js +0 -1
  170. package/dist/twilight-components/p-728bd268.entry.js +0 -1
  171. package/dist/twilight-components/p-72985a41.entry.js +0 -1
  172. package/dist/twilight-components/p-747f80df.entry.js +0 -1
  173. package/dist/twilight-components/p-81a7a676.entry.js +0 -1
  174. package/dist/twilight-components/p-880711d4.entry.js +0 -1
  175. package/dist/twilight-components/p-8dd742df.entry.js +0 -1
  176. package/dist/twilight-components/p-9642541b.entry.js +0 -1
  177. package/dist/twilight-components/p-a24588ab.entry.js +0 -1
  178. package/dist/twilight-components/twilight-components.css +0 -1
  179. package/dist/types/components/salla-tabby/salla-tabby.d.ts +0 -3
  180. package/dist/types/components/salla-tamara/salla-tamara.d.ts +0 -3
@@ -0,0 +1,1506 @@
1
+ /*!
2
+ * Crafted with ❤ by Salla
3
+ */
4
+ import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
+ import { H as Helper } from './Helper.js';
6
+
7
+ function createCommonjsModule(fn, basedir, module) {
8
+ return module = {
9
+ path: basedir,
10
+ exports: {},
11
+ require: function (path, base) {
12
+ return commonjsRequire();
13
+ }
14
+ }, fn(module, module.exports), module.exports;
15
+ }
16
+
17
+ function commonjsRequire () {
18
+ throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs');
19
+ }
20
+
21
+ var intlTelInput$1 = createCommonjsModule(function (module) {
22
+ /*
23
+ * International Telephone Input v17.0.15
24
+ * https://github.com/jackocnr/intl-tel-input.git
25
+ * Licensed under the MIT license
26
+ */
27
+
28
+ // wrap in UMD
29
+ (function(factory) {
30
+ if (module.exports) module.exports = factory(); else window.intlTelInput = factory();
31
+ })(function(undefined$1) {
32
+ return function() {
33
+ // Array of country objects for the flag dropdown.
34
+ // Here is the criteria for the plugin to support a given country/territory
35
+ // - It has an iso2 code: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
36
+ // - It has it's own country calling code (it is not a sub-region of another country): https://en.wikipedia.org/wiki/List_of_country_calling_codes
37
+ // - It has a flag in the region-flags project: https://github.com/behdad/region-flags/tree/gh-pages/png
38
+ // - It is supported by libphonenumber (it must be listed on this page): https://github.com/googlei18n/libphonenumber/blob/master/resources/ShortNumberMetadata.xml
39
+ // Each country array has the following information:
40
+ // [
41
+ // Country name,
42
+ // iso2 code,
43
+ // International dial code,
44
+ // Order (if >1 country with same dial code),
45
+ // Area codes
46
+ // ]
47
+ var allCountries = [ [ "Afghanistan (‫افغانستان‬‎)", "af", "93" ], [ "Albania (Shqipëri)", "al", "355" ], [ "Algeria (‫الجزائر‬‎)", "dz", "213" ], [ "American Samoa", "as", "1", 5, [ "684" ] ], [ "Andorra", "ad", "376" ], [ "Angola", "ao", "244" ], [ "Anguilla", "ai", "1", 6, [ "264" ] ], [ "Antigua and Barbuda", "ag", "1", 7, [ "268" ] ], [ "Argentina", "ar", "54" ], [ "Armenia (Հայաստան)", "am", "374" ], [ "Aruba", "aw", "297" ], [ "Ascension Island", "ac", "247" ], [ "Australia", "au", "61", 0 ], [ "Austria (Österreich)", "at", "43" ], [ "Azerbaijan (Azərbaycan)", "az", "994" ], [ "Bahamas", "bs", "1", 8, [ "242" ] ], [ "Bahrain (‫البحرين‬‎)", "bh", "973" ], [ "Bangladesh (বাংলাদেশ)", "bd", "880" ], [ "Barbados", "bb", "1", 9, [ "246" ] ], [ "Belarus (Беларусь)", "by", "375" ], [ "Belgium (België)", "be", "32" ], [ "Belize", "bz", "501" ], [ "Benin (Bénin)", "bj", "229" ], [ "Bermuda", "bm", "1", 10, [ "441" ] ], [ "Bhutan (འབྲུག)", "bt", "975" ], [ "Bolivia", "bo", "591" ], [ "Bosnia and Herzegovina (Босна и Херцеговина)", "ba", "387" ], [ "Botswana", "bw", "267" ], [ "Brazil (Brasil)", "br", "55" ], [ "British Indian Ocean Territory", "io", "246" ], [ "British Virgin Islands", "vg", "1", 11, [ "284" ] ], [ "Brunei", "bn", "673" ], [ "Bulgaria (България)", "bg", "359" ], [ "Burkina Faso", "bf", "226" ], [ "Burundi (Uburundi)", "bi", "257" ], [ "Cambodia (កម្ពុជា)", "kh", "855" ], [ "Cameroon (Cameroun)", "cm", "237" ], [ "Canada", "ca", "1", 1, [ "204", "226", "236", "249", "250", "289", "306", "343", "365", "387", "403", "416", "418", "431", "437", "438", "450", "506", "514", "519", "548", "579", "581", "587", "604", "613", "639", "647", "672", "705", "709", "742", "778", "780", "782", "807", "819", "825", "867", "873", "902", "905" ] ], [ "Cape Verde (Kabu Verdi)", "cv", "238" ], [ "Caribbean Netherlands", "bq", "599", 1, [ "3", "4", "7" ] ], [ "Cayman Islands", "ky", "1", 12, [ "345" ] ], [ "Central African Republic (République centrafricaine)", "cf", "236" ], [ "Chad (Tchad)", "td", "235" ], [ "Chile", "cl", "56" ], [ "China (中国)", "cn", "86" ], [ "Christmas Island", "cx", "61", 2, [ "89164" ] ], [ "Cocos (Keeling) Islands", "cc", "61", 1, [ "89162" ] ], [ "Colombia", "co", "57" ], [ "Comoros (‫جزر القمر‬‎)", "km", "269" ], [ "Congo (DRC) (Jamhuri ya Kidemokrasia ya Kongo)", "cd", "243" ], [ "Congo (Republic) (Congo-Brazzaville)", "cg", "242" ], [ "Cook Islands", "ck", "682" ], [ "Costa Rica", "cr", "506" ], [ "Côte d’Ivoire", "ci", "225" ], [ "Croatia (Hrvatska)", "hr", "385" ], [ "Cuba", "cu", "53" ], [ "Curaçao", "cw", "599", 0 ], [ "Cyprus (Κύπρος)", "cy", "357" ], [ "Czech Republic (Česká republika)", "cz", "420" ], [ "Denmark (Danmark)", "dk", "45" ], [ "Djibouti", "dj", "253" ], [ "Dominica", "dm", "1", 13, [ "767" ] ], [ "Dominican Republic (República Dominicana)", "do", "1", 2, [ "809", "829", "849" ] ], [ "Ecuador", "ec", "593" ], [ "Egypt (‫مصر‬‎)", "eg", "20" ], [ "El Salvador", "sv", "503" ], [ "Equatorial Guinea (Guinea Ecuatorial)", "gq", "240" ], [ "Eritrea", "er", "291" ], [ "Estonia (Eesti)", "ee", "372" ], [ "Eswatini", "sz", "268" ], [ "Ethiopia", "et", "251" ], [ "Falkland Islands (Islas Malvinas)", "fk", "500" ], [ "Faroe Islands (Føroyar)", "fo", "298" ], [ "Fiji", "fj", "679" ], [ "Finland (Suomi)", "fi", "358", 0 ], [ "France", "fr", "33" ], [ "French Guiana (Guyane française)", "gf", "594" ], [ "French Polynesia (Polynésie française)", "pf", "689" ], [ "Gabon", "ga", "241" ], [ "Gambia", "gm", "220" ], [ "Georgia (საქართველო)", "ge", "995" ], [ "Germany (Deutschland)", "de", "49" ], [ "Ghana (Gaana)", "gh", "233" ], [ "Gibraltar", "gi", "350" ], [ "Greece (Ελλάδα)", "gr", "30" ], [ "Greenland (Kalaallit Nunaat)", "gl", "299" ], [ "Grenada", "gd", "1", 14, [ "473" ] ], [ "Guadeloupe", "gp", "590", 0 ], [ "Guam", "gu", "1", 15, [ "671" ] ], [ "Guatemala", "gt", "502" ], [ "Guernsey", "gg", "44", 1, [ "1481", "7781", "7839", "7911" ] ], [ "Guinea (Guinée)", "gn", "224" ], [ "Guinea-Bissau (Guiné Bissau)", "gw", "245" ], [ "Guyana", "gy", "592" ], [ "Haiti", "ht", "509" ], [ "Honduras", "hn", "504" ], [ "Hong Kong (香港)", "hk", "852" ], [ "Hungary (Magyarország)", "hu", "36" ], [ "Iceland (Ísland)", "is", "354" ], [ "India (भारत)", "in", "91" ], [ "Indonesia", "id", "62" ], [ "Iran (‫ایران‬‎)", "ir", "98" ], [ "Iraq (‫العراق‬‎)", "iq", "964" ], [ "Ireland", "ie", "353" ], [ "Isle of Man", "im", "44", 2, [ "1624", "74576", "7524", "7924", "7624" ] ], [ "Israel (‫ישראל‬‎)", "il", "972" ], [ "Italy (Italia)", "it", "39", 0 ], [ "Jamaica", "jm", "1", 4, [ "876", "658" ] ], [ "Japan (日本)", "jp", "81" ], [ "Jersey", "je", "44", 3, [ "1534", "7509", "7700", "7797", "7829", "7937" ] ], [ "Jordan (‫الأردن‬‎)", "jo", "962" ], [ "Kazakhstan (Казахстан)", "kz", "7", 1, [ "33", "7" ] ], [ "Kenya", "ke", "254" ], [ "Kiribati", "ki", "686" ], [ "Kosovo", "xk", "383" ], [ "Kuwait (‫الكويت‬‎)", "kw", "965" ], [ "Kyrgyzstan (Кыргызстан)", "kg", "996" ], [ "Laos (ລາວ)", "la", "856" ], [ "Latvia (Latvija)", "lv", "371" ], [ "Lebanon (‫لبنان‬‎)", "lb", "961" ], [ "Lesotho", "ls", "266" ], [ "Liberia", "lr", "231" ], [ "Libya (‫ليبيا‬‎)", "ly", "218" ], [ "Liechtenstein", "li", "423" ], [ "Lithuania (Lietuva)", "lt", "370" ], [ "Luxembourg", "lu", "352" ], [ "Macau (澳門)", "mo", "853" ], [ "North Macedonia (Македонија)", "mk", "389" ], [ "Madagascar (Madagasikara)", "mg", "261" ], [ "Malawi", "mw", "265" ], [ "Malaysia", "my", "60" ], [ "Maldives", "mv", "960" ], [ "Mali", "ml", "223" ], [ "Malta", "mt", "356" ], [ "Marshall Islands", "mh", "692" ], [ "Martinique", "mq", "596" ], [ "Mauritania (‫موريتانيا‬‎)", "mr", "222" ], [ "Mauritius (Moris)", "mu", "230" ], [ "Mayotte", "yt", "262", 1, [ "269", "639" ] ], [ "Mexico (México)", "mx", "52" ], [ "Micronesia", "fm", "691" ], [ "Moldova (Republica Moldova)", "md", "373" ], [ "Monaco", "mc", "377" ], [ "Mongolia (Монгол)", "mn", "976" ], [ "Montenegro (Crna Gora)", "me", "382" ], [ "Montserrat", "ms", "1", 16, [ "664" ] ], [ "Morocco (‫المغرب‬‎)", "ma", "212", 0 ], [ "Mozambique (Moçambique)", "mz", "258" ], [ "Myanmar (Burma) (မြန်မာ)", "mm", "95" ], [ "Namibia (Namibië)", "na", "264" ], [ "Nauru", "nr", "674" ], [ "Nepal (नेपाल)", "np", "977" ], [ "Netherlands (Nederland)", "nl", "31" ], [ "New Caledonia (Nouvelle-Calédonie)", "nc", "687" ], [ "New Zealand", "nz", "64" ], [ "Nicaragua", "ni", "505" ], [ "Niger (Nijar)", "ne", "227" ], [ "Nigeria", "ng", "234" ], [ "Niue", "nu", "683" ], [ "Norfolk Island", "nf", "672" ], [ "North Korea (조선 민주주의 인민 공화국)", "kp", "850" ], [ "Northern Mariana Islands", "mp", "1", 17, [ "670" ] ], [ "Norway (Norge)", "no", "47", 0 ], [ "Oman (‫عُمان‬‎)", "om", "968" ], [ "Pakistan (‫پاکستان‬‎)", "pk", "92" ], [ "Palau", "pw", "680" ], [ "Palestine (‫فلسطين‬‎)", "ps", "970" ], [ "Panama (Panamá)", "pa", "507" ], [ "Papua New Guinea", "pg", "675" ], [ "Paraguay", "py", "595" ], [ "Peru (Perú)", "pe", "51" ], [ "Philippines", "ph", "63" ], [ "Poland (Polska)", "pl", "48" ], [ "Portugal", "pt", "351" ], [ "Puerto Rico", "pr", "1", 3, [ "787", "939" ] ], [ "Qatar (‫قطر‬‎)", "qa", "974" ], [ "Réunion (La Réunion)", "re", "262", 0 ], [ "Romania (România)", "ro", "40" ], [ "Russia (Россия)", "ru", "7", 0 ], [ "Rwanda", "rw", "250" ], [ "Saint Barthélemy", "bl", "590", 1 ], [ "Saint Helena", "sh", "290" ], [ "Saint Kitts and Nevis", "kn", "1", 18, [ "869" ] ], [ "Saint Lucia", "lc", "1", 19, [ "758" ] ], [ "Saint Martin (Saint-Martin (partie française))", "mf", "590", 2 ], [ "Saint Pierre and Miquelon (Saint-Pierre-et-Miquelon)", "pm", "508" ], [ "Saint Vincent and the Grenadines", "vc", "1", 20, [ "784" ] ], [ "Samoa", "ws", "685" ], [ "San Marino", "sm", "378" ], [ "São Tomé and Príncipe (São Tomé e Príncipe)", "st", "239" ], [ "Saudi Arabia (‫المملكة العربية السعودية‬‎)", "sa", "966" ], [ "Senegal (Sénégal)", "sn", "221" ], [ "Serbia (Србија)", "rs", "381" ], [ "Seychelles", "sc", "248" ], [ "Sierra Leone", "sl", "232" ], [ "Singapore", "sg", "65" ], [ "Sint Maarten", "sx", "1", 21, [ "721" ] ], [ "Slovakia (Slovensko)", "sk", "421" ], [ "Slovenia (Slovenija)", "si", "386" ], [ "Solomon Islands", "sb", "677" ], [ "Somalia (Soomaaliya)", "so", "252" ], [ "South Africa", "za", "27" ], [ "South Korea (대한민국)", "kr", "82" ], [ "South Sudan (‫جنوب السودان‬‎)", "ss", "211" ], [ "Spain (España)", "es", "34" ], [ "Sri Lanka (ශ්‍රී ලංකාව)", "lk", "94" ], [ "Sudan (‫السودان‬‎)", "sd", "249" ], [ "Suriname", "sr", "597" ], [ "Svalbard and Jan Mayen", "sj", "47", 1, [ "79" ] ], [ "Sweden (Sverige)", "se", "46" ], [ "Switzerland (Schweiz)", "ch", "41" ], [ "Syria (‫سوريا‬‎)", "sy", "963" ], [ "Taiwan (台灣)", "tw", "886" ], [ "Tajikistan", "tj", "992" ], [ "Tanzania", "tz", "255" ], [ "Thailand (ไทย)", "th", "66" ], [ "Timor-Leste", "tl", "670" ], [ "Togo", "tg", "228" ], [ "Tokelau", "tk", "690" ], [ "Tonga", "to", "676" ], [ "Trinidad and Tobago", "tt", "1", 22, [ "868" ] ], [ "Tunisia (‫تونس‬‎)", "tn", "216" ], [ "Turkey (Türkiye)", "tr", "90" ], [ "Turkmenistan", "tm", "993" ], [ "Turks and Caicos Islands", "tc", "1", 23, [ "649" ] ], [ "Tuvalu", "tv", "688" ], [ "U.S. Virgin Islands", "vi", "1", 24, [ "340" ] ], [ "Uganda", "ug", "256" ], [ "Ukraine (Україна)", "ua", "380" ], [ "United Arab Emirates (‫الإمارات العربية المتحدة‬‎)", "ae", "971" ], [ "United Kingdom", "gb", "44", 0 ], [ "United States", "us", "1", 0 ], [ "Uruguay", "uy", "598" ], [ "Uzbekistan (Oʻzbekiston)", "uz", "998" ], [ "Vanuatu", "vu", "678" ], [ "Vatican City (Città del Vaticano)", "va", "39", 1, [ "06698" ] ], [ "Venezuela", "ve", "58" ], [ "Vietnam (Việt Nam)", "vn", "84" ], [ "Wallis and Futuna (Wallis-et-Futuna)", "wf", "681" ], [ "Western Sahara (‫الصحراء الغربية‬‎)", "eh", "212", 1, [ "5288", "5289" ] ], [ "Yemen (‫اليمن‬‎)", "ye", "967" ], [ "Zambia", "zm", "260" ], [ "Zimbabwe", "zw", "263" ], [ "Åland Islands", "ax", "358", 1, [ "18" ] ] ];
48
+ // loop over all of the countries above, restructuring the data to be objects with named keys
49
+ for (var i = 0; i < allCountries.length; i++) {
50
+ var c = allCountries[i];
51
+ allCountries[i] = {
52
+ name: c[0],
53
+ iso2: c[1],
54
+ dialCode: c[2],
55
+ priority: c[3] || 0,
56
+ areaCodes: c[4] || null
57
+ };
58
+ }
59
+ function _classCallCheck(instance, Constructor) {
60
+ if (!(instance instanceof Constructor)) {
61
+ throw new TypeError("Cannot call a class as a function");
62
+ }
63
+ }
64
+ function _defineProperties(target, props) {
65
+ for (var i = 0; i < props.length; i++) {
66
+ var descriptor = props[i];
67
+ descriptor.enumerable = descriptor.enumerable || false;
68
+ descriptor.configurable = true;
69
+ if ("value" in descriptor) descriptor.writable = true;
70
+ Object.defineProperty(target, descriptor.key, descriptor);
71
+ }
72
+ }
73
+ function _createClass(Constructor, protoProps, staticProps) {
74
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
75
+ if (staticProps) _defineProperties(Constructor, staticProps);
76
+ return Constructor;
77
+ }
78
+ var intlTelInputGlobals = {
79
+ getInstance: function getInstance(input) {
80
+ var id = input.getAttribute("data-intl-tel-input-id");
81
+ return window.intlTelInputGlobals.instances[id];
82
+ },
83
+ instances: {},
84
+ // using a global like this allows us to mock it in the tests
85
+ documentReady: function documentReady() {
86
+ return document.readyState === "complete";
87
+ }
88
+ };
89
+ if (typeof window === "object") window.intlTelInputGlobals = intlTelInputGlobals;
90
+ // these vars persist through all instances of the plugin
91
+ var id = 0;
92
+ var defaults = {
93
+ // whether or not to allow the dropdown
94
+ allowDropdown: true,
95
+ // if there is just a dial code in the input: remove it on blur
96
+ autoHideDialCode: true,
97
+ // add a placeholder in the input with an example number for the selected country
98
+ autoPlaceholder: "polite",
99
+ // modify the parentClass
100
+ customContainer: "",
101
+ // modify the auto placeholder
102
+ customPlaceholder: null,
103
+ // append menu to specified element
104
+ dropdownContainer: null,
105
+ // don't display these countries
106
+ excludeCountries: [],
107
+ // format the input value during initialisation and on setNumber
108
+ formatOnDisplay: true,
109
+ // geoIp lookup function
110
+ geoIpLookup: null,
111
+ // inject a hidden input with this name, and on submit, populate it with the result of getNumber
112
+ hiddenInput: "",
113
+ // initial country
114
+ initialCountry: "",
115
+ // localized country names e.g. { 'de': 'Deutschland' }
116
+ localizedCountries: null,
117
+ // don't insert international dial codes
118
+ nationalMode: true,
119
+ // display only these countries
120
+ onlyCountries: [],
121
+ // number type to use for placeholders
122
+ placeholderNumberType: "MOBILE",
123
+ // the countries at the top of the list. defaults to united states and united kingdom
124
+ preferredCountries: [ "us", "gb" ],
125
+ // display the country dial code next to the selected flag so it's not part of the typed number
126
+ separateDialCode: false,
127
+ // specify the path to the libphonenumber script to enable validation/formatting
128
+ utilsScript: ""
129
+ };
130
+ // https://en.wikipedia.org/wiki/List_of_North_American_Numbering_Plan_area_codes#Non-geographic_area_codes
131
+ var regionlessNanpNumbers = [ "800", "822", "833", "844", "855", "866", "877", "880", "881", "882", "883", "884", "885", "886", "887", "888", "889" ];
132
+ // utility function to iterate over an object. can't use Object.entries or native forEach because
133
+ // of IE11
134
+ var forEachProp = function forEachProp(obj, callback) {
135
+ var keys = Object.keys(obj);
136
+ for (var i = 0; i < keys.length; i++) {
137
+ callback(keys[i], obj[keys[i]]);
138
+ }
139
+ };
140
+ // run a method on each instance of the plugin
141
+ var forEachInstance = function forEachInstance(method) {
142
+ forEachProp(window.intlTelInputGlobals.instances, function(key) {
143
+ window.intlTelInputGlobals.instances[key][method]();
144
+ });
145
+ };
146
+ // this is our plugin class that we will create an instance of
147
+ // eslint-disable-next-line no-unused-vars
148
+ var Iti = /*#__PURE__*/
149
+ function() {
150
+ function Iti(input, options) {
151
+ var _this = this;
152
+ _classCallCheck(this, Iti);
153
+ this.id = id++;
154
+ this.telInput = input;
155
+ this.activeItem = null;
156
+ this.highlightedItem = null;
157
+ // process specified options / defaults
158
+ // alternative to Object.assign, which isn't supported by IE11
159
+ var customOptions = options || {};
160
+ this.options = {};
161
+ forEachProp(defaults, function(key, value) {
162
+ _this.options[key] = customOptions.hasOwnProperty(key) ? customOptions[key] : value;
163
+ });
164
+ this.hadInitialPlaceholder = Boolean(input.getAttribute("placeholder"));
165
+ }
166
+ _createClass(Iti, [ {
167
+ key: "_init",
168
+ value: function _init() {
169
+ var _this2 = this;
170
+ // if in nationalMode, disable options relating to dial codes
171
+ if (this.options.nationalMode) this.options.autoHideDialCode = false;
172
+ // if separateDialCode then doesn't make sense to A) insert dial code into input
173
+ // (autoHideDialCode), and B) display national numbers (because we're displaying the country
174
+ // dial code next to them)
175
+ if (this.options.separateDialCode) {
176
+ this.options.autoHideDialCode = this.options.nationalMode = false;
177
+ }
178
+ // we cannot just test screen size as some smartphones/website meta tags will report desktop
179
+ // resolutions
180
+ // Note: for some reason jasmine breaks if you put this in the main Plugin function with the
181
+ // rest of these declarations
182
+ // Note: to target Android Mobiles (and not Tablets), we must find 'Android' and 'Mobile'
183
+ this.isMobile = /Android.+Mobile|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
184
+ if (this.isMobile) {
185
+ // trigger the mobile dropdown css
186
+ document.body.classList.add("iti-mobile");
187
+ // on mobile, we want a full screen dropdown, so we must append it to the body
188
+ if (!this.options.dropdownContainer) this.options.dropdownContainer = document.body;
189
+ }
190
+ // these promises get resolved when their individual requests complete
191
+ // this way the dev can do something like iti.promise.then(...) to know when all requests are
192
+ // complete
193
+ if (typeof Promise !== "undefined") {
194
+ var autoCountryPromise = new Promise(function(resolve, reject) {
195
+ _this2.resolveAutoCountryPromise = resolve;
196
+ _this2.rejectAutoCountryPromise = reject;
197
+ });
198
+ var utilsScriptPromise = new Promise(function(resolve, reject) {
199
+ _this2.resolveUtilsScriptPromise = resolve;
200
+ _this2.rejectUtilsScriptPromise = reject;
201
+ });
202
+ this.promise = Promise.all([ autoCountryPromise, utilsScriptPromise ]);
203
+ } else {
204
+ // prevent errors when Promise doesn't exist
205
+ this.resolveAutoCountryPromise = this.rejectAutoCountryPromise = function() {};
206
+ this.resolveUtilsScriptPromise = this.rejectUtilsScriptPromise = function() {};
207
+ }
208
+ // in various situations there could be no country selected initially, but we need to be able
209
+ // to assume this variable exists
210
+ this.selectedCountryData = {};
211
+ // process all the data: onlyCountries, excludeCountries, preferredCountries etc
212
+ this._processCountryData();
213
+ // generate the markup
214
+ this._generateMarkup();
215
+ // set the initial state of the input value and the selected flag
216
+ this._setInitialState();
217
+ // start all of the event listeners: autoHideDialCode, input keydown, selectedFlag click
218
+ this._initListeners();
219
+ // utils script, and auto country
220
+ this._initRequests();
221
+ }
222
+ }, {
223
+ key: "_processCountryData",
224
+ value: function _processCountryData() {
225
+ // process onlyCountries or excludeCountries array if present
226
+ this._processAllCountries();
227
+ // process the countryCodes map
228
+ this._processCountryCodes();
229
+ // process the preferredCountries
230
+ this._processPreferredCountries();
231
+ // translate countries according to localizedCountries option
232
+ if (this.options.localizedCountries) this._translateCountriesByLocale();
233
+ // sort countries by name
234
+ if (this.options.onlyCountries.length || this.options.localizedCountries) {
235
+ this.countries.sort(this._countryNameSort);
236
+ }
237
+ }
238
+ }, {
239
+ key: "_addCountryCode",
240
+ value: function _addCountryCode(iso2, countryCode, priority) {
241
+ if (countryCode.length > this.countryCodeMaxLen) {
242
+ this.countryCodeMaxLen = countryCode.length;
243
+ }
244
+ if (!this.countryCodes.hasOwnProperty(countryCode)) {
245
+ this.countryCodes[countryCode] = [];
246
+ }
247
+ // bail if we already have this country for this countryCode
248
+ for (var i = 0; i < this.countryCodes[countryCode].length; i++) {
249
+ if (this.countryCodes[countryCode][i] === iso2) return;
250
+ }
251
+ // check for undefined as 0 is falsy
252
+ var index = priority !== undefined$1 ? priority : this.countryCodes[countryCode].length;
253
+ this.countryCodes[countryCode][index] = iso2;
254
+ }
255
+ }, {
256
+ key: "_processAllCountries",
257
+ value: function _processAllCountries() {
258
+ if (this.options.onlyCountries.length) {
259
+ var lowerCaseOnlyCountries = this.options.onlyCountries.map(function(country) {
260
+ return country.toLowerCase();
261
+ });
262
+ this.countries = allCountries.filter(function(country) {
263
+ return lowerCaseOnlyCountries.indexOf(country.iso2) > -1;
264
+ });
265
+ } else if (this.options.excludeCountries.length) {
266
+ var lowerCaseExcludeCountries = this.options.excludeCountries.map(function(country) {
267
+ return country.toLowerCase();
268
+ });
269
+ this.countries = allCountries.filter(function(country) {
270
+ return lowerCaseExcludeCountries.indexOf(country.iso2) === -1;
271
+ });
272
+ } else {
273
+ this.countries = allCountries;
274
+ }
275
+ }
276
+ }, {
277
+ key: "_translateCountriesByLocale",
278
+ value: function _translateCountriesByLocale() {
279
+ for (var i = 0; i < this.countries.length; i++) {
280
+ var iso = this.countries[i].iso2.toLowerCase();
281
+ if (this.options.localizedCountries.hasOwnProperty(iso)) {
282
+ this.countries[i].name = this.options.localizedCountries[iso];
283
+ }
284
+ }
285
+ }
286
+ }, {
287
+ key: "_countryNameSort",
288
+ value: function _countryNameSort(a, b) {
289
+ return a.name.localeCompare(b.name);
290
+ }
291
+ }, {
292
+ key: "_processCountryCodes",
293
+ value: function _processCountryCodes() {
294
+ this.countryCodeMaxLen = 0;
295
+ // here we store just dial codes
296
+ this.dialCodes = {};
297
+ // here we store "country codes" (both dial codes and their area codes)
298
+ this.countryCodes = {};
299
+ // first: add dial codes
300
+ for (var i = 0; i < this.countries.length; i++) {
301
+ var c = this.countries[i];
302
+ if (!this.dialCodes[c.dialCode]) this.dialCodes[c.dialCode] = true;
303
+ this._addCountryCode(c.iso2, c.dialCode, c.priority);
304
+ }
305
+ // next: add area codes
306
+ // this is a second loop over countries, to make sure we have all of the "root" countries
307
+ // already in the map, so that we can access them, as each time we add an area code substring
308
+ // to the map, we also need to include the "root" country's code, as that also matches
309
+ for (var _i = 0; _i < this.countries.length; _i++) {
310
+ var _c = this.countries[_i];
311
+ // area codes
312
+ if (_c.areaCodes) {
313
+ var rootCountryCode = this.countryCodes[_c.dialCode][0];
314
+ // for each area code
315
+ for (var j = 0; j < _c.areaCodes.length; j++) {
316
+ var areaCode = _c.areaCodes[j];
317
+ // for each digit in the area code to add all partial matches as well
318
+ for (var k = 1; k < areaCode.length; k++) {
319
+ var partialDialCode = _c.dialCode + areaCode.substr(0, k);
320
+ // start with the root country, as that also matches this dial code
321
+ this._addCountryCode(rootCountryCode, partialDialCode);
322
+ this._addCountryCode(_c.iso2, partialDialCode);
323
+ }
324
+ // add the full area code
325
+ this._addCountryCode(_c.iso2, _c.dialCode + areaCode);
326
+ }
327
+ }
328
+ }
329
+ }
330
+ }, {
331
+ key: "_processPreferredCountries",
332
+ value: function _processPreferredCountries() {
333
+ this.preferredCountries = [];
334
+ for (var i = 0; i < this.options.preferredCountries.length; i++) {
335
+ var countryCode = this.options.preferredCountries[i].toLowerCase();
336
+ var countryData = this._getCountryData(countryCode, false, true);
337
+ if (countryData) this.preferredCountries.push(countryData);
338
+ }
339
+ }
340
+ }, {
341
+ key: "_createEl",
342
+ value: function _createEl(name, attrs, container) {
343
+ var el = document.createElement(name);
344
+ if (attrs) forEachProp(attrs, function(key, value) {
345
+ return el.setAttribute(key, value);
346
+ });
347
+ if (container) container.appendChild(el);
348
+ return el;
349
+ }
350
+ }, {
351
+ key: "_generateMarkup",
352
+ value: function _generateMarkup() {
353
+ // if autocomplete does not exist on the element and its form, then
354
+ // prevent autocomplete as there's no safe, cross-browser event we can react to, so it can
355
+ // easily put the plugin in an inconsistent state e.g. the wrong flag selected for the
356
+ // autocompleted number, which on submit could mean wrong number is saved (esp in nationalMode)
357
+ if (!this.telInput.hasAttribute("autocomplete") && !(this.telInput.form && this.telInput.form.hasAttribute("autocomplete"))) {
358
+ this.telInput.setAttribute("autocomplete", "off");
359
+ }
360
+ // containers (mostly for positioning)
361
+ var parentClass = "iti";
362
+ if (this.options.allowDropdown) parentClass += " iti--allow-dropdown";
363
+ if (this.options.separateDialCode) parentClass += " iti--separate-dial-code";
364
+ if (this.options.customContainer) {
365
+ parentClass += " ";
366
+ parentClass += this.options.customContainer;
367
+ }
368
+ var wrapper = this._createEl("div", {
369
+ "class": parentClass
370
+ });
371
+ this.telInput.parentNode.insertBefore(wrapper, this.telInput);
372
+ this.flagsContainer = this._createEl("div", {
373
+ "class": "iti__flag-container"
374
+ }, wrapper);
375
+ wrapper.appendChild(this.telInput);
376
+ // selected flag (displayed to left of input)
377
+ this.selectedFlag = this._createEl("div", {
378
+ "class": "iti__selected-flag",
379
+ role: "combobox",
380
+ "aria-controls": "iti-".concat(this.id, "__country-listbox"),
381
+ "aria-owns": "iti-".concat(this.id, "__country-listbox"),
382
+ "aria-expanded": "false"
383
+ }, this.flagsContainer);
384
+ this.selectedFlagInner = this._createEl("div", {
385
+ "class": "iti__flag"
386
+ }, this.selectedFlag);
387
+ if (this.options.separateDialCode) {
388
+ this.selectedDialCode = this._createEl("div", {
389
+ "class": "iti__selected-dial-code"
390
+ }, this.selectedFlag);
391
+ }
392
+ if (this.options.allowDropdown) {
393
+ // make element focusable and tab navigable
394
+ this.selectedFlag.setAttribute("tabindex", "0");
395
+ this.dropdownArrow = this._createEl("div", {
396
+ "class": "iti__arrow"
397
+ }, this.selectedFlag);
398
+ // country dropdown: preferred countries, then divider, then all countries
399
+ this.countryList = this._createEl("ul", {
400
+ "class": "iti__country-list iti__hide",
401
+ id: "iti-".concat(this.id, "__country-listbox"),
402
+ role: "listbox",
403
+ "aria-label": "List of countries"
404
+ });
405
+ if (this.preferredCountries.length) {
406
+ this._appendListItems(this.preferredCountries, "iti__preferred", true);
407
+ this._createEl("li", {
408
+ "class": "iti__divider",
409
+ role: "separator",
410
+ "aria-disabled": "true"
411
+ }, this.countryList);
412
+ }
413
+ this._appendListItems(this.countries, "iti__standard");
414
+ // create dropdownContainer markup
415
+ if (this.options.dropdownContainer) {
416
+ this.dropdown = this._createEl("div", {
417
+ "class": "iti iti--container"
418
+ });
419
+ this.dropdown.appendChild(this.countryList);
420
+ } else {
421
+ this.flagsContainer.appendChild(this.countryList);
422
+ }
423
+ }
424
+ if (this.options.hiddenInput) {
425
+ var hiddenInputName = this.options.hiddenInput;
426
+ var name = this.telInput.getAttribute("name");
427
+ if (name) {
428
+ var i = name.lastIndexOf("[");
429
+ // if input name contains square brackets, then give the hidden input the same name,
430
+ // replacing the contents of the last set of brackets with the given hiddenInput name
431
+ if (i !== -1) hiddenInputName = "".concat(name.substr(0, i), "[").concat(hiddenInputName, "]");
432
+ }
433
+ this.hiddenInput = this._createEl("input", {
434
+ type: "hidden",
435
+ name: hiddenInputName
436
+ });
437
+ wrapper.appendChild(this.hiddenInput);
438
+ }
439
+ }
440
+ }, {
441
+ key: "_appendListItems",
442
+ value: function _appendListItems(countries, className, preferred) {
443
+ // we create so many DOM elements, it is faster to build a temp string
444
+ // and then add everything to the DOM in one go at the end
445
+ var tmp = "";
446
+ // for each country
447
+ for (var i = 0; i < countries.length; i++) {
448
+ var c = countries[i];
449
+ var idSuffix = preferred ? "-preferred" : "";
450
+ // open the list item
451
+ tmp += "<li class='iti__country ".concat(className, "' tabIndex='-1' id='iti-").concat(this.id, "__item-").concat(c.iso2).concat(idSuffix, "' role='option' data-dial-code='").concat(c.dialCode, "' data-country-code='").concat(c.iso2, "' aria-selected='false'>");
452
+ // add the flag
453
+ tmp += "<div class='iti__flag-box'><div class='iti__flag iti__".concat(c.iso2, "'></div></div>");
454
+ // and the country name and dial code
455
+ tmp += "<span class='iti__country-name'>".concat(c.name, "</span>");
456
+ tmp += "<span class='iti__dial-code'>+".concat(c.dialCode, "</span>");
457
+ // close the list item
458
+ tmp += "</li>";
459
+ }
460
+ this.countryList.insertAdjacentHTML("beforeend", tmp);
461
+ }
462
+ }, {
463
+ key: "_setInitialState",
464
+ value: function _setInitialState() {
465
+ // fix firefox bug: when first load page (with input with value set to number with intl dial
466
+ // code) and initialising plugin removes the dial code from the input, then refresh page,
467
+ // and we try to init plugin again but this time on number without dial code so get grey flag
468
+ var attributeValue = this.telInput.getAttribute("value");
469
+ var inputValue = this.telInput.value;
470
+ var useAttribute = attributeValue && attributeValue.charAt(0) === "+" && (!inputValue || inputValue.charAt(0) !== "+");
471
+ var val = useAttribute ? attributeValue : inputValue;
472
+ var dialCode = this._getDialCode(val);
473
+ var isRegionlessNanp = this._isRegionlessNanp(val);
474
+ var _this$options = this.options, initialCountry = _this$options.initialCountry, nationalMode = _this$options.nationalMode, autoHideDialCode = _this$options.autoHideDialCode, separateDialCode = _this$options.separateDialCode;
475
+ // if we already have a dial code, and it's not a regionlessNanp, we can go ahead and set the
476
+ // flag, else fall back to the default country
477
+ if (dialCode && !isRegionlessNanp) {
478
+ this._updateFlagFromNumber(val);
479
+ } else if (initialCountry !== "auto") {
480
+ // see if we should select a flag
481
+ if (initialCountry) {
482
+ this._setFlag(initialCountry.toLowerCase());
483
+ } else {
484
+ if (dialCode && isRegionlessNanp) {
485
+ // has intl dial code, is regionless nanp, and no initialCountry, so default to US
486
+ this._setFlag("us");
487
+ } else {
488
+ // no dial code and no initialCountry, so default to first in list
489
+ this.defaultCountry = this.preferredCountries.length ? this.preferredCountries[0].iso2 : this.countries[0].iso2;
490
+ if (!val) {
491
+ this._setFlag(this.defaultCountry);
492
+ }
493
+ }
494
+ }
495
+ // if empty and no nationalMode and no autoHideDialCode then insert the default dial code
496
+ if (!val && !nationalMode && !autoHideDialCode && !separateDialCode) {
497
+ this.telInput.value = "+".concat(this.selectedCountryData.dialCode);
498
+ }
499
+ }
500
+ // NOTE: if initialCountry is set to auto, that will be handled separately
501
+ // format - note this wont be run after _updateDialCode as that's only called if no val
502
+ if (val) this._updateValFromNumber(val);
503
+ }
504
+ }, {
505
+ key: "_initListeners",
506
+ value: function _initListeners() {
507
+ this._initKeyListeners();
508
+ if (this.options.autoHideDialCode) this._initBlurListeners();
509
+ if (this.options.allowDropdown) this._initDropdownListeners();
510
+ if (this.hiddenInput) this._initHiddenInputListener();
511
+ }
512
+ }, {
513
+ key: "_initHiddenInputListener",
514
+ value: function _initHiddenInputListener() {
515
+ var _this3 = this;
516
+ this._handleHiddenInputSubmit = function() {
517
+ _this3.hiddenInput.value = _this3.getNumber();
518
+ };
519
+ if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleHiddenInputSubmit);
520
+ }
521
+ }, {
522
+ key: "_getClosestLabel",
523
+ value: function _getClosestLabel() {
524
+ var el = this.telInput;
525
+ while (el && el.tagName !== "LABEL") {
526
+ el = el.parentNode;
527
+ }
528
+ return el;
529
+ }
530
+ }, {
531
+ key: "_initDropdownListeners",
532
+ value: function _initDropdownListeners() {
533
+ var _this4 = this;
534
+ // hack for input nested inside label (which is valid markup): clicking the selected-flag to
535
+ // open the dropdown would then automatically trigger a 2nd click on the input which would
536
+ // close it again
537
+ this._handleLabelClick = function(e) {
538
+ // if the dropdown is closed, then focus the input, else ignore the click
539
+ if (_this4.countryList.classList.contains("iti__hide")) _this4.telInput.focus(); else e.preventDefault();
540
+ };
541
+ var label = this._getClosestLabel();
542
+ if (label) label.addEventListener("click", this._handleLabelClick);
543
+ // toggle country dropdown on click
544
+ this._handleClickSelectedFlag = function() {
545
+ // only intercept this event if we're opening the dropdown
546
+ // else let it bubble up to the top ("click-off-to-close" listener)
547
+ // we cannot just stopPropagation as it may be needed to close another instance
548
+ if (_this4.countryList.classList.contains("iti__hide") && !_this4.telInput.disabled && !_this4.telInput.readOnly) {
549
+ _this4._showDropdown();
550
+ }
551
+ };
552
+ this.selectedFlag.addEventListener("click", this._handleClickSelectedFlag);
553
+ // open dropdown list if currently focused
554
+ this._handleFlagsContainerKeydown = function(e) {
555
+ var isDropdownHidden = _this4.countryList.classList.contains("iti__hide");
556
+ if (isDropdownHidden && [ "ArrowUp", "Up", "ArrowDown", "Down", " ", "Enter" ].indexOf(e.key) !== -1) {
557
+ // prevent form from being submitted if "ENTER" was pressed
558
+ e.preventDefault();
559
+ // prevent event from being handled again by document
560
+ e.stopPropagation();
561
+ _this4._showDropdown();
562
+ }
563
+ // allow navigation from dropdown to input on TAB
564
+ if (e.key === "Tab") _this4._closeDropdown();
565
+ };
566
+ this.flagsContainer.addEventListener("keydown", this._handleFlagsContainerKeydown);
567
+ }
568
+ }, {
569
+ key: "_initRequests",
570
+ value: function _initRequests() {
571
+ var _this5 = this;
572
+ // if the user has specified the path to the utils script, fetch it on window.load, else resolve
573
+ if (this.options.utilsScript && !window.intlTelInputUtils) {
574
+ // if the plugin is being initialised after the window.load event has already been fired
575
+ if (window.intlTelInputGlobals.documentReady()) {
576
+ window.intlTelInputGlobals.loadUtils(this.options.utilsScript);
577
+ } else {
578
+ // wait until the load event so we don't block any other requests e.g. the flags image
579
+ window.addEventListener("load", function() {
580
+ window.intlTelInputGlobals.loadUtils(_this5.options.utilsScript);
581
+ });
582
+ }
583
+ } else this.resolveUtilsScriptPromise();
584
+ if (this.options.initialCountry === "auto") this._loadAutoCountry(); else this.resolveAutoCountryPromise();
585
+ }
586
+ }, {
587
+ key: "_loadAutoCountry",
588
+ value: function _loadAutoCountry() {
589
+ // 3 options:
590
+ // 1) already loaded (we're done)
591
+ // 2) not already started loading (start)
592
+ // 3) already started loading (do nothing - just wait for loading callback to fire)
593
+ if (window.intlTelInputGlobals.autoCountry) {
594
+ this.handleAutoCountry();
595
+ } else if (!window.intlTelInputGlobals.startedLoadingAutoCountry) {
596
+ // don't do this twice!
597
+ window.intlTelInputGlobals.startedLoadingAutoCountry = true;
598
+ if (typeof this.options.geoIpLookup === "function") {
599
+ this.options.geoIpLookup(function(countryCode) {
600
+ window.intlTelInputGlobals.autoCountry = countryCode.toLowerCase();
601
+ // tell all instances the auto country is ready
602
+ // TODO: this should just be the current instances
603
+ // UPDATE: use setTimeout in case their geoIpLookup function calls this callback straight
604
+ // away (e.g. if they have already done the geo ip lookup somewhere else). Using
605
+ // setTimeout means that the current thread of execution will finish before executing
606
+ // this, which allows the plugin to finish initialising.
607
+ setTimeout(function() {
608
+ return forEachInstance("handleAutoCountry");
609
+ });
610
+ }, function() {
611
+ return forEachInstance("rejectAutoCountryPromise");
612
+ });
613
+ }
614
+ }
615
+ }
616
+ }, {
617
+ key: "_initKeyListeners",
618
+ value: function _initKeyListeners() {
619
+ var _this6 = this;
620
+ // update flag on keyup
621
+ this._handleKeyupEvent = function() {
622
+ if (_this6._updateFlagFromNumber(_this6.telInput.value)) {
623
+ _this6._triggerCountryChange();
624
+ }
625
+ };
626
+ this.telInput.addEventListener("keyup", this._handleKeyupEvent);
627
+ // update flag on cut/paste events (now supported in all major browsers)
628
+ this._handleClipboardEvent = function() {
629
+ // hack because "paste" event is fired before input is updated
630
+ setTimeout(_this6._handleKeyupEvent);
631
+ };
632
+ this.telInput.addEventListener("cut", this._handleClipboardEvent);
633
+ this.telInput.addEventListener("paste", this._handleClipboardEvent);
634
+ }
635
+ }, {
636
+ key: "_cap",
637
+ value: function _cap(number) {
638
+ var max = this.telInput.getAttribute("maxlength");
639
+ return max && number.length > max ? number.substr(0, max) : number;
640
+ }
641
+ }, {
642
+ key: "_initBlurListeners",
643
+ value: function _initBlurListeners() {
644
+ var _this7 = this;
645
+ // on blur or form submit: if just a dial code then remove it
646
+ this._handleSubmitOrBlurEvent = function() {
647
+ _this7._removeEmptyDialCode();
648
+ };
649
+ if (this.telInput.form) this.telInput.form.addEventListener("submit", this._handleSubmitOrBlurEvent);
650
+ this.telInput.addEventListener("blur", this._handleSubmitOrBlurEvent);
651
+ }
652
+ }, {
653
+ key: "_removeEmptyDialCode",
654
+ value: function _removeEmptyDialCode() {
655
+ if (this.telInput.value.charAt(0) === "+") {
656
+ var numeric = this._getNumeric(this.telInput.value);
657
+ // if just a plus, or if just a dial code
658
+ if (!numeric || this.selectedCountryData.dialCode === numeric) {
659
+ this.telInput.value = "";
660
+ }
661
+ }
662
+ }
663
+ }, {
664
+ key: "_getNumeric",
665
+ value: function _getNumeric(s) {
666
+ return s.replace(/\D/g, "");
667
+ }
668
+ }, {
669
+ key: "_trigger",
670
+ value: function _trigger(name) {
671
+ // have to use old school document.createEvent as IE11 doesn't support `new Event()` syntax
672
+ var e = document.createEvent("Event");
673
+ e.initEvent(name, true, true);
674
+ // can bubble, and is cancellable
675
+ this.telInput.dispatchEvent(e);
676
+ }
677
+ }, {
678
+ key: "_showDropdown",
679
+ value: function _showDropdown() {
680
+ this.countryList.classList.remove("iti__hide");
681
+ this.selectedFlag.setAttribute("aria-expanded", "true");
682
+ this._setDropdownPosition();
683
+ // update highlighting and scroll to active list item
684
+ if (this.activeItem) {
685
+ this._highlightListItem(this.activeItem, false);
686
+ this._scrollTo(this.activeItem, true);
687
+ }
688
+ // bind all the dropdown-related listeners: mouseover, click, click-off, keydown
689
+ this._bindDropdownListeners();
690
+ // update the arrow
691
+ this.dropdownArrow.classList.add("iti__arrow--up");
692
+ this._trigger("open:countrydropdown");
693
+ }
694
+ }, {
695
+ key: "_toggleClass",
696
+ value: function _toggleClass(el, className, shouldHaveClass) {
697
+ if (shouldHaveClass && !el.classList.contains(className)) el.classList.add(className); else if (!shouldHaveClass && el.classList.contains(className)) el.classList.remove(className);
698
+ }
699
+ }, {
700
+ key: "_setDropdownPosition",
701
+ value: function _setDropdownPosition() {
702
+ var _this8 = this;
703
+ if (this.options.dropdownContainer) {
704
+ this.options.dropdownContainer.appendChild(this.dropdown);
705
+ }
706
+ if (!this.isMobile) {
707
+ var pos = this.telInput.getBoundingClientRect();
708
+ // windowTop from https://stackoverflow.com/a/14384091/217866
709
+ var windowTop = window.pageYOffset || document.documentElement.scrollTop;
710
+ var inputTop = pos.top + windowTop;
711
+ var dropdownHeight = this.countryList.offsetHeight;
712
+ // dropdownFitsBelow = (dropdownBottom < windowBottom)
713
+ var dropdownFitsBelow = inputTop + this.telInput.offsetHeight + dropdownHeight < windowTop + window.innerHeight;
714
+ var dropdownFitsAbove = inputTop - dropdownHeight > windowTop;
715
+ // by default, the dropdown will be below the input. If we want to position it above the
716
+ // input, we add the dropup class.
717
+ this._toggleClass(this.countryList, "iti__country-list--dropup", !dropdownFitsBelow && dropdownFitsAbove);
718
+ // if dropdownContainer is enabled, calculate postion
719
+ if (this.options.dropdownContainer) {
720
+ // by default the dropdown will be directly over the input because it's not in the flow.
721
+ // If we want to position it below, we need to add some extra top value.
722
+ var extraTop = !dropdownFitsBelow && dropdownFitsAbove ? 0 : this.telInput.offsetHeight;
723
+ // calculate placement
724
+ this.dropdown.style.top = "".concat(inputTop + extraTop, "px");
725
+ this.dropdown.style.left = "".concat(pos.left + document.body.scrollLeft, "px");
726
+ // close menu on window scroll
727
+ this._handleWindowScroll = function() {
728
+ return _this8._closeDropdown();
729
+ };
730
+ window.addEventListener("scroll", this._handleWindowScroll);
731
+ }
732
+ }
733
+ }
734
+ }, {
735
+ key: "_getClosestListItem",
736
+ value: function _getClosestListItem(target) {
737
+ var el = target;
738
+ while (el && el !== this.countryList && !el.classList.contains("iti__country")) {
739
+ el = el.parentNode;
740
+ }
741
+ // if we reached the countryList element, then return null
742
+ return el === this.countryList ? null : el;
743
+ }
744
+ }, {
745
+ key: "_bindDropdownListeners",
746
+ value: function _bindDropdownListeners() {
747
+ var _this9 = this;
748
+ // when mouse over a list item, just highlight that one
749
+ // we add the class "highlight", so if they hit "enter" we know which one to select
750
+ this._handleMouseoverCountryList = function(e) {
751
+ // handle event delegation, as we're listening for this event on the countryList
752
+ var listItem = _this9._getClosestListItem(e.target);
753
+ if (listItem) _this9._highlightListItem(listItem, false);
754
+ };
755
+ this.countryList.addEventListener("mouseover", this._handleMouseoverCountryList);
756
+ // listen for country selection
757
+ this._handleClickCountryList = function(e) {
758
+ var listItem = _this9._getClosestListItem(e.target);
759
+ if (listItem) _this9._selectListItem(listItem);
760
+ };
761
+ this.countryList.addEventListener("click", this._handleClickCountryList);
762
+ // click off to close
763
+ // (except when this initial opening click is bubbling up)
764
+ // we cannot just stopPropagation as it may be needed to close another instance
765
+ var isOpening = true;
766
+ this._handleClickOffToClose = function() {
767
+ if (!isOpening) _this9._closeDropdown();
768
+ isOpening = false;
769
+ };
770
+ document.documentElement.addEventListener("click", this._handleClickOffToClose);
771
+ // listen for up/down scrolling, enter to select, or letters to jump to country name.
772
+ // use keydown as keypress doesn't fire for non-char keys and we want to catch if they
773
+ // just hit down and hold it to scroll down (no keyup event).
774
+ // listen on the document because that's where key events are triggered if no input has focus
775
+ var query = "";
776
+ var queryTimer = null;
777
+ this._handleKeydownOnDropdown = function(e) {
778
+ // prevent down key from scrolling the whole page,
779
+ // and enter key from submitting a form etc
780
+ e.preventDefault();
781
+ // up and down to navigate
782
+ if (e.key === "ArrowUp" || e.key === "Up" || e.key === "ArrowDown" || e.key === "Down") _this9._handleUpDownKey(e.key); else if (e.key === "Enter") _this9._handleEnterKey(); else if (e.key === "Escape") _this9._closeDropdown(); else if (/^[a-zA-ZÀ-ÿа-яА-Я ]$/.test(e.key)) {
783
+ // jump to countries that start with the query string
784
+ if (queryTimer) clearTimeout(queryTimer);
785
+ query += e.key.toLowerCase();
786
+ _this9._searchForCountry(query);
787
+ // if the timer hits 1 second, reset the query
788
+ queryTimer = setTimeout(function() {
789
+ query = "";
790
+ }, 1e3);
791
+ }
792
+ };
793
+ document.addEventListener("keydown", this._handleKeydownOnDropdown);
794
+ }
795
+ }, {
796
+ key: "_handleUpDownKey",
797
+ value: function _handleUpDownKey(key) {
798
+ var next = key === "ArrowUp" || key === "Up" ? this.highlightedItem.previousElementSibling : this.highlightedItem.nextElementSibling;
799
+ if (next) {
800
+ // skip the divider
801
+ if (next.classList.contains("iti__divider")) {
802
+ next = key === "ArrowUp" || key === "Up" ? next.previousElementSibling : next.nextElementSibling;
803
+ }
804
+ this._highlightListItem(next, true);
805
+ }
806
+ }
807
+ }, {
808
+ key: "_handleEnterKey",
809
+ value: function _handleEnterKey() {
810
+ if (this.highlightedItem) this._selectListItem(this.highlightedItem);
811
+ }
812
+ }, {
813
+ key: "_searchForCountry",
814
+ value: function _searchForCountry(query) {
815
+ for (var i = 0; i < this.countries.length; i++) {
816
+ if (this._startsWith(this.countries[i].name, query)) {
817
+ var listItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(this.countries[i].iso2));
818
+ // update highlighting and scroll
819
+ this._highlightListItem(listItem, false);
820
+ this._scrollTo(listItem, true);
821
+ break;
822
+ }
823
+ }
824
+ }
825
+ }, {
826
+ key: "_startsWith",
827
+ value: function _startsWith(a, b) {
828
+ return a.substr(0, b.length).toLowerCase() === b;
829
+ }
830
+ }, {
831
+ key: "_updateValFromNumber",
832
+ value: function _updateValFromNumber(originalNumber) {
833
+ var number = originalNumber;
834
+ if (this.options.formatOnDisplay && window.intlTelInputUtils && this.selectedCountryData) {
835
+ var useNational = !this.options.separateDialCode && (this.options.nationalMode || number.charAt(0) !== "+");
836
+ var _intlTelInputUtils$nu = intlTelInputUtils.numberFormat, NATIONAL = _intlTelInputUtils$nu.NATIONAL, INTERNATIONAL = _intlTelInputUtils$nu.INTERNATIONAL;
837
+ var format = useNational ? NATIONAL : INTERNATIONAL;
838
+ number = intlTelInputUtils.formatNumber(number, this.selectedCountryData.iso2, format);
839
+ }
840
+ number = this._beforeSetNumber(number);
841
+ this.telInput.value = number;
842
+ }
843
+ }, {
844
+ key: "_updateFlagFromNumber",
845
+ value: function _updateFlagFromNumber(originalNumber) {
846
+ // if we're in nationalMode and we already have US/Canada selected, make sure the number starts
847
+ // with a +1 so _getDialCode will be able to extract the area code
848
+ // update: if we dont yet have selectedCountryData, but we're here (trying to update the flag
849
+ // from the number), that means we're initialising the plugin with a number that already has a
850
+ // dial code, so fine to ignore this bit
851
+ var number = originalNumber;
852
+ var selectedDialCode = this.selectedCountryData.dialCode;
853
+ var isNanp = selectedDialCode === "1";
854
+ if (number && this.options.nationalMode && isNanp && number.charAt(0) !== "+") {
855
+ if (number.charAt(0) !== "1") number = "1".concat(number);
856
+ number = "+".concat(number);
857
+ }
858
+ // update flag if user types area code for another country
859
+ if (this.options.separateDialCode && selectedDialCode && number.charAt(0) !== "+") {
860
+ number = "+".concat(selectedDialCode).concat(number);
861
+ }
862
+ // try and extract valid dial code from input
863
+ var dialCode = this._getDialCode(number, true);
864
+ var numeric = this._getNumeric(number);
865
+ var countryCode = null;
866
+ if (dialCode) {
867
+ var countryCodes = this.countryCodes[this._getNumeric(dialCode)];
868
+ // check if the right country is already selected. this should be false if the number is
869
+ // longer than the matched dial code because in this case we need to make sure that if
870
+ // there are multiple country matches, that the first one is selected (note: we could
871
+ // just check that here, but it requires the same loop that we already have later)
872
+ var alreadySelected = countryCodes.indexOf(this.selectedCountryData.iso2) !== -1 && numeric.length <= dialCode.length - 1;
873
+ var isRegionlessNanpNumber = selectedDialCode === "1" && this._isRegionlessNanp(numeric);
874
+ // only update the flag if:
875
+ // A) NOT (we currently have a NANP flag selected, and the number is a regionlessNanp)
876
+ // AND
877
+ // B) the right country is not already selected
878
+ if (!isRegionlessNanpNumber && !alreadySelected) {
879
+ // if using onlyCountries option, countryCodes[0] may be empty, so we must find the first
880
+ // non-empty index
881
+ for (var j = 0; j < countryCodes.length; j++) {
882
+ if (countryCodes[j]) {
883
+ countryCode = countryCodes[j];
884
+ break;
885
+ }
886
+ }
887
+ }
888
+ } else if (number.charAt(0) === "+" && numeric.length) {
889
+ // invalid dial code, so empty
890
+ // Note: use getNumeric here because the number has not been formatted yet, so could contain
891
+ // bad chars
892
+ countryCode = "";
893
+ } else if (!number || number === "+") {
894
+ // empty, or just a plus, so default
895
+ countryCode = this.defaultCountry;
896
+ }
897
+ if (countryCode !== null) {
898
+ return this._setFlag(countryCode);
899
+ }
900
+ return false;
901
+ }
902
+ }, {
903
+ key: "_isRegionlessNanp",
904
+ value: function _isRegionlessNanp(number) {
905
+ var numeric = this._getNumeric(number);
906
+ if (numeric.charAt(0) === "1") {
907
+ var areaCode = numeric.substr(1, 3);
908
+ return regionlessNanpNumbers.indexOf(areaCode) !== -1;
909
+ }
910
+ return false;
911
+ }
912
+ }, {
913
+ key: "_highlightListItem",
914
+ value: function _highlightListItem(listItem, shouldFocus) {
915
+ var prevItem = this.highlightedItem;
916
+ if (prevItem) prevItem.classList.remove("iti__highlight");
917
+ this.highlightedItem = listItem;
918
+ this.highlightedItem.classList.add("iti__highlight");
919
+ if (shouldFocus) this.highlightedItem.focus();
920
+ }
921
+ }, {
922
+ key: "_getCountryData",
923
+ value: function _getCountryData(countryCode, ignoreOnlyCountriesOption, allowFail) {
924
+ var countryList = ignoreOnlyCountriesOption ? allCountries : this.countries;
925
+ for (var i = 0; i < countryList.length; i++) {
926
+ if (countryList[i].iso2 === countryCode) {
927
+ return countryList[i];
928
+ }
929
+ }
930
+ if (allowFail) {
931
+ return null;
932
+ }
933
+ throw new Error("No country data for '".concat(countryCode, "'"));
934
+ }
935
+ }, {
936
+ key: "_setFlag",
937
+ value: function _setFlag(countryCode) {
938
+ var prevCountry = this.selectedCountryData.iso2 ? this.selectedCountryData : {};
939
+ // do this first as it will throw an error and stop if countryCode is invalid
940
+ this.selectedCountryData = countryCode ? this._getCountryData(countryCode, false, false) : {};
941
+ // update the defaultCountry - we only need the iso2 from now on, so just store that
942
+ if (this.selectedCountryData.iso2) {
943
+ this.defaultCountry = this.selectedCountryData.iso2;
944
+ }
945
+ this.selectedFlagInner.setAttribute("class", "iti__flag iti__".concat(countryCode));
946
+ // update the selected country's title attribute
947
+ var title = countryCode ? "".concat(this.selectedCountryData.name, ": +").concat(this.selectedCountryData.dialCode) : "Unknown";
948
+ this.selectedFlag.setAttribute("title", title);
949
+ if (this.options.separateDialCode) {
950
+ var dialCode = this.selectedCountryData.dialCode ? "+".concat(this.selectedCountryData.dialCode) : "";
951
+ this.selectedDialCode.innerHTML = dialCode;
952
+ // offsetWidth is zero if input is in a hidden container during initialisation
953
+ var selectedFlagWidth = this.selectedFlag.offsetWidth || this._getHiddenSelectedFlagWidth();
954
+ // add 6px of padding after the grey selected-dial-code box, as this is what we use in the css
955
+ this.telInput.style.paddingLeft = "".concat(selectedFlagWidth + 6, "px");
956
+ }
957
+ // and the input's placeholder
958
+ this._updatePlaceholder();
959
+ // update the active list item
960
+ if (this.options.allowDropdown) {
961
+ var prevItem = this.activeItem;
962
+ if (prevItem) {
963
+ prevItem.classList.remove("iti__active");
964
+ prevItem.setAttribute("aria-selected", "false");
965
+ }
966
+ if (countryCode) {
967
+ // check if there is a preferred item first, else fall back to standard
968
+ var nextItem = this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode, "-preferred")) || this.countryList.querySelector("#iti-".concat(this.id, "__item-").concat(countryCode));
969
+ nextItem.setAttribute("aria-selected", "true");
970
+ nextItem.classList.add("iti__active");
971
+ this.activeItem = nextItem;
972
+ this.selectedFlag.setAttribute("aria-activedescendant", nextItem.getAttribute("id"));
973
+ }
974
+ }
975
+ // return if the flag has changed or not
976
+ return prevCountry.iso2 !== countryCode;
977
+ }
978
+ }, {
979
+ key: "_getHiddenSelectedFlagWidth",
980
+ value: function _getHiddenSelectedFlagWidth() {
981
+ // to get the right styling to apply, all we need is a shallow clone of the container,
982
+ // and then to inject a deep clone of the selectedFlag element
983
+ var containerClone = this.telInput.parentNode.cloneNode();
984
+ containerClone.style.visibility = "hidden";
985
+ document.body.appendChild(containerClone);
986
+ var flagsContainerClone = this.flagsContainer.cloneNode();
987
+ containerClone.appendChild(flagsContainerClone);
988
+ var selectedFlagClone = this.selectedFlag.cloneNode(true);
989
+ flagsContainerClone.appendChild(selectedFlagClone);
990
+ var width = selectedFlagClone.offsetWidth;
991
+ containerClone.parentNode.removeChild(containerClone);
992
+ return width;
993
+ }
994
+ }, {
995
+ key: "_updatePlaceholder",
996
+ value: function _updatePlaceholder() {
997
+ var shouldSetPlaceholder = this.options.autoPlaceholder === "aggressive" || !this.hadInitialPlaceholder && this.options.autoPlaceholder === "polite";
998
+ if (window.intlTelInputUtils && shouldSetPlaceholder) {
999
+ var numberType = intlTelInputUtils.numberType[this.options.placeholderNumberType];
1000
+ var placeholder = this.selectedCountryData.iso2 ? intlTelInputUtils.getExampleNumber(this.selectedCountryData.iso2, this.options.nationalMode, numberType) : "";
1001
+ placeholder = this._beforeSetNumber(placeholder);
1002
+ if (typeof this.options.customPlaceholder === "function") {
1003
+ placeholder = this.options.customPlaceholder(placeholder, this.selectedCountryData);
1004
+ }
1005
+ this.telInput.setAttribute("placeholder", placeholder);
1006
+ }
1007
+ }
1008
+ }, {
1009
+ key: "_selectListItem",
1010
+ value: function _selectListItem(listItem) {
1011
+ // update selected flag and active list item
1012
+ var flagChanged = this._setFlag(listItem.getAttribute("data-country-code"));
1013
+ this._closeDropdown();
1014
+ this._updateDialCode(listItem.getAttribute("data-dial-code"), true);
1015
+ // focus the input
1016
+ this.telInput.focus();
1017
+ // put cursor at end - this fix is required for FF and IE11 (with nationalMode=false i.e. auto
1018
+ // inserting dial code), who try to put the cursor at the beginning the first time
1019
+ var len = this.telInput.value.length;
1020
+ this.telInput.setSelectionRange(len, len);
1021
+ if (flagChanged) {
1022
+ this._triggerCountryChange();
1023
+ }
1024
+ }
1025
+ }, {
1026
+ key: "_closeDropdown",
1027
+ value: function _closeDropdown() {
1028
+ this.countryList.classList.add("iti__hide");
1029
+ this.selectedFlag.setAttribute("aria-expanded", "false");
1030
+ // update the arrow
1031
+ this.dropdownArrow.classList.remove("iti__arrow--up");
1032
+ // unbind key events
1033
+ document.removeEventListener("keydown", this._handleKeydownOnDropdown);
1034
+ document.documentElement.removeEventListener("click", this._handleClickOffToClose);
1035
+ this.countryList.removeEventListener("mouseover", this._handleMouseoverCountryList);
1036
+ this.countryList.removeEventListener("click", this._handleClickCountryList);
1037
+ // remove menu from container
1038
+ if (this.options.dropdownContainer) {
1039
+ if (!this.isMobile) window.removeEventListener("scroll", this._handleWindowScroll);
1040
+ if (this.dropdown.parentNode) this.dropdown.parentNode.removeChild(this.dropdown);
1041
+ }
1042
+ this._trigger("close:countrydropdown");
1043
+ }
1044
+ }, {
1045
+ key: "_scrollTo",
1046
+ value: function _scrollTo(element, middle) {
1047
+ var container = this.countryList;
1048
+ // windowTop from https://stackoverflow.com/a/14384091/217866
1049
+ var windowTop = window.pageYOffset || document.documentElement.scrollTop;
1050
+ var containerHeight = container.offsetHeight;
1051
+ var containerTop = container.getBoundingClientRect().top + windowTop;
1052
+ var containerBottom = containerTop + containerHeight;
1053
+ var elementHeight = element.offsetHeight;
1054
+ var elementTop = element.getBoundingClientRect().top + windowTop;
1055
+ var elementBottom = elementTop + elementHeight;
1056
+ var newScrollTop = elementTop - containerTop + container.scrollTop;
1057
+ var middleOffset = containerHeight / 2 - elementHeight / 2;
1058
+ if (elementTop < containerTop) {
1059
+ // scroll up
1060
+ if (middle) newScrollTop -= middleOffset;
1061
+ container.scrollTop = newScrollTop;
1062
+ } else if (elementBottom > containerBottom) {
1063
+ // scroll down
1064
+ if (middle) newScrollTop += middleOffset;
1065
+ var heightDifference = containerHeight - elementHeight;
1066
+ container.scrollTop = newScrollTop - heightDifference;
1067
+ }
1068
+ }
1069
+ }, {
1070
+ key: "_updateDialCode",
1071
+ value: function _updateDialCode(newDialCodeBare, hasSelectedListItem) {
1072
+ var inputVal = this.telInput.value;
1073
+ // save having to pass this every time
1074
+ var newDialCode = "+".concat(newDialCodeBare);
1075
+ var newNumber;
1076
+ if (inputVal.charAt(0) === "+") {
1077
+ // there's a plus so we're dealing with a replacement (doesn't matter if nationalMode or not)
1078
+ var prevDialCode = this._getDialCode(inputVal);
1079
+ if (prevDialCode) {
1080
+ // current number contains a valid dial code, so replace it
1081
+ newNumber = inputVal.replace(prevDialCode, newDialCode);
1082
+ } else {
1083
+ // current number contains an invalid dial code, so ditch it
1084
+ // (no way to determine where the invalid dial code ends and the rest of the number begins)
1085
+ newNumber = newDialCode;
1086
+ }
1087
+ } else if (this.options.nationalMode || this.options.separateDialCode) {
1088
+ // don't do anything
1089
+ return;
1090
+ } else {
1091
+ // nationalMode is disabled
1092
+ if (inputVal) {
1093
+ // there is an existing value with no dial code: prefix the new dial code
1094
+ newNumber = newDialCode + inputVal;
1095
+ } else if (hasSelectedListItem || !this.options.autoHideDialCode) {
1096
+ // no existing value and either they've just selected a list item, or autoHideDialCode is
1097
+ // disabled: insert new dial code
1098
+ newNumber = newDialCode;
1099
+ } else {
1100
+ return;
1101
+ }
1102
+ }
1103
+ this.telInput.value = newNumber;
1104
+ }
1105
+ }, {
1106
+ key: "_getDialCode",
1107
+ value: function _getDialCode(number, includeAreaCode) {
1108
+ var dialCode = "";
1109
+ // only interested in international numbers (starting with a plus)
1110
+ if (number.charAt(0) === "+") {
1111
+ var numericChars = "";
1112
+ // iterate over chars
1113
+ for (var i = 0; i < number.length; i++) {
1114
+ var c = number.charAt(i);
1115
+ // if char is number (https://stackoverflow.com/a/8935649/217866)
1116
+ if (!isNaN(parseInt(c, 10))) {
1117
+ numericChars += c;
1118
+ // if current numericChars make a valid dial code
1119
+ if (includeAreaCode) {
1120
+ if (this.countryCodes[numericChars]) {
1121
+ // store the actual raw string (useful for matching later)
1122
+ dialCode = number.substr(0, i + 1);
1123
+ }
1124
+ } else {
1125
+ if (this.dialCodes[numericChars]) {
1126
+ dialCode = number.substr(0, i + 1);
1127
+ // if we're just looking for a dial code, we can break as soon as we find one
1128
+ break;
1129
+ }
1130
+ }
1131
+ // stop searching as soon as we can - in this case when we hit max len
1132
+ if (numericChars.length === this.countryCodeMaxLen) {
1133
+ break;
1134
+ }
1135
+ }
1136
+ }
1137
+ }
1138
+ return dialCode;
1139
+ }
1140
+ }, {
1141
+ key: "_getFullNumber",
1142
+ value: function _getFullNumber() {
1143
+ var val = this.telInput.value.trim();
1144
+ var dialCode = this.selectedCountryData.dialCode;
1145
+ var prefix;
1146
+ var numericVal = this._getNumeric(val);
1147
+ if (this.options.separateDialCode && val.charAt(0) !== "+" && dialCode && numericVal) {
1148
+ // when using separateDialCode, it is visible so is effectively part of the typed number
1149
+ prefix = "+".concat(dialCode);
1150
+ } else {
1151
+ prefix = "";
1152
+ }
1153
+ return prefix + val;
1154
+ }
1155
+ }, {
1156
+ key: "_beforeSetNumber",
1157
+ value: function _beforeSetNumber(originalNumber) {
1158
+ var number = originalNumber;
1159
+ if (this.options.separateDialCode) {
1160
+ var dialCode = this._getDialCode(number);
1161
+ // if there is a valid dial code
1162
+ if (dialCode) {
1163
+ // in case _getDialCode returned an area code as well
1164
+ dialCode = "+".concat(this.selectedCountryData.dialCode);
1165
+ // a lot of numbers will have a space separating the dial code and the main number, and
1166
+ // some NANP numbers will have a hyphen e.g. +1 684-733-1234 - in both cases we want to get
1167
+ // rid of it
1168
+ // NOTE: don't just trim all non-numerics as may want to preserve an open parenthesis etc
1169
+ var start = number[dialCode.length] === " " || number[dialCode.length] === "-" ? dialCode.length + 1 : dialCode.length;
1170
+ number = number.substr(start);
1171
+ }
1172
+ }
1173
+ return this._cap(number);
1174
+ }
1175
+ }, {
1176
+ key: "_triggerCountryChange",
1177
+ value: function _triggerCountryChange() {
1178
+ this._trigger("countrychange");
1179
+ }
1180
+ }, {
1181
+ key: "handleAutoCountry",
1182
+ value: function handleAutoCountry() {
1183
+ if (this.options.initialCountry === "auto") {
1184
+ // we must set this even if there is an initial val in the input: in case the initial val is
1185
+ // invalid and they delete it - they should see their auto country
1186
+ this.defaultCountry = window.intlTelInputGlobals.autoCountry;
1187
+ // if there's no initial value in the input, then update the flag
1188
+ if (!this.telInput.value) {
1189
+ this.setCountry(this.defaultCountry);
1190
+ }
1191
+ this.resolveAutoCountryPromise();
1192
+ }
1193
+ }
1194
+ }, {
1195
+ key: "handleUtils",
1196
+ value: function handleUtils() {
1197
+ // if the request was successful
1198
+ if (window.intlTelInputUtils) {
1199
+ // if there's an initial value in the input, then format it
1200
+ if (this.telInput.value) {
1201
+ this._updateValFromNumber(this.telInput.value);
1202
+ }
1203
+ this._updatePlaceholder();
1204
+ }
1205
+ this.resolveUtilsScriptPromise();
1206
+ }
1207
+ }, {
1208
+ key: "destroy",
1209
+ value: function destroy() {
1210
+ var form = this.telInput.form;
1211
+ if (this.options.allowDropdown) {
1212
+ // make sure the dropdown is closed (and unbind listeners)
1213
+ this._closeDropdown();
1214
+ this.selectedFlag.removeEventListener("click", this._handleClickSelectedFlag);
1215
+ this.flagsContainer.removeEventListener("keydown", this._handleFlagsContainerKeydown);
1216
+ // label click hack
1217
+ var label = this._getClosestLabel();
1218
+ if (label) label.removeEventListener("click", this._handleLabelClick);
1219
+ }
1220
+ // unbind hiddenInput listeners
1221
+ if (this.hiddenInput && form) form.removeEventListener("submit", this._handleHiddenInputSubmit);
1222
+ // unbind autoHideDialCode listeners
1223
+ if (this.options.autoHideDialCode) {
1224
+ if (form) form.removeEventListener("submit", this._handleSubmitOrBlurEvent);
1225
+ this.telInput.removeEventListener("blur", this._handleSubmitOrBlurEvent);
1226
+ }
1227
+ // unbind key events, and cut/paste events
1228
+ this.telInput.removeEventListener("keyup", this._handleKeyupEvent);
1229
+ this.telInput.removeEventListener("cut", this._handleClipboardEvent);
1230
+ this.telInput.removeEventListener("paste", this._handleClipboardEvent);
1231
+ // remove attribute of id instance: data-intl-tel-input-id
1232
+ this.telInput.removeAttribute("data-intl-tel-input-id");
1233
+ // remove markup (but leave the original input)
1234
+ var wrapper = this.telInput.parentNode;
1235
+ wrapper.parentNode.insertBefore(this.telInput, wrapper);
1236
+ wrapper.parentNode.removeChild(wrapper);
1237
+ delete window.intlTelInputGlobals.instances[this.id];
1238
+ }
1239
+ }, {
1240
+ key: "getExtension",
1241
+ value: function getExtension() {
1242
+ if (window.intlTelInputUtils) {
1243
+ return intlTelInputUtils.getExtension(this._getFullNumber(), this.selectedCountryData.iso2);
1244
+ }
1245
+ return "";
1246
+ }
1247
+ }, {
1248
+ key: "getNumber",
1249
+ value: function getNumber(format) {
1250
+ if (window.intlTelInputUtils) {
1251
+ var iso2 = this.selectedCountryData.iso2;
1252
+ return intlTelInputUtils.formatNumber(this._getFullNumber(), iso2, format);
1253
+ }
1254
+ return "";
1255
+ }
1256
+ }, {
1257
+ key: "getNumberType",
1258
+ value: function getNumberType() {
1259
+ if (window.intlTelInputUtils) {
1260
+ return intlTelInputUtils.getNumberType(this._getFullNumber(), this.selectedCountryData.iso2);
1261
+ }
1262
+ return -99;
1263
+ }
1264
+ }, {
1265
+ key: "getSelectedCountryData",
1266
+ value: function getSelectedCountryData() {
1267
+ return this.selectedCountryData;
1268
+ }
1269
+ }, {
1270
+ key: "getValidationError",
1271
+ value: function getValidationError() {
1272
+ if (window.intlTelInputUtils) {
1273
+ var iso2 = this.selectedCountryData.iso2;
1274
+ return intlTelInputUtils.getValidationError(this._getFullNumber(), iso2);
1275
+ }
1276
+ return -99;
1277
+ }
1278
+ }, {
1279
+ key: "isValidNumber",
1280
+ value: function isValidNumber() {
1281
+ var val = this._getFullNumber().trim();
1282
+ var countryCode = this.options.nationalMode ? this.selectedCountryData.iso2 : "";
1283
+ return window.intlTelInputUtils ? intlTelInputUtils.isValidNumber(val, countryCode) : null;
1284
+ }
1285
+ }, {
1286
+ key: "setCountry",
1287
+ value: function setCountry(originalCountryCode) {
1288
+ var countryCode = originalCountryCode.toLowerCase();
1289
+ // check if already selected
1290
+ if (!this.selectedFlagInner.classList.contains("iti__".concat(countryCode))) {
1291
+ this._setFlag(countryCode);
1292
+ this._updateDialCode(this.selectedCountryData.dialCode, false);
1293
+ this._triggerCountryChange();
1294
+ }
1295
+ }
1296
+ }, {
1297
+ key: "setNumber",
1298
+ value: function setNumber(number) {
1299
+ // we must update the flag first, which updates this.selectedCountryData, which is used for
1300
+ // formatting the number before displaying it
1301
+ var flagChanged = this._updateFlagFromNumber(number);
1302
+ this._updateValFromNumber(number);
1303
+ if (flagChanged) {
1304
+ this._triggerCountryChange();
1305
+ }
1306
+ }
1307
+ }, {
1308
+ key: "setPlaceholderNumberType",
1309
+ value: function setPlaceholderNumberType(type) {
1310
+ this.options.placeholderNumberType = type;
1311
+ this._updatePlaceholder();
1312
+ }
1313
+ } ]);
1314
+ return Iti;
1315
+ }();
1316
+ /********************
1317
+ * STATIC METHODS
1318
+ ********************/
1319
+ // get the country data object
1320
+ intlTelInputGlobals.getCountryData = function() {
1321
+ return allCountries;
1322
+ };
1323
+ // inject a <script> element to load utils.js
1324
+ var injectScript = function injectScript(path, handleSuccess, handleFailure) {
1325
+ // inject a new script element into the page
1326
+ var script = document.createElement("script");
1327
+ script.onload = function() {
1328
+ forEachInstance("handleUtils");
1329
+ if (handleSuccess) handleSuccess();
1330
+ };
1331
+ script.onerror = function() {
1332
+ forEachInstance("rejectUtilsScriptPromise");
1333
+ if (handleFailure) handleFailure();
1334
+ };
1335
+ script.className = "iti-load-utils";
1336
+ script.async = true;
1337
+ script.src = path;
1338
+ document.body.appendChild(script);
1339
+ };
1340
+ // load the utils script
1341
+ intlTelInputGlobals.loadUtils = function(path) {
1342
+ // 2 options:
1343
+ // 1) not already started loading (start)
1344
+ // 2) already started loading (do nothing - just wait for the onload callback to fire, which will
1345
+ // trigger handleUtils on all instances, invoking their resolveUtilsScriptPromise functions)
1346
+ if (!window.intlTelInputUtils && !window.intlTelInputGlobals.startedLoadingUtilsScript) {
1347
+ // only do this once
1348
+ window.intlTelInputGlobals.startedLoadingUtilsScript = true;
1349
+ // if we have promises, then return a promise
1350
+ if (typeof Promise !== "undefined") {
1351
+ return new Promise(function(resolve, reject) {
1352
+ return injectScript(path, resolve, reject);
1353
+ });
1354
+ }
1355
+ injectScript(path);
1356
+ }
1357
+ return null;
1358
+ };
1359
+ // default options
1360
+ intlTelInputGlobals.defaults = defaults;
1361
+ // version
1362
+ intlTelInputGlobals.version = "17.0.15";
1363
+ // convenience wrapper
1364
+ return function(input, options) {
1365
+ var iti = new Iti(input, options);
1366
+ iti._init();
1367
+ input.setAttribute("data-intl-tel-input-id", iti.id);
1368
+ window.intlTelInputGlobals.instances[iti.id] = iti;
1369
+ return iti;
1370
+ };
1371
+ }();
1372
+ });
1373
+ });
1374
+
1375
+ /**
1376
+ * Exposing intl-tel-input as a component
1377
+ */
1378
+ var intlTelInput = intlTelInput$1;
1379
+
1380
+ const sallaTelInputCss = "@charset \"UTF-8\";.iti{width:100%;position:relative;display:inline-block}.iti *{box-sizing:border-box;-moz-box-sizing:border-box}.iti__hide{display:none}.iti__v-hide{visibility:hidden}.iti input,.iti input[type=text],.iti input[type=tel]{position:relative;z-index:0;direction:ltr !important;margin-top:0 !important;margin-bottom:0 !important;padding-left:95px !important;padding-right:15px !important;margin-left:0 !important}.iti__flag-container{width:100%;position:absolute;top:0;bottom:0;left:0;padding:1px}.iti__selected-flag{width:80px;z-index:1;position:relative;display:flex;align-items:center;height:100%;float:left;padding:0 15px;box-shadow:none !important;outline:none !important}.ltr .iti__selected-flag{justify-content:flex-end}.iti__selected-flag:before{content:\"\";display:block;width:1px;height:70%;background:#eee;position:absolute;top:15%;right:0}.iti__selected-flag .iti__flag{display:none}.iti__arrow{width:15px;height:15px;line-height:15px;position:absolute;left:10px;top:50%;transform:translateY(-50%)}.iti__arrow:after{content:\"\";font-family:sallaicons;font-size:16px;color:#999;opacity:0.65}.iti__arrow--up:after{transform:rotate(180deg)}.iti__country-list{width:100%;max-height:160px;position:absolute;top:100%;left:0;z-index:2;list-style:none;margin:0;padding:0;margin:5px 0 0 0;border-radius:5px;box-shadow:0px 2px 4px 2px rgba(0, 0, 0, 0.05);border:1px solid #f5f7f9;background-color:white;white-space:nowrap;overflow:hidden;overflow-y:auto;-webkit-overflow-scrolling:touch}.iti__country-list::-webkit-scrollbar{width:4px}.dark .iti__country-list{background-color:#52525b;border-color:#52525b}.iti__country-list li{display:flex;align-items:center;justify-content:flex-start;flex-direction:row;padding:8px 10px;transition:background-color 0.3s}.iti__country-list li span{font-size:12px}.iti__country-list li:hover,.iti__country-list li.highlighted{background-color:rgba(0, 0, 0, 0.05)}.iti__country-list--dropup{bottom:100%;top:unset;margin:0 0 5px 0}@media (max-width: 500px){.iti__country-list{white-space:normal}}.iti__flag-box{display:inline-block;width:20px;margin:0 0 0 5px}.iti__divider{padding-bottom:5px;margin-bottom:5px;border-bottom:1px solid #eee}.iti__country{padding:5px 10px;outline:none}.iti__dial-code{font-family:Arial;color:#999;unicode-bidi:plaintext;letter-spacing:1px}.iti__country.iti__highlight{background-color:rgba(0, 0, 0, 0.05)}.iti__flag-box,.iti__country-name,.iti__dial-code{vertical-align:middle}.iti__country-name{flex:auto;margin:0;padding:0 10px;white-space:normal;line-height:1.3}.iti--allow-dropdown .iti__flag-container,.iti--separate-dial-code .iti__flag-container{left:0}.iti--allow-dropdown .iti__flag-container:hover{cursor:pointer}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover{cursor:default}.iti--allow-dropdown input[disabled]+.iti__flag-container:hover .iti__selected-flag,.iti--allow-dropdown input[readonly]+.iti__flag-container:hover .iti__selected-flag{background-color:transparent}.iti--separate-dial-code .iti__selected-dial-code{unicode-bidi:plaintext;direction:ltr;letter-spacing:1px;font-family:\"Arial\", serif;font-size:13px}.iti--container{position:absolute;top:-1000px;z-index:1060;padding:1px}.iti--container:hover{cursor:pointer}.iti-mobile .iti--container{inset:0;margin:20px;width:calc(100% - 40px);position:fixed;z-index:9999}.iti-mobile .iti__country-list{max-height:100%;width:100%;inset:0}.iti-mobile .iti__country{padding:10px 10px;line-height:1.5em}.iti__flag{width:20px}.iti__flag.iti__be{width:18px}.iti__flag.iti__ch{width:15px}.iti__flag.iti__mc{width:19px}.iti__flag.iti__ne{width:18px}.iti__flag.iti__np{width:13px}.iti__flag.iti__va{width:15px}@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi){.iti__flag{background-size:5652px 15px}}.iti__flag.iti__ac{height:10px;background-position:0px 0px}.iti__flag.iti__ad{height:14px;background-position:-22px 0px}.iti__flag.iti__ae{height:10px;background-position:-44px 0px}.iti__flag.iti__af{height:14px;background-position:-66px 0px}.iti__flag.iti__ag{height:14px;background-position:-88px 0px}.iti__flag.iti__ai{height:10px;background-position:-110px 0px}.iti__flag.iti__al{height:15px;background-position:-132px 0px}.iti__flag.iti__am{height:10px;background-position:-154px 0px}.iti__flag.iti__ao{height:14px;background-position:-176px 0px}.iti__flag.iti__aq{height:14px;background-position:-198px 0px}.iti__flag.iti__ar{height:13px;background-position:-220px 0px}.iti__flag.iti__as{height:10px;background-position:-242px 0px}.iti__flag.iti__at{height:14px;background-position:-264px 0px}.iti__flag.iti__au{height:10px;background-position:-286px 0px}.iti__flag.iti__aw{height:14px;background-position:-308px 0px}.iti__flag.iti__ax{height:13px;background-position:-330px 0px}.iti__flag.iti__az{height:10px;background-position:-352px 0px}.iti__flag.iti__ba{height:10px;background-position:-374px 0px}.iti__flag.iti__bb{height:14px;background-position:-396px 0px}.iti__flag.iti__bd{height:12px;background-position:-418px 0px}.iti__flag.iti__be{height:15px;background-position:-440px 0px}.iti__flag.iti__bf{height:14px;background-position:-460px 0px}.iti__flag.iti__bg{height:12px;background-position:-482px 0px}.iti__flag.iti__bh{height:12px;background-position:-504px 0px}.iti__flag.iti__bi{height:12px;background-position:-526px 0px}.iti__flag.iti__bj{height:14px;background-position:-548px 0px}.iti__flag.iti__bl{height:14px;background-position:-570px 0px}.iti__flag.iti__bm{height:10px;background-position:-592px 0px}.iti__flag.iti__bn{height:10px;background-position:-614px 0px}.iti__flag.iti__bo{height:14px;background-position:-636px 0px}.iti__flag.iti__bq{height:14px;background-position:-658px 0px}.iti__flag.iti__br{height:14px;background-position:-680px 0px}.iti__flag.iti__bs{height:10px;background-position:-702px 0px}.iti__flag.iti__bt{height:14px;background-position:-724px 0px}.iti__flag.iti__bv{height:15px;background-position:-746px 0px}.iti__flag.iti__bw{height:14px;background-position:-768px 0px}.iti__flag.iti__by{height:10px;background-position:-790px 0px}.iti__flag.iti__bz{height:14px;background-position:-812px 0px}.iti__flag.iti__ca{height:10px;background-position:-834px 0px}.iti__flag.iti__cc{height:10px;background-position:-856px 0px}.iti__flag.iti__cd{height:15px;background-position:-878px 0px}.iti__flag.iti__cf{height:14px;background-position:-900px 0px}.iti__flag.iti__cg{height:14px;background-position:-922px 0px}.iti__flag.iti__ch{height:15px;background-position:-944px 0px}.iti__flag.iti__ci{height:14px;background-position:-961px 0px}.iti__flag.iti__ck{height:10px;background-position:-983px 0px}.iti__flag.iti__cl{height:14px;background-position:-1005px 0px}.iti__flag.iti__cm{height:14px;background-position:-1027px 0px}.iti__flag.iti__cn{height:14px;background-position:-1049px 0px}.iti__flag.iti__co{height:14px;background-position:-1071px 0px}.iti__flag.iti__cp{height:14px;background-position:-1093px 0px}.iti__flag.iti__cr{height:12px;background-position:-1115px 0px}.iti__flag.iti__cu{height:10px;background-position:-1137px 0px}.iti__flag.iti__cv{height:12px;background-position:-1159px 0px}.iti__flag.iti__cw{height:14px;background-position:-1181px 0px}.iti__flag.iti__cx{height:10px;background-position:-1203px 0px}.iti__flag.iti__cy{height:14px;background-position:-1225px 0px}.iti__flag.iti__cz{height:14px;background-position:-1247px 0px}.iti__flag.iti__de{height:12px;background-position:-1269px 0px}.iti__flag.iti__dg{height:10px;background-position:-1291px 0px}.iti__flag.iti__dj{height:14px;background-position:-1313px 0px}.iti__flag.iti__dk{height:15px;background-position:-1335px 0px}.iti__flag.iti__dm{height:10px;background-position:-1357px 0px}.iti__flag.iti__do{height:14px;background-position:-1379px 0px}.iti__flag.iti__dz{height:14px;background-position:-1401px 0px}.iti__flag.iti__ea{height:14px;background-position:-1423px 0px}.iti__flag.iti__ec{height:14px;background-position:-1445px 0px}.iti__flag.iti__ee{height:13px;background-position:-1467px 0px}.iti__flag.iti__eg{height:14px;background-position:-1489px 0px}.iti__flag.iti__eh{height:10px;background-position:-1511px 0px}.iti__flag.iti__er{height:10px;background-position:-1533px 0px}.iti__flag.iti__es{height:14px;background-position:-1555px 0px}.iti__flag.iti__et{height:10px;background-position:-1577px 0px}.iti__flag.iti__eu{height:14px;background-position:-1599px 0px}.iti__flag.iti__fi{height:12px;background-position:-1621px 0px}.iti__flag.iti__fj{height:10px;background-position:-1643px 0px}.iti__flag.iti__fk{height:10px;background-position:-1665px 0px}.iti__flag.iti__fm{height:11px;background-position:-1687px 0px}.iti__flag.iti__fo{height:15px;background-position:-1709px 0px}.iti__flag.iti__fr{height:14px;background-position:-1731px 0px}.iti__flag.iti__ga{height:15px;background-position:-1753px 0px}.iti__flag.iti__gb{height:10px;background-position:-1775px 0px}.iti__flag.iti__gd{height:12px;background-position:-1797px 0px}.iti__flag.iti__ge{height:14px;background-position:-1819px 0px}.iti__flag.iti__gf{height:14px;background-position:-1841px 0px}.iti__flag.iti__gg{height:14px;background-position:-1863px 0px}.iti__flag.iti__gh{height:14px;background-position:-1885px 0px}.iti__flag.iti__gi{height:10px;background-position:-1907px 0px}.iti__flag.iti__gl{height:14px;background-position:-1929px 0px}.iti__flag.iti__gm{height:14px;background-position:-1951px 0px}.iti__flag.iti__gn{height:14px;background-position:-1973px 0px}.iti__flag.iti__gp{height:14px;background-position:-1995px 0px}.iti__flag.iti__gq{height:14px;background-position:-2017px 0px}.iti__flag.iti__gr{height:14px;background-position:-2039px 0px}.iti__flag.iti__gs{height:10px;background-position:-2061px 0px}.iti__flag.iti__gt{height:13px;background-position:-2083px 0px}.iti__flag.iti__gu{height:11px;background-position:-2105px 0px}.iti__flag.iti__gw{height:10px;background-position:-2127px 0px}.iti__flag.iti__gy{height:12px;background-position:-2149px 0px}.iti__flag.iti__hk{height:14px;background-position:-2171px 0px}.iti__flag.iti__hm{height:10px;background-position:-2193px 0px}.iti__flag.iti__hn{height:10px;background-position:-2215px 0px}.iti__flag.iti__hr{height:10px;background-position:-2237px 0px}.iti__flag.iti__ht{height:12px;background-position:-2259px 0px}.iti__flag.iti__hu{height:10px;background-position:-2281px 0px}.iti__flag.iti__ic{height:14px;background-position:-2303px 0px}.iti__flag.iti__id{height:14px;background-position:-2325px 0px}.iti__flag.iti__ie{height:10px;background-position:-2347px 0px}.iti__flag.iti__il{height:15px;background-position:-2369px 0px}.iti__flag.iti__im{height:10px;background-position:-2391px 0px}.iti__flag.iti__in{height:14px;background-position:-2413px 0px}.iti__flag.iti__io{height:10px;background-position:-2435px 0px}.iti__flag.iti__iq{height:14px;background-position:-2457px 0px}.iti__flag.iti__ir{height:12px;background-position:-2479px 0px}.iti__flag.iti__is{height:15px;background-position:-2501px 0px}.iti__flag.iti__it{height:14px;background-position:-2523px 0px}.iti__flag.iti__je{height:12px;background-position:-2545px 0px}.iti__flag.iti__jm{height:10px;background-position:-2567px 0px}.iti__flag.iti__jo{height:10px;background-position:-2589px 0px}.iti__flag.iti__jp{height:14px;background-position:-2611px 0px}.iti__flag.iti__ke{height:14px;background-position:-2633px 0px}.iti__flag.iti__kg{height:12px;background-position:-2655px 0px}.iti__flag.iti__kh{height:13px;background-position:-2677px 0px}.iti__flag.iti__ki{height:10px;background-position:-2699px 0px}.iti__flag.iti__km{height:12px;background-position:-2721px 0px}.iti__flag.iti__kn{height:14px;background-position:-2743px 0px}.iti__flag.iti__kp{height:10px;background-position:-2765px 0px}.iti__flag.iti__kr{height:14px;background-position:-2787px 0px}.iti__flag.iti__kw{height:10px;background-position:-2809px 0px}.iti__flag.iti__ky{height:10px;background-position:-2831px 0px}.iti__flag.iti__kz{height:10px;background-position:-2853px 0px}.iti__flag.iti__la{height:14px;background-position:-2875px 0px}.iti__flag.iti__lb{height:14px;background-position:-2897px 0px}.iti__flag.iti__lc{height:10px;background-position:-2919px 0px}.iti__flag.iti__li{height:12px;background-position:-2941px 0px}.iti__flag.iti__lk{height:10px;background-position:-2963px 0px}.iti__flag.iti__lr{height:11px;background-position:-2985px 0px}.iti__flag.iti__ls{height:14px;background-position:-3007px 0px}.iti__flag.iti__lt{height:12px;background-position:-3029px 0px}.iti__flag.iti__lu{height:12px;background-position:-3051px 0px}.iti__flag.iti__lv{height:10px;background-position:-3073px 0px}.iti__flag.iti__ly{height:10px;background-position:-3095px 0px}.iti__flag.iti__ma{height:14px;background-position:-3117px 0px}.iti__flag.iti__mc{height:15px;background-position:-3139px 0px}.iti__flag.iti__md{height:10px;background-position:-3160px 0px}.iti__flag.iti__me{height:10px;background-position:-3182px 0px}.iti__flag.iti__mf{height:14px;background-position:-3204px 0px}.iti__flag.iti__mg{height:14px;background-position:-3226px 0px}.iti__flag.iti__mh{height:11px;background-position:-3248px 0px}.iti__flag.iti__mk{height:10px;background-position:-3270px 0px}.iti__flag.iti__ml{height:14px;background-position:-3292px 0px}.iti__flag.iti__mm{height:14px;background-position:-3314px 0px}.iti__flag.iti__mn{height:10px;background-position:-3336px 0px}.iti__flag.iti__mo{height:14px;background-position:-3358px 0px}.iti__flag.iti__mp{height:10px;background-position:-3380px 0px}.iti__flag.iti__mq{height:14px;background-position:-3402px 0px}.iti__flag.iti__mr{height:14px;background-position:-3424px 0px}.iti__flag.iti__ms{height:10px;background-position:-3446px 0px}.iti__flag.iti__mt{height:14px;background-position:-3468px 0px}.iti__flag.iti__mu{height:14px;background-position:-3490px 0px}.iti__flag.iti__mv{height:14px;background-position:-3512px 0px}.iti__flag.iti__mw{height:14px;background-position:-3534px 0px}.iti__flag.iti__mx{height:12px;background-position:-3556px 0px}.iti__flag.iti__my{height:10px;background-position:-3578px 0px}.iti__flag.iti__mz{height:14px;background-position:-3600px 0px}.iti__flag.iti__na{height:14px;background-position:-3622px 0px}.iti__flag.iti__nc{height:10px;background-position:-3644px 0px}.iti__flag.iti__ne{height:15px;background-position:-3666px 0px}.iti__flag.iti__nf{height:10px;background-position:-3686px 0px}.iti__flag.iti__ng{height:10px;background-position:-3708px 0px}.iti__flag.iti__ni{height:12px;background-position:-3730px 0px}.iti__flag.iti__nl{height:14px;background-position:-3752px 0px}.iti__flag.iti__no{height:15px;background-position:-3774px 0px}.iti__flag.iti__np{height:15px;background-position:-3796px 0px}.iti__flag.iti__nr{height:10px;background-position:-3811px 0px}.iti__flag.iti__nu{height:10px;background-position:-3833px 0px}.iti__flag.iti__nz{height:10px;background-position:-3855px 0px}.iti__flag.iti__om{height:10px;background-position:-3877px 0px}.iti__flag.iti__pa{height:14px;background-position:-3899px 0px}.iti__flag.iti__pe{height:14px;background-position:-3921px 0px}.iti__flag.iti__pf{height:14px;background-position:-3943px 0px}.iti__flag.iti__pg{height:15px;background-position:-3965px 0px}.iti__flag.iti__ph{height:10px;background-position:-3987px 0px}.iti__flag.iti__pk{height:14px;background-position:-4009px 0px}.iti__flag.iti__pl{height:13px;background-position:-4031px 0px}.iti__flag.iti__pm{height:14px;background-position:-4053px 0px}.iti__flag.iti__pn{height:10px;background-position:-4075px 0px}.iti__flag.iti__pr{height:14px;background-position:-4097px 0px}.iti__flag.iti__ps{height:10px;background-position:-4119px 0px}.iti__flag.iti__pt{height:14px;background-position:-4141px 0px}.iti__flag.iti__pw{height:13px;background-position:-4163px 0px}.iti__flag.iti__py{height:11px;background-position:-4185px 0px}.iti__flag.iti__qa{height:8px;background-position:-4207px 0px}.iti__flag.iti__re{height:14px;background-position:-4229px 0px}.iti__flag.iti__ro{height:14px;background-position:-4251px 0px}.iti__flag.iti__rs{height:14px;background-position:-4273px 0px}.iti__flag.iti__ru{height:14px;background-position:-4295px 0px}.iti__flag.iti__rw{height:14px;background-position:-4317px 0px}.iti__flag.iti__sa{height:14px;background-position:-4339px 0px}.iti__flag.iti__sb{height:10px;background-position:-4361px 0px}.iti__flag.iti__sc{height:10px;background-position:-4383px 0px}.iti__flag.iti__sd{height:10px;background-position:-4405px 0px}.iti__flag.iti__se{height:13px;background-position:-4427px 0px}.iti__flag.iti__sg{height:14px;background-position:-4449px 0px}.iti__flag.iti__sh{height:10px;background-position:-4471px 0px}.iti__flag.iti__si{height:10px;background-position:-4493px 0px}.iti__flag.iti__sj{height:15px;background-position:-4515px 0px}.iti__flag.iti__sk{height:14px;background-position:-4537px 0px}.iti__flag.iti__sl{height:14px;background-position:-4559px 0px}.iti__flag.iti__sm{height:15px;background-position:-4581px 0px}.iti__flag.iti__sn{height:14px;background-position:-4603px 0px}.iti__flag.iti__so{height:14px;background-position:-4625px 0px}.iti__flag.iti__sr{height:14px;background-position:-4647px 0px}.iti__flag.iti__ss{height:10px;background-position:-4669px 0px}.iti__flag.iti__st{height:10px;background-position:-4691px 0px}.iti__flag.iti__sv{height:12px;background-position:-4713px 0px}.iti__flag.iti__sx{height:14px;background-position:-4735px 0px}.iti__flag.iti__sy{height:14px;background-position:-4757px 0px}.iti__flag.iti__sz{height:14px;background-position:-4779px 0px}.iti__flag.iti__ta{height:10px;background-position:-4801px 0px}.iti__flag.iti__tc{height:10px;background-position:-4823px 0px}.iti__flag.iti__td{height:14px;background-position:-4845px 0px}.iti__flag.iti__tf{height:14px;background-position:-4867px 0px}.iti__flag.iti__tg{height:13px;background-position:-4889px 0px}.iti__flag.iti__th{height:14px;background-position:-4911px 0px}.iti__flag.iti__tj{height:10px;background-position:-4933px 0px}.iti__flag.iti__tk{height:10px;background-position:-4955px 0px}.iti__flag.iti__tl{height:10px;background-position:-4977px 0px}.iti__flag.iti__tm{height:14px;background-position:-4999px 0px}.iti__flag.iti__tn{height:14px;background-position:-5021px 0px}.iti__flag.iti__to{height:10px;background-position:-5043px 0px}.iti__flag.iti__tr{height:14px;background-position:-5065px 0px}.iti__flag.iti__tt{height:12px;background-position:-5087px 0px}.iti__flag.iti__tv{height:10px;background-position:-5109px 0px}.iti__flag.iti__tw{height:14px;background-position:-5131px 0px}.iti__flag.iti__tz{height:14px;background-position:-5153px 0px}.iti__flag.iti__ua{height:14px;background-position:-5175px 0px}.iti__flag.iti__ug{height:14px;background-position:-5197px 0px}.iti__flag.iti__um{height:11px;background-position:-5219px 0px}.iti__flag.iti__un{height:14px;background-position:-5241px 0px}.iti__flag.iti__us{height:11px;background-position:-5263px 0px}.iti__flag.iti__uy{height:14px;background-position:-5285px 0px}.iti__flag.iti__uz{height:10px;background-position:-5307px 0px}.iti__flag.iti__va{height:15px;background-position:-5329px 0px}.iti__flag.iti__vc{height:14px;background-position:-5346px 0px}.iti__flag.iti__ve{height:14px;background-position:-5368px 0px}.iti__flag.iti__vg{height:10px;background-position:-5390px 0px}.iti__flag.iti__vi{height:14px;background-position:-5412px 0px}.iti__flag.iti__vn{height:14px;background-position:-5434px 0px}.iti__flag.iti__vu{height:12px;background-position:-5456px 0px}.iti__flag.iti__wf{height:14px;background-position:-5478px 0px}.iti__flag.iti__ws{height:10px;background-position:-5500px 0px}.iti__flag.iti__xk{height:15px;background-position:-5522px 0px}.iti__flag.iti__ye{height:14px;background-position:-5544px 0px}.iti__flag.iti__yt{height:14px;background-position:-5566px 0px}.iti__flag.iti__za{height:14px;background-position:-5588px 0px}.iti__flag.iti__zm{height:14px;background-position:-5610px 0px}.iti__flag.iti__zw{height:10px;background-position:-5632px 0px}.iti__flag{height:15px;box-shadow:0px 0px 1px 0px #888;background-image:url(\"https://intl-tel-input.com/node_modules/intl-tel-input/build/img/flags.png\");background-repeat:no-repeat;background-color:#f5f7f9;background-position:20px 0}@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi){.iti__flag{background-image:url(\"https://intl-tel-input.com/node_modules/intl-tel-input/build/img/flags@2x.png\")}}.iti__flag.iti__np{background-color:transparent}";
1381
+
1382
+ const SallaTelInput = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
1383
+ constructor() {
1384
+ super();
1385
+ this.__registerHost();
1386
+ this.enterClicked = createEvent(this, "enterClicked", 7);
1387
+ /**
1388
+ * Current country_code
1389
+ */
1390
+ this.countryCode = salla.config.get('user.country_code', 'SA');
1391
+ this.countryKey = "+966"; //TODO:: why we need it, if it's important find a way to get it automatically for the current user
1392
+ this.countryCodeLabel = salla.lang.get('common.country_code');
1393
+ this.mobileLabel = salla.lang.get('common.elements.mobile');
1394
+ this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
1395
+ this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });
1396
+ this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
1397
+ this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
1398
+ this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
1399
+ Helper.setHost(this.host);
1400
+ salla.event.on('languages::translations.loaded', () => {
1401
+ this.mobileLabel = salla.lang.get('common.elements.mobile');
1402
+ this.countryCodeLabel = salla.lang.get('common.country_code');
1403
+ this.invalidNumber = salla.lang.get('common.errors.invalid_value', { attribute: this.mobileLabel });
1404
+ this.invalidCountryCode = salla.lang.get('common.errors.invalid_value', { attribute: this.countryCodeLabel });
1405
+ this.tooShort = salla.lang.get('common.errors.too_short', { attribute: this.mobileLabel });
1406
+ this.tooLong = salla.lang.get('common.errors.too_long', { attribute: this.mobileLabel });
1407
+ this.mobileRequired = salla.lang.get('common.errors.field_required', { attribute: this.mobileLabel });
1408
+ this.errorMap = [this.invalidNumber, this.invalidCountryCode, this.tooShort, this.tooLong, this.invalidNumber];
1409
+ });
1410
+ }
1411
+ /**
1412
+ * Get current values
1413
+ * @return {{mobile:number,countryCode:'SA'|string, countryKey:'+966'|string}}
1414
+ */
1415
+ async getValues() {
1416
+ return {
1417
+ mobile: this.mobile = this.phoneInput.value,
1418
+ countryCode: this.countryCode = this.countryCodeInput.value,
1419
+ countryKey: this.countryKey = this.countryKeyInput.value
1420
+ };
1421
+ }
1422
+ /**
1423
+ * Is current data valid or not
1424
+ * @return {boolean}
1425
+ */
1426
+ async isValid() {
1427
+ this.reset();
1428
+ if (this.iti.isValidNumber())
1429
+ return true;
1430
+ if (!this.phoneInput.value.trim()) {
1431
+ this.phoneInput.classList.add("s-has-error");
1432
+ this.errorMsg.innerText = this.mobileRequired || '';
1433
+ return;
1434
+ }
1435
+ this.phoneInput.classList.add("s-has-error");
1436
+ let errorCode = this.iti.getValidationError();
1437
+ this.errorMsg.innerText = this.errorMap[errorCode] || '';
1438
+ return false;
1439
+ }
1440
+ initTelInput() {
1441
+ salla.helpers.inputDigitsOnly(this.phoneInput);
1442
+ this.iti = intlTelInput(this.phoneInput, {
1443
+ initialCountry: this.countryCode || 'sa',
1444
+ preferredCountries: ['sa', 'ae', 'kw', 'bh', 'qa', 'iq', 'om', 'ye', 'eg', 'jo', 'sy', 'ps', 'sd', 'lb', 'dz', 'tn', 'ma', 'ly'],
1445
+ formatOnDisplay: false,
1446
+ separateDialCode: true,
1447
+ autoPlaceholder: 'aggressive',
1448
+ utilsScript: 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.min.js',
1449
+ });
1450
+ this.phoneInput.addEventListener("countrychange", () => {
1451
+ let data = this.iti.getSelectedCountryData();
1452
+ this.countryCodeInput.value = data.iso2.toUpperCase();
1453
+ this.countryKeyInput.value = ('+' + data.dialCode).replace('++', '+');
1454
+ });
1455
+ // on blur: validate
1456
+ this.phoneInput.addEventListener('blur', () => this.isValid());
1457
+ // on keyup / change flag: reset
1458
+ this.phoneInput.addEventListener('input', e => {
1459
+ salla.helpers.inputDigitsOnly(e.target);
1460
+ this.reset();
1461
+ });
1462
+ }
1463
+ reset() {
1464
+ this.phoneInput.classList.remove("s-has-error");
1465
+ this.errorMsg.innerHTML = "";
1466
+ }
1467
+ ;
1468
+ render() {
1469
+ return (h(Host, { id: "s-tel-input" }, h("input", { type: "tel", name: "mobile", value: this.mobile, ref: el => this.phoneInput = el, class: "s-tel-input-control tel-input s-ltr" }), h("span", { class: "s-tel-input-error-msg", ref: el => this.errorMsg = el }), h("input", { type: "hidden", name: "country_code", value: this.countryCode, ref: el => this.countryCodeInput = el, class: "country_code" }), h("input", { type: "hidden", name: "country_key", value: this.countryKey, ref: el => this.countryKeyInput = el, class: "country_key" })));
1470
+ }
1471
+ componentDidLoad() {
1472
+ this.initTelInput();
1473
+ }
1474
+ get host() { return this; }
1475
+ static get style() { return sallaTelInputCss; }
1476
+ }, [0, "salla-tel-input", {
1477
+ "mobile": [1025],
1478
+ "countryCode": [1025, "country-code"],
1479
+ "countryKey": [1025, "country-key"],
1480
+ "mobileRequired": [32],
1481
+ "countryCodeLabel": [32],
1482
+ "mobileLabel": [32],
1483
+ "tooShort": [32],
1484
+ "tooLong": [32],
1485
+ "invalidCountryCode": [32],
1486
+ "invalidNumber": [32],
1487
+ "errorMap": [32],
1488
+ "getValues": [64],
1489
+ "isValid": [64]
1490
+ }]);
1491
+ function defineCustomElement() {
1492
+ if (typeof customElements === "undefined") {
1493
+ return;
1494
+ }
1495
+ const components = ["salla-tel-input"];
1496
+ components.forEach(tagName => { switch (tagName) {
1497
+ case "salla-tel-input":
1498
+ if (!customElements.get(tagName)) {
1499
+ customElements.define(tagName, SallaTelInput);
1500
+ }
1501
+ break;
1502
+ } });
1503
+ }
1504
+ defineCustomElement();
1505
+
1506
+ export { SallaTelInput as S, defineCustomElement as d };